From a1aa3b62fa75a97045dc4ad17d0d4c1b15296cea Mon Sep 17 00:00:00 2001 From: Lordmau5 Date: Sun, 8 Sep 2024 11:49:15 +0200 Subject: [PATCH] Only set "PreventLosingWeapons" when enabled --- src/gtasa/GameHandler.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gtasa/GameHandler.h b/src/gtasa/GameHandler.h index 4cb7d81..e8e73da 100644 --- a/src/gtasa/GameHandler.h +++ b/src/gtasa/GameHandler.h @@ -111,14 +111,6 @@ class GameHandler HOOK (GlobalHooksInstance::Get (), Hooked_DrawBlur, void (float), 0x704E8A); - // Lose weapons after busted or wasted - for (int address : {0x442E16 + 1, 0x4431CF + 1}) - { - injector::WriteMemory (address, - &loseWeaponsAfterDeathOrBusted, - true); - } - // TODO: Option to disable music during dance and lowrider minigame // We will probably have to set the SFX volume to 0. // Alternatively, changing the pointer to our own variable @@ -167,6 +159,20 @@ class GameHandler HOOK_METHOD_ARGS (GlobalHooksInstance::Get (), Hooked_OpCodes_1100_1199, char (CRunningScript *, int), 0x48A320); + // Prevent losing weapons after death or busted + loseWeaponsAfterDeathOrBusted + = !CONFIG ("Fixes.PreventLosingWeapons", false); + if (!loseWeaponsAfterDeathOrBusted) + { + // Lose weapons after busted or wasted + for (int address : {0x442E16 + 1, 0x4431CF + 1}) + { + injector::WriteMemory (address, + &loseWeaponsAfterDeathOrBusted, + true); + } + } + Missions::Initialise (); initialised = true; @@ -196,9 +202,6 @@ class GameHandler static void UpdateConfigValues () { - loseWeaponsAfterDeathOrBusted - = !CONFIG ("Fixes.PreventLosingWeapons", false); - UpdateFrameDelay (); UpdateDisableReplays (); UpdateDisableInteriorMusic ();