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(gameengine): queue squares over the production bar, seconds gone
Olcay Seygan386cf9507a94
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7efdab447..845915833 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -260,6 +260,7 @@ found and fixed, EA's own, not port damage.**- The bars over units are a third thinner, so a big fight no longer looks like a sheet of red and green stripes over the units underneath.- Health a unit has lost now shows as a dark stretch at the end of its bar. It used to be bare ground, so a red bar over red ground, or any team colour over the wrong terrain, looked full when it was half gone.+- A factory's white bar now says how much is waiting behind it. One small square sits over the bar's right end for each order in line, so a barracks with four on order wears three and one on its last wears none, and a glance across the base shows which factory is busy for the next minute. The seconds written on the bar are gone; the build button and the queue still count them down.## Jets fly like jetsdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.hindex 1a1f2bf2a..48b05ae08 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h@@ -897,7 +897,6 @@ private:DisplayString* m_constructDisplayString; ///< string to display construction % completeDisplayString* m_supplyCashDisplayString; ///< string to display the cash left in a supply pileInt m_lastSupplyCashDisplayed; ///< so the string is only rebuilt when the pile shrinks- DisplayString* m_productionTimeDisplayString; ///< seconds left on what this building is makingDisplayString* m_chargeTimeDisplayString; ///< seconds left on a public timer charging hereDisplayString* m_captionDisplayString; ///< string to display captionDisplayString* m_groupNumber; ///< string to display the group number of this drawablediff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cppindex 029bb396c..44936152e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp@@ -642,7 +642,6 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBitm_lastConstructDisplayed = -1.0f;m_supplyCashDisplayString = NULL;m_lastSupplyCashDisplayed = -1;- m_productionTimeDisplayString = NULL;m_chargeTimeDisplayString = NULL;m_constructDisplayString = NULL; // buildRenderObjects@@ -849,10 +848,6 @@ Drawable::~Drawable()TheDisplayStringManager->freeDisplayString( m_supplyCashDisplayString );m_supplyCashDisplayString = NULL;- if( m_productionTimeDisplayString )- TheDisplayStringManager->freeDisplayString( m_productionTimeDisplayString );- m_productionTimeDisplayString = NULL;-if( m_chargeTimeDisplayString )TheDisplayStringManager->freeDisplayString( m_chargeTimeDisplayString );m_chargeTimeDisplayString = NULL;@@ -4995,13 +4990,13 @@ static void freeOwnCountdown( DisplayString *&countdown )countdown = NULL;}-static Int drawOwnCountdown( DisplayString *&countdown, Int seconds, Int x, Int y )+static void drawOwnCountdown( DisplayString *&countdown, Int seconds, Int x, Int y ){if( countdown == NULL ){countdown = TheDisplayStringManager->newDisplayString();if( countdown == NULL )- return 0;+ return;countdown->setFont( TheFontLibrary->getFont( TheInGameUI->getDrawableCaptionFontName(),TheGlobalLanguageData->adjustFontSize( TheInGameUI->getDrawableCaptionPointSize() - 2 ),@@ -5015,7 +5010,6 @@ static Int drawOwnCountdown( DisplayString *&countdown, Int seconds, Int x, IntInt textW, textH;countdown->getSize( &textW, &textH );countdown->draw( x, y - textH, GameMakeColor( 255, 255, 255, 255 ), GameMakeColor( 0, 0, 0, 255 ) );- return textH;}//-------------------------------------------------------------------------------------------------@@ -5288,11 +5282,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)(healthBoxWidth - 2) - healthFillWidth, healthBoxHeight - 2,GameMakeColor( 10, 10, 10, 190 ) );- // bars stack upwards from just above the health bar, each clearing the seconds written over- // the one below it+ // bars stack upwards from just above the health bar, each clearing what is drawn over the one below itInt stackY = healthBarRegion->lo.y - 3;- // own producers show a white production-progress bar above the health bar, with seconds left at its top-left+ // own producers show a white production-progress bar above the health barProductionUpdateInterface *pu = hasIconModule( ICON_MODULE_PRODUCTION ) && showsOwnerDetail( obj )? obj->getProductionUpdateInterface() : NULL;const ProductionEntry *pe = pu ? pu->firstProduction() : NULL;@@ -5311,19 +5304,30 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)(healthBoxWidth - 2) * pct * 0.01f, healthBoxHeight - 2,GameMakeColor( 255, 255, 255, 255 ) );- Player *player = obj->getControllingPlayer();- Int totalFrames = pe->getProductionType() == PRODUCTION_UNIT- ? pe->getProductionObject()->calcTimeToBuild( player )- : pe->getProductionUpgrade()->calcTimeToBuild( player );- Int secondsLeft = ControlBar_secondsFromFrames( totalFrames * (1.0f - pct * 0.01f) );-- Int textH = drawOwnCountdown( m_productionTimeDisplayString, secondsLeft, healthBarRegion->lo.x, prodY );+ stackY = prodY - 3;- // whatever comes next goes above the seconds, not through them- stackY = prodY - textH - 1;+ //+ // One white square over the bar's right end for each entry waiting behind the one being made.+ // The squares share a black outline, so they stay apart on any ground, follow the bar's own+ // thickness up the screen sizes, and start a new row when a far zoom makes the bar too short.+ //+ const Int waiting = (Int)pu->getProductionCount() - 1;+ if( waiting > 0 )+ {+ const Int side = (Int)healthBoxHeight + 2;+ const Int pitch = side - 1;+ const Int perRow = max( 1, ((Int)healthBoxWidth - 1) / pitch );+ const Int bottom = prodY - 1 - side;+ for( Int i = 0; i < waiting; ++i )+ {+ const Int x = healthBarRegion->lo.x + (Int)healthBoxWidth - side - (i % perRow) * pitch;+ const Int y = bottom - (i / perRow) * pitch;+ TheDisplay->drawFillRect( x, y, side, side, GameMakeColor( 0, 0, 0, 255 ) );+ TheDisplay->drawFillRect( x + 1, y + 1, side - 2, side - 2, GameMakeColor( 255, 255, 255, 255 ) );+ }+ stackY = bottom - ((waiting - 1) / perRow) * pitch - 3;+ }}- else- freeOwnCountdown( m_productionTimeDisplayString );//// A weapon on a long reload, on a unit of ours the player is looking at: selected or under