bugfix(input): Use time-based double tap for unit group centering#2545
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | Replaces getFrame()-based double-tap timing with timeGetTime() and m_doubleClickTimeMS in MSG_META_SELECT_TEAM and MSG_META_ADD_TEAM handlers; logic is correct and consistent. |
| GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | Mirrors the same double-tap timing fix for the Zero Hour expansion; changes are symmetric with the Generals file. |
Sequence Diagram
sequenceDiagram
participant User
participant SelectionXlat
participant timeGetTime
participant GlobalData
participant TacticalView
User->>SelectionXlat: Press group key (first press)
SelectionXlat->>timeGetTime: now = timeGetTime()
SelectionXlat->>SelectionXlat: m_lastGroupSelTime==0 → set to now
SelectionXlat->>GlobalData: read m_doubleClickTimeMS
Note over SelectionXlat: group != m_lastGroupSelGroup(-1)<br/>No double tap triggered
SelectionXlat->>SelectionXlat: Perform selection, update timestamps
User->>SelectionXlat: Press same group key again
SelectionXlat->>timeGetTime: now = timeGetTime()
SelectionXlat->>GlobalData: read m_doubleClickTimeMS
alt now - m_lastGroupSelTime < m_doubleClickTimeMS AND group matches
SelectionXlat->>TacticalView: userLookAt(unit position) — center camera
else Outside window or different group
SelectionXlat->>SelectionXlat: Normal selection only
end
SelectionXlat->>SelectionXlat: Update m_lastGroupSelTime and m_lastGroupSelGroup
Reviews (1): Last reviewed commit: "fix(input): Use time-based double tap fo..." | Re-trigger Greptile
Mauller
left a comment
There was a problem hiding this comment.
looks good, silly that it gave you less than a second to double click select.
Summary
group selection (MSG_META_SELECT_TEAM and MSG_META_ADD_TEAM handlers)
timeGetTime()instead ofTheGameLogic->getFrame()and compare againstTheGlobalData->m_doubleClickTimeMSinstead of a hardcoded 20-frame threshold60 FPS), now uses the OS double-click time consistently
Closes #2531