Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameclient): fit the build order to eight players
Olcay Seyganeb19f6129588
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c275bf633..64e940385 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,7 +13,7 @@ found and fixed — EA's own, not port damage.**- The old score table with its rows of icons and the Tactical Analysis box is gone. Every score screen, skirmish, LAN, online, replay and campaign mission alike, opens on one summary: a row per player with its side, units built, lost and destroyed, buildings built, lost and destroyed, and money earned, the winner marked. In a campaign mission your enemies share one row per side, as they did in the old table. Generals' Challenge keeps the general's portrait and verdict it always had.- Under the summary one chart at a time draws a line per player over the whole match: money earned, army size or buildings standing. Army size counts infantry, vehicles and aircraft; workers and supply trucks are left out.- A single row of small pictures above the chart marks superweapons built and fired, general's powers and promotions, framed in the player's colour. Moments that fall close together share one picture with a count on it. Hover over it for the list, each line with its time, and a faint line down to where each one falls on the chart.-- The Build order tab puts the first of each structure and unit each player made on a timeline whose first five minutes take over half the width, so an opening reads at a glance. Show every build adds the rest; hover over a picture for its name and time.+- The Build order tab puts the first of each structure and unit each player made on a timeline whose first five minutes take over half the width, so an opening reads at a glance. Show every build adds the rest; hover over a picture for its name and time. In a 4v4 each row shrinks to one line of text, the player's name or the general where computer seats share a name, and one strip of pictures, so all eight fit even at 1280x720.- The game records all of this as the match plays, a sample every five seconds, and it changes nothing in the match itself. A game loaded from a save only graphs what happened after the load.## Computer players have personalitiesdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cppindex fe260f3a0..bad157cd9 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp@@ -653,6 +653,21 @@ static void layoutBuildOrder( Int top, Int width, Int bottom, Int pad )if( players.empty() )return;+ const Int rowsTop = top + smallLine + pad / 2;+ // a lone campaign player gets the height of two rows, not the whole area+ const Int rowHeight = ( bottom - rowsTop ) / max( (Int)players.size(), 2 );+ // a row too short for the name over the side (six players and up at 1080) gets one line: the name,+ // or the side where names repeat, as eight "Hard AI" seats would+ const Bool twoLines = rowHeight >= 2 * smallLine;+ std::vector< UnicodeString > labels;+ for( size_t each = 0; each < players.size(); each++ )+ {+ Bool repeated = FALSE;+ for( size_t other = 0; other < players.size(); other++ )+ repeated = repeated || ( other != each && players[ other ]->name == players[ each ]->name );+ labels.push_back( twoLines || !repeated ? players[ each ]->name : players[ each ]->side );+ }+UnsignedInt end = history.getSampleCount() > 0 ? history.getSampleFrame( history.getSampleCount() - 1 ) : 0;Int nameWidth = 0;for( size_t each = 0; each < players.size(); each++ )@@ -660,19 +675,22 @@ static void layoutBuildOrder( Int top, Int width, Int bottom, Int pad )const std::vector< MatchBuild > &builds = history.getBuilds( players[ each ]->index );if( !builds.empty() )end = max( end, builds.back().frame );- DisplayString *name = newText( players[ each ]->name, s_smallFont );- nameWidth = max( nameWidth, textWidth( name ) );- name->setText( players[ each ]->side );+ DisplayString *name = newText( labels[ each ], s_smallFont );nameWidth = max( nameWidth, textWidth( name ) );+ if( twoLines )+ {+ name->setText( players[ each ]->side );+ nameWidth = max( nameWidth, textWidth( name ) );+ }TheDisplayStringManager->freeDisplayString( name );}end = max( end, (UnsignedInt)LOGICFRAMES_PER_SECOND );- const Int rowsTop = top + smallLine + pad / 2;- // a lone campaign player gets the height of two rows, not the whole area- const Int rowHeight = ( bottom - rowsTop ) / max( (Int)players.size(), 2 );- // the cameos at their own 4:3, two lanes of the first of each thing, three of every build- const Int lanes = s_everyBuild ? 3 : 2;+ // the cameos at their own 4:3, two lanes of the first of each thing, three of every build, and+ // fewer lanes where that would shrink a cameo under two thirds of a line of text+ Int lanes = s_everyBuild ? 3 : 2;+ while( lanes > 1 && ( rowHeight - pad ) / lanes - 3 < smallLine * 2 / 3 )+ lanes--;const Int icon = min( max( ( rowHeight - pad ) / lanes - 3, 10 ), s_font->height * 3 / 2 );const Int iconWidth = icon * 4 / 3;const Int left = pad * 3 + nameWidth + iconWidth / 2;@@ -698,9 +716,10 @@ static void layoutBuildOrder( Int top, Int width, Int bottom, Int pad )const Int rowTop = rowsTop + (Int)each * rowHeight;if( each > 0 )addRule( pad * 2, rowTop, right + iconWidth / 2, rowTop, GRID );- const Int nameTop = rowTop + ( rowHeight - 2 * smallLine ) / 2;- addText( player.name, s_smallFont, pad * 2, nameTop, player.color );- addText( player.side, s_smallFont, pad * 2, nameTop + smallLine, TEXT_DIM );+ const Int nameTop = rowTop + ( rowHeight - ( twoLines ? 2 : 1 ) * smallLine ) / 2;+ addText( labels[ each ], s_smallFont, pad * 2, nameTop, player.color );+ if( twoLines )+ addText( player.side, s_smallFont, pad * 2, nameTop + smallLine, TEXT_DIM );std::vector< Int > laneRight( lanes, -iconWidth );std::vector< const ThingTemplate * > seen;