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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(gameclient): EA's Alternate Mouse Setup again, in Classic only
Olcay Seygan3523d09420e1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 23f648fc3..b2bb9a04e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1108,6 +1108,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- Classic shows what a factory is building again. Select one with anything queued and its queue takes the portrait's place, the unit in production wearing its build clock, and a click on any entry cancels it; the portrait comes back when the queue runs dry. Until now a Classic factory could queue a hundred units with nothing on screen to count them by. The queue stops at nine, the number of slots that show it, and the build buttons grey out at nine as they did in 1.04. Your general's powers climb the right edge of the screen from the top of the bar, one over the other, as they did in 1.04, and the empty strip above them no longer swallows clicks on the battlefield. They carry how many are ready, with no key letter and no recharge seconds, and the promotion screen carries no number keys either, since Classic's number keys pick teams. Every button on that screen takes its click again: the right half used to sit under the powers bar's empty frame and the bottom row under the command bar's top edge, and a click there went nowhere.- Classic's command bar lets the battlefield have the ground it shows. A click on the battlefield between its three pieces, or over the sloped shoulders of the build grid's plate, reaches the unit standing there; only the painted metal keeps it. Change the resolution with the bar minimised and the build tooltip used to come back 245 pixels too high at 1920x1080, as far as the bar had dropped; it stays over the radar now.- Classic's command bar empties when you let your worker go, as 1.04's did. Reforged's habit of showing a builder's buildings with nothing selected had leaked into Classic, so a dozer's build menu stayed on the bar after you dropped it, and was there from the first second of a match before you had picked anything. In Reforged that builder's menu now also comes back after a resolution change; it used to leave the bar empty until you clicked something.+- Classic brings back 1.04's Alternate Mouse Setup, on its Controls page where EA had it and off until you tick it. Ticked, the right button gives the order and the left one only selects: a left click on open ground drops your selection, a right drag still scrolls the map, a double right click is the guard order when Double Click Guard is ticked, and the radar looks on the left button and sends units on the right. It is saved under the name 1.04 gave it, so a settings file 1.04 wrote keeps your choice. Reforged has one mouse, no box, and ignores the setting. The orders are 1.04's either way, so the box changes nothing about a match or its replay.- Supply piles stop shouting their cash over the whole map. A small pile shows its amount only while your cursor is on it or close by, in a smaller font; a big supply dock keeps its label all the time. Classic has the same labels now, with the radar still leaving the piles off.- The Esc menu and the general's promotion screen close the way they open, in both interfaces. Both used to vanish in a single frame, and Classic's Esc menu had lost its opening flash as well. Classic plays 1.04's flash and fade, forwards to open and backwards to close; Reforged fades its pages out over a little more than a tenth of a second, as fast as they fade in.- Every graphics setting is on the Graphics and Effects pages. Shadows, clouds, ground lighting, soft water edges, trees, extra animations, heat haze, texture resolution and the particle limit used to hide in a popup that only opened if you picked Custom from the detail box on another page, so choosing High never showed you what High turns on. Pick a preset now and its settings change in front of you; touch any one of them and the box reads Custom. Texture filtering and the number of anisotropic samples, which needed a text editor, sit there too.diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wndindex f4a709722..0e7ce05c7 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd@@ -7571,6 +7571,53 @@ WINDOWWINDOWWINDOWTYPE = CHECKBOX;SCREENRECT = UPPERLEFT: 288 182, BOTTOMRIGHT: 512 206, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckAlternateMouse";+ STATUS = ENABLED+IMAGE+BORDER;+ STYLE = CHECKBOX+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;+ HEADERTEMPLATE = "MinorTitle";+ TOOLTIPTEXT = "TOOLTIP:AlternateMouse";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:AlternateMouse";+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ END+ CHILD+ WINDOW+ WINDOWTYPE = CHECKBOX;+ SCREENRECT = UPPERLEFT: 288 210, BOTTOMRIGHT: 512 234, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:Retaliation";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -7617,7 +7664,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 210, BOTTOMRIGHT: 512 234, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 288 238, BOTTOMRIGHT: 512 262, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckDoubleClickAttackMove";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -7664,7 +7711,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 282 254, BOTTOMRIGHT: 506 278, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 530 150, BOTTOMRIGHT: 754 174, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:GroupHeadingControls2";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -7709,7 +7756,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 286, BOTTOMRIGHT: 512 310, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 536 182, BOTTOMRIGHT: 760 206, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckGridBuild";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -7756,7 +7803,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 314, BOTTOMRIGHT: 512 338, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 536 210, BOTTOMRIGHT: 760 234, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckSnapBuild45";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -7803,7 +7850,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 342, BOTTOMRIGHT: 512 366, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 536 238, BOTTOMRIGHT: 760 262, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckSnapBuildNeighbour";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -7850,7 +7897,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 370, BOTTOMRIGHT: 512 394, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 536 266, BOTTOMRIGHT: 760 290, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckNudgeBuild";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -7897,7 +7944,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 530 150, BOTTOMRIGHT: 754 174, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 530 310, BOTTOMRIGHT: 754 334, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:GroupHeadingControls3";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -7942,7 +7989,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 530 182, BOTTOMRIGHT: 754 206, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 530 342, BOTTOMRIGHT: 754 366, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelDragTolerance";TOOLTIPTEXT = "TOOLTIP:DragTolerance";STATUS = ENABLED;@@ -7990,7 +8037,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 674 206, BOTTOMRIGHT: 754 230, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 674 366, BOTTOMRIGHT: 754 390, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ValueDragTolerance";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -8036,7 +8083,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = HORZSLIDER;- SCREENRECT = UPPERLEFT: 536 206, BOTTOMRIGHT: 672 230, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 536 366, BOTTOMRIGHT: 672 390, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:SliderDragTolerance";STATUS = ENABLED+IMAGE+TABSTOP;STYLE = HORZSLIDER+MOUSETRACK;@@ -8110,7 +8157,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 536 238, BOTTOMRIGHT: 760 262, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 536 398, BOTTOMRIGHT: 760 422, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckChromaLighting";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex 8e16b5c21..80ea3b37a 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -187,6 +187,7 @@ public:Bool m_noDynamicLODOverride; // "-noDynamicLOD": off for this run, whatever the static preset or Options.ini setBool m_enableStaticLOD;Int m_terrainLODTargetTimeMS;+ Bool m_useAlternateMouse; ///< EA's Alternate Mouse Setup, Options.ini UseAlternateMouse: Classic only, Reforged never reads it (client only)Bool m_clientRetaliationModeEnabled;Bool m_doubleClickAttackMove;Bool m_rightMouseAlwaysScrolls;@@ -342,6 +343,10 @@ public:Int m_hudScale; ///< HUD size step, 0 = 100%; see ControlBarHudScale (client only)Int m_interfaceStyle; ///< INTERFACE_STYLE_CLASSIC or INTERFACE_STYLE_REFORGED, set by -interface only (client only, never GameLogic)Bool isClassicUI() const { return m_interfaceStyle == INTERFACE_STYLE_CLASSIC; }+ /// which button gives a click on the ground its order. Reforged: the right. Classic: the left, as+ /// 1.04 shipped, or the right under EA's Alternate Mouse Setup, where the left only selects+ Bool leftButtonOrders() const { return isClassicUI() && !m_useAlternateMouse; }+ Bool rightButtonOrders() const { return !leftButtonOrders(); }Int m_playerColorScheme; ///< PlayerColorSchemeType: whose colour the client draws (client only)Int m_textLanguage; ///< TextLanguageType: the translation GameText lays over the CSF, read once at startup (client only)Bool m_showOrderLines; ///< draw a line from each selected unit to where it is going, and its queue (client only)diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.hindex cb9ce09d6..4a2500d06 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h@@ -93,6 +93,7 @@ public:void setOnlineIPAddress(AsciiString IP); // convenience functionvoid setLANIPAddress(UnsignedInt IP); // convenience functionvoid setOnlineIPAddress(UnsignedInt IP); // convenience function+ Bool getAlternateMouseModeEnabled(void); // convenience functionBool getRetaliationModeEnabled(); // convenience functionBool getDoubleClickAttackMoveEnabled(void); // convenience functionReal getScrollFactor(void); // convenience functiondiff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 4c6451fae..9beaf7939 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -1298,6 +1298,7 @@ GlobalData::GlobalData()//m_allAdvice = FALSE;m_clientRetaliationModeEnabled = TRUE; //On by default.+ m_useAlternateMouse = FALSE;} // end GlobalData@@ -1460,6 +1461,7 @@ void GlobalData::parseGameDataDefinition( INI* ini )// override INI values with user preferencesOptionPreferences optionPref;+ TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled();TheWritableGlobalData->m_clientRetaliationModeEnabled = optionPref.getRetaliationModeEnabled();TheWritableGlobalData->m_doubleClickAttackMove = optionPref.getDoubleClickAttackMoveEnabled();TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cppindex 96efe8ed3..4514f04af 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp@@ -337,8 +337,9 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg,// see if the user wants to move the tactical view// Left on the radar looks and right orders, the same division the world has. Classic- // divides the world the other way round, and so did the radar in the game as shipped.- const UnsignedInt lookButton = TheGlobalData->isClassicUI() ? GWM_RIGHT_DOWN : GWM_LEFT_DOWN;+ // divides the world the other way round, and so did the radar in the game as shipped,+ // except under EA's Alternate Mouse Setup, which looked with the left.+ const UnsignedInt lookButton = TheGlobalData->leftButtonOrders() ? GWM_RIGHT_DOWN : GWM_LEFT_DOWN;if( drawableList->empty() || msg == lookButton ){radarLookAt( &world );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cppindex 46036db62..e350e034e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp@@ -113,6 +113,10 @@ static Int menuModeCount = 0;static NameKeyType comboBoxDetailID = NAMEKEY_INVALID;static GameWindow * comboBoxDetail = NULL;+// only OptionsMenuClassic.wnd carries it: Reforged has one mouse and no box, so this stays NULL there+static NameKeyType checkAlternateMouseID = NAMEKEY_INVALID;+static GameWindow * checkAlternateMouse = NULL;+static NameKeyType checkRetaliationID = NAMEKEY_INVALID;static GameWindow * checkRetaliation = NULL;@@ -395,6 +399,18 @@ void OptionPreferences::setOnlineIPAddress( UnsignedInt IP )(*this)["GameSpyIPAddress"] = tmp;}+Bool OptionPreferences::getAlternateMouseModeEnabled(void)+{+ OptionPreferences::const_iterator it = find("UseAlternateMouse");+ if (it == end())+ return TheGlobalData->m_useAlternateMouse;++ if (strcasecmp(it->second.str(), "yes") == 0) {+ return TRUE;+ }+ return FALSE;+}+Bool OptionPreferences::getRetaliationModeEnabled(void){OptionPreferences::const_iterator it = find("Retaliation");@@ -901,6 +917,8 @@ static void setDefaults( void )//-------------------------------------------------------------------------------------------------// Mouse Mode+ if( checkAlternateMouse )+ GadgetCheckBoxSetChecked(checkAlternateMouse, FALSE);GadgetCheckBoxSetChecked(checkRetaliation, TRUE );GadgetCheckBoxSetChecked( checkDoubleClickAttackMove, FALSE );@@ -1522,7 +1540,13 @@ static void saveOptions( void )//-------------------------------------------------------------------------------------------------- // mouse mode+ // mouse mode. Saved only from the Classic screen, so an Accept in Reforged keeps what Classic chose+ if( checkAlternateMouse )+ {+ TheWritableGlobalData->m_useAlternateMouse = GadgetCheckBoxIsChecked(checkAlternateMouse);+ (*pref)["UseAlternateMouse"] = TheWritableGlobalData->m_useAlternateMouse ? AsciiString("yes") : AsciiString("no");+ }+TheWritableGlobalData->m_clientRetaliationModeEnabled = GadgetCheckBoxIsChecked(checkRetaliation);(*pref)["Retaliation"] = TheWritableGlobalData->m_clientRetaliationModeEnabled? AsciiString("yes") : AsciiString("no");@@ -2179,6 +2203,8 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )comboBoxLANIP = TheWindowManager->winGetWindowFromId( NULL, comboBoxLANIPID);comboBoxOnlineIPID = TheNameKeyGenerator->nameToKey( AsciiString( "OptionsMenu.wnd:ComboBoxOnlineIP" ) );comboBoxOnlineIP = TheWindowManager->winGetWindowFromId( NULL, comboBoxOnlineIPID);+ checkAlternateMouseID = TheNameKeyGenerator->nameToKey( AsciiString( "OptionsMenu.wnd:CheckAlternateMouse" ) );+ checkAlternateMouse = TheWindowManager->winGetWindowFromId( NULL, checkAlternateMouseID);checkRetaliationID = TheNameKeyGenerator->nameToKey( AsciiString( "OptionsMenu.wnd:Retaliation" ) );checkRetaliation = TheWindowManager->winGetWindowFromId( NULL, checkRetaliationID);checkDoubleClickAttackMoveID = TheNameKeyGenerator->nameToKey( AsciiString( "OptionsMenu.wnd:CheckDoubleClickAttackMove" ) );@@ -2554,6 +2580,8 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )// GadgetCheckBoxSetChecked(checkAudioSurround, TheAudio->getSpeakerSurround());// set the mouse mode+ if( checkAlternateMouse )+ GadgetCheckBoxSetChecked(checkAlternateMouse, TheGlobalData->m_useAlternateMouse);GadgetCheckBoxSetChecked(checkRetaliation, TheGlobalData->m_clientRetaliationModeEnabled);GadgetCheckBoxSetChecked( checkDoubleClickAttackMove, TheGlobalData->m_doubleClickAttackMove );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cppindex bb17d20aa..80ae1fb68 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp@@ -4179,7 +4179,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage//-----------------------------------------------------------------------------case GameMessage::MSG_MOUSE_RIGHT_DOUBLE_CLICK:{- if( TheGlobalData->m_doubleClickAttackMove && !TheGlobalData->isClassicUI() )+ if( TheGlobalData->m_doubleClickAttackMove && TheGlobalData->rightButtonOrders() ){// create the message and append arguments for a guard locationGameMessage *newMsg = TheMessageStream->appendMessage( GameMessage::MSG_DO_GUARD_POSITION );@@ -4198,10 +4198,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage}case GameMessage::MSG_MOUSE_RIGHT_CLICK:{- // A Classic right button never orders at all: it scrolls and deselects, which LookAtXlat- // and SelectionXlat do, as the game shipped.- if( TheGlobalData->isClassicUI() )+ // The Classic right button orders only under EA's Alternate Mouse Setup, and then exactly+ // as 1.04 did: the click below and nothing else. Without it it scrolls and deselects,+ // which LookAtXlat and SelectionXlat do, as the game shipped.+ if( !TheGlobalData->rightButtonOrders() )break;+ const Bool classic = TheGlobalData->isClassicUI();// A right click is an order. A right drag pans the camera (LookAtXlat), so a release that// travelled past the drag tolerance, or was held too long, gives no order at all.@@ -4211,8 +4213,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage// The one exception is the move, attack, attack move or guard key. Those orders are aimed// with the left button, so a right click while one is armed puts the key down and gives no- // order. A pan leaves the key armed.- if( TheInGameUI->isOrderKeyArmed() )+ // order. A pan leaves the key armed. Classic's alternate mouse aims its attack move with+ // this click, as 1.04 did.+ if( !classic && TheInGameUI->isOrderKeyArmed() ){if( isRightClick )TheInGameUI->clearAttackMoveToMode();@@ -4263,8 +4266,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessagecase GameMessage::MSG_MOUSE_LEFT_DOUBLE_CLICK:{// Classic's orders are on the left button, so its double-click guard is here, the game's- // own guard with its own two arguments. Reforged's is on the right button.- if( TheGlobalData->isClassicUI() && TheGlobalData->m_doubleClickAttackMove )+ // own guard with its own two arguments. Reforged's, and the alternate mouse's, is on the+ // right button.+ if( TheGlobalData->leftButtonOrders() && TheGlobalData->m_doubleClickAttackMove ){GameMessage *newMsg = TheMessageStream->appendMessage( GameMessage::MSG_DO_GUARD_POSITION );Coord3D pos;@@ -4308,10 +4312,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage// The left button selects and nothing else. The exceptions are a GUI command that is// already armed and waiting for a target, and the attack, attack move and guard keys: all of// them are aimed with the left button, because the right one cancels them. In Classic the- // left button is the order button as well, as it was in the game as shipped.+ // left button is the order button as well, as it was in the game as shipped, unless EA's+ // Alternate Mouse Setup is on: then only a GUI command waiting for a target fires here.const Bool classic = TheGlobalData->isClassicUI();const Bool isOrderKey = TheInGameUI->isOrderKeyArmed();- if( !isFiringGUICommand && !isOrderKey && !classic )+ if( classic ? !TheGlobalData->leftButtonOrders() && !isFiringGUICommand+ : !isFiringGUICommand && !isOrderKey )break;Bool controllable = TheInGameUI->areSelectedObjectsControllable()diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cppindex d14d1bab1..53c1da361 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp@@ -1186,9 +1186,9 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessaif( !TheInGameUI->getGUICommand() && !TheInGameUI->isOrderKeyArmed()&& !TheKeyboard->isShift() && !TheKeyboard->isCtrl() && !TheKeyboard->isAlt() ){- //No GUI command mode, so a click on empty ground deselects everyone. Not in Classic,- //where that click is a move order and the right button is what deselects.- if( TheInGameUI->getPendingPlaceSourceObjectID() == INVALID_ID && !TheGlobalData->isClassicUI() )+ //No GUI command mode, so a click on empty ground deselects everyone. Not in Classic's+ //default mouse, where that click is a move order and the right button is what deselects.+ if( TheInGameUI->getPendingPlaceSourceObjectID() == INVALID_ID && !TheGlobalData->leftButtonOrders() ){if( !TheInGameUI->getPreventLeftClickDeselectionInAlternateMouseModeForOneClick() ){@@ -1224,10 +1224,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa// Classic is the game as shipped: a right click with nothing armed deselects everyone, and// with something armed it only takes that back, below. A right drag panned and is gone above.+ // Under EA's Alternate Mouse Setup that click is the order instead (CommandXlat) and+ // deselects nothing.if( TheGlobalData->isClassicUI() && TheInGameUI->getGUICommand() == NULL&& TheInGameUI->getPendingPlaceType() == NULL ){- deselectAll();+ if( TheGlobalData->leftButtonOrders() )+ deselectAll();break;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cppindex 1a3a05e59..0af54ee59 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp@@ -188,8 +188,9 @@ extern Bool contextCommandForNewSelection(const DrawableList *currentlySelectedD// In Reforged the left button selects and the right button orders, so a left click never// commands. The counting above is still wanted - the caller reads the counts for the cursor and- // the selection filters.- if (!TheGlobalData->isClassicUI()) {+ // the selection filters. Classic's alternate mouse is EA's, where the left button never+ // commanded either.+ if (!TheGlobalData->leftButtonOrders()) {return FALSE;}diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 27e0ccf42..a30985f9a 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -1283,6 +1283,33 @@ TEST(ctrl_force_fires_in_classic_and_only_there)CHECK( !InGameUI_isForceFireOn( FALSE, FALSE, TRUE ) );}+/* GlobalData.h: which button orders. Classic is 1.04's left button, or the right under EA's Alternate+ Mouse Setup (UseAlternateMouse, off out of the box); Reforged is the right whatever Options.ini says. */+TEST(alternate_mouse_moves_the_order_button_in_classic_only)+{+ GlobalData *saved = TheWritableGlobalData;+ TheWritableGlobalData = NEW GlobalData;+ CHECK( !TheGlobalData->m_useAlternateMouse );++ TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_CLASSIC;+ CHECK( TheGlobalData->leftButtonOrders() );+ CHECK( !TheGlobalData->rightButtonOrders() );++ TheWritableGlobalData->m_useAlternateMouse = TRUE;+ CHECK( !TheGlobalData->leftButtonOrders() );+ CHECK( TheGlobalData->rightButtonOrders() );++ TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_REFORGED;+ CHECK( !TheGlobalData->leftButtonOrders() );+ CHECK( TheGlobalData->rightButtonOrders() );+ TheWritableGlobalData->m_useAlternateMouse = FALSE;+ CHECK( !TheGlobalData->leftButtonOrders() );+ CHECK( TheGlobalData->rightButtonOrders() );++ delete TheWritableGlobalData;+ TheWritableGlobalData = saved;+}+/* Player.cpp: the lobby's unit limit is 840 units shared out by the players who are not watching. */TEST(unit_limit_shares_840_between_the_players){diff --git a/GeneralsMD/Code/Tests/test_minimap_input.inc b/GeneralsMD/Code/Tests/test_minimap_input.incindex b43aaf3bf..ed67d520e 100644--- a/GeneralsMD/Code/Tests/test_minimap_input.inc+++ b/GeneralsMD/Code/Tests/test_minimap_input.inc@@ -248,12 +248,16 @@ struct MinimapInputFixtureTheInGameUI = ui;// Reforged's radar: left looks, right orders. Classic swaps them, and says so in its own testsavedStyle = TheGlobalData->m_interfaceStyle;+ savedAlternateMouse = TheGlobalData->m_useAlternateMouse;TheWritableGlobalData->m_interfaceStyle = INTERFACE_STYLE_REFORGED;+ TheWritableGlobalData->m_useAlternateMouse = FALSE;}Int savedStyle;+ Bool savedAlternateMouse;~MinimapInputFixture(){TheWritableGlobalData->m_interfaceStyle = savedStyle;+ TheWritableGlobalData->m_useAlternateMouse = savedAlternateMouse;windows.winDestroyAll();TheRadar = savedRadar;TheTerrainLogic = savedTerrain;@@ -314,6 +318,27 @@ TEST(minimap_classic_right_button_looks_with_units_selected)CHECK(messages.commands.getFirstMessage() == NULL);}+/* EA's Alternate Mouse Setup put the radar's look back on the left button, the world's select button.+ Reforged's radar looks on the left whether the setting is on or not. */+TEST(minimap_alternate_mouse_looks_on_the_left_in_classic_and_reforged_ignores_it)+{+ CHECK(bootOnce());+ const Int styles[2] = { INTERFACE_STYLE_CLASSIC, INTERFACE_STYLE_REFORGED };+ for (Int i = 0; i < 2; ++i)+ {+ MinimapInputFixture f;+ MinimapMessages messages;+ messages.stream.attachTranslator(NEW WindowTranslator, 10);+ TheWritableGlobalData->m_interfaceStyle = styles[i];+ TheWritableGlobalData->m_useAlternateMouse = TRUE;+ ((MinimapTestUI*)TheInGameUI)->selected.push_back(NULL);+ f.event(messages, GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN, 120, 220);+ CHECK(f.engine.view.lookAtCalls == 1);+ f.event(messages, GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP, 120, 220);+ CHECK(messages.commands.getFirstMessage() == NULL);+ }+}+/* Off the radar the drag pins to the picture's edge, so the camera waits at the map's edge instead ofwherever the last move inside left it. A release outside never reaches the radar, and the next dragthat starts on the battlefield and crosses the radar must still leave the camera alone. */diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.pyindex a29b34ba2..3ff851710 100644--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py@@ -124,9 +124,10 @@ NAME_THE_UNNAMED = [("GUI:Options", "LabelTitle"),]-# Controls that are in the shipped file and are not wanted at all. CheckAlternateMouse chose-# between the classic mouse and the alternate one; there is one mouse now.-DELETE = ["CheckAlternateMouse"]+# EA's controls that only the Classic page keeps. CheckAlternateMouse is EA's Alternate Mouse Setup:+# Classic plays 1.04's mouse and offers its alternate one too, Reforged has one mouse and ignores the+# setting, so its page drops the box. OptionsMenu.cpp finds it by name and does without it.+CLASSIC_ONLY = ["CheckAlternateMouse"]# The templates new controls are cloned from, and whose lettering the moved ones take.CHECK, LABEL, COMBO, SLIDER = "Retaliation", "DetailLabel", "ComboBoxDetail", "SliderGamma"@@ -315,6 +316,7 @@ GROUP_LAYOUT = [("check", "CheckStartAtMaxZoom"),("check", "CheckSnapCamera45")]),("GUI:OptionsGroupOrders", [+ ("check", "CheckAlternateMouse"),("check", "Retaliation"),("check", "CheckDoubleClickAttackMove")]),("GUI:OptionsGroupPlacement", [@@ -389,12 +391,13 @@ def flow(groups):return best[1]-def without_reforged(groups):- """The Classic page: REFORGED_ONLY controls out, and a group left with nothing in it out too."""+def without(groups, names):+ """A page with these controls out, and a group left with nothing in it out too. The Classic page+ leaves out REFORGED_ONLY, the Reforged page CLASSIC_ONLY."""kept = []for heading, items in groups:items = [item for item in items if (item[2] if item[0] == "setting" else item[1])- not in REFORGED_ONLY]+ not in names]if items:kept.append((heading, items))return kept@@ -558,7 +561,8 @@ def build(layout, classic=False):node.name = _named(name)drop_by_text(layout.root, HEADINGS)- drop_by_name(layout.root, DELETE)+ if not classic:+ drop_by_name(layout.root, CLASSIC_ONLY)for name in RULES + DROP:detach(old, name)@@ -611,8 +615,7 @@ def build(layout, classic=False):page_bottom = PAGE[1] + PAGE[3]for page_name, groups in GROUP_LAYOUT:- if classic:- groups = without_reforged(groups)+ groups = without(groups, REFORGED_ONLY if classic else CLASSIC_ONLY)if not groups:raise ValueError("%s has nothing left on it" % page_name)index = 0@@ -776,6 +779,11 @@ def selfcheck():for name in sorted(widgets - set(REFORGED_ONLY)):if name not in classic_controls:problems.append("OptionsMenuClassic.wnd has no %s" % name)+ for name in CLASSIC_ONLY:+ if name in controls:+ problems.append("OptionsMenu.wnd still carries %s, which only Classic has" % name)+ if name not in classic_controls:+ problems.append("OptionsMenuClassic.wnd has no %s" % name)for page_name, _tab, _text in TABS:if classic.find(page_name) is None:problems.append("OptionsMenuClassic.wnd has no %s" % page_name)