Skip to content

Commit 567d645

Browse files
committed
Add new world special property (vehicleburnexplosions)
1 parent 7763da4 commit 567d645

File tree

11 files changed

+64
-0
lines changed

11 files changed

+64
-0
lines changed

Client/game_sa/CGameSA.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,25 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
902902
m_isIgnoreFireStateEnabled = isEnabled;
903903
}
904904

905+
void CGameSA::SetVehicleBurnExplosionsEnabled(bool isEnabled)
906+
{
907+
if (isEnabled == m_isVehicleBurnExplosionsEnabled)
908+
return;
909+
910+
if (isEnabled)
911+
{
912+
MemCpy((void*)0x6A74EA, "\xE8\x61\xF5\x08\x00", 5); // CAutomobile::ProcessCarOnFireAndExplode
913+
MemCpy((void*)0x737929, "\xE8\x22\xF1\xFF\xFF", 5); // CExplosion::Update
914+
}
915+
else
916+
{
917+
MemSet((void*)0x6A74EA, 0x90, 5);
918+
MemSet((void*)0x737929, 0x90, 5);
919+
}
920+
921+
m_isVehicleBurnExplosionsEnabled = isEnabled;
922+
}
923+
905924
bool CGameSA::PerformChecks()
906925
{
907926
std::map<std::string, SCheatSA*>::iterator it;

Client/game_sa/CGameSA.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ class CGameSA : public CGame
253253
bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
254254
void SetIgnoreFireStateEnabled(bool isEnabled) override;
255255

256+
bool IsVehicleBurnExplosionsEnabled() const noexcept override { return m_isVehicleBurnExplosionsEnabled; }
257+
void SetVehicleBurnExplosionsEnabled(bool isEnabled) override;
258+
256259
unsigned long GetMinuteDuration();
257260
void SetMinuteDuration(unsigned long ulTime);
258261

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

388392
static unsigned int& ClumpOffset;
389393

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6051,6 +6051,9 @@ bool CClientGame::SetWorldSpecialProperty(const WorldSpecialProperty property, c
60516051
case WorldSpecialProperty::FLYINGCOMPONENTS:
60526052
m_pVehicleManager->SetSpawnFlyingComponentEnabled(enabled);
60536053
break;
6054+
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
6055+
g_pGame->SetVehicleBurnExplosionsEnabled(enabled);
6056+
break;
60546057
default:
60556058
return false;
60566059
}
@@ -6095,6 +6098,8 @@ bool CClientGame::IsWorldSpecialProperty(const WorldSpecialProperty property)
60956098
return g_pGame->IsIgnoreFireStateEnabled();
60966099
case WorldSpecialProperty::FLYINGCOMPONENTS:
60976100
return m_pVehicleManager->IsSpawnFlyingComponentEnabled();
6101+
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
6102+
return g_pGame->IsVehicleBurnExplosionsEnabled();
60986103
}
60996104

61006105
return false;
@@ -6812,6 +6817,9 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo
68126817
g_pGame->SetRoadSignsTextEnabled(true);
68136818
g_pGame->SetExtendedWaterCannonsEnabled(true);
68146819
g_pGame->SetTunnelWeatherBlendEnabled(true);
6820+
g_pGame->SetIgnoreFireStateEnabled(false);
6821+
m_pVehicleManager->SetSpawnFlyingComponentEnabled(true);
6822+
g_pGame->SetVehicleBurnExplosionsEnabled(true);
68156823
}
68166824

68176825
// Reset all setWorldProperty to default

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,7 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream)
24012401
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::TUNNELWEATHERBLEND, wsProps.data5.tunnelweatherblend);
24022402
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::IGNOREFIRESTATE, wsProps.data6.ignoreFireState);
24032403
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FLYINGCOMPONENTS, wsProps.data7.flyingcomponents);
2404+
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, wsProps.data8.vehicleburnexplosions);
24042405

24052406
float fJetpackMaxHeight = 100;
24062407
if (!bitStream.Read(fJetpackMaxHeight))

Client/sdk/game/CGame.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ class __declspec(novtable) CGame
234234
virtual bool IsIgnoreFireStateEnabled() const noexcept = 0;
235235
virtual void SetIgnoreFireStateEnabled(bool isEnabled) = 0;
236236

