@@ -578,6 +578,38 @@ static void _declspec(naked) HOOK_CTaskSimpleSwim__ProcessEffectsBubbleFix()
578
578
}
579
579
}
580
580
581
+ // Fixes invisible weapon particles (extinguisher, spraycan, flamethrower) at high FPS
582
+ #define HOOKPOS_CWeapon_Update 0x73DC3D
583
+ #define HOOKSIZE_CWeapon_Update 5
584
+ static constexpr std::uintptr_t RETURN_CWeapon_Update = 0x073DC42 ;
585
+ static void __declspec (naked) HOOK_CWeapon_Update()
586
+ {
587
+ _asm
588
+ {
589
+ // timeStep / kOriginalTimeStep
590
+ fld ds:[0xB7CB5C ] // CTimer::ms_fTimeStep
591
+ fdiv kOriginalTimeStep
592
+
593
+ mov eax, [esi+10h] // m_timeToNextShootInMS
594
+ mov ebx, ds:[0xB7CB84 ] // CTimer::m_snTimeInMilliseconds
595
+
596
+ sub eax, ebx // m_timeToNextShootInMS - CTimer::m_snTimeInMilliseconds
597
+
598
+ push eax
599
+ fild dword ptr [esp]
600
+ add esp, 4
601
+
602
+ fmul st (0 ), st (1 ) // (m_timeToNextShootInMS - CTimer::m_snTimeInMilliseconds) * (timeStep / kOriginalTimeStep)
603
+ fadd st (0 ), ebx // + m_snTimeInMilliseconds
604
+ fistp [esi+10h]
605
+
606
+ mov eax, ebx
607
+
608
+ xor ebx, ebx
609
+ jmp RETURN_CWeapon_Update
610
+ }
611
+ }
612
+
581
613
void CMultiplayerSA::InitHooks_FrameRateFixes ()
582
614
{
583
615
EZHookInstall (CTaskSimpleUseGun__SetMoveAnim);
@@ -619,4 +651,6 @@ void CMultiplayerSA::InitHooks_FrameRateFixes()
619
651
EZHookInstall (CVehicle__AddExhaustParticles);
620
652
EZHookInstall (CTaskSimpleSwim__ProcessEffects);
621
653
EZHookInstall (CTaskSimpleSwim__ProcessEffectsBubbleFix);
654
+
655
+ EZHookInstall (CWeapon_Update);
622
656
}
0 commit comments