Skip to content

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.

fix(gameengine): draw director lines on settled panes so they read

Olcay Seygan56102be40877
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 157ba715e..b001bbb91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -749,7 +749,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 three seconds before the second begins, and only when the first run saw the Director's own fight go on for the whole time the split will be up, so the second picture never sweeps in and straight back out. A skirmish the first run saw come to nothing is not cut to, and neither is a special power that hurts nobody: an Air Force general's spy satellite every minute used to pull the camera to empty ground, where a carpet bomb or an artillery strike still gets it from the launch. Each half keeps its own fight. The main camera used to leave for the second half's fight as it began, and the two halves glided past each other over empty ground and swapped places; now it takes that fight over only once its own is finished, and the second half closes as it does. 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, which stays on the first player's base until something happens instead of gliding across empty ground to another one. 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. Under each line and round the radar lies a soft band of the Reforged blue. Coming in, the lines grow out from where they meet, the band fades in a beat behind them and the radar's frame draws its gold round the map; going out runs the same backwards, and while the screen stays cut a light runs out along the gold every five seconds. 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 after its second picture is all the way in and ends once the second fight has burnt down to a quarter of the first, and the picture then stays whole four seconds even for a fight the first run saw coming, so it does not flicker between one and two. The two fights have to be further apart than either half's picture is wide once it has risen to fit its fight, so no piece of ground shows in both: at a fixed 660 the two halves of a 1v1 showed the same bridge from neighbouring angles. A crowd beside the Director's fight that the first run saw as part of it does not split the screen either; that was the Director's own fight spreading, and the second half swept in for two seconds before the camera followed it there. 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 (a computer player goes by his general with his difficulty beside it, where every one of them used to read "Hard AI"), 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. Teammates sit together on it with their team's army total under them, a free for all deals its players to both sides, and with three sides or more the bar is every side's share end to end. Eight players fit at 720p: a side of more than three rows sets them smaller and drops the general column. A dark colour like purple is lightened where it is text, so it reads on the bar's ground, and the gold player's colour gets a dark edge so it does not melt into the gold lines. A skirmish can be staged in any shape now, 4v1 or three players alone beside a pair: `-team 4 0` puts slot 4 on team 0. The opening seats teammates next to each other and names their team on their plates, and a split names a team as "Team A" where a player alone keeps his own name. Each picture of the opening names its player on a plate hanging just over his command centre, and the plate stays on the building as the camera rises and the pictures sweep away. 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, and while the halves sweep in it rides above its fight, where it used to slide down over it. 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 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 three seconds before the second begins, and only when the first run saw the Director's own fight go on for the whole time the split will be up, so the second picture never sweeps in and straight back out. A skirmish the first run saw come to nothing is not cut to, and neither is a special power that hurts nobody: an Air Force general's spy satellite every minute used to pull the camera to empty ground, where a carpet bomb or an artillery strike still gets it from the launch. Each half keeps its own fight. The main camera used to leave for the second half's fight as it began, and the two halves glided past each other over empty ground and swapped places; now it takes that fight over only once its own is finished, and the second half closes as it does. 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, which stays on the first player's base until something happens instead of gliding across empty ground to another one. 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. Under each line and round the radar lies a soft band of the Reforged blue. The pictures slide into place first, and only then does the gold draw out from where the lines meet, over most of a second, with the band fading in behind it and the radar's frame tracing its gold round the map once the radar has arrived; going out, the gold pulls back in before the pictures leave. The opening plays it the same way from the first player's full view. While the screen stays cut a bright white-gold light runs out along every line every five seconds, the opening included. At first all of this ran inside the half second the pictures take to slide, and on film the lines were already whole by the third 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 after its second picture is all the way in and ends once the second fight has burnt down to a quarter of the first, and the picture then stays whole four seconds even for a fight the first run saw coming, so it does not flicker between one and two. The two fights have to be further apart than either half's picture is wide once it has risen to fit its fight, so no piece of ground shows in both: at a fixed 660 the two halves of a 1v1 showed the same bridge from neighbouring angles. A crowd beside the Director's fight that the first run saw as part of it does not split the screen either; that was the Director's own fight spreading, and the second half swept in for two seconds before the camera followed it there. 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 (a computer player goes by his general with his difficulty beside it, where every one of them used to read "Hard AI"), 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. Teammates sit together on it with their team's army total under them, a free for all deals its players to both sides, and with three sides or more the bar is every side's share end to end. Eight players fit at 720p: a side of more than three rows sets them smaller and drops the general column. A dark colour like purple is lightened where it is text, so it reads on the bar's ground, and the gold player's colour gets a dark edge two pixels wide even at 720p so it does not melt into the gold lines. A skirmish can be staged in any shape now, 4v1 or three players alone beside a pair: `-team 4 0` puts slot 4 on team 0. The opening seats teammates next to each other and names their team on their plates, and a split names a team as "Team A" where a player alone keeps his own name. Each picture of the opening names its player on a plate hanging just over his command centre, and the plate stays on the building as the camera rises and the pictures sweep away. The name sits over his general and team in smaller type, and the plate stays wholly inside its picture: in an eight-player opening the lines used to cut it down to "ank General Team A", and in a 4v1 the top one hid under the score bar. 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, and while the halves sweep in it rides above its fight, where it used to slide down over it. 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/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
index cbef339d1..836c7c2cc 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
@@ -279,10 +279,12 @@ Int ObserverCamera_paneSeamBand( Int height );
/// the width of the soft band of the brand's blue under every line between panes and round the radar
Int ObserverCamera_paneBandWidth( Int height );
/// how much of its length a line between panes has grown out from the meeting point at progress, the
-/// panes' slide, 0 to 1; whole before the slide is
+/// lines' draw on the settled panes, 0 to 1; whole before the draw is
Real ObserverCamera_lineDrawn( Real progress );
/// how far a line's band has faded in at progress, behind the line
Real ObserverCamera_bandShown( Real progress );
+/// how much of the radar frame's gold has been traced round the map at progress
+Real ObserverCamera_frameTraced( Real progress );
/// where along the gold lines the travelling light is on logic frame frame, 0 at the meeting point and
/// 1 at the far end, eased; below 0 between two runs
Real ObserverCamera_shimmerAt( UnsignedInt frame );
@@ -354,6 +356,8 @@ public:
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; }
+ /// how far the gold lines have drawn out on the settled panes, 0 to 1, not eased
+ Real getLineProgress( void ) const { return m_lineProgress; }
/// who a split's pane shows: everybody dealing or taking hits in its fight; 0 when nobody is
PlayerMaskType getPaneSides( Int pane ) const;
/// the panes are the match's opening, each one player's: his index, and the point over his command
@@ -465,7 +469,9 @@ private:
UnsignedInt m_splitChanged; ///< the logic frame the split last went on or off
Coord2D m_secondPlace; ///< the second fight, shown in the second pane
- enum PanePhase { PANES_NONE, PANES_RADAR_OUT, PANES_IN, PANES_HELD, PANES_OUT, PANES_RADAR_IN };
+ enum PanePhase { PANES_NONE, PANES_RADAR_OUT, PANES_IN, PANES_DRAW, PANES_HELD, PANES_UNDRAW, PANES_OUT, PANES_RADAR_IN };
+ /// the panes all in, their lines drawing, drawn or going back
+ Bool panesSettled( void ) const { return m_panePhase == PANES_DRAW || m_panePhase == PANES_HELD || m_panePhase == PANES_UNDRAW; }
PanePhase m_panePhase;
UnsignedInt m_panePhaseStart; ///< the logic frame the phase began on
Bool m_intro; ///< the panes are the match's opening, one a player
@@ -475,6 +481,7 @@ private:
Int m_paneCount; ///< 0 with no panes
Real m_paneRays[ OBSERVER_MOST_PANES ];
Real m_paneProgress; ///< 0 for no panes on the screen, 1 for all of them, eased
+ Real m_lineProgress; ///< 0 for no gold on the lines, 1 for all of it, a straight share of the draw
Real m_paneExit; ///< how far off the meeting point goes, in pixels
Real m_paneBaseZoom; ///< the view's zoom when the panes started, which they rise from
Coord2D m_paneCentres[ OBSERVER_MOST_PANES ]; ///< where each pane's subject is put, the rays meeting in the middle
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 90c492194..4c8c14483 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -10619,16 +10619,22 @@ static UnicodeString broadcastTeamName( const std::vector< SpectatorStats > &pla
return text;
}
+/// the ground's edge round a gold player's swatch, in 720 line pixels: one pixel was lost at 720p
+static const Real BROADCAST_GOLD_EDGE = 2.0f;
+
/** A player's colour as a filled rectangle; one near the lines' gold gets an edge of the ground round
- * it, so it does not run into them. */
+ * it, outside so a swatch three pixels wide keeps its colour, and over its neighbours' ends in the
+ * army bar so it does not run into them. */
static void drawBroadcastSwatch( Int left, Int top, Int width, Int height, Color color )
{
if( width <= 0 )
return;
+ if( ObserverCamera_nearBrandGold( color ) )
+ {
+ const Int edge = max( broadcastPixels( BROADCAST_GOLD_EDGE ), 2 );
+ TheDisplay->drawFillRect( left - edge, top - edge, width + edge * 2, height + edge * 2, BROADCAST_GROUND );
+ }
TheDisplay->drawFillRect( left, top, width, height, color );
- if( !ObserverCamera_nearBrandGold( color ) || width < 3 )
- return;
- TheDisplay->drawOpenRect( left, top, width, height, 1.0f, BROADCAST_GROUND );
}
/// a label on the picture: pieces of text side by side, each its colour, on the ground with the gold
@@ -10998,8 +11004,8 @@ void InGameUI::drawDirectorBroadcast( void )
}
//-------------------------------------------------------------------------------------------------
-/** The opening's plate for the pane being drawn, the player's name with a player's side beside it,
- * hung just over his command centre through the camera drawing that pane, so it stays on the
+/** The opening's plate for the pane being drawn, the player's name with a player's side and team under
+ * it, hung just over his command centre and kept inside the pane's circle through the camera drawing that pane, so it stays on the
* building as the camera moves, zooms and slides. Drawn in the pane's own draw it lies on that
* pane's picture, and the recording takes it with the pane; held on the screen when the building
* goes off it, and faded with the panes. */
@@ -11016,33 +11022,77 @@ void InGameUI::drawDirectorIntroPlate( void )
Player *player = ThePlayerList->getNthPlayer( TheObserverCamera.getIntroPlayerIndex( pane ) );
const std::string seat = std::to_string( player->getPlayerIndex() );
- BroadcastPlate plate;
- plate.pieces.push_back( broadcastText( "name" + seat, broadcastName( player ), BROADCAST_WORDS, broadcastPoints( BROADCAST_NAME_POINTS ), TRUE ) );
- plate.colors.push_back( ObserverCamera_readableColor( clientPlayerColor( player ) ) );
- // an AI is called by its side already
- if( player->getPlayerType() != PLAYER_COMPUTER )
- {
- plate.pieces.push_back( broadcastText( "side" + seat, broadcastSide( player ), BROADCAST_WORDS, broadcastPoints( BROADCAST_SIDE_POINTS ), FALSE ) );
- plate.colors.push_back( BROADCAST_MUTED );
- }
- // and the team he is on, the score bar's name for it
const std::vector< SpectatorStats > players = gatherSpectatorStats( SPECTATOR_STATS[ 0 ], NULL );
- for( size_t index = 0; index < players.size(); index++ )
- {
- if( players[ index ].player != player || broadcastTeamSize( players, players[ index ].team ) < 2 )
- continue;
- plate.pieces.push_back( broadcastText( "introteam" + seat, broadcastTeamName( players, players[ index ].team ), BROADCAST_WORDS,
- broadcastPoints( BROADCAST_SIDE_POINTS ), TRUE ) );
- plate.colors.push_back( BROADCAST_GOLD );
- }
-
- Int plateWidth = 0, plateHeight = 0;
- broadcastPlateSize( plate, &plateWidth, &plateHeight );
- const Int left = over.x - plateWidth / 2;
- const Int top = over.y - broadcastPixels( BROADCAST_PAD ) - plateHeight;
- const Int rightmost = (Int)TheDisplay->getWidth() - plateWidth;
- const Int lowest = (Int)TheDisplay->getHeight() - plateHeight;
- drawBroadcastPlate( plate, min( max( left, 0 ), rightmost ), min( max( top, 0 ), lowest ), shown );
+ Coord2D centre;
+ Real radius = 0.0f;
+ TheObserverCamera.getPaneCircle( pane, &centre, &radius );
+
+ // the name on top, and under it, smaller, a player's side and the team he is on: side by side on
+ // one plate they ran past the rays of an eight-pane opening. A block wider than the pane's circle
+ // steps down through smaller sizes until it fits, or takes the smallest; each size has keys of its
+ // own since a string keeps the font it was made with
+ BroadcastPlate name;
+ BroadcastPlate under;
+ Int nameWidth = 0, nameHeight = 0, underWidth = 0, underHeight = 0;
+ const Int nameSizes[] = { BROADCAST_NAME_POINTS, BROADCAST_SIDE_POINTS, BROADCAST_HEAD_POINTS };
+ const Int underSizes[] = { BROADCAST_SIDE_POINTS, BROADCAST_COMPACT_POINTS, BROADCAST_HEAD_POINTS };
+ const Int sizeCount = ARRAY_SIZE( nameSizes );
+ for( Int step = 0; step < sizeCount; step++ )
+ {
+ const std::string size = std::to_string( step ) + ":";
+ const Int namePoints = broadcastPoints( nameSizes[ step ] );
+ const Int underPoints = broadcastPoints( underSizes[ step ] );
+ name = BroadcastPlate();
+ under = BroadcastPlate();
+ name.pieces.push_back( broadcastText( "name" + size + seat, broadcastName( player ), BROADCAST_WORDS, namePoints, TRUE ) );
+ name.colors.push_back( ObserverCamera_readableColor( clientPlayerColor( player ) ) );
+ // an AI is called by its side already
+ if( player->getPlayerType() != PLAYER_COMPUTER )
+ {
+ under.pieces.push_back( broadcastText( "side" + size + seat, broadcastSide( player ), BROADCAST_WORDS, underPoints, FALSE ) );
+ under.colors.push_back( BROADCAST_MUTED );
+ }
+ for( size_t index = 0; index < players.size(); index++ )
+ {
+ if( players[ index ].player != player || broadcastTeamSize( players, players[ index ].team ) < 2 )
+ continue;
+ under.pieces.push_back( broadcastText( "introteam" + size + seat, broadcastTeamName( players, players[ index ].team ), BROADCAST_WORDS,
+ underPoints, TRUE ) );
+ under.colors.push_back( BROADCAST_GOLD );
+ }
+ broadcastPlateSize( name, &nameWidth, &nameHeight );
+ underWidth = underHeight = 0;
+ if( !under.pieces.empty() )
+ broadcastPlateSize( under, &underWidth, &underHeight );
+ const Real across = (Real)max( nameWidth, underWidth );
+ const Real down = (Real)( nameHeight + underHeight );
+ if( across * across + down * down <= 4.0f * radius * radius )
+ break;
+ }
+ const Real width = (Real)max( nameWidth, underWidth );
+ const Real height = (Real)( nameHeight + underHeight );
+
+ // hung over the command centre, then pulled in until all of it is inside the pane's circle, so no
+ // ray cuts it and the score bar does not cover it
+ Coord2D middle;
+ middle.x = (Real)over.x;
+ middle.y = over.y - broadcastPixels( BROADCAST_PAD ) - height * 0.5f;
+ const Real room = max( radius - sqrtf( width * width + height * height ) * 0.5f, 0.0f );
+ const Real dx = middle.x - centre.x;
+ const Real dy = middle.y - centre.y;
+ const Real away = sqrtf( dx * dx + dy * dy );
+ if( away > room )
+ {
+ middle.x = centre.x + ( away > 0.0f ? dx / away * room : 0.0f );
+ middle.y = centre.y + ( away > 0.0f ? dy / away * room : 0.0f );
+ }
+ const Int top = min( max( REAL_TO_INT( middle.y - height * 0.5f ), 0 ), (Int)( TheDisplay->getHeight() - height ) );
+ const Int nameLeft = min( max( REAL_TO_INT( middle.x ) - nameWidth / 2, 0 ), (Int)TheDisplay->getWidth() - nameWidth );
+ drawBroadcastPlate( name, nameLeft, top, shown );
+ if( under.pieces.empty() )
+ return;
+ const Int underLeft = min( max( REAL_TO_INT( middle.x ) - underWidth / 2, 0 ), (Int)TheDisplay->getWidth() - underWidth );
+ drawBroadcastPlate( under, underLeft, top + nameHeight, shown );
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
index 06760d309..000051556 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
@@ -130,9 +130,14 @@ static const UnsignedInt SPLIT_REST_FRAMES = 4 * LOGICFRAMES_PER_SECOND;
static const UnsignedInt PANE_RADAR_FRAMES = 12;
/// the panes take this long to slide in along the rays, and out again
static const UnsignedInt PANE_SLIDE_FRAMES = 15;
+/// then the gold draws out along the settled lines from where they meet, and the radar's frame round
+/// the map, for this long; it goes back in as long before the panes leave. Drawn while the panes
+/// slid, the lines were whole before the meeting point was on the screen and nothing was seen to draw
+static const UnsignedInt PANE_DRAW_FRAMES = 21;
+static const UnsignedInt PANE_UNDRAW_FRAMES = 15;
/// so a split, once on, stays on this long whatever its fights do, unless its panes come to show
/// the same ground: a split that went off before its panes were in flashed a pane in and out
-static const UnsignedInt SPLIT_LEAST_FRAMES = PANE_RADAR_FRAMES + PANE_SLIDE_FRAMES + SPLIT_HOLD_FRAMES;
+static const UnsignedInt SPLIT_LEAST_FRAMES = PANE_RADAR_FRAMES + PANE_SLIDE_FRAMES + PANE_DRAW_FRAMES + SPLIT_HOLD_FRAMES;
/// a split the timeline plans opens this long before its fight: at four seconds pane 1 sat on an
/// empty bridge
static const UnsignedInt SPLIT_LEAD_FRAMES = 3 * LOGICFRAMES_PER_SECOND;
@@ -142,10 +147,12 @@ static const UnsignedInt PANE_INTRO_FRAMES = 7 * LOGICFRAMES_PER_SECOND;
static const Real PANE_LINE_ROWS_A_PIXEL = 120.0f;
/// the soft band of the brand's blue under a line is this many times the gold's width
static const Int PANE_BAND_LINES = 5;
-/// as the panes come in a line grows out from the meeting point over this share of the slide, and its
-/// band fades in over the slide from this share of it, a beat behind; going out runs it backwards
+/// once the panes are in, a line grows out from the meeting point over this share of the draw, its
+/// band fades in from this share of it, a beat behind, and the radar's frame traces its gold round
+/// the map over this share; going back runs it all backwards
static const Real PANE_LINE_DRAWN_BY = 0.75f;
static const Real PANE_BAND_FROM = 0.35f;
+static const Real PANE_FRAME_TRACED_BY = 0.6f;
/// while the panes are held a light runs out along every gold line once in this many logic frames,
/// taking this many to reach the end
static const UnsignedInt PANE_SHIMMER_PERIOD = 5 * LOGICFRAMES_PER_SECOND;
@@ -1126,6 +1133,12 @@ Real ObserverCamera_bandShown( Real progress )
return easeBetween( progress, PANE_BAND_FROM, 1.0f );
}
+//-------------------------------------------------------------------------------------------------
+Real ObserverCamera_frameTraced( Real progress )
+{
+ return easeBetween( progress, 0.0f, PANE_FRAME_TRACED_BY );
+}
+
//-------------------------------------------------------------------------------------------------
Real ObserverCamera_shimmerAt( UnsignedInt frame )
{
@@ -1192,6 +1205,7 @@ void ObserverCamera::reset( void )
m_panesLeftPlace.x = m_panesLeftPlace.y = 0.0f;
m_paneCount = 0;
m_paneProgress = 0.0f;
+ m_lineProgress = 0.0f;
m_paneExit = 0.0f;
m_paneBaseZoom = 1.0f;
m_paneFitValid = FALSE;
@@ -1785,7 +1799,7 @@ void ObserverCamera::updateSplit( void )
//-------------------------------------------------------------------------------------------------
void ObserverCamera::advancePanes( UnsignedInt frame )
{
- static const char *const phaseNames[] = { "none", "radar out", "in", "held", "out", "radar in" };
+ static const char *const phaseNames[] = { "none", "radar out", "in", "draw", "held", "undraw", "out", "radar in" };
PanePhase next = m_panePhase;
const UnsignedInt elapsed = frame >= m_panePhaseStart ? frame - m_panePhaseStart : 0;
switch( m_panePhase )
@@ -1823,10 +1837,11 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
for( Int pane = 0; pane < players; pane++ )
m_panePlayers[ pane ] = found[ pane ];
m_paneCount = ObserverCamera_paneLayout( players, m_paneRays );
+ // the opening starts on the first view whole and opens into its panes like a split
if( m_paneCount >= 2 )
{
m_intro = TRUE;
- next = PANES_HELD;
+ next = PANES_RADAR_OUT;
}
}
else if( m_split )
@@ -1852,14 +1867,18 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
break;
case PANES_IN:
if( elapsed >= PANE_SLIDE_FRAMES )
+ next = PANES_DRAW;
+ break;
+ case PANES_DRAW:
+ if( elapsed >= PANE_DRAW_FRAMES )
next = PANES_HELD;
break;
case PANES_HELD:
if( m_intro ? elapsed >= PANE_INTRO_FRAMES : !m_split )
- next = PANES_OUT;
+ next = PANES_UNDRAW;
// the opening ends on pane 0's base and the director stays there until something happens;
// handed whatever sight it had come to meanwhile, it glided over empty ground to another base
- if( next == PANES_OUT && m_intro && ( !m_placeValid || m_placeKind == PLACE_SIGHT ) )
+ if( next == PANES_UNDRAW && m_intro && ( !m_placeValid || m_placeKind == PLACE_SIGHT ) )
{
m_place = m_paneSubject[ 0 ];
m_placeKind = PLACE_SIGHT;
@@ -1868,6 +1887,10 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
m_placeValid = TRUE;
}
break;
+ case PANES_UNDRAW:
+ if( elapsed >= PANE_UNDRAW_FRAMES )
+ next = PANES_OUT;
+ break;
case PANES_OUT:
if( elapsed >= PANE_SLIDE_FRAMES )
{
@@ -1905,10 +1928,18 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
m_paneProgress = ObserverCamera_easeFrames( frame, m_panePhaseStart, PANE_SLIDE_FRAMES );
m_cornerRadarSlide = 1.0f;
break;
+ case PANES_DRAW:
+ m_paneProgress = 1.0f;
+ m_cornerRadarSlide = 1.0f;
+ break;
case PANES_HELD:
m_paneProgress = 1.0f;
m_cornerRadarSlide = 1.0f;
break;
+ case PANES_UNDRAW:
+ m_paneProgress = 1.0f;
+ m_cornerRadarSlide = 1.0f;
+ break;
case PANES_OUT:
m_paneProgress = 1.0f - ObserverCamera_easeFrames( frame, m_panePhaseStart, PANE_SLIDE_FRAMES );
m_cornerRadarSlide = 1.0f;
@@ -1919,6 +1950,13 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
break;
}
+ // the gold draws on the panes once they have settled and goes back in before they leave
+ const UnsignedInt phaseFrames = frame >= m_panePhaseStart ? frame - m_panePhaseStart : 0;
+ m_lineProgress = m_panePhase == PANES_HELD ? 1.0f : 0.0f;
+ if( m_panePhase == PANES_DRAW )
+ m_lineProgress = min( (Real)phaseFrames / PANE_DRAW_FRAMES, 1.0f );
+ if( m_panePhase == PANES_UNDRAW )
+ m_lineProgress = 1.0f - min( (Real)phaseFrames / PANE_UNDRAW_FRAMES, 1.0f );
m_paneOrigin.x = TheDisplay->getWidth() * 0.5f;
m_paneOrigin.y = TheDisplay->getHeight() * 0.5f;
if( m_paneCount >= 2 )
@@ -2070,7 +2108,7 @@ void ObserverCamera::fitPanes( UnsignedInt frame )
const Bool mapLowers = wanted < fitted && wanted < m_paneFit[ pane ];
if( !m_paneFitValid )
m_paneFit[ pane ] = wanted;
- else if( moves && ( m_panePhase != PANES_HELD || wanted > m_paneFit[ pane ] || mapLowers ) )
+ else if( moves && ( !panesSettled() || wanted > m_paneFit[ pane ] || mapLowers ) )
m_paneFit[ pane ] += ( wanted - m_paneFit[ pane ] ) * PANE_FIT_FOLLOW;
}
m_paneFitValid = TRUE;
@@ -2625,10 +2663,11 @@ Bool ObserverCamera::chooseTarget( const ViewLocation &current, ViewLocation *ta
// the opening shows the first player's base in pane 0. Pane 0 keeps its place until the panes
// have gone: a split ends when the director moves onto the second fight, and pane 0 going there at
// once showed that fight twice while pane 1 slid out
- if( m_intro && m_panePhase == PANES_HELD )
+ if( m_intro && m_panePhase != PANES_OUT && m_panePhase != PANES_RADAR_IN )
place = m_paneSubject[ 0 ];
- const Bool panesUp = m_panePhase == PANES_IN || m_panePhase == PANES_HELD || m_panePhase == PANES_OUT;
- if( panesUp && ( m_panePhase == PANES_OUT || ( !m_split && !m_intro ) ) )
+ const Bool leaving = m_panePhase == PANES_UNDRAW || m_panePhase == PANES_OUT;
+ const Bool panesUp = m_panePhase == PANES_IN || panesSettled() || m_panePhase == PANES_OUT;
+ if( panesUp && ( leaving || ( !m_split && !m_intro ) ) )
place = m_panesLeftPlace;
else
m_panesLeftPlace = place;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index 71c4f7f6b..8a2c34a4e 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -434,18 +434,26 @@ static const UnsignedByte PANE_BAND_RGB[ 3 ] = { 0x80, 0x95, 0xea };
static const Real PANE_BAND_OUTER_ALPHA = 0.3f;
static const Real PANE_BAND_INNER_ALPHA = 0.55f;
static const Real PANE_BAND_FAR_SHARE = 0.35f;
-/// the light that runs along the gold: --gold half way to white, over this share of a line's length
-static const Color PANE_SHIMMER = GameMakeColor( 0xf9, 0xe0, 0x98, 255 );
-static const Real PANE_SHIMMER_SHARE = 0.12f;
+/// the light that runs along the gold: --gold most of the way to white, as wide as the edged line and
+/// this share of its length, fading out to both ends. At --gold half way to white and the gold's
+/// own width nobody saw it at 720p
+static const UnsignedByte PANE_SHIMMER_RGB[ 3 ] = { 0xff, 0xf6, 0xd8 };
+static const Real PANE_SHIMMER_SHARE = 0.18f;
+
+static Color paneShimmer( UnsignedByte alpha )
+{
+ return GameMakeColor( PANE_SHIMMER_RGB[ 0 ], PANE_SHIMMER_RGB[ 1 ], PANE_SHIMMER_RGB[ 2 ], alpha );
+}
static Color paneBand( Real alpha )
{
return GameMakeColor( PANE_BAND_RGB[ 0 ], PANE_BAND_RGB[ 1 ], PANE_BAND_RGB[ 2 ], (UnsignedByte)REAL_TO_INT( 255.0f * alpha ) );
}
-/** The rays between the panes, from their meeting point out, as far as they have grown: every ray's
- * band first, then every edge, then the gold, so the gold runs on unbroken where they meet. Held,
- * a light runs out along the gold now and then. */
+/** The rays between the panes, from their meeting point out: the dark edge whole from the start, so
+ * the seams read as the panes slide in, and the band and the gold as far as they have drawn out on
+ * the settled panes. Every ray's band first, then every edge, then the gold, so the gold runs on
+ * unbroken where they meet. Drawn, a light runs out along the gold now and then. */
static void drawPaneRays( void )
{
const Real gold = (Real)ObserverCamera_paneLineWidth( TheDisplay->getHeight() );
@@ -454,7 +462,7 @@ static void drawPaneRays( void )
const Coord2D origin = TheObserverCamera.getPaneOrigin();
const Real *rays = TheObserverCamera.getPaneRays();
const Int count = TheObserverCamera.getDrawnPaneCount();
- const Real progress = TheObserverCamera.getPaneProgress();
+ const Real progress = TheObserverCamera.getLineProgress();
const Real bandShown = ObserverCamera_bandShown( progress );
const Real drawn = ObserverCamera_lineDrawn( progress );
// the far end is past the farthest corner from the meeting point, wherever that has slid to
@@ -462,7 +470,8 @@ static void drawPaneRays( void )
const Real height = (Real)TheDisplay->getHeight();
const Real farX = max( fabsf( origin.x ), fabsf( width - origin.x ) );
const Real farY = max( fabsf( origin.y ), fabsf( height - origin.y ) );
- const Real length = sqrtf( farX * farX + farY * farY ) * drawn;
+ const Real whole = sqrtf( farX * farX + farY * farY );
+ const Real length = whole * drawn;
const Int fromX = REAL_TO_INT( origin.x );
const Int fromY = REAL_TO_INT( origin.y );
for( Int pass = 0; pass < 4; pass++ )
@@ -470,16 +479,19 @@ static void drawPaneRays( void )
for( Int ray = 0; ray < count; ray++ )
{
const Real angle = rays[ ray ] * PI / 180.0f;
- const Int toX = REAL_TO_INT( origin.x + cosf( angle ) * length );
- const Int toY = REAL_TO_INT( origin.y - sinf( angle ) * length );
+ const Real reach = pass == 2 ? whole : length;
+ const Int toX = REAL_TO_INT( origin.x + cosf( angle ) * reach );
+ const Int toY = REAL_TO_INT( origin.y - sinf( angle ) * reach );
if( pass == 0 && bandShown > 0.0f )
TheDisplay->drawLine( fromX, fromY, toX, toY, band, paneBand( PANE_BAND_OUTER_ALPHA * bandShown ),
paneBand( PANE_BAND_OUTER_ALPHA * bandShown * PANE_BAND_FAR_SHARE ) );
else if( pass == 1 && bandShown > 0.0f )
TheDisplay->drawLine( fromX, fromY, toX, toY, ( band + edged ) * 0.5f, paneBand( PANE_BAND_INNER_ALPHA * bandShown ),
paneBand( PANE_BAND_INNER_ALPHA * bandShown * PANE_BAND_FAR_SHARE ) );
- else if( pass >= 2 )
- TheDisplay->drawLine( fromX, fromY, toX, toY, pass == 2 ? edged : gold, pass == 2 ? PANE_EDGE : PANE_GOLD );
+ else if( pass == 2 )
+ TheDisplay->drawLine( fromX, fromY, toX, toY, edged, PANE_EDGE );
+ else if( pass == 3 && drawn > 0.0f )
+ TheDisplay->drawLine( fromX, fromY, toX, toY, gold, PANE_GOLD );
}
}
@@ -497,10 +509,10 @@ static void drawPaneRays( void )
const Real end = min( middle + half, length );
const Int middleX = REAL_TO_INT( origin.x + alongX * middle );
const Int middleY = REAL_TO_INT( origin.y + alongY * middle );
- TheDisplay->drawLine( REAL_TO_INT( origin.x + alongX * start ), REAL_TO_INT( origin.y + alongY * start ), middleX, middleY, gold,
- PANE_GOLD, PANE_SHIMMER );
- TheDisplay->drawLine( middleX, middleY, REAL_TO_INT( origin.x + alongX * end ), REAL_TO_INT( origin.y + alongY * end ), gold,
- PANE_SHIMMER, PANE_GOLD );
+ TheDisplay->drawLine( REAL_TO_INT( origin.x + alongX * start ), REAL_TO_INT( origin.y + alongY * start ), middleX, middleY, edged,
+ paneShimmer( 0 ), paneShimmer( 255 ) );
+ TheDisplay->drawLine( middleX, middleY, REAL_TO_INT( origin.x + alongX * end ), REAL_TO_INT( origin.y + alongY * end ), edged,
+ paneShimmer( 255 ), paneShimmer( 0 ) );
}
}
@@ -610,9 +622,9 @@ void W3DInGameUI::draw( void )
const Int halo = max( ( ObserverCamera_paneBandWidth( TheDisplay->getHeight() ) - frameGold ) / 2 - OBSERVER_PANE_LINE_EDGE, 0 );
if( framed )
{
- const Real progress = TheObserverCamera.getPaneProgress();
+ const Real progress = TheObserverCamera.getLineProgress();
const Real bandShown = ObserverCamera_bandShown( progress );
- const Real drawn = ObserverCamera_lineDrawn( progress );
+ const Real drawn = ObserverCamera_frameTraced( progress );
if( bandShown > 0.0f )
{
fillAround( corner, frameOutside + halo, paneBand( PANE_BAND_OUTER_ALPHA * bandShown ) );
diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.inc
index e0f884246..2dbd961f0 100644
--- a/GeneralsMD/Code/Tests/test_observer_camera.inc
+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc
@@ -346,9 +346,9 @@ TEST(the_recording_split_ends_at_once_when_the_two_halves_show_one_fight)
TEST(a_split_once_on_stays_until_its_panes_are_in_and_held_six_seconds)
{
const Real needed = 660.0f;
- // in through the radar's slide and the panes' and held six seconds, whatever the second fight does:
- // one that went off on the next scan slid a pane in and straight back out
- const UnsignedInt least = 12 + 15 + 6 * LOGICFRAMES_PER_SECOND;
+ // in through the radar's slide, the panes' and the lines' draw, and held six seconds, whatever the
+ // second fight does: one that went off on the next scan slid a pane in and straight back out
+ const UnsignedInt least = 12 + 15 + 21 + 6 * LOGICFRAMES_PER_SECOND;
CHECK( ObserverCamera_holdSplit( TRUE, 6.0f, 0.0f, 2000.0f, needed, 15 ) );
CHECK( ObserverCamera_holdSplit( TRUE, 6.0f, 0.0f, 2000.0f, needed, least - 1 ) );
CHECK( !ObserverCamera_holdSplit( TRUE, 6.0f, 0.0f, 2000.0f, needed, least ) );
@@ -902,8 +902,11 @@ TEST(the_score_bar_keeps_each_team_together_and_balances_its_two_columns)
TEST(the_pane_lines_grow_out_then_their_band_fades_in_and_a_light_runs_along_them)
{
- // the line is whole three quarters of the way through the slide, its band only at the end, and
- // the band has not begun while the line is still short
+ // the line is whole three quarters of the way through its draw, its band only at the end, and
+ // the band has not begun while the line is still short; the radar's frame goes round by 0.6
+ CHECK_NEAR( ObserverCamera_frameTraced( 0.0f ), 0.0f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_frameTraced( 0.6f ), 1.0f, 0.0001f );
+ CHECK( ObserverCamera_frameTraced( 0.3f ) > 0.3f && ObserverCamera_frameTraced( 0.3f ) < 0.7f );
CHECK_NEAR( ObserverCamera_lineDrawn( 0.0f ), 0.0f, 0.0001f );
CHECK_NEAR( ObserverCamera_lineDrawn( 0.75f ), 1.0f, 0.0001f );
CHECK_NEAR( ObserverCamera_lineDrawn( 1.0f ), 1.0f, 0.0001f );