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): broadcast score bar and pane labels on director record
Olcay Seygan7b0b3e5fe3e1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9e5f5caf5..afd5970d0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -748,7 +748,7 @@ A third pass went through the generals' powers, promotions and unit abilities.- Watching, the bars over the buildings are everyone's too - what each factory is turning out, and how long the superweapons have left. An observer used to see none of it.- Watching, the camera can drive itself. Two drop-downs in the camera panel on the right, above the board, say who has it and which player you follow, and you can follow nobody. The Director goes to the fight with the most on the line over the last five seconds, where a dead Overlord counts for more than six riflemen being shot at and anything happening to a superweapon counts three times over. It stays with that fight twelve seconds, leaves after six only for one four times the size, and after half a minute on the same fight a third bigger is enough. So a 4v4 is watched like a broadcast rather than hunted for, and it does not hop between spots every few seconds. Any general's power used on the map outranks every fight. A nuke is shown in its silo as it leaves, then the camera waits at the target for it to come down and stays through the blast. The particle cannon's beam is followed along its whole sweep, and a Scud Storm or a carpet bomb is watched until the last explosion has died down. Then it goes back to the fighting. The camera glides between places and slows into each one, and only cuts when the next one is across most of the map. When nobody is shooting it no longer parks on empty ground: it goes round what is worth seeing, an army on the march, a superweapon, a base going up, the rest of a base, the dearest first and fourteen seconds each, and does not come back to one of the last three while there is anything else to show. With a player picked it keeps to his fights and his own armies and buildings. Player camera shows his screen: a human player's camera comes over the network five times a second, smoothed in between, and a computer player, who has no camera, gets the Director narrowed to his own fights. Scroll with the keys or a drag, turn the view or click the radar and the camera is yours again, still following the same player. The edge of the screen does not scroll while it drives: the panel on the right stands on that edge, and reaching for it used to hand the camera back to you, so the Director stopped following the fighting the first time you went to change a setting. In a replay with the recorded camera switched on in the options, the player you follow still drives the camera the way his button in the old list did.- Watching, the Director climbs over a wide battle until the whole of it is on the screen, and comes back down to your own height when it moves on or you take the camera. The mouse wheel still zooms while it drives, and it keeps what you chose. It stops short of the map's border too, where a fight on the edge used to come with a black corner of nothing beside it. A nuke or a Scud Storm is shown leaving its silo even when the Director has only just arrived at another fight; before, the launch was over by the time it was allowed to move. Rewinding a replay leaves your camera settings as they were, where a rewind used to hand you back a free camera with nobody followed. And following one player while a superweapon wiped out everything he had at the spot could close the game. It no longer does.-- Watching can be filmed. Start the game with `-directorrecord` and the Director has the camera from the first second, with nothing over the picture but the radar, and the whole match goes into one video; the game closes itself when the match is decided or the replay runs out. Beside `-replay` it turns an old match into footage, and beside four computer players it films a match nobody played. It plays the match twice. The first time there is no picture and the game runs as fast as the machine goes, 8,000 frames of a four-player match in 17 seconds, writing down where each fight starts and when each superweapon fires; the second time it films, and the camera is already at a fight four seconds before the first shot instead of arriving halfway through it. When two fights are about to start far apart the screen splits before either begins, and a skirmish the first run saw come to nothing is not cut to. The two runs compare the whole state of the game every 30 seconds, and if they ever disagree the rest is filmed the old way, finding fights as they happen. A skirmish without `-seed` is handed one, the same for both runs. The film opens on every player at once: the screen cut into one picture per player along lines at 45 degrees that meet round the radar, two players on a diagonal and four on an X, each picture on that player's base. Seven seconds in they sweep away to the Director's single view. When two real fights far apart are both worth watching, the radar slides out of its corner, then the second fight sweeps in from the corner along a 45 degree diagonal, carrying the radar in a frame of the same line to the middle, one fight on each side with its own camera gliding to it. Going back is the same film run backwards: the second fight sweeps out with the radar, and the radar slides back into its corner. The lines are the Reforged gold on a dark edge, so they read on snow and at night, and they run straight into the radar's frame. While the screen is cut, each picture frames its own fight: the camera puts it in the biggest round space its slice has clear of the lines and the radar, and rises until the whole fight fits there with room to spare, never lower than the Director flies and never more than three times as high. A fight that spreads is let out smoothly; one that shrinks does not make the picture pump in and out. The opening frames each player's base the same way. A split holds at least six seconds and ends once the second fight has burnt down to a quarter of the first, so the picture does not flicker between one and two. Only the video shows the other pictures; the window keeps the Director's own fight under the lines. Two bases going up are not a fight, and the split ends the moment the camera's own fight and the second one turn out to be the same. The pictures go straight into ffmpeg as they are drawn, so an hour of 1080p does not need tens of gigabytes of disk first; put ffmpeg beside the game or on your PATH, because without it nothing is recorded and the game says so and closes. Any recorded clip also plays its animations at their real speed now. The animation clock used to move by however long each picture took to save, and a slow disk made every explosion in the footage run fast.+- Watching can be filmed. Start the game with `-directorrecord` and the Director has the camera from the first second, with nothing over the picture but the radar, and the whole match goes into one video; the game closes itself when the match is decided or the replay runs out. Beside `-replay` it turns an old match into footage, and beside four computer players it films a match nobody played. It plays the match twice. The first time there is no picture and the game runs as fast as the machine goes, 8,000 frames of a four-player match in 17 seconds, writing down where each fight starts and when each superweapon fires; the second time it films, and the camera is already at a fight four seconds before the first shot instead of arriving halfway through it. When two fights are about to start far apart the screen splits before either begins, and a skirmish the first run saw come to nothing is not cut to. The two runs compare the whole state of the game every 30 seconds, and if they ever disagree the rest is filmed the old way, finding fights as they happen. A skirmish without `-seed` is handed one, the same for both runs. The film opens on every player at once: the screen cut into one picture per player along lines at 45 degrees that meet round the radar, two players on a diagonal and four on an X, each picture on that player's base. Seven seconds in they sweep away to the Director's single view. When two real fights far apart are both worth watching, the radar slides out of its corner, then the second fight sweeps in from the corner along a 45 degree diagonal, carrying the radar in a frame of the same line to the middle, one fight on each side with its own camera gliding to it. Going back is the same film run backwards: the second fight sweeps out with the radar, and the radar slides back into its corner. The lines are the Reforged gold on a dark edge, so they read on snow and at night, and they run straight into the radar's frame. While the screen is cut, each picture frames its own fight: the camera puts it in the biggest round space its slice has clear of the lines and the radar, and rises until the whole fight fits there with room to spare, never lower than the Director flies and never more than three times as high. A fight that spreads is let out smoothly; one that shrinks does not make the picture pump in and out. The opening frames each player's base the same way. A split holds at least six seconds and ends once the second fight has burnt down to a quarter of the first, so the picture does not flicker between one and two. Only the video shows the other pictures; the window keeps the Director's own fight under the lines. Two bases going up are not a fight, and the split ends the moment the camera's own fight and the second one turn out to be the same. The pictures go straight into ffmpeg as they are drawn, so an hour of 1080p does not need tens of gigabytes of disk first; put ffmpeg beside the game or on your PATH, because without it nothing is recorded and the game says so and closes. The film carries a score bar across the top in the Reforged colours: every player's name in his own colour, his general, his cash and what his army cost, the match clock in the middle, and under it one bar the two sides' armies pull on, each player's share in his colour and a gold mark at the middle, so whoever is past it is ahead. Each picture of the opening names its player, and each half of a split names the players in its fight, in a plate inside its own slice clear of the lines and the radar. It is sized from the screen's height and reads the same at 720p and 1080p, and the pictures under it are framed below it, so no base or fight sits behind the bar. Any recorded clip also plays its animations at their real speed now. The animation clock used to move by however long each picture took to save, and a slow disk made every explosion in the footage run fast.- Watching, tick Fog of war under the camera and you see what the player you follow sees and nothing more: black where he has never been, grey where he has been, none of the enemy he cannot see, and an enemy base as he last saw it. Stealth goes by his eyes too: a Jarmen Kell he has not found is gone from the screen and the radar, and his own stealthed units show the way they show him. It stays on whoever drives the camera, until you switch it off or follow nobody. Switch to another player and his fog comes in whole, shadows included: a building he has never seen casts nothing on his grey ground. An observer used to have no fog at all: the whole map, all match, with no way to see the game the way one of its players was seeing it.- An ally, and anyone watching, now sees a stealthed unit's muzzle flash, its promotion and the cash it earns - if they can see the unit at all. Those three asked 'is it mine' instead of 'can I see it', so allies and observers got nothing.- Watching, the match opens on the middle of the map. An observer has no start position, so the game looked for the camera waypoint of "player zero", did not find it, and fell back to the corner of the map: every match watched from the stands began pointed at empty ground in the south west.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex 381655ac4..5eb2e8271 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -1100,6 +1100,10 @@ public: // ********************************************************************virtual void preDraw( void ); ///< Logic which needs to occur before the UI rendersvirtual void draw( void ) = 0; ///< Render the in-game user interfacevirtual void postDraw( void ); ///< Logic which needs to occur after the UI renders+ /// -directorrecord's broadcast over the director's picture: a score bar along the top with every+ /// player's name, side, cash and army and the match clock, the armies' tug of war under it, and a+ /// label in each pane. Pane 0's draw alone; the recording takes these pixels from it+ void drawDirectorBroadcast( void );//// One cameo of the global production strip: which producer it belongs to, which entry of that@@ -1755,6 +1759,10 @@ protected:DisplayString * m_hudDisplayString; ///< the ShowHudOverlay line (fps / clock)HtmlValues m_hudValues; ///< that line's readings one by one, for Window/Html/Net.htmlDisplayString * m_peaceTimeDisplayString; ///< the peace time clock at the top of the screen+ /// the broadcast's string for what key names, in font at points, holding text: one string per+ /// thing written, so a text is laid out again only when it changes+ DisplayString *broadcastText( const std::string &key, const UnicodeString &text, const char *font, Int points, Bool bold );+ std::map< std::string, DisplayString * > m_broadcastTexts;DisplayString * m_peaceTimeLabelDisplayString; ///< the word written over that clockDisplayString * m_peaceCountdownDisplayString; ///< the big digit of its last ten secondsInt m_lastMoneyDisplayed; ///< so the money gadget is only written when the amount changesdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.hindex 31d5d35ca..f62c4a692 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h@@ -202,10 +202,15 @@ Real ObserverCamera_paneExit( const Real *rays, Int count, Int width, Int heightCoord2D ObserverCamera_paneExitDirection( const Real *rays );/// the largest circle that fits in each pane with the rays meeting in the middle of the picture, kept/// off the screen's edges, the rays and the radar's frame, a rectangle radarHalf wide and high each-/// way from the middle. Its centre is where the pane's subject is put and its radius, in pixels,-/// what the subject is fitted into; centres and radii have count entries-void ObserverCamera_paneCircles( const Real *rays, Int count, Int width, Int height, const Coord2D &radarHalf,+/// way from the middle, and below the top rows the broadcast's score bar takes. Its centre is where+/// the pane's subject is put and its radius, in pixels, what the subject is fitted into; centres and+/// radii have count entries+void ObserverCamera_paneCircles( const Real *rays, Int count, Int width, Int height, const Coord2D &radarHalf, Real top,Coord2D *centres, Real *radii );+/// the top row of a label width by height pixels centred across a pane's circle as high as the circle+/// holds all of it, so it stays inside the pane and clear of its lines; the circle's middle row when+/// it is too wide for that+Real ObserverCamera_paneLabelTop( const Coord2D ¢re, Real radius, Real width, Real height );/// how far from around the farthest of the things within reach of it lie, on the ground, and never less/// than leastReal ObserverCamera_extentAround( const std::vector< DirectorHeat > &things, const Coord2D &around, Real reach, Real least );@@ -283,6 +288,20 @@ public:/// the framed radar's rectangle as it was drawn, frame included: the recording takes it from pane 0void setRadarFrame( const IRegion2D &frame ) { m_radarFrame = frame; }const IRegion2D &getRadarFrame( void ) const { return m_radarFrame; }+ /// the broadcast drawn over pane 0, its score bar and its labels: the recording takes these+ /// rectangles from pane 0 whichever pane they lie over. Cleared at the start of each of its draws+ void clearBroadcast( void ) { m_broadcast.clear(); }+ void addBroadcast( const IRegion2D ®ion ) { m_broadcast.push_back( region ); }+ Bool isBroadcast( Int x, Int y ) const;+ /// the rows the score bar takes at the top of the picture, which every pane's circle stays below+ void setBroadcastTop( Real rows ) { m_broadcastTop = rows; }+ /// a pane's circle where it is drawn this frame, slid with the rays' meeting point+ void getPaneCircle( Int pane, Coord2D *centre, Real *radius ) const;+ /// how far in the panes are, 0 to 1+ Real getPaneProgress( void ) const { return m_paneProgress; }+ /// who a pane shows: the opening's player, or everybody dealing or taking hits in the fight it+ /// shows; 0 when nobody is+ PlayerMaskType getPaneSides( Int pane ) const;Bool isDrawingSecond( void ) const { return m_drawingPane != 0; }Int getDrawingPane( void ) const { return m_drawingPane; }/// the view moved to a pane's camera for one draw, and put back after it@@ -374,6 +393,9 @@ private:UnsignedInt m_nextEventId;std::vector< DirectorHeat > m_fights; ///< the last scan's hits one player dealt another he is at war with; the split counts only these+ std::vector< PlayerMaskType > m_fightSides; ///< and the two players each of them was between+ std::vector< IRegion2D > m_broadcast; ///< the rectangles the broadcast drew over pane 0 this frame+ Real m_broadcastTop; ///< the rows the score bar tookBool m_split; ///< -directorrecord wants two fights side by sideUnsignedInt m_splitChanged; ///< the logic frame the split last went on or offCoord2D m_secondPlace; ///< the second fight, shown in the second panediff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex d4b096354..ddfda2f47 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -1433,6 +1433,9 @@ InGameUI::~InGameUI()for( size_t key = 0; key < m_quitMenuKeyOverlays.size(); key++ )delete m_quitMenuKeyOverlays[ key ];m_quitMenuKeyOverlays.clear();+ for( std::map< std::string, DisplayString * >::iterator text = m_broadcastTexts.begin(); text != m_broadcastTexts.end(); ++text )+ TheDisplayStringManager->freeDisplayString( text->second );+ m_broadcastTexts.clear();for( Int grid = 0; grid < CELL_GRID_COUNT; grid++ ){delete m_cellFrontOverlay[ grid ];@@ -2110,19 +2113,18 @@ static void addObjectStats( Object *obj, void *userData )}//--------------------------------------------------------------------------------------------------/** Everyone still in the match with his numbers, ranked by `stat`. Allies both ways share a team- * number, counted in the order the teams first appear in the player list. */+/** Everyone still in the match but leftOut with his numbers, ranked by `stat`. Allies both ways share+ * a team number, counted in the order the teams first appear in the player list. *///--------------------------------------------------------------------------------------------------static std::vector< SpectatorStats > gatherSpectatorStats( const SpectatorStat &stat )+static std::vector< SpectatorStats > gatherSpectatorStats( const SpectatorStat &stat, const Player *leftOut ){std::vector< SpectatorStats > players;- const Player *local = ThePlayerList->getLocalPlayer();const UnsignedInt frame = TheGameLogic->getFrame();Int teams = 0;for( Int index = 0; index < ThePlayerList->getPlayerCount(); index++ ){Player *player = ThePlayerList->getNthPlayer( index );- if( player == NULL || player == local || !player->isPlayerActive() || !player->isPlayableSide() )+ if( player == NULL || player == leftOut || !player->isPlayerActive() || !player->isPlayableSide() )continue;ScoreKeeper *score = player->getScoreKeeper();@@ -2656,7 +2658,7 @@ void InGameUI::drawSpectatorPage( void )|| frame < m_spectatorListsFrame || frame >= m_spectatorListsFrame + NET_WORTH_REFRESH_FRAMES ){const SpectatorStat &stat = spectatorStat( m_spectatorPicked );- const std::vector< SpectatorStats > players = gatherSpectatorStats( stat );+ const std::vector< SpectatorStats > players = gatherSpectatorStats( stat, ThePlayerList->getLocalPlayer() );fillSpectatorPlayers( players, stat, m_spectatorLists[ "players" ] );fillSpectatorArmies( players, m_spectatorLists[ "army" ] );fillSpectatorFollows( players, m_spectatorLists[ "follows" ] );@@ -10522,6 +10524,317 @@ void InGameUI::drawPeaceCountdown( UnsignedInt framesLeft )peaceTimeColor( alpha ), GameMakeColor( 0, 0, 0, alpha ) );}+// -directorrecord's broadcast is drawn in zerohour.gg's colours (website/resources/css/app.css,+// docs/reference/BRAND.md): the ground at the site's veil, its panel, ink, muted text, the line and+// the gold the pane lines are drawn in. The site sets words in Chivo and numbers in JetBrains Mono;+// Windows has neither, and these are the site's own fallbacks for the two+static const Color BROADCAST_GROUND = GameMakeColor( 0x0c, 0x12, 0x20, 224 );+static const Color BROADCAST_PANEL = GameMakeColor( 0x12, 0x1a, 0x2b, 255 );+static const Color BROADCAST_LINE = GameMakeColor( 0x1f, 0x29, 0x40, 255 );+static const Color BROADCAST_INK = GameMakeColor( 0xe8, 0xea, 0xf0, 255 );+static const Color BROADCAST_MUTED = GameMakeColor( 0x8e, 0x97, 0xad, 255 );+static const Color BROADCAST_GOLD = GameMakeColor( 0xf2, 0xc2, 0x30, 255 );+static const char *const BROADCAST_WORDS = "Segoe UI";+static const char *const BROADCAST_NUMBERS = "Consolas";+/// the broadcast's sizes are a 720 row picture's, grown with the picture's height+static const Real BROADCAST_ROWS = 720.0f;+static const Int BROADCAST_NAME_POINTS = 11;+static const Int BROADCAST_SIDE_POINTS = 9;+static const Int BROADCAST_HEAD_POINTS = 7;+static const Int BROADCAST_CLOCK_POINTS = 16;+static const Real BROADCAST_PAD = 8.0f;+static const Real BROADCAST_GAP = 10.0f;+static const Real BROADCAST_SWATCH = 4.0f;+static const Real BROADCAST_ROW_GAP = 3.0f;+static const Real BROADCAST_RULE = 2.0f;+static const Real BROADCAST_TUG = 6.0f;+static const Int THOUSANDS = 3;+static const Int BROADCAST_WIDEST = 888888; ///< the number the cash and army columns are measured on++/** A whole number with its thousands parted by commas, after prefix. */+static UnicodeString broadcastNumber( const char *prefix, Int value )+{+ std::string digits = std::to_string( value );+ for( Int at = (Int)digits.size() - THOUSANDS; at > 0; at -= THOUSANDS )+ digits.insert( at, "," );+ UnicodeString text;+ text.translate( AsciiString( ( prefix + digits ).c_str() ) );+ return text;+}++/** color with its opacity taken down to share of what it was. */+static Color broadcastFade( Color color, Real share )+{+ UnsignedByte red, green, blue, alpha;+ GameGetColorComponents( color, &red, &green, &blue, &alpha );+ return GameMakeColor( red, green, blue, (UnsignedByte)REAL_TO_INT( alpha * share ) );+}++//-------------------------------------------------------------------------------------------------+DisplayString *InGameUI::broadcastText( const std::string &key, const UnicodeString &text, const char *font, Int points, Bool bold )+{+ DisplayString *&string = m_broadcastTexts[ key ];+ if( string == NULL )+ {+ string = TheDisplayStringManager->newDisplayString();+ string->setFont( TheFontLibrary->getFont( AsciiString( font ), points, bold ) );+ }+ string->setText( text );+ return string;+}++/// one player's row of the score bar+struct BroadcastRow+{+ const SpectatorStats *stats;+ Color color;+ DisplayString *name;+ DisplayString *side;+ DisplayString *cash;+ DisplayString *army;+};++//-------------------------------------------------------------------------------------------------+/** The score bar hangs from the top edge in the middle: the match clock in a box of its own, one row a+ * player either side of it, the swatch of his colour and his name on the outside, his side, then his+ * cash and the cost of everything he has standing that is not a building nearest the clock. Two+ * teams face each other across it; in a free for all the first half of the list is on the left.+ * Under the rows the armies pull on one bar: the left's from the left edge, the right's from the+ * right, each player his colour, gold at the middle so the side ahead is the one past it. While+ * there are panes each carries a plate in the top of its circle, inside its wedge and clear of the+ * lines and the radar: the player's name and side in the opening, the fight's players in a split.+ * Everything is read off the players and their objects; nothing here writes the logic. */+//-------------------------------------------------------------------------------------------------+void InGameUI::drawDirectorBroadcast( void )+{+ TheObserverCamera.clearBroadcast();+ std::vector< SpectatorStats > players = gatherSpectatorStats( SPECTATOR_STATS[ 0 ], NULL );+ // the match is over: nobody is left to score+ if( players.empty() )+ return;+ std::stable_sort( players.begin(), players.end(), []( const SpectatorStats &a, const SpectatorStats &b )+ { return a.team != b.team ? a.team < b.team : a.player->getPlayerIndex() < b.player->getPlayerIndex(); } );++ const Real unit = TheDisplay->getHeight() / BROADCAST_ROWS;+ auto pixels = [ unit ]( Real at720 ) { return max( REAL_TO_INT( at720 * unit ), 1 ); };+ auto points = [ unit ]( Int at720 ) { return REAL_TO_INT( at720 * unit ); };+ const Int pad = pixels( BROADCAST_PAD );+ const Int gap = pixels( BROADCAST_GAP );+ const Int swatch = pixels( BROADCAST_SWATCH );+ const Int rowGap = pixels( BROADCAST_ROW_GAP );+ const Int rule = pixels( BROADCAST_RULE );+ const Int tug = pixels( BROADCAST_TUG );++ const Int teams = players.back().team + 1;+ size_t leftCount = ( players.size() + 1 ) / 2;+ if( teams == 2 )+ {+ leftCount = 0;+ while( players[ leftCount ].team == 0 )+ leftCount++;+ }++ std::vector< BroadcastRow > rows;+ Int nameWidth = 0, sideWidth = 0, cashWidth = 0, armyWidth = 0, rowHeight = 0;+ Int armies[ 2 ] = { 0, 0 };+ for( size_t index = 0; index < players.size(); index++ )+ {+ const SpectatorStats &stats = players[ index ];+ const std::string seat = std::to_string( stats.player->getPlayerIndex() );+ BroadcastRow row;+ row.stats = &stats;+ row.color = clientPlayerColor( stats.player );+ row.name = broadcastText( "name" + seat, stats.player->getPlayerDisplayName(), BROADCAST_WORDS, points( BROADCAST_NAME_POINTS ), TRUE );+ row.side = broadcastText( "side" + seat, stats.player->getPlayerTemplate()->getDisplayName(), BROADCAST_WORDS,+ points( BROADCAST_SIDE_POINTS ), FALSE );+ row.cash = broadcastText( "cash" + seat, broadcastNumber( "$", stats.cash ), BROADCAST_NUMBERS, points( BROADCAST_NAME_POINTS ), TRUE );+ row.army = broadcastText( "army" + seat, broadcastNumber( "", stats.army ), BROADCAST_NUMBERS, points( BROADCAST_NAME_POINTS ), TRUE );+ Int width = 0, height = 0;+ row.name->getSize( &width, &height );+ nameWidth = max( nameWidth, width );+ rowHeight = max( rowHeight, height );+ row.side->getSize( &width, &height );+ sideWidth = max( sideWidth, width );+ row.cash->getSize( &width, &height );+ cashWidth = max( cashWidth, width );+ rowHeight = max( rowHeight, height );+ row.army->getSize( &width, &height );+ armyWidth = max( armyWidth, width );+ armies[ index < leftCount ? 0 : 1 ] += stats.army;+ rows.push_back( row );+ }++ DisplayString *cashHead = broadcastText( "cashhead", TheGameText->fetch( "GUI:HudStatCash" ), BROADCAST_NUMBERS,+ points( BROADCAST_HEAD_POINTS ), FALSE );+ DisplayString *armyHead = broadcastText( "armyhead", TheGameText->fetch( "GUI:HudStatArmy" ), BROADCAST_NUMBERS,+ points( BROADCAST_HEAD_POINTS ), FALSE );+ UnicodeString clockText;+ clockText.translate( AsciiString( spectatorClock( TheGameLogic->getFrame() ).c_str() ) );+ DisplayString *clock = broadcastText( "clock", clockText, BROADCAST_NUMBERS, points( BROADCAST_CLOCK_POINTS ), TRUE );+ // the number columns are as wide as six digits whatever they hold, so the bar does not change its+ // width every time a player's cash crosses a thousand+ DisplayString *cashWidest = broadcastText( "cashwidest", broadcastNumber( "$", BROADCAST_WIDEST ), BROADCAST_NUMBERS,+ points( BROADCAST_NAME_POINTS ), TRUE );+ DisplayString *armyWidest = broadcastText( "armywidest", broadcastNumber( "", BROADCAST_WIDEST ), BROADCAST_NUMBERS,+ points( BROADCAST_NAME_POINTS ), TRUE );+ Int cashHeadWidth = 0, armyHeadWidth = 0, headHeight = 0, clockWidth = 0, clockHeight = 0, widestHeight = 0;+ Int cashWidestWidth = 0, armyWidestWidth = 0;+ cashHead->getSize( &cashHeadWidth, &headHeight );+ armyHead->getSize( &armyHeadWidth, &headHeight );+ clock->getSize( &clockWidth, &clockHeight );+ cashWidest->getSize( &cashWidestWidth, &widestHeight );+ armyWidest->getSize( &armyWidestWidth, &widestHeight );+ const Int cashColumn = max( max( cashWidth, cashWidestWidth ), cashHeadWidth );+ const Int armyColumn = max( max( armyWidth, armyWidestWidth ), armyHeadWidth );++ // the bar's measures, its left edge at left and its top on the screen's+ const Int half = swatch + gap / 2 + nameWidth + gap + sideWidth + gap + cashColumn + gap + armyColumn;+ const Int rowCount = (Int)max( leftCount, rows.size() - leftCount );+ const Int tableTop = pad + headHeight;+ const Int tableBottom = tableTop + rowCount * ( rowHeight + rowGap );+ const Int clockBox = clockWidth + 2 * gap;+ const Int width = 2 * ( pad + half + pad ) + clockBox;+ const Int left = ( TheDisplay->getWidth() - width ) / 2;+ const Int tugTop = tableBottom + pad / 2;+ const Int height = tugTop + tug + pad;+ const Int clockLeft = left + pad + half + pad;+ const Int rightStart = clockLeft + clockBox + pad;++ TheDisplay->drawFillRect( left, 0, width, height, BROADCAST_GROUND );+ TheDisplay->drawFillRect( clockLeft, 0, clockBox, tableBottom, BROADCAST_PANEL );+ TheDisplay->drawFillRect( clockLeft, tableBottom - rule, clockBox, rule, BROADCAST_GOLD );+ clock->draw( clockLeft + gap, ( tableBottom - clockHeight ) / 2, BROADCAST_INK, BROADCAST_GROUND );++ // the columns on the left run outwards in, on the right inwards out; numbers end on their column's+ // right edge both sides so their digits line up+ const Int leftCashEnd = left + pad + half - gap - armyColumn;+ const Int leftArmyEnd = left + pad + half;+ const Int rightArmyEnd = rightStart + armyColumn;+ const Int rightCashEnd = rightArmyEnd + gap + cashColumn;+ cashHead->draw( leftCashEnd - cashHeadWidth, pad, BROADCAST_MUTED, BROADCAST_GROUND );+ armyHead->draw( leftArmyEnd - armyHeadWidth, pad, BROADCAST_MUTED, BROADCAST_GROUND );+ armyHead->draw( rightArmyEnd - armyHeadWidth, pad, BROADCAST_MUTED, BROADCAST_GROUND );+ cashHead->draw( rightCashEnd - cashHeadWidth, pad, BROADCAST_MUTED, BROADCAST_GROUND );++ for( size_t index = 0; index < rows.size(); index++ )+ {+ const BroadcastRow &row = rows[ index ];+ const Bool onLeft = index < leftCount;+ const Int top = tableTop + (Int)( onLeft ? index : index - leftCount ) * ( rowHeight + rowGap );+ Int nameW = 0, nameH = 0, sideW = 0, sideH = 0, cashW = 0, cashH = 0, armyW = 0, armyH = 0;+ row.name->getSize( &nameW, &nameH );+ row.side->getSize( &sideW, &sideH );+ row.cash->getSize( &cashW, &cashH );+ row.army->getSize( &armyW, &armyH );+ const Int swatchLeft = onLeft ? left + pad : rightStart + half - swatch;+ const Int nameLeft = onLeft ? swatchLeft + swatch + gap / 2 : swatchLeft - gap / 2 - nameW;+ const Int sideLeft = onLeft ? nameLeft + nameWidth + gap : swatchLeft - gap / 2 - nameWidth - gap - sideW;+ const Int cashEnd = onLeft ? leftCashEnd : rightCashEnd;+ const Int armyEnd = onLeft ? leftArmyEnd : rightArmyEnd;+ TheDisplay->drawFillRect( swatchLeft, top, swatch, rowHeight, row.color );+ row.name->draw( nameLeft, top + ( rowHeight - nameH ) / 2, row.color, BROADCAST_GROUND );+ row.side->draw( sideLeft, top + ( rowHeight - sideH ) / 2, BROADCAST_MUTED, BROADCAST_GROUND );+ row.cash->draw( cashEnd - cashW, top + ( rowHeight - cashH ) / 2, BROADCAST_INK, BROADCAST_GROUND );+ row.army->draw( armyEnd - armyW, top + ( rowHeight - armyH ) / 2, BROADCAST_INK, BROADCAST_GROUND );+ }++ // the tug of war: each side's armies from its own end, split among its players+ const Int tugLeft = left + pad;+ const Int tugWidth = width - 2 * pad;+ const Int total = armies[ 0 ] + armies[ 1 ];+ TheDisplay->drawFillRect( tugLeft, tugTop, tugWidth, tug, BROADCAST_LINE );+ Int fromLeft = tugLeft;+ Int fromRight = tugLeft + tugWidth;+ for( size_t index = 0; index < rows.size() && total > 0; index++ )+ {+ const Int share = (Int)( (Int64)rows[ index ].stats->army * tugWidth / total );+ if( index < leftCount )+ {+ TheDisplay->drawFillRect( fromLeft, tugTop, share, tug, rows[ index ].color );+ fromLeft += share;+ continue;+ }+ fromRight -= share;+ TheDisplay->drawFillRect( fromRight, tugTop, share, tug, rows[ index ].color );+ }+ TheDisplay->drawFillRect( tugLeft + ( tugWidth - rule ) / 2, tugTop - rule, rule, tug + 2 * rule, BROADCAST_GOLD );++ IRegion2D bar;+ bar.lo.x = left;+ bar.lo.y = 0;+ bar.hi.x = left + width;+ bar.hi.y = height;+ TheObserverCamera.addBroadcast( bar );+ TheObserverCamera.setBroadcastTop( (Real)( height + pad ) );++ // a plate a pane, faded in and out with the panes+ const Real shown = TheObserverCamera.getPaneProgress();+ const Int panes = TheObserverCamera.getDrawnPaneCount();+ DisplayString *versus = broadcastText( "versus", UnicodeString( u"vs" ), BROADCAST_WORDS, points( BROADCAST_SIDE_POINTS ), FALSE );+ for( Int pane = 0; pane < panes && panes >= 2; pane++ )+ {+ const PlayerMaskType sides = TheObserverCamera.getPaneSides( pane );+ std::vector< DisplayString * > pieces;+ std::vector< Color > colors;+ const BroadcastRow *only = NULL;+ for( size_t index = 0; index < rows.size(); index++ )+ {+ if( ( rows[ index ].stats->player->getPlayerMask() & sides ) == 0 )+ continue;+ if( !pieces.empty() )+ {+ pieces.push_back( versus );+ colors.push_back( BROADCAST_MUTED );+ }+ pieces.push_back( rows[ index ].name );+ colors.push_back( rows[ index ].color );+ only = &rows[ index ];+ }+ // the opening's pane is one player's, and his side goes beside his name+ if( pieces.size() == 1 )+ {+ pieces.push_back( only->side );+ colors.push_back( BROADCAST_MUTED );+ }+ if( pieces.empty() )+ continue;++ Int textWidth = 0, textHeight = 0;+ for( size_t piece = 0; piece < pieces.size(); piece++ )+ {+ Int pieceWidth = 0, pieceHeight = 0;+ pieces[ piece ]->getSize( &pieceWidth, &pieceHeight );+ textWidth += pieceWidth + ( piece > 0 ? gap / 2 : 0 );+ textHeight = max( textHeight, pieceHeight );+ }+ const Int plateWidth = textWidth + 2 * pad;+ const Int plateHeight = textHeight + pad + rule;+ Coord2D centre;+ Real radius = 0.0f;+ TheObserverCamera.getPaneCircle( pane, ¢re, &radius );+ const Int plateTop = REAL_TO_INT( ObserverCamera_paneLabelTop( centre, radius, (Real)plateWidth, (Real)plateHeight ) );+ const Int plateLeft = REAL_TO_INT( centre.x ) - plateWidth / 2;+ TheDisplay->drawFillRect( plateLeft, plateTop, plateWidth, plateHeight, broadcastFade( BROADCAST_GROUND, shown ) );+ TheDisplay->drawFillRect( plateLeft, plateTop + plateHeight - rule, plateWidth, rule, broadcastFade( BROADCAST_GOLD, shown ) );+ Int x = plateLeft + pad;+ for( size_t piece = 0; piece < pieces.size(); piece++ )+ {+ Int pieceWidth = 0, pieceHeight = 0;+ pieces[ piece ]->getSize( &pieceWidth, &pieceHeight );+ pieces[ piece ]->draw( x, plateTop + pad / 2 + ( textHeight - pieceHeight ) / 2, broadcastFade( colors[ piece ], shown ),+ broadcastFade( BROADCAST_GROUND, shown ) );+ x += pieceWidth + gap / 2;+ }++ IRegion2D plate;+ plate.lo.x = plateLeft;+ plate.lo.y = plateTop;+ plate.hi.x = plateLeft + plateWidth;+ plate.hi.y = plateTop + plateHeight;+ TheObserverCamera.addBroadcast( plate );+ }+}+//-------------------------------------------------------------------------------------------------void InGameUI::drawHudOverlay( void ){diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cppindex ea0d87be8..fbfe6394f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp@@ -534,7 +534,7 @@ static Real distanceToRay( Real x, Real y, Real middleX, Real middleY, Real degr* the screen's four sides or the radar's frame; the grid point furthest from all of them is the* circle's centre. *///--------------------------------------------------------------------------------------------------void ObserverCamera_paneCircles( const Real *rays, Int count, Int width, Int height, const Coord2D &radarHalf,+void ObserverCamera_paneCircles( const Real *rays, Int count, Int width, Int height, const Coord2D &radarHalf, Real top,Coord2D *centres, Real *radii ){const Real middleX = width * 0.5f;@@ -552,7 +552,7 @@ void ObserverCamera_paneCircles( const Real *rays, Int count, Int width, Int heiconst Real x = ( column + 0.5f ) * width / PANE_CIRCLE_COLUMNS;const Real y = ( row + 0.5f ) * height / PANE_CIRCLE_ROWS;const Int pane = ObserverCamera_paneOf( x, y, middleX, middleY, rays, count );- Real clear = min( min( x, width - x ), min( y, height - y ) );+ Real clear = min( min( x, width - x ), min( y - top, height - y ) );clear = min( clear, distanceToRay( x, y, middleX, middleY, rays[ pane ] ) );clear = min( clear, distanceToRay( x, y, middleX, middleY, rays[ ( pane + 1 ) % count ] ) );const Real outX = max( fabs( x - middleX ) - radarHalf.x, 0.0f );@@ -568,6 +568,19 @@ void ObserverCamera_paneCircles( const Real *rays, Int count, Int width, Int hei}}+//-------------------------------------------------------------------------------------------------+/** The label's top corners are the first of it to leave the circle going up: they meet it where its+ * chord is the label's width, and the label hangs from there. */+//-------------------------------------------------------------------------------------------------+Real ObserverCamera_paneLabelTop( const Coord2D ¢re, Real radius, Real width, Real height )+{+ const Real halfWidth = width * 0.5f;+ if( halfWidth >= radius )+ return centre.y - height * 0.5f;+ const Real above = sqrtf( radius * radius - halfWidth * halfWidth );+ return centre.y - max( above, height * 0.5f );+}+//-------------------------------------------------------------------------------------------------Real ObserverCamera_extentAround( const std::vector< DirectorHeat > &things, const Coord2D &around, Real reach, Real least ){@@ -903,6 +916,9 @@ void ObserverCamera::reset( void )m_events.clear();m_nextEventId = 1;m_fights.clear();+ m_fightSides.clear();+ m_broadcast.clear();+ m_broadcastTop = 0.0f;m_split = FALSE;m_splitChanged = 0;m_secondPlace.x = m_secondPlace.y = 0.0f;@@ -1623,7 +1639,7 @@ void ObserverCamera::fitPanes( UnsignedInt frame )m_radarHalf.y = ( radar.hi.y - radar.lo.y ) * 0.5f;}ObserverCamera_paneCircles( m_paneRays, m_paneCount, TheDisplay->getWidth(), TheDisplay->getHeight(), m_radarHalf,- m_paneCentres, m_paneRadii );+ m_broadcastTop, m_paneCentres, m_paneRadii );Coord2D subjects[ OBSERVER_MOST_PANES ];for( Int pane = 0; pane < m_paneCount; pane++ )@@ -1727,6 +1743,42 @@ Coord2D ObserverCamera::getFramedRadarMiddle( Real radarDiagonal ) constreturn middle;}+//-------------------------------------------------------------------------------------------------+Bool ObserverCamera::isBroadcast( Int x, Int y ) const+{+ for( size_t index = 0; index < m_broadcast.size(); index++ )+ {+ const IRegion2D ®ion = m_broadcast[ index ];+ if( x >= region.lo.x && x < region.hi.x && y >= region.lo.y && y < region.hi.y )+ return TRUE;+ }+ return FALSE;+}++//-------------------------------------------------------------------------------------------------+void ObserverCamera::getPaneCircle( Int pane, Coord2D *centre, Real *radius ) const+{+ centre->x = m_paneCentres[ pane ].x + m_paneOrigin.x - TheDisplay->getWidth() * 0.5f;+ centre->y = m_paneCentres[ pane ].y + m_paneOrigin.y - TheDisplay->getHeight() * 0.5f;+ *radius = m_paneRadii[ pane ];+}++//-------------------------------------------------------------------------------------------------+/** A split's two panes show the fights at the director's place and at the second one, and their+ * sides are every player in the hits within the gather radius of each. */+//-------------------------------------------------------------------------------------------------+PlayerMaskType ObserverCamera::getPaneSides( Int pane ) const+{+ if( m_intro )+ return m_panePlayers[ pane ]->getPlayerMask();+ const Coord2D &subject = pane == 0 ? m_panesLeftPlace : m_secondPlace;+ PlayerMaskType sides = 0;+ for( size_t index = 0; index < m_fights.size(); index++ )+ if( sameFight( m_fights[ index ].position, subject ) )+ sides |= m_fightSides[ index ];+ return sides;+}+//-------------------------------------------------------------------------------------------------void ObserverCamera::beginPanePass( Int pane ){@@ -1924,6 +1976,7 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )std::vector< DirectorHeat > hits;std::vector< DirectorHeat > fights;+ std::vector< PlayerMaskType > sides;std::vector< DirectorHeat > sights;for( Object *obj = TheGameLogic->getFirstObject(); obj != NULL; obj = obj->getNextObject() ){@@ -1956,11 +2009,15 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )heat.weight = ObserverCamera_hitWeight( cost, obj->isEffectivelyDead(), superweapon );hits.push_back( heat );- // -directorrecord's split counts only fights- if( fightSides( obj, body ) != 0 )- fights.push_back( heat );+ // -directorrecord's split counts only fights, and its labels name who is in them+ const PlayerMaskType between = fightSides( obj, body );+ if( between == 0 )+ continue;+ fights.push_back( heat );+ sides.push_back( between );}m_fights = fights;+ m_fightSides = sides;Coord2D hottest;Real hottestHeat = 0.0f;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppindex 2edf8796f..c4a1e23d0 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp@@ -4301,8 +4301,8 @@ static Bool openVideoPipe(Int width, Int height)/** -directorrecord's panes joined into pane 0's picture: each pixel is taken from the pane whose wedge* it lies in. A pane's camera already slid its picture with the rays' meeting point, so the copy is* pixel for pixel; moving the pixels instead read past a picture's edge and smeared it. Pane 0 keeps the framed radar and a band along every- * seam, where only its draw has the line. A pane with no picture of this frame and size stays pane- * 0's. */+ * seam, where only its draw has the line, and the broadcast's score bar and labels, which only its+ * draw has either. A pane with no picture of this frame and size stays pane 0's. */static void joinVideoPanes(char *rows, Int width, Int height, UnsignedInt frame){const Int seamBand = ObserverCamera_paneSeamBand(height);@@ -4334,6 +4334,8 @@ static void joinVideoPanes(char *rows, Int width, Int height, UnsignedInt frame)continue;if (x >= radar.lo.x && x < radar.hi.x && y >= radar.lo.y && y < radar.hi.y)continue;+ if (TheObserverCamera.isBroadcast(x, y))+ continue;const Int left = max(x - seamBand, 0);const Int right = min(x + seamBand, width - 1);const Int up = max(y - seamBand, 0);diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex a9a5d3bde..5125129ea 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -547,6 +547,10 @@ void W3DInGameUI::draw( void )TheControlBar->placeWindowAt( radarWindow, corner );W3DLeftHUDDraw( radarWindow, NULL );}++ // -directorrecord's score bar and pane labels, over everything and pane 0's alone like the lines+ if( TheGlobalData->m_directorRecord && !TheObserverCamera.isDrawingSecond() )+ drawDirectorBroadcast();return;}diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.incindex cdfbc1362..bf71b612c 100644--- a/GeneralsMD/Code/Tests/test_observer_camera.inc+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc@@ -410,7 +410,7 @@ TEST(a_pane_circle_is_the_largest_its_wedge_holds)// two panes: the circle touching the top, the left and the diagonal x + y = 1000 has a radius of// 1000 / (2 + root 2), and pane 1's is its mirror through the middleObserverCamera_paneLayout( 2, rays );- ObserverCamera_paneCircles( rays, 2, 1280, 720, noRadar, centres, radii );+ ObserverCamera_paneCircles( rays, 2, 1280, 720, noRadar, 0.0f, centres, radii );CHECK_NEAR( radii[ 0 ], 292.9f, 8.0f );CHECK_NEAR( centres[ 0 ].x, 292.9f, 15.0f );CHECK_NEAR( centres[ 0 ].y, 292.9f, 15.0f );@@ -421,7 +421,7 @@ TEST(a_pane_circle_is_the_largest_its_wedge_holds)// one runs past the top and bottom corners, and its circle touching the left edge and both rays has// 640 / (1 + root 2)ObserverCamera_paneLayout( 4, rays );- ObserverCamera_paneCircles( rays, 4, 1280, 720, noRadar, centres, radii );+ ObserverCamera_paneCircles( rays, 4, 1280, 720, noRadar, 0.0f, centres, radii );CHECK_NEAR( radii[ 0 ], 149.1f, 8.0f );CHECK_NEAR( centres[ 0 ].x, 640.0f, 15.0f );CHECK_NEAR( radii[ 1 ], 265.1f, 8.0f );@@ -431,7 +431,7 @@ TEST(a_pane_circle_is_the_largest_its_wedge_holds)// a Y: three circles, every one inside the screenObserverCamera_paneLayout( 3, rays );- ObserverCamera_paneCircles( rays, 3, 1280, 720, noRadar, centres, radii );+ ObserverCamera_paneCircles( rays, 3, 1280, 720, noRadar, 0.0f, centres, radii );for( Int pane = 0; pane < 3; pane++ ){CHECK( radii[ pane ] > 100.0f );@@ -443,9 +443,32 @@ TEST(a_pane_circle_is_the_largest_its_wedge_holds)// the framed radar in the middle takes room from the two pane circle, which reached its cornerObserverCamera_paneLayout( 2, rays );const Coord2D radar = { 150.0f, 100.0f };- ObserverCamera_paneCircles( rays, 2, 1280, 720, radar, centres, radii );+ ObserverCamera_paneCircles( rays, 2, 1280, 720, radar, 0.0f, centres, radii );CHECK( radii[ 0 ] < 285.0f );CHECK( radii[ 0 ] > 150.0f );++ // the score bar's rows at the top are no pane's: the upper circle stays below them+ ObserverCamera_paneCircles( rays, 2, 1280, 720, noRadar, 90.0f, centres, radii );+ CHECK( centres[ 0 ].y - radii[ 0 ] >= 90.0f - 6.0f );+ CHECK( radii[ 0 ] < 285.0f );+}++TEST(a_pane_label_hangs_as_high_in_its_circle_as_the_circle_holds_it)+{+ Coord2D centre;+ centre.x = 300.0f;+ centre.y = 400.0f;+ // 160 wide in a circle of 100: its top corners meet the circle 60 above the centre+ const Real top = ObserverCamera_paneLabelTop( centre, 100.0f, 160.0f, 20.0f );+ CHECK_NEAR( top, 340.0f, 0.01f );+ // its top corners, the first of it to leave the circle, are on it+ const Real dx = 80.0f;+ const Real dy = top - centre.y;+ CHECK( dx * dx + dy * dy <= 100.0f * 100.0f + 0.5f );+ // too wide to fit at all: across the middle+ CHECK_NEAR( ObserverCamera_paneLabelTop( centre, 100.0f, 240.0f, 20.0f ), 390.0f, 0.01f );+ // a chord shorter than the label is tall: across the middle as well+ CHECK_NEAR( ObserverCamera_paneLabelTop( centre, 100.0f, 198.0f, 40.0f ), 380.0f, 0.01f );}TEST(a_subject_spreads_as_far_as_its_farthest_thing_within_reach)