Skip to content

Add new world special property (vehicleburnexplosions) #4040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
@@ -902,6 +902,25 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
m_isIgnoreFireStateEnabled = isEnabled;
}

void CGameSA::SetVehicleBurnExplosionsEnabled(bool isEnabled)
{
if (isEnabled == m_isVehicleBurnExplosionsEnabled)
return;

if (isEnabled)
{
MemCpy((void*)0x6A74EA, "\xE8\x61\xF5\x08\x00", 5); // CAutomobile::ProcessCarOnFireAndExplode
MemCpy((void*)0x737929, "\xE8\x22\xF1\xFF\xFF", 5); // CExplosion::Update
}
else
{
MemSet((void*)0x6A74EA, 0x90, 5);
MemSet((void*)0x737929, 0x90, 5);
}

m_isVehicleBurnExplosionsEnabled = isEnabled;
}

bool CGameSA::PerformChecks()
{
std::map<std::string, SCheatSA*>::iterator it;
4 changes: 4 additions & 0 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
@@ -253,6 +253,9 @@ class CGameSA : public CGame
bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
void SetIgnoreFireStateEnabled(bool isEnabled) override;

bool IsVehicleBurnExplosionsEnabled() const noexcept override { return m_isVehicleBurnExplosionsEnabled; }
void SetVehicleBurnExplosionsEnabled(bool isEnabled) override;

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

@@ -384,6 +387,7 @@ class CGameSA : public CGame
bool m_isGameWorldRemoved{false};
bool m_isExtendedWaterCannonsEnabled{false};
bool m_isIgnoreFireStateEnabled{false};
bool m_isVehicleBurnExplosionsEnabled{true};

static unsigned int& ClumpOffset;

8 changes: 8 additions & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
@@ -6051,6 +6051,9 @@ bool CClientGame::SetWorldSpecialProperty(const WorldSpecialProperty property, c
case WorldSpecialProperty::FLYINGCOMPONENTS:
m_pVehicleManager->SetSpawnFlyingComponentEnabled(enabled);
break;
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
g_pGame->SetVehicleBurnExplosionsEnabled(enabled);
break;
default:
return false;
}
@@ -6095,6 +6098,8 @@ bool CClientGame::IsWorldSpecialProperty(const WorldSpecialProperty property)
return g_pGame->IsIgnoreFireStateEnabled();
case WorldSpecialProperty::FLYINGCOMPONENTS:
return m_pVehicleManager->IsSpawnFlyingComponentEnabled();
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
return g_pGame->IsVehicleBurnExplosionsEnabled();
}

return false;
@@ -6812,6 +6817,9 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo
g_pGame->SetRoadSignsTextEnabled(true);
g_pGame->SetExtendedWaterCannonsEnabled(true);
g_pGame->SetTunnelWeatherBlendEnabled(true);
g_pGame->SetIgnoreFireStateEnabled(false);
m_pVehicleManager->SetSpawnFlyingComponentEnabled(true);
g_pGame->SetVehicleBurnExplosionsEnabled(true);
}

// Reset all setWorldProperty to default
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CPacketHandler.cpp
Original file line number Diff line number Diff line change
@@ -2401,6 +2401,7 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream)
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::TUNNELWEATHERBLEND, wsProps.data5.tunnelweatherblend);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::IGNOREFIRESTATE, wsProps.data6.ignoreFireState);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FLYINGCOMPONENTS, wsProps.data7.flyingcomponents);
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, wsProps.data8.vehicleburnexplosions);

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

virtual bool IsVehicleBurnExplosionsEnabled() const noexcept = 0;
virtual void SetVehicleBurnExplosionsEnabled(bool isEnabled) = 0;

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

4 changes: 4 additions & 0 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
@@ -261,6 +261,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
m_WorldSpecialProps[WorldSpecialProperty::TUNNELWEATHERBLEND] = true;
m_WorldSpecialProps[WorldSpecialProperty::IGNOREFIRESTATE] = false;
m_WorldSpecialProps[WorldSpecialProperty::FLYINGCOMPONENTS] = true;
m_WorldSpecialProps[WorldSpecialProperty::VEHICLEBURNEXPLOSIONS] = true;

