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; void(void) m_pEventCall;
float m_flEventTime; float m_flEventTime;
float m_flEventFrame;
int m_iLastWeapon; int m_iLastWeapon;
int m_iOldWeapon; int m_iOldWeapon;

View file

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

View file

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