InputSystem: fix controller hold keys not working

Should've been !keyInfo.m_bKeyDown.
This commit is contained in:
Kawe Mazidjatari 2023-12-30 17:32:38 +01:00
parent b618daa694
commit d592bb2241
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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: