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): draw attack move and guard lines with the left button
Olcay Seygan77ff190f8d82
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 61f722a97..647a61645 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,7 +3,7 @@EA released the 2003 source for preservation. It did not compile, did not run, and nobody had touchedthe bugs inside it in twenty-two years. This build compiles, runs and plays.-**122 changes. ~580 engine source files ported. 14 automated test suites. Around 60 original bugs+**123 changes. ~580 engine source files ported. 14 automated test suites. Around 60 original bugsfound and fixed — EA's own, not port damage.**---@@ -126,11 +126,11 @@ found and fixed — EA's own, not port damage.**- Ctrl+Q now takes infantry only, not every armed thing you own.- A box drawn with Ctrl held takes those units back out of your selection instead of replacing it, so a group is trimmed by dragging over the corner of it rather than picked again from scratch. Held with Alt the box keeps only what can shoot: drag across your base and you get the tanks, not the dozers and supply trucks standing among them. Both are drag-only, and a single click still means exactly what it always did.- The three buttons each do one thing now. Left selects, and only selects. Right gives orders, and nothing it does moves the camera. The camera is on the middle button, and it scrolls the way the right button used to: the spot you pressed on stays put, and the further you pull away from it the faster the map runs. Hold Ctrl and the same drag turns the view instead. The wheel zooms toward whatever the cursor is over and the screen edges still scroll. The classic scheme, where left both selected and commanded and right scrolled and deselected, is gone rather than switched off, and the two checkboxes that used to choose between them are out of the options screen.-- Drag the right button and you draw a line: the selection spreads itself evenly along it, in the order the units already stand, so a column arrives as a firing line instead of a queue. It is the line you actually drew, curves and all, however far you keep drawing it: a long sweep used to give up partway through and finish as one straight run to the cursor, and now it holds its shape to the end. Letting go over the sidebar finishes the order rather than leaving the line stuck to the cursor. Draw the same line with attack move armed and the whole line is an attack move: artillery spread across a front, each gun firing on what walks into it, instead of one clump on one spot. Armed with attack instead, every unit fires on its own station along the line, which is a barrage laid across a ridge in one drag. This is what the right button freed up. `FormationDrag = no` in Options.ini turns it off if you would rather a slipped click did nothing.+- Drag the right button and you draw a line: the selection spreads itself evenly along it, in the order the units already stand, so a column arrives as a firing line instead of a queue. It is the line you actually drew, curves and all, however far you keep drawing it: a long sweep used to give up partway through and finish as one straight run to the cursor, and now it holds its shape to the end. Letting go over the sidebar finishes the order rather than leaving the line stuck to the cursor. Draw the same line with attack move armed and the whole line is an attack move: artillery spread across a front, each gun firing on what walks into it, instead of one clump on one spot. With F armed the left button draws it too, since the left button is what attack move is aimed with. Armed with attack instead, every unit fires on its own station along the line, which is a barrage laid across a ridge in one drag. This is what the right button freed up. `FormationDrag = no` in Options.ini turns it off if you would rather a slipped click did nothing.- Selected units draw a thread to wherever they are going, and the marker on the spot is the game's own cursor. Every order that has a cursor gets that cursor: move, attack move, attack, force fire, ground fire, enter, dock, repair, heal, capture, hack, guard, a waypoint path. Green for a move, pink for an attack-move, red for anything that shoots, so a group told three different things reads as three different colours. It is not a flash at the moment of the order: the line is asked of the unit every frame, so it lasts until the unit gets there, changes its mind or leaves your selection, and it shows on the formation line while you are still drawing it. A unit that has walked off the edge of the screen still draws its line, which is how you see where the half of your army you cannot see is headed. The animated ring the ground used to sprout wherever you clicked is gone: it flashed for a second and told you nothing the marker sitting on the destination does not, and that marker stays for as long as the order does. A marker that has just appeared slides the last few pixels up out of the bottom right and fades in as it lands, over about an eighth of a second, so a fresh order catches your eye without anything flashing. Aircraft draw their thread from the click, not from the moment they leave the runway. A plane parked on its airfield answers an order by starting its takeoff and puts the order itself aside until the wheels are up, so the taxi and the climb, which is exactly the stretch where you are wondering whether the strike went out at all, used to show nothing.- A unit standing guard draws its marker on the ground it is guarding. A guard order clears the unit's goal on the way in, so every guard marker used to sit in the bottom left corner of the map with a thread running the whole way across it, whatever the unit was actually watching.- A is attack and F is attack move, each arming the next order click. A click on the ground with A held down is a shot at that ground, on your own tank a shot at your own tank, and the mode drops again the moment the order goes out, so nothing stays armed behind your back. The click keeps your group, too: an attack click that was not a drag used to run the same deselect an ordinary left click runs, so the order arrived a moment after the units it was meant for had been dropped. Both orders are aimed with the left button, the way a special power is, and a right click puts the key down again without giving any order. Holding ctrl no longer forces fire: A is the one way to shoot the ground, and ctrl on a move is only the shared pace. The two keys turn each other off, and the letters they took were sitting on grid commands that moved.-- G is guard, armed the same way. The next order click posts the selection on that spot: they hold it, shoot what walks into range and do not chase it off the post you put them on. Drag the right button with G armed and they post along the line you draw, one unit per station, which is how a hill or a bridge approach gets covered in one gesture instead of a click per tank. Guard has its own colour, blue, on the line while you draw it and on the thread and marker afterwards, so a group told to hold ground reads apart from one told to walk there. Hold position, which posts every unit on the spot it is already standing on, has moved to H.+- G is guard, armed the same way and aimed with the same left button. A left click posts the selection on that spot: they hold it, shoot what walks into range and do not chase it off the post you put them on. The cursor turns into the targeting cross while G is armed, so you can see the key is down before you click, and a right click puts it down again. Drag the left button with G armed and they post along the line you draw, one unit per station, which is how a hill or a bridge approach gets covered in one gesture instead of a click per tank. Guard has its own colour, blue, on the line while you draw it and on the thread and marker afterwards, so a group told to hold ground reads apart from one told to walk there. Hold position, which posts every unit on the spot it is already standing on, has moved to H.- With A armed, hold the left button and drag a circle instead: everything hostile you can see inside it becomes a target list, nearest first, and the selection works down that list on its own. When the current target dies the next order goes out the same frame, so a strike group clears a circle without you clicking once per tank. It moves on from a target the group has stopped working on, too, rather than only from a dead one: something none of them can reach or hurt used to sit at the head of the list and hold every other target behind it for the rest of the match. That list is the same queue a shift-clicked attack builds, so you can see it: every target still owed has its own thread and marker, in the order they will be taken, instead of one line to whatever is being shot at this second. Hold shift while you draw the circle and its targets go on the end of what the group is already working through; draw it without shift and the circle replaces the lot. The ground inside the circle is washed the same red while you drag it, painted on the map rather than over it, so it runs up the hills inside the circle and your own tanks stand on top of it. Any order you give by hand ends the list. Losing a unit does not: the list belongs to the group that was told and carries on with whoever is left, which is worth saying because for a while it did not, and one tank dying threw away every target still owed. A target with enough of your fire already in the air to kill it counts as done, so the rest of the group takes the next thing on the list rather than emptying itself into something that is dead and has not fallen over yet. Aircraft are what this is for: a flight fires from range and the missiles are seconds behind, and four planes used to spend all four loads on the first tank in the circle. Running out of ammo does not cost you the list either. A flight that empties its racks flies home, lands, rearms and comes back to the target it left, and the queue waits for it instead of counting the trip as the group giving up: a circle drawn for four planes used to be empty by the time they were back in the air, one entry lost every two seconds they were away. The threads stay on the ground for the whole trip, too. A plane flying home has no target and no order to read, so the list it was still holding used to vanish off the map the moment it turned for base and reappear only when it was shooting again, which looks exactly like the list being thrown away. What the circle picks up is what you can shoot: a shell or a missile crossing it is on the enemy's side like everything else and used to go on the list as a target, costing the group a two second stall on something that was about to stop existing. A target that has driven into the shroud since you picked it keeps its place in the list but stops drawing its thread, so the line cannot be used to trace it through the fog. An attack-move queued behind other orders keeps the force fire it was given rather than losing it when the attack key drops.- Shift queues an attack now, not only a move. A or F held down while you shift-click adds a force-attack or an attack-move to the line of orders a group is already holding, and it fires the moment the order in front of it is finished - a target dead, or nobody left chasing an attack-move point. The coloured thread that shows a queued order covers it too, so a queue of "go here, then attack that, then attack-move over there" reads as one continuous line in three colours. The game's own white waypoint markings, which used to draw over the same ground the moment shift went down, are gone - they only ever duplicated what the coloured thread already showed, and doing both left a queued attack sitting under two different pictures of itself.- Ctrl+D takes every unit of the kinds you have selected that is on the screen, and pressed twice inside half a second takes them across the whole map. One tank selected and two keystrokes is your whole armour, wherever it is standing. It was on Shift+Ctrl+E, which is three fingers for something you do in every fight, and it only ever reached across the map when the screen had nothing left to give - so the wide selection happened to you instead of being asked for.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 05295ab8b..35a250448 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -158,7 +158,7 @@ GUI:ToggleAttackMoveENDGUI:ToggleAttackMoveDescription-"Arms attack move: left click where the selected units should go, fighting anything they meet on the way. Right click puts it down."+"Arms attack move: left click where the selected units should go, fighting anything they meet on the way, or drag the left button to spread them along a line. Right click puts it down."ENDGUI:ToggleForceAttack@@ -174,7 +174,7 @@ GUI:ToggleGuardENDGUI:ToggleGuardDescription-"Arms guard: the next order click posts the selected units on that spot, and a right drag posts them along the line you draw."+"Arms guard: left click posts the selected units on that spot, and a left drag posts them along the line you draw. Right click puts it down."ENDGUI:HoldPositiondiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.hindex 373b86cb2..18cd292f9 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h@@ -62,10 +62,14 @@ private:// still an order, and weighing the camera's travel turned those into drags and lost them.// The deselect path in SelectionXlat does weigh it, which is where it belongs.- // latched the moment the right button goes down: whether this drag is drawing a formation line.+ // latched the moment the button goes down: whether this drag is drawing a formation line.// Latched rather than asked again, so a selection that changes mid-drag cannot abandon a line- // the player is already dragging.+ // the player is already dragging. The right button draws one always, the left one only with+ // attack move or guard armed, and the anchor is wherever the drawing button went down.Bool m_formationDragArmed;+ ICoord2D m_formationDragAnchor;++ void finishFormationDrag( const ICoord2D& lift );GameMessage::Type createMoveToLocationMessage( Drawable *draw, const Coord3D *dest, CommandEvaluateType commandType );GameMessage::Type createAttackMessage( Drawable *draw, Drawable *other, CommandEvaluateType commandType );diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex 8f90ed0e6..7c2d753b6 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -867,13 +867,14 @@ public: // ********************************************************************// same call that drops attack movevoid toggleForceAttackArmed( void ) { m_forceAttackArmed = !m_forceAttackArmed; m_attackMoveToMode = FALSE; m_guardArmed = FALSE; }Bool isForceAttackArmed( void ) const { return m_forceAttackArmed; }- Bool isAttackOrderArmed( void ) const { return m_forceAttackArmed || m_attackMoveToMode; } ///< the next left click is an attack or an attack move+ Bool isOrderKeyArmed( void ) const { return m_forceAttackArmed || m_attackMoveToMode || m_guardArmed; } ///< the next left click is an attack, an attack move or a guard// and the guard key arms guard the same way: the next order click posts the selection on that// spot, or on that object, and a drag posts them along the line instead of stacking them all// on one point. All three modes are one mode at a timevoid toggleGuardArmed( void ) { m_guardArmed = !m_guardArmed; m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; }Bool isGuardArmed( void ) const { return m_guardArmed; }+ Bool isLineOrderArmed( void ) const { return m_attackMoveToMode || m_guardArmed; } ///< a left drag draws an attack move or guard line; force fire's left drag is the attack circle// zeroing the repeat clock makes the first quantized step happen on the very next update, so a// tap of the key is one eighth and a hold is one eighth every CAMERA_SNAP_REPEAT_MS.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionXlat.hindex 28daa3d58..4452d9e04 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionXlat.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/SelectionXlat.h@@ -47,7 +47,7 @@ private:Bool m_leftMouseButtonIsDown;Bool m_dragSelecting;- Bool m_attackCircleJustIssued; ///< a circle drag just went out, so eat the click that ends it (fork)+ Bool m_dragOrderJustIssued; ///< an attack circle or a left-drawn order line just went out, so eat the click that ends it (fork)UnsignedInt m_lastGroupSelTime;Int m_lastGroupSelGroup;ICoord2D m_selectFeedbackAnchor; // Note: Used for drawing feedback only.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 3720dc87c..836ea91a8 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -4282,7 +4282,9 @@ void InGameUI::createCommandHint( const GameMessage *msg )(TheRadar->isRadarHidden() ||ThePlayerList->getLocalPlayer()->hasRadar() == FALSE) )setMouseCursor( Mouse::ARROW );- else+ else if( isGuardArmed() )+ setMouseCursor( Mouse::CROSS ); // the targeting cross, the cursor EA's own guard button arms+ elsesetMouseCursor( Mouse::MOVETO );break;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cppindex a61c6cb5f..415e86d77 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp@@ -1436,6 +1436,8 @@ CommandTranslator::CommandTranslator() :m_mouseRightDragAnchor.y = 0;m_mouseRightDragLift.x = 0;m_mouseRightDragLift.y = 0;+ m_formationDragAnchor.x = 0;+ m_formationDragAnchor.y = 0;}//====================================================================================@@ -1443,6 +1445,60 @@ CommandTranslator::~CommandTranslator(){}+//-------------------------------------------------------------------------------------------------+/**+ * The button that drew a formation line came back up. A drag that travelled far enough to be a+ * line becomes the order its armed mode names; one that never did was a click, and the click+ * message behind this release gives that order instead.+ */+void CommandTranslator::finishFormationDrag( const ICoord2D& lift )+{+ const Bool wasDrag = TheInGameUI->isFormationDragging();++ if( wasDrag )+ TheInGameUI->addFormationDragPoint( lift );++ // copied out before the drag is cleared, which throws the curve away+ std::vector<ICoord2D> curve = TheInGameUI->getFormationDragPoints();++ // the preview goes with the drag; from here on the units' own goals are what gets drawn,+ // so the picture carries on without a break+ TheInGameUI->clearFormationDrag();+ m_formationDragArmed = FALSE;++ if( !wasDrag || curve.size() < 2 )+ return;++ // the same curve means "attack along this" while one of the attack modes is armed, which+ // is the artillery gesture: a line of fire instead of a line of tanks. Attack move+ // walks it and shoots what it meets; the attack key fires on the line where it stands+ const GameMessage::Type formationType =+ Command_formationMessage( TheInGameUI->isInAttackMoveToMode(),+ TheInGameUI->isForceAttackArmed(),+ TheInGameUI->isGuardArmed() );++ // the traced curve becomes world points; who stands where along it is decided on+ // the logic side, where every machine decides it the same way+ GameMessage *newMsg = TheMessageStream->appendMessage( formationType );+ for( std::vector<ICoord2D>::const_iterator it = curve.begin(); it != curve.end(); ++it )+ {+ Coord3D world;+ TheTacticalView->screenToTerrain( &(*it), &world );+ newMsg->appendLocationArgument( world );+ }++ TheInGameUI->clearAttackMoveToMode();++ // a hand-given order ends whatever list the group was working through, unless shift+ // says the player is adding to it+ if( !TheInGameUI->isInWaypointMode() )+ TheInGameUI->clearShiftAttackQueue();++ const DrawableList *selected = TheInGameUI->getAllSelectedDrawables();+ if( selected && !selected->empty() )+ pickAndPlayUnitVoiceResponse( selected, GameMessage::MSG_DO_MOVETO );+}+//-------------------------------------------------------------------------------------------------@@ -3983,11 +4039,34 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessagem_mouseRightDragAnchor = msg->getArgument( 0 )->pixel;m_mouseRightDown = (UnsignedInt) msg->getArgument( 2 )->integer;+ m_formationDragAnchor = m_mouseRightDragAnchor;m_formationDragArmed = isFormationDragArmed();break;}+ //-----------------------------------------------------------------------------+ // Attack move and guard are aimed with the left button, so with either armed a left drag draws+ // the same line a right drag does. The attack key keeps its left drag for the attack circle.+ case GameMessage::MSG_RAW_MOUSE_LEFT_DOUBLE_CLICK:+ case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN:+ {+ if( TheInGameUI->isLineOrderArmed() )+ {+ m_formationDragAnchor = msg->getArgument( 0 )->pixel;+ m_formationDragArmed = isFormationDragArmed();+ }+ break;+ }++ //-----------------------------------------------------------------------------+ case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP:+ {+ if( m_formationDragArmed )+ finishFormationDrag( msg->getArgument( 0 )->pixel );+ break;+ }+//-----------------------------------------------------------------------------case GameMessage::MSG_RAW_MOUSE_POSITION:{@@ -4001,10 +4080,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage// once it is a drag, every position message is a point on the curveTheInGameUI->addFormationDragPoint( here );}- else if( (UnsignedInt)abs( here.x - m_mouseRightDragAnchor.x ) > TheMouse->m_dragTolerance- || (UnsignedInt)abs( here.y - m_mouseRightDragAnchor.y ) > TheMouse->m_dragTolerance )+ else if( (UnsignedInt)abs( here.x - m_formationDragAnchor.x ) > TheMouse->m_dragTolerance+ || (UnsignedInt)abs( here.y - m_formationDragAnchor.y ) > TheMouse->m_dragTolerance ){- TheInGameUI->addFormationDragPoint( m_mouseRightDragAnchor );+ TheInGameUI->addFormationDragPoint( m_formationDragAnchor );TheInGameUI->addFormationDragPoint( here );}}@@ -4020,54 +4099,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessagem_mouseRightUp = (UnsignedInt) msg->getArgument( 2 )->integer;if( m_formationDragArmed )- {- const Bool wasDrag = TheInGameUI->isFormationDragging();-- if( wasDrag )- TheInGameUI->addFormationDragPoint( m_mouseRightDragLift );-- // copied out before the drag is cleared, which throws the curve away- std::vector<ICoord2D> curve = TheInGameUI->getFormationDragPoints();-- // the preview goes with the drag; from here on the units' own goals are what gets drawn,- // so the picture carries on without a break- TheInGameUI->clearFormationDrag();- m_formationDragArmed = FALSE;-- if( wasDrag && curve.size() >= 2 )- {- // the same curve means "attack along this" while one of the attack modes is armed, which- // is the artillery gesture: a line of fire instead of a line of tanks. Attack move- // walks it and shoots what it meets; the attack key fires on the line where it stands- const GameMessage::Type formationType =- Command_formationMessage( TheInGameUI->isInAttackMoveToMode(),- TheInGameUI->isForceAttackArmed(),- TheInGameUI->isGuardArmed() );-- // the traced curve becomes world points; who stands where along it is decided on- // the logic side, where every machine decides it the same way- GameMessage *newMsg = TheMessageStream->appendMessage( formationType );- for( std::vector<ICoord2D>::const_iterator it = curve.begin(); it != curve.end(); ++it )- {- Coord3D world;- TheTacticalView->screenToTerrain( &(*it), &world );- newMsg->appendLocationArgument( world );- }-- TheInGameUI->clearAttackMoveToMode();-- // a hand-given order ends whatever list the group was working through, unless shift- // says the player is adding to it- if( !TheInGameUI->isInWaypointMode() )- TheInGameUI->clearShiftAttackQueue();-- const DrawableList *selected = TheInGameUI->getAllSelectedDrawables();- if( selected && !selected->empty() )- pickAndPlayUnitVoiceResponse( selected, GameMessage::MSG_DO_MOVETO );-- break;- }- }+ finishFormationDrag( m_mouseRightDragLift );// a structure waiting to be placed is dropped by the same release, over in// SelectionXlat, which sees it whether this was a click or a drag@@ -4101,9 +4133,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage// which is gone: a click here commands, a drag draws a formation line, and neither of// them scrolls.//- // The one exception is the attack or attack move 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.- if( TheInGameUI->isAttackOrderArmed() )+ // The one exception is the 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.+ if( TheInGameUI->isOrderKeyArmed() ){TheInGameUI->clearAttackMoveToMode();disp = DESTROY_MESSAGE;@@ -4191,10 +4223,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage|| command->getCommandType() == GUICOMMANDMODE_CONVERT_TO_CARBOMB));// 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 and attack move keys: all of them- // are aimed with the left button, because the right one cancels them.- const Bool isAttackOrder = TheInGameUI->isAttackOrderArmed();- if( !isFiringGUICommand && !isAttackOrder )+ // 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.+ const Bool isOrderKey = TheInGameUI->isOrderKeyArmed();+ if( !isFiringGUICommand && !isOrderKey )break;Bool controllable = TheInGameUI->areSelectedObjectsControllable()@@ -4217,7 +4249,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage// the same rule the right button's orders follow: a hand-given attack ends the list the// group was working through, unless shift says it is being added to- if( isAttackOrder && !TheInGameUI->isInWaypointMode() )+ if( isOrderKey && !TheInGameUI->isInWaypointMode() )TheInGameUI->clearShiftAttackQueue();//issueMoveToLocationCommand( &pos, draw, DO_COMMAND );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cppindex 57388edca..5e5e88742 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp@@ -268,7 +268,7 @@ SelectionTranslator::SelectionTranslator(){m_leftMouseButtonIsDown = FALSE;m_dragSelecting = FALSE;- m_attackCircleJustIssued = FALSE;+ m_dragOrderJustIssued = FALSE;m_lastGroupSelTime = 0;m_lastGroupSelGroup = -1;m_selectFeedbackAnchor.x = 0;@@ -414,7 +414,10 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessabreak;}- if (m_leftMouseButtonIsDown)+ // with attack move or guard armed a left drag draws the order line over in CommandXlat, so+ // no selection box grows under it+ const Bool leftDrawsLine = TheInGameUI->isLineOrderArmed() && TheInGameUI->getSelectCount() > 0;+ if (m_leftMouseButtonIsDown && !leftDrawsLine){ICoord2D delta;@@ -491,15 +494,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa// the release that ended a circle arrives as a double click when the circle was the// second of a quick pair. Letting it through would select everything of one kind on the// screen, and that new selection is exactly what drops the orders just given- if( m_attackCircleJustIssued )+ if( m_dragOrderJustIssued ){- m_attackCircleJustIssued = FALSE;+ m_dragOrderJustIssued = FALSE;disp = DESTROY_MESSAGE;break;}- // an armed attack key makes this click an order, which CommandXlat gives- if (TheInGameUI->isAttackOrderArmed())+ // an armed order key makes this click an order, which CommandXlat gives+ if (TheInGameUI->isOrderKeyArmed())break;const IRegion2D& region = msg->getArgument(0)->pixelRegion;@@ -634,9 +637,9 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa// the release that ended an attack circle still arrives here as a click. Letting it// through would reselect whatever sat under the anchor, and a changed selection is exactly// what drops the queue that was just built- if( m_attackCircleJustIssued )+ if( m_dragOrderJustIssued ){- m_attackCircleJustIssued = FALSE;+ m_dragOrderJustIssued = FALSE;disp = DESTROY_MESSAGE;break;}@@ -648,9 +651,9 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessabreak;}- // With the attack or attack move key armed and something selected, a point click is the- // order and not a selection. It goes on to CommandXlat untouched, drawable under it or not- if (TheInGameUI->isAttackOrderArmed() && TheInGameUI->getSelectCount() > 0)+ // With the attack, attack move or guard key armed and something selected, a point click is+ // the order and not a selection. It goes on to CommandXlat untouched, drawable under it or not+ if (TheInGameUI->isOrderKeyArmed() && TheInGameUI->getSelectCount() > 0)break;// Basically, we need to first determine if there are any drawables in the region of interest.@@ -1064,7 +1067,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessaif( TheInGameUI->issueAttackCircle() ){TheInGameUI->clearAttackMoveToMode();- m_attackCircleJustIssued = TRUE;+ m_dragOrderJustIssued = TRUE;}//@@ -1077,6 +1080,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessabreak;}+ // a left drag that drew an attack move or guard line is turned into its order by CommandXlat,+ // which sees this release next. The click behind the release would select whatever sat+ // under it and drop the group the line was drawn for+ if( TheInGameUI->isFormationDragging() && TheInGameUI->isLineOrderArmed() )+ {+ m_dragOrderJustIssued = TRUE;+ break;+ }+if (m_dragSelecting) {// Stop drag selecting now, thanks.m_dragSelecting = FALSE;@@ -1098,8 +1110,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa//Added support to cancel the GUI command without deselecting the unit(s) involved//when you right click.- // an armed attack key keeps the group: the click behind this release is its order- if( !TheInGameUI->getGUICommand() && !TheInGameUI->isAttackOrderArmed()+ // an armed order key keeps the group: the click behind this release is its order+ if( !TheInGameUI->getGUICommand() && !TheInGameUI->isOrderKeyArmed()&& !TheKeyboard->isShift() && !TheKeyboard->isCtrl() && !TheKeyboard->isAlt() ){//No GUI command mode, so a click on empty ground deselects everyone.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cppindex fed9aa440..6b1ac34e2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp@@ -242,7 +242,8 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage// command bar freezes there and never lets go.if( TheInGameUI && TheInGameUI->isFormationDragging()&& ( msg->getType() == GameMessage::MSG_RAW_MOUSE_POSITION- || msg->getType() == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP ) )+ || msg->getType() == GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP+ || msg->getType() == GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_UP ) ){forceKeepMessage = TRUE;}