Add type selection by double/triple-click#2297
Conversation
Double-click a unit to select every unit of its selection group on screen; triple-click to select them across the whole map. Complements the vanilla type-select hotkey (hold T + click) with the double/triple-click gesture common to modern RTS games, reusing Phobos' selection-group concept (GetSelectionGroupID / HasSelectionGroupID, i.e. the GroupAs tag). Gated behind [Phobos] TypeSelectByMultiClick (default off).
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
… TypeSelectByMultiClick Mirror the upstream PR structure in the integrated local build. The single ModernControls toggle/file is replaced by two, matching PR Phobos-developers#2298 (right-click to command) and PR Phobos-developers#2297 (multi-click type-select): - src/Misc/RightClickCommand.cpp - RMB command + LMB select/deselect, gated by [Phobos] -> RightClickCommand - src/Misc/MultiClickTypeSelect.cpp - double/triple-click type-select, gated by [Phobos] -> TypeSelectByMultiClick Both default true (this is the personal build). The fork-only 250px double-click radius and selection-group matching are preserved. The two features share RightClickCommand::RmbCommandInProgress: the RMB redirect flows through the 0x693290 multi-click hook, which clears the flag and skips the event, so an RMB order is never miscounted as a left-click. WASD panning stays separate and always-on (CameraPanWASD.cpp). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TaranDahl
left a comment
There was a problem hiding this comment.
I suspect the entire design is flawed. In other games such as SC2, you can double-click the left mouse button to select all units, as the left click only serves to select units in that game. However, in RA2, the left mouse button has multiple functions, and double-clicking a unit will immediately command it to perform corresponding actions.
| return; | ||
|
|
||
| // The single click that preceded this streak left the clicked unit as the selection. | ||
| const auto pClicked = abstract_cast<FootClass*, true>(ObjectClass::CurrentObjects.GetItem(0)); |
There was a problem hiding this comment.
Have you tested this? I doubt if this is working as you said in your docs when you are selecting multiple units.
Double-clicking a unit selects every unit of the same selection group currently on screen
Feature
Adds the modern-RTS multi-click selection gesture, complementing the existing type-select hotkey (hold
T+ click):The "selection group" reuses the existing Phobos concept (
TechnoTypeExt::GetSelectionGroupID/HasSelectionGroupID, i.e. the[TechnoType] -> GroupAstag with the type ID as fallback), so it stays consistent with the hotkey-driven type select inSelection.cpp. Only the player's own selectable mobile units are affected.Config
Gated behind a new user setting, default off:
Implementation
src/Misc/MultiClickTypeSelect.cpp. A single hook in the tacticalLBUTTONUPhandler — after the click's own selection has been applied, on the single-click dispatch path only (completed rubber-band selections exit earlier) — tracks the click streak viaGetTickCount/GetCursorPos/GetDoubleClickTime(±4 px tolerance) and expands the freshly-clicked unit's selection to its group: on screen for a double-click, map-wide for a triple-click.Docs & credits
docs/User-Interface.md(new "Type selection by multi-click" section),docs/Whats-New.md(new setting + changelog entry),CREDITS.md.Built clean (Debug/Release, 0 warnings) and tested in-game (skirmish) on the CnCNet Yuri's Revenge build.