Skip to content

Commit

Permalink
Fixes breakable objects decaying faster on high fps (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
Merlin committed Aug 2, 2022
1 parent f597c46 commit 7c26ddd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Client/multiplayer_sa/CMultiplayerSA_FrameRateFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,30 @@ void _declspec(naked) HOOK_CTimer__Update()
}
}

#define HOOKPOS_BreakObject_c__Update 0x59E420
#define HOOKSIZE_BreakObject_c__Update 0xB
const unsigned int RETURN_BreakObject_c__Update = 0x59E42B;

void _declspec(naked) HOOK_BreakObject_c__Update()
{
_asm {
movzx edx, bWouldBeNewFrame
test edx, edx
jz skip

mov edx, [edi+eax+0x70]
lea eax, [edi+eax+0x70]
dec edx
mov [eax], edx

skip:
jmp RETURN_BreakObject_c__Update
}
}

void CMultiplayerSA::InitHooks_FrameRateFixes()
{
EZHookInstall(CTaskSimpleUseGun__SetMoveAnim);
EZHookInstall(CTimer__Update);
EZHookInstall(BreakObject_c__Update);
}

0 comments on commit 7c26ddd

Please sign in to comment.