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(controlbar): classic bar empties when the worker is let go
Olcay Seygan3d666ea82e26
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6c99079e0..ed545b259 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1092,6 +1092,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- Interface, in the launcher, picks between Classic and Reforged. Classic is the command bar, mouse and hotkeys of Zero Hour 1.04 that your hands still remember; Reforged is the console in the middle, right-click orders and the key grid this version built. Every player starts on Classic, and a game started without the launcher is Classic too. The choice is yours alone: two players on different styles still play the same match and the same replay. It takes effect the next time the game starts. Classic's screen is EA's again: the command bar in each side's own painting, the radar with its flashing under-attack lamp, the beacon button, six lines of messages in the top left that fade as they did, superweapon countdowns written out by name, the old chat line and quit menu, lettering at the old sizes, and Tab opening diplomacy. The menus outside a match fill the screen as 1.04's did; in a match the options and save screens keep their drawn shape in the middle, over the battlefield. The match's own furniture is never pulled out of shape and never waits in a frame in the middle. The command bar comes in three pieces at every resolution: the radar stands on the left edge of the screen, the build grid in the middle and your selection on the right edge, each at the size a 4:3 screen of the same height gives it, with battlefield between them on anything wider. At 1920x1080 a build button is 90 by 79 pixels, the shape it was drawn, where EA's stretched bar made it 120 by 79, and on a 5120x1440 screen the radar is still in the corner your eye goes to, not 1280 pixels in from it. Your general's powers climb the right edge, the build tooltip and the chat line sit over the radar, diplomacy opens in the top left, the messages run from the top left corner and the superweapon countdowns from the top right, all at that same size, as they stood on a 4:3 screen. The mouse and keys are 1.04's as well. The left button selects and gives the order, so an enemy under it is an attack and a bunker under your infantry is a way in; the right button drops your selection or takes back a half-given order, and a right drag scrolls the map. Ctrl held is force fire. Alt held lays waypoints, and the white path joining them is drawn again. A guard order holds the range it always held, Shift and a number adds that group to what you have selected, and a build button is one unit a click. The keys are your language's own key map from the game's files, with nothing of Reforged's grid laid over it, and a build button's key is the letter 1.04 gave it, taken from the English name in every language, so a Turkish or German player presses the same key an English one does. The letter sits in the button's corner on the dark badge Reforged puts its grid keys on, in the middle of a square plate the same size for every letter, larger than Reforged's and in gold while the button can be pressed; the tooltip's name is plain white with no letter picked out. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, and the clock plate, the frame counter and the experience bar under the portrait stay off the screen. So does the peace time plate, though a host's truce still holds. The money readout is the money alone, with no income figure beside it. Health bars and garrison squares look and behave as they do in Reforged, and the Health Bars and empty garrison squares settings are back on Classic's options page. The build buttons are the pictures alone, without the seconds, price and power figures. Those seconds were measured against the wall clock, so on a match running just under full speed a 120 second build read 125. An upgrade bought for a group of buildings goes to the one whose buttons you see. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms as fast as Reforged's, about fourteen notches from the ground to the whole map where 1.04 took eighty, on the middle of the screen unless you tick Zoom to Cursor, as near and as far as Reforged's camera goes, turns without snapping unless you tick Snap Camera Rotation, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. It runs past the edge of the map as far as Reforged's camera does, 200 units unless `CameraBoundaryMargin` says otherwise, so a base in a corner comes to the middle of the screen in either interface. A move order puts 1.04's animated ring on the ground where it lands, and no marker or line stays behind it. None of it reaches the battle itself: Classic sends the game only the orders 1.04 sent, so a Classic player and a Reforged one share a match, and a replay plays back the same in either.- Classic shows what a factory is building again. Select one with anything queued and its queue takes the portrait's place, the unit in production wearing its build clock, and a click on any entry cancels it; the portrait comes back when the queue runs dry. Until now a Classic factory could queue a hundred units with nothing on screen to count them by. The queue stops at nine, the number of slots that show it, and the build buttons grey out at nine as they did in 1.04. Your general's powers climb the right edge of the screen from the top of the bar, one over the other, as they did in 1.04, and the empty strip above them no longer swallows clicks on the battlefield. They carry how many are ready, with no key letter and no recharge seconds, and the promotion screen carries no number keys either, since Classic's number keys pick teams. Every button on that screen takes its click again: the right half used to sit under the powers bar's empty frame and the bottom row under the command bar's top edge, and a click there went nowhere.- Classic's command bar lets the battlefield have the ground it shows. A click on the battlefield between its three pieces, or over the sloped shoulders of the build grid's plate, reaches the unit standing there; only the painted metal keeps it. Change the resolution with the bar minimised and the build tooltip used to come back 245 pixels too high at 1920x1080, as far as the bar had dropped; it stays over the radar now.+- Classic's command bar empties when you let your worker go, as 1.04's did. Reforged's habit of showing a builder's buildings with nothing selected had leaked into Classic, so a dozer's build menu stayed on the bar after you dropped it, and was there from the first second of a match before you had picked anything. In Reforged that builder's menu now also comes back after a resolution change; it used to leave the bar empty until you clicked something.- Supply piles stop shouting their cash over the whole map. A small pile shows its amount only while your cursor is on it or close by, in a smaller font; a big supply dock keeps its label all the time. Classic has the same labels now, with the radar still leaving the piles off.- The Esc menu and the general's promotion screen close the way they open, in both interfaces. Both used to vanish in a single frame, and Classic's Esc menu had lost its opening flash as well. Classic plays 1.04's flash and fade, forwards to open and backwards to close; Reforged fades its pages out over a little more than a tenth of a second, as fast as they fade in.- Every graphics setting is on the Graphics and Effects pages. Shadows, clouds, ground lighting, soft water edges, trees, extra animations, heat haze, texture resolution and the particle limit used to hide in a popup that only opened if you picked Custom from the detail box on another page, so choosing High never showed you what High turns on. Pick a preset now and its settings change in front of you; touch any one of them and the box reads Custom. Texture filtering and the number of anisotropic samples, which needed a text editor, sit there too.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex 95c4e7234..08b072e5e 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -1143,6 +1143,7 @@ public:/// top edge of the highest visible window the bar owns, and where MoneyDisplay is; see -uidrillvoid forEachPlacedWindow( Int *topOut, Int *moneyOut );+ ControlBarContext getCurrentContext( void ) const { return m_currContext; } ///< for -uidrill's log/// the window every other one on the bar hangs off, so -uidrill can walk it looking for a buttonGameWindow *getMasterParent( void ) { return m_contextParent[ CP_MASTER ]; }diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex 90430d678..c0434e3a2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -2649,10 +2649,13 @@ void ControlBar_logPlacement( const char *tag, Int frame )tip->hide( TRUE );}- DEBUG_LOG(("UIDRILL: frame %d %s top %d money %d origin (%d,%d) marker (%d,%d) live (%d,%d) tip (%d,%d %dx%d) screen %dx%d\n",+ // what the bar shows against what is selected: an empty selection showing a command set is a+ // builder standing in, which only Reforged has+ DEBUG_LOG(("UIDRILL: frame %d %s top %d money %d origin (%d,%d) marker (%d,%d) live (%d,%d) tip (%d,%d %dx%d) screen %dx%d selected %d context %d\n",frame, tag, top, money, origin->x, origin->y, markX, markY, liveX, liveY,tipX, tipY, tipW, tipH,- TheDisplay->getWidth(), TheDisplay->getHeight()));+ TheDisplay->getWidth(), TheDisplay->getHeight(),+ TheInGameUI ? TheInGameUI->getSelectCount() : -1, (Int)TheControlBar->getCurrentContext()));}void ControlBar::forEachPlacedWindow( Int *topOut, Int *moneyOut )@@ -4383,6 +4386,11 @@ static void findStandInBuilderProc( Object *obj, void *userData )Drawable *ControlBar::findStandInBuilder( Bool freeOnly ){+ // Classic's bar is 1.04's: nothing selected is an empty bar, and a build needs a selected worker.+ // A stand-in kept the dozer's build menu up after the dozer was let go.+ if( barIsClassic() )+ return NULL;+Player *player = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;if( player == NULL )return NULL;@@ -5663,6 +5671,9 @@ void ControlBar::setControlBarSchemeByPlayer(Player *p){switchToContext( CB_CONTEXT_NONE, NULL );m_isObserverCommandBar = FALSE;+ // what was showing is gone, and no selection event will bring it back: the selection's or+ // the stand-in builder's command set has to be evaluated again+ markUIDirty();if (buttonIdleWorker)buttonIdleWorker->winHide(FALSE);@@ -5712,6 +5723,9 @@ void ControlBar::setControlBarSchemeByPlayerTemplate( const PlayerTemplate *pt){switchToContext( CB_CONTEXT_NONE, NULL );m_isObserverCommandBar = FALSE;+ // what was showing is gone, and no selection event will bring it back: the selection's or+ // the stand-in builder's command set has to be evaluated again+ markUIDirty();if (buttonIdleWorker)buttonIdleWorker->winHide(FALSE);