Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameclient): keep director record panes on their own fights
Olcay Seygan407e72dd482b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex afd5970d0..45b83eac8 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. 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 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. 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. 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 (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. 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, 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 5eb2e8271..bf38cf5ae 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -1102,8 +1102,11 @@ public: // ********************************************************************virtual 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+ /// label in each pane of a split. Pane 0's draw alone; the recording takes these pixels from itvoid drawDirectorBroadcast( void );+ /// the opening's plate over the command centre of the player in the pane being drawn, in every+ /// pane's own draw+ void drawDirectorIntroPlate( void );//// One cameo of the global production strip: which producer it belongs to, which entry of thatdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.hindex 363909c40..9288bb80e 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h@@ -123,15 +123,19 @@ Bool ObserverCamera_worthFilming( const DirectorMoment &moment );/// rather than skipped as a fizzlevoid ObserverCamera_closeTimeline( std::vector< DirectorMoment > &moments, UnsignedInt end );/// the moment the director goes to wait at on frame: of the fights worth filming and the superweapons-/// that begin within the pre-roll after frame, a superweapon first and then the hottest. -1 for none-Int ObserverCamera_prerollMoment( const std::vector< DirectorMoment > &timeline, UnsignedInt frame );+/// that begin within the pre-roll after frame, a superweapon first and then the hottest, leaving out+/// any too near taken for a split to tell apart, the place another pane already shows (NULL for+/// none). -1 for none+Int ObserverCamera_prerollMoment( const std::vector< DirectorMoment > &timeline, UnsignedInt frame, const Coord2D *taken );/// whether the fight going on at place on frame is one the scouting pass saw fizzle, which the/// director does not cut to. FALSE where the pass saw nothing, so a match it did not scout is/// filmed as beforeBool ObserverCamera_fizzles( const std::vector< DirectorMoment > &timeline, const Coord2D &place, UnsignedInt frame );-/// a fight worth filming going on at frame, or beginning within the pre-roll, far enough from first-/// to want a pane of its own: the hottest such, where it begins; FALSE for none-Bool ObserverCamera_plannedSecond( const std::vector< DirectorMoment > &timeline, const Coord2D &first, UnsignedInt frame, Coord2D *second );+/// a fight worth filming beginning within the pre-roll after frame, or with keeping, the split up+/// already, one going on at frame, far enough from first to want a pane of its own: the hottest such,+/// -1 for none. A fight already going is not split for anew: where it began is only a guess at+/// where it is now, and a fight that had wandered off left pane 1 on empty ground+Int ObserverCamera_plannedSecond( const std::vector< DirectorMoment > &timeline, const Coord2D &first, UnsignedInt frame, Bool keeping );/// a moment as one line of the timeline file, and back; FALSE for a line that is not oneAsciiString ObserverCamera_formatMoment( const DirectorMoment &moment );Bool ObserverCamera_parseMoment( const char *line, DirectorMoment *moment );@@ -299,13 +303,17 @@ public: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 belowvoid setBroadcastTop( Real rows ) { m_broadcastTop = rows; }- /// a pane's circle where it is drawn this frame, slid with the rays' meeting point+ /// a pane's circle round its subject where that is drawn this frame, the panes part way in or outvoid getPaneCircle( Int pane, Coord2D *centre, Real *radius ) const;/// how far in the panes are, 0 to 1Real 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+ /// who a split's pane shows: everybody dealing or taking hits in its fight; 0 when nobody isPlayerMaskType getPaneSides( Int pane ) const;+ /// the panes are the match's opening, each one player's: his index, and the point over his command+ /// centre his plate hangs from, on the ground where his things crowd when he has none+ Bool isIntro( void ) const { return m_intro; }+ Int getIntroPlayerIndex( Int pane ) const;+ const Coord3D &getIntroMark( Int pane ) const { return m_paneMark[ pane ]; }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@@ -434,6 +442,7 @@ private:IRegion2D m_radarFrame;const Player *m_panePlayers[ OBSERVER_MOST_PANES ]; ///< the intro's player for each paneCoord2D m_paneSubject[ OBSERVER_MOST_PANES ]; ///< what each pane past the first looks at+ Coord3D m_paneMark[ OBSERVER_MOST_PANES ]; ///< the top of each opening player's command centreViewLocation m_paneGlide[ OBSERVER_MOST_PANES ]; ///< where each pane's subject glide has got toObserverCameraVelocity m_paneVelocity[ OBSERVER_MOST_PANES ];ViewLocation m_paneView[ OBSERVER_MOST_PANES ]; ///< each pane's camera for its drawdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex ddfda2f47..b3989d2b3 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -10524,11 +10524,11 @@ 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 );+// -directorrecord's broadcast is drawn in zerohour.gg's colours: the ground, its panel, ink, muted+// text, the line and the gold the pane lines are drawn in. The ground is opaque: at the site's veil+// the gold of the pane lines under it showed through the score bar's corners. The site sets words in+// Chivo and numbers in JetBrains Mono; Windows has neither, and these are the site's own fallbacks+static const Color BROADCAST_GROUND = GameMakeColor( 0x0c, 0x12, 0x20, 255 );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 );@@ -10570,6 +10570,73 @@ static Color broadcastFade( Color color, Real share )return GameMakeColor( red, green, blue, (UnsignedByte)REAL_TO_INT( alpha * share ) );}+/** A size given for the 720 row picture, in this picture's pixels and font points. */+static Int broadcastPixels( Real at720 )+{+ return max( REAL_TO_INT( at720 * ( TheDisplay->getHeight() / BROADCAST_ROWS ) ), 1 );+}++static Int broadcastPoints( Int at720 )+{+ return REAL_TO_INT( at720 * ( TheDisplay->getHeight() / BROADCAST_ROWS ) );+}++/** What the broadcast calls a player and what goes beside it. Every AI's name is its difficulty, so+ * a plate read "Hard AI vs Hard AI": an AI is called by its general, the difficulty beside it. */+static UnicodeString broadcastName( Player *player )+{+ return player->getPlayerType() == PLAYER_COMPUTER ? player->getPlayerTemplate()->getDisplayName() : player->getPlayerDisplayName();+}++static UnicodeString broadcastSide( Player *player )+{+ return player->getPlayerType() == PLAYER_COMPUTER ? player->getPlayerDisplayName() : player->getPlayerTemplate()->getDisplayName();+}++/// a label on the picture: pieces of text side by side, each its colour, on the ground with the gold+/// rule along its bottom+struct BroadcastPlate+{+ std::vector< DisplayString * > pieces;+ std::vector< Color > colors;+};++static void broadcastPlateSize( const BroadcastPlate &plate, Int *width, Int *height )+{+ Int textWidth = 0, textHeight = 0;+ for( size_t piece = 0; piece < plate.pieces.size(); piece++ )+ {+ Int pieceWidth = 0, pieceHeight = 0;+ plate.pieces[ piece ]->getSize( &pieceWidth, &pieceHeight );+ textWidth += pieceWidth + ( piece > 0 ? broadcastPixels( BROADCAST_GAP ) / 2 : 0 );+ textHeight = max( textHeight, pieceHeight );+ }+ *width = textWidth + 2 * broadcastPixels( BROADCAST_PAD );+ *height = textHeight + broadcastPixels( BROADCAST_PAD ) + broadcastPixels( BROADCAST_RULE );+}++/** The plate with its top left at left, top, faded to shown. */+static void drawBroadcastPlate( const BroadcastPlate &plate, Int left, Int top, Real shown )+{+ const Int pad = broadcastPixels( BROADCAST_PAD );+ const Int gap = broadcastPixels( BROADCAST_GAP );+ const Int rule = broadcastPixels( BROADCAST_RULE );+ Int width = 0, height = 0;+ broadcastPlateSize( plate, &width, &height );+ const Int textHeight = height - pad - rule;+ TheDisplay->drawFillRect( left, top, width, height, broadcastFade( BROADCAST_GROUND, shown ) );+ TheDisplay->drawFillRect( left, top + height - rule, width, rule, broadcastFade( BROADCAST_GOLD, shown ) );+ Int x = left + pad;+ for( size_t piece = 0; piece < plate.pieces.size(); piece++ )+ {+ Int pieceWidth = 0, pieceHeight = 0;+ plate.pieces[ piece ]->getSize( &pieceWidth, &pieceHeight );+ plate.pieces[ piece ]->draw( x, top + pad / 2 + ( textHeight - pieceHeight ) / 2, broadcastFade( plate.colors[ piece ], shown ),+ broadcastFade( BROADCAST_GROUND, shown ) );+ x += pieceWidth + gap / 2;+ }+}+//-------------------------------------------------------------------------------------------------DisplayString *InGameUI::broadcastText( const std::string &key, const UnicodeString &text, const char *font, Int points, Bool bold ){@@ -10601,8 +10668,8 @@ struct BroadcastRow* 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.+ * a split is up each pane carries a plate in the top of its circle, inside its wedge and clear of+ * the lines and the radar, naming the fight's players.* Everything is read off the players and their objects; nothing here writes the logic. *///-------------------------------------------------------------------------------------------------void InGameUI::drawDirectorBroadcast( void )@@ -10615,15 +10682,12 @@ void InGameUI::drawDirectorBroadcast( void )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 pad = broadcastPixels( BROADCAST_PAD );+ const Int gap = broadcastPixels( BROADCAST_GAP );+ const Int swatch = broadcastPixels( BROADCAST_SWATCH );+ const Int rowGap = broadcastPixels( BROADCAST_ROW_GAP );+ const Int rule = broadcastPixels( BROADCAST_RULE );+ const Int tug = broadcastPixels( BROADCAST_TUG );const Int teams = players.back().team + 1;size_t leftCount = ( players.size() + 1 ) / 2;@@ -10644,11 +10708,10 @@ void InGameUI::drawDirectorBroadcast( void )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 );+ row.name = broadcastText( "name" + seat, broadcastName( stats.player ), BROADCAST_WORDS, broadcastPoints( BROADCAST_NAME_POINTS ), TRUE );+ row.side = broadcastText( "side" + seat, broadcastSide( stats.player ), BROADCAST_WORDS, broadcastPoints( BROADCAST_SIDE_POINTS ), FALSE );+ row.cash = broadcastText( "cash" + seat, broadcastNumber( "$", stats.cash ), BROADCAST_NUMBERS, broadcastPoints( BROADCAST_NAME_POINTS ), TRUE );+ row.army = broadcastText( "army" + seat, broadcastNumber( "", stats.army ), BROADCAST_NUMBERS, broadcastPoints( BROADCAST_NAME_POINTS ), TRUE );Int width = 0, height = 0;row.name->getSize( &width, &height );nameWidth = max( nameWidth, width );@@ -10665,18 +10728,18 @@ void InGameUI::drawDirectorBroadcast( void )}DisplayString *cashHead = broadcastText( "cashhead", TheGameText->fetch( "GUI:HudStatCash" ), BROADCAST_NUMBERS,- points( BROADCAST_HEAD_POINTS ), FALSE );+ broadcastPoints( BROADCAST_HEAD_POINTS ), FALSE );DisplayString *armyHead = broadcastText( "armyhead", TheGameText->fetch( "GUI:HudStatArmy" ), BROADCAST_NUMBERS,- points( BROADCAST_HEAD_POINTS ), FALSE );+ broadcastPoints( 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 );+ DisplayString *clock = broadcastText( "clock", clockText, BROADCAST_NUMBERS, broadcastPoints( 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 thousandDisplayString *cashWidest = broadcastText( "cashwidest", broadcastNumber( "$", BROADCAST_WIDEST ), BROADCAST_NUMBERS,- points( BROADCAST_NAME_POINTS ), TRUE );+ broadcastPoints( BROADCAST_NAME_POINTS ), TRUE );DisplayString *armyWidest = broadcastText( "armywidest", broadcastNumber( "", BROADCAST_WIDEST ), BROADCAST_NUMBERS,- points( BROADCAST_NAME_POINTS ), TRUE );+ broadcastPoints( 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 );@@ -10767,74 +10830,85 @@ void InGameUI::drawDirectorBroadcast( void )TheObserverCamera.addBroadcast( bar );TheObserverCamera.setBroadcastTop( (Real)( height + pad ) );- // a plate a pane, faded in and out with the panes+ // a split's plate a pane, faded in and out with the panes; the opening's are each pane's ownconst Real shown = TheObserverCamera.getPaneProgress();- const Int panes = TheObserverCamera.getDrawnPaneCount();- DisplayString *versus = broadcastText( "versus", UnicodeString( u"vs" ), BROADCAST_WORDS, points( BROADCAST_SIDE_POINTS ), FALSE );+ const Int panes = TheObserverCamera.isIntro() ? 0 : TheObserverCamera.getDrawnPaneCount();+ DisplayString *versus = broadcastText( "versus", UnicodeString( u"vs" ), BROADCAST_WORDS, broadcastPoints( 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;+ BroadcastPlate plate;for( size_t index = 0; index < rows.size(); index++ ){if( ( rows[ index ].stats->player->getPlayerMask() & sides ) == 0 )continue;- if( !pieces.empty() )+ if( !plate.pieces.empty() ){- pieces.push_back( versus );- colors.push_back( BROADCAST_MUTED );+ plate.pieces.push_back( versus );+ plate.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 );+ plate.pieces.push_back( rows[ index ].name );+ plate.colors.push_back( rows[ index ].color );}- if( pieces.empty() )+ if( plate.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;+ Int plateWidth = 0, plateHeight = 0;+ broadcastPlateSize( plate, &plateWidth, &plateHeight );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;- }+ drawBroadcastPlate( plate, plateLeft, plateTop, shown );- IRegion2D plate;- plate.lo.x = plateLeft;- plate.lo.y = plateTop;- plate.hi.x = plateLeft + plateWidth;- plate.hi.y = plateTop + plateHeight;- TheObserverCamera.addBroadcast( plate );+ IRegion2D drawn;+ drawn.lo.x = plateLeft;+ drawn.lo.y = plateTop;+ drawn.hi.x = plateLeft + plateWidth;+ drawn.hi.y = plateTop + plateHeight;+ TheObserverCamera.addBroadcast( drawn );}}+//-------------------------------------------------------------------------------------------------+/** 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+ * 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. */+//-------------------------------------------------------------------------------------------------+void InGameUI::drawDirectorIntroPlate( void )+{+ const Real shown = TheObserverCamera.getPaneProgress();+ if( !TheObserverCamera.isIntro() || shown <= 0.0f )+ return;+ const Int pane = TheObserverCamera.getDrawingPane();+ ICoord2D over;+ if( TheTacticalView->worldToScreenTriReturn( &TheObserverCamera.getIntroMark( pane ), &over ) == View::WTS_INVALID )+ return;++ 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( 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 );+ }++ 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 );+}+//-------------------------------------------------------------------------------------------------void InGameUI::drawHudOverlay( void ){diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cppindex 0f8ff56f1..6d13f005a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp@@ -139,6 +139,9 @@ static const Real PANE_FIT_LEAST_EXTENT = 150.0f;static const Real PANE_INTRO_REACH = 500.0f;/// how much of the way to a new fit a pane's zoom goes each logic frame, about a second and a halfstatic const Real PANE_FIT_FOLLOW = 0.06f;+/// how far over a command centre's own height its player's plate hangs: the flags on a GLA palace+/// stand past it, and zoomed in they ran into the plate+static const Real PANE_MARK_LIFT = 15.0f;/// the scouting pass: a crowd of hits this near a fight still going is more of that fightstatic const Real SCOUT_SAME_FIGHT = 2.0f * DIRECTOR_GATHER_RADIUS;/// a fight with no crowd near it for this long is over; its hits stay hot DIRECTOR_HEAT_FRAMES on top@@ -773,7 +776,7 @@ void ObserverCamera_closeTimeline( std::vector< DirectorMoment > &moments, Unsig}//--------------------------------------------------------------------------------------------------Int ObserverCamera_prerollMoment( const std::vector< DirectorMoment > &timeline, UnsignedInt frame )+Int ObserverCamera_prerollMoment( const std::vector< DirectorMoment > &timeline, UnsignedInt frame, const Coord2D *taken ){Int best = -1;for( size_t index = 0; index < timeline.size(); index++ )@@ -783,6 +786,8 @@ Int ObserverCamera_prerollMoment( const std::vector< DirectorMoment > &timeline,continue;if( moment.power ? !moment.superweapon : !ObserverCamera_worthFilming( moment ) )continue;+ if( taken != NULL && within( moment.place, *taken, SPLIT_APART ) )+ continue;if( best >= 0 ){const DirectorMoment &held = timeline[ best ];@@ -818,7 +823,7 @@ Bool ObserverCamera_fizzles( const std::vector< DirectorMoment > &timeline, cons}//--------------------------------------------------------------------------------------------------Bool ObserverCamera_plannedSecond( const std::vector< DirectorMoment > &timeline, const Coord2D &first, UnsignedInt frame, Coord2D *second )+Int ObserverCamera_plannedSecond( const std::vector< DirectorMoment > &timeline, const Coord2D &first, UnsignedInt frame, Bool keeping ){Int best = -1;for( size_t index = 0; index < timeline.size(); index++ )@@ -826,15 +831,14 @@ Bool ObserverCamera_plannedSecond( const std::vector< DirectorMoment > &timelineconst DirectorMoment &fight = timeline[ index ];if( fight.power || !ObserverCamera_worthFilming( fight ) || frame + DIRECTOR_PREROLL_FRAMES < fight.start || frame > fight.last )continue;+ if( !keeping && frame >= fight.start )+ continue;if( within( fight.place, first, SPLIT_APART ) )continue;if( best < 0 || fight.peak > timeline[ best ].peak )best = (Int)index;}- if( best < 0 )- return FALSE;- *second = timeline[ best ].place;- return TRUE;+ return best;}//-------------------------------------------------------------------------------------------------@@ -956,6 +960,7 @@ void ObserverCamera::reset( void )m_paneRays[ pane ] = 0.0f;m_panePlayers[ pane ] = NULL;m_paneSubject[ pane ].x = m_paneSubject[ pane ].y = 0.0f;+ m_paneMark[ pane ].x = m_paneMark[ pane ].y = m_paneMark[ pane ].z = 0.0f;m_paneCentres[ pane ].x = m_paneCentres[ pane ].y = 0.0f;m_paneRadii[ pane ] = 0.0f;m_paneExtent[ pane ] = PANE_FIT_LEAST_EXTENT;@@ -1394,12 +1399,19 @@ void ObserverCamera::updateSplit( void )ObserverCamera_secondPlace( m_fights, m_place, &second, &secondHeat );if( secondHeat > 0.0f && ObserverCamera_fizzles( m_timeline, second, frame ) )secondHeat = 0.0f;- // the scouting pass knows the pairs: a second fight worth filming going on or about to begin far- // enough away splits the picture before its first shot, and keeps it split while it lasts- Coord2D planned;- const Bool plannedSplit = m_placeKind != PLACE_SIGHT && ObserverCamera_plannedSecond( m_timeline, m_place, frame, &planned );- if( plannedSplit && ( secondHeat <= 0.0f || !within( second, planned, SPLIT_APART ) ) )- second = planned;+ // the scouting pass knows the pairs: a second fight worth filming about to begin far enough away+ // splits the picture before its first shot, pane 1 waiting where it begins, and keeps it split+ // while it lasts. Once it is going it is wherever the hits are, and in a lull pane 1 stays put;+ // sent back to where it began, pane 1 sat on empty ground while the fight went on elsewhere. The+ // director that moved onto pane 1's fight has been handed it, and the split ends there: kept on+ // by the timeline, pane 1 went over to the fight pane 0 had just left+ const Bool handedOver = m_split && within( m_place, m_secondPlace, SPLIT_APART );+ const Int planned = m_placeKind != PLACE_SIGHT ? ObserverCamera_plannedSecond( m_timeline, m_place, frame, m_split ) : -1;+ const Bool plannedSplit = planned >= 0;+ if( plannedSplit && frame < m_timeline[ planned ].start && ( secondHeat <= 0.0f || !within( second, m_timeline[ planned ].place, SPLIT_APART ) ) )+ second = m_timeline[ planned ].place;+ else if( plannedSplit && secondHeat <= 0.0f )+ second = m_secondPlace;// the second fight is followed once it has moved a little, the way the director follows its ownCoord2D shown = m_secondPlace;@@ -1412,7 +1424,7 @@ void ObserverCamera::updateSplit( void )const Real apart = sqrtf( ax * ax + ay * ay );const UnsignedInt since = frame >= m_splitChanged ? frame - m_splitChanged : 0;- const Bool split = plannedSplit || ObserverCamera_holdSplit( m_split, firstHeat, secondHeat, apart, since );+ const Bool split = !handedOver && ( plannedSplit || ObserverCamera_holdSplit( m_split, firstHeat, secondHeat, apart, since ) );if( split != m_split ){DEBUG_LOG(( "OBSCAM frame %u split %s, first heat %.1f, second (%.0f,%.0f) heat %.1f, %.0f apart%s\n", frame,@@ -1483,6 +1495,16 @@ void ObserverCamera::advancePanes( UnsignedInt frame )case PANES_HELD:if( m_intro ? elapsed >= PANE_INTRO_FRAMES : !m_split )next = PANES_OUT;+ // 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 ) )+ {+ m_place = m_paneSubject[ 0 ];+ m_placeKind = PLACE_SIGHT;+ m_placeHeight = 0.0f;+ m_placeSince = frame;+ m_placeValid = TRUE;+ }break;case PANES_OUT:if( elapsed >= PANE_SLIDE_FRAMES )@@ -1575,7 +1597,7 @@ void ObserverCamera::updateIntroPlaces( void )//-------------------------------------------------------------------------------------------------/** The opening's subjects, fixed for the whole of it: each player's command centre, his start, or* where his things crowd when he has none. Following the crowd let a pane wander off after the- * first units to leave the base. */+ * first units to leave the base. His plate hangs from the top of the command centre. *///-------------------------------------------------------------------------------------------------void ObserverCamera::pickIntroBases( void ){@@ -1597,6 +1619,8 @@ void ObserverCamera::pickIntroBases( void )based[ pane ] = TRUE;m_paneSubject[ pane ].x = obj->getPosition()->x;m_paneSubject[ pane ].y = obj->getPosition()->y;+ m_paneMark[ pane ] = *obj->getPosition();+ m_paneMark[ pane ].z += obj->getGeometryInfo().getMaxHeightAbovePosition() + PANE_MARK_LIFT;}if( cost <= 0 )continue;@@ -1613,6 +1637,9 @@ void ObserverCamera::pickIntroBases( void )continue;Real heat = 0.0f;ObserverCamera_hottestPlace( sights[ pane ], &m_paneSubject[ pane ], &heat );+ m_paneMark[ pane ].x = m_paneSubject[ pane ].x;+ m_paneMark[ pane ].y = m_paneSubject[ pane ].y;+ m_paneMark[ pane ].z = TheTerrainLogic->getGroundHeight( m_paneSubject[ pane ].x, m_paneSubject[ pane ].y );}}@@ -1767,11 +1794,26 @@ Bool ObserverCamera::isBroadcast( Int x, Int y ) constreturn FALSE;}+//-------------------------------------------------------------------------------------------------+/** Where each pane's subject is drawn, the way update and stepPaneCameras put it: pane 0's moves from+ * the middle of the screen to its circle as the panes come in, every other pane's circle slides+ * with the meeting point. Moved with the meeting point as well, pane 0's label hung under its+ * subject while the panes slid, over the fight it was naming. *///-------------------------------------------------------------------------------------------------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;+ const Real middleX = TheDisplay->getWidth() * 0.5f;+ const Real middleY = TheDisplay->getHeight() * 0.5f;+ if( pane == 0 )+ {+ centre->x = middleX + ( m_paneCentres[ 0 ].x - middleX ) * m_paneProgress;+ centre->y = middleY + ( m_paneCentres[ 0 ].y - middleY ) * m_paneProgress;+ }+ else+ {+ centre->x = m_paneCentres[ pane ].x + m_paneOrigin.x - middleX;+ centre->y = m_paneCentres[ pane ].y + m_paneOrigin.y - middleY;+ }*radius = m_paneRadii[ pane ];}@@ -1781,8 +1823,6 @@ void ObserverCamera::getPaneCircle( Int pane, Coord2D *centre, Real *radius ) co//-------------------------------------------------------------------------------------------------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++ )@@ -1791,6 +1831,12 @@ PlayerMaskType ObserverCamera::getPaneSides( Int pane ) constreturn sides;}+//-------------------------------------------------------------------------------------------------+Int ObserverCamera::getIntroPlayerIndex( Int pane ) const+{+ return m_panePlayers[ pane ]->getPlayerIndex();+}+//-------------------------------------------------------------------------------------------------void ObserverCamera::beginPanePass( Int pane ){@@ -2101,7 +2147,8 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )m_placeKind = PLACE_FIGHT;m_placeSince = frame;}- const Int upcoming = timeline ? ObserverCamera_prerollMoment( m_timeline, frame ) : -1;+ // the fight pane 1 holds stays pane 1's: pane 0 going there swapped the two panes' subjects+ const Int upcoming = timeline ? ObserverCamera_prerollMoment( m_timeline, frame, m_split ? &m_secondPlace : NULL ) : -1;if( upcoming >= 0 && upcoming != m_placeMoment ){const DirectorMoment &moment = m_timeline[ upcoming ];@@ -2125,7 +2172,10 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )if( m_placeValid && m_placeKind == PLACE_FIGHT ){const Real heatHere = ObserverCamera_heatAround( hits, m_place, &followed );- if( heatHere > 0.0f && ( sameFight( hottest, followed ) || !ObserverCamera_shouldMove( heatHere, hottestHeat, held ) ) )+ // a split's pane 0 keeps its own fight while it goes on rather than take pane 1's; once it is+ // over the director moves there and the split ends, pane 1's fight handed to pane 0+ const Bool heldByPaneOne = m_split && within( hottest, m_secondPlace, SPLIT_APART );+ if( heatHere > 0.0f && ( sameFight( hottest, followed ) || heldByPaneOne || !ObserverCamera_shouldMove( heatHere, hottestHeat, held ) ) ){const Real dx = followed.x - m_place.x;const Real dy = followed.y - m_place.y;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex 5125129ea..efd86d20e 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -548,9 +548,14 @@ void W3DInGameUI::draw( void )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();+ // -directorrecord's opening plates, each pane's own, then the score bar and a split's labels over+ // everything and pane 0's alone like the lines+ if( TheGlobalData->m_directorRecord )+ {+ drawDirectorIntroPlate();+ if( !TheObserverCamera.isDrawingSecond() )+ drawDirectorBroadcast();+ }return;}diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.incindex 5740c89db..28be7aea8 100644--- a/GeneralsMD/Code/Tests/test_observer_camera.inc+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc@@ -654,14 +654,29 @@ TEST(the_director_goes_to_wait_for_a_fight_four_seconds_before_it_starts_superwetimeline.push_back( scoutedPower( 1020, 6000.0f, 1000.0f, FALSE ) );timeline.push_back( scoutedPower( 1100, 6000.0f, 3000.0f, TRUE ) );const UnsignedInt preroll = 4 * LOGICFRAMES_PER_SECOND;- CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1000 - preroll - 1 ), -1 );- CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1000 - preroll ), 0 );+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1000 - preroll - 1, NULL ), -1 );+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1000 - preroll, NULL ), 0 );// two coming up: the hotter- CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1050 - preroll ), 1 );+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1050 - preroll, NULL ), 1 );// a superweapon over any fight- CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1100 - preroll ), 4 );+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1100 - preroll, NULL ), 4 );// one that has started is no longer waited for- CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1100 ), -1 );+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1100, NULL ), -1 );+}++TEST(the_director_does_not_wait_for_the_fight_the_other_pane_already_shows)+{+ std::vector< DirectorMoment > timeline;+ timeline.push_back( scoutedFight( 1000, 1600, 1000.0f, 1000.0f, 6.0f ) );+ timeline.push_back( scoutedFight( 1050, 1600, 3000.0f, 3000.0f, 9.0f ) );+ const UnsignedInt preroll = 4 * LOGICFRAMES_PER_SECOND;+ // pane 1 waits at the hotter one: pane 0 takes the other+ Coord2D taken;+ taken.x = 3100.0f;+ taken.y = 3000.0f;+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1050 - preroll, &taken ), 0 );+ // and with nothing else coming up, none+ CHECK_EQ( ObserverCamera_prerollMoment( timeline, 1001, &taken ), -1 );}TEST(the_director_skips_only_a_fight_the_scout_saw_fizzle)@@ -694,13 +709,25 @@ TEST(the_recording_splits_before_a_known_second_fight_far_from_the_first)timeline.push_back( scoutedFight( 900, 1500, 6000.0f, 6000.0f, 2.0f ) );Coord2D first;first.x = first.y = 1000.0f;- Coord2D second;const UnsignedInt preroll = 4 * LOGICFRAMES_PER_SECOND;- CHECK( !ObserverCamera_plannedSecond( timeline, first, 1000 - preroll - 1, &second ) );- CHECK( ObserverCamera_plannedSecond( timeline, first, 1000 - preroll, &second ) );- CHECK_NEAR( second.x, 4000.0f, 0.001f );- CHECK( ObserverCamera_plannedSecond( timeline, first, 1500, &second ) );- CHECK( !ObserverCamera_plannedSecond( timeline, first, 1501, &second ) );+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 1000 - preroll - 1, FALSE ), -1 );+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 1000 - preroll, FALSE ), 0 );+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 1500, TRUE ), 0 );+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 1501, TRUE ), -1 );+}++TEST(the_recording_splits_ahead_for_a_fight_still_to_begin_and_not_anew_for_one_under_way)+{+ std::vector< DirectorMoment > timeline;+ timeline.push_back( scoutedFight( 5865, 6870, 1218.0f, 1689.0f, 15.2f ) );+ Coord2D first;+ first.x = 2346.0f;+ first.y = 1668.0f;+ // a split already up keeps the fight while it lasts+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 6451, TRUE ), 0 );+ // none up: where it began twenty seconds ago is no place to send a pane+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 6451, FALSE ), -1 );+ CHECK_EQ( ObserverCamera_plannedSecond( timeline, first, 5864, FALSE ), 0 );}TEST(a_timeline_line_reads_back_as_the_moment_it_was_written_from)