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): stop the cameo trays overlapping their neighbours
Olcay Seygan0d22b38de4f6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 19df2791c..39d81b417 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -327,6 +327,7 @@ found and fixed — EA's own, not port damage.**- A slot in it is a slot of that bar to the pixel, at every resolution - the size is measured off the bar itself rather than guessed - so the queue is read at a glance instead of squinted at: these were postage stamps a third of that size. Ten tanks ordered back to back are one picture with an x10 in its corner rather than ten copies of the same tank eating the row, so what is left of the row still says what else is coming.- The buildings your workers are raising stand in that same column, not in one of their own: a war factory going up is a picture in the queue at the point its time puts it, between the tank that lands before it and the one that lands after. One column is the whole answer to what your base has coming, read bottom to top in the order it arrives, and it no longer takes a second strip of screen to say the slower half of it. Each site carries its own sweep and the seconds it still needs. Click one and the camera goes there - a half-finished building under fire on the far side of the map is one click away instead of a hunt across the minimap - and none of them can be cancelled by mistake: a building already standing is sold or lost, never cancelled, so Ctrl over it does nothing.- The superweapon strip in the top right stands in the same metal, the right way round this time: it is anchored to the right hand edge and grows leftwards, which is the way that bar in the corner grows, so its rail closes the row against the edge of the screen. The black rectangle behind those pictures is gone with it, and the countdowns are the size of the ones down in the corner rather than half of it.+- Nothing in a row of trays lies over the picture in the tray beside it any more. A slot used to slide an eighth of a tray back under its neighbour so a row would read as one run of metal, and what it actually did was drop that neighbour's rail across the left edge of every cameo but the last - visible on the general's powers along the bottom right and on the superweapon countdowns along the top. They step a whole tray now, sideways as well as upward, which is what the queue column down the left has always done.- A game opens with nothing selected, so your first click is not a rally point.- Your general's powers no longer climb the right hand edge of the screen. They sit three abreast, filling from the bottom corner where the first one has always been and wrapping upward, so a general holding eleven of them still reads as a block instead of a ladder from the radar to the sky. The keys follow the same shape: the first press picks a row, the second picks the power in it, so every power is two keys away - F1 F1 for the one in the corner, F2 F1 for the row above it. Only the keys you can press next are written on the pictures, so you are never reading eleven labels to find one, and Escape drops a row you thought better of - so does clicking a power with the mouse, and so does four seconds' pause, so a key hit by mistake in a fight never turns your next one into a superweapon. Rows with nothing in them yet cannot be picked at all: early on, when you hold three powers, only the row you have answers a key.- The second key of that pair works now. Anything that touched the interface at all - a promotion, a unit rolling out, a building captured somewhere across the map - was quietly forgetting the row you had just picked, and in a real fight that happens several times a second, so the pair almost never completed and the powers looked as though they answered no key at all.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex d0fd326d0..2160f2c58 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -737,12 +737,8 @@ public: // ********************************************************************PRODUCTION_STRIP_TRAY_X = 1, ///< where the cameo sits inside itPRODUCTION_STRIP_TRAY_Y = 7,PRODUCTION_STRIP_QUEUE_W = 39, ///< and how big it is there- PRODUCTION_STRIP_QUEUE_H = 27,- PRODUCTION_STRIP_TRAY_OVER = 6, ///< that bar steps 35 between 41-tall slots: its trays overlap by- /// six sideways, and so do ours. Stacked, they do not: the- /// trays sit one on top of the next at their full height, so no- /// cameo has another tray's rail lying over its top edge- PRODUCTION_STRIP_BAR_STEP = 35 ///< the step itself, kept so the overlap can be checked against it+ PRODUCTION_STRIP_QUEUE_H = 27 ///< a cell steps a whole tray both ways, so no tray lies over the+ /// cameo in the one beside or below it};///< does an item go in front of one already in the row? the selected building's items are adiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex deb254d6a..4dc31328a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -3958,15 +3958,6 @@ Bool ControlBar::trayLayoutFromSlot( Int slotWidth, Int slotHeight, ICoord2D *trconst Int HOLE_WIDTH = 45;const Int HOLE_HEIGHT = 38;- //- // the tray's right edge is the thick one - eleven of the artwork's sixty columns. A row set- // side by side shows that slab between every pair of cameos, so each slot after the rightmost- // slides eight (of the tray's authored forty-eight) back under its neighbour, and the rightmost- // is drawn last so it covers the slab rather than being covered by it- //- const Int TRAY_WIDTH = 48;- const Int OVERLAP = 8;-if( traySize ){traySize->x = slotWidth;@@ -3985,8 +3976,15 @@ Bool ControlBar::trayLayoutFromSlot( Int slotWidth, Int slotHeight, ICoord2D *trcameoOffset->y = ( slotHeight * HOLE_Y + ART_HEIGHT / 2 ) / ART_HEIGHT;}+ //+ // A row steps a whole tray, the way a column already does. The slots used to slide an eighth of+ // a tray back under each other so a row read as one run of metal, and what that actually did was+ // lay the neighbour's rail over the left edge of every cameo but the last: the general's powers+ // and the superweapon countdowns both came out overlapping. Side by side they read as the boxes+ // they are, and the queue column down the left has looked like that all along.+ //if( columnStep )- *columnStep = slotWidth - ( slotWidth * OVERLAP ) / TRAY_WIDTH;+ *columnStep = slotWidth;return TRUE;diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex b1ce42c85..c22b55819 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -7563,9 +7563,7 @@ static const ProductionEntry *findStripEntry( ProductionUpdateInterface *pu,//-------------------------------------------------------------------------------------------------/** The tray a queue cameo stands in: the general's power bar's own, this side's copy of it, turned* back to front. That bar grows leftward out of the corner and its tray's heavy rail is on the- * right hand edge, where in a row running rightward from the left of the screen it would stand- * between every pair of cameos; mirrored, the rail leads the row and the trays close up behind- * it.+ * right hand edge; mirrored, the rail leads a row running the other way.** Kept until the bar hands back a different tray - a side change, an observer picking a different* player out of the list, a mod's own bar - rather than rebuilt per cameo per frame. NULL when@@ -7613,7 +7611,7 @@ void InGameUI::stripTrayMetrics( ICoord2D *tray, ICoord2D *cameo, ICoord2D *holecameo->y = stripPixels( PRODUCTION_STRIP_QUEUE_H );hole->x = stripPixels( PRODUCTION_STRIP_TRAY_X );hole->y = stripPixels( PRODUCTION_STRIP_TRAY_Y );- *step = tray->x - stripPixels( PRODUCTION_STRIP_TRAY_OVER );+ *step = tray->x;}//-------------------------------------------------------------------------------------------------@@ -7816,10 +7814,8 @@ void InGameUI::drawSuperweaponStrip( void )const Int y = trayY + trayHole.y;//- // The trays go down first, all of them, and from the far end back: each tray's heavy rail- // is on its right, and it takes the tray to its right drawn on top of it to cover that- // rail. The rightmost is drawn last, and its rail is the one that closes the row against- // the edge of the screen.+ // The trays go down first, all of them, and from the far end back, so the rightmost - the+ // countdown that lands next - is the one drawn last.//for( Int back = inRow - 1; back >= 0; back-- ){@@ -7958,9 +7954,8 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )// any resolution, and it is never squeezed to fit anything - squeezed, its rail and its inner// frame collapse into a coloured smudge and none of it reads as that bar any more.//- // Along a row the trays overlap by what that bar overlaps its own by, so the row is one run of- // metal rather than a line of separate boxes. Stacked they do not overlap at all: a cell steps- // a whole tray, so no cameo has the tray above it lying over its top edge.+ // A cell steps a whole tray whichever way the strip runs, so no cameo has the tray beside it or+ // above it lying over its edge.//ICoord2D traySize, cameoSize, trayHole;Int trayStep = 0;@@ -7978,9 +7973,8 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )const Int x = left + trayInsetX; ///< where the first cameo starts//- // Which way the cells run. Down a column they step a whole tray, so no cameo has the tray above- // it lying over its top edge; along a row they step the way that bar steps its own slots, six- // short of the tray, and the six is the rail the next tray covers.+ // Which way the cells run. Either way they step a whole tray, so no cameo has a neighbouring+ // tray lying over its edge.//const Int cellStepX = m_productionStripWatching ? trayStep : 0;const Int cellStepY = m_productionStripWatching ? 0 : trayH;@@ -8000,8 +7994,7 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )//// The trays go down first, all of them, and from the far end back: the near one carries the item- // that arrives next, so it is the one drawn last and the one whose frame is whole. In a row- // that draw order is also what covers each tray's rail, which the mirrored art puts on its left.+ // that arrives next, so it is the one drawn last and the one whose frame is whole.//// Without the art - a mod that ships no shortcut bar - a slot keeps the flat plate it used to// have rather than losing its backing.diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex cd759a232..f8f0ecfc1 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -8544,24 +8544,11 @@ TEST(a_queue_cameo_sits_in_the_general_power_tray_the_way_that_bar_sits_in_it)<= (Int)InGameUI::PRODUCTION_STRIP_TRAY_H );//- // The overlap is that bar's own: it steps 35 between slots 41 tall, so consecutive trays cover- // six of each other and a row of them is one run of metal rather than a line of loose boxes.+ // Six whole trays side by side is what a row costs across - and that has to fit inside the 800+ // the whole layout is written in, or the strip runs off the side of the screen before its+ // overflow count is ever reached.//- CHECK_EQ( (Int)InGameUI::PRODUCTION_STRIP_TRAY_H - (Int)InGameUI::PRODUCTION_STRIP_BAR_STEP,- (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER );-- // and it never eats a whole tray: the step has to stay positive on both axes or the row stacks- CHECK( (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER < (Int)InGameUI::PRODUCTION_STRIP_TRAY_W );- CHECK( (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER < (Int)InGameUI::PRODUCTION_STRIP_TRAY_H );-- //- // Six trays at that step, plus the tray the last one still needs the rest of, is what the row- // costs across - and that has to fit inside the 800 the whole layout is written in, or the strip- // runs off the side of the screen before its overflow count is ever reached.- //- const Int step = (Int)InGameUI::PRODUCTION_STRIP_TRAY_W - (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER;- const Int rowWidth = ( (Int)InGameUI::PRODUCTION_STRIP_ROW_MAX - 1 ) * step- + (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;+ const Int rowWidth = (Int)InGameUI::PRODUCTION_STRIP_ROW_MAX * (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;CHECK( rowWidth < 800 );}@@ -8598,9 +8585,8 @@ TEST(the_strip_tray_geometry_is_a_fraction_of_whatever_size_the_bar_was_loaded_aCHECK( hole.y + cameo.y <= tray.y );CHECK( cameo.x > 0 && cameo.y > 0 );- // a row closes up rather than separating, and never eats a whole tray- CHECK( step > 0 );- CHECK( step < tray.x );+ // a row steps a whole tray, so one tray never lies over the cameo in the next+ CHECK_EQ( tray.x, step );//// Twice the bar, twice everything: an observer borrowing another side's tray gets that side's@@ -8628,17 +8614,11 @@ TEST(the_strip_tray_geometry_is_a_fraction_of_whatever_size_the_bar_was_loaded_aCHECK_EQ( step, stepOnly );}-/* Sideways the trays close up, by the six the general's power bar closes its own by. Stacked they- do not: a row stands a whole tray above the row under it. The overlap that reads as one sheet- of metal along a row cuts six pixels off the top of every picture in a column, and a cameo with- another tray's rail lying across it is the thing this was changed to stop. */+/* No tray lies over another, in either direction: a cell steps a whole tray sideways as well as+ upward. A tray sliding under its neighbour cut the rail across the picture next to it, which is+ what the general's powers and the superweapon countdowns both looked like. */TEST(a_stacked_tray_does_not_lie_over_the_one_below_it){- // sideways: that bar's step, six short of the tray- CHECK_EQ( (Int)InGameUI::PRODUCTION_STRIP_TRAY_H - (Int)InGameUI::PRODUCTION_STRIP_BAR_STEP,- (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER );- CHECK( (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER > 0 );-// upward: nothing is taken off, so a cell has to clear the whole picture that stands in itCHECK( (Int)InGameUI::PRODUCTION_STRIP_TRAY_Y + (Int)InGameUI::PRODUCTION_STRIP_QUEUE_H<= (Int)InGameUI::PRODUCTION_STRIP_TRAY_H );@@ -8661,14 +8641,11 @@ TEST(a_stacked_tray_does_not_lie_over_the_one_below_it)const Int watchPile = (Int)InGameUI::PRODUCTION_STRIP_ROWS * (Int)InGameUI::PRODUCTION_STRIP_TRAY_H;CHECK( watchPile < 2 * 600 / 3 );- const Int watchStep = (Int)InGameUI::PRODUCTION_STRIP_TRAY_W - (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER;- const Int watchWidth = (Int)InGameUI::PRODUCTION_STRIP_WATCH_MAX * watchStep- + (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;+ const Int watchWidth = ( (Int)InGameUI::PRODUCTION_STRIP_WATCH_MAX + 1 )+ * (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;CHECK( watchWidth < 800 / 2 );- const Int step = (Int)InGameUI::PRODUCTION_STRIP_TRAY_W - (Int)InGameUI::PRODUCTION_STRIP_TRAY_OVER;- const Int rowWidth = ( (Int)InGameUI::SUPERWEAPON_STRIP_COLS - 1 ) * step- + (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;+ const Int rowWidth = (Int)InGameUI::SUPERWEAPON_STRIP_COLS * (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;CHECK( rowWidth < 800 );}