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(gameclient): split a 1v1 film only for two big fights at once

Olcay Seygan14caf9d946ca
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
index 5995f4085..3daf7b74b 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
@@ -168,10 +168,10 @@ void ObserverCamera_markLandings( std::vector< DirectorMoment > &moments, const
/// it did not see, so a match it did not scout waits for the hits
Bool ObserverCamera_powerLands( const std::vector< DirectorMoment > &timeline, UnsignedInt frame, const Coord2D &at );
/// whether the timeline has a fight worth filming near place, going on at frame or beginning within
-/// the pre-roll, that lasts to until, leaving out any that is also near besides, the place another
-/// pane already shows (NULL for none)
+/// the pre-roll, that lasts to until and peaked at least leastPeak, leaving out any that is also near
+/// besides, the place another pane already shows (NULL for none)
Bool ObserverCamera_fightLasts( const std::vector< DirectorMoment > &timeline, const Coord2D &place, UnsignedInt frame, UnsignedInt until,
- const Coord2D *besides );
+ const Coord2D *besides, Real leastPeak = 0.0f );
/// the scouting pass's fights as its run ends on frame end: one still going was cut short by the end
/// of the match, not by itself, and is counted as lasting, so a last battle that got hot is filmed
/// rather than skipped as a fizzle
@@ -266,6 +266,14 @@ Bool ObserverCamera_sidePlaces( const std::vector< DirectorHeat > *candidates, R
/// at once, however new, when the two places come within two thirds of needed and the two panes
/// would show the same ground
Bool ObserverCamera_holdSplit( Bool split, Real firstHeat, Real secondHeat, Real apart, Real needed, UnsignedInt framesSince );
+/// the same in a match of two, a pane each player, with apart 0 when no place was found for either.
+/// The opening's split goes on after SPLIT_REST_FRAMES whenever the two are further apart than needed
+/// and stays through SPLIT_LEAST_FRAMES, then up to SPLIT_MOST_FRAMES while fighting has either player
+/// in a fight and twice that while it has neither. Past the opening it goes on only for big, each
+/// player in a big fight of his own, and only SIDE_SPLIT_REST_FRAMES after the last one went off; it
+/// stays through SIDE_SPLIT_LEAST_FRAMES whatever happens, then while both players fight, up to
+/// SIDE_SPLIT_MOST_FRAMES
+Bool ObserverCamera_holdSideSplit( Bool split, Bool opening, Bool big, Int fighting, Real apart, Real needed, UnsignedInt framesSince );
/// -directorrecord's panes. The picture is cut by rays from one point, and pane i is the wedge from
/// ray i counterclockwise to ray i + 1. Angles are degrees, 0 to the right and 90 up the screen
@@ -365,8 +373,6 @@ Int ObserverCamera_paneBandWidth( Int height );
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( Real frame );
@@ -420,12 +426,10 @@ public:
const Real *getPaneRays( void ) const { return m_paneRays; }
/// where the rays meet on the screen, in pixels, which slides in from off the screen and back out
Coord2D getPaneOrigin( void ) const { return m_paneOrigin; }
- /// how far the radar in the bottom left corner is slid out to the left, 0 to 1
+ /// how far the radar in the middle of the bottom edge is slid down off the screen, 0 to 1
Real getCornerRadarSlide( void ) const { return m_cornerRadarSlide; }
- /// the radar framed on the rays' meeting point, pane 0's, while there are panes; its middle comes
- /// with the meeting point and goes off the screen with it
+ /// whether there are panes on the screen, which the radar is not drawn over
Bool isRadarFramed( void ) const { return m_paneCount >= 2 && m_paneProgress > 0.0f; }
- Coord2D getFramedRadarMiddle( Real radarDiagonal ) const;
/// the framed radar's rectangle as it was drawn, frame included: the recording takes it from pane 0
void setRadarFrame( const IRegion2D &frame ) { m_radarFrame = frame; }
const IRegion2D &getRadarFrame( void ) const { return m_radarFrame; }
@@ -442,8 +446,11 @@ public:
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
+ /// who a split's pane shows: everybody dealing or taking hits in its fight, and in a match of two
+ /// the pane's own player whatever he does; 0 when nobody is
PlayerMaskType getPaneSides( Int pane ) const;
+ /// who the director's fight on the whole screen is between; 0 when it shows no fight
+ PlayerMaskType getPlaceSides( void ) 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; }
@@ -451,8 +458,6 @@ public:
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 camera a pane past the first draws from; pane 0's is the view's own
- const ViewLocation &getPaneView( Int pane ) const { return m_paneView[ pane ]; }
/// the view moved to a pane's camera for one draw, and put back after it
void beginPanePass( Int pane );
void endPanePass( void );
@@ -497,6 +502,8 @@ private:
Region2D mapRegion( void ) const;
Bool updateSplit( void );
Bool updateSideSplit( void );
+ /// everybody dealing or taking the last scan's hits in the fight at subject
+ PlayerMaskType sidesAround( const Coord2D &subject ) const;
void measureScreenGround( void );
Real paneGround( const Coord2D &subject ) const;
Real splitApart( const Coord2D &second ) const;
@@ -592,6 +599,7 @@ private:
std::vector< PlayerMaskType > m_sightOwners; ///< and whose each of them is, 0 for nobody's
const Player *m_sidePlayers[ 2 ]; ///< a match of two: the opening's pane players, each split's pane 0 and pane 1 follow the same one
Coord2D m_sideFirst; ///< where pane 0's player is, the place the director holds while that split is up
+ Bool m_sideOpening; ///< the split up is the one the opening's panes went on as
std::vector< IRegion2D > m_broadcast; ///< the rectangles the broadcast drew over pane 0 this frame
Real m_broadcastTop; ///< the rows the score bar took
Real m_screenGround; ///< the ground the whole picture spans across its middle row, last measured with no panes up
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index dc982f813..3253af4a7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -10695,6 +10695,8 @@ static const Color BROADCAST_DEFEAT = GameMakeColor( 0xb8, 0x26, 0x1f, 255 );
static const Int BROADCAST_BANNER_POINTS = 16;
static const Int BROADCAST_BANNER_WORD_POINTS = 12;
static const Real BROADCAST_BANNER_FOOT = 0.7f;
+/// the whole screen's "X vs Y" plate comes and goes over this many logic frames
+static const Real BROADCAST_WHOLE_PLATE_FADE_FRAMES = 15.0f;
/** A banner's height with title over under, its rule included. */
static Int broadcastBannerHeight( const BroadcastPlate &title, const BroadcastPlate &under )
@@ -11117,8 +11119,8 @@ void InGameUI::drawDirectorBroadcast( void )
const Int frameEdge = frameGold + max( REAL_TO_INT( screenRows / BROADCAST_FRAME_EDGE_ROWS_A_PIXEL ), 1 );
const Int frameHalo = max( ( ObserverCamera_paneBandWidth( screenRows ) - lineGold ) / 2 - OBSERVER_PANE_LINE_EDGE, 0 ) / 2;
const Int frameReach = frameEdge + frameHalo;
- // while the screen is split the bar goes up off the top, frame and all, as the corner radar slides
- // out to the left, and comes back down as the radar comes back: the panes have the screen to
+ // while the screen is split the bar goes up off the top, frame and all, as the radar slides down
+ // off the bottom, and comes back down as the radar comes back: the panes have the screen to
// themselves. Everything the bar draws hangs from its layouts' rows, so lifting those lifts it
const Int lift = REAL_TO_INT( TheObserverCamera.getCornerRadarSlide() * ( max( from.height, to.height ) + frameReach ) );
auto liftLayout = [ lift ]( BroadcastLayout &l )
@@ -11396,7 +11398,8 @@ void InGameUI::drawDirectorBroadcast( void )
TheObserverCamera.addBroadcast( bar );
for( size_t flag = 0; flag < flagsDrawn.size(); flag++ )
TheObserverCamera.addBroadcast( flagsDrawn[ flag ] );
- TheObserverCamera.setBroadcastTop( (Real)max( height + frameReach + pad, 0 ) );
+ const Int barFoot = max( height + frameReach + pad, 0 );
+ TheObserverCamera.setBroadcastTop( (Real)barFoot );
static Int loggedHeight = -1;
if( !sliding && lift == 0 && height != loggedHeight )
{
@@ -11406,14 +11409,14 @@ void InGameUI::drawDirectorBroadcast( void )
from.cardWidth, from.fullCardWidth ));
}
- // a split's plate a pane, faded in and out with the panes; the opening's are each pane's own
+ // a split's plate a pane, faded in and out with the panes, and with no panes the director's fight's
+ // on the whole screen under the score bar; the opening's are each pane's own
const Real paneShown = TheObserverCamera.getPaneProgress();
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++ )
+ // a team of two or more by its name once, a player alone by his own
+ auto sidesPlate = [ & ]( PlayerMaskType sides ) -> BroadcastPlate
{
- const PlayerMaskType sides = TheObserverCamera.getPaneSides( pane );
- // a team of two or more by its name once, a player alone by his own
BroadcastPlate plate;
for( size_t block = 0; block < from.blockFirst.size(); block++ )
{
@@ -11436,25 +11439,68 @@ void InGameUI::drawDirectorBroadcast( void )
break;
}
}
+ return plate;
+ };
+ // each plate's sides are logged when they change, the whole screen's last, so a film's plates can
+ // be counted
+ static PlayerMaskType loggedSides[ OBSERVER_MOST_PANES + 1 ];
+ auto placePlate = [ & ]( Int slot, PlayerMaskType sides, const BroadcastPlate &plate, Int plateLeft, Int plateTop, Int plateWidth,
+ Int plateHeight, Real shown )
+ {
+ if( sides != loggedSides[ slot ] )
+ {
+ loggedSides[ slot ] = sides;
+ DEBUG_LOG(( "OBSCAM frame %u %s plate %d, %d name(s)%s\n", frame, slot < OBSERVER_MOST_PANES ? "pane" : "whole screen",
+ slot, (Int)( plate.pieces.size() + 1 ) / 2, plate.pieces.size() > 1 ? ", vs" : "" ));
+ }
+ drawBroadcastPlate( plate, plateLeft, plateTop, shown );
+ IRegion2D drawn;
+ drawn.lo.x = plateLeft;
+ drawn.lo.y = plateTop;
+ drawn.hi.x = plateLeft + plateWidth;
+ drawn.hi.y = plateTop + plateHeight;
+ TheObserverCamera.addBroadcast( drawn );
+ };
+ for( Int pane = 0; pane < OBSERVER_MOST_PANES; pane++ )
+ {
+ const PlayerMaskType sides = pane < panes && panes >= 2 ? TheObserverCamera.getPaneSides( pane ) : 0;
+ const BroadcastPlate plate = sidesPlate( sides );
if( plate.pieces.empty() )
+ {
+ loggedSides[ pane ] = 0;
continue;
-
+ }
Int plateWidth = 0, plateHeight = 0;
broadcastPlateSize( plate, &plateWidth, &plateHeight );
Coord2D centre;
Real radius = 0.0f;
TheObserverCamera.getPaneCircle( pane, &centre, &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;
- drawBroadcastPlate( plate, plateLeft, plateTop, paneShown );
-
- IRegion2D drawn;
- drawn.lo.x = plateLeft;
- drawn.lo.y = plateTop;
- drawn.hi.x = plateLeft + plateWidth;
- drawn.hi.y = plateTop + plateHeight;
- TheObserverCamera.addBroadcast( drawn );
+ placePlate( pane, sides, plate, REAL_TO_INT( centre.x ) - plateWidth / 2, plateTop, plateWidth, plateHeight, paneShown );
+ }
+ // the whole screen's plate names a fight between two sides or more, fades in over the panes' slide
+ // and out again keeping the names it had
+ static PlayerMaskType wholeSides = 0;
+ static Real wholeShown = 0.0f;
+ static Real wholeShownAt = 0.0f;
+ const Real picture = GameEngine_pictureFrame();
+ const PlayerMaskType placeSides = panes == 1 ? TheObserverCamera.getPlaceSides() : 0;
+ const Bool fightShown = sidesPlate( placeSides ).pieces.size() > 1;
+ if( fightShown )
+ wholeSides = placeSides;
+ const Real wholeStep = max( picture - wholeShownAt, 0.0f ) / BROADCAST_WHOLE_PLATE_FADE_FRAMES;
+ wholeShownAt = picture;
+ wholeShown = fightShown ? min( wholeShown + wholeStep, 1.0f ) : max( wholeShown - wholeStep, 0.0f );
+ if( wholeShown > 0.0f )
+ {
+ const BroadcastPlate plate = sidesPlate( wholeSides );
+ Int plateWidth = 0, plateHeight = 0;
+ broadcastPlateSize( plate, &plateWidth, &plateHeight );
+ placePlate( OBSERVER_MOST_PANES, wholeSides, plate, ( TheDisplay->getWidth() - plateWidth ) / 2, barFoot, plateWidth, plateHeight,
+ wholeShown );
}
+ else
+ loggedSides[ OBSERVER_MOST_PANES ] = 0;
// a defeated player's banner across the lower picture, the broadcast's red in its tab, and once the
// match is decided the winner's under it in gold. A banner names the player in his colour, under it
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
index efadf1fdf..86b9e56b7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
@@ -157,7 +157,7 @@ static const UnsignedInt SPLIT_HOLD_FRAMES = 6 * LOGICFRAMES_PER_SECOND;
static const Real SPLIT_STAY_SHARE = 0.25f;
/// once the picture is whole again it stays whole this long, so it does not flicker between the two
static const UnsignedInt SPLIT_REST_FRAMES = 4 * LOGICFRAMES_PER_SECOND;
-/// the corner radar takes this long to slide out to the left before the panes come, and back after
+/// the radar takes this long to slide down off the screen before the panes come, and back after
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;
@@ -172,6 +172,22 @@ static const UnsignedInt SPLIT_LEAST_FRAMES = PANE_RADAR_FRAMES + PANE_SLIDE_FRA
/// 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;
+/// a match of two, past the opening's split: the picture splits only for a big moment, each player
+/// in a fight of his own, his own fire there at least this hot, far from the other's. Split whenever
+/// the two were far apart, S1-A1 went to panes and back 40 times in its first 24000 frames, mostly
+/// for a few hits
+static const Real SIDE_SPLIT_ENTER_HEAT = 3.0f;
+/// and, with a timeline, each fight one the scouting pass saw peak at least this hot, twice what is
+/// worth filming at all, and last through the split's least hold. S1-A1's timeline has five such
+/// pairs in 57700 frames
+static const Real SIDE_SPLIT_PEAK = 8.0f;
+/// such a split is held this long once its panes are in, whatever its fights do, then while both
+/// players fight, up to the most
+static const UnsignedInt SIDE_SPLIT_HOLD_FRAMES = 15 * LOGICFRAMES_PER_SECOND;
+static const UnsignedInt SIDE_SPLIT_LEAST_FRAMES = PANE_RADAR_FRAMES + PANE_SLIDE_FRAMES + PANE_DRAW_FRAMES + SIDE_SPLIT_HOLD_FRAMES;
+static const UnsignedInt SIDE_SPLIT_MOST_FRAMES = 40 * LOGICFRAMES_PER_SECOND;
+/// and after one the picture stays whole at least this long
+static const UnsignedInt SIDE_SPLIT_REST_FRAMES = 120 * LOGICFRAMES_PER_SECOND;
/// the match opens on every player's base, one pane each, for this long
static const UnsignedInt PANE_INTRO_FRAMES = 7 * LOGICFRAMES_PER_SECOND;
/// the gold of a line between panes is a pixel for every this many rows of the picture
@@ -179,11 +195,9 @@ 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;
/// 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
+/// band fades in from this share of it, a beat behind; 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;
@@ -583,6 +597,22 @@ Bool ObserverCamera_holdSplit( Bool split, Real firstHeat, Real secondHeat, Real
&& secondHeat >= firstHeat * SPLIT_ENTER_SHARE;
}
+//-------------------------------------------------------------------------------------------------
+Bool ObserverCamera_holdSideSplit( Bool split, Bool opening, Bool big, Int fighting, Real apart, Real needed, UnsignedInt framesSince )
+{
+ if( split && framesSince < ( opening ? SPLIT_LEAST_FRAMES : SIDE_SPLIT_LEAST_FRAMES ) )
+ return TRUE;
+ if( apart <= needed )
+ return FALSE;
+ if( split && opening )
+ return framesSince < ( fighting > 0 ? SPLIT_MOST_FRAMES : 2 * SPLIT_MOST_FRAMES );
+ if( split )
+ return fighting == 2 && framesSince < SIDE_SPLIT_MOST_FRAMES;
+ if( opening )
+ return framesSince >= SPLIT_REST_FRAMES;
+ return big && framesSince >= SIDE_SPLIT_REST_FRAMES;
+}
+
//-------------------------------------------------------------------------------------------------
/** How much of a picture half w wide and half h high round its middle a ray sweeping counterclockwise
* from 0 has covered by angle degrees. In each quarter the swept part is a triangle against the near
@@ -1308,12 +1338,13 @@ static Bool scoutedNear( const DirectorMoment &fight, const Coord2D &place )
//-------------------------------------------------------------------------------------------------
Bool ObserverCamera_fightLasts( const std::vector< DirectorMoment > &timeline, const Coord2D &place, UnsignedInt frame, UnsignedInt until,
- const Coord2D *besides )
+ const Coord2D *besides, Real leastPeak )
{
for( size_t index = 0; index < timeline.size(); index++ )
{
const DirectorMoment &fight = timeline[ index ];
- if( fight.power || !ObserverCamera_worthFilming( fight ) || frame + DIRECTOR_PREROLL_FRAMES < fight.start || fight.last < until )
+ if( fight.power || !ObserverCamera_worthFilming( fight ) || fight.peak < leastPeak || frame + DIRECTOR_PREROLL_FRAMES < fight.start
+ || fight.last < until )
continue;
if( scoutedNear( fight, place ) && ( besides == NULL || !scoutedNear( fight, *besides ) ) )
return TRUE;
@@ -1407,11 +1438,6 @@ Real ObserverCamera_bandShown( Real progress )
return ObserverCamera_easeBetween( progress, PANE_BAND_FROM, 1.0f );
}
-//-------------------------------------------------------------------------------------------------
-Real ObserverCamera_frameTraced( Real progress )
-{
- return ObserverCamera_easeBetween( progress, 0.0f, PANE_FRAME_TRACED_BY );
-}
//-------------------------------------------------------------------------------------------------
Real ObserverCamera_shimmerAt( Real frame )
@@ -1540,6 +1566,7 @@ void ObserverCamera::reset( void )
m_sightOwners.clear();
m_sidePlayers[ 0 ] = m_sidePlayers[ 1 ] = NULL;
m_sideFirst.x = m_sideFirst.y = 0.0f;
+ m_sideOpening = FALSE;
m_broadcast.clear();
m_broadcastTop = 0.0f;
m_screenGround = 0.0f;
@@ -2282,11 +2309,13 @@ Bool ObserverCamera::updateSplit( void )
/** -directorrecord in a match of two: a pane each player, pane 0 always the opening's pane 0 player
* and pane 1 the other, so the two sides keep their halves of the screen from the opening on. What
* a player is doing is where his own fire falls, or with none his base and his army on the move.
- * The split is up whenever the two are far enough apart, the opening's panes handing straight over
- * to it, and the director follows pane 0's player while it is. It goes when a pane's player turns
- * to something somewhere else, when the two come together (one fight both are in, which the whole
- * screen shows), or after SPLIT_MOST_FRAMES with a fight in it and twice that without, so the
- * director gets its turn. TRUE when it moved the director. */
+ * The opening's panes hand straight over to the split, which stays while the two are far enough
+ * apart, up to SPLIT_MOST_FRAMES with a fight in it and twice that without. After that the
+ * picture splits again only for a big moment, both players each in a hot fight of his own far from
+ * the other's, with long rests between (ObserverCamera_holdSideSplit), and the director follows
+ * pane 0's player while it is up. A split also goes when a pane's player turns to something
+ * somewhere else, or when the two come together (one fight both are in, which the whole screen
+ * shows). TRUE when it moved the director. */
//-------------------------------------------------------------------------------------------------
Bool ObserverCamera::updateSideSplit( void )
{
@@ -2311,22 +2340,36 @@ Bool ObserverCamera::updateSideSplit( void )
const UnsignedInt since = frame >= m_splitChanged ? frame - m_splitChanged : 0;
const Real sameGround = needed * SPLIT_SAME_GROUND_SHARE;
- Bool split = found && apart > needed && ( m_split || since >= SPLIT_REST_FRAMES );
- if( m_split && since >= SPLIT_LEAST_FRAMES )
+ // past the opening, a big moment: both players fighting hot, far apart, and with a timeline two
+ // fights the scouting pass saw get big and last through the least hold
+ const Bool opening = m_split ? m_sideOpening : m_intro;
+ const Int fightingPlayers = ( fighting[ 0 ] ? 1 : 0 ) + ( fighting[ 1 ] ? 1 : 0 );
+ Bool big = !m_split && !opening && found && fightingPlayers == 2 && min( heats[ 0 ], heats[ 1 ] ) >= SIDE_SPLIT_ENTER_HEAT;
+ if( big && !m_timeline.empty() )
+ {
+ const UnsignedInt heldTo = frame + SIDE_SPLIT_LEAST_FRAMES;
+ big = ObserverCamera_fightLasts( m_timeline, places[ 0 ], frame, heldTo, &places[ 1 ], SIDE_SPLIT_PEAK )
+ && ObserverCamera_fightLasts( m_timeline, places[ 1 ], frame, heldTo, &places[ 0 ], SIDE_SPLIT_PEAK );
+ }
+ Bool split = ObserverCamera_holdSideSplit( m_split, opening, big, fightingPlayers, found ? apart : 0.0f, needed, since );
+ // a special power directorPlace went to ends the split at once, and none opens while it is shown
+ if( m_placeValid && m_placeKind == PLACE_EVENT )
+ {
+ if( m_split )
+ DEBUG_LOG(( "OBSCAM frame %u split ends: a special power\n", frame ));
+ split = FALSE;
+ }
+ if( m_split && split && since >= ( opening ? SPLIT_LEAST_FRAMES : SIDE_SPLIT_LEAST_FRAMES ) )
{
- const Bool fight = fighting[ 0 ] || fighting[ 1 ];
- const Bool upTooLong = since >= ( fight ? SPLIT_MOST_FRAMES : 2 * SPLIT_MOST_FRAMES );
const Bool paneZeroLeft = found && !within( places[ 0 ], m_sideFirst, sameGround );
const Bool paneOneLeft = found && !within( places[ 1 ], m_secondPlace, sameGround );
- if( split && ( upTooLong || paneZeroLeft || paneOneLeft ) )
+ if( paneZeroLeft || paneOneLeft )
{
- DEBUG_LOG(( "OBSCAM frame %u split ends:%s%s%s\n", frame, upTooLong ? " up too long" : "",
+ DEBUG_LOG(( "OBSCAM frame %u split ends:%s%s\n", frame,
paneZeroLeft ? " pane 0's player turned elsewhere" : "", paneOneLeft ? " pane 1's player turned elsewhere" : "" ));
split = FALSE;
}
}
- else if( m_split )
- split = TRUE;
if( split != m_split )
{
@@ -2340,6 +2383,7 @@ Bool ObserverCamera::updateSideSplit( void )
m_paneSurvivor = 0;
if( split )
{
+ m_sideOpening = m_intro;
m_sideFirst = places[ 0 ];
m_secondPlace = places[ 1 ];
}
@@ -2365,9 +2409,9 @@ Bool ObserverCamera::updateSideSplit( void )
}
//-------------------------------------------------------------------------------------------------
-/** The panes' timeline, on logic frames, which is what each recorded picture is. A split: the corner
- * radar slides out, the second pane slides in along the diagonal with the framed radar on its
- * corner, and it all goes back the same way when the split ends. The match opens with a pane a
+/** The panes' timeline, on logic frames, which is what each recorded picture is. A split: the radar
+ * slides down off the screen, the second pane slides in along the diagonal, and it all goes back
+ * the same way when the split ends. The match opens with a pane a
* player, held a few seconds and then slid away to leave pane 0. */
//-------------------------------------------------------------------------------------------------
void ObserverCamera::advancePanes( UnsignedInt frame )
@@ -2775,21 +2819,6 @@ void ObserverCamera::stepPaneCameras( const ViewLocation &step, Real elapsedSeco
}
}
-//-------------------------------------------------------------------------------------------------
-/** On the meeting point when the panes are all in, and far enough out along its way off the screen,
- * the radar's own size further, that none of it shows when they have gone. */
-//-------------------------------------------------------------------------------------------------
-Coord2D ObserverCamera::getFramedRadarMiddle( Real radarDiagonal ) const
-{
- const Coord2D away = ObserverCamera_paneExitDirection( m_paneRays );
- const Real side = m_paneSurvivor == 1 ? -1.0f : 1.0f;
- const Real out = side * ( 1.0f - m_paneProgress ) * ( m_paneExit + radarDiagonal );
- Coord2D middle;
- middle.x = TheDisplay->getWidth() * 0.5f + away.x * out;
- middle.y = TheDisplay->getHeight() * 0.5f + away.y * out;
- return middle;
-}
-
//-------------------------------------------------------------------------------------------------
/** 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
@@ -2817,12 +2846,8 @@ void ObserverCamera::getPaneCircle( Int pane, Coord2D *centre, Real *radius ) co
/** A split's two panes show the fights at the director's place and at the second one, and their
* sides are every player in the hits within the gather radius of each. */
//-------------------------------------------------------------------------------------------------
-PlayerMaskType ObserverCamera::getPaneSides( Int pane ) const
+PlayerMaskType ObserverCamera::sidesAround( const Coord2D &subject ) const
{
- // a match of two names each pane's own player
- if( m_sidePlayers[ 0 ] != NULL && pane < 2 )
- return m_sidePlayers[ pane ]->getPlayerMask();
- const Coord2D &subject = pane == 0 ? m_panesLeftPlace : m_secondPlace;
PlayerMaskType sides = 0;
for( size_t index = 0; index < m_fights.size(); index++ )
if( sameFight( m_fights[ index ].position, subject ) )
@@ -2830,6 +2855,21 @@ PlayerMaskType ObserverCamera::getPaneSides( Int pane ) const
return sides;
}
+//-------------------------------------------------------------------------------------------------
+PlayerMaskType ObserverCamera::getPaneSides( Int pane ) const
+{
+ // a match of two names each pane's own player, and whoever he is fighting there: named alone, the
+ // "X vs Y" plate never showed in a 1v1 film
+ const PlayerMaskType own = m_sidePlayers[ 0 ] != NULL && pane < 2 ? m_sidePlayers[ pane ]->getPlayerMask() : 0;
+ return own | sidesAround( pane == 0 ? m_panesLeftPlace : m_secondPlace );
+}
+
+//-------------------------------------------------------------------------------------------------
+PlayerMaskType ObserverCamera::getPlaceSides( void ) const
+{
+ return m_placeValid && m_placeKind == PLACE_FIGHT ? sidesAround( m_place ) : 0;
+}
+
//-------------------------------------------------------------------------------------------------
Int ObserverCamera::getIntroPlayerIndex( Int pane ) const
{
@@ -3087,12 +3127,10 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )
m_fightSources = sources;
m_sights = sights;
m_sightOwners = sightOwners;
- // a split a pane each player holds the director on pane 0's player; updateSideSplit moves it
- if( m_split && m_sidePlayers[ 0 ] != NULL && narrowTo == NULL )
- {
- *place = m_place;
- return TRUE;
- }
+ // a split a pane each player holds the director on pane 0's player, and updateSideSplit moves it,
+ // unless a special power lands: that ends the split and is shown on the whole screen. Held on
+ // pane 0's player, the director missed the particle cannon in S1-A1
+ const Bool sideSplit = m_split && m_sidePlayers[ 0 ] != NULL && narrowTo == NULL;
Coord2D hottest;
Real hottestHeat = 0.0f;
@@ -3142,10 +3180,10 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )
}
// an event that just ended hands straight over to the next; anything else is given its settle
// first, except a superweapon still leaving its silo
- if( best != NULL && ( !m_placeValid || m_placeKind == PLACE_EVENT || ObserverCamera_eventCutsIn( *best, frame, held ) ) )
+ if( best != NULL && ( sideSplit || !m_placeValid || m_placeKind == PLACE_EVENT || ObserverCamera_eventCutsIn( *best, frame, held ) ) )
{
- DEBUG_LOG(( "OBSCAM frame %u director to special power %u at (%.0f,%.0f)%s\n", frame, best->id,
- best->target.x, best->target.y, best->superweapon ? " superweapon" : "" ));
+ DEBUG_LOG(( "OBSCAM frame %u director to special power %u at (%.0f,%.0f)%s%s\n", frame, best->id,
+ best->target.x, best->target.y, best->superweapon ? " superweapon" : "", sideSplit ? ", out of the split" : "" ));
m_place = ObserverCamera_eventPlace( *best, frame );
m_placeKind = PLACE_EVENT;
m_placeHeight = 0.0f;
@@ -3155,6 +3193,11 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )
*place = m_place;
return TRUE;
}
+ if( sideSplit )
+ {
+ *place = m_place;
+ return TRUE;
+ }
// a fight the scouting pass saw begin is waited for where it begins, so the picture has it from
// the first shot; it becomes an ordinary fight when it starts. It is gone to from nothing, from a
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h
index 05fa221d6..4ba98262a 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h
@@ -97,7 +97,6 @@ protected:
void cacheLandmarks( void ); ///< rebuild the landmark list from both object lists
void collectLandmarks( const RadarObject *listHead ); ///< add the landmarks of one list to the cache
void drawViewBox( Int pixelX, Int pixelY, Int width, Int height ); ///< draw view box
- void drawPaneBox( Int pane, Int pixelX, Int pixelY, Int width, Int height ); ///< -directorrecord: one pane's view box
void drawBoxLines( const ICoord2D *corners ); ///< a view box's lines through its four corners in pixels
void buildTerrainTexture( TerrainLogic *terrain ); ///< create the terrain texture of the radar
void drawIcons( Int pixelX, Int pixelY, Int width, Int height ); ///< draw all of the radar icons
@@ -137,8 +136,6 @@ protected:
//
Bool m_reconstructViewBox; ///< true when we need to reconstruct the box
ICoord2D m_viewBox[ 4 ]; ///< radar cell points for the 4 corners of view box
- Int m_viewBoxesDrawn; ///< how many view boxes the last draw had, one a -directorrecord pane
- UnsignedInt m_paneBoxLogged[ OBSERVER_MOST_PANES ]; ///< the logic frame each pane's box was last logged on
// By value, not by pointer into the object. The list is rebuilt every OVERLAY_REFRESH_RATE
// frames and read on every one of them, so a hero killed in between left a pointer into a
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
index 2b85ecec7..6a702c9d6 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
@@ -495,59 +495,6 @@ void W3DRadar::drawBoxLines( const ICoord2D *corners )
}
}
-//-------------------------------------------------------------------------------------------------
-/** -directorrecord's box for one pane: the square round the circle the pane fits its subject in,
- * put on the ground through that pane's own camera. The view is moved to a pane past the first
- * for the four corners and put back, the way GameClient's pane pass moves it for a draw */
-//-------------------------------------------------------------------------------------------------
-void W3DRadar::drawPaneBox( Int pane, Int pixelX, Int pixelY, Int width, Int height )
-{
- Coord2D centre;
- Real radius = 0.0f;
- TheObserverCamera.getPaneCircle( pane, &centre, &radius );
- // setLocation only stores the place; the picks below go through the W3D camera, which the draw
- // builds, so it is aimed here as ObserverCamera::aimView does. Without it pane 1's box was pane
- // 0's camera picked at pane 1's circle, and in S1-A1's opening both boxes sat on the top base
- ViewLocation own;
- if( pane != 0 )
- {
- TheTacticalView->getLocation( &own );
- TheTacticalView->setLocation( &TheObserverCamera.getPaneView( pane ) );
- TheTacticalView->aimCamera();
- }
- const Real sideX[ 4 ] = { -1.0f, 1.0f, 1.0f, -1.0f };
- const Real sideY[ 4 ] = { -1.0f, -1.0f, 1.0f, 1.0f };
- ICoord2D corners[ 4 ];
- Coord2D middle = { 0.0f, 0.0f };
- for( Int corner = 0; corner < 4; corner++ )
- {
- ICoord2D screen;
- screen.x = REAL_TO_INT( centre.x + sideX[ corner ] * radius );
- screen.y = REAL_TO_INT( centre.y + sideY[ corner ] * radius );
- Coord3D world;
- TheTacticalView->screenToWorldAtZ( &screen, &world, getTerrainAverageZ() );
- middle.x += world.x * 0.25f;
- middle.y += world.y * 0.25f;
- ICoord2D radar;
- radar.x = world.x / ( m_mapExtent.width() / RADAR_CELL_WIDTH );
- radar.y = world.y / ( m_mapExtent.height() / RADAR_CELL_HEIGHT );
- radarToPixel( &radar, &corners[ corner ], pixelX, pixelY, width, height );
- }
- if( pane != 0 )
- {
- TheTacticalView->setLocation( &own );
- TheTacticalView->aimCamera();
- }
- // a second a box, to set against the OBSCAM pane subject lines
- const UnsignedInt frame = TheGameLogic->getFrame();
- if( frame % LOGICFRAMES_PER_SECOND == 0 && frame != m_paneBoxLogged[ pane ] )
- {
- m_paneBoxLogged[ pane ] = frame;
- DEBUG_LOG(( "RADAR frame %u pane %d box round (%.0f,%.0f)\n", frame, pane, middle.x, middle.y ));
- }
- drawBoxLines( corners );
-}
-
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
void W3DRadar::drawSingleBeaconEvent( Int pixelX, Int pixelY, Int width, Int height, Int index )
@@ -1034,9 +981,6 @@ W3DRadar::W3DRadar( void )
m_textureHeight = RADAR_CELL_HEIGHT;
m_reconstructViewBox = TRUE;
- m_viewBoxesDrawn = 1;
- for( Int pane = 0; pane < OBSERVER_MOST_PANES; pane++ )
- m_paneBoxLogged[ pane ] = 0;
for( Int i = 0; i < 4; i++ )
{
@@ -1649,21 +1593,9 @@ void W3DRadar::draw( Int pixelX, Int pixelY, Int width, Int height )
if( m_reconstructViewBox )
reconstructViewBox();
- // -directorrecord's panes, the opening's included, each get a box of their own; the one view box
- // stood for pane 0 alone while the other half of the screen showed somewhere else
- const Int boxes = TheGlobalData->m_directorRecord ? TheObserverCamera.getDrawnPaneCount() : 1;
- if( boxes != m_viewBoxesDrawn )
- {
- DEBUG_LOG(( "RADAR frame %u %d view boxes\n", TheGameLogic->getFrame(), boxes ));
- m_viewBoxesDrawn = boxes;
- }
-
- // draw the view region on top of the radar reconstructing if necessary
- if( boxes < 2 )
- drawViewBox( ul.x, ul.y, scaledWidth, scaledHeight );
- else
- for( Int pane = 0; pane < boxes; pane++ )
- drawPaneBox( pane, ul.x, ul.y, scaledWidth, scaledHeight );
+ // draw the view region on top of the radar reconstructing if necessary. -directorrecord draws no
+ // radar while its panes are up, so there is one view to box
+ drawViewBox( ul.x, ul.y, scaledWidth, scaledHeight );
} // end draw
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index 9a172dace..2b4e18207 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -519,28 +519,6 @@ static void drawPaneRays( void )
}
}
-/** The radar's frame drawing its gold in round the window, clockwise from the top left corner, drawn
- * share of the way; the edge is under all of it from the start. */
-static void drawFrameGold( const IRegion2D &window, Int gold, Real drawn )
-{
- const Int left = window.lo.x - gold;
- const Int top = window.lo.y - gold;
- const Int across = window.hi.x - window.lo.x + 2 * gold;
- const Int down = window.hi.y - window.lo.y + 2 * gold;
- Int remaining = REAL_TO_INT( drawn * 2 * ( across + down ) );
- const Int topRun = min( remaining, across );
- TheDisplay->drawFillRect( left, top, topRun, gold, PANE_GOLD );
- remaining -= topRun;
- const Int rightRun = min( remaining, down );
- TheDisplay->drawFillRect( left + across - gold, top, gold, rightRun, PANE_GOLD );
- remaining -= rightRun;
- const Int bottomRun = min( remaining, across );
- TheDisplay->drawFillRect( left + across - bottomRun, top + down - gold, bottomRun, gold, PANE_GOLD );
- remaining -= bottomRun;
- const Int leftRun = min( remaining, down );
- TheDisplay->drawFillRect( left, top + down - leftRun, gold, leftRun, PANE_GOLD );
-}
-
/// a rectangle the given pixels larger than window on every side, filled
static void fillAround( const IRegion2D &window, Int outside, Color color )
{
@@ -572,12 +550,10 @@ void W3DInGameUI::draw( void )
// the console's 'hidehud showmap=true': the bar is hidden, so its radar window is put in the
// corner by hand, where the radar's own pixel maths find it too, and painted. Under
- // -directorrecord it slides out of the corner to the left before panes come and back after
- // them, and while they are up it sits in a frame of the rays' own line where they meet. Every
- // pane draws the frame and its halo, for the same reason as the rays; the map in it is pane 0's
- // alone, and the recording takes the framed map from pane 0
- const Bool secondPane = TheObserverCamera.isDrawingSecond();
- if( CinemaDirector_showsMap() && ( framed || !secondPane ) )
+ // -directorrecord it sits in the middle of the bottom edge, slides down off the screen before
+ // panes come and back up after them, and is not drawn while they are up: framed where the rays
+ // met, its box for every pane was one more thing on a split screen the owner found too busy
+ if( CinemaDirector_showsMap() && !framed && !TheObserverCamera.isDrawingSecond() )
{
GameWindow *radarWindow = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:LeftHUD" ) );
// W3DLeftHUDDraw paints one pixel inside the window, and the radar keeps the map's shape
@@ -594,78 +570,30 @@ void W3DInGameUI::draw( void )
corner.lo.y = corner.hi.y - ( lr.y - ul.y ) - 2 * RADAR_BEZEL;
const Int mapWidth = corner.hi.x - corner.lo.x;
const Int mapHeight = corner.hi.y - corner.lo.y;
- // the frame is the rays' gold and outer edge laid round the window, the gold on the bezel
- const Int frameGold = ObserverCamera_paneLineWidth( TheDisplay->getHeight() );
- const Int frameOutside = frameGold + OBSERVER_PANE_LINE_EDGE;
- // -directorrecord frames the radar in its corner as well; the console's showmap alone keeps
- // it bare and flush with the corner
- const Bool cornerFramed = !framed && TheGlobalData->m_directorRecord;
- if( framed )
+ // -directorrecord frames it, half the rays' gold on a pixel of edge a 720 rows with the lines'
+ // band as a halo, flush with the bottom so only the top and the sides show; the console's
+ // showmap alone keeps it bare and flush with the corner
+ if( TheGlobalData->m_directorRecord )
{
- const Real diagonal = sqrtf( (Real)( mapWidth * mapWidth + mapHeight * mapHeight ) ) + 2 * frameOutside;
- const Coord2D middle = TheObserverCamera.getFramedRadarMiddle( diagonal );
- corner.lo.x = REAL_TO_INT( middle.x ) - mapWidth / 2;
+ const Int frameGold = ObserverCamera_paneLineWidth( TheDisplay->getHeight() );
+ const Int halo = max( ( ObserverCamera_paneBandWidth( TheDisplay->getHeight() ) - frameGold ) / 2 - OBSERVER_PANE_LINE_EDGE, 0 ) / 2;
+ const Int gold = max( frameGold / 2, 1 );
+ const Int outside = gold + max( REAL_TO_INT( TheDisplay->getHeight() / CORNER_EDGE_ROWS_A_PIXEL ), 1 );
+ // slid down far enough to take the frame and its halo off the screen too
+ const Int slide = REAL_TO_INT( TheObserverCamera.getCornerRadarSlide() * ( mapHeight + outside + halo ) );
+ corner.lo.x = ( TheDisplay->getWidth() - mapWidth ) / 2;
corner.hi.x = corner.lo.x + mapWidth;
- corner.lo.y = REAL_TO_INT( middle.y ) - mapHeight / 2;
- corner.hi.y = corner.lo.y + mapHeight;
- }
- // in its corner the radar stays flush with the screen's left and bottom edges and its frame is
- // half the rays' gold on a pixel of edge a 720 rows, so only its top and right show: the
- // owner found the full frame, inset by its width, too heavy for a corner
- const Int halo = max( ( ObserverCamera_paneBandWidth( TheDisplay->getHeight() ) - frameGold ) / 2 - OBSERVER_PANE_LINE_EDGE, 0 );
- const Int cornerGold = max( frameGold / 2, 1 );
- const Int cornerOutside = cornerGold + max( REAL_TO_INT( TheDisplay->getHeight() / CORNER_EDGE_ROWS_A_PIXEL ), 1 );
- const Int cornerHalo = halo / 2;
- if( cornerFramed )
- {
- // slid out left far enough to take the frame and its halo off the screen too
- const Int slide = REAL_TO_INT( TheObserverCamera.getCornerRadarSlide() * ( mapWidth + cornerOutside + cornerHalo ) );
- corner.lo.x -= slide;
- corner.hi.x -= slide;
- }
-
- // two filled rectangles under the radar, square at the corners: the edge, then the gold up
- // to the window, so the map sits on the gold with no gap. Between the panes the frame wears the lines' blue band as a halo and draws its gold in round
- // the window as the lines grow; until the gold is whole the map sits on the edge. In the
- // corner the same rectangles run off the screen's left and bottom, which leaves the top and
- // the right
- if( framed )
- {
- const Real progress = TheObserverCamera.getLineProgress();
- const Real bandShown = ObserverCamera_bandShown( progress );
- const Real drawn = ObserverCamera_frameTraced( progress );
- if( bandShown > 0.0f )
- {
- fillAround( corner, frameOutside + halo, paneBand( PANE_BAND_OUTER_ALPHA * bandShown ) );
- fillAround( corner, frameOutside + halo / 2, paneBand( PANE_BAND_INNER_ALPHA * bandShown ) );
- }
- fillAround( corner, frameOutside, PANE_EDGE );
- if( drawn >= 1.0f )
- fillAround( corner, frameGold, PANE_GOLD );
- else
- drawFrameGold( corner, frameGold, drawn );
- }
- else if( cornerFramed )
- {
- fillAround( corner, cornerOutside + cornerHalo, paneBand( PANE_BAND_OUTER_ALPHA ) );
- fillAround( corner, cornerOutside + cornerHalo / 2, paneBand( PANE_BAND_INNER_ALPHA ) );
- fillAround( corner, cornerOutside, PANE_EDGE );
- fillAround( corner, cornerGold, PANE_GOLD );
- }
- if( !secondPane )
- {
- if( framed )
- {
- IRegion2D taken = corner;
- taken.lo.x -= frameOutside;
- taken.lo.y -= frameOutside;
- taken.hi.x += frameOutside;
- taken.hi.y += frameOutside;
- TheObserverCamera.setRadarFrame( taken );
- }
- TheControlBar->placeWindowAt( radarWindow, corner );
- W3DLeftHUDDraw( radarWindow, NULL );
+ corner.lo.y += slide;
+ corner.hi.y += slide;
+ // filled rectangles under the radar, square at the corners: the halo, the edge, then the gold
+ // up to the window, so the map sits on the gold with no gap
+ fillAround( corner, outside + halo, paneBand( PANE_BAND_OUTER_ALPHA ) );
+ fillAround( corner, outside + halo / 2, paneBand( PANE_BAND_INNER_ALPHA ) );
+ fillAround( corner, outside, PANE_EDGE );
+ fillAround( corner, gold, PANE_GOLD );
}
+ TheControlBar->placeWindowAt( radarWindow, corner );
+ W3DLeftHUDDraw( radarWindow, NULL );
}
// -directorrecord's opening plates, each pane's own, then the score bar and a split's labels over
diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.inc
index 8e3d92b9a..cd51a3004 100644
--- a/GeneralsMD/Code/Tests/test_observer_camera.inc
+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc
@@ -422,6 +422,59 @@ TEST(the_recording_splits_a_match_of_two_into_a_pane_each_player)
CHECK_NEAR( heats[ 1 ], 3.0f, 0.001f );
}
+TEST(a_match_of_two_splits_after_its_opening_only_for_a_big_moment)
+{
+ const Real needed = 930.0f;
+ const Real farApart = 1500.0f;
+ const UnsignedInt second = LOGICFRAMES_PER_SECOND;
+ // the opening's split: on after the usual rest whenever the two players are far apart, bases or not
+ CHECK( ObserverCamera_holdSideSplit( FALSE, TRUE, FALSE, 0, farApart, needed, 4 * second ) );
+ CHECK( !ObserverCamera_holdSideSplit( FALSE, TRUE, FALSE, 0, farApart, needed, 3 * second ) );
+ // held through its least whatever, then up to 18 s with a fight and 36 s without
+ CHECK( ObserverCamera_holdSideSplit( TRUE, TRUE, FALSE, 0, 0.0f, needed, 7 * second ) );
+ CHECK( ObserverCamera_holdSideSplit( TRUE, TRUE, FALSE, 0, farApart, needed, 30 * second ) );
+ CHECK( !ObserverCamera_holdSideSplit( TRUE, TRUE, FALSE, 1, farApart, needed, 18 * second ) );
+ CHECK( !ObserverCamera_holdSideSplit( TRUE, TRUE, FALSE, 0, farApart, needed, 36 * second ) );
+
+ // past it, two players merely firing far apart split nothing however long the rest; S1-A1 went to
+ // panes and back every few seconds for it
+ const UnsignedInt rested = 120 * second;
+ CHECK( !ObserverCamera_holdSideSplit( FALSE, FALSE, FALSE, 2, farApart, needed, 600 * second ) );
+ // a big moment splits, but only after a long rest and only for fights far enough apart
+ CHECK( ObserverCamera_holdSideSplit( FALSE, FALSE, TRUE, 2, farApart, needed, rested ) );
+ CHECK( !ObserverCamera_holdSideSplit( FALSE, FALSE, TRUE, 2, farApart, needed, rested - 1 ) );
+ CHECK( !ObserverCamera_holdSideSplit( FALSE, FALSE, TRUE, 2, 900.0f, needed, rested ) );
+ // once on it stays the panes' slide and 15 s whatever the fights do, no 8 s flicker
+ const UnsignedInt least = 12 + 15 + 21 + 15 * second;
+ CHECK( ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 0, 0.0f, needed, 8 * second ) );
+ CHECK( ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 0, 0.0f, needed, least - 1 ) );
+ CHECK( !ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 0, 0.0f, needed, least ) );
+ // then while both players fight, up to 40 s
+ CHECK( ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 2, farApart, needed, 30 * second ) );
+ CHECK( !ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 1, farApart, needed, 30 * second ) );
+ CHECK( !ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 2, farApart, needed, 40 * second ) );
+}
+
+TEST(a_big_moment_wants_fights_the_scouting_pass_saw_peak_hot)
+{
+ std::vector< DirectorMoment > timeline;
+ DirectorMoment fight;
+ fight.start = 1000;
+ fight.last = 2000;
+ fight.place.x = fight.target.x = 1000.0f;
+ fight.place.y = fight.target.y = 1000.0f;
+ fight.peak = 8.0f;
+ fight.sides = 3;
+ fight.power = FALSE;
+ fight.superweapon = FALSE;
+ timeline.push_back( fight );
+ const Coord2D place = { 1000.0f, 1000.0f };
+ CHECK( ObserverCamera_fightLasts( timeline, place, 1100, 1500, NULL ) );
+ CHECK( !ObserverCamera_fightLasts( timeline, place, 1100, 1500, NULL, 12.0f ) );
+ timeline[ 0 ].peak = 12.0f;
+ CHECK( ObserverCamera_fightLasts( timeline, place, 1100, 1500, NULL, 12.0f ) );
+}
+
TEST(the_recording_splits_for_a_big_second_fight_holds_it_and_rests_after)
{
const UnsignedInt rested = 5 * LOGICFRAMES_PER_SECOND;
@@ -1189,10 +1242,7 @@ TEST(the_score_bar_sets_every_side_in_one_row_and_fits_eight_players)
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 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 );
+ // the band has not begun while the line is still short
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 );