Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): drop force attack from the hotkeys preview

Olcay Seygan75b2d6df2d5e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d5ebb421..13b3e3b09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -423,6 +423,7 @@ found and fixed, EA's own, not port damage.**
- The drags followed the click there. Under the Alternate Mouse Setup the line you draw with attack move or guard armed, the Ctrl circle and the Ctrl+Shift attack line still wanted the right button, and a left drag with A armed drew a selection box instead. All of them, and every guard button, are the left button's now in every setup, and a right drag pans the map with the key still armed. On the radar a left press with A or G armed, or with a general's power waiting for its target, sends the order there, where it used to move the camera; the right button looks.
- Holding the right button on the radar now carries the camera with the cursor when the left button gives orders. The radar has looked with the held button since the last version, but only the left one ever got the drag: the right press moved the camera once and then sat there, so in the game's default setup crossing the map still meant clicking your way over it.
- Ctrl on a garrisoned Bunker fires on a unit as well as the ground, where it used to take only the ground. The soldiers inside do the shooting, and the Air Force General's Combat Chinook takes a Ctrl target the same way. Shift on top of the Ctrl hold keeps it: the pointer stays the force-fire one, and a drag draws the attack line instead of the circle. The Force Attack button 3.1.0 put on the command bar is gone again, since Ctrl already did everything it did, and each bar has its old empty place back.
+- The Hotkeys tab in Options stopped listing a Force Attack button on bars that have not had one since it left the command bar. Ctrl still fires on whatever is under the pointer, and that hold now moves on the launcher's Hotkeys page alone.
- The dark plate behind Exit, Restart and the options screen in a match covers the whole picture. It used to sit in a 4:3 frame in the middle, so a widescreen left the battlefield bright down both sides. The box itself keeps the shape it was drawn in.
- Buildings select together again, which the one interface had taken away. Shift-click them, drag a box over them, or double-click one for every building of its kind on the screen; select four War Factories and each tank you click goes to whichever has the shortest queue. Double-click a unit and every one of that kind whose feet sit in the picture is taken, including the ones sitting past the camera's far clip that used to be skipped. A building and a unit still never share a selection.
- Formation lines are back for everyone. With move, attack move or guard armed, a left drag spreads the selection along the line you draw again; since the one interface it drew a selection box instead, because the line was switched off for the Classic mouse that every player now runs. A drag with no order armed is still the selection box.
diff --git a/GeneralsMD/Code/Data/French/Generals.str b/GeneralsMD/Code/Data/French/Generals.str
index b9bd25c66..e5fbe516e 100644
--- a/GeneralsMD/Code/Data/French/Generals.str
+++ b/GeneralsMD/Code/Data/French/Generals.str
@@ -17025,10 +17025,6 @@ GUI:HotkeysPressLetter
"Appuyez sur une lettre, ou sur Échap pour annuler"
END
-GUI:HotkeysPressForceAttack
-"Appuyez sur une touche, ou sur Ctrl ou Alt seul. Maj ne peut pas servir de touche maintenue. Échap annule."
-END
-
GUI:HotkeysPressHold
"Appuyez sur une touche, ou sur Ctrl, Alt ou Maj seul. Échap annule."
END
@@ -17057,10 +17053,6 @@ GUI:HotkeysButtonMoved
"Le jeu lui donnait la lettre d'une touche fixe, alors le lanceur l'a déplacée."
END
-GUI:HotkeysForceAttack
-"Maintenez-la pour tirer sur ce qui se trouve sous le pointeur. Maj plus cette touche trace toujours un cadre de sélection. Par défaut : Ctrl."
-END
-
GUI:HotkeysPick
"Choisissez une commande ou un bouton, puis double-cliquez dessus ou cliquez sur Changer."
END
diff --git a/GeneralsMD/Code/Data/German/Generals.str b/GeneralsMD/Code/Data/German/Generals.str
index 95090cdbe..82dcd5beb 100644
--- a/GeneralsMD/Code/Data/German/Generals.str
+++ b/GeneralsMD/Code/Data/German/Generals.str
@@ -15129,10 +15129,6 @@ GUI:HotkeysPressLetter
"Drücke einen Buchstaben, oder Esc zum Abbrechen"
END
-GUI:HotkeysPressForceAttack
-"Drücke eine Taste, oder Strg oder Alt allein. Umschalt kann nicht die Haltetaste sein. Esc bricht ab."
-END
-
GUI:HotkeysPressHold
"Drücke eine Taste, oder Strg, Alt oder Umschalt allein. Esc bricht ab."
END
@@ -15161,10 +15157,6 @@ GUI:HotkeysButtonMoved
"Das Spiel gab ihr den Buchstaben einer festen Taste, deshalb hat der Launcher sie verlegt."
END
-GUI:HotkeysForceAttack
-"Gedrückt halten, um auf alles unter dem Zeiger zu feuern. Umschalt plus diese Taste zieht weiterhin einen Auswahlrahmen. Standard ist Strg."
-END
-
GUI:HotkeysPick
"Wähle einen Befehl oder eine Schaltfläche, dann doppelklicke darauf oder drücke Ändern."
END
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index bb41d0b00..d35cfcc24 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1718,10 +1718,6 @@ GUI:HotkeysPressLetter
"Press a letter, or Esc to cancel"
END
-GUI:HotkeysPressForceAttack
-"Press a key, or Ctrl or Alt alone. Shift cannot be the hold. Esc cancels."
-END
-
GUI:HotkeysPressHold
"Press a key, or Ctrl, Alt or Shift alone. Esc cancels."
END
@@ -1750,10 +1746,6 @@ GUI:HotkeysButtonMoved
"The game gave it the letter of a fixed key, so the launcher moved it."
END
-GUI:HotkeysForceAttack
-"Hold to fire on whatever is under the pointer. Shift plus this key still draws a selection box. Default is Ctrl."
-END
-
GUI:HotkeysPick
"Pick a command or a button, then double-click it or press Change."
END
diff --git a/GeneralsMD/Code/Data/Russian/Generals.str b/GeneralsMD/Code/Data/Russian/Generals.str
index be53ac907..e1721aa67 100644
--- a/GeneralsMD/Code/Data/Russian/Generals.str
+++ b/GeneralsMD/Code/Data/Russian/Generals.str
@@ -16977,10 +16977,6 @@ GUI:HotkeysPressLetter
"Нажмите букву или Esc для отмены"
END
-GUI:HotkeysPressForceAttack
-"Нажмите клавишу или Ctrl либо Alt отдельно. Shift нельзя использовать для удержания. Esc отменяет."
-END
-
GUI:HotkeysPressHold
"Нажмите клавишу или Ctrl, Alt либо Shift отдельно. Esc отменяет."
END
@@ -17009,10 +17005,6 @@ GUI:HotkeysButtonMoved
"Игра дала ей букву фиксированной клавиши, поэтому лаунчер её переместил."
END
-GUI:HotkeysForceAttack
-"Удерживайте, чтобы стрелять по всему, что под курсором. Shift плюс эта клавиша по-прежнему рисует рамку выделения. По умолчанию Ctrl."
-END
-
GUI:HotkeysPick
"Выберите команду или кнопку, затем дважды щёлкните по ней или нажмите «Изменить»."
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 04290dea1..c26016f5b 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -16089,10 +16089,6 @@ GUI:HotkeysPressLetter
"Bir harfe basın, vazgeçmek için Esc"
END
-GUI:HotkeysPressForceAttack
-"Bir tuşa ya da tek başına Ctrl veya Alt tuşuna basın. Shift basılı tutma tuşu olamaz. Esc vazgeçer."
-END
-
GUI:HotkeysPressHold
"Bir tuşa ya da tek başına Ctrl, Alt veya Shift tuşuna basın. Esc vazgeçer."
END
@@ -16121,10 +16117,6 @@ GUI:HotkeysButtonMoved
"Oyun ona sabit bir tuşun harfini vermişti, başlatıcı taşıdı."
END
-GUI:HotkeysForceAttack
-"Basılı tutunca imlecin altındakine ateş eder. Bu tuşla Shift, birlik kutusu çizer. Varsayılan Ctrl."
-END
-
GUI:HotkeysPick
"Bir komut ya da düğme seçin, sonra çift tıklayın ya da Değiştir'e basın."
END
diff --git a/GeneralsMD/Code/Data/Ukrainian/Generals.str b/GeneralsMD/Code/Data/Ukrainian/Generals.str
index 762dcc707..70c55e49f 100644
--- a/GeneralsMD/Code/Data/Ukrainian/Generals.str
+++ b/GeneralsMD/Code/Data/Ukrainian/Generals.str
@@ -16977,10 +16977,6 @@ GUI:HotkeysPressLetter
"Натисніть літеру або Esc для скасування"
END
-GUI:HotkeysPressForceAttack
-"Натисніть клавішу або лише Ctrl чи Alt. Shift не може бути утриманням. Esc скасовує."
-END
-
GUI:HotkeysPressHold
"Натисніть клавішу або лише Ctrl, Alt чи Shift. Esc скасовує."
END
@@ -17009,10 +17005,6 @@ GUI:HotkeysButtonMoved
"Гра дала їй літеру фіксованої клавіші, тому лаунчер її перемістив."
END
-GUI:HotkeysForceAttack
-"Утримуйте, щоб стріляти по всьому, що під курсором. Shift плюс ця клавіша, як і раніше, малює рамку виділення. За замовчуванням Ctrl."
-END
-
GUI:HotkeysPick
"Виберіть команду або кнопку, потім двічі клацніть по ній або натисніть «Змінити»."
END
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 712d961e7..8ca407bf8 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -530,23 +530,6 @@ Bool ControlBar_needsWideCommandGrid( const Int *types, Int count );
* narrow bar is the only one that leaves windows out. */
Bool ControlBar_usesCommandWindow( Int slot, Bool spareWindows, Bool wide );
-/** Slot 12 (0-based 11) when the set already has Attack Move and that hole is empty: left of Stop,
- * under Attack Move. An object ControlBar_forceFires names takes 12 too, or 11 above it when 12 is
- * taken (Gattling Cannon's mines, Stinger Site's camo net, Fire Base's Sell). -1 when neither
- * applies, or the place is used (China CC mines, a Tunnel Network's full bar). */
-Int ControlBar_forceAttackSlot( const Int *types, Int count, Bool forceFires );
-
-/** Whether Force Attack belongs on a bar without Attack Move. A base defence (FS_BASE_DEFENSE) with its
- * own gun (CAN_ATTACK: Patriot, Gattling Cannon, Fire Base, Tunnel Network), soldiers for a gun
- * (SPAWNS_ARE_THE_WEAPONS: Stinger Site) or a garrison that shoots out (GARRISONABLE_UNTIL_DESTROYED:
- * Bunker), and a transport whose riders shoot (TRANSPORT with CAN_ATTACK: Combat Chinook; the
- * plain Chinook lacks CAN_ATTACK). A Speaker Tower is none of them. The launcher's Hotkeys page
- * reads KindOf the same way. */
-Bool ControlBar_forceFires( const Object *obj );
-/// The same asked of a template, for the options menu's Hotkeys page, which has no object to ask.
-Bool ControlBar_forceFires( const ThingTemplate *thing );
-
-
/** The page's keys past attack, hold position and move, which no command set has a button for either. */
enum OrderKeyExtra
{
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h
index 3c45c992e..63aea2010 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h
@@ -206,7 +206,7 @@ struct HotkeyCommandRow
std::string category;
std::string label; ///< DisplayName, empty for none
std::string pair; ///< END_ of a BEGIN_, empty otherwise
- Bool barOnly; ///< Force Attack's hold, set on the command bar page only
+ Bool barOnly; ///< Force Attack's hold, which the options menu's page leaves to the launcher's
Bool hold; ///< a BEGIN_ the shipped file puts on a modifier alone, which a modifier alone may take again
Bool launcherDefault; ///< a key the launcher gives a command the game leaves unbound
};
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index fd05b6745..c04ac8dac 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -491,40 +491,6 @@ Bool ControlBar_usesCommandWindow( Int slot, Bool spareWindows, Bool wide )
return !spareWindows || wide || slot < COMMAND_GRID_NARROW_SLOTS;
}
-//-------------------------------------------------------------------------------------------------
-Int ControlBar_forceAttackSlot( const Int *types, Int count, Bool forceFires )
-{
- enum { SLOT = 11, ABOVE = 10 };
- if( count <= SLOT )
- return -1;
- Bool fights = forceFires;
- for( Int slot = 0; slot < count && !fights; slot++ )
- fights = types[ slot ] == GUI_COMMAND_ATTACK_MOVE;
- if( fights && types[ SLOT ] == GUI_COMMAND_NONE )
- return SLOT;
- if( forceFires && types[ ABOVE ] == GUI_COMMAND_NONE )
- return ABOVE;
- return -1;
-}
-
-//-------------------------------------------------------------------------------------------------
-Bool ControlBar_forceFires( const Object *obj )
-{
- if( obj->isKindOf( KINDOF_FS_BASE_DEFENSE ) )
- return obj->isKindOf( KINDOF_CAN_ATTACK ) || obj->isKindOf( KINDOF_SPAWNS_ARE_THE_WEAPONS )
- || obj->isKindOf( KINDOF_GARRISONABLE_UNTIL_DESTROYED );
- return obj->isKindOf( KINDOF_TRANSPORT ) && obj->isKindOf( KINDOF_CAN_ATTACK );
-}
-
-//-------------------------------------------------------------------------------------------------
-Bool ControlBar_forceFires( const ThingTemplate *thing )
-{
- if( thing->isKindOf( KINDOF_FS_BASE_DEFENSE ) )
- return thing->isKindOf( KINDOF_CAN_ATTACK ) || thing->isKindOf( KINDOF_SPAWNS_ARE_THE_WEAPONS )
- || thing->isKindOf( KINDOF_GARRISONABLE_UNTIL_DESTROYED );
- return thing->isKindOf( KINDOF_TRANSPORT ) && thing->isKindOf( KINDOF_CAN_ATTACK );
-}
-
//-------------------------------------------------------------------------------------------------
void ControlBar_orderKeyPlaces( const Int *places, Int count, Bool fights, Int *keys )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
index 8e7791916..1c6070ebb 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
@@ -130,14 +130,6 @@ AsciiString hotkeysPath( void )
return path;
}
-const HotkeyCommandRow *forceAttackRow( void )
-{
- for( size_t each = 0; each < s_rows.size(); each++ )
- if( s_rows[ each ].id == "BEGIN_FORCEATTACK" )
- return &s_rows[ each ];
- return NULL;
-}
-
/// What a command answers to in a match with the keys on the page: the player's, else the launcher's
/// part of the file, else the game's own. The launcher's own defaults reach the game only from its part.
HotkeyBinding bindingOf( const HotkeyCommandRow& row )
@@ -221,12 +213,10 @@ std::map< std::string, WideChar > buttonKeys( void )
return keys;
}
-/// A button's key in a bar's slot as text: Force Attack's chord, else its letter; empty for none.
+/// A button's letter in a bar's slot as text; empty for none.
UnicodeString buttonKeyText( const BarObject *object, Int slot, const std::map< std::string, WideChar >& keys )
{
const CommandButton *button = object->slots[ slot ];
- if( button->getCommandType() == GUI_COMMAND_FORCE_ATTACK )
- return wide( Hotkeys_chordText( bindingOf( *forceAttackRow() ) ) );
Int types[ BAR_SLOTS ], ranks[ BAR_SLOTS ];
for( Int each = 0; each < BAR_SLOTS; each++ )
types[ each ] = object->slots[ each ] ? object->slots[ each ]->getCommandType() : GUI_COMMAND_NONE;
@@ -265,7 +255,6 @@ Bool shownText( const UnicodeString& text )
void findBars( void )
{
s_factions.clear();
- const CommandButton *force = TheControlBar->findCommandButton( AsciiString( "Command_ForceAttack" ) );
for( Int index = 0; index < ThePlayerTemplateStore->getPlayerTemplateCount(); index++ )
{
const PlayerTemplate *side = ThePlayerTemplateStore->getNthPlayerTemplate( index );
@@ -295,12 +284,6 @@ void findBars( void )
slots[ slot ] = ( button && !BitTest( button->getOptions(), SCRIPT_ONLY ) ) ? button : NULL;
types[ slot ] = slots[ slot ] ? slots[ slot ]->getCommandType() : GUI_COMMAND_NONE;
}
- const Int forceSlot = ControlBar_forceAttackSlot( types, MAX_COMMANDS_PER_SET, ControlBar_forceFires( thing ) );
- if( forceSlot >= 0 && force )
- {
- slots[ forceSlot ] = force;
- types[ forceSlot ] = force->getCommandType();
- }
// the windows as the bar fills them (ControlBar::populateCommand), so a slot here is the
// slot a Name@slot key and the grid's letters mean: a set's button past the bar's
// windows moves into an empty one. A mod's wide bar has all eighteen.
@@ -474,9 +457,7 @@ void fillButtons( void )
continue;
const UnicodeString key = buttonKeyText( object, slot, keys );
const Bool waiting = s_capture == CAPTURE_BUTTON && button == s_button;
- const Bool changed = button->getCommandType() == GUI_COMMAND_FORCE_ATTACK
- ? s_file.commands.count( "BEGIN_FORCEATTACK" ) != 0
- : s_file.buttons.count( HotKeyManager::fileButtonName( button->getName() ) ) != 0;
+ const Bool changed = s_file.buttons.count( HotKeyManager::fileButtonName( button->getName() ) ) != 0;
const Int at = GadgetListBoxAddEntryImage( s_buttonList, button->getButtonImage(), -1, 0, height, height * 61 / 48 );
GadgetListBoxAddEntryText( s_buttonList, buttonName( button ), changed ? CHANGED_COLOR : TEXT_COLOR, at, 1 );
GadgetListBoxAddEntryText( s_buttonList,
@@ -555,15 +536,12 @@ void updateNote( void )
}
else if( s_active == 1 && s_button )
{
- const Bool force = s_button->getCommandType() == GUI_COMMAND_FORCE_ATTACK;
- const WideChar fixed = force ? 0 : HotKeyManager::fixedKey( s_button->getName(), s_button->getCommandType() );
+ const WideChar fixed = HotKeyManager::fixedKey( s_button->getName(), s_button->getCommandType() );
const std::string name = HotKeyManager::fileButtonName( s_button->getName() );
- changed = force ? s_file.commands.count( "BEGIN_FORCEATTACK" ) != 0 : s_file.buttons.count( name ) != 0;
+ changed = s_file.buttons.count( name ) != 0;
canChange = TRUE;
if( s_capture == CAPTURE_BUTTON )
- note = TheGameText->fetch( force ? "GUI:HotkeysPressForceAttack" : "GUI:HotkeysPressLetter" );
- else if( force )
- note = TheGameText->fetch( "GUI:HotkeysForceAttack" );
+ note = TheGameText->fetch( "GUI:HotkeysPressLetter" );
else if( changed )
{
const UnicodeString key = letterText( fixed != 0 ? fixed : TheGameText->fetchEnglishHotKey( s_button->getTextLabel() ) );
@@ -632,9 +610,7 @@ void applySelected( const HotkeyBinding *binding, Bool backToGame )
setCommand( s_rows[ s_commandRow ].id, backToGame ? NULL : binding );
else if( s_active == 1 && s_button )
{
- if( s_button->getCommandType() == GUI_COMMAND_FORCE_ATTACK )
- setCommand( "BEGIN_FORCEATTACK", backToGame ? NULL : binding );
- else if( backToGame )
+ if( backToGame )
s_file.buttons.erase( HotKeyManager::fileButtonName( s_button->getName() ) );
else
s_file.buttons[ HotKeyManager::fileButtonName( s_button->getName() ) ] = binding->key.size() == 5 ? binding->key.substr( 4 ) : std::string();
@@ -785,14 +761,12 @@ Bool OptionsHotkeysKey( UnsignedByte key, Int state )
const Bool ctrl = BitTest( state, KEY_STATE_CONTROL ), alt = BitTest( state, KEY_STATE_ALT ), shift = BitTest( state, KEY_STATE_SHIFT );
const Bool ctrlKey = key == KEY_LCTRL || key == KEY_RCTRL, altKey = key == KEY_LALT || key == KEY_RALT;
const Bool shiftKey = key == KEY_LSHIFT || key == KEY_RSHIFT;
- const Bool force = s_capture == CAPTURE_BUTTON && s_button->getCommandType() == GUI_COMMAND_FORCE_ATTACK;
- const Bool hold = force || ( s_capture == CAPTURE_COMMAND && s_rows[ s_commandRow ].hold );
+ const Bool hold = s_capture == CAPTURE_COMMAND && s_rows[ s_commandRow ].hold;
if( hold )
{
- // a modifier let go with no key between is the hold alone. Shift cannot be Force Attack's:
- // Shift on top of that hold queues the circle.
- const char *alone = ctrlKey ? "CTRL" : altKey ? "ALT" : ( shiftKey && !force ) ? "SHIFT" : NULL;
+ // a modifier let go with no key between is the hold alone
+ const char *alone = ctrlKey ? "CTRL" : altKey ? "ALT" : shiftKey ? "SHIFT" : NULL;
if( alone )
{
if( down )
@@ -805,9 +779,9 @@ Bool OptionsHotkeysKey( UnsignedByte key, Int state )
return TRUE;
}
const std::string name = keyName( key );
- if( down && !( force && shift ) && !name.empty() )
+ if( down && !name.empty() )
{
- const HotkeyBinding binding( name, modifierName( ctrl, alt, !force && shift ) );
+ const HotkeyBinding binding( name, modifierName( ctrl, alt, shift ) );
applySelected( &binding, FALSE );
}
else if( down )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp
index 27f7062be..bb16594e7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp
@@ -994,7 +994,7 @@ std::vector< HotkeyCommandRow > Hotkeys_commandRows( const std::string& commandM
}
// HOLD_COMMANDS: KEY_NONE and a modifier in the shipped file, which the rows above leave out.
- // Force Attack's is set from its command bar button, the other two on the commands list.
+ // Force Attack's moves on the launcher's page only, the other two on the options menu's as well.
static const char *const HOLDS[][ 2 ] = { { "FORCEATTACK", "CTRL" }, { "WAYPOINTS", "ALT" }, { "PREFER_SELECTION", "SHIFT" } };
for( size_t each = 0; each < sizeof( HOLDS ) / sizeof( HOLDS[ 0 ] ); each++ )
{
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 6b01823da..21d7cd306 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -5502,56 +5502,25 @@ TEST(hotkeys_page_shows_the_wide_bar_windows_and_letters)
checkHotkeysPageLetters( letters, "ZZZ.....V.A.GS...." );
}
-TEST(controlbar_force_attack_slot_is_under_attack_move)
+TEST(hotkeys_force_attack_button_gone_from_the_bar_still_loads_from_a_file)
{
- enum { SLOTS = MAX_COMMANDS_PER_SET, WINDOWS = 14 };
- const Int N = GUI_COMMAND_NONE, U = GUI_COMMAND_OBJECT_UPGRADE, W = GUI_COMMAND_SWITCH_WEAPON;
- Int types[ SLOTS ];
- for( Int slot = 0; slot < SLOTS; slot++ )
- types[ slot ] = N;
- types[ 10 ] = GUI_COMMAND_ATTACK_MOVE;
- types[ 12 ] = GUI_COMMAND_GUARD;
- types[ 13 ] = GUI_COMMAND_STOP;
- CHECK_EQ( ControlBar_forceAttackSlot( types, SLOTS, FALSE ), 11 );
-
- types[ 11 ] = GUI_COMMAND_OBJECT_UPGRADE;
- CHECK_EQ( ControlBar_forceAttackSlot( types, SLOTS, FALSE ), -1 );
-
- types[ 11 ] = N;
- types[ 10 ] = N;
- CHECK_EQ( ControlBar_forceAttackSlot( types, SLOTS, FALSE ), -1 );
-
- /* A base defence that shoots, or a Combat Chinook, has no Attack Move. Patriot (Stop 13, Sell 14)
- and the Chinook take 12; Gattling Cannon and Bunker (mines 12) take 11 above them; GLA Tunnel
- Network and the Infantry General's Bunker fill 1 to 14 and get none */
- types[ 12 ] = GUI_COMMAND_STOP;
- types[ 13 ] = GUI_COMMAND_SELL;
- CHECK_EQ( ControlBar_forceAttackSlot( types, SLOTS, TRUE ), 11 );
- types[ 11 ] = GUI_COMMAND_PLAYER_UPGRADE;
- CHECK_EQ( ControlBar_forceAttackSlot( types, SLOTS, TRUE ), 10 );
- for( Int slot = 0; slot < 14; slot++ )
- types[ slot ] = GUI_COMMAND_EXIT_CONTAINER;
- CHECK_EQ( ControlBar_forceAttackSlot( types, SLOTS, TRUE ), -1 );
-
- /* Contra ranger: Attack Move in 15, slot 12 empty. Inject then fit keeps Force Attack in 12
- and still maps Attack Move, Guard and Stop to 11, 13 and 14 */
- Bool windowed[ SLOTS ];
- Int shown[ SLOTS ];
- for( Int slot = 0; slot < SLOTS; slot++ )
- windowed[ slot ] = slot < WINDOWS;
- Int ranger[ SLOTS ] = { U, U, U, U, U, N, GUI_COMMAND_SPECIAL_POWER, W, N, W, N, N, N, N,
- GUI_COMMAND_ATTACK_MOVE, N, GUI_COMMAND_GUARD, GUI_COMMAND_STOP };
- CHECK_EQ( ControlBar_forceAttackSlot( ranger, SLOTS, FALSE ), 11 );
- ranger[ 11 ] = GUI_COMMAND_FORCE_ATTACK;
- ControlBar_fitCommandSlots( ranger, windowed, SLOTS, shown );
- CHECK_EQ( shown[ 10 ], 14 );
- CHECK_EQ( shown[ 11 ], 11 );
- CHECK_EQ( shown[ 12 ], 16 );
- CHECK_EQ( shown[ 13 ], 17 );
-
/* Force Attack is Ctrl: the English label's F stays off the button */
CHECK_EQ( HotKeyManager::playerButtonKey( AsciiString( "Command_ForceAttack" ), 'F',
GUI_COMMAND_FORCE_ATTACK ), 0 );
+
+ /* A file written while the button stood on the bar reads and writes back as it was, hold included */
+ const std::vector< HotkeyCommandRow > rows = Hotkeys_commandRows( HOTKEYS_COMMAND_MAP );
+ const HotkeysFile file = Hotkeys_parse(
+ "CommandMap BEGIN_FORCEATTACK\r\n Key = KEY_NONE\r\n Modifiers = ALT\r\n UseableIn = GAME\r\nEnd\r\n"
+ "CommandButtonHotKey Command_ForceAttack\r\n Key = W\r\nEnd\r\n"
+ "CommandButtonHotKey Command_ForceAttack@12\r\n Key = Q\r\nEnd\r\n", rows );
+ CHECK( file.commands.find( "BEGIN_FORCEATTACK" )->second == HotkeyBinding( "", "ALT" ) );
+ CHECK_STR( file.buttons.find( "Command_ForceAttack" )->second.c_str(), "W" );
+ CHECK_STR( file.buttons.find( "Command_ForceAttack@12" )->second.c_str(), "Q" );
+ const HotkeysFile again = Hotkeys_parse( Hotkeys_format( file, rows ), rows );
+ CHECK( again.commands.find( "BEGIN_FORCEATTACK" )->second == HotkeyBinding( "", "ALT" ) );
+ CHECK_STR( again.buttons.find( "Command_ForceAttack" )->second.c_str(), "W" );
+ CHECK_STR( again.buttons.find( "Command_ForceAttack@12" )->second.c_str(), "Q" );
}
/* FixedOrderKeys, Enabled = No: the keys as shipped. The German Guard is W and its rally point U, and
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index 9d2573384..6789f6190 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -92,9 +92,9 @@ HOTKEY_BUTTON_TOP, HOTKEY_BUTTON_WIDTH = 412, 104
HOTKEY_COMMAND_COLUMNS = (68, 32)
HOTKEY_BUTTON_COLUMNS = (12, 66, 22)
# strings OptionsMenuHotkeys.cpp shows besides the captions above
-HOTKEY_STRINGS = ["GUI:HotkeysNone", "GUI:HotkeysPressKey", "GUI:HotkeysPressLetter", "GUI:HotkeysPressForceAttack",
+HOTKEY_STRINGS = ["GUI:HotkeysNone", "GUI:HotkeysPressKey", "GUI:HotkeysPressLetter",
"GUI:HotkeysClash", "GUI:HotkeysAlsoOn", "GUI:HotkeysFixed", "GUI:HotkeysGameKey",
- "GUI:HotkeysMoved", "GUI:HotkeysForceAttack", "GUI:HotkeysPick", "GUI:HotkeysOnFixedKey",
+ "GUI:HotkeysMoved", "GUI:HotkeysPick", "GUI:HotkeysOnFixedKey",
"GUI:HotkeysButtonMoved", "TOOLTIP:HotkeyChange", "TOOLTIP:HotkeyClear",
"TOOLTIP:HotkeyDefault"]