Skip to content

Commit

Permalink
Only set "PreventLosingWeapons" when enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordmau5 committed Sep 8, 2024
1 parent 17aa442 commit a1aa3b6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/gtasa/GameHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool *> (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
Expand Down Expand Up @@ -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<bool *> (address,
&loseWeaponsAfterDeathOrBusted,
true);
}
}

Missions::Initialise ();

initialised = true;
Expand Down Expand Up @@ -196,9 +202,6 @@ class GameHandler
static void
UpdateConfigValues ()
{
loseWeaponsAfterDeathOrBusted
= !CONFIG ("Fixes.PreventLosingWeapons", false);

UpdateFrameDelay ();
UpdateDisableReplays ();
UpdateDisableInteriorMusic ();
Expand Down

0 comments on commit a1aa3b6

Please sign in to comment.