Skip to content

Commit 797ac20

Browse files
committed
refactor(input): Remove obsolete sequence field from keyboard input system
1 parent 18a75ec commit 797ac20

File tree

6 files changed

+0
-38
lines changed

6 files changed

+0
-38
lines changed

Generals/Code/GameEngine/Include/GameClient/Keyboard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ struct KeyboardIO
7676
UnsignedByte key; // KeyDefType, key data
7777
UnsignedByte status; // StatusType, above
7878
UnsignedShort state; // KEY_STATE_* in KeyDefs.h
79-
UnsignedInt sequence; // DirectInput sequence number; overwritten with frame number for ordering
8079
UnsignedInt keyDownTimeMsec; // real-time in milliseconds when key went down
8180

8281
};
@@ -132,7 +131,6 @@ class Keyboard : public SubsystemInterface
132131
Bool checkKeyRepeat( void ); ///< check for repeating keys
133132
UnsignedByte getKeyStatusData( KeyDefType key ); ///< get key status
134133
Bool getKeyStateBit( KeyDefType key, Int bit ); ///< get key state bit
135-
UnsignedInt getKeySequenceData( KeyDefType key ); ///< get key sequence
136134
void setKeyStateData( KeyDefType key, UnsignedByte data ); ///< get key state
137135

138136
UnsignedShort m_modifiers;

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ void Keyboard::updateKeys( void )
143143

144144
m_keyStatus[ m_keys[ index ].key ].state = m_keys[ index ].state;
145145
m_keyStatus[ m_keys[ index ].key ].status = m_keys[ index ].status;
146-
m_keyStatus[ m_keys[ index ].key ].sequence = m_inputFrame;
147146

148147
// Update key down time for new key presses
149148
if( BitIsSet( m_keys[ index ].state, KEY_STATE_DOWN ) )
@@ -243,10 +242,6 @@ Bool Keyboard::checkKeyRepeat( void )
243242
// Set End Flag
244243
m_keys[ ++index ].key = KEY_NONE;
245244

246-
// Set all keys as new to prevent multiple keys repeating
247-
for( index = 0; index< NUM_KEYS; index++ )
248-
m_keyStatus[ index ].sequence = m_inputFrame;
249-
250245
// Set repeated key so it will repeat again after the interval
251246
m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC + KEY_REPEAT_INTERVAL_MSEC);
252247

@@ -809,14 +804,6 @@ Bool Keyboard::getKeyStateBit( KeyDefType key, Int bit )
809804
return (m_keyStatus[ key ].state & bit) ? 1 : 0;
810805
}
811806

812-
//-------------------------------------------------------------------------------------------------
813-
/** return the sequence data for the given key */
814-
//-------------------------------------------------------------------------------------------------
815-
UnsignedInt Keyboard::getKeySequenceData( KeyDefType key )
816-
{
817-
return m_keyStatus[ key ].sequence;
818-
}
819-
820807
//-------------------------------------------------------------------------------------------------
821808
/** set the key status data */
822809
//-------------------------------------------------------------------------------------------------

Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ void DirectInputKeyboard::getKey( KeyboardIO *key )
251251
HRESULT hr;
252252

253253
assert( key );
254-
key->sequence = 0;
255254
key->key = KEY_NONE;
256255

257256
if( m_pKeyboardDevice )
@@ -315,9 +314,6 @@ void DirectInputKeyboard::getKey( KeyboardIO *key )
315314
// set the key
316315
key->key = (UnsignedByte)(kbdat.dwOfs & 0xFF);
317316

318-
// sequence
319-
key->sequence = kbdat.dwSequence;
320-
321317
//
322318
// state of key, note we are setting the key state here with an assignment
323319
// and not a bit set of the up/down state, this is the "start"

GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ struct KeyboardIO
7676
UnsignedByte key; // KeyDefType, key data
7777
UnsignedByte status; // StatusType, above
7878
UnsignedShort state; // KEY_STATE_* in KeyDefs.h
79-
UnsignedInt sequence; // DirectInput sequence number; overwritten with frame number for ordering
8079
UnsignedInt keyDownTimeMsec; // real-time in milliseconds when key went down
8180

8281
};
@@ -132,7 +131,6 @@ class Keyboard : public SubsystemInterface
132131
Bool checkKeyRepeat( void ); ///< check for repeating keys
133132
UnsignedByte getKeyStatusData( KeyDefType key ); ///< get key status
134133
Bool getKeyStateBit( KeyDefType key, Int bit ); ///< get key state bit
135-
UnsignedInt getKeySequenceData( KeyDefType key ); ///< get key sequence
136134
void setKeyStateData( KeyDefType key, UnsignedByte data ); ///< get key state
137135

138136
UnsignedShort m_modifiers;

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ void Keyboard::updateKeys( void )
143143

144144
m_keyStatus[ m_keys[ index ].key ].state = m_keys[ index ].state;
145145
m_keyStatus[ m_keys[ index ].key ].status = m_keys[ index ].status;
146-
m_keyStatus[ m_keys[ index ].key ].sequence = m_inputFrame;
147146

148147
// Update key down time for new key presses
149148
if( BitIsSet( m_keys[ index ].state, KEY_STATE_DOWN ) )
@@ -243,10 +242,6 @@ Bool Keyboard::checkKeyRepeat( void )
243242
// Set End Flag
244243
m_keys[ ++index ].key = KEY_NONE;
245244

246-
// Set all keys as new to prevent multiple keys repeating
247-
for( index = 0; index< NUM_KEYS; index++ )
248-
m_keyStatus[ index ].sequence = m_inputFrame;
249-
250245
// Set repeated key so it will repeat again after the interval
251246
m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC + KEY_REPEAT_INTERVAL_MSEC);
252247

@@ -809,14 +804,6 @@ Bool Keyboard::getKeyStateBit( KeyDefType key, Int bit )
809804
return (m_keyStatus[ key ].state & bit) ? 1 : 0;
810805
}
811806

812-
//-------------------------------------------------------------------------------------------------
813-
/** return the sequence data for the given key */
814-
//-------------------------------------------------------------------------------------------------
815-
UnsignedInt Keyboard::getKeySequenceData( KeyDefType key )
816-
{
817-
return m_keyStatus[ key ].sequence;
818-
}
819-
820807
//-------------------------------------------------------------------------------------------------
821808
/** set the key status data */
822809
//-------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ void DirectInputKeyboard::getKey( KeyboardIO *key )
251251
HRESULT hr;
252252

253253
assert( key );
254-
key->sequence = 0;
255254
key->key = KEY_NONE;
256255

257256
if( m_pKeyboardDevice )
@@ -315,9 +314,6 @@ void DirectInputKeyboard::getKey( KeyboardIO *key )
315314
// set the key
316315
key->key = (UnsignedByte)(kbdat.dwOfs & 0xFF);
317316

318-
// sequence
319-
key->sequence = kbdat.dwSequence;
320-
321317
//
322318
// state of key, note we are setting the key state here with an assignment
323319
// and not a bit set of the up/down state, this is the "start"

0 commit comments

Comments
 (0)