diff --git a/Client/game_sa/CGameSA.cpp b/Client/game_sa/CGameSA.cpp index 804acc5717..43ea348489 100644 --- a/Client/game_sa/CGameSA.cpp +++ b/Client/game_sa/CGameSA.cpp @@ -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 } diff --git a/Client/game_sa/CGameSA.h b/Client/game_sa/CGameSA.h index ca8bcabed3..61c68de445 100644 --- a/Client/game_sa/CGameSA.h +++ b/Client/game_sa/CGameSA.h @@ -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 @@ -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; diff --git a/Client/mods/deathmatch/logic/CPacketHandler.cpp b/Client/mods/deathmatch/logic/CPacketHandler.cpp index 32b2130714..3828ae27ca 100644 --- a/Client/mods/deathmatch/logic/CPacketHandler.cpp +++ b/Client/mods/deathmatch/logic/CPacketHandler.cpp @@ -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)) diff --git a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp index df7b4c0d03..965d998905 100644 --- a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp @@ -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); } diff --git a/Shared/mods/deathmatch/logic/Enums.h b/Shared/mods/deathmatch/logic/Enums.h index d22b4495e6..9264678962 100644 --- a/Shared/mods/deathmatch/logic/Enums.h +++ b/Shared/mods/deathmatch/logic/Enums.h @@ -88,8 +88,8 @@ enum class WorldSpecialProperty WATERCREATURES, BURNFLIPPEDCARS, FIREBALLDESTRUCT, - EXTENDEDWATERCANNONS, ROADSIGNSTEXT, + EXTENDEDWATERCANNONS, }; DECLARE_ENUM_CLASS(WorldSpecialProperty); diff --git a/Shared/sdk/net/SyncStructures.h b/Shared/sdk/net/SyncStructures.h index c92313f209..636f90d8eb 100644 --- a/Shared/sdk/net/SyncStructures.h +++ b/Shared/sdk/net/SyncStructures.h @@ -2034,7 +2034,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure }; enum { - BITCOUNT3 = 2 + BITCOUNT3 = 1 + }; + enum + { + BITCOUNT4 = 1 }; bool Read(NetBitStreamInterface& bitStream) @@ -2045,16 +2049,16 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure else data2.fireballdestruct = true; - if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons)) - isOK &= bitStream.ReadBits(reinterpret_cast(&data3), BITCOUNT3); - else - data3.extendedwatercannons = true; - if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_RoadSignsText)) isOK &= bitStream.ReadBits(reinterpret_cast(&data3), BITCOUNT3); else data3.roadsignstext = true; + if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons)) + isOK &= bitStream.ReadBits(reinterpret_cast(&data4), BITCOUNT4); + else + data4.extendedwatercannons = true; + //// Example for adding item: // if (bitStream.Can(eBitStreamVersion::YourProperty)) // isOK &= bitStream.ReadBits(reinterpret_cast(&data9), BITCOUNT9); @@ -2069,10 +2073,12 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_FireballDestruct)) bitStream.WriteBits(reinterpret_cast(&data2), BITCOUNT2); - if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons)) if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_RoadSignsText)) bitStream.WriteBits(reinterpret_cast(&data3), BITCOUNT3); + if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons)) + bitStream.WriteBits(reinterpret_cast(&data4), BITCOUNT4); + //// Example for adding item: // if (bitStream.Can(eBitStreamVersion::YourProperty)) // bitStream.WriteBits(reinterpret_cast(&data9), BITCOUNT9); @@ -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 @@ -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; } }; diff --git a/Shared/sdk/net/bitstream.h b/Shared/sdk/net/bitstream.h index 57e14a0b01..d15ae4c657 100644 --- a/Shared/sdk/net/bitstream.h +++ b/Shared/sdk/net/bitstream.h @@ -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,