diff --git a/src/engine/sys_mainwind.cpp b/src/engine/sys_mainwind.cpp index b08353e2..8fb7d3ce 100644 --- a/src/engine/sys_mainwind.cpp +++ b/src/engine/sys_mainwind.cpp @@ -121,12 +121,12 @@ void CGame::GetWindowRect(int* const x, int* const y, int* const w, int* const h //----------------------------------------------------------------------------- // Purpose: dispatch key event //----------------------------------------------------------------------------- -void CGame::DispatchKeyEvent(const uint64_t msTime, const ButtonCode_t buttonCode) const +void CGame::DispatchKeyEvent(const uint64_t currentTick, const ButtonCode_t buttonCode) const { - const float duration = buttonCode == KEY_XBUTTON_BACK ? 1.0f : 0.2f; + const float delay = buttonCode == KEY_XBUTTON_BACK ? 1.0f : 0.2f; KeyInfo_t& keyInfo = g_pKeyInfo[buttonCode]; - if (keyInfo.m_bKeyDown && ((msTime - keyInfo.m_nEventTick) * 0.001f) >= duration) + if (!keyInfo.m_bKeyDown && ((currentTick - keyInfo.m_nEventTick) * 0.001f) >= delay) { KeyEvent_t keyEvent; diff --git a/src/engine/sys_mainwind.h b/src/engine/sys_mainwind.h index a4451beb..76745149 100644 --- a/src/engine/sys_mainwind.h +++ b/src/engine/sys_mainwind.h @@ -34,7 +34,7 @@ public: inline float GetTVRefreshRate() const // Avoid stutter on TV's running on broadcast frame rates. { return ((float)m_iDesktopRefreshRate == 59.0f || (float)m_iDesktopRefreshRate == 60.0f) ? 59.939999f : (float)m_iDesktopRefreshRate; } - void DispatchKeyEvent(const uint64_t msTime, const ButtonCode_t buttonCode) const; + void DispatchKeyEvent(const uint64_t currentTick, const ButtonCode_t buttonCode) const; void DispatchAllStoredGameMessages() const; private: