Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ void CGameSA::SetCoronaZTestEnabled(bool isEnabled)
m_isCoronaZTestEnabled = isEnabled;
}

void CGameSA::SetWaterCreaturesEnabled(bool isEnabled)
void CGameSA::SetWaterCreaturesEnabled(bool isEnabled)
{
if (isEnabled == m_areWaterCreaturesEnabled)
return;
Expand All @@ -684,6 +684,29 @@ void CGameSA::SetWaterCreaturesEnabled(bool isEnabled)
m_areWaterCreaturesEnabled = isEnabled;
}

void CGameSA::SetTunnelWeatherBlendEnabled(bool isEnabled)
{
if (isEnabled == m_isTunnelWeatherBlendEnabled)
return;
// CWeather::UpdateInTunnelness
DWORD functionAddress = 0x72B630;
if (isEnabled)
{
// Restore original bytes: 83 EC 20
MemPut<BYTE>(functionAddress, 0x83); // Restore 83
MemPut<BYTE>(functionAddress + 1, 0xEC); // Restore EC
MemPut<BYTE>(functionAddress + 2, 0x20); // Restore 20
}
else
{
// Patch CWeather::UpdateInTunnelness (Found By AlexTMjugador)
MemPut<BYTE>(functionAddress, 0xC3); // Write C3 (RET)
MemPut<BYTE>(functionAddress + 1, 0x90); // Write 90 (NOP)
MemPut<BYTE>(functionAddress + 2, 0x90); // Write 90 (NOP)
}
m_isTunnelWeatherBlendEnabled = isEnabled;
}

void CGameSA::SetBurnFlippedCarsEnabled(bool isEnabled)
{
if (isEnabled == m_isBurnFlippedCarsEnabled)
Expand Down
5 changes: 5 additions & 0 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ class CGameSA : public CGame
bool IsRoadSignsTextEnabled() const noexcept override { return m_isRoadSignsTextEnabled; }
void SetRoadSignsTextEnabled(bool isEnabled) override;

bool IsTunnelWeatherBlendEnabled() const noexcept override { return m_isTunnelWeatherBlendEnabled; }
void SetTunnelWeatherBlendEnabled(bool isEnabled) override;


unsigned long GetMinuteDuration();
void SetMinuteDuration(unsigned long ulTime);

Expand Down Expand Up @@ -363,6 +367,7 @@ class CGameSA : public CGame
int m_iCheckStatus;
bool m_bUnderworldWarp;
bool m_isCoronaZTestEnabled{true};
bool m_isTunnelWeatherBlendEnabled{true};
bool m_areWaterCreaturesEnabled{true};
bool m_isBurnFlippedCarsEnabled{true};
bool m_isFireballDestructEnabled{true};
Expand Down
5 changes: 5 additions & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6108,6 +6108,9 @@ bool CClientGame::SetWorldSpecialProperty(WorldSpecialProperty property, bool is
case WorldSpecialProperty::ROADSIGNSTEXT:
g_pGame->SetRoadSignsTextEnabled(isEnabled);
return true;
case WorldSpecialProperty::TUNNELWEATHERBLEND:
g_pGame->SetTunnelWeatherBlendEnabled(isEnabled);
return true;
}
return false;
}
Expand Down Expand Up @@ -6143,6 +6146,8 @@ bool CClientGame::IsWorldSpecialProperty(WorldSpecialProperty property)
return g_pGame->IsExtendedWaterCannonsEnabled();
case WorldSpecialProperty::ROADSIGNSTEXT:
return g_pGame->IsRoadSignsTextEnabled();
case WorldSpecialProperty::TUNNELWEATHERBLEND:
return g_pGame->IsTunnelWeatherBlendEnabled();
}
return false;
}
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CPacketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2390,6 +2390,7 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream)
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FIREBALLDESTRUCT, wsProps.data2.fireballdestruct);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::ROADSIGNSTEXT, wsProps.data3.roadsignstext);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::EXTENDEDWATERCANNONS, wsProps.data4.extendedwatercannons);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::TUNNELWEATHERBLEND, wsProps.data5.tunnelweatherblend);

float fJetpackMaxHeight = 100;
if (!bitStream.Read(fJetpackMaxHeight))
Expand Down
4 changes: 4 additions & 0 deletions Client/sdk/game/CGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ class __declspec(novtable) CGame
virtual bool IsRoadSignsTextEnabled() const noexcept = 0;
virtual void SetRoadSignsTextEnabled(bool isEnabled) = 0;

