diff --git a/Client/game_sa/CWaterManagerSA.cpp b/Client/game_sa/CWaterManagerSA.cpp index e721e544dc..cce374e54b 100644 --- a/Client/game_sa/CWaterManagerSA.cpp +++ b/Client/game_sa/CWaterManagerSA.cpp @@ -742,17 +742,25 @@ bool CWaterManagerSA::SetPositionWaterLevel(const CVector& vecPosition, float fL return SetPolyWaterLevel(pPoly, fLevel, pChangeSource); } -bool CWaterManagerSA::SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel) +bool CWaterManagerSA::SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel) { assert(m_bInitializedVertices); CVector vecVertexPos; - for (DWORD i = 0; i < NUM_DefWaterVertices; i++) + + if (bIncludeWorldSeaLevel || bIncludeWorldNonSeaLevel) { - m_Vertices[i].GetPosition(vecVertexPos); - if (bIncludeWorldNonSeaLevel || !m_Vertices[i].IsWorldNonSeaLevel()) - vecVertexPos.fZ = fLevel; - m_Vertices[i].SetPosition(vecVertexPos, pChangeSource); + for (DWORD i = 0; i < NUM_DefWaterVertices; i++) + { + m_Vertices[i].GetPosition(vecVertexPos); + if ((bIncludeWorldNonSeaLevel && m_Vertices[i].IsWorldNonSeaLevel()) || (bIncludeWorldSeaLevel && !m_Vertices[i].IsWorldNonSeaLevel())) + vecVertexPos.fZ = fLevel; + m_Vertices[i].SetPosition(vecVertexPos, pChangeSource); + } } + + if (bIncludeOutsideWorldLevel) + SetOutsideWorldWaterLevel(fLevel); + return true; } @@ -768,6 +776,17 @@ bool CWaterManagerSA::SetPolyWaterLevel(CWaterPoly* pPoly, float fLevel, void* p return true; } +void CWaterManagerSA::SetOutsideWorldWaterLevel(float fLevel) +{ + // Outside world vertices + MemPut(0x6EFECC, fLevel); + MemPut(0x6EFF0C, fLevel); + MemPut(0x6EFF4A, fLevel); + MemPut(0x6EFFA6, fLevel); + // Collision + MemPut(0x6E873F, fLevel); +} + float CWaterManagerSA::GetWaveLevel() { return *(float*)VAR_WaveLevel; @@ -957,6 +976,8 @@ void CWaterManagerSA::ResetWorldWaterLevel() if (m_bInitializedVertices) for (DWORD i = 0; i < NUM_DefWaterVertices; i++) m_Vertices[i].Reset(); + + SetOutsideWorldWaterLevel(DEFAULT_WATER_LEVEL); } void CWaterManagerSA::Reset() @@ -964,6 +985,8 @@ void CWaterManagerSA::Reset() // Resets all water to the original single player configuration UndoChanges(); + SetOutsideWorldWaterLevel(DEFAULT_WATER_LEVEL); + MemSetFast(m_QuadPool, 0, sizeof(m_QuadPool)); MemSetFast(m_TrianglePool, 0, sizeof(m_TrianglePool)); diff --git a/Client/game_sa/CWaterManagerSA.h b/Client/game_sa/CWaterManagerSA.h index bbb5d43d22..ff3a3b364b 100644 --- a/Client/game_sa/CWaterManagerSA.h +++ b/Client/game_sa/CWaterManagerSA.h @@ -13,6 +13,7 @@ #include "CWaterSA.h" +#define DEFAULT_WATER_LEVEL 0.0f #define DEFAULT_WAVE_LEVEL 0.0f #define FUNC_ReadWaterConfiguration 0x6EAE80 // () @@ -154,9 +155,10 @@ class CWaterManagerSA : public CWaterManager bool GetWaterLevel(const CVector& vecPosition, float* pfLevel, bool bCheckWaves, CVector* pvecUnknown); - bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel); + bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel); bool SetPositionWaterLevel(const CVector& vecPosition, float fLevel, void* pChangeSource); bool SetPolyWaterLevel(CWaterPoly* pPoly, float fLevel, void* pChangeSource); + void SetOutsideWorldWaterLevel(float fLevel); void ResetWorldWaterLevel(); float GetWaveLevel(); diff --git a/Client/mods/deathmatch/logic/CClientWaterManager.cpp b/Client/mods/deathmatch/logic/CClientWaterManager.cpp index 195a0f6f47..22e96e8a70 100644 --- a/Client/mods/deathmatch/logic/CClientWaterManager.cpp +++ b/Client/mods/deathmatch/logic/CClientWaterManager.cpp @@ -88,9 +88,9 @@ bool CClientWaterManager::SetPositionWaterLevel(const CVector& vecPosition, floa return g_pGame->GetWaterManager()->SetPositionWaterLevel(vecPosition, fLevel, pChangeSource); } -bool CClientWaterManager::SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel) +bool CClientWaterManager::SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel) { - return g_pGame->GetWaterManager()->SetWorldWaterLevel(fLevel, pChangeSource, bIncludeWorldNonSeaLevel); + return g_pGame->GetWaterManager()->SetWorldWaterLevel(fLevel, pChangeSource, bIncludeWorldNonSeaLevel, bIncludeWorldSeaLevel, bIncludeOutsideWorldLevel); } bool CClientWaterManager::SetAllElementWaterLevel(float fLevel, void* pChangeSource) diff --git a/Client/mods/deathmatch/logic/CClientWaterManager.h b/Client/mods/deathmatch/logic/CClientWaterManager.h index c8ce98ebc6..e072b91732 100644 --- a/Client/mods/deathmatch/logic/CClientWaterManager.h +++ b/Client/mods/deathmatch/logic/CClientWaterManager.h @@ -29,7 +29,7 @@ class CClientWaterManager bool GetWaterLevel(CVector& vecPosition, float* pfLevel, bool bCheckWaves, CVector* pvecUnknown); bool SetPositionWaterLevel(const CVector& vecPosition, float fLevel, void* pChangeSource); - bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel); + bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel); bool SetAllElementWaterLevel(float fLevel, void* pChangeSource); void ResetWorldWaterLevel(); diff --git a/Client/mods/deathmatch/logic/CPacketHandler.cpp b/Client/mods/deathmatch/logic/CPacketHandler.cpp index ca1a545648..be629ed8bb 100644 --- a/Client/mods/deathmatch/logic/CPacketHandler.cpp +++ b/Client/mods/deathmatch/logic/CPacketHandler.cpp @@ -2230,18 +2230,32 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream) float fSeaLevel = 0.0f; bool bHasNonSeaLevel = false; float fNonSeaLevel = 0.0f; + bool bHasOutsideLevel = false; + float fOutsideLevel = 0.0f; bitStream.Read(fSeaLevel); bitStream.ReadBit(bHasNonSeaLevel); if (bHasNonSeaLevel) + { bitStream.Read(fNonSeaLevel); - + } + if (bitStream.Can(eBitStreamVersion::SetWaterLevel_ChangeOutsideWorldLevel)) + { + bitStream.ReadBit(bHasOutsideLevel); + if (bHasOutsideLevel) + { + bitStream.Read(fOutsideLevel); + } + } // Reset world water level to GTA default g_pClientGame->GetManager()->GetWaterManager()->ResetWorldWaterLevel(); // Apply world non-sea level (to all world water) if (bHasNonSeaLevel) - g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fNonSeaLevel, NULL, true); + g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fNonSeaLevel, nullptr, true, false, false); + // Apply outside world level (before -3000 and after 3000) + if (bHasOutsideLevel) + g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fOutsideLevel, nullptr, false, false, true); // Apply world sea level (to world sea level water only) - g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fSeaLevel, NULL, false); + g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fSeaLevel, nullptr, false, true, false); unsigned short usFPSLimit = 36; bitStream.ReadCompressed(usFPSLimit); diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 9cdb305b35..fed607c054 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -6308,9 +6308,9 @@ bool CStaticFunctionDefinitions::GetWaterVertexPosition(CClientWater* pWater, in return pWater->GetVertexPosition(iVertexIndex - 1, vecPosition); } -bool CStaticFunctionDefinitions::SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel) +bool CStaticFunctionDefinitions::SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel) { - return g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fLevel, pChangeSource, bIncludeWorldNonSeaLevel); + return g_pClientGame->GetManager()->GetWaterManager()->SetWorldWaterLevel(fLevel, pChangeSource, bIncludeWorldNonSeaLevel, bIncludeWorldSeaLevel, bIncludeOutsideWorldLevel); } bool CStaticFunctionDefinitions::SetPositionWaterLevel(const CVector& vecPosition, float fLevel, void* pChangeSource) diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h index d8fc31326f..9e208c6c45 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h @@ -571,7 +571,7 @@ class CStaticFunctionDefinitions static bool GetWaterLevel(CVector& vecPosition, float& fLevel, bool bCheckWaves, CVector& vecUnknown); static bool GetWaterLevel(CClientWater* pWater, float& fLevel); static bool GetWaterVertexPosition(CClientWater* pWater, int iVertexIndex, CVector& vecPosition); - static bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel); + static bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel); static bool SetPositionWaterLevel(const CVector& vecPosition, float fLevel, void* pChangeSource); static bool SetAllElementWaterLevel(float fLevel, void* pChangeSource); static bool ResetWorldWaterLevel(); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp index 4666c84b3e..9da9d15723 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp @@ -240,20 +240,24 @@ int CLuaWaterDefs::SetWaterLevel(lua_State* luaVM) else { // Call type 3 - // bool setWaterLevel ( float level, bool bIncludeWorldNonSeaLevel, bool bIncludeAllWaterElements ) + // bool setWaterLevel ( float level, bool bIncludeWorldNonSeaLevel, bool bIncludeAllWaterElements, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel ) float fLevel; bool bIncludeWorldNonSeaLevel; bool bIncludeAllWaterElements; + bool bIncludeWorldSeaLevel; + bool bIncludeOutsideWorldLevel; argStream.ReadNumber(fLevel); argStream.ReadBool(bIncludeWorldNonSeaLevel, true); argStream.ReadBool(bIncludeAllWaterElements, true); + argStream.ReadBool(bIncludeWorldSeaLevel, true); + argStream.ReadBool(bIncludeOutsideWorldLevel, false); if (!argStream.HasErrors()) { if (bIncludeAllWaterElements) CStaticFunctionDefinitions::SetAllElementWaterLevel(fLevel, pResource); - if (CStaticFunctionDefinitions::SetWorldWaterLevel(fLevel, pResource, bIncludeWorldNonSeaLevel)) + if (CStaticFunctionDefinitions::SetWorldWaterLevel(fLevel, pResource, bIncludeWorldNonSeaLevel, bIncludeWorldSeaLevel, bIncludeOutsideWorldLevel)) { lua_pushboolean(luaVM, true); return 1; diff --git a/Client/mods/deathmatch/logic/rpc/CWaterRPCs.cpp b/Client/mods/deathmatch/logic/rpc/CWaterRPCs.cpp index a4407e0db1..e387ee831f 100644 --- a/Client/mods/deathmatch/logic/rpc/CWaterRPCs.cpp +++ b/Client/mods/deathmatch/logic/rpc/CWaterRPCs.cpp @@ -26,11 +26,18 @@ void CWaterRPCs::LoadFunctions() void CWaterRPCs::SetWorldWaterLevel(NetBitStreamInterface& bitStream) { float fLevel; - bool bIncludeWorldNonSeaLevel; + bool bIncludeWorldNonSeaLevel = true; + bool bIncludeWorldSeaLevel = true; + bool bIncludeOutsideWorldLevel = false; if (bitStream.Read(fLevel) && bitStream.ReadBit(bIncludeWorldNonSeaLevel)) { - m_pWaterManager->SetWorldWaterLevel(fLevel, NULL, bIncludeWorldNonSeaLevel); + if (bitStream.Can(eBitStreamVersion::SetWaterLevel_ChangeOutsideWorldLevel)) + { + bitStream.ReadBit(bIncludeWorldSeaLevel); + bitStream.ReadBit(bIncludeOutsideWorldLevel); + } + m_pWaterManager->SetWorldWaterLevel(fLevel, nullptr, bIncludeWorldNonSeaLevel, bIncludeWorldSeaLevel, bIncludeOutsideWorldLevel); } } diff --git a/Client/sdk/game/CWaterManager.h b/Client/sdk/game/CWaterManager.h index feac1fa4eb..57e4dfb907 100644 --- a/Client/sdk/game/CWaterManager.h +++ b/Client/sdk/game/CWaterManager.h @@ -21,7 +21,7 @@ class CWaterManager virtual bool DeletePoly(CWaterPoly* pPoly) = 0; virtual bool GetWaterLevel(const CVector& vecPosition, float* pfLevel, bool bCheckWaves, CVector* pvecUnknown) = 0; - virtual bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel) = 0; + virtual bool SetWorldWaterLevel(float fLevel, void* pChangeSource, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel) = 0; virtual bool SetPositionWaterLevel(const CVector& vecPosition, float fLevel, void* pChangeSource) = 0; virtual bool SetPolyWaterLevel(CWaterPoly* pPoly, float fLevel, void* pChangeSource) = 0; virtual void ResetWorldWaterLevel() = 0; diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 5d12cd3439..2392b34bea 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -9161,13 +9161,15 @@ bool CStaticFunctionDefinitions::SetAllElementWaterLevel(float fLevel) return true; } -bool CStaticFunctionDefinitions::SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel) +bool CStaticFunctionDefinitions::SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel) { - g_pGame->GetWaterManager()->SetWorldWaterLevel(fLevel, bIncludeWorldNonSeaLevel); + g_pGame->GetWaterManager()->SetWorldWaterLevel(fLevel, bIncludeWorldNonSeaLevel, bIncludeWorldSeaLevel, bIncludeOutsideWorldLevel); CBitStream BitStream; BitStream.pBitStream->Write(fLevel); BitStream.pBitStream->WriteBit(bIncludeWorldNonSeaLevel); + BitStream.pBitStream->WriteBit(bIncludeWorldSeaLevel); + BitStream.pBitStream->WriteBit(bIncludeOutsideWorldLevel); m_pPlayerManager->BroadcastOnlyJoined(CLuaPacket(SET_WORLD_WATER_LEVEL, *BitStream.pBitStream)); return true; } diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h index 11f25655fa..b700696ac7 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h @@ -547,7 +547,7 @@ class CStaticFunctionDefinitions static CWater* CreateWater(CResource* pResource, CVector* pV1, CVector* pV2, CVector* pV3, CVector* pV4, bool bShallow); static bool SetElementWaterLevel(CWater* pWater, float fLevel); static bool SetAllElementWaterLevel(float fLevel); - static bool SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel); + static bool SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel); static bool ResetWorldWaterLevel(); static bool GetWaterVertexPosition(CWater* pWater, int iVertexIndex, CVector& vecPosition); static bool SetWaterVertexPosition(CWater* pWater, int iVertexIndex, CVector& vecPosition); diff --git a/Server/mods/deathmatch/logic/CWaterManager.cpp b/Server/mods/deathmatch/logic/CWaterManager.cpp index 16c705322c..77025ccdd5 100644 --- a/Server/mods/deathmatch/logic/CWaterManager.cpp +++ b/Server/mods/deathmatch/logic/CWaterManager.cpp @@ -14,8 +14,10 @@ CWaterManager::CWaterManager() { m_WorldWaterLevelInfo.bNonSeaLevelSet = false; + m_WorldWaterLevelInfo.bOutsideLevelSet = false; m_WorldWaterLevelInfo.fSeaLevel = 0; m_WorldWaterLevelInfo.fNonSeaLevel = 0; + m_WorldWaterLevelInfo.fOutsideLevel = 0; m_fGlobalWaveHeight = 0.0f; } @@ -64,21 +66,31 @@ void CWaterManager::SetAllElementWaterLevel(float fLevel) } } -void CWaterManager::SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel) +void CWaterManager::SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel) { - m_WorldWaterLevelInfo.fSeaLevel = fLevel; + if (bIncludeWorldSeaLevel) + { + m_WorldWaterLevelInfo.fSeaLevel = fLevel; + } if (bIncludeWorldNonSeaLevel) { m_WorldWaterLevelInfo.bNonSeaLevelSet = true; m_WorldWaterLevelInfo.fNonSeaLevel = fLevel; } + if (bIncludeOutsideWorldLevel) + { + m_WorldWaterLevelInfo.bOutsideLevelSet = true; + m_WorldWaterLevelInfo.fOutsideLevel = fLevel; + } } void CWaterManager::ResetWorldWaterLevel() { m_WorldWaterLevelInfo.bNonSeaLevelSet = false; + m_WorldWaterLevelInfo.bOutsideLevelSet = false; m_WorldWaterLevelInfo.fSeaLevel = 0; m_WorldWaterLevelInfo.fNonSeaLevel = 0; + m_WorldWaterLevelInfo.fOutsideLevel = 0; } void CWaterManager::DeleteAll() diff --git a/Server/mods/deathmatch/logic/CWaterManager.h b/Server/mods/deathmatch/logic/CWaterManager.h index b8adbec585..b05a3cfe5c 100644 --- a/Server/mods/deathmatch/logic/CWaterManager.h +++ b/Server/mods/deathmatch/logic/CWaterManager.h @@ -32,7 +32,7 @@ class CWaterManager void SetGlobalWaveHeight(float fHeight) { m_fGlobalWaveHeight = fHeight; } const SWorldWaterLevelInfo& GetWorldWaterLevelInfo() const { return m_WorldWaterLevelInfo; } - void SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel); + void SetWorldWaterLevel(float fLevel, bool bIncludeWorldNonSeaLevel, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel); void ResetWorldWaterLevel(); void SetElementWaterLevel(CWater* pWater, float fLevel); void SetAllElementWaterLevel(float fLevel); diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp index 289821f5bc..2a4e38c0ae 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp @@ -130,20 +130,24 @@ int CLuaWaterDefs::SetWaterLevel(lua_State* luaVM) else { // Call type 2 - // bool setWaterLevel ( float level, bool bIncludeWorldNonSeaLevel, bool bIncludeAllWaterElements ) + // bool setWaterLevel ( float level, bool bIncludeWorldNonSeaLevel, bool bIncludeAllWaterElements, bool bIncludeWorldSeaLevel, bool bIncludeOutsideWorldLevel ) float fLevel; bool bIncludeWorldNonSeaLevel; bool bIncludeAllWaterElements; + bool bIncludeWorldSeaLevel; + bool bIncludeOutsideWorldLevel; argStream.ReadNumber(fLevel); argStream.ReadBool(bIncludeWorldNonSeaLevel, true); argStream.ReadBool(bIncludeAllWaterElements, true); + argStream.ReadBool(bIncludeWorldSeaLevel, true); + argStream.ReadBool(bIncludeOutsideWorldLevel, false); if (!argStream.HasErrors()) { if (bIncludeAllWaterElements) CStaticFunctionDefinitions::SetAllElementWaterLevel(fLevel); - if (CStaticFunctionDefinitions::SetWorldWaterLevel(fLevel, bIncludeWorldNonSeaLevel)) + if (CStaticFunctionDefinitions::SetWorldWaterLevel(fLevel, bIncludeWorldNonSeaLevel, bIncludeWorldSeaLevel, bIncludeOutsideWorldLevel)) { lua_pushboolean(luaVM, true); return 1; diff --git a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp index f7a38a11bc..3e45e9b36e 100644 --- a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp @@ -133,8 +133,17 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const BitStream.Write(m_WorldWaterLevelInfo.fSeaLevel); BitStream.WriteBit(m_WorldWaterLevelInfo.bNonSeaLevelSet); if (m_WorldWaterLevelInfo.bNonSeaLevelSet) + { BitStream.Write(m_WorldWaterLevelInfo.fNonSeaLevel); - + } + if (BitStream.Can(eBitStreamVersion::SetWaterLevel_ChangeOutsideWorldLevel)) + { + BitStream.WriteBit(m_WorldWaterLevelInfo.bOutsideLevelSet); + if (m_WorldWaterLevelInfo.bOutsideLevelSet) + { + BitStream.Write(m_WorldWaterLevelInfo.fOutsideLevel); + } + } BitStream.WriteCompressed(m_usFPSLimit); // Write the garage states diff --git a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.h b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.h index 1f4de78058..263c046886 100644 --- a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.h +++ b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.h @@ -16,8 +16,10 @@ struct SWorldWaterLevelInfo { bool bNonSeaLevelSet; + bool bOutsideLevelSet; float fSeaLevel; float fNonSeaLevel; + float fOutsideLevel; }; class CMapInfoPacket : public CPacket diff --git a/Shared/sdk/net/bitstream.h b/Shared/sdk/net/bitstream.h index dc1295fb77..890546a180 100644 --- a/Shared/sdk/net/bitstream.h +++ b/Shared/sdk/net/bitstream.h @@ -444,6 +444,10 @@ enum class eBitStreamVersion : unsigned short // 1.5.8 RELEASED - 2020-10-11 // + // setWaterLevel: add bIncludeWorldSeaLevel and bIncludeOutsideWorldLevel + // 2020-11-03 0x70 + SetWaterLevel_ChangeOutsideWorldLevel, + // 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,