Skip to content

Commit

Permalink
Fix #508 Texture bug with setJetpackWeaponEnabled (#3559)
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX authored Jul 15, 2024
1 parent e3a8bd9 commit a68c2c4
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Client/multiplayer_sa/CMultiplayerSA_1.3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ DWORD RETURN_CProjectile_FixTearGasCrash_Cont = 0x4C0409;
#define HOOKPOS_CProjectile_FixExplosionLocation 0x738A77
DWORD RETURN_CProjectile_FixExplosionLocation = 0x738A86;

#define HOOKPOS_CPed_RemoveWeaponWhenEnteringVehicle 0x5E6370
DWORD RETURN_CPed_RemoveWeaponWhenEnteringVehicle = 0x5E6379;

void HOOK_CVehicle_ProcessStuff_TestSirenTypeSingle();
void HOOK_CVehicle_ProcessStuff_PostPushSirenPositionSingle();
void HOOK_CVehicle_ProcessStuff_TestSirenTypeDual();
Expand All @@ -137,6 +140,7 @@ void HOOK_CVehicleModelInterface_SetClump();
void HOOK_CBoat_ApplyDamage();
void HOOK_CProjectile_FixTearGasCrash();
void HOOK_CProjectile_FixExplosionLocation();
void HOOK_CPed_RemoveWeaponWhenEnteringVehicle();

void CMultiplayerSA::Init_13()
{
Expand Down Expand Up @@ -192,6 +196,9 @@ void CMultiplayerSA::InitHooks_13()

HookInstall(HOOKPOS_CProjectile_FixExplosionLocation, (DWORD)HOOK_CProjectile_FixExplosionLocation, 12);

// Fix invisible weapons during jetpack task
HookInstall(HOOKPOS_CPed_RemoveWeaponWhenEnteringVehicle, (DWORD)HOOK_CPed_RemoveWeaponWhenEnteringVehicle, 9);

InitHooks_ClothesSpeedUp();
EnableHooks_ClothesMemFix(true);
InitHooks_FixBadAnimId();
Expand Down Expand Up @@ -1668,3 +1675,42 @@ void _declspec(naked) HOOK_CProjectile_FixExplosionLocation()
jmp RETURN_CProjectile_FixExplosionLocation
}
}

DWORD CPed_RemoveWeaponWhenEnteringVehicle_CalledFrom = 0;
void _declspec(naked) HOOK_CPed_RemoveWeaponWhenEnteringVehicle()
{
_asm
{
push eax
mov eax, [esp+4]
mov CPed_RemoveWeaponWhenEnteringVehicle_CalledFrom, eax
pop eax

push esi
mov esi, ecx
mov eax, [esi+480h]
}

// Called from CTaskSimpleJetPack::ProcessPed
if (CPed_RemoveWeaponWhenEnteringVehicle_CalledFrom == 0x68025F)
{
_asm
{
mov pPedUsingJetpack, esi
}

if (AllowJetPack())
{
_asm
{
pop esi
retn 4
}
}
}

_asm
{
jmp RETURN_CPed_RemoveWeaponWhenEnteringVehicle
}
}

0 comments on commit a68c2c4

Please sign in to comment.