Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(w3ddevice): draw pane lines in every pane instead of a pane 0 seam
Olcay Seygan77c916a0d926
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.hindex 836c7c2cc..333569b7c 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h@@ -273,9 +273,6 @@ Real ObserverCamera_easeFrames( UnsignedInt frame, UnsignedInt start, UnsignedInenum { OBSERVER_PANE_LINE_EDGE = 2 };/// the gold of a line between panes, in pixels, for a picture height pixels high: 6 at 720, 9 at 1080Int 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 line-Int ObserverCamera_paneSeamBand( Int height );/// the width of the soft band of the brand's blue under every line between panes and round the radarInt ObserverCamera_paneBandWidth( Int height );/// how much of its length a line between panes has grown out from the meeting point at progress, thediff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cppindex 000051556..50b92bed0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp@@ -1096,16 +1096,6 @@ Int ObserverCamera_paneLineWidth( Int height )return max( REAL_TO_INT( height / PANE_LINE_ROWS_A_PIXEL ), 2 );}-//--------------------------------------------------------------------------------------------------/** A row crosses a 45 degree line over its width times the square root of two, the widest any of- * the rays is cut; one pixel more for the rounding of the line's quad. */-//--------------------------------------------------------------------------------------------------Int ObserverCamera_paneSeamBand( Int height )-{- 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 ){diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppindex c4a1e23d0..531f66513 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp@@ -4300,12 +4300,12 @@ static Bool openVideoPipe(Int width, Int height)/** -directorrecord's panes joined into pane 0's picture: each pixel is taken from the pane whose wedge* it lies in. A pane's camera already slid its picture with the rays' meeting point, so the copy is- * pixel for pixel; moving the pixels instead read past a picture's edge and smeared it. Pane 0 keeps the framed radar and a band along every- * seam, where only its draw has the line, and the broadcast's score bar and labels, which only its- * draw has either. A pane with no picture of this frame and size stays pane 0's. */+ * pixel for pixel; moving the pixels instead read past a picture's edge and smeared it. Every pane+ * draws the lines and the radar's frame, so a seam needs nothing of its own. Pane 0 keeps the framed+ * radar and the broadcast's score bar and labels, which only its draw has. A pane with no picture+ * of this frame and size stays pane 0's. */static void joinVideoPanes(char *rows, Int width, Int height, UnsignedInt frame){- const Int seamBand = ObserverCamera_paneSeamBand(height);const Int count = TheObserverCamera.getDrawnPaneCount();const Real *rays = TheObserverCamera.getPaneRays();const Coord2D origin = TheObserverCamera.getPaneOrigin();@@ -4336,13 +4336,6 @@ static void joinVideoPanes(char *rows, Int width, Int height, UnsignedInt frame)continue;if (TheObserverCamera.isBroadcast(x, y))continue;- const Int left = max(x - seamBand, 0);- const Int right = min(x + seamBand, width - 1);- const Int up = max(y - seamBand, 0);- const Int down = min(y + seamBand, height - 1);- if (s_videoPaneMap[y * width + left] != pane || s_videoPaneMap[y * width + right] != pane- || s_videoPaneMap[up * width + x] != pane || s_videoPaneMap[down * width + x] != pane)- continue;const Int at = (y * width + x) * 3;memcpy(rows + at, s_videoHeld[pane] + at, 3);}diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex 8a2c34a4e..264e04205 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -560,17 +560,21 @@ void W3DInGameUI::draw( void )noFrame.lo.x = noFrame.lo.y = noFrame.hi.x = noFrame.hi.y = 0;TheObserverCamera.setRadarFrame( noFrame );- // -directorrecord's panes: the rays between them, drawn in pane 0's draw alone and under the- // radar; the join takes a band along every seam from pane 0, line and all- if( framed && !TheObserverCamera.isDrawingSecond() )+ // -directorrecord's panes: the rays between them, under the radar, drawn in every pane's draw so+ // each pane's half of a line's band lies over its own picture. Kept from pane 0 alone, the band+ // showed pane 0's ground on the far side of the seam, the black past its map in an eight-pane+ // opening+ if( framed )drawPaneRays();// 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,- // pane 0's alone: the other panes' draws leave it out and the recording takes it from pane 0- if( CinemaDirector_showsMap() && !TheObserverCamera.isDrawingSecond() )+ // 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 ) ){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@@ -616,8 +620,7 @@ 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- // between the panes the frame wears the lines' blue band as a halo and draws its gold in round+ // 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 edgeconst Int halo = max( ( ObserverCamera_paneBandWidth( TheDisplay->getHeight() ) - frameGold ) / 2 - OBSERVER_PANE_LINE_EDGE, 0 );if( framed )@@ -641,17 +644,20 @@ void W3DInGameUI::draw( void )fillAround( corner, frameOutside, PANE_EDGE );fillAround( corner, frameGold, PANE_GOLD );}- if( framed )+ if( !secondPane ){- IRegion2D taken = corner;- taken.lo.x -= frameOutside + halo;- taken.lo.y -= frameOutside + halo;- taken.hi.x += frameOutside + halo;- taken.hi.y += frameOutside + halo;- TheObserverCamera.setRadarFrame( taken );+ 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 );}- TheControlBar->placeWindowAt( radarWindow, corner );- W3DLeftHUDDraw( radarWindow, NULL );}// -directorrecord's opening plates, each pane's own, then the score bar and a split's labels overdiff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.incindex 2dbd961f0..87794363c 100644--- a/GeneralsMD/Code/Tests/test_observer_camera.inc+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc@@ -572,14 +572,11 @@ TEST(a_pane_shows_its_wedge_cut_by_the_screen)CHECK_EQ( ObserverCamera_panePolygon( rays, 1, 0, middle, 1280, 720, vertices ), 4 );}-TEST(pane_lines_grow_with_the_picture_and_the_join_keeps_all_of_them)+TEST(pane_lines_grow_with_the_picture){CHECK_EQ( ObserverCamera_paneLineWidth( 720 ), 6 );CHECK_EQ( ObserverCamera_paneLineWidth( 1080 ), 9 );CHECK_EQ( ObserverCamera_paneLineWidth( 2160 ), 18 );- // the gold and both edges, crossed by a row at 45 degrees: 13 * 0.707 is 9.2 at 1080- CHECK( ObserverCamera_paneSeamBand( 1080 ) >= 10 );- CHECK( ObserverCamera_paneSeamBand( 720 ) >= 8 );}static DirectorFightHit fightHit( Real x, Real y, UnsignedInt sides )@@ -926,9 +923,8 @@ TEST(the_pane_lines_grow_out_then_their_band_fades_in_and_a_light_runs_along_theCHECK( 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+ // the band is five golds wideCHECK_EQ( ObserverCamera_paneBandWidth( 720 ), 30 );- CHECK( ObserverCamera_paneSeamBand( 720 ) * 2 >= ObserverCamera_paneBandWidth( 720 ) );}TEST(the_army_bar_cuts_its_whole_width_among_the_sides)