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
fix(gameclient): bunch order threads and restore the pointer marker
Olcay Seygan1f280dc76ac1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cccbff4a3..fdf0ef328 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -137,7 +137,7 @@ found and fixed — EA's own, not port damage.**- A box dragged over your army and your economy together takes the army. The dozers, workers, supply trucks and hackers standing among the tanks stay where they are, and ambulances and troop carriers go with the soldiers they look after. A box with nobody military in it takes the workers the way it always did. Legacy keeps the old box.- 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 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. The left button, because that is what attack move is aimed with; with F armed a right drag draws nothing. 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, with a marker on the spot. A group sent to one spot draws each unit's thread to the ground that unit will actually stand on, where every line used to run into the same point. 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. A move wears a dot and anything that shoots wears a ring, so the shape tells them apart for somebody who cannot tell the red from the green. The marker sits on the middle of the spot and grows with your screen; it used to be a tinted copy of the mouse pointer, hung off to one side of the destination and covering whatever stood beside it. 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 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.- 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 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.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex 20a32eb13..8298fbc92 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -446,7 +446,7 @@ public: // ********************************************************************ObjectID owner; ///< the selected unit this one belongs toUnsignedInt bornMs; ///< when the marker first appeared, so it can be slid in};- const std::vector<OrderHint>& getOrderHints( void ) const { return m_orderHints; }+ const std::vector<OrderHint>& getOrderHints( void ) const { return m_drawnOrderHints; }// Where each ally's mouse is pointing. A network game only: the position arrives about ten// times a second on a side channel of its own, carries nothing the simulation reads, and is@@ -1055,7 +1055,8 @@ protected:Bool m_isFormationDragging; ///< TRUE while a formation line is being drawn (fork)std::vector<ICoord2D> m_formationDragPoints; ///< the traced curve, in pixels, first point is where it startedInt m_formationDragSpacing; ///< pixels a new point has to earn, doubled each time the curve fills up- std::vector<OrderHint> m_orderHints; ///< who is going where, for drawing+ std::vector<OrderHint> m_orderHints; ///< who is going where, one per unit and queued point+ std::vector<OrderHint> m_drawnOrderHints; ///< the same, units headed the same way bunched into oneAllyCursor m_allyCursors[ MAX_PLAYER_COUNT ]; ///< where every ally's mouse was last seen (fork)UnsignedInt m_allyCursorSentMs; ///< wall clock of the last position this machine sent@@ -1082,6 +1083,8 @@ protected:void updateFormationHints( void ); ///< recompute who goes where from the curve being drawnvoid updateOrderHints( void ); ///< read the selection's own goals, once a frame+ void collectOrderHints( void ); ///< one hint per selected unit and queued point+ void bunchOrderHints( void ); ///< merge the hints of units going the same wayvoid updateShiftAttackQueue( void ); ///< send the next queued attack once the current one is overvoid addOrderHint( OrderHint& hint, const std::vector<OrderHint>& previous ); ///< keep a marker's age across the frame the list is rebuilt onBool getHeldAircraftOrder( const Object *obj, OrderHintKind& kind, Coord3D& to ) const; ///< the order an aircraft is sitting on until it is airbornediff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 9b85a0ca2..8dbb5bdda 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -3684,12 +3684,23 @@ static Bool getGuardedSpot( const AIUpdateInterface *ai, Coord3D& spot )//-------------------------------------------------------------------------------------------------void InGameUI::updateOrderHints( void ){+ // a formation line being drawn shows every unit's own station, which is the whole point of itif( m_isFormationDragging ){updateFormationHints();+ m_drawnOrderHints = m_orderHints;return;}+ collectOrderHints();+ bunchOrderHints();+}++//-------------------------------------------------------------------------------------------------+/** One hint per selected unit, and one more per queued point it still owes. */+//-------------------------------------------------------------------------------------------------+void InGameUI::collectOrderHints( void )+{// last frame's markers, kept only so this frame's can inherit their age (see addOrderHint)std::vector<OrderHint> previous;previous.swap( m_orderHints );@@ -3702,6 +3713,11 @@ void InGameUI::updateOrderHints( void )if( !obj || obj->getControllingPlayer() != local )continue;+ // an angry mob's members each chase a spot round the nexus, which holds the real order, so+ // only the nexus draws: one line for the mob rather than one per rioter+ if( obj->isKindOf( KINDOF_IGNORED_IN_GUI ) )+ continue;+AIUpdateInterface *ai = obj->getAIUpdateInterface();if( ai == NULL )continue;@@ -3730,7 +3746,17 @@ void InGameUI::updateOrderHints( void )hint.kind = ORDER_HINT_WAYPOINT;break;+ // An attack move and a shot at the ground both end on the point that was clicked, which the+ // order keeps as its goal position. The end of the unit's path is somewhere else: a free+ // cell next to it for a mover, the centre of a cell in range for a gun. The attack move's+ // path is also thrown away every time the unit stops to fight, so reading the path left the+ // thread pointing at whatever the fight was aboutcase AI_ATTACK_MOVE_TO:+ hint.kind = ORDER_HINT_ATTACK_MOVE;+ resolvedGoal = *ai->getGoalPosition();+ goalResolved = TRUE;+ break;+case AI_ATTACKFOLLOW_WAYPOINT_PATH_AS_INDIVIDUALS:case AI_ATTACKFOLLOW_WAYPOINT_PATH_AS_TEAM:case AI_HUNT:@@ -3748,6 +3774,11 @@ void InGameUI::updateOrderHints( void )break;case AI_ATTACK_POSITION:+ hint.kind = ORDER_HINT_ATTACK_GROUND;+ resolvedGoal = *ai->getGoalPosition();+ goalResolved = TRUE;+ break;+case AI_ATTACK_AREA:hint.kind = ORDER_HINT_ATTACK_GROUND;break;@@ -3904,6 +3935,64 @@ void InGameUI::updateOrderHints( void )}}+//-------------------------------------------------------------------------------------------------+/** Units on the same kind of order that stand together and are headed to the same place draw one+ * thread between them, from their average position to their average destination. Twenty tanks+ * sent across the map were twenty threads laid almost on top of each other; a selection spread+ * over the map still draws one thread per knot of units, so a flank sent separately stays+ * visible. */+//-------------------------------------------------------------------------------------------------+void InGameUI::bunchOrderHints( void )+{+ // about ten pathfinding cells: a knot of four or five tanks, or a flood of destinations round+ // one click+ const Real BUNCH_RADIUS = 100.0f;+ const Real bunchRadiusSqr = BUNCH_RADIUS * BUNCH_RADIUS;++ m_drawnOrderHints.clear();+ std::vector<Int> memberCounts;++ for( std::vector<OrderHint>::const_iterator hint = m_orderHints.begin();+ hint != m_orderHints.end(); ++hint )+ {+ Bool joined = FALSE;+ for( size_t i = 0; i < m_drawnOrderHints.size(); ++i )+ {+ OrderHint& bunch = m_drawnOrderHints[ i ];+ if( bunch.kind != hint->kind )+ continue;+ const Real fromX = bunch.from.x - hint->from.x;+ const Real fromY = bunch.from.y - hint->from.y;+ if( fromX * fromX + fromY * fromY > bunchRadiusSqr )+ continue;+ const Real toX = bunch.to.x - hint->to.x;+ const Real toY = bunch.to.y - hint->to.y;+ if( toX * toX + toY * toY > bunchRadiusSqr )+ continue;++ // running averages, so the bunch is compared against its middle rather than its first unit+ const Real share = 1.0f / (Real)( ++memberCounts[ i ] );+ bunch.from.x += ( hint->from.x - bunch.from.x ) * share;+ bunch.from.y += ( hint->from.y - bunch.from.y ) * share;+ bunch.from.z += ( hint->from.z - bunch.from.z ) * share;+ bunch.to.x += ( hint->to.x - bunch.to.x ) * share;+ bunch.to.y += ( hint->to.y - bunch.to.y ) * share;+ bunch.to.z += ( hint->to.z - bunch.to.z ) * share;++ // the oldest member's age, so a unit joining a standing order does not slide the marker in again+ bunch.bornMs = min( bunch.bornMs, hint->bornMs );+ joined = TRUE;+ break;+ }++ if( !joined )+ {+ m_drawnOrderHints.push_back( *hint );+ memberCounts.push_back( 1 );+ }+ }+}+//-------------------------------------------------------------------------------------------------/** Every target still owed, one thread from the last point to the next, starting wherever the hint* handed in leaves off. */diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex 71728457b..ada84a51c 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -929,9 +929,9 @@ void W3DInGameUI::drawAttackCircle( void )//-------------------------------------------------------------------------------------------------/** 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, everything else is green. The marker on the end of it is a- * dot in the same colour, and an order that ends in a shot wears a ring instead, so the shape- * still says which is which to somebody who cannot tell the red from the green. */+ * is pink, a post to be held is blue, 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. *///-------------------------------------------------------------------------------------------------static UnsignedInt orderHintLineColor( InGameUI::OrderHintKind kind ){@@ -955,97 +955,141 @@ static UnsignedInt orderHintMarkerColor( InGameUI::OrderHintKind kind )return orderHintLineColor( kind ) | 0xFF000000;}-static Bool orderHintEndsInAShot( InGameUI::OrderHintKind kind )+struct OrderCursorArt{- return kind == InGameUI::ORDER_HINT_ATTACK || kind == InGameUI::ORDER_HINT_FORCE_ATTACK ||- kind == InGameUI::ORDER_HINT_ATTACK_GROUND;-}--static Real edgeCoverage( Real edge )-{- return edge < 0.0f ? 0.0f : ( edge > 1.0f ? 1.0f : edge );-}+ const Image *image;+ ICoord2D hotSpot;+ Bool tried;+};+static OrderCursorArt s_orderCursorArt[ Mouse::NUM_MOUSE_CURSORS ];//--------------------------------------------------------------------------------------------------/** A marker is drawn once into a texture several times the size it is shown at, so the shrink on- * the way to the screen leaves a soft edge at any resolution. The body is near white and takes- * the order's colour from the tint; the outline is near black and stays dark on any ground. */+/** Turn one Windows cursor into something the 2D renderer can draw. Mouse.ini's Image entries+ * name mapped images that do not exist in the shipped data, and the Texture entries name .ANI+ * files rather than textures - so the art the player is actually holding only exists as an HCURSOR.+ * Pull the first frame's bits out of it and keep them as a texture. *///--------------------------------------------------------------------------------------------------static const Image *buildOrderMarkerImage( Bool ring )+static const Image *loadOrderCursorImage( Mouse::MouseCursor cursor, ICoord2D *hotSpot ){- const Int size = 64;- const Real centre = size * 0.5f;- const Real outer = size * 0.47f; // outside edge of the outline- const Real body = outer * 0.72f; // where the outline gives way to the body- const Real hole = outer * 0.38f; // inside edge of a ring's inner outline- const Real holeBody = hole + ( outer - body ); // where that inner outline gives way to the body- const Real OUTLINE_GREY = 24.0f;- const Real BODY_GREY = 245.0f;-- TextureClass *texture = MSGNEW("TextureClass") TextureClass( size, size, WW3D_FORMAT_A8R8G8B8, MIP_LEVELS_1 );- SurfaceClass *surface = texture->Get_Surface_Level();- Int pitch;- UnsignedByte *bits = (UnsignedByte *)surface->Lock( &pitch );- for( Int y = 0; y < size; ++y )+ const AsciiString& name = TheMouse->m_cursorInfo[ cursor ].textureName;+ if( name.isEmpty() )+ return NULL;++ char path[ 256 ];+ snprintf( path, ARRAY_SIZE(path), "data\\cursors\\%s.ANI", name.str() );++ HCURSOR hcursor = LoadCursorFromFile( path );+ if( hcursor == NULL )+ return NULL;++ ICONINFO info;+ if( GetIconInfo( hcursor, &info ) == FALSE )+ return NULL;++ const Image *result = NULL;++ BITMAP bm;+ if( info.hbmColor && GetObject( info.hbmColor, sizeof( BITMAP ), &bm ) ){- UnsignedInt *pixel = (UnsignedInt *)( bits + y * pitch );- for( Int x = 0; x < size; ++x )- {- const Real dx = x + 0.5f - centre;- const Real dy = y + 0.5f - centre;- const Real distance = (Real)sqrt( dx * dx + dy * dy );- Real alpha = edgeCoverage( outer + 0.5f - distance );- Real light = edgeCoverage( body + 0.5f - distance );- if( ring )+ const Int w = bm.bmWidth;+ const Int h = bm.bmHeight;++ BITMAPINFO bi;+ memset( &bi, 0, sizeof( bi ) );+ bi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );+ bi.bmiHeader.biWidth = w;+ bi.bmiHeader.biHeight = -h; // negative means top down, which is the order a texture wants+ bi.bmiHeader.biPlanes = 1;+ bi.bmiHeader.biBitCount = 32;+ bi.bmiHeader.biCompression = BI_RGB;++ UnsignedInt *color = NEW UnsignedInt[ w * h ];+ UnsignedInt *mask = NEW UnsignedInt[ w * h ];++ HDC dc = GetDC( NULL );+ GetDIBits( dc, info.hbmColor, 0, h, color, &bi, DIB_RGB_COLORS );+ GetDIBits( dc, info.hbmMask, 0, h, mask, &bi, DIB_RGB_COLORS );+ ReleaseDC( NULL, dc );++ //+ // a 32-bit cursor carries its own alpha; an older one leaves it zero and says what is+ // transparent in the AND mask instead, where a white pixel is a hole+ //+ Bool hasAlpha = FALSE;+ for( Int i = 0; i < w * h; ++i )+ if( color[ i ] & 0xFF000000 ){- alpha *= edgeCoverage( distance - ( hole - 0.5f ) );- light *= edgeCoverage( distance - ( holeBody - 0.5f ) );+ hasAlpha = TRUE;+ break;}- const UnsignedInt grey = (UnsignedInt)REAL_TO_INT( OUTLINE_GREY + light * ( BODY_GREY - OUTLINE_GREY ) );- const UnsignedInt opacity = (UnsignedInt)REAL_TO_INT( alpha * 255.0f );- pixel[ x ] = ( opacity << 24 ) | ( grey << 16 ) | ( grey << 8 ) | grey;- }++ if( hasAlpha == FALSE )+ for( Int i = 0; i < w * h; ++i )+ color[ i ] |= (mask[ i ] & 0x00FFFFFF) ? 0x00000000 : 0xFF000000;++ TextureClass *texture = MSGNEW("TextureClass") TextureClass( w, h, WW3D_FORMAT_A8R8G8B8, MIP_LEVELS_1 );+ SurfaceClass *surface = texture->Get_Surface_Level();+ Int pitch;+ UnsignedByte *bits = (UnsignedByte *)surface->Lock( &pitch );+ for( Int row = 0; row < h; ++row )+ memcpy( bits + row * pitch, color + row * w, w * sizeof( UnsignedInt ) );+ surface->Unlock();+ REF_PTR_RELEASE( surface );++ delete [] color;+ delete [] mask;++ Image *image = newInstance(Image);+ Region2D uv;+ uv.lo.x = 0.0f;+ uv.lo.y = 0.0f;+ uv.hi.x = 1.0f;+ uv.hi.y = 1.0f;+ image->setStatus( IMAGE_STATUS_RAW_TEXTURE );+ image->setRawTextureData( texture );+ image->setUV( &uv );+ image->setTextureWidth( w );+ image->setTextureHeight( h );+ ICoord2D size;+ size.x = w;+ size.y = h;+ image->setImageSize( &size );++ hotSpot->x = info.xHotspot;+ hotSpot->y = info.yHotspot;+ result = image;}- surface->Unlock();- REF_PTR_RELEASE( surface );-- Image *image = newInstance(Image);- Region2D uv;- uv.lo.x = 0.0f;- uv.lo.y = 0.0f;- uv.hi.x = 1.0f;- uv.hi.y = 1.0f;- image->setStatus( IMAGE_STATUS_RAW_TEXTURE );- image->setRawTextureData( texture );- image->setUV( &uv );- image->setTextureWidth( size );- image->setTextureHeight( size );- ICoord2D dimensions;- dimensions.x = size;- dimensions.y = size;- image->setImageSize( &dimensions );- return image;++ if( info.hbmColor )+ DeleteObject( info.hbmColor );+ if( info.hbmMask )+ DeleteObject( info.hbmMask );++ return result;}//--------------------------------------------------------------------------------------------------/** The dot for anything that goes somewhere, the ring for anything that ends in a shot. Built the- * first time each is drawn. */+/** The marker on a destination is the cursor the player would be holding if they were pointing at+ * it. Built once. *///--------------------------------------------------------------------------------------------------static const Image *orderMarkerImage( Bool ring )+static const Image *orderCursorImage( Mouse::MouseCursor cursor, ICoord2D *hotSpot ){- static const Image *s_dot = NULL;- static const Image *s_ring = NULL;- const Image *&image = ring ? s_ring : s_dot;- if( image == NULL )- image = buildOrderMarkerImage( ring );- return image;+ OrderCursorArt& art = s_orderCursorArt[ cursor ];+ if( art.tried == FALSE )+ {+ art.image = loadOrderCursorImage( cursor, &art.hotSpot );+ art.tried = TRUE;+ }++ *hotSpot = art.hotSpot;+ return art.image;}//--------------------------------------------------------------------------------------------------/** One faint line per selected unit, from where it stands to where it is going, with the order's- * marker 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. */+/** 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. *///-------------------------------------------------------------------------------------------------void W3DInGameUI::drawOrderHints( void ){@@ -1059,9 +1103,7 @@ void W3DInGameUI::drawOrderHints( void )// 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 = 8.0f; // at 800x600, like the diameter- const Real MARKER_DIAMETER = 11.0f;- const Real uiScale = TheUIScale();+ const Real MARKER_SLIDE_PIXELS = 13.0f;const UnsignedInt nowMs = timeGetTime();@@ -1092,16 +1134,19 @@ void W3DInGameUI::drawOrderHints( void )if( TheGlobalData->m_showOrderLines )TheDisplay->drawLine( from.x, from.y, to.x, to.y, width, lineColor );- // the marker sits centred on the destination, and grows with the screen the way a health bar- // does- const Image *image = orderMarkerImage( orderHintEndsInAShot( it->kind ) );+ // 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 = REAL_TO_INT( MARKER_DIAMETER * uiScale );- const Int h = w;- const Int slide = REAL_TO_INT_FLOOR( ( 1.0f - eased ) * MARKER_SLIDE_PIXELS * uiScale );- const Int x = to.x - w / 2 + slide;- const Int y = to.y - h / 2 + slide;+ 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 colourconst UnsignedInt markerColor = ( orderHintMarkerColor( it->kind ) & 0x00FFFFFF )