Skip to content

Commit 18a75ec

Browse files
committed
fix(input): Correct keyboard repeat interval math to match original behavior
1 parent ef712ba commit 18a75ec

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Bool Keyboard::checkKeyRepeat( void )
248248
m_keyStatus[ index ].sequence = m_inputFrame;
249249

250250
// Set repeated key so it will repeat again after the interval
251-
m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC - KEY_REPEAT_INTERVAL_MSEC);
251+
m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC + KEY_REPEAT_INTERVAL_MSEC);
252252

253253
retVal = TRUE;
254254
break; // exit for key

Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
282282
{
283283
stopScrolling();
284284
}
285-
break;
286-
}
285+
break;
286+
}
287287

288288
//-----------------------------------------------------------------------------
289289
case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN:

GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Bool Keyboard::checkKeyRepeat( void )
248248
m_keyStatus[ index ].sequence = m_inputFrame;
249249

250250
// Set repeated key so it will repeat again after the interval
251-
m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC - KEY_REPEAT_INTERVAL_MSEC);
251+
m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC + KEY_REPEAT_INTERVAL_MSEC);
252252

253253
retVal = TRUE;
254254
break; // exit for key

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
281281
{
282282
stopScrolling();
283283
}
284-
break;
285-
}
284+
break;
285+
}
286286

287287
//-----------------------------------------------------------------------------
288288
case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN:

0 commit comments

Comments
 (0)