Skip to content

Commit 9b9120c

Browse files
authored
Fix for randomly bright objects after weapon change (#3838)
1 parent 2c9f48c commit 9b9120c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Client/multiplayer_sa/CMultiplayerSA_Weapons.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,33 @@ void _declspec(naked) HOOK_Fx_AddBulletImpact()
200200
}
201201
}
202202

203+
//////////////////////////////////////////////////////////////////////////////////////////
204+
//
205+
// CVisibilityPlugins::RenderWeaponPedsForPC
206+
//
207+
// Fix for the bright objects after weapon change sometimes
208+
//
209+
//////////////////////////////////////////////////////////////////////////////////////////
210+
#define HOOKPOS_CVisibilityPlugins_RenderWeaponPedsForPC 0x733123
211+
#define HOOKSIZE_CVisibilityPlugins_RenderWeaponPedsForPC 5
212+
static constexpr DWORD CONTINUE_CVisibilityPlugins_RenderWeaponPedsForPC = 0x733128;
213+
static void _declspec(naked) HOOK_CVisibilityPlugins_RenderWeaponPedsForPC()
214+
{
215+
_asm
216+
{
217+
mov eax, 5DF4E0h
218+
call eax // call CPed::ResetGunFlashAlpha
219+
220+
mov eax, 5533B0h
221+
mov ecx, ebx
222+
223+
push 0
224+
call eax // call CPed::RemoveLighting
225+
226+
jmp CONTINUE_CVisibilityPlugins_RenderWeaponPedsForPC
227+
}
228+
}
229+
203230
//////////////////////////////////////////////////////////////////////////////////////////
204231
//
205232
// CMultiplayerSA::InitHooks_Weapons
@@ -212,4 +239,5 @@ void CMultiplayerSA::InitHooks_Weapons()
212239
EZHookInstall(CWeapon_GenerateDamageEvent);
213240
EZHookInstall(CShotInfo_Update);
214241
EZHookInstall(Fx_AddBulletImpact);
242+
EZHookInstall(CVisibilityPlugins_RenderWeaponPedsForPC);
215243
}

0 commit comments

Comments
 (0)