m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true;
m_JetpackWeapons[WEAPONTYPE_TEC9] = true;
@@ -4517,6 +4518,9 @@ void CGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo)
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::ROADSIGNSTEXT, true);
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::EXTENDEDWATERCANNONS, true);
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::TUNNELWEATHERBLEND, true);
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::IGNOREFIRESTATE, false);
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS, true);
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, true);
}

// Reset all weather stuff like heat haze, wind velocity etc
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp
Original file line number Diff line number Diff line change
@@ -194,6 +194,7 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const
wsProps.data5.tunnelweatherblend = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::TUNNELWEATHERBLEND);
wsProps.data6.ignoreFireState = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::IGNOREFIRESTATE);
wsProps.data7.flyingcomponents = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS);
wsProps.data8.vehicleburnexplosions = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS);
BitStream.Write(&wsProps);
}

1 change: 1 addition & 0 deletions Shared/mods/deathmatch/logic/Enums.cpp
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@ ADD_ENUM(WorldSpecialProperty::ROADSIGNSTEXT, "roadsignstext")
ADD_ENUM(WorldSpecialProperty::TUNNELWEATHERBLEND, "tunnelweatherblend")
ADD_ENUM(WorldSpecialProperty::IGNOREFIRESTATE, "ignorefirestate")
ADD_ENUM(WorldSpecialProperty::FLYINGCOMPONENTS, "flyingcomponents")
ADD_ENUM(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, "vehicleburnexplosions")
IMPLEMENT_ENUM_CLASS_END("world-special-property")

IMPLEMENT_ENUM_BEGIN(ePacketID)
1 change: 1 addition & 0 deletions Shared/mods/deathmatch/logic/Enums.h
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@ enum class WorldSpecialProperty
TUNNELWEATHERBLEND,
IGNOREFIRESTATE,
FLYINGCOMPONENTS,
VEHICLEBURNEXPLOSIONS,
};
DECLARE_ENUM_CLASS(WorldSpecialProperty);

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

bool Read(NetBitStreamInterface& bitStream)
{
@@ -2112,6 +2116,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data7), BITCOUNT7);
else
data7.flyingcomponents = true;

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_VehicleBurnExplosions))
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data8), BITCOUNT8);
else
data8.vehicleburnexplosions = true;

//// Example for adding item:
// if (bitStream.Can(eBitStreamVersion::YourProperty))
@@ -2142,6 +2151,9 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_FlyingComponents))
bitStream.WriteBits(reinterpret_cast<const char*>(&data7), BITCOUNT7);

if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_VehicleBurnExplosions))
bitStream.WriteBits(reinterpret_cast<const char*>(&data8), BITCOUNT8);

//// Example for adding item:
// if (bitStream.Can(eBitStreamVersion::YourProperty))
// bitStream.WriteBits(reinterpret_cast<const char*>(&data9), BITCOUNT9);
@@ -2193,6 +2205,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
{
bool flyingcomponents : 1;
} data7;

struct
{
bool vehicleburnexplosions : 1;
} data8;

SWorldSpecialPropertiesStateSync()
{
@@ -2215,6 +2232,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
data5.tunnelweatherblend = true;
data6.ignoreFireState = false;
data7.flyingcomponents = true;
data8.vehicleburnexplosions = true;
}
};

4 changes: 4 additions & 0 deletions Shared/sdk/net/bitstream.h
Original file line number Diff line number Diff line change
@@ -612,6 +612,10 @@ enum class eBitStreamVersion : unsigned short
// 2025-01-29
PedSync_CameraRotation,

// Add "vehicleburnexplosions" to setWorldSpecialPropertyEnabled
// 2025-02-20
WorldSpecialProperty_VehicleBurnExplosions,

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