virtual bool IsTunnelWeatherBlendEnabled() const noexcept = 0;
virtual void SetTunnelWeatherBlendEnabled(bool isEnabled) = 0;

virtual CWeapon* CreateWeapon() = 0;
virtual CWeaponStat* CreateWeaponStat(eWeaponType weaponType, eWeaponSkill weaponSkill) = 0;

Expand Down Expand Up @@ -269,4 +272,5 @@ class __declspec(novtable) CGame
virtual void RestoreGameBuildings() = 0;

virtual bool SetBuildingPoolSize(size_t size) = 0;

};
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
m_WorldSpecialProps[WorldSpecialProperty::FIREBALLDESTRUCT] = true;
m_WorldSpecialProps[WorldSpecialProperty::EXTENDEDWATERCANNONS] = true;
m_WorldSpecialProps[WorldSpecialProperty::ROADSIGNSTEXT] = true;
m_WorldSpecialProps[WorldSpecialProperty::TUNNELWEATHERBLEND] = true;

m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true;
m_JetpackWeapons[WEAPONTYPE_TEC9] = true;
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const
wsProps.data2.fireballdestruct = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FIREBALLDESTRUCT);
wsProps.data3.roadsignstext = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::ROADSIGNSTEXT);
wsProps.data4.extendedwatercannons = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::EXTENDEDWATERCANNONS);
wsProps.data5.tunnelweatherblend = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::TUNNELWEATHERBLEND);
BitStream.Write(&wsProps);
}

Expand Down
1 change: 1 addition & 0 deletions Shared/mods/deathmatch/logic/Enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ ADD_ENUM(WorldSpecialProperty::BURNFLIPPEDCARS, "burnflippedcars")
ADD_ENUM(WorldSpecialProperty::FIREBALLDESTRUCT, "fireballdestruct")
ADD_ENUM(WorldSpecialProperty::EXTENDEDWATERCANNONS, "extendedwatercannons")
ADD_ENUM(WorldSpecialProperty::ROADSIGNSTEXT, "roadsignstext")
ADD_ENUM(WorldSpecialProperty::TUNNELWEATHERBLEND, "tunnelweatherblend")
IMPLEMENT_ENUM_CLASS_END("world-special-property")

IMPLEMENT_ENUM_BEGIN(ePacketID)
Expand Down
1 change: 1 addition & 0 deletions Shared/mods/deathmatch/logic/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ enum class WorldSpecialProperty
FIREBALLDESTRUCT,
ROADSIGNSTEXT,
EXTENDEDWATERCANNONS,
TUNNELWEATHERBLEND,
};
DECLARE_ENUM_CLASS(WorldSpecialProperty);

Expand Down
18 changes: 18 additions & 0 deletions Shared/sdk/net/SyncStructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,10 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
{
BITCOUNT4 = 1
};
enum
{
BITCOUNT5 = 1
};

bool Read(NetBitStreamInterface& bitStream)
{
Expand All @@ -2059,6 +2063,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
else
data4.extendedwatercannons = true;

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_TunnelWeatherBlend))
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data5), BITCOUNT5);
else
data5.tunnelweatherblend = true;

//// Example for adding item:
// if (bitStream.Can(eBitStreamVersion::YourProperty))
// isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data9), BITCOUNT9);
Expand All @@ -2079,6 +2088,9 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_ExtendedWaterCannons))
bitStream.WriteBits(reinterpret_cast<const char*>(&data4), BITCOUNT4);

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_TunnelWeatherBlend))
bitStream.WriteBits(reinterpret_cast<const char*>(&data5), BITCOUNT5);

//// Example for adding item:
// if (bitStream.Can(eBitStreamVersion::YourProperty))
// bitStream.WriteBits(reinterpret_cast<const char*>(&data9), BITCOUNT9);
Expand Down Expand Up @@ -2116,6 +2128,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
bool extendedwatercannons : 1;
} data4;

struct
{
bool tunnelweatherblend : 1;
} data5;

SWorldSpecialPropertiesStateSync()
{
// Set default states
Expand All @@ -2134,6 +2151,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
data2.fireballdestruct = true;
data3.roadsignstext = true;
data4.extendedwatercannons = true;
data5.tunnelweatherblend = true;
}
};

Expand Down
5 changes: 5 additions & 0 deletions Shared/sdk/net/bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ enum class eBitStreamVersion : unsigned short
// 2024-06-16
PedSync_Revision,

// Add "extendedwatercannons" to setWorldSpecialPropertyEnabled
// 2024-06-30
WorldSpecialProperty_TunnelWeatherBlend,


// 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