Skip to content

Commit abc0a90

Browse files
committed
Fix bug
1 parent 2c9f48c commit abc0a90

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Client/multiplayer_sa/CMultiplayerSA_Weapons.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,35 @@ 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+
pushad
224+
push 0
225+
call eax // call CPed::RemoveLighting
226+
popad
227+
228+
jmp CONTINUE_CVisibilityPlugins_RenderWeaponPedsForPC
229+
}
230+
}
231+
203232
//////////////////////////////////////////////////////////////////////////////////////////
204233
//
205234
// CMultiplayerSA::InitHooks_Weapons
@@ -212,4 +241,5 @@ void CMultiplayerSA::InitHooks_Weapons()
212241
EZHookInstall(CWeapon_GenerateDamageEvent);
213242
EZHookInstall(CShotInfo_Update);
214243
EZHookInstall(Fx_AddBulletImpact);
244+
EZHookInstall(CVisibilityPlugins_RenderWeaponPedsForPC);
215245
}

0 commit comments

Comments
 (0)