From b7b274fbdedc3e8d6eb0cb0bfb3dc83aaf20c7c6 Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Sun, 5 Jul 2026 18:08:27 +0300 Subject: [PATCH 1/5] Add PS2 scorched vehicles feature - Introduced a new world special property for PS2 scorched vehicles, allowing for enhanced vehicle lighting effects. - Implemented enabling/disabling functionality in CClientGame and CMultiplayerSA. - Updated packet handling to synchronize the new property across clients and servers. - Adjusted vehicle color darkening logic based on the new property state. - Added necessary hooks and enums to support the new feature. This change enhances the visual experience for vehicles in the game, particularly for PS2 users. --- .../CMultiplayerSA_ScorchedVehicles.cpp | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp diff --git a/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp b/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp new file mode 100644 index 0000000000..fd75280372 --- /dev/null +++ b/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp @@ -0,0 +1,44 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto + * LICENSE: See LICENSE in the top level directory + * FILE: multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp + * + * Multi Theft Auto is available from https://www.multitheftauto.com/ + * + *****************************************************************************/ + +#include "StdInc.h" + +namespace +{ + constexpr float SCORCHED_VEHICLE_LIGHTING_PS2 = 0.0f; + + bool ms_bPs2ScorchedVehiclesEnabled = false; + + using WorldReplaceNormalLightsWithScorched_t = void(__cdecl*)(RpWorld* world, float lighting); + + void __cdecl WorldReplaceNormalLightsWithScorched_MTA(RpWorld* world, float lighting) + { + if (ms_bPs2ScorchedVehiclesEnabled) + lighting = SCORCHED_VEHICLE_LIGHTING_PS2; + + reinterpret_cast(0x7357E0)(world, lighting); + } +} // namespace + +bool CMultiplayerSA::IsPs2ScorchedVehiclesEnabled() const noexcept +{ + return ms_bPs2ScorchedVehiclesEnabled; +} + +void CMultiplayerSA::SetPs2ScorchedVehiclesEnabled(bool enabled) +{ + ms_bPs2ScorchedVehiclesEnabled = enabled; +} + +void CMultiplayerSA::InitHooks_ScorchedVehicles() +{ + HookInstallCall(0x553E6A, reinterpret_cast(WorldReplaceNormalLightsWithScorched_MTA)); // SetupLightingForEntity + HookInstallCall(0x554FC2, reinterpret_cast(WorldReplaceNormalLightsWithScorched_MTA)); // CObject::SetupLighting +} From 1784a8e5bf0b864b9e3d38c60a603d9d81e39a1f Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Sun, 5 Jul 2026 18:08:50 +0300 Subject: [PATCH 2/5] Implement PS2 scorched vehicles feature - Added support for PS2 scorched vehicles as a new world special property. - Updated CClientGame and CMultiplayerSA to manage the enabling/disabling of this feature. - Enhanced packet handling to synchronize the new property across clients and servers. - Modified vehicle color darkening logic to reflect the state of the new property. - Introduced necessary hooks and enums to facilitate the feature. This update improves the visual effects for vehicles, particularly enhancing the experience for PS2 users. --- Client/mods/deathmatch/logic/CClientGame.cpp | 6 ++++++ Client/mods/deathmatch/logic/CPacketHandler.cpp | 1 + Client/multiplayer_sa/CMultiplayerSA.cpp | 13 +++++++++++++ Client/multiplayer_sa/CMultiplayerSA.h | 4 ++++ Client/sdk/multiplayer/CMultiplayer.h | 3 +++ Server/mods/deathmatch/logic/CGame.cpp | 2 ++ .../deathmatch/logic/packets/CMapInfoPacket.cpp | 1 + Shared/mods/deathmatch/logic/Enums.cpp | 1 + Shared/mods/deathmatch/logic/Enums.h | 1 + Shared/sdk/net/SyncStructures.h | 4 +++- Tests/client/SyncMisc_Tests.cpp | 4 ++-- 11 files changed, 37 insertions(+), 3 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 69edcc4337..9697996dea 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -6160,6 +6160,9 @@ bool CClientGame::SetWorldSpecialProperty(const WorldSpecialProperty property, c case WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART: SetVehicleEngineAutoStartEnabled(enabled); break; + case WorldSpecialProperty::PS2SCORCHEDVEHICLES: + g_pMultiplayer->SetPs2ScorchedVehiclesEnabled(enabled); + break; default: return false; } @@ -6208,6 +6211,8 @@ bool CClientGame::IsWorldSpecialProperty(const WorldSpecialProperty property) return g_pGame->IsVehicleBurnExplosionsEnabled(); case WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART: return IsVehicleEngineAutoStartEnabled(); + case WorldSpecialProperty::PS2SCORCHEDVEHICLES: + return g_pMultiplayer->IsPs2ScorchedVehiclesEnabled(); } return false; @@ -7013,6 +7018,7 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo m_pVehicleManager->SetSpawnFlyingComponentEnabled(true); g_pGame->SetVehicleBurnExplosionsEnabled(true); SetVehicleEngineAutoStartEnabled(true); + g_pMultiplayer->SetPs2ScorchedVehiclesEnabled(false); } // Reset all setWorldProperty to default diff --git a/Client/mods/deathmatch/logic/CPacketHandler.cpp b/Client/mods/deathmatch/logic/CPacketHandler.cpp index 1fb1a3d8fa..71d7a4b0b4 100644 --- a/Client/mods/deathmatch/logic/CPacketHandler.cpp +++ b/Client/mods/deathmatch/logic/CPacketHandler.cpp @@ -2438,6 +2438,7 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream) g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FLYINGCOMPONENTS, wsProps.data.flyingcomponents); g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, wsProps.data.vehicleburnexplosions); g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, wsProps.data.vehicleEngineAutoStart); + g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::PS2SCORCHEDVEHICLES, wsProps.data.ps2ScorchedVehicles); float fJetpackMaxHeight = 100; if (!bitStream.Read(fJetpackMaxHeight)) diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index 741426c972..ade4a5695e 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -1597,6 +1597,7 @@ void CMultiplayerSA::InitHooks() InitHooks_Postprocess(); InitHooks_Explosions(); InitHooks_Tasks(); + InitHooks_ScorchedVehicles(); } // Used to store copied pointers for explosions in the FxSystem @@ -6510,6 +6511,18 @@ void _cdecl SaveVehColors(DWORD dwThis) if (pVehicle) { pVehicle->GetColor(&vehColors[0], &vehColors[1], &vehColors[2], &vehColors[3], true); + + // Darken blown vehicle colours + if (pMultiplayer->IsPs2ScorchedVehiclesEnabled() && pVehicle->GetHealth() <= 0.0f) + { + constexpr float darkFactor = 0.08f; + for (auto& color : vehColors) + { + color.R = static_cast(color.R * darkFactor); + color.G = static_cast(color.G * darkFactor); + color.B = static_cast(color.B * darkFactor); + } + } } } diff --git a/Client/multiplayer_sa/CMultiplayerSA.h b/Client/multiplayer_sa/CMultiplayerSA.h index 166566ac9f..554b94f421 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.h +++ b/Client/multiplayer_sa/CMultiplayerSA.h @@ -87,6 +87,7 @@ class CMultiplayerSA : public CMultiplayer void InitHooks_DeviceSelection(); void InitHooks_Explosions(); void InitHooks_Tasks(); + void InitHooks_ScorchedVehicles(); CRemoteDataStorage* CreateRemoteDataStorage(); void DestroyRemoteDataStorage(CRemoteDataStorage* pData); void AddRemoteDataStorage(CPlayerPed* pPed, CRemoteDataStorage* pData); @@ -341,6 +342,9 @@ class CMultiplayerSA : public CMultiplayer bool IsVehicleEngineAutoStartEnabled() const noexcept override; void SetVehicleEngineAutoStartEnabled(bool enabled) override; + bool IsPs2ScorchedVehiclesEnabled() const noexcept override; + void SetPs2ScorchedVehiclesEnabled(bool enabled) override; + bool IsRapidVehicleStopFixEnabled() const noexcept override { return m_isRapidVehicleStopFixEnabled; }; void SetRapidVehicleStopFixEnabled(bool enabled) override; diff --git a/Client/sdk/multiplayer/CMultiplayer.h b/Client/sdk/multiplayer/CMultiplayer.h index 28d2e07408..760b0eef42 100644 --- a/Client/sdk/multiplayer/CMultiplayer.h +++ b/Client/sdk/multiplayer/CMultiplayer.h @@ -449,6 +449,9 @@ class CMultiplayer virtual bool IsVehicleEngineAutoStartEnabled() const noexcept = 0; virtual void SetVehicleEngineAutoStartEnabled(bool enabled) = 0; + virtual bool IsPs2ScorchedVehiclesEnabled() const noexcept = 0; + virtual void SetPs2ScorchedVehiclesEnabled(bool enabled) = 0; + virtual bool IsRapidVehicleStopFixEnabled() const noexcept = 0; virtual void SetRapidVehicleStopFixEnabled(bool enabled) = 0; diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index 4ce0091d5e..57f2c29ae4 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -272,6 +272,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connections per 30 m_WorldSpecialProps[WorldSpecialProperty::FLYINGCOMPONENTS] = true; m_WorldSpecialProps[WorldSpecialProperty::VEHICLEBURNEXPLOSIONS] = true; m_WorldSpecialProps[WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART] = true; + m_WorldSpecialProps[WorldSpecialProperty::PS2SCORCHEDVEHICLES] = false; m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true; m_JetpackWeapons[WEAPONTYPE_TEC9] = true; @@ -4514,6 +4515,7 @@ void CGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo) g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS, true); g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, true); g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, true); + g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::PS2SCORCHEDVEHICLES, false); } // Reset all weather stuff like heat haze, wind velocity etc diff --git a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp index aceac1b129..b8d2b1e12d 100644 --- a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp @@ -192,6 +192,7 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const wsProps.data.flyingcomponents = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS); wsProps.data.vehicleburnexplosions = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS); wsProps.data.vehicleEngineAutoStart = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART); + wsProps.data.ps2ScorchedVehicles = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::PS2SCORCHEDVEHICLES); BitStream.Write(&wsProps); BitStream.Write(m_fJetpackMaxHeight); diff --git a/Shared/mods/deathmatch/logic/Enums.cpp b/Shared/mods/deathmatch/logic/Enums.cpp index 8bb99db974..77cd43101e 100644 --- a/Shared/mods/deathmatch/logic/Enums.cpp +++ b/Shared/mods/deathmatch/logic/Enums.cpp @@ -120,6 +120,7 @@ ADD_ENUM(WorldSpecialProperty::IGNOREFIRESTATE, "ignorefirestate") ADD_ENUM(WorldSpecialProperty::FLYINGCOMPONENTS, "flyingcomponents") ADD_ENUM(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, "vehicleburnexplosions") ADD_ENUM(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, "vehicle_engine_autostart") +ADD_ENUM(WorldSpecialProperty::PS2SCORCHEDVEHICLES, "ps2scorchedvehicles") IMPLEMENT_ENUM_CLASS_END("world-special-property") IMPLEMENT_ENUM_BEGIN(ePacketID) diff --git a/Shared/mods/deathmatch/logic/Enums.h b/Shared/mods/deathmatch/logic/Enums.h index 884bb559f5..cb72ef409f 100644 --- a/Shared/mods/deathmatch/logic/Enums.h +++ b/Shared/mods/deathmatch/logic/Enums.h @@ -97,6 +97,7 @@ enum class WorldSpecialProperty FLYINGCOMPONENTS, VEHICLEBURNEXPLOSIONS, VEHICLE_ENGINE_AUTOSTART, + PS2SCORCHEDVEHICLES, }; DECLARE_ENUM_CLASS(WorldSpecialProperty); diff --git a/Shared/sdk/net/SyncStructures.h b/Shared/sdk/net/SyncStructures.h index 8c3276be53..1f5c72ab56 100644 --- a/Shared/sdk/net/SyncStructures.h +++ b/Shared/sdk/net/SyncStructures.h @@ -1962,7 +1962,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure { enum { - BITCOUNT = 20 + BITCOUNT = 21 }; bool Read(NetBitStreamInterface& bitStream) @@ -2009,6 +2009,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure bool flyingcomponents : 1; bool vehicleburnexplosions : 1; bool vehicleEngineAutoStart : 1; + bool ps2ScorchedVehicles : 1; } data; // Add new ones in separate structs @@ -2036,6 +2037,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure data.flyingcomponents = true; data.vehicleburnexplosions = true; data.vehicleEngineAutoStart = true; + data.ps2ScorchedVehicles = false; } }; diff --git a/Tests/client/SyncMisc_Tests.cpp b/Tests/client/SyncMisc_Tests.cpp index 0dd84f8d00..b96af826d9 100644 --- a/Tests/client/SyncMisc_Tests.cpp +++ b/Tests/client/SyncMisc_Tests.cpp @@ -87,7 +87,7 @@ TEST(SFunBugsStateSync, RoundTrip) // World special properties // ============================================================================ -// 20 boolean flags controlling world behaviour (hovercars, foliage, etc.). +// 21 boolean flags controlling world behaviour (hovercars, foliage, etc.). // The constructor sets default values, so we flip a few and verify both // changed and unchanged flags. TEST(SWorldSpecialPropertiesStateSync, RoundTrip) @@ -98,7 +98,7 @@ TEST(SWorldSpecialPropertiesStateSync, RoundTrip) sync.data.randomfoliage = false; sync.data.vehicleEngineAutoStart = false; sync.Write(bs); - EXPECT_EQ(20, bs.GetNumberOfBitsUsed()); + EXPECT_EQ(21, bs.GetNumberOfBitsUsed()); bs.ResetReadPointer(); SWorldSpecialPropertiesStateSync out; EXPECT_TRUE(out.Read(bs)); From 129d323d8a619b0c80ed451015bea61586c7662e Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Wed, 22 Jul 2026 23:40:41 +0300 Subject: [PATCH 3/5] Refactor PS2 scorched vehicles functionality - Added noexcept specifier to SetPs2ScorchedVehiclesEnabled method in CMultiplayerSA and CMultiplayer interfaces for improved safety. - Updated comments for clarity in CMultiplayerSA_ScorchedVehicles.cpp regarding lighting setup. - Adjusted hook installation comments for better accuracy in CMultiplayerSA. These changes enhance code readability and maintainability while ensuring consistent behavior in the PS2 scorched vehicles feature. --- Client/multiplayer_sa/CMultiplayerSA.h | 2 +- Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp | 7 ++++--- Client/sdk/multiplayer/CMultiplayer.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Client/multiplayer_sa/CMultiplayerSA.h b/Client/multiplayer_sa/CMultiplayerSA.h index 554b94f421..6dcc1fd487 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.h +++ b/Client/multiplayer_sa/CMultiplayerSA.h @@ -343,7 +343,7 @@ class CMultiplayerSA : public CMultiplayer void SetVehicleEngineAutoStartEnabled(bool enabled) override; bool IsPs2ScorchedVehiclesEnabled() const noexcept override; - void SetPs2ScorchedVehiclesEnabled(bool enabled) override; + void SetPs2ScorchedVehiclesEnabled(bool enabled) noexcept override; bool IsRapidVehicleStopFixEnabled() const noexcept override { return m_isRapidVehicleStopFixEnabled; }; void SetRapidVehicleStopFixEnabled(bool enabled) override; diff --git a/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp b/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp index fd75280372..123e5125de 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_ScorchedVehicles.cpp @@ -23,6 +23,7 @@ namespace if (ms_bPs2ScorchedVehiclesEnabled) lighting = SCORCHED_VEHICLE_LIGHTING_PS2; + // Call WorldReplaceNormalLightsWithScorched reinterpret_cast(0x7357E0)(world, lighting); } } // namespace @@ -32,13 +33,13 @@ bool CMultiplayerSA::IsPs2ScorchedVehiclesEnabled() const noexcept return ms_bPs2ScorchedVehiclesEnabled; } -void CMultiplayerSA::SetPs2ScorchedVehiclesEnabled(bool enabled) +void CMultiplayerSA::SetPs2ScorchedVehiclesEnabled(bool enabled) noexcept { ms_bPs2ScorchedVehiclesEnabled = enabled; } void CMultiplayerSA::InitHooks_ScorchedVehicles() { - HookInstallCall(0x553E6A, reinterpret_cast(WorldReplaceNormalLightsWithScorched_MTA)); // SetupLightingForEntity - HookInstallCall(0x554FC2, reinterpret_cast(WorldReplaceNormalLightsWithScorched_MTA)); // CObject::SetupLighting + HookInstallCall(0x553E6A, reinterpret_cast(WorldReplaceNormalLightsWithScorched_MTA)); // CRenderer::SetupLightingForEntity + HookInstallCall(0x554FB7, reinterpret_cast(WorldReplaceNormalLightsWithScorched_MTA)); // CObject::SetupLighting } diff --git a/Client/sdk/multiplayer/CMultiplayer.h b/Client/sdk/multiplayer/CMultiplayer.h index 760b0eef42..402ed41c93 100644 --- a/Client/sdk/multiplayer/CMultiplayer.h +++ b/Client/sdk/multiplayer/CMultiplayer.h @@ -450,7 +450,7 @@ class CMultiplayer virtual void SetVehicleEngineAutoStartEnabled(bool enabled) = 0; virtual bool IsPs2ScorchedVehiclesEnabled() const noexcept = 0; - virtual void SetPs2ScorchedVehiclesEnabled(bool enabled) = 0; + virtual void SetPs2ScorchedVehiclesEnabled(bool enabled) noexcept = 0; virtual bool IsRapidVehicleStopFixEnabled() const noexcept = 0; virtual void SetRapidVehicleStopFixEnabled(bool enabled) = 0; From cdb3deb499b4a135d7c0be1ad2d966ae316b3741 Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Fri, 24 Jul 2026 18:52:20 +0300 Subject: [PATCH 4/5] Add PS2 scorched vehicles settings and GUI integration - Introduced a new setting for PS2 scorched vehicles in CClientVariables, allowing users to enable or disable this feature. - Updated CCore to apply the PS2 scorched vehicles setting in multiplayer. - Added GUI elements in CSettings for user interaction with the PS2 scorched vehicles option. - Enhanced the Reset and SaveData methods in CSettings to handle the new setting appropriately. These changes improve user control over the visual effects related to PS2 vehicles, enhancing the overall gaming experience. --- Client/core/CClientVariables.cpp | 1 + Client/core/CCore.cpp | 2 ++ Client/core/CSettings.cpp | 16 ++++++++++++++++ Client/core/CSettings.h | 1 + Client/mods/deathmatch/logic/CClientGame.cpp | 6 ------ Client/mods/deathmatch/logic/CPacketHandler.cpp | 1 - Server/mods/deathmatch/logic/CGame.cpp | 2 -- .../deathmatch/logic/packets/CMapInfoPacket.cpp | 1 - Shared/mods/deathmatch/logic/Enums.cpp | 1 - Shared/mods/deathmatch/logic/Enums.h | 1 - Shared/sdk/net/SyncStructures.h | 4 +--- Tests/client/SyncMisc_Tests.cpp | 4 ++-- 12 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Client/core/CClientVariables.cpp b/Client/core/CClientVariables.cpp index 8f34d94e1f..6113ca485e 100644 --- a/Client/core/CClientVariables.cpp +++ b/Client/core/CClientVariables.cpp @@ -351,6 +351,7 @@ void CClientVariables::LoadDefaults() DEFAULT("high_detail_peds", 0); // Disable rendering high detail peds all the time DEFAULT("blur", 1); // Enable blur DEFAULT("corona_reflections", 0); // Disable corona rain reflections + DEFAULT("ps2_scorched_vehicles", 0); DEFAULT("dynamic_ped_shadows", 0); // Disable dynamic ped shadows DEFAULT("fast_clothes_loading", 1); // 0-off 1-auto 2-on DEFAULT("allow_screen_upload", 1); // 0-off 1-on diff --git a/Client/core/CCore.cpp b/Client/core/CCore.cpp index a47cee348e..d6f57fac22 100644 --- a/Client/core/CCore.cpp +++ b/Client/core/CCore.cpp @@ -684,6 +684,8 @@ void CCore::ApplyGameSettings() pGameSettings->SetGrassEnabled(bVal); CVARS_GET("heat_haze", bVal); m_pMultiplayer->SetHeatHazeEnabled(bVal); + CVARS_GET("ps2_scorched_vehicles", bVal); + m_pMultiplayer->SetPs2ScorchedVehiclesEnabled(bVal); CVARS_GET("fast_clothes_loading", iVal); m_pMultiplayer->SetFastClothesLoading((CMultiplayer::EFastClothesLoading)iVal); CVARS_GET("tyre_smoke_enabled", bVal); diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index 9e76d37902..d377252ec1 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -233,6 +233,7 @@ void CSettings::ResetGuiPointers() m_pCheckBoxHighDetailPeds = NULL; m_pCheckBoxBlur = NULL; m_pCheckBoxCoronaReflections = NULL; + m_pCheckBoxPs2ScorchedVehicles = NULL; m_pCheckBoxDynamicPedShadows = NULL; m_pFieldOfViewLabel = NULL; m_pFieldOfView = NULL; @@ -1407,6 +1408,10 @@ void CSettings::CreateGUI() m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 150.0f)); m_pCheckBoxCoronaReflections->AutoSize(nullptr, 20.0f); + m_pCheckBoxPs2ScorchedVehicles = reinterpret_cast(pManager->CreateCheckBox(pTabVideo, _("PS2 scorched vehicles"), true)); + m_pCheckBoxPs2ScorchedVehicles->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 170.0f)); + m_pCheckBoxPs2ScorchedVehicles->AutoSize(nullptr, 20.0f); + float fPosY = vecTemp.fY; m_pCheckBoxMinimize = reinterpret_cast(pManager->CreateCheckBox(pTabVideo, _("Full Screen Minimize"), true)); m_pCheckBoxMinimize->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 30.0f)); @@ -2330,6 +2335,11 @@ void CSettings::UpdateVideoTab() CVARS_GET("corona_reflections", bCoronaReflections); m_pCheckBoxCoronaReflections->SetSelected(bCoronaReflections); + // PS2 scorched vehicles + bool bPs2ScorchedVehicles; + CVARS_GET("ps2_scorched_vehicles", bPs2ScorchedVehicles); + m_pCheckBoxPs2ScorchedVehicles->SetSelected(bPs2ScorchedVehicles); + // Dynamic ped shadows bool bDynamicPedShadows; CVARS_GET("dynamic_ped_shadows", bDynamicPedShadows); @@ -2679,6 +2689,7 @@ bool CSettings::OnVideoDefaultClick(CGUIElement* pElement) CVARS_SET("high_detail_peds", false); CVARS_SET("blur", true); CVARS_SET("corona_reflections", false); + CVARS_SET("ps2_scorched_vehicles", false); CVARS_SET("dynamic_ped_shadows", false); CVARS_SET("borderless_gamma_power", kBorderlessGammaDefault); CVARS_SET("borderless_brightness_scale", kBorderlessBrightnessDefault); @@ -4499,6 +4510,11 @@ void CSettings::SaveData() CVARS_SET("corona_reflections", bCoronaReflections); gameSettings->ResetCoronaReflectionsEnabled(); + // PS2 scorched vehicles (client graphics preference) + bool bPs2ScorchedVehicles = m_pCheckBoxPs2ScorchedVehicles->GetSelected(); + CVARS_SET("ps2_scorched_vehicles", bPs2ScorchedVehicles); + g_pCore->GetMultiplayer()->SetPs2ScorchedVehiclesEnabled(bPs2ScorchedVehicles); + // Dynamic ped shadows bool bDynamicPedShadows = m_pCheckBoxDynamicPedShadows->GetSelected(); CVARS_SET("dynamic_ped_shadows", bDynamicPedShadows); diff --git a/Client/core/CSettings.h b/Client/core/CSettings.h index 9e5dc07567..f5e2470f5c 100644 --- a/Client/core/CSettings.h +++ b/Client/core/CSettings.h @@ -175,6 +175,7 @@ class CSettings CGUICheckBox* m_pCheckBoxHighDetailPeds; CGUICheckBox* m_pCheckBoxBlur; CGUICheckBox* m_pCheckBoxCoronaReflections; + CGUICheckBox* m_pCheckBoxPs2ScorchedVehicles; CGUICheckBox* m_pCheckBoxDynamicPedShadows; CGUILabel* m_pFieldOfViewLabel; CGUIScrollBar* m_pFieldOfView; diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 9697996dea..69edcc4337 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -6160,9 +6160,6 @@ bool CClientGame::SetWorldSpecialProperty(const WorldSpecialProperty property, c case WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART: SetVehicleEngineAutoStartEnabled(enabled); break; - case WorldSpecialProperty::PS2SCORCHEDVEHICLES: - g_pMultiplayer->SetPs2ScorchedVehiclesEnabled(enabled); - break; default: return false; } @@ -6211,8 +6208,6 @@ bool CClientGame::IsWorldSpecialProperty(const WorldSpecialProperty property) return g_pGame->IsVehicleBurnExplosionsEnabled(); case WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART: return IsVehicleEngineAutoStartEnabled(); - case WorldSpecialProperty::PS2SCORCHEDVEHICLES: - return g_pMultiplayer->IsPs2ScorchedVehiclesEnabled(); } return false; @@ -7018,7 +7013,6 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo m_pVehicleManager->SetSpawnFlyingComponentEnabled(true); g_pGame->SetVehicleBurnExplosionsEnabled(true); SetVehicleEngineAutoStartEnabled(true); - g_pMultiplayer->SetPs2ScorchedVehiclesEnabled(false); } // Reset all setWorldProperty to default diff --git a/Client/mods/deathmatch/logic/CPacketHandler.cpp b/Client/mods/deathmatch/logic/CPacketHandler.cpp index 71d7a4b0b4..1fb1a3d8fa 100644 --- a/Client/mods/deathmatch/logic/CPacketHandler.cpp +++ b/Client/mods/deathmatch/logic/CPacketHandler.cpp @@ -2438,7 +2438,6 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream) g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FLYINGCOMPONENTS, wsProps.data.flyingcomponents); g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, wsProps.data.vehicleburnexplosions); g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, wsProps.data.vehicleEngineAutoStart); - g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::PS2SCORCHEDVEHICLES, wsProps.data.ps2ScorchedVehicles); float fJetpackMaxHeight = 100; if (!bitStream.Read(fJetpackMaxHeight)) diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index 57f2c29ae4..4ce0091d5e 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -272,7 +272,6 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connections per 30 m_WorldSpecialProps[WorldSpecialProperty::FLYINGCOMPONENTS] = true; m_WorldSpecialProps[WorldSpecialProperty::VEHICLEBURNEXPLOSIONS] = true; m_WorldSpecialProps[WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART] = true; - m_WorldSpecialProps[WorldSpecialProperty::PS2SCORCHEDVEHICLES] = false; m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true; m_JetpackWeapons[WEAPONTYPE_TEC9] = true; @@ -4515,7 +4514,6 @@ void CGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo) g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS, true); g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, true); g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, true); - g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::PS2SCORCHEDVEHICLES, false); } // Reset all weather stuff like heat haze, wind velocity etc diff --git a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp index b8d2b1e12d..aceac1b129 100644 --- a/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp @@ -192,7 +192,6 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const wsProps.data.flyingcomponents = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS); wsProps.data.vehicleburnexplosions = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS); wsProps.data.vehicleEngineAutoStart = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART); - wsProps.data.ps2ScorchedVehicles = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::PS2SCORCHEDVEHICLES); BitStream.Write(&wsProps); BitStream.Write(m_fJetpackMaxHeight); diff --git a/Shared/mods/deathmatch/logic/Enums.cpp b/Shared/mods/deathmatch/logic/Enums.cpp index 77cd43101e..8bb99db974 100644 --- a/Shared/mods/deathmatch/logic/Enums.cpp +++ b/Shared/mods/deathmatch/logic/Enums.cpp @@ -120,7 +120,6 @@ ADD_ENUM(WorldSpecialProperty::IGNOREFIRESTATE, "ignorefirestate") ADD_ENUM(WorldSpecialProperty::FLYINGCOMPONENTS, "flyingcomponents") ADD_ENUM(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, "vehicleburnexplosions") ADD_ENUM(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, "vehicle_engine_autostart") -ADD_ENUM(WorldSpecialProperty::PS2SCORCHEDVEHICLES, "ps2scorchedvehicles") IMPLEMENT_ENUM_CLASS_END("world-special-property") IMPLEMENT_ENUM_BEGIN(ePacketID) diff --git a/Shared/mods/deathmatch/logic/Enums.h b/Shared/mods/deathmatch/logic/Enums.h index cb72ef409f..884bb559f5 100644 --- a/Shared/mods/deathmatch/logic/Enums.h +++ b/Shared/mods/deathmatch/logic/Enums.h @@ -97,7 +97,6 @@ enum class WorldSpecialProperty FLYINGCOMPONENTS, VEHICLEBURNEXPLOSIONS, VEHICLE_ENGINE_AUTOSTART, - PS2SCORCHEDVEHICLES, }; DECLARE_ENUM_CLASS(WorldSpecialProperty); diff --git a/Shared/sdk/net/SyncStructures.h b/Shared/sdk/net/SyncStructures.h index 1f5c72ab56..8c3276be53 100644 --- a/Shared/sdk/net/SyncStructures.h +++ b/Shared/sdk/net/SyncStructures.h @@ -1962,7 +1962,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure { enum { - BITCOUNT = 21 + BITCOUNT = 20 }; bool Read(NetBitStreamInterface& bitStream) @@ -2009,7 +2009,6 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure bool flyingcomponents : 1; bool vehicleburnexplosions : 1; bool vehicleEngineAutoStart : 1; - bool ps2ScorchedVehicles : 1; } data; // Add new ones in separate structs @@ -2037,7 +2036,6 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure data.flyingcomponents = true; data.vehicleburnexplosions = true; data.vehicleEngineAutoStart = true; - data.ps2ScorchedVehicles = false; } }; diff --git a/Tests/client/SyncMisc_Tests.cpp b/Tests/client/SyncMisc_Tests.cpp index b96af826d9..0dd84f8d00 100644 --- a/Tests/client/SyncMisc_Tests.cpp +++ b/Tests/client/SyncMisc_Tests.cpp @@ -87,7 +87,7 @@ TEST(SFunBugsStateSync, RoundTrip) // World special properties // ============================================================================ -// 21 boolean flags controlling world behaviour (hovercars, foliage, etc.). +// 20 boolean flags controlling world behaviour (hovercars, foliage, etc.). // The constructor sets default values, so we flip a few and verify both // changed and unchanged flags. TEST(SWorldSpecialPropertiesStateSync, RoundTrip) @@ -98,7 +98,7 @@ TEST(SWorldSpecialPropertiesStateSync, RoundTrip) sync.data.randomfoliage = false; sync.data.vehicleEngineAutoStart = false; sync.Write(bs); - EXPECT_EQ(21, bs.GetNumberOfBitsUsed()); + EXPECT_EQ(20, bs.GetNumberOfBitsUsed()); bs.ResetReadPointer(); SWorldSpecialPropertiesStateSync out; EXPECT_TRUE(out.Read(bs)); From 82e10ea2327951c77ad63966721ce95a3aa99f72 Mon Sep 17 00:00:00 2001 From: Batuhan Tonga <76632145+QueryOfficial@users.noreply.github.com> Date: Fri, 24 Jul 2026 22:21:17 +0300 Subject: [PATCH 5/5] Address FileEX review: nullptr, CVAR comment, clang-format --- Client/core/CClientVariables.cpp | 2 +- Client/core/CSettings.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/core/CClientVariables.cpp b/Client/core/CClientVariables.cpp index 6113ca485e..92e6686c58 100644 --- a/Client/core/CClientVariables.cpp +++ b/Client/core/CClientVariables.cpp @@ -351,7 +351,7 @@ void CClientVariables::LoadDefaults() DEFAULT("high_detail_peds", 0); // Disable rendering high detail peds all the time DEFAULT("blur", 1); // Enable blur DEFAULT("corona_reflections", 0); // Disable corona rain reflections - DEFAULT("ps2_scorched_vehicles", 0); + DEFAULT("ps2_scorched_vehicles", 0); // Disable PS2-style scorched destroyed vehicles DEFAULT("dynamic_ped_shadows", 0); // Disable dynamic ped shadows DEFAULT("fast_clothes_loading", 1); // 0-off 1-auto 2-on DEFAULT("allow_screen_upload", 1); // 0-off 1-on diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index d377252ec1..35e53ebd72 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -233,7 +233,7 @@ void CSettings::ResetGuiPointers() m_pCheckBoxHighDetailPeds = NULL; m_pCheckBoxBlur = NULL; m_pCheckBoxCoronaReflections = NULL; - m_pCheckBoxPs2ScorchedVehicles = NULL; + m_pCheckBoxPs2ScorchedVehicles = nullptr; m_pCheckBoxDynamicPedShadows = NULL; m_pFieldOfViewLabel = NULL; m_pFieldOfView = NULL;