Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed May 29, 2024
1 parent b11607d commit be39d40
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ void CGameSA::SetExtendedWaterCannonsEnabled(bool isEnabled)
{
char* currentCannon = (char*)currentACannons + i * SIZE_CWaterCannon;

((void(__thiscall*)(int, void*, bool))FUNC_CAESoundManager_CancelSoundsOwnedByAudioEntity)(STRUC_CAESoundManager, currentCannon + NUM_CWaterCannon_Audio_Offset, true); // CAESoundManager::CancelSoundsOwnedByAudioEntity to prevent random crashes from CAESound::UpdateParameters
((void(__thiscall*)(int, void*, bool))FUNC_CAESoundManager_CancelSoundsOwnedByAudioEntity)(STRUCT_CAESoundManager, currentCannon + NUM_CWaterCannon_Audio_Offset, true); // CAESoundManager::CancelSoundsOwnedByAudioEntity to prevent random crashes from CAESound::UpdateParameters
((void(__thiscall*)(void*))FUNC_CWaterCannon_Destructor)(currentCannon); // CWaterCannon::~CWaterCannon
}

Expand Down
4 changes: 2 additions & 2 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extern unsigned int OBJECTDYNAMICINFO_MAX; // default: 160
#define CHEAT_HEALTARMORMONEY "healtharmormoney"

#define FUNC_CAESoundManager_CancelSoundsOwnedByAudioEntity 0x4EFCD0
#define STRUC_CAESoundManager 0xB62CB0
#define STRUCT_CAESoundManager 0xB62CB0
#define FUNC_CWaterCannon_Constructor 0x728B10
#define FUNC_CWaterCannon_Destructor 0x728B30
#define FUNC_CWaterCannon_Init 0x728B40
Expand Down Expand Up @@ -364,8 +364,8 @@ class CGameSA : public CGame
bool m_areWaterCreaturesEnabled{true};
bool m_isBurnFlippedCarsEnabled{true};
bool m_isFireballDestructEnabled{true};
bool m_isExtendedWaterCannonsEnabled;
bool m_isRoadSignsTextEnabled{true};
bool m_isExtendedWaterCannonsEnabled{false};

static unsigned int& ClumpOffset;

Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CPacketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2387,8 +2387,8 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream)
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::WATERCREATURES, wsProps.data.watercreatures);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::BURNFLIPPEDCARS, wsProps.data.burnflippedcars);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FIREBALLDESTRUCT, wsProps.data2.fireballdestruct);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::EXTENDEDWATERCANNONS, wsProps.data3.extendedwatercannons);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::ROADSIGNSTEXT, wsProps.data3.roadsignstext);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::EXTENDEDWATERCANNONS, wsProps.data4.extendedwatercannons);

float fJetpackMaxHeight = 100;
if (!bitStream.Read(fJetpackMaxHeight))
Expand Down
2 changes: 1 addition & 1 deletion Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const
wsProps.data.watercreatures = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::WATERCREATURES);
wsProps.data.burnflippedcars = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::BURNFLIPPEDCARS);
wsProps.data2.fireballdestruct = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FIREBALLDESTRUCT);
wsProps.data3.extendedwatercannons = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::EXTENDEDWATERCANNONS);
wsProps.data3.roadsignstext = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::ROADSIGNSTEXT);
wsProps.data4.extendedwatercannons = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::EXTENDEDWATERCANNONS);
BitStream.Write(&wsProps);
}

Expand Down
2 changes: 1 addition & 1 deletion Shared/mods/deathmatch/logic/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ enum class WorldSpecialProperty
WATERCREATURES,
BURNFLIPPEDCARS,
FIREBALLDESTRUCT,
EXTENDEDWATERCANNONS,
ROADSIGNSTEXT,
EXTENDEDWATERCANNONS,
};
DECLARE_ENUM_CLASS(WorldSpecialProperty);

Expand Down
28 changes: 19 additions & 9 deletions Shared/sdk/net/SyncStructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
};
enum
{
BITCOUNT3 = 2
BITCOUNT3 = 1
};
enum
{
BITCOUNT4 = 1
};

bool Read(NetBitStreamInterface& bitStream)
Expand All @@ -2045,16 +2049,16 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
else
data2.fireballdestruct = true;

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons))
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data3), BITCOUNT3);
else
data3.extendedwatercannons = true;

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_RoadSignsText))
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data3), BITCOUNT3);
else
data3.roadsignstext = true;

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons))
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data4), BITCOUNT4);
else
data4.extendedwatercannons = true;

//// Example for adding item:
// if (bitStream.Can(eBitStreamVersion::YourProperty))
// isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data9), BITCOUNT9);
Expand All @@ -2069,10 +2073,12 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_FireballDestruct))
bitStream.WriteBits(reinterpret_cast<const char*>(&data2), BITCOUNT2);

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons))
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_RoadSignsText))
bitStream.WriteBits(reinterpret_cast<const char*>(&data3), BITCOUNT3);

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons))
bitStream.WriteBits(reinterpret_cast<const char*>(&data4), BITCOUNT4);

//// Example for adding item:
// if (bitStream.Can(eBitStreamVersion::YourProperty))
// bitStream.WriteBits(reinterpret_cast<const char*>(&data9), BITCOUNT9);
Expand Down Expand Up @@ -2102,10 +2108,14 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure

struct
{
bool extendedwatercannons : 1;
bool roadsignstext : 1;
} data3;

struct
{
bool extendedwatercannons : 1;
} data4;

SWorldSpecialPropertiesStateSync()
{
// Set default states
Expand All @@ -2122,8 +2132,8 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
data.watercreatures = true;
data.burnflippedcars = true;
data2.fireballdestruct = true;
data3.extendedwatercannons = true;
data3.roadsignstext = true;
data4.extendedwatercannons = true;
}
};

Expand Down
11 changes: 5 additions & 6 deletions Shared/sdk/net/bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,20 +539,19 @@ enum class eBitStreamVersion : unsigned short
// Send server name to player in CPlayerJoinCompletePacket
// 2023-10-12
CPlayerJoinCompletePacket_ServerName,


// Add "extendedwatercannons" to setWorldSpecialPropertyEnabled
// 2024-05-23
WorldSpecialProperty_ExtendedWaterCannons,

// Send weapon switch for other players
// 2023-01-13
OnPlayerWeaponSwitch_Remote,

// Add "roadsignstext" to setWorldSpecialPropertyEnabled
// 2024-05-23
// 2024-05-17
WorldSpecialProperty_RoadSignsText,

// Add "extendedwatercannons" to setWorldSpecialPropertyEnabled
// 2024-05-23
WorldSpecialProperty_ExtendedWaterCannons,

// This allows us to automatically increment the BitStreamVersion when things are added to this enum.
// Make sure you only add things above this comment.
Next,
Expand Down

0 comments on commit be39d40

Please sign in to comment.