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(gameclient): Classic health bars, garrison pips and cameos are EA's
Olcay Seygan120f4dc92287
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8ed1534dd..a52b249ed 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1087,7 +1087,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- Display, graphics, effects, audio, controls, gameplay and network, behind seven buttons across the top. The original screen was one panel with everything on it at once, and it was already full the day it shipped: the language filter, the keyboard button and four camera checkboxes are all still in there, parked off the right edge where nobody can reach them, because there was nowhere left to put them.- Classic Graphics, at the top of the Graphics page, puts the game back the way it looked in 2003 in one click: its own textures and ground in place of the upscaled ones, the old hard shadows, the round dark patch under every tree where Reforged lays the tree's own outline on the ground, no bump detail on the models and no glow or sharpening over the picture. Leave it off and you have Reforged. The rest of the options stay yours either way, and the box takes effect the next time the game starts.-- Interface, at the top of the HUD group on the Gameplay page, 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, including anyone updating whose settings never named it. 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 one-piece 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. What it does not do is stretch. On a 16:9 or 21:9 screen the bar, the menus and every dialog sit in a 4:3 frame in the middle at their drawn shape, and the battlefield runs out to both edges past them; at 2560x1080 that is 560 pixels of ground on either side of the bar. 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 painted yellow in its name again. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, the piles carry no money over them, 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. A unit's health bar is the bar alone, with no build, reload, charge or work clocks over it, and an upgrade bought for a group of buildings goes to the one whose buttons you see. The building and unit keys are the yellow letters in Turkish as well: İkmal Kamyonu is the i key on a Turkish keyboard, wherever that key sits. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms on the middle of the screen ten units a notch, between the map's own nearest and farthest heights, turns without snapping, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. 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.+- Interface, at the top of the HUD group on the Gameplay page, 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, including anyone updating whose settings never named it. 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 one-piece 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. What it does not do is stretch. On a 16:9 or 21:9 screen the bar, the menus and every dialog sit in a 4:3 frame in the middle at their drawn shape, and the battlefield runs out to both edges past them; at 2560x1080 that is 560 pixels of ground on either side of the bar. 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 painted yellow in its name again. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, the piles carry no money over them, 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. Health bars are 1.04's: only over what you have selected or have the pointer on, red to green by health and blue while building or disabled, with no build, reload, charge or work clocks over them, and a building shows its garrison squares only when it is yours and somebody is inside. 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. The building and unit keys are the yellow letters in Turkish as well: İkmal Kamyonu is the i key on a Turkish keyboard, wherever that key sits. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms on the middle of the screen ten units a notch, between the map's own nearest and farthest heights, turns without snapping, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. 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.- 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.- Every page is sorted into titled groups by what the settings do, and the groups sit in the same three columns on every tab. On Graphics the detail preset heads the first column with the texture and particle sliders under it, the picture settings take the second and the terrain the third. The framed boxes the original drew inside each page are gone. They were sized for headings that no longer exist, which is why no two pages started their first setting at the same height.- The detail box has Ultra above High, and a preset now sets everything it is responsible for. Picking High used to leave antialiasing and texture filtering wherever they happened to be; High now brings 4x antialiasing and 8 anisotropic samples with it, and Low turns both down for the machines that need it. Ultra is High with the particle limit at the top of its slider, 5,000 against High's 3,000, detail that is never dropped when the frame rate dips, 8x antialiasing, 16 anisotropic samples, thick smoke and every new shadow and effect switched on. Glow stays yours whichever you pick: the artwork was painted without it.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cppindex 0fa1f987e..fbfb02fd3 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp@@ -3008,7 +3008,10 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region )Coord3D p;obj->getHealthBoxPosition(p);- p.z += healthBarArtLift( obj );+ // Classic keeps EA's place and size for the bar+ const Bool classic = TheGlobalData->isClassicUI();+ if( !classic )+ p.z += healthBarArtLift( obj );ICoord2D screenCenter;if( !TheTacticalView->worldToScreen( &p, &screenCenter ) )return FALSE;@@ -3033,7 +3036,7 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region )// screen: on a 2560 wide screen a tank was three times its 800x600 size wearing the same// hairline bar. Both follow the screen now.//- const Real uiScale = TheUIScale();+ const Real uiScale = classic ? 1.0f : TheUIScale();healthBoxWidth *= uiScale;// do this so health bar doesn't get too skinny or fat after scaling@@ -3313,6 +3316,14 @@ void Drawable::drawContained( const IRegion2D *healthBarRegion )if (!TheGlobalData->m_showObjectHealth)return;+ // Classic is EA's rule: your own container, selected or under the pointer, and only once+ // somebody is inside+ const Bool classic = TheGlobalData->isClassicUI();+ if (classic &&+ !((isSelected() || (TheInGameUI && TheInGameUI->getMousedOverDrawableID() == getID())) &&+ obj->getControllingPlayer() == ThePlayerList->getLocalPlayer()))+ return;+//// ...and a building you can garrison shows them whoever holds it. How many rooms are left in// that civilian block is the question you ask before sending a squad at it, and how many are@@ -3331,7 +3342,7 @@ void Drawable::drawContained( const IRegion2D *healthBarRegion )// empty containers still show their (empty) pips, unless the player switched that off for// buildings: a Barracks wears ten empty boxes for the whole match otherwise- if (numFull == 0 && !TheGlobalData->m_showEmptyBuildingPips && obj->isKindOf( KINDOF_STRUCTURE ))+ if (numFull == 0 && (classic || (!TheGlobalData->m_showEmptyBuildingPips && obj->isKindOf( KINDOF_STRUCTURE ))))return;Int numInfantry = 0;@@ -4422,7 +4433,11 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)// m_showObjectHealth is the debug master switch (a cheat key toggles it); which units wear a bar// while it is on is the player's HealthBars setting, applied further down once the health is known- if( TheGlobalData->m_showObjectHealth )+ // Classic is EA's rule: a bar only over what is selected or under the pointer, and over anything+ // that is, with EA's colours and none of this fork's filters+ const Bool classic = TheGlobalData->isClassicUI();+ const Bool mousedOver = TheInGameUI != NULL && TheInGameUI->getMousedOverDrawableID() == getID();+ if( TheGlobalData->m_showObjectHealth && ( !classic || isSelected() || mousedOver ) ){Object *obj = getObject();@@ -4450,7 +4465,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)//// A booby trap has one hit point and cannot be shot, so its bar was a full green line// forever, over something that is meant to be hidden.- if( obj->isKindOf( KINDOF_PROJECTILE ) ||+ if( !classic && ( obj->isKindOf( KINDOF_PROJECTILE ) ||obj->isKindOf( KINDOF_BOOBY_TRAP ) ||obj->isKindOf( KINDOF_INERT ) ||obj->isKindOf( KINDOF_CLEANUP_HAZARD ) ||@@ -4459,10 +4474,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)obj->isKindOf( KINDOF_HULK ) ||obj->isKindOf( KINDOF_CLICK_THROUGH ) ||obj->isKindOf( KINDOF_CRATE ) ||- ( obj->isKindOf( KINDOF_IMMOBILE ) && !obj->isKindOf( KINDOF_STRUCTURE ) ) )+ ( obj->isKindOf( KINDOF_IMMOBILE ) && !obj->isKindOf( KINDOF_STRUCTURE ) ) ) )return;- if( obj->isKindOf( KINDOF_STRUCTURE ) )+ if( !classic && obj->isKindOf( KINDOF_STRUCTURE ) ){const ContainModuleInterface *contain = obj->getContain();const Bool isBridge = obj->isKindOf( KINDOF_BRIDGE ) ||@@ -4505,10 +4520,9 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)// the player's setting decides who wears one. It is tested here rather than at the top of the// function because smart mode needs the health, and the health needs the body module.- if( !Drawable_healthBarModeShows( TheGlobalData->m_healthBarMode,+ if( !classic && !Drawable_healthBarModeShows( TheGlobalData->m_healthBarMode,isSelected(),- TheInGameUI != NULL &&- TheInGameUI->getMousedOverDrawableID() == getID(),+ mousedOver,health < maxHealth ) )return;@@ -4521,13 +4535,17 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)//Color color, outlineColor;- if( Drawable_disabledShowsBlueHealthBar( obj->getDisabledFlags() ) )+ const Bool blue = classic+ ? ( obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ||+ ( obj->isDisabled() && !obj->isDisabledByType( DISABLED_HELD ) ) )+ : Drawable_disabledShowsBlueHealthBar( obj->getDisabledFlags() );+ if( blue ){color = GameMakeColor( 0, healthRatio * 255.0f, 255, 255 );//blue to cyanoutlineColor = GameMakeColor( 0, healthRatio * 128.0f, 128, 255 );//dark blue to dark cyan}- else if( obj->getControllingPlayer() != NULL &&+ else if( !classic && obj->getControllingPlayer() != NULL &&obj->getControllingPlayer()->getPlayerColor() != 0 ){//@@ -4606,7 +4624,8 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)// 2D overlay and the pick ray only knows about the 3D scene, so without this a click on a bar// hits nothing at all.//- TheGameClient->addHealthBarPickRegion( this, *healthBarRegion );+ if( !classic )+ TheGameClient->addHealthBarPickRegion( this, *healthBarRegion );// draw the health box outlineTheDisplay->drawOpenRect( healthBarRegion->lo.x, healthBarRegion->lo.y, healthBoxWidth, healthBoxHeight,@@ -4616,7 +4635,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)// reads in a crowd where every unit carries a bar, without reserving a row above the bar for// a marker. It sits outside rather than replacing the outline, so the bar keeps its owner// colour all the way round.- if( isSelected() )+ if( isSelected() && !classic )TheDisplay->drawOpenRect( healthBarRegion->lo.x - 1, healthBarRegion->lo.y - 1,healthBoxWidth + 2, healthBoxHeight + 2,healthBoxOutlineSize, GameMakeColor( 255, 255, 255, 255 ) );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cppindex c2394de72..cb313da08 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp@@ -847,7 +847,9 @@ void ControlBar::updateContextCommand( void ){const ThingTemplate *tmpl = command->getThingTemplate();Player *localPlayer = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;- if( tmpl && localPlayer )+ // Classic's cameos are EA's pictures alone: no seconds, price or power on them. The+ // seconds were wall-clock ones, so they crept up whenever the match ran under 30 frames+ if( tmpl && localPlayer && !TheGlobalData->isClassicUI() ){GadgetButtonSetSeconds( win, ControlBar_secondsFromFrames( (Real)tmpl->calcTimeToBuild( localPlayer ) ) );//@@ -886,7 +888,7 @@ void ControlBar::updateContextCommand( void )const UpgradeTemplate *ut = command->getUpgradeTemplate();Player *localPlayer = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;- if( ut && localPlayer )+ if( ut && localPlayer && !TheGlobalData->isClassicUI() ){GadgetButtonSetSeconds( win, ControlBar_secondsFromFrames( (Real)ut->calcTimeToBuild( localPlayer ) ) );GadgetButtonSetCost( win, ut->calcCostToBuild( localPlayer ) );