TrueInvicibility INI option

This commit is contained in:
Silent 2019-03-07 23:02:49 +01:00
parent 3a40147ce9
commit 971e4a26a7
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1

View file

@ -1556,6 +1556,34 @@ namespace LightbeamFix
} }
namespace TrueInvicibility
{
static bool isEnabled = false;
static uintptr_t WillKillJumpBack;
void __declspec(naked) ComputeWillKillPedHook()
{
_asm
{
cmp dword ptr [ebp+0Ch], WEAPONTYPE_LAST_WEAPONTYPE
jl ComputeWillKillPedHook_DoNotKill
cmp [isEnabled], 0
je ComputeWillKillPedHook_Kill
cmp dword ptr [ebp+0Ch], WEAPONTYPE_UZI_DRIVEBY
jne ComputeWillKillPedHook_Kill
ComputeWillKillPedHook_DoNotKill:
pop esi
pop ebp
pop ebx
retn 0Ch
ComputeWillKillPedHook_Kill:
jmp [WillKillJumpBack]
}
}
}
#ifndef NDEBUG #ifndef NDEBUG
// ============= QPC spoof for verifying high timer issues ============= // ============= QPC spoof for verifying high timer issues =============
@ -2716,6 +2744,21 @@ 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 )
{
using namespace TrueInvicibility;
isEnabled = INIoption != 0;
WillKillJumpBack = 0x4B3238;
InjectHook( 0x4B322E, ComputeWillKillPedHook, PATCH_JUMP );
if ( bHasDebugMenu )
{
DebugMenuAddVar( "SilentPatch", "True invicibility", &isEnabled, nullptr );
}
}
// Moonphases // Moonphases
// Not taking effect with new skygfx since aap has it too now // Not taking effect with new skygfx since aap has it too now
if ( !ModCompat::SkygfxPatchesMoonphases( skygfxModule ) ) if ( !ModCompat::SkygfxPatchesMoonphases( skygfxModule ) )