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): orders drawn with EA's rally line and flag
Olcay Seyganc39d1746f42b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6c99079e0..39a68a383 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -269,16 +269,16 @@ found and fixed — EA's own, not port damage.**- How far the pointer travels before a click becomes a drag is yours to set. Drag Threshold on Options > Controls runs from 2 to 50 pixels, and the game's own value was 25. Raise it if selection boxes start by accident, lower it if your drags are read as clicks.- An isometric camera, on Options > Controls. It looks at the battlefield from far off through a narrow lens, so a tank at the top of the screen is drawn the same size as one at the bottom and a base reads like a city-builder's plan instead of shrinking into the distance. It buys no extra sight. The normal camera's corners, edges and centre are laid over the isometric screen as closely as a flat picture allows, hills and ultrawide screens included: the normal camera still sees a little more at the far corners and the isometric one the same amount more at the near corners, because a perspective view is wider at the back than at the front and an isometric one is not. Pan across a ridge and the picture holds its size and its angle; it does not rise and dip with the ground under it. Campaign cinematics are filmed with the normal camera whatever the box says, and the isometric view comes back when the black bars go. They are shot from ten feet off the ground looking up at a rocket leaving its pad or a skyline, and the isometric camera turned each of those shots into a view from above of somewhere else: the picture lurched sideways every time the shot tilted, and a low shot ran off the edge of the map into a white screen. With the box ticked, USA 1's opening now plays the way it does without it. You still turn and zoom it the way you always did, and the box takes effect the moment you tick it, mid-match included.- Press V, or the move button, then drag the left 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 line with the left button while attack move is 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. Guard draws the same way. Every line is drawn with the left button, the one armed orders are aimed with, and the right button never draws one: its drag is the camera. Without an order armed a left drag is the selection box it always was. 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. `FormationDrag = no` in Options.ini turns the line off if you would rather an armed drag did nothing.-- Selected units draw a thread to wherever they are going, with the pointer, tinted, sitting on the spot. Every order draws one: 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. Units standing together and headed the same way share one thread, from the middle of the knot to the middle of where they are going, so twenty tanks sent across the map draw one line instead of twenty laid on top of each other; a selection spread over the map draws one per knot, and a flank sent on its own still shows. An angry mob draws one thread for the whole mob, not one per rioter. An attack move and a shot at the ground both point at the spot you clicked: the attack move's thread used to wander off to whichever free ground each unit was steering for, and ground fire pointed at the middle of the nearest map cell. An attack move stays pink from start to finish, too. A unit that stopped to fight used to swing its thread onto the enemy it was fighting, and only swung it back to your destination once the enemy was dead. A dot and a ring stood in for the pointer for a while, and players asked for the pointer back. 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.+- Selected units draw a line to wherever they are going, and it looks like a building's rally point: EA's blue rally line, with the rally flag in your colour planted on the ground they are headed for. Every order draws one: move, attack move, attack, force fire, ground fire, enter, dock, repair, heal, capture, hack, guard, a waypoint path. An order aimed at something rather than somewhere, a tank to kill, a building to shoot, take or climb into, a unit to guard, ends on the line's joint instead of a flag, a small disc sitting just over the target and riding along with it while it drives, so a flag never stands on a tank. A shift list runs one line through all its stops, a joint on each and the flag on the last bit of ground. Units standing together and headed the same way share one thread, from the middle of the knot to the middle of where they are going, so twenty tanks sent across the map draw one line instead of twenty laid on top of each other; a selection spread over the map draws one per knot, and a flank sent on its own still shows. An angry mob draws one thread for the whole mob, not one per rioter. An attack move and a shot at the ground both point at the spot you clicked: the attack move's thread used to wander off to whichever free ground each unit was steering for, and ground fire pointed at the middle of the nearest map cell. An attack move stays pink from start to finish, too. A unit that stopped to fight used to swing its thread onto the enemy it was fighting, and only swung it back to your destination once the enemy was dead. 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 flag on the destination does not, and the flag stays for as long as the order does. 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 D 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. With A armed, pointing at something nothing in your selection can shoot shows the game's can't-do-that pointer: a Sentry Drone before its gun is researched has no weapon at all, and the pointer used to look ready while the click did nothing.-- 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 (the right one draws nothing while G is down) 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 (the right one draws nothing while G is down) 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 circle it holds 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: the enemies you can see inside it are split across the units that can shoot, as evenly as the numbers allow, in the order both sides stand around the circle. The tank on the left of your group takes the enemy on the left of theirs. Ten of yours against three of theirs put four guns on one and three on each of the others. Three of yours against ten of theirs each take a run of three or four and work down that run. One enemy, and every selected gun takes it. When a unit's target dies the next of its own 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. 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. A stroke drawn across enemies splits them across the units that can shoot, as evenly as the numbers allow, in the order both sides stand along the stroke. The unit nearest the start takes the enemy nearest the start. Ten guns on three enemies put four on one and three on each of the others. Three guns on ten each work down a run of three or four. The whole group used to walk one list and pour every gun into each enemy in turn. Before that the line poured fire into the ground under it and hit whatever happened to be standing there. A stroke that crosses nobody still fires on the ground along it.- Shift queues a guard as well, and it is where the line of orders stops. Hold shift with G armed and click, and the group takes up its post once it has finished everything queued in front of it: clear that ridge, then sit on it, in one set of clicks instead of standing over the fight waiting to give the last order. Nothing goes behind a guard, because a posted unit has no next place to be. The thread to the post is drawn in the guard colour like any other guard.- 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.- The shift queue takes any mix of orders now and stays with the units you gave it to. Move, attack-move, attack a target, draw a formation line, then guard: hold shift, click them in whatever order you like, and the group works down the list by itself. Queue an army's whole route, select something else, go back to your base, and the army keeps going. Before, clicking anything else threw the list away. Each step also starts the moment the one before it is done. It used to wait for the order to travel to the other players and back, which on a 250ms connection was a quarter of a second standing still at every corner. The group keeps together: nobody starts the next order until everyone still alive has finished this one, so a column does not string out behind its fastest tank. Select part of a group and shift-click, and that part takes its own copy of the list with the new order on the end while the others carry on with theirs. Shift-click a group that is already on an ordinary move and the new point goes behind the move instead of replacing it.- Shift queues whatever a right-click orders, not just moves. Shift-right-click an enemy tank and killing it goes on the list; do it on a building with a Black Lotus selected and taking the building goes on the list. A transport to climb into, a repair bay, a hospital and a supply dock work the same way, and so does an ability armed from the command bar. "Walk here, take that supply center, walk on" is one set of clicks, and the list waits for the capture to finish before anyone sets off for the next point. Upgrades queue as well: shift-click the Overlord's Gatling cannon and it is bought when the Overlord gets there and paid for then. If the money is not in the bank by that time the upgrade is passed over and the list carries on. Each unit with more than one place to go numbers its markers in the order it will reach them, and a step the colour cannot tell apart from a move carries its own cursor next to the number, or the upgrade's picture. A shift-click on one of your own units is still a point on the path. Keep shift down after pressing F, A or G and the key stays armed, so five targets are one key and five clicks instead of five of each; it drops when shift comes up. A guard, a hold or fire on the ground ends a list for good. Nothing queues behind one, whether it was given with shift or without, until an order without shift takes the units off it. Replays recorded before this version that shift-clicked an upgrade, or gave a unit holding a list an ability without shift, play back differently.-- A capture on the list looks like a capture. Its thread is gold where a move's is green, and the capture cursor sits beside its marker even when taking the building is the only order the unit has: one queued capture used to look exactly like a walk to the building's door. The thread stays gold the whole time the capture runs, on the walk over and at the door, where it used to show a plain move and then nothing at all while the building turned. The riflemen who walk in by the door queue a capture the same way Black Lotus does, Rangers and Red Guards included, from the capture button or a shift-right-click.+- A capture on the list looks like a capture. Its line ends on the building, and the capture cursor sits beside it even when taking the building is the only order the unit has: one queued capture used to look exactly like a walk to the building's door. The line stays on the building the whole time the capture runs, on the walk over and at the door, where it used to show a plain move and then nothing at all while the building turned. The riflemen who walk in by the door queue a capture the same way Black Lotus does, Rangers and Red Guards included, from the capture button or a shift-right-click.- Attack move stays armed for as long as shift is down, whether you pressed its key or clicked its button on the bar, so every point you queue is an attack move. Orders given on the minimap are the orders they would be on the battlefield: an armed attack move is an attack move there too, and shift adds to the queue. Passing the pointer over the minimap no longer puts an armed attack move down.- What the circle picks up is what you can see, and a stealthed unit is not that. Shroud was the only test, so a hidden tank parked in ground you had already cleared went on the list like anything else: drag a circle over open country and the group opened fire on air, one order per hidden unit, which is a stealth detector drawn with the mouse. An undetected unit is not in the circle.- 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/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex f648c864f..381655ac4 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -564,9 +564,21 @@ public: // ********************************************************************ORDER_HINT_ABILITY, ///< use an ability where it stands, from a shift listORDER_HINT_UPGRADE ///< buy an upgrade where it stands, from a shift list};+ // What stands on the end of an order's line, in EA's rally point art: the flag on the last bit of+ // ground a unit is sent to, the line's joint on everything else - a unit or building it is sent+ // at (which the joint then follows), and every point of a shift list short of the last+ enum OrderHintMark+ {+ ORDER_MARK_NONE = 0, ///< nothing of its own: an upgrade or ability used where the step before ends+ ORDER_MARK_JOINT, ///< EA's waypoint node+ ORDER_MARK_FLAG ///< EA's rally flag+ };+ static OrderHintMark markForOrderHint( OrderHintKind kind, Bool onObject, Bool lastPoint );+struct OrderHint{- OrderHint( void ) : kind( ORDER_HINT_MOVE ), owner( INVALID_ID ), bornMs( 0 ), step( 0 ), icon( NULL ), radius( 0.0f ) {}+ OrderHint( void ) : kind( ORDER_HINT_MOVE ), owner( INVALID_ID ), bornMs( 0 ), step( 0 ), icon( NULL ), radius( 0.0f ),+ onObject( FALSE ), mark( ORDER_MARK_NONE ) {}Coord3D from; ///< where the unit is nowCoord3D to; ///< where it is going@@ -576,6 +588,8 @@ public: // ********************************************************************Int step; ///< its place in the order the unit will get to its points, from 1; 0 when it has only the oneconst Image *icon; ///< the upgrade's own button art on an upgrade step, NULL otherwiseReal radius; ///< the circle a guard holds round 'to', 0 for every other kind+ Bool onObject; ///< 'to' is a unit or building, read off it every frame+ OrderHintMark mark; ///< what stands on 'to'};const std::vector<OrderHint>& getOrderHints( void ) const { return m_drawnOrderHints; }@@ -1493,10 +1507,13 @@ protected:void collectOrderHints( void ); ///< one hint per selected unit and queued pointvoid bunchOrderHints( void ); ///< merge the hints of units going the same wayvoid addOrderHint( OrderHint& hint, const std::vector<OrderHint>& previous ); ///< keep a marker's age across the frame the list is rebuilt on- Bool getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Coord3D& to ) const; ///< the order an aircraft is sitting on until it is airborne+ Bool getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Coord3D& to, Bool& onObject ) const; ///< the order an aircraft is sitting on until it is airbornevoid addQueuedOrderTail( OrderHint& hint, const OrderChain& chain, const std::vector<OrderHint>& previous ); ///< every order still owed, drawn on from where the hint leaves offBool getQueuedOrderHint( const QueuedOrder& order, OrderHint& hint ) const; ///< the marker a queued order draws, FALSE for nonevoid numberOrderHints( void ); ///< a unit with more than one place to go numbers them+ void markOrderHints( void ); ///< flag or joint on each hint's end+ void updateOrderFlags( void ); ///< stand a rally flag on every flagged hint+ std::vector<DrawableID> m_orderFlagIDs; ///< the rally flags updateOrderFlags stands, reused frame to frameBool isHiddenByShroud( const Object *obj ) const; ///< is the shroud over this, for the player at this machineBool m_displayedMaxWarning; ///< keeps the warning from being shown over and overconst CommandButton * m_pendingGUICommand; ///< GUI command that needs additional interaction from the userdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 04f812e16..0c7987086 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -4255,6 +4255,9 @@ void InGameUI::reset( void )}m_nextMoveHint = 0;+ // the flags went with the match's drawables, and their ids are handed out again from the start+ m_orderFlagIDs.clear();+m_isQuitMenuVisible = FALSE;m_scoreboardOpen = FALSE;m_scoreboardPageLoaded = FALSE;@@ -5402,7 +5405,20 @@ void InGameUI::updateFormationHints( void )* attack by handing its state machine to the takeoff sequence and putting the order aside, so* neither the state id nor the goal names the thing the player pointed at until it is flying. *///--------------------------------------------------------------------------------------------------Bool InGameUI::getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Coord3D& to ) const+//-------------------------------------------------------------------------------------------------+/** Where an order aimed at a unit or building ends: just over the top of it. The joint EA's rally+ * line puts on the ground sits inside the model there and the model hides it, and at the top of+ * the geometry a turret still covers it. */+//-------------------------------------------------------------------------------------------------+static Coord3D orderTargetSpot( const Object *target )+{+ const Real CLEARANCE = 8.0f;+ Coord3D spot = *target->getPosition();+ spot.z += target->getGeometryInfo().getMaxHeightAbovePosition() + CLEARANCE;+ return spot;+}++Bool InGameUI::getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Coord3D& to, Bool& onObject ) const{const AIUpdateInterface *ai = obj->getAIUpdateInterface();const JetAIUpdate *jet = ai->getJetAIUpdate();@@ -5450,12 +5466,13 @@ Bool InGameUI::getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Cooreturn FALSE;}- if( targetID != INVALID_ID )+ onObject = ( targetID != INVALID_ID );+ if( onObject ){const Object *target = TheGameLogic->findObjectByID( targetID );if( target == NULL )return FALSE;- to = *target->getPosition();+ to = orderTargetSpot( target );}else{@@ -5470,8 +5487,9 @@ Bool InGameUI::getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Coo* so the machine's goal position is the origin and reading it drew every guard marker in the* bottom left corner of the map. What the unit is guarding is kept on the AI itself. *///--------------------------------------------------------------------------------------------------static Bool getGuardedSpot( const AIUpdateInterface *ai, Coord3D& spot )+static Bool getGuardedSpot( const AIUpdateInterface *ai, Coord3D& spot, Bool& onObject ){+ onObject = ( ai->getGuardTargetType() == GUARDTARGET_OBJECT );switch( ai->getGuardTargetType() ){case GUARDTARGET_LOCATION:@@ -5483,7 +5501,7 @@ static Bool getGuardedSpot( const AIUpdateInterface *ai, Coord3D& spot )const Object *guarded = TheGameLogic->findObjectByID( ai->getGuardObject() );if( guarded == NULL )return FALSE;- spot = *guarded->getPosition();+ spot = orderTargetSpot( guarded );return TRUE;}@@ -5512,13 +5530,106 @@ void InGameUI::updateOrderHints( void )if( m_isFormationDragging ){updateFormationHints();+ markOrderHints();m_drawnOrderHints = m_orderHints;- return;}+ else+ {+ collectOrderHints();+ numberOrderHints();+ markOrderHints();+ bunchOrderHints();+ }++ updateOrderFlags();+}++//-------------------------------------------------------------------------------------------------+/** EA's rally point says "go here" with a flag and marks every bend of its line with a joint. An+ * order reads the same way: the flag goes on the last bit of ground a unit is sent to, and a unit+ * or building it is sent at gets the joint instead, so a flag never stands on a tank. */+//-------------------------------------------------------------------------------------------------+InGameUI::OrderHintMark InGameUI::markForOrderHint( OrderHintKind kind, Bool onObject, Bool lastPoint )+{+ if( kind == ORDER_HINT_ABILITY || kind == ORDER_HINT_UPGRADE )+ return ORDER_MARK_NONE;+ return ( lastPoint && !onObject ) ? ORDER_MARK_FLAG : ORDER_MARK_JOINT;+}++//-------------------------------------------------------------------------------------------------+/** A unit's hints sit together, in the order it gets to them. The flag goes on the last of them+ * that is ground, even when an attack on something is queued after it. */+//-------------------------------------------------------------------------------------------------+void InGameUI::markOrderHints( void )+{+ size_t first = 0;+ while( first < m_orderHints.size() )+ {+ size_t end = first + 1;+ while( end < m_orderHints.size() && m_orderHints[ end ].owner == m_orderHints[ first ].owner )+ ++end;- collectOrderHints();- numberOrderHints();- bunchOrderHints();+ size_t last = end;+ for( size_t i = first; i < end; ++i )+ if( markForOrderHint( m_orderHints[ i ].kind, m_orderHints[ i ].onObject, TRUE ) == ORDER_MARK_FLAG )+ last = i;++ for( size_t i = first; i < end; ++i )+ m_orderHints[ i ].mark = markForOrderHint( m_orderHints[ i ].kind, m_orderHints[ i ].onObject, i == last );++ first = end;+ }+}++//-------------------------------------------------------------------------------------------------+/** EA's rally flag (the RallyPointMarker the control bar stands on a building's rally point) on+ * every flagged destination. Client-only drawables, kept from frame to frame and moved, so the+ * flag's flutter does not restart every frame. Reforged only; Classic has EA's move ring. */+//-------------------------------------------------------------------------------------------------+void InGameUI::updateOrderFlags( void )+{+ size_t used = 0;+ const ThingTemplate *flagTemplate = TheGlobalData->isClassicUI() ? NULL : TheThingFactory->findTemplate( "RallyPointMarker" );+ Player *player = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;+ if( flagTemplate && player )+ {+ const Color color = ( TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT ) ? player->getPlayerNightColor() : player->getPlayerColor();+ for( std::vector<OrderHint>::const_iterator it = m_drawnOrderHints.begin(); it != m_drawnOrderHints.end(); ++it )+ {+ if( it->mark != ORDER_MARK_FLAG )+ continue;++ Drawable *flag = NULL;+ if( used < m_orderFlagIDs.size() )+ flag = TheGameClient->findDrawableByID( m_orderFlagIDs[ used ] );+ if( flag == NULL )+ {+ flag = TheThingFactory->newDrawable( flagTemplate );+ if( flag == NULL )+ break;+ flag->setDrawableStatus( DRAWABLE_STATUS_NO_SAVE );+ if( used < m_orderFlagIDs.size() )+ m_orderFlagIDs[ used ] = flag->getID();+ else+ m_orderFlagIDs.push_back( flag->getID() );+ }++ Coord3D spot = it->to;+ spot.z = TheTerrainLogic->getGroundHeight( spot.x, spot.y );+ flag->setPosition( &spot );+ flag->setOrientation( TheGlobalData->m_downwindAngle );+ flag->setIndicatorColor( color );+ ++used;+ }+ }++ while( m_orderFlagIDs.size() > used )+ {+ Drawable *flag = TheGameClient->findDrawableByID( m_orderFlagIDs.back() );+ if( flag )+ TheGameClient->destroyDrawable( flag );+ m_orderFlagIDs.pop_back();+ }}//-------------------------------------------------------------------------------------------------@@ -5551,6 +5662,7 @@ void InGameUI::collectOrderHints( void )hint.owner = obj->getID();Coord3D resolvedGoal;Bool goalResolved = FALSE;+ Bool resolvedOnObject = FALSE; // the resolved goal is a unit or building, not groundBool legsDrawn = FALSE; // the order drew its own threads, and the shift list follows on from them// a capture walks its man to the door with a plain move of its own and then stands him idle@@ -5628,12 +5740,14 @@ void InGameUI::collectOrderHints( void ){hint.kind = ( ai->getTunnelTripEnd() == TUNNEL_TRIP_ATTACK_MOVE ) ? ORDER_HINT_ATTACK_MOVE : ORDER_HINT_MOVE;hint.from = *obj->getPosition();- hint.to = *entrance->getPosition();+ hint.to = orderTargetSpot( entrance );+ hint.onObject = TRUE;addOrderHint( hint, previous );const Object *exit = local->getTunnelSystem()->findQuietTunnelNear( ai->getTunnelTripGoal() );hint.from = ( exit != NULL ) ? *exit->getPosition() : hint.to;hint.to = *ai->getTunnelTripGoal();+ hint.onObject = FALSE;addOrderHint( hint, previous );legsDrawn = TRUE;break;@@ -5667,7 +5781,7 @@ void InGameUI::collectOrderHints( void )// behind is the origin - and the marker landed in the bottom left corner of the map// every time. The spot being guarded lives on the AI itself, so ask it there.hint.kind = ORDER_HINT_GUARD;- if( !getGuardedSpot( ai, resolvedGoal ) )+ if( !getGuardedSpot( ai, resolvedGoal, resolvedOnObject ) )continue;goalResolved = TRUE;// and the circle it holds there@@ -5681,7 +5795,7 @@ void InGameUI::collectOrderHints( void )// gave it, and that order is held out of reach of the goal until the wheels are up.// Ask for it, or an air strike shows nothing at all during the seconds the plane spends// taxiing, which is exactly when the player wants to see where it is going- if( captured == NULL && !getHeldAircraftOrder( obj, hint.kind, resolvedGoal ) )+ if( captured == NULL && !getHeldAircraftOrder( obj, hint.kind, resolvedGoal, resolvedOnObject ) )continue;goalResolved = TRUE;break;@@ -5690,8 +5804,9 @@ void InGameUI::collectOrderHints( void )if( captured ){hint.kind = ORDER_HINT_CAPTURE;- resolvedGoal = *captured->getPosition();+ resolvedGoal = orderTargetSpot( captured );goalResolved = TRUE;+ resolvedOnObject = TRUE;}if( !legsDrawn )@@ -5703,9 +5818,11 @@ void InGameUI::collectOrderHints( void )// stays there after the key is let goconst Int pathSize = ai->friend_getWaypointGoalPathSize();const Int pathIndex = ai->friend_getCurrentGoalPathIndex();+ hint.onObject = FALSE;if( goalResolved ){hint.to = resolvedGoal;+ hint.onObject = resolvedOnObject;}else if( pathSize > 0 && pathIndex >= 0 && pathIndex < pathSize ){@@ -5726,8 +5843,9 @@ void InGameUI::collectOrderHints( void )// waiting for its path has only the order's point to showObject *goalObj = ai->getGoalObject();Path *path = ai->getPath();+ hint.onObject = ( goalObj != NULL );if( goalObj )- hint.to = *goalObj->getPosition();+ hint.to = orderTargetSpot( goalObj );else if( path )hint.to = *path->getLastNode()->getPosition();else@@ -5834,7 +5952,7 @@ void InGameUI::bunchOrderHints( void )for( size_t i = 0; i < m_drawnOrderHints.size(); ++i ){OrderHint& bunch = m_drawnOrderHints[ i ];- if( bunch.kind != hint->kind || bunch.step != hint->step || bunch.icon != hint->icon )+ if( bunch.kind != hint->kind || bunch.step != hint->step || bunch.icon != hint->icon || bunch.mark != hint->mark )continue;const Real fromX = bunch.from.x - hint->from.x;const Real fromY = bunch.from.y - hint->from.y;@@ -5898,6 +6016,7 @@ void InGameUI::addQueuedOrderTail( OrderHint& hint, const OrderChain& chain, conBool InGameUI::getQueuedOrderHint( const QueuedOrder& order, OrderHint& hint ) const{hint.icon = NULL;+ hint.onObject = FALSE;switch( order.getType() ){@@ -6008,7 +6127,8 @@ Bool InGameUI::getQueuedOrderHint( const QueuedOrder& order, OrderHint& hint ) cif( target == NULL || target->isEffectivelyDead() || isHiddenByShroud( target ) )return FALSE;- hint.to = *target->getPosition();+ hint.to = orderTargetSpot( target );+ hint.onObject = TRUE;return TRUE;}diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex 7f78545cb..9800803a0 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -1015,11 +1015,9 @@ void W3DInGameUI::drawAttackCircle( void )} // end drawAttackCircle//--------------------------------------------------------------------------------------------------/** The thread is coloured by what it is for: anything that ends in a shot is red, an attack move- * is pink, a post to be held is blue, a building to be taken is gold, everything else is green.- * The marker on the end of it is the plain pointer in the same colour - one shape for every- * order, so the colour is the whole message. A dot and a ring were tried in its place and- * players wanted the pointer back. */+/** An order's colour: anything that ends in a shot is red, an attack move is pink, a post to be+ * held is blue, a building to be taken is gold, everything else is green. The line itself is+ * EA's rally line now; the colour is left on the guard circle and the step numbers. *///-------------------------------------------------------------------------------------------------static UnsignedInt orderHintLineColor( InGameUI::OrderHintKind kind ){@@ -1265,10 +1263,8 @@ void W3DInGameUI::drawOrderStep( const OrderHint& hint, const ICoord2D& tip, Uns}//--------------------------------------------------------------------------------------------------/** One faint line per bunch of selected units going the same way, from where they stand to where- * they are going, with the order's own cursor sitting on the destination. Green for a move, pink- * for an attack-move, red for an attack. The goals are read off the units every frame, so the- * lines last as long as the orders do and go when the units arrive or the selection changes. */+/** The screen-space part of the order hints: a guard's circle and the numbers of a shift list. The+ * goals are read off the units every frame, so both last as long as the orders do. *///-------------------------------------------------------------------------------------------------void W3DInGameUI::drawOrderHints( void ){@@ -1278,19 +1274,11 @@ void W3DInGameUI::drawOrderHints( void )const Real width = 1.0f;- // how far right of the spot an upgrade or an ability stands: past the pointer and the number of- // the step that ends there, both of which grow with the screen+ // how far right of the spot an upgrade or an ability stands: past the number of the step that+ // ends there, which grows with the screenconst Real IN_PLACE_MARKER_OFFSET = 44.0f;const Int inPlaceOffset = REAL_TO_INT( IN_PLACE_MARKER_OFFSET * orderStepScale() );- // A new marker slides up out of the bottom right and fades in over this long, so an order that- // has just been given announces itself instead of appearing fully formed. Wall clock rather- // than frames: the picture is uncapped, so a frame count would run at the frame rate.- const UnsignedInt MARKER_SLIDE_MS = 130;- const Real MARKER_SLIDE_PIXELS = 13.0f;-- const UnsignedInt nowMs = Clock_Milliseconds();-// a group on one guard order is one circle, not one per unit stacked into an opaque bandstd::vector<const OrderHint *> ringsDrawn;@@ -1310,63 +1298,22 @@ void W3DInGameUI::drawOrderHints( void )}}- const UnsignedInt ageMs = nowMs - it->bornMs;- Real arrival = 1.0f;- if( ageMs < MARKER_SLIDE_MS )- arrival = (Real)ageMs / (Real)MARKER_SLIDE_MS;-- // eased out, so it comes in fast and settles rather than sliding at one speed and stopping- const Real remaining = 1.0f - arrival;- const Real eased = 1.0f - remaining * remaining * remaining;-- // a unit off the edge of the screen still has a destination worth seeing, and the line to it- // says which way it went. WTS_OUTSIDE_FRUSTUM still gives usable pixels, so only points- // behind the camera are dropped- ICoord2D from, to;- if( TheTacticalView->worldToScreenTriReturn( &it->from, &from ) == View::WTS_INVALID )- continue;+ // The line, the joint and the flag are EA's rally point art in the 3D scene+ // (W3DWaypointBuffer::drawWaypoints and InGameUI::updateOrderFlags). What is left here is+ // the step number and the art of a step whose kind the line cannot tell apart from a move.+ // WTS_OUTSIDE_FRUSTUM still gives usable pixels, so only points behind the camera are dropped+ ICoord2D to;if( TheTacticalView->worldToScreenTriReturn( &it->to, &to ) == View::WTS_INVALID )continue;- // an upgrade or an ability is used on the spot the step before it ends on, whose marker is- // already there, so this one stands beside it rather than on top of it and draws no thread- const Bool inPlace = it->kind == ORDER_HINT_UPGRADE || it->kind == ORDER_HINT_ABILITY;- if( inPlace )+ // an upgrade or an ability is used on the spot the step before it ends on, whose number is+ // already there, so this one stands beside it rather than on top of it+ if( it->kind == ORDER_HINT_UPGRADE || it->kind == ORDER_HINT_ABILITY )to.x += inPlaceOffset;- // Order Lines off in the options takes the lines away and leaves the markers: where a unit is- // going is still worth a glance when the thread across the map is not- if( TheGlobalData->m_showOrderLines && !TheGlobalData->isClassicUI() && !inPlace )- TheDisplay->drawLine( from.x, from.y, to.x, to.y, width, lineColor );-- // the marker is the plain pointer, tinted: its white body takes the order colour and the- // dark outline stays. The hot spot is the pixel the player aims with, so that is the pixel- // that goes on the destination - a pointer hung by its top left corner points at the wrong- // ground- ICoord2D hotSpot;- const Image *image = orderCursorImage( Mouse::ARROW, &hotSpot );- if( image )- {- const Int w = image->getImageWidth();- const Int h = image->getImageHeight();- const Int slide = REAL_TO_INT_FLOOR( ( 1.0f - eased ) * MARKER_SLIDE_PIXELS );- const Int x = to.x - hotSpot.x + slide;- const Int y = to.y - hotSpot.y + slide;-- // the tint carries the fade as well as the order's colour- const UnsignedInt markerColor = ( orderHintMarkerColor( it->kind ) & 0x00FFFFFF )- | ( (UnsignedInt)REAL_TO_INT( 255.0f * eased ) << 24 );- TheDisplay->drawImage( image, x, y, x + w, y + h, markerColor );-- // a capture carries its cursor even alone: a lone one is the case that looked like a walk- if( it->step > 0 || it->icon || it->kind == ORDER_HINT_CAPTURE )- {- ICoord2D tip;- tip.x = to.x + slide;- tip.y = to.y + slide;- drawOrderStep( *it, tip, markerColor );- }- }+ // a capture carries its cursor even alone: a lone one is the case that looked like a walk+ if( it->step > 0 || it->icon || it->kind == ORDER_HINT_CAPTURE )+ drawOrderStep( *it, to, orderHintMarkerColor( it->kind ) );}} // end drawOrderHintsdiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cppindex e098bba59..8f3276a75 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp@@ -71,6 +71,7 @@#include "GameClient/InGameUI.h"#include "GameLogic/Object.h"+#include "GameLogic/TerrainLogic.h"#include "GameLogic/Module/AIUpdate.h"@@ -247,6 +248,43 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo)renderQueuedLines( localRinfo );}+ // Reforged draws every order the selection is on the way a building's rally point is drawn: this+ // line, the puck on each point short of the end and on any unit or building it is aimed at, and+ // the rally flag on the last bit of ground (a drawable of its own, InGameUI::updateOrderFlags).+ // The hints are rebuilt off the units every frame, so a puck on a target follows it.+ if( !TheGlobalData->isClassicUI() && !TheInGameUI->getOrderHints().empty() )+ {+ LightEnvironmentClass lightEnv;+ lightEnv.Reset(Vector3(0,0,0), Vector3(1.0f,1.0f,1.0f));+ lightEnv.Pre_Render_Update(rinfo.Camera.Get_Transform());+ RenderInfoClass localRinfo(rinfo.Camera);+ localRinfo.light_environment=&lightEnv;++ const std::vector<InGameUI::OrderHint>& hints = TheInGameUI->getOrderHints();+ for( std::vector<InGameUI::OrderHint>::const_iterator it = hints.begin(); it != hints.end(); ++it )+ {+ if( it->mark == InGameUI::ORDER_MARK_NONE )+ continue; // an upgrade or ability bought where the step before ends: no line, no point++ // an order's point can carry a zero height; nothing goes under the ground, and an aircraft+ // at either end keeps its own height+ Vector3 points[ 2 ];+ points[ 0 ].Set( it->from.x, it->from.y, max( it->from.z, TheTerrainLogic->getGroundHeight( it->from.x, it->from.y ) ) );+ points[ 1 ].Set( it->to.x, it->to.y, max( it->to.z, TheTerrainLogic->getGroundHeight( it->to.x, it->to.y ) ) );++ // Order Lines off in the options takes the lines away and leaves the points+ if( TheGlobalData->m_showOrderLines )+ queueLine( 2, points );++ if( it->mark == InGameUI::ORDER_MARK_JOINT )+ {+ m_waypointNodeRobj->Set_Position( points[ 1 ] );+ WW3D::Render( *m_waypointNodeRobj, localRinfo ); // the little hockey puck+ }+ }+ renderQueuedLines( localRinfo );+ }+// Rally points, drawn whenever we are not actively laying down waypoints. This used to be the// else of the block above, which is why turning that block on full time hid every rally line.if( !TheInGameUI->isInWaypointMode() )diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 5bf06a9b0..f18dc8740 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -13227,6 +13227,28 @@ TEST(build_plans_are_numbered_in_the_order_their_builder_takes_them)CHECK_EQ( plans[ 3 ].step, 3 );}+TEST(an_order_ends_in_a_flag_on_ground_and_a_joint_on_a_target)+{+ // the last ground point of a move, an attack move, a shot at the ground or a guarded spot: flag+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_MOVE, FALSE, TRUE ), (Int)InGameUI::ORDER_MARK_FLAG );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_ATTACK_MOVE, FALSE, TRUE ), (Int)InGameUI::ORDER_MARK_FLAG );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_ATTACK_GROUND, FALSE, TRUE ), (Int)InGameUI::ORDER_MARK_FLAG );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_GUARD, FALSE, TRUE ), (Int)InGameUI::ORDER_MARK_FLAG );++ // a unit or building it is sent at: the joint, never a flag+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_ATTACK, TRUE, TRUE ), (Int)InGameUI::ORDER_MARK_JOINT );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_ENTER, TRUE, TRUE ), (Int)InGameUI::ORDER_MARK_JOINT );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_CAPTURE, TRUE, TRUE ), (Int)InGameUI::ORDER_MARK_JOINT );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_GUARD, TRUE, TRUE ), (Int)InGameUI::ORDER_MARK_JOINT );++ // a shift list's points short of the last: joints+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_MOVE, FALSE, FALSE ), (Int)InGameUI::ORDER_MARK_JOINT );++ // an upgrade or ability bought where the step before ends draws nothing of its own+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_UPGRADE, FALSE, TRUE ), (Int)InGameUI::ORDER_MARK_NONE );+ CHECK_EQ( (Int)InGameUI::markForOrderHint( InGameUI::ORDER_HINT_ABILITY, FALSE, FALSE ), (Int)InGameUI::ORDER_MARK_NONE );+}+TEST(empty_building_slots_are_a_check_box_that_starts_on){const OptionDef *def = findOptionDef( "EmptyBuildingPips" );