Skip to content

Commit 8c81c72

Browse files
Synchronize changes from 1.6 master branch [ci skip]
88d303c Add new world special property: vehicleburnexplosions (PR #4040)
2 parents bdcbf9b + 88d303c commit 8c81c72

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
@@ -911,6 +911,25 @@ void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
911911
m_isIgnoreFireStateEnabled = isEnabled;
912912
}
913913

914+
void CGameSA::SetVehicleBurnExplosionsEnabled(bool isEnabled)
915+
{
916+
if (isEnabled == m_isVehicleBurnExplosionsEnabled)
917+
return;
918+
919+
if (isEnabled)
920+
{
921+
MemCpy((void*)0x6A74EA, "\xE8\x61\xF5\x08\x00", 5); // CAutomobile::ProcessCarOnFireAndExplode
922+
MemCpy((void*)0x737929, "\xE8\x22\xF1\xFF\xFF", 5); // CExplosion::Update
923+
}
924+
else
925+
{
926+
MemSet((void*)0x6A74EA, 0x90, 5);
927+
MemSet((void*)0x737929, 0x90, 5);
928+
}
929+
930+
m_isVehicleBurnExplosionsEnabled = isEnabled;
931+
}
932+
914933
bool CGameSA::PerformChecks()
915934
{
916935
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
@@ -259,6 +259,9 @@ class CGameSA : public CGame
259259
bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
260260
void SetIgnoreFireStateEnabled(bool isEnabled) override;
261261

262+
bool IsVehicleBurnExplosionsEnabled() const noexcept override { return m_isVehicleBurnExplosionsEnabled; }
263+
void SetVehicleBurnExplosionsEnabled(bool isEnabled) override;
264+
262265
unsigned long GetMinuteDuration();
263266
void SetMinuteDuration(unsigned long ulTime);
264267

@@ -390,6 +393,7 @@ class CGameSA : public CGame
390393
bool m_isGameWorldRemoved{false};
391394
bool m_isExtendedWaterCannonsEnabled{false};
392395
bool m_isIgnoreFireStateEnabled{false};
396+
bool m_isVehicleBurnExplosionsEnabled{true};
393397

394398
static unsigned int& ClumpOffset;
395399

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6054,6 +6054,9 @@ bool CClientGame::SetWorldSpecialProperty(const WorldSpecialProperty property, c
60546054
case WorldSpecialProperty::FLYINGCOMPONENTS:
60556055
m_pVehicleManager->SetSpawnFlyingComponentEnabled(enabled);
60566056
break;
6057+
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
6058+
g_pGame->SetVehicleBurnExplosionsEnabled(enabled);
6059+
break;
60576060
default:
60586061
return false;
60596062
}
@@ -6098,6 +6101,8 @@ bool CClientGame::IsWorldSpecialProperty(const WorldSpecialProperty property)
60986101
return g_pGame->IsIgnoreFireStateEnabled();
60996102
case WorldSpecialProperty::FLYINGCOMPONENTS:
61006103
return m_pVehicleManager->IsSpawnFlyingComponentEnabled();
6104+
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
6105+
return g_pGame->IsVehicleBurnExplosionsEnabled();
61016106
}
61026107

61036108
return false;
@@ -6815,6 +6820,9 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo
68156820
g_pGame->SetRoadSignsTextEnabled(true);
68166821
g_pGame->SetExtendedWaterCannonsEnabled(true);
68176822
g_pGame->SetTunnelWeatherBlendEnabled(true);
6823+
g_pGame->SetIgnoreFireStateEnabled(false);
6824+
m_pVehicleManager->SetSpawnFlyingComponentEnabled(true);
6825+
g_pGame->SetVehicleBurnExplosionsEnabled(true);
68186826
}
68196827

68206828
// 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
@@ -238,6 +238,9 @@ class __declspec(novtable) CGame
238238
virtual bool IsIgnoreFireStateEnabled() const noexcept = 0;
239239
virtual void SetIgnoreFireStateEnabled(bool isEnabled) = 0;
240240

241+
virtual bool IsVehicleBurnExplosionsEnabled() const noexcept = 0;
242+
virtual void SetVehicleBurnExplosionsEnabled(bool isEnabled) = 0;
243+
241244
virtual CWeapon* CreateWeapon() = 0;
242245
virtual CWeaponStat* CreateWeaponStat(eWeaponType weaponType, eWeaponSkill weaponSkill) = 0;
243246

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
@@ -118,6 +118,7 @@ ADD_ENUM(WorldSpecialProperty::ROADSIGNSTEXT, "roadsignstext")
118118
ADD_ENUM(WorldSpecialProperty::TUNNELWEATHERBLEND, "tunnelweatherblend")
119119
ADD_ENUM(WorldSpecialProperty::IGNOREFIRESTATE, "ignorefirestate")
120120
ADD_ENUM(WorldSpecialProperty::FLYINGCOMPONENTS, "flyingcomponents")
121+
ADD_ENUM(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, "vehicleburnexplosions")
121122
IMPLEMENT_ENUM_CLASS_END("world-special-property")
122123

123124
IMPLEMENT_ENUM_BEGIN(ePacketID)

Shared/mods/deathmatch/logic/Enums.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ enum class WorldSpecialProperty
9595
TUNNELWEATHERBLEND,
9696
IGNOREFIRESTATE,
9797
FLYINGCOMPONENTS,
98+
VEHICLEBURNEXPLOSIONS,
9899
};
99100
DECLARE_ENUM_CLASS(WorldSpecialProperty);
100101

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

Shared/sdk/net/bitstream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ enum class eBitStreamVersion : unsigned short
612612
// 2025-01-29
613613
PedSync_CameraRotation,
614614

615+
// Add "vehicleburnexplosions" to setWorldSpecialPropertyEnabled
616+
// 2025-02-20
617+
WorldSpecialProperty_VehicleBurnExplosions,
618+
615619
// This allows us to automatically increment the BitStreamVersion when things are added to this enum.
616620
// Make sure you only add things above this comment.
617621
Next,

0 commit comments

Comments
 (0)