From 9de11adc48484f6cecaeb4f6db932b0466547bea Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 12 Oct 2024 11:36:07 +0200 Subject: [PATCH] SA: Rename TrueInvicibility to TrueInvincibility Fixes #28 --- Config/SilentPatchSA.ini | 4 ++-- SilentPatchSA/SilentPatchSA.cpp | 31 ++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Config/SilentPatchSA.ini b/Config/SilentPatchSA.ini index 1c87921..ea7a55a 100644 --- a/Config/SilentPatchSA.ini +++ b/Config/SilentPatchSA.ini @@ -22,8 +22,8 @@ SunSizeHack=1 ; This matches the behaviour present in GTA III or VC, but may not look perfect in all cases - so consider it ; a matter of personal preference DirectionalFromSun=0 -; When this setting is enabled, police helicopter will not be able to hurt CJ when Invicibility Cheat is active -TrueInvicibility=0 +; When this setting is enabled, police helicopter will not be able to hurt CJ when Invincibility Cheat is active +TrueInvincibility=0 ; Allows to override units used by the game - 0 forces metric units, 1 forces imperial units, ; -1 makes the game use units based on system locale Units=-1 diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index e859083..59b0ec2 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -1840,7 +1840,7 @@ namespace LightbeamFix } -namespace TrueInvicibility +namespace TrueInvincibility { static bool isEnabled = false; static uintptr_t WillKillJumpBack; @@ -4145,18 +4145,27 @@ BOOL InjectDelayedPatches_10() } } - // True invicibility - not being hurt by Police Maverick bullets anymore - if ( const int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"TrueInvicibility", -1, wcModulePath); INIoption != -1 && !bSAMP ) + // True invincibility - not being hurt by Police Maverick bullets anymore + if ( !bSAMP ) { - using namespace TrueInvicibility; - - isEnabled = INIoption != 0; - WillKillJumpBack = 0x4B3238; - InjectHook( 0x4B322E, ComputeWillKillPedHook, HookType::Jump ); - - if ( bHasDebugMenu ) + int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"TrueInvincibility", -1, wcModulePath); + if (INIoption == -1) { - DebugMenuAddVar( "SilentPatch", "True invicibility", &isEnabled, nullptr ); + // Minor spelling mistake, keep it for backwards compatibility with old INI files + INIoption = GetPrivateProfileIntW(L"SilentPatch", L"TrueInvicibility", -1, wcModulePath); + } + if (INIoption != -1) + { + using namespace TrueInvincibility; + + isEnabled = INIoption != 0; + WillKillJumpBack = 0x4B3238; + InjectHook( 0x4B322E, ComputeWillKillPedHook, HookType::Jump ); + + if ( bHasDebugMenu ) + { + DebugMenuAddVar( "SilentPatch", "True invincibility", &isEnabled, nullptr ); + } } }