Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(w3ddevice): brand band and logic-frame animation on director lines
Olcay Seygand64f28e62cfb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 091d5e3d0..157ba715e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -749,7 +749,7 @@ A third pass went through the generals' powers, promotions and unit abilities.- Watching, the bars over the buildings are everyone's too - what each factory is turning out, and how long the superweapons have left. An observer used to see none of it.- Watching, the camera can drive itself. Two drop-downs in the camera panel on the right, above the board, say who has it and which player you follow, and you can follow nobody. The Director goes to the fight with the most on the line over the last five seconds, where a dead Overlord counts for more than six riflemen being shot at and anything happening to a superweapon counts three times over. It stays with that fight twelve seconds, leaves after six only for one four times the size, and after half a minute on the same fight a third bigger is enough. So a 4v4 is watched like a broadcast rather than hunted for, and it does not hop between spots every few seconds. Any general's power used on the map outranks every fight. A nuke is shown in its silo as it leaves, then the camera waits at the target for it to come down and stays through the blast. The particle cannon's beam is followed along its whole sweep, and a Scud Storm or a carpet bomb is watched until the last explosion has died down. Then it goes back to the fighting. The camera glides between places and slows into each one, and only cuts when the next one is across most of the map. When nobody is shooting it no longer parks on empty ground: it goes round what is worth seeing, an army on the march, a superweapon, a base going up, the rest of a base, the dearest first and fourteen seconds each, and does not come back to one of the last three while there is anything else to show. With a player picked it keeps to his fights and his own armies and buildings. Player camera shows his screen: a human player's camera comes over the network five times a second, smoothed in between, and a computer player, who has no camera, gets the Director narrowed to his own fights. Scroll with the keys or a drag, turn the view or click the radar and the camera is yours again, still following the same player. The edge of the screen does not scroll while it drives: the panel on the right stands on that edge, and reaching for it used to hand the camera back to you, so the Director stopped following the fighting the first time you went to change a setting. In a replay with the recorded camera switched on in the options, the player you follow still drives the camera the way his button in the old list did.- Watching, the Director climbs over a wide battle until the whole of it is on the screen, and comes back down to your own height when it moves on or you take the camera. The mouse wheel still zooms while it drives, and it keeps what you chose. It stops short of the map's border too, where a fight on the edge used to come with a black corner of nothing beside it. A nuke or a Scud Storm is shown leaving its silo even when the Director has only just arrived at another fight; before, the launch was over by the time it was allowed to move. Rewinding a replay leaves your camera settings as they were, where a rewind used to hand you back a free camera with nobody followed. And following one player while a superweapon wiped out everything he had at the spot could close the game. It no longer does.-- Watching can be filmed. Start the game with `-directorrecord` and the Director has the camera from the first second, with nothing over the picture but the radar, and the whole match goes into one video; the game closes itself when the match is decided or the replay runs out. Beside `-replay` it turns an old match into footage, and beside four computer players it films a match nobody played. It plays the match twice. The first time there is no picture and the game runs as fast as the machine goes, 8,000 frames of a four-player match in 17 seconds, writing down where each fight starts and when each superweapon fires; the second time it films, and the camera is already at a fight four seconds before the first shot instead of arriving halfway through it. When two fights are about to start far apart the screen splits three seconds before the second begins, and only when the first run saw the Director's own fight go on for the whole time the split will be up, so the second picture never sweeps in and straight back out. A skirmish the first run saw come to nothing is not cut to, and neither is a special power that hurts nobody: an Air Force general's spy satellite every minute used to pull the camera to empty ground, where a carpet bomb or an artillery strike still gets it from the launch. Each half keeps its own fight. The main camera used to leave for the second half's fight as it began, and the two halves glided past each other over empty ground and swapped places; now it takes that fight over only once its own is finished, and the second half closes as it does. The two runs compare the whole state of the game every 30 seconds, and if they ever disagree the rest is filmed the old way, finding fights as they happen. A skirmish without `-seed` is handed one, the same for both runs. The film opens on every player at once: the screen cut into one picture per player along lines at 45 degrees that meet round the radar, two players on a diagonal and four on an X, each picture on that player's base. Seven seconds in they sweep away to the Director's single view, which stays on the first player's base until something happens instead of gliding across empty ground to another one. When two real fights far apart are both worth watching, the radar slides out of its corner, then the second fight sweeps in from the corner along a 45 degree diagonal, carrying the radar in a frame of the same line to the middle, one fight on each side with its own camera gliding to it. Going back is the same film run backwards: the second fight sweeps out with the radar, and the radar slides back into its corner. The lines are the Reforged gold on a dark edge, so they read on snow and at night, and they run straight into the radar's frame. While the screen is cut, each picture frames its own fight: the camera puts it in the biggest round space its slice has clear of the lines and the radar, and rises until the whole fight fits there with room to spare, never lower than the Director flies and never more than three times as high. A fight that spreads is let out smoothly; one that shrinks does not make the picture pump in and out. The opening frames each player's base the same way. A split holds at least six seconds after its second picture is all the way in and ends once the second fight has burnt down to a quarter of the first, and the picture then stays whole four seconds even for a fight the first run saw coming, so it does not flicker between one and two. The two fights have to be further apart than either half's picture is wide once it has risen to fit its fight, so no piece of ground shows in both: at a fixed 660 the two halves of a 1v1 showed the same bridge from neighbouring angles. A crowd beside the Director's fight that the first run saw as part of it does not split the screen either; that was the Director's own fight spreading, and the second half swept in for two seconds before the camera followed it there. Only the video shows the other pictures; the window keeps the Director's own fight under the lines. Two bases going up are not a fight, and the split ends the moment the camera's own fight and the second one turn out to be the same. The pictures go straight into ffmpeg as they are drawn, so an hour of 1080p does not need tens of gigabytes of disk first; put ffmpeg beside the game or on your PATH, because without it nothing is recorded and the game says so and closes. The film carries a score bar across the top in the Reforged colours: every player's name in his own colour, his general, his cash and what his army cost (a computer player goes by his general with his difficulty beside it, where every one of them used to read "Hard AI"), the match clock in the middle, and under it one bar the two sides' armies pull on, each player's share in his colour and a gold mark at the middle, so whoever is past it is ahead. Teammates sit together on it with their team's army total under them, a free for all deals its players to both sides, and with three sides or more the bar is every side's share end to end. Eight players fit at 720p: a side of more than three rows sets them smaller and drops the general column. A dark colour like purple is lightened where it is text, so it reads on the bar's ground, and the gold player's colour gets a dark edge so it does not melt into the gold lines. A skirmish can be staged in any shape now, 4v1 or three players alone beside a pair: `-team 4 0` puts slot 4 on team 0. The opening seats teammates next to each other and names their team on their plates, and a split names a team as "Team A" where a player alone keeps his own name. Each picture of the opening names its player on a plate hanging just over his command centre, and the plate stays on the building as the camera rises and the pictures sweep away. Each half of a split names the players in its fight, in a plate inside its own slice clear of the lines and the radar, and while the halves sweep in it rides above its fight, where it used to slide down over it. It is sized from the screen's height and reads the same at 720p and 1080p, and the pictures under it are framed below it, so no base or fight sits behind the bar. Any recorded clip also plays its animations at their real speed now. The animation clock used to move by however long each picture took to save, and a slow disk made every explosion in the footage run fast.+- Watching can be filmed. Start the game with `-directorrecord` and the Director has the camera from the first second, with nothing over the picture but the radar, and the whole match goes into one video; the game closes itself when the match is decided or the replay runs out. Beside `-replay` it turns an old match into footage, and beside four computer players it films a match nobody played. It plays the match twice. The first time there is no picture and the game runs as fast as the machine goes, 8,000 frames of a four-player match in 17 seconds, writing down where each fight starts and when each superweapon fires; the second time it films, and the camera is already at a fight four seconds before the first shot instead of arriving halfway through it. When two fights are about to start far apart the screen splits three seconds before the second begins, and only when the first run saw the Director's own fight go on for the whole time the split will be up, so the second picture never sweeps in and straight back out. A skirmish the first run saw come to nothing is not cut to, and neither is a special power that hurts nobody: an Air Force general's spy satellite every minute used to pull the camera to empty ground, where a carpet bomb or an artillery strike still gets it from the launch. Each half keeps its own fight. The main camera used to leave for the second half's fight as it began, and the two halves glided past each other over empty ground and swapped places; now it takes that fight over only once its own is finished, and the second half closes as it does. The two runs compare the whole state of the game every 30 seconds, and if they ever disagree the rest is filmed the old way, finding fights as they happen. A skirmish without `-seed` is handed one, the same for both runs. The film opens on every player at once: the screen cut into one picture per player along lines at 45 degrees that meet round the radar, two players on a diagonal and four on an X, each picture on that player's base. Seven seconds in they sweep away to the Director's single view, which stays on the first player's base until something happens instead of gliding across empty ground to another one. When two real fights far apart are both worth watching, the radar slides out of its corner, then the second fight sweeps in from the corner along a 45 degree diagonal, carrying the radar in a frame of the same line to the middle, one fight on each side with its own camera gliding to it. Going back is the same film run backwards: the second fight sweeps out with the radar, and the radar slides back into its corner. The lines are the Reforged gold on a dark edge, so they read on snow and at night, and they run straight into the radar's frame. Under each line and round the radar lies a soft band of the Reforged blue. Coming in, the lines grow out from where they meet, the band fades in a beat behind them and the radar's frame draws its gold round the map; going out runs the same backwards, and while the screen stays cut a light runs out along the gold every five seconds. While the screen is cut, each picture frames its own fight: the camera puts it in the biggest round space its slice has clear of the lines and the radar, and rises until the whole fight fits there with room to spare, never lower than the Director flies and never more than three times as high. A fight that spreads is let out smoothly; one that shrinks does not make the picture pump in and out. The opening frames each player's base the same way. A split holds at least six seconds after its second picture is all the way in and ends once the second fight has burnt down to a quarter of the first, and the picture then stays whole four seconds even for a fight the first run saw coming, so it does not flicker between one and two. The two fights have to be further apart than either half's picture is wide once it has risen to fit its fight, so no piece of ground shows in both: at a fixed 660 the two halves of a 1v1 showed the same bridge from neighbouring angles. A crowd beside the Director's fight that the first run saw as part of it does not split the screen either; that was the Director's own fight spreading, and the second half swept in for two seconds before the camera followed it there. Only the video shows the other pictures; the window keeps the Director's own fight under the lines. Two bases going up are not a fight, and the split ends the moment the camera's own fight and the second one turn out to be the same. The pictures go straight into ffmpeg as they are drawn, so an hour of 1080p does not need tens of gigabytes of disk first; put ffmpeg beside the game or on your PATH, because without it nothing is recorded and the game says so and closes. The film carries a score bar across the top in the Reforged colours: every player's name in his own colour, his general, his cash and what his army cost (a computer player goes by his general with his difficulty beside it, where every one of them used to read "Hard AI"), the match clock in the middle, and under it one bar the two sides' armies pull on, each player's share in his colour and a gold mark at the middle, so whoever is past it is ahead. Teammates sit together on it with their team's army total under them, a free for all deals its players to both sides, and with three sides or more the bar is every side's share end to end. Eight players fit at 720p: a side of more than three rows sets them smaller and drops the general column. A dark colour like purple is lightened where it is text, so it reads on the bar's ground, and the gold player's colour gets a dark edge so it does not melt into the gold lines. A skirmish can be staged in any shape now, 4v1 or three players alone beside a pair: `-team 4 0` puts slot 4 on team 0. The opening seats teammates next to each other and names their team on their plates, and a split names a team as "Team A" where a player alone keeps his own name. Each picture of the opening names its player on a plate hanging just over his command centre, and the plate stays on the building as the camera rises and the pictures sweep away. Each half of a split names the players in its fight, in a plate inside its own slice clear of the lines and the radar, and while the halves sweep in it rides above its fight, where it used to slide down over it. It is sized from the screen's height and reads the same at 720p and 1080p, and the pictures under it are framed below it, so no base or fight sits behind the bar. Any recorded clip also plays its animations at their real speed now. The animation clock used to move by however long each picture took to save, and a slow disk made every explosion in the footage run fast.- Watching, 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.hindex cf40068d9..cbef339d1 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h@@ -276,6 +276,16 @@ Int ObserverCamera_paneLineWidth( Int height );/// how far either side of a seam the join keeps pane 0's pixels, which is where its line is drawn:/// the whole edged line's half width, measured along a row or column across a 45 degree lineInt ObserverCamera_paneSeamBand( Int height );+/// the width of the soft band of the brand's blue under every line between panes and round the radar+Int ObserverCamera_paneBandWidth( Int height );+/// how much of its length a line between panes has grown out from the meeting point at progress, the+/// panes' slide, 0 to 1; whole before the slide is+Real ObserverCamera_lineDrawn( Real progress );+/// how far a line's band has faded in at progress, behind the line+Real ObserverCamera_bandShown( Real progress );+/// where along the gold lines the travelling light is on logic frame frame, 0 at the meeting point and+/// 1 at the far end, eased; below 0 between two runs+Real ObserverCamera_shimmerAt( UnsignedInt frame );class ObserverCamera{diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cppindex 22dcc274c..06760d309 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp@@ -140,6 +140,16 @@ static const UnsignedInt SPLIT_LEAD_FRAMES = 3 * LOGICFRAMES_PER_SECOND;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 picturestatic const Real PANE_LINE_ROWS_A_PIXEL = 120.0f;+/// the soft band of the brand's blue under a line is this many times the gold's width+static const Int PANE_BAND_LINES = 5;+/// as the panes come in a line grows out from the meeting point over this share of the slide, and its+/// band fades in over the slide from this share of it, a beat behind; going out runs it backwards+static const Real PANE_LINE_DRAWN_BY = 0.75f;+static const Real PANE_BAND_FROM = 0.35f;+/// 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;+static const UnsignedInt PANE_SHIMMER_FRAMES = 45;/// a pane's circle is looked for on a grid this fine, a centre every 10 pixels at 1280x720static const Int PANE_CIRCLE_COLUMNS = 128;static const Int PANE_CIRCLE_ROWS = 72;@@ -1085,10 +1095,46 @@ Int ObserverCamera_paneLineWidth( Int height )//-------------------------------------------------------------------------------------------------Int ObserverCamera_paneSeamBand( Int height ){- const Real whole = (Real)( ObserverCamera_paneLineWidth( height ) + 2 * OBSERVER_PANE_LINE_EDGE );+ const Real whole = (Real)max( ObserverCamera_paneLineWidth( height ) + 2 * OBSERVER_PANE_LINE_EDGE, ObserverCamera_paneBandWidth( height ) );return REAL_TO_INT_CEIL( whole * 0.5f * sqrtf( 2.0f ) ) + 1;}+//-------------------------------------------------------------------------------------------------+Int ObserverCamera_paneBandWidth( Int height )+{+ return PANE_BAND_LINES * ObserverCamera_paneLineWidth( height );+}++//-------------------------------------------------------------------------------------------------+/** progress along from to to, eased in and out, 0 before from and 1 after to. */+//-------------------------------------------------------------------------------------------------+static Real easeBetween( Real progress, Real from, Real to )+{+ const Real t = min( max( ( progress - from ) / ( to - from ), 0.0f ), 1.0f );+ return t * t * ( 3.0f - 2.0f * t );+}++//-------------------------------------------------------------------------------------------------+Real ObserverCamera_lineDrawn( Real progress )+{+ return easeBetween( progress, 0.0f, PANE_LINE_DRAWN_BY );+}++//-------------------------------------------------------------------------------------------------+Real ObserverCamera_bandShown( Real progress )+{+ return easeBetween( progress, PANE_BAND_FROM, 1.0f );+}++//-------------------------------------------------------------------------------------------------+Real ObserverCamera_shimmerAt( UnsignedInt frame )+{+ const UnsignedInt into = frame % PANE_SHIMMER_PERIOD;+ if( into >= PANE_SHIMMER_FRAMES )+ return -1.0f;+ return easeBetween( (Real)into, 0.0f, (Real)PANE_SHIMMER_FRAMES );+}+//-------------------------------------------------------------------------------------------------ObserverCamera::ObserverCamera(){diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex efd86d20e..71c4f7f6b 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -428,27 +428,102 @@ static void drawGroundRing( const Coord3D& center, Real radius, UnsignedInt colo/// night maps alikestatic const Color PANE_GOLD = GameMakeColor( 0xf2, 0xc2, 0x30, 255 );static const Color PANE_EDGE = GameMakeColor( 0x0c, 0x12, 0x20, 255 );+/// the band under the lines is the site's text blue, --blue #8095ea, the brand's second colour: a+/// wide faint layer and a narrower stronger one, fading out along the ray+static const UnsignedByte PANE_BAND_RGB[ 3 ] = { 0x80, 0x95, 0xea };+static const Real PANE_BAND_OUTER_ALPHA = 0.3f;+static const Real PANE_BAND_INNER_ALPHA = 0.55f;+static const Real PANE_BAND_FAR_SHARE = 0.35f;+/// the light that runs along the gold: --gold half way to white, over this share of a line's length+static const Color PANE_SHIMMER = GameMakeColor( 0xf9, 0xe0, 0x98, 255 );+static const Real PANE_SHIMMER_SHARE = 0.12f;++static Color paneBand( Real alpha )+{+ return GameMakeColor( PANE_BAND_RGB[ 0 ], PANE_BAND_RGB[ 1 ], PANE_BAND_RGB[ 2 ], (UnsignedByte)REAL_TO_INT( 255.0f * alpha ) );+}-/** The rays between the panes, from their meeting point to past the screen's edge, every ray's edge- * before any gold so the gold runs on unbroken where they meet. */+/** The rays between the panes, from their meeting point out, as far as they have grown: every ray's+ * band first, then every edge, then the gold, so the gold runs on unbroken where they meet. Held,+ * a light runs out along the gold now and then. */static void drawPaneRays( void ){const Real gold = (Real)ObserverCamera_paneLineWidth( TheDisplay->getHeight() );const Real edged = gold + 2 * OBSERVER_PANE_LINE_EDGE;- const Real reach = 2.0f * ( TheDisplay->getWidth() + TheDisplay->getHeight() );+ const Real band = (Real)ObserverCamera_paneBandWidth( TheDisplay->getHeight() );const Coord2D origin = TheObserverCamera.getPaneOrigin();const Real *rays = TheObserverCamera.getPaneRays();const Int count = TheObserverCamera.getDrawnPaneCount();- for( Int pass = 0; pass < 2; pass++ )+ const Real progress = TheObserverCamera.getPaneProgress();+ const Real bandShown = ObserverCamera_bandShown( progress );+ const Real drawn = ObserverCamera_lineDrawn( progress );+ // the far end is past the farthest corner from the meeting point, wherever that has slid to+ const Real width = (Real)TheDisplay->getWidth();+ const Real height = (Real)TheDisplay->getHeight();+ const Real farX = max( fabsf( origin.x ), fabsf( width - origin.x ) );+ const Real farY = max( fabsf( origin.y ), fabsf( height - origin.y ) );+ const Real length = sqrtf( farX * farX + farY * farY ) * drawn;+ const Int fromX = REAL_TO_INT( origin.x );+ const Int fromY = REAL_TO_INT( origin.y );+ for( Int pass = 0; pass < 4; pass++ ){for( Int ray = 0; ray < count; ray++ ){const Real angle = rays[ ray ] * PI / 180.0f;- TheDisplay->drawLine( REAL_TO_INT( origin.x ), REAL_TO_INT( origin.y ),- REAL_TO_INT( origin.x + cosf( angle ) * reach ), REAL_TO_INT( origin.y - sinf( angle ) * reach ),- pass == 0 ? edged : gold, pass == 0 ? PANE_EDGE : PANE_GOLD );+ const Int toX = REAL_TO_INT( origin.x + cosf( angle ) * length );+ const Int toY = REAL_TO_INT( origin.y - sinf( angle ) * length );+ if( pass == 0 && bandShown > 0.0f )+ TheDisplay->drawLine( fromX, fromY, toX, toY, band, paneBand( PANE_BAND_OUTER_ALPHA * bandShown ),+ paneBand( PANE_BAND_OUTER_ALPHA * bandShown * PANE_BAND_FAR_SHARE ) );+ else if( pass == 1 && bandShown > 0.0f )+ TheDisplay->drawLine( fromX, fromY, toX, toY, ( band + edged ) * 0.5f, paneBand( PANE_BAND_INNER_ALPHA * bandShown ),+ paneBand( PANE_BAND_INNER_ALPHA * bandShown * PANE_BAND_FAR_SHARE ) );+ else if( pass >= 2 )+ TheDisplay->drawLine( fromX, fromY, toX, toY, pass == 2 ? edged : gold, pass == 2 ? PANE_EDGE : PANE_GOLD );}}++ const Real shimmer = ObserverCamera_shimmerAt( TheGameLogic->getFrame() );+ if( drawn < 1.0f || shimmer < 0.0f )+ return;+ const Real half = length * PANE_SHIMMER_SHARE * 0.5f;+ const Real middle = length * shimmer;+ for( Int ray = 0; ray < count; ray++ )+ {+ const Real angle = rays[ ray ] * PI / 180.0f;+ const Real alongX = cosf( angle );+ const Real alongY = -sinf( angle );+ const Real start = max( middle - half, 0.0f );+ const Real end = min( middle + half, length );+ const Int middleX = REAL_TO_INT( origin.x + alongX * middle );+ const Int middleY = REAL_TO_INT( origin.y + alongY * middle );+ TheDisplay->drawLine( REAL_TO_INT( origin.x + alongX * start ), REAL_TO_INT( origin.y + alongY * start ), middleX, middleY, gold,+ PANE_GOLD, PANE_SHIMMER );+ TheDisplay->drawLine( middleX, middleY, REAL_TO_INT( origin.x + alongX * end ), REAL_TO_INT( origin.y + alongY * end ), gold,+ PANE_SHIMMER, PANE_GOLD );+ }+}++/** 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@@ -530,7 +605,26 @@ void W3DInGameUI::draw( void )// 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. All of it is pane 0's in the join- if( framed || cornerFramed )+ // 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+ const Int halo = max( ( ObserverCamera_paneBandWidth( TheDisplay->getHeight() ) - frameGold ) / 2 - OBSERVER_PANE_LINE_EDGE, 0 );+ if( framed )+ {+ const Real progress = TheObserverCamera.getPaneProgress();+ const Real bandShown = ObserverCamera_bandShown( progress );+ const Real drawn = ObserverCamera_lineDrawn( 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, frameOutside, PANE_EDGE );fillAround( corner, frameGold, PANE_GOLD );@@ -538,10 +632,10 @@ void W3DInGameUI::draw( void )if( framed ){IRegion2D taken = corner;- taken.lo.x -= frameOutside;- taken.lo.y -= frameOutside;- taken.hi.x += frameOutside;- taken.hi.y += frameOutside;+ taken.lo.x -= frameOutside + halo;+ taken.lo.y -= frameOutside + halo;+ taken.hi.x += frameOutside + halo;+ taken.hi.y += frameOutside + halo;TheObserverCamera.setRadarFrame( taken );}TheControlBar->placeWindowAt( radarWindow, corner );diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.incindex 15497114d..e0f884246 100644--- a/GeneralsMD/Code/Tests/test_observer_camera.inc+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc@@ -900,6 +900,34 @@ TEST(the_score_bar_keeps_each_team_together_and_balances_its_two_columns)CHECK_EQ( order[ index ], expected[ index ] );}+TEST(the_pane_lines_grow_out_then_their_band_fades_in_and_a_light_runs_along_them)+{+ // the line is whole three quarters of the way through the slide, its band only at the end, and+ // the band has not begun while the line is still short+ 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 );+ CHECK_NEAR( ObserverCamera_bandShown( 0.3f ), 0.0f, 0.0001f );+ CHECK( ObserverCamera_lineDrawn( 0.3f ) > 0.2f );+ CHECK_NEAR( ObserverCamera_bandShown( 1.0f ), 1.0f, 0.0001f );+ Real last = 0.0f;+ for( Int step = 0; step <= 20; step++ )+ {+ const Real now = ObserverCamera_bandShown( step / 20.0f );+ CHECK( now >= last );+ last = now;+ }+ // the light runs out over 45 frames once every five seconds, and is off in between+ CHECK_NEAR( ObserverCamera_shimmerAt( 0 ), 0.0f, 0.0001f );+ CHECK( ObserverCamera_shimmerAt( 22 ) > 0.3f && ObserverCamera_shimmerAt( 22 ) < 0.7f );+ CHECK( ObserverCamera_shimmerAt( 45 ) < 0.0f );+ CHECK( ObserverCamera_shimmerAt( 149 ) < 0.0f );+ CHECK_NEAR( ObserverCamera_shimmerAt( 150 ), 0.0f, 0.0001f );+ // the band is five golds wide and the join keeps all of it from pane 0+ CHECK_EQ( ObserverCamera_paneBandWidth( 720 ), 30 );+ CHECK( ObserverCamera_paneSeamBand( 720 ) * 2 >= ObserverCamera_paneBandWidth( 720 ) );+}+TEST(the_army_bar_cuts_its_whole_width_among_the_sides){std::vector< Int > armies;