View_AddEvent: Add hack to cache and verify we're playing the event only on our frame of choice

This commit is contained in:
Marco Cawthorne 2021-03-30 07:30:33 +02:00
parent b043b57ed5
commit 9319e63619
3 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,7 @@ struct
void(void) m_pEventCall;
float m_flEventTime;
float m_flEventFrame;
int m_iLastWeapon;
int m_iOldWeapon;

View File

@ -122,6 +122,9 @@ Event_Callback(float mtime, __inout float btime)
if (pSeat->m_pEventCall == __NULL__)
return;
if (pSeat->m_flEventFrame != pSeat->m_eViewModel.frame)
return;
/* only play once */
if (mtime == btime)
return;

View File

@ -52,6 +52,7 @@ View_AddEvent(void(void) pCallback, float flTime)
{
pSeat->m_pEventCall = pCallback;
pSeat->m_flEventTime = flTime;
pSeat->m_flEventFrame = pSeat->m_eViewModel.frame;
}
void