237+
virtual bool IsVehicleBurnExplosionsEnabled() const noexcept = 0;
238+
virtual void SetVehicleBurnExplosionsEnabled(bool isEnabled) = 0;
239+
237240
virtual CWeapon* CreateWeapon() = 0;
238241
virtual CWeaponStat* CreateWeaponStat(eWeaponType weaponType, eWeaponSkill weaponSkill) = 0;
239242

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
261261
m_WorldSpecialProps[WorldSpecialProperty::TUNNELWEATHERBLEND] = true;
262262
m_WorldSpecialProps[WorldSpecialProperty::IGNOREFIRESTATE] = false;
263263
m_WorldSpecialProps[WorldSpecialProperty::FLYINGCOMPONENTS] = true;
264+
m_WorldSpecialProps[WorldSpecialProperty::VEHICLEBURNEXPLOSIONS] = true;
264265

265266
m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true;
266267
m_JetpackWeapons[WEAPONTYPE_TEC9] = true;
@@ -4517,6 +4518,9 @@ void CGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo)
45174518
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::ROADSIGNSTEXT, true);
45184519
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::EXTENDEDWATERCANNONS, true);
45194520
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::TUNNELWEATHERBLEND, true);
4521+
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::IGNOREFIRESTATE, false);
4522+
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS, true);
4523+
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, true);
45204524
}
45214525

45224526
// Reset all weather stuff like heat haze, wind velocity etc

Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const
194194
wsProps.data5.tunnelweatherblend = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::TUNNELWEATHERBLEND);
195195
wsProps.data6.ignoreFireState = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::IGNOREFIRESTATE);
196196
wsProps.data7.flyingcomponents = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS);
197+
wsProps.data8.vehicleburnexplosions = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS);
197198
BitStream.Write(&wsProps);
198199
}
199200

Shared/mods/deathmatch/logic/Enums.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ ADD_ENUM(WorldSpecialProperty::ROADSIGNSTEXT, "roadsignstext")
103103
ADD_ENUM(WorldSpecialProperty::TUNNELWEATHERBLEND, "tunnelweatherblend")
104104
ADD_ENUM(WorldSpecialProperty::IGNOREFIRESTATE, "ignorefirestate")
105105
ADD_ENUM(WorldSpecialProperty::FLYINGCOMPONENTS, "flyingcomponents")
106+
ADD_ENUM(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, "vehicleburnexplosions")
106107
IMPLEMENT_ENUM_CLASS_END("world-special-property")
107108

108109
IMPLEMENT_ENUM_BEGIN(ePacketID)

Shared/mods/deathmatch/logic/Enums.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ enum class WorldSpecialProperty
9393
TUNNELWEATHERBLEND,
9494
IGNOREFIRESTATE,
9595
FLYINGCOMPONENTS,
96+
VEHICLEBURNEXPLOSIONS,
9697
};
9798
DECLARE_ENUM_CLASS(WorldSpecialProperty);
9899

Shared/sdk/net/SyncStructures.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,10 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
20792079
{
20802080
BITCOUNT7 = 1
20812081
};
2082+
enum
2083+
{
2084+
BITCOUNT8 = 1
2085+
};
20822086

20832087
bool Read(NetBitStreamInterface& bitStream)
20842088
{
@@ -2112,6 +2116,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
21122116
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data7), BITCOUNT7);
21132117
else
21142118
data7.flyingcomponents = true;
2119+
2120+
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_VehicleBurnExplosions))
2121+
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data8), BITCOUNT8);
2122+
else
2123+
data8.vehicleburnexplosions = true;
21152124

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

2154+
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_VehicleBurnExplosions))
2155+
bitStream.WriteBits(reinterpret_cast<const char*>(&data8), BITCOUNT8);
2156+
21452157
//// Example for adding item:
21462158
// if (bitStream.Can(eBitStreamVersion::YourProperty))
21472159
// bitStream.WriteBits(reinterpret_cast<const char*>(&data9), BITCOUNT9);
@@ -2193,6 +2205,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
21932205
{
21942206
bool flyingcomponents : 1;
21952207
} data7;
2208+
2209+
struct
2210+
{
2211+
bool vehicleburnexplosions : 1;
2212+
} data8;
21962213

21972214
SWorldSpecialPropertiesStateSync()
21982215
{
@@ -2215,6 +2232,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
22152232
data5.tunnelweatherblend = true;
22162233
data6.ignoreFireState = false;
22172234
data7.flyingcomponents = true;
2235+
data8.vehicleburnexplosions = true;
22182236
}
22192237
};
22202238

0 commit comments

Comments
 (0)