Skip to content

Commit

Permalink
Fix for randomly bright objects after weapon change (#3838)
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX authored Nov 5, 2024
1 parent 2c9f48c commit 9b9120c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Client/multiplayer_sa/CMultiplayerSA_Weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,33 @@ void _declspec(naked) HOOK_Fx_AddBulletImpact()
}
}

//////////////////////////////////////////////////////////////////////////////////////////
//
// CVisibilityPlugins::RenderWeaponPedsForPC
//
// Fix for the bright objects after weapon change sometimes
//
//////////////////////////////////////////////////////////////////////////////////////////
#define HOOKPOS_CVisibilityPlugins_RenderWeaponPedsForPC 0x733123
#define HOOKSIZE_CVisibilityPlugins_RenderWeaponPedsForPC 5
static constexpr DWORD CONTINUE_CVisibilityPlugins_RenderWeaponPedsForPC = 0x733128;
static void _declspec(naked) HOOK_CVisibilityPlugins_RenderWeaponPedsForPC()
{
_asm
{
mov eax, 5DF4E0h
call eax // call CPed::ResetGunFlashAlpha

mov eax, 5533B0h
mov ecx, ebx

push 0
call eax // call CPed::RemoveLighting

jmp CONTINUE_CVisibilityPlugins_RenderWeaponPedsForPC
}
}

//////////////////////////////////////////////////////////////////////////////////////////
//
// CMultiplayerSA::InitHooks_Weapons
Expand All @@ -212,4 +239,5 @@ void CMultiplayerSA::InitHooks_Weapons()
EZHookInstall(CWeapon_GenerateDamageEvent);
EZHookInstall(CShotInfo_Update);
EZHookInstall(Fx_AddBulletImpact);
EZHookInstall(CVisibilityPlugins_RenderWeaponPedsForPC);
}

0 comments on commit 9b9120c

Please sign in to comment.