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.

feat(gameclient): gold pane lines flush on the radar and higher pane cameras

Olcay Seygan66d6bb97e2c5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99e9e84e4..df997863e 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. 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. A split holds at least six seconds and ends once the second fight has burnt down to a quarter of the first, so the picture does not flicker between one and two. Only the video shows the other pictures; the window keeps the Director's own fight under the lines. Two bases going up are not a fight, and the split ends the moment the camera's own fight and the second one turn out to be the same. The pictures go straight into ffmpeg as they are drawn, so an hour of 1080p does not need tens of gigabytes of disk first; put ffmpeg beside the game or on your PATH, because without it nothing is recorded and the game says so and closes. Any recorded clip also plays its animations at their real speed now. The animation clock used to move by however long each picture took to save, and a slow disk made every explosion in the footage run fast.
+- Watching can be filmed. Start the game with `-directorrecord` and the Director has the camera from the first second, with nothing over the picture but the radar, and the whole match goes into one video; the game closes itself when the match is decided or the replay runs out. Beside `-replay` it turns an old match into footage, and beside four computer players it films a match nobody played. 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, every camera rises to keep its fight whole in a narrower slice: 30 percent higher for two pictures, half again for four or more, easing up and back down with the sweep. A split holds at least six seconds and ends once the second fight has burnt down to a quarter of the first, so the picture does not flicker between one and two. Only the video shows the other pictures; the window keeps the Director's own fight under the lines. Two bases going up are not a fight, and the split ends the moment the camera's own fight and the second one turn out to be the same. The pictures go straight into ffmpeg as they are drawn, so an hour of 1080p does not need tens of gigabytes of disk first; put ffmpeg beside the game or on your PATH, because without it nothing is recorded and the game says so and closes. Any recorded clip also plays its animations at their real speed now. The animation clock used to move by however long each picture took to save, and a slow disk made every explosion in the footage run fast.
- Watching, tick Fog of war under the camera and you see what the player you follow sees and nothing more: black where he has never been, grey where he has been, none of the enemy he cannot see, and an enemy base as he last saw it. Stealth goes by his eyes too: a Jarmen Kell he has not found is gone from the screen and the radar, and his own stealthed units show the way they show him. It stays on whoever drives the camera, until you switch it off or follow nobody. Switch to another player and his fog comes in whole, shadows included: a building he has never seen casts nothing on his grey ground. An observer used to have no fog at all: the whole map, all match, with no way to see the game the way one of its players was seeing it.
- An ally, and anyone watching, now sees a stealthed unit's muzzle flash, its promotion and the cash it earns - if they can see the unit at all. Those three asked 'is it mine' instead of 'can I see it', so allies and observers got nothing.
- Watching, the match opens on the middle of the map. An observer has no start position, so the game looked for the camera waypoint of "player zero", did not find it, and fell back to the corner of the map: every match watched from the stands began pointed at empty ground in the south west.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
index 268799d4a..83d68554e 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
@@ -157,6 +157,8 @@ Coord2D ObserverCamera_paneExitDirection( const Real *rays );
void ObserverCamera_paneMiddles( const Real *rays, Int count, Int width, Int height, Coord2D *middles );
/// how far an animation of length frames that started on start is on frame, eased in and out, 0 to 1
Real ObserverCamera_easeFrames( UnsignedInt frame, UnsignedInt start, UnsignedInt length );
+/// how much higher every camera stands while count panes are progress of the way in, 1 with none
+Real ObserverCamera_paneZoom( Int count, Real progress );
class ObserverCamera
{
@@ -284,6 +286,7 @@ private:
Real m_paneRays[ OBSERVER_MOST_PANES ];
Real m_paneProgress; ///< 0 for no panes on the screen, 1 for all of them, eased
Real m_paneExit; ///< how far off the meeting point goes, in pixels
+ Real m_paneBaseZoom; ///< the view's zoom when the panes started, which they rise from
Coord2D m_paneOrigin; ///< where the rays meet now, in pixels
Real m_cornerRadarSlide;
IRegion2D m_radarFrame;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
index 3aaf8ca06..ec39ca204 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
@@ -124,6 +124,10 @@ static const UnsignedInt PANE_RADAR_FRAMES = 12;
static const UnsignedInt PANE_SLIDE_FRAMES = 15;
/// the match opens on every player's base, one pane each, for this long
static const UnsignedInt PANE_INTRO_FRAMES = 7 * LOGICFRAMES_PER_SECOND;
+/// how much higher the cameras stand with the panes all in, by how many panes there are
+static const Real PANE_ZOOM_TWO = 1.3f;
+static const Real PANE_ZOOM_THREE = 1.4f;
+static const Real PANE_ZOOM_FOUR_OR_MORE = 1.5f;
/// a pane's middle is measured on a grid this coarse, which is plenty for where to put a subject
static const Int PANE_MIDDLE_COLUMNS = 64;
static const Int PANE_MIDDLE_ROWS = 36;
@@ -524,6 +528,18 @@ Real ObserverCamera_easeFrames( UnsignedInt frame, UnsignedInt start, UnsignedIn
return t * t * ( 3.0f - 2.0f * t );
}
+//-------------------------------------------------------------------------------------------------
+/** A wedge is a slice of the screen, so its subject wants more ground round it than the whole
+ * screen gave; more panes are narrower slices and stand higher still. */
+//-------------------------------------------------------------------------------------------------
+Real ObserverCamera_paneZoom( Int count, Real progress )
+{
+ if( count < 2 )
+ return 1.0f;
+ const Real highest = count == 2 ? PANE_ZOOM_TWO : count == 3 ? PANE_ZOOM_THREE : PANE_ZOOM_FOUR_OR_MORE;
+ return 1.0f + ( highest - 1.0f ) * progress;
+}
+
//-------------------------------------------------------------------------------------------------
ObserverCamera::ObserverCamera()
{
@@ -571,6 +587,7 @@ void ObserverCamera::reset( void )
m_paneCount = 0;
m_paneProgress = 0.0f;
m_paneExit = 0.0f;
+ m_paneBaseZoom = 1.0f;
m_paneOrigin.x = m_paneOrigin.y = 0.0f;
m_cornerRadarSlide = 0.0f;
m_radarFrame.lo.x = m_radarFrame.lo.y = m_radarFrame.hi.x = m_radarFrame.hi.y = 0;
@@ -890,6 +907,7 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
if( next != PANES_NONE )
{
m_paneExit = ObserverCamera_paneExit( m_paneRays, m_paneCount, TheDisplay->getWidth(), TheDisplay->getHeight() );
+ m_paneBaseZoom = TheTacticalView->getZoom();
for( Int pane = 0; pane < OBSERVER_MOST_PANES; pane++ )
m_paneGlide[ pane ] = ViewLocation();
}
@@ -1355,7 +1373,10 @@ void ObserverCamera::update( UnsignedInt nowMilliseconds )
releaseHeight();
else
driveHeight( m_placeHeight );
- holdHeight( isShowingPlayerView() );
+ // while there are panes the zoom is set outright from how far in they are, with the view's own
+ // settling held off: it eases on every draw, and a frame has a draw a pane
+ const Bool panesZoom = m_paneCount >= 2 && !isShowingPlayerView();
+ holdHeight( isShowingPlayerView() || panesZoom );
if( !m_driving )
{
m_velocity.x = m_velocity.y = m_velocity.z = m_velocity.angle = m_velocity.pitch = m_velocity.zoom = 0.0f;
@@ -1393,8 +1414,14 @@ void ObserverCamera::update( UnsignedInt nowMilliseconds )
m_introGlide = FALSE;
}
const Bool player = m_mode == OBSERVER_CAMERA_PLAYER;
- const ViewLocation step = ObserverCamera_approach( subject, target, elapsed / MILLISECONDS_PER_SECOND,
+ ViewLocation step = ObserverCamera_approach( subject, target, elapsed / MILLISECONDS_PER_SECOND,
player ? PLAYER_PAN_SECONDS : DIRECTOR_PAN_SECONDS, player ? PLAYER_TOP_SPEED : DIRECTOR_TOP_SPEED, &m_velocity );
+ if( panesZoom )
+ {
+ const Coord3D &stepAt = step.getPosition();
+ step.init( stepAt.x, stepAt.y, stepAt.z, step.getAngle(), step.getPitch(),
+ m_paneBaseZoom * ObserverCamera_paneZoom( m_paneCount, m_paneProgress ) );
+ }
const Coord2D offset = screenToGround( step, fromMiddle );
Coord2D sitBack;
sitBack.x = step.getPosition().x - offset.x;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index 80c05fab4..06ec423b0 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -423,11 +423,83 @@ void W3DInGameUI::reset( void )
static void drawGroundRing( const Coord3D& center, Real radius, UnsignedInt color, Real width );
-/// -directorrecord's line between panes, and round the radar framed where they meet
-static void drawPaneLine( Real fromX, Real fromY, Real toX, Real toY )
+/// -directorrecord's lines between panes and round the framed radar: the brand's gold (zerohour.gg's
+/// --gold, #f2c230) on an edge of its ground (--bg, #0c1220), so the line reads on snow and on night
+/// maps alike
+enum { PANE_LINE_WIDTH = 3, PANE_EDGE_WIDTH = 5, PANE_MOST_LINES = 2 * OBSERVER_MOST_PANES + 4 };
+struct PaneLine
{
- TheDisplay->drawLine( REAL_TO_INT( fromX ), REAL_TO_INT( fromY ), REAL_TO_INT( toX ), REAL_TO_INT( toY ),
- 3.0f, GameMakeColor( 235, 235, 235, 255 ) );
+ Coord2D from;
+ Coord2D to;
+};
+
+/// every edge drawn before any gold, so where two lines meet the gold runs on unbroken
+static void drawPaneLines( const PaneLine *lines, Int count )
+{
+ const Color edge = GameMakeColor( 0x0c, 0x12, 0x20, 255 );
+ const Color gold = GameMakeColor( 0xf2, 0xc2, 0x30, 255 );
+ for( Int line = 0; line < count; line++ )
+ TheDisplay->drawLine( REAL_TO_INT( lines[ line ].from.x ), REAL_TO_INT( lines[ line ].from.y ),
+ REAL_TO_INT( lines[ line ].to.x ), REAL_TO_INT( lines[ line ].to.y ), (Real)PANE_EDGE_WIDTH, edge );
+ for( Int line = 0; line < count; line++ )
+ TheDisplay->drawLine( REAL_TO_INT( lines[ line ].from.x ), REAL_TO_INT( lines[ line ].from.y ),
+ REAL_TO_INT( lines[ line ].to.x ), REAL_TO_INT( lines[ line ].to.y ), (Real)PANE_LINE_WIDTH, gold );
+}
+
+/** A ray from the panes' meeting point with the part inside the radar's frame left out, so the ray
+ * starts on the frame's line: one piece, two when the meeting point is outside the frame and the ray
+ * crosses it, none when it ends inside. */
+static Int addRayOutsideFrame( const Coord2D &from, const Coord2D &to, const IRegion2D *frame, PaneLine *lines )
+{
+ PaneLine whole = { from, to };
+ if( frame == NULL )
+ {
+ lines[ 0 ] = whole;
+ return 1;
+ }
+
+ // the stretch of the ray inside the frame, as fractions of it (Liang and Barsky's clip)
+ const Real start[ 2 ] = { from.x, from.y };
+ const Real along[ 2 ] = { to.x - from.x, to.y - from.y };
+ const Real low[ 2 ] = { (Real)frame->lo.x, (Real)frame->lo.y };
+ const Real high[ 2 ] = { (Real)frame->hi.x, (Real)frame->hi.y };
+ Real enter = 0.0f;
+ Real leave = 1.0f;
+ for( Int axis = 0; axis < 2; axis++ )
+ {
+ if( along[ axis ] == 0.0f )
+ {
+ if( start[ axis ] < low[ axis ] || start[ axis ] > high[ axis ] )
+ enter = 2.0f;
+ continue;
+ }
+ const Real atLow = ( low[ axis ] - start[ axis ] ) / along[ axis ];
+ const Real atHigh = ( high[ axis ] - start[ axis ] ) / along[ axis ];
+ enter = max( enter, min( atLow, atHigh ) );
+ leave = min( leave, max( atLow, atHigh ) );
+ }
+ if( enter >= leave )
+ {
+ lines[ 0 ] = whole;
+ return 1;
+ }
+
+ Int count = 0;
+ if( enter > 0.0f )
+ {
+ lines[ count ].from = from;
+ lines[ count ].to.x = from.x + along[ 0 ] * enter;
+ lines[ count ].to.y = from.y + along[ 1 ] * enter;
+ count++;
+ }
+ if( leave < 1.0f )
+ {
+ lines[ count ].from.x = from.x + along[ 0 ] * leave;
+ lines[ count ].from.y = from.y + along[ 1 ] * leave;
+ lines[ count ].to = to;
+ count++;
+ }
+ return count;
}
//-------------------------------------------------------------------------------------------------
@@ -440,24 +512,14 @@ void W3DInGameUI::draw( void )
// 930 and 1230), and nothing on the list belongs in a shot. The letterbox is the display's own.
if( CinemaDirector_hidesHud() )
{
- // -directorrecord's panes: the rays between them, from where they meet to past the screen's
- // edge, drawn in pane 0's draw alone; the join takes a band along every seam from pane 0, line
- // and all
const Bool framed = TheObserverCamera.isRadarFramed();
IRegion2D noFrame;
noFrame.lo.x = noFrame.lo.y = noFrame.hi.x = noFrame.hi.y = 0;
TheObserverCamera.setRadarFrame( noFrame );
- if( framed && !TheObserverCamera.isDrawingSecond() )
- {
- const Real reach = 2.0f * ( TheDisplay->getWidth() + TheDisplay->getHeight() );
- const Coord2D origin = TheObserverCamera.getPaneOrigin();
- const Real *rays = TheObserverCamera.getPaneRays();
- for( Int ray = 0; ray < TheObserverCamera.getDrawnPaneCount(); ray++ )
- {
- const Real angle = rays[ ray ] * PI / 180.0f;
- drawPaneLine( origin.x, origin.y, origin.x + cosf( angle ) * reach, origin.y - sinf( angle ) * reach );
- }
- }
+ // the frame's line runs along the radar window's outside edge, its inner side on the window's
+ // one pixel bezel, so the map meets it with no gap
+ IRegion2D frame = noFrame;
+ Bool hasFrame = FALSE;
// 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
@@ -481,10 +543,11 @@ 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;
- enum { RADAR_FRAME_GAP = 3 };
+ // how far the frame's line and its edge reach outside the window
+ enum { RADAR_FRAME_OUTSIDE = 1 + PANE_EDGE_WIDTH / 2 + 1 };
if( framed )
{
- const Real diagonal = sqrtf( (Real)( mapWidth * mapWidth + mapHeight * mapHeight ) ) + 2 * RADAR_FRAME_GAP;
+ const Real diagonal = sqrtf( (Real)( mapWidth * mapWidth + mapHeight * mapHeight ) ) + 2 * RADAR_FRAME_OUTSIDE;
const Coord2D middle = TheObserverCamera.getFramedRadarMiddle( diagonal );
corner.lo.x = REAL_TO_INT( middle.x ) - mapWidth / 2;
corner.hi.x = corner.lo.x + mapWidth;
@@ -493,7 +556,7 @@ void W3DInGameUI::draw( void )
}
else
{
- const Int slide = REAL_TO_INT( TheObserverCamera.getCornerRadarSlide() * ( mapWidth + RADAR_FRAME_GAP ) );
+ const Int slide = REAL_TO_INT( TheObserverCamera.getCornerRadarSlide() * ( mapWidth + RADAR_FRAME_OUTSIDE ) );
corner.lo.x -= slide;
corner.hi.x -= slide;
}
@@ -502,22 +565,60 @@ void W3DInGameUI::draw( void )
if( framed )
{
- IRegion2D frame;
- frame.lo.x = corner.lo.x - RADAR_FRAME_GAP;
- frame.lo.y = corner.lo.y - RADAR_FRAME_GAP;
- frame.hi.x = corner.hi.x + RADAR_FRAME_GAP;
- frame.hi.y = corner.hi.y + RADAR_FRAME_GAP;
- drawPaneLine( frame.lo.x, frame.lo.y, frame.hi.x, frame.lo.y );
- drawPaneLine( frame.hi.x, frame.lo.y, frame.hi.x, frame.hi.y );
- drawPaneLine( frame.hi.x, frame.hi.y, frame.lo.x, frame.hi.y );
- drawPaneLine( frame.lo.x, frame.hi.y, frame.lo.x, frame.lo.y );
- // the line is drawn on the frame's edge, so its outer half is pane 0's too
- frame.lo.x -= RADAR_FRAME_GAP;
- frame.lo.y -= RADAR_FRAME_GAP;
- frame.hi.x += RADAR_FRAME_GAP;
- frame.hi.y += RADAR_FRAME_GAP;
- TheObserverCamera.setRadarFrame( frame );
+ // the window's last column is corner.hi.x - 1, so the line's middle is one pixel
+ // outside the bezel on every side
+ frame.lo.x = corner.lo.x - 1;
+ frame.lo.y = corner.lo.y - 1;
+ frame.hi.x = corner.hi.x;
+ frame.hi.y = corner.hi.y;
+ hasFrame = TRUE;
+ // the line and its edge are drawn over the frame's outline, so they are pane 0's too
+ IRegion2D taken = frame;
+ taken.lo.x -= PANE_EDGE_WIDTH / 2 + 1;
+ taken.lo.y -= PANE_EDGE_WIDTH / 2 + 1;
+ taken.hi.x += PANE_EDGE_WIDTH / 2 + 1;
+ taken.hi.y += PANE_EDGE_WIDTH / 2 + 1;
+ TheObserverCamera.setRadarFrame( taken );
+ }
+ }
+
+ // -directorrecord's panes: the rays between them, from where they meet to past the screen's
+ // edge, meeting the radar's frame and drawn with it in pane 0's draw alone; the join takes a
+ // band along every seam from pane 0, line and all
+ if( framed && !TheObserverCamera.isDrawingSecond() )
+ {
+ PaneLine lines[ PANE_MOST_LINES ];
+ Int count = 0;
+ const Real reach = 2.0f * ( TheDisplay->getWidth() + TheDisplay->getHeight() );
+ const Coord2D origin = TheObserverCamera.getPaneOrigin();
+ const Real *rays = TheObserverCamera.getPaneRays();
+ for( Int ray = 0; ray < TheObserverCamera.getDrawnPaneCount(); ray++ )
+ {
+ const Real angle = rays[ ray ] * PI / 180.0f;
+ Coord2D end;
+ end.x = origin.x + cosf( angle ) * reach;
+ end.y = origin.y - sinf( angle ) * reach;
+ count += addRayOutsideFrame( origin, end, hasFrame ? &frame : NULL, lines + count );
+ }
+ if( hasFrame )
+ {
+ // each side runs on past the corners by half the edge, so the corners are filled
+ const Real past = PANE_EDGE_WIDTH / 2;
+ const Real left = (Real)frame.lo.x;
+ const Real top = (Real)frame.lo.y;
+ const Real right = (Real)frame.hi.x;
+ const Real bottom = (Real)frame.hi.y;
+ const PaneLine sides[ 4 ] =
+ {
+ { { left - past, top }, { right + past, top } },
+ { { right, top - past }, { right, bottom + past } },
+ { { right + past, bottom }, { left - past, bottom } },
+ { { left, bottom + past }, { left, top - past } },
+ };
+ for( Int side = 0; side < 4; side++ )
+ lines[ count++ ] = sides[ side ];
}
+ drawPaneLines( lines, count );
}
return;
}
diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.inc
index c9f2b447b..f48565a02 100644
--- a/GeneralsMD/Code/Tests/test_observer_camera.inc
+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc
@@ -411,6 +411,17 @@ TEST(the_two_pane_middles_mirror_through_the_screen_middle)
CHECK_NEAR( middles[ 0 ].y + middles[ 1 ].y, 720.0f, 1.0f );
}
+TEST(pane_cameras_stand_higher_the_more_panes_there_are)
+{
+ CHECK_NEAR( ObserverCamera_paneZoom( 1, 1.0f ), 1.0f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_paneZoom( 2, 0.0f ), 1.0f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_paneZoom( 2, 1.0f ), 1.3f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_paneZoom( 2, 0.5f ), 1.15f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_paneZoom( 3, 1.0f ), 1.4f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_paneZoom( 4, 1.0f ), 1.5f, 0.0001f );
+ CHECK_NEAR( ObserverCamera_paneZoom( 8, 1.0f ), 1.5f, 0.0001f );
+}
+
TEST(pane_animations_ease_over_logic_frames)
{
CHECK_NEAR( ObserverCamera_easeFrames( 100, 100, 15 ), 0.0f, 0.0001f );