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): peace time on its own plate under the money
Olcay Seyganbf7db2dcd35b
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.htmlindex 8a72e621a..063616cf4 100644--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html@@ -94,6 +94,8 @@{{clock.x}} ... the match clock's well at the top of the top page, its figureReadout.html's{{moneyblock.x}} ... the money's well under it, the money's window moved into it+ {{peacebar.x}} ... while the lobby's peace time runs, a third plate under the money's,+ {{peace.x}} ... framed as the other two, and its well; the figure is Readout.html's{{Name.x}} .y .w .h the rectangle of the bar's window Name, {{Name.shown}} "shown" or "hidden"and {{Name.state}} any of "disabled", "hilite", "pushed", for LeftHUD (theradar), RightHUD (the portrait's box), CameoWindow (the portrait),@@ -406,6 +408,14 @@<div class="shade" style="right: -{{moneybar.br}}px; top: -{{moneybar.bt}}px; bottom: -{{moneybar.bb}}px"></div><div class="base" style="left: -{{moneybar.bl}}px; right: -{{moneybar.br}}px; bottom: -{{moneybar.bb}}px"></div></div>+ <div class="piece frame bezel solid {{peacebar.shown}}" style="left: {{peacebar.x}}px; top: {{peacebar.y}}px; width: {{peacebar.w}}px; height: {{peacebar.h}}px; border-width: {{peacebar.bt}}px {{peacebar.br}}px {{peacebar.bb}}px {{peacebar.bl}}px">+ <div class="steel" style="left: -{{peacebar.bl}}px; right: -{{peacebar.br}}px; top: -{{peacebar.bt}}px; bottom: -{{peacebar.bb}}px"></div>+ <div class="shine" style="left: -{{peacebar.bl}}px; right: -{{peacebar.br}}px; top: -{{peacebar.bt}}px"></div>+ <div class="lit" style="left: -{{peacebar.bl}}px; top: -{{peacebar.bt}}px; bottom: -{{peacebar.bb}}px"></div>+ <div class="shade" style="right: -{{peacebar.br}}px; top: -{{peacebar.bt}}px; bottom: -{{peacebar.bb}}px"></div>+ <div class="base" style="left: -{{peacebar.bl}}px; right: -{{peacebar.br}}px; bottom: -{{peacebar.bb}}px"></div>+ </div>+ <div class="piece moneywell {{peace.shown}}" style="left: {{peace.x}}px; top: {{peace.y}}px; width: {{peace.w}}px; height: {{peace.h}}px"><div class="lip"></div></div><div class="piece moneywell {{clock.shown}}" style="left: {{clock.x}}px; top: {{clock.y}}px; width: {{clock.w}}px; height: {{clock.h}}px"><div class="lip"></div></div><div class="piece groove stack {{powerframe.shown}}" style="left: {{powerframe.x}}px; top: {{powerframe.y}}px; width: {{powerframe.w}}px; height: {{powerframe.h}}px"><div class="cells {{power.state}}" style="height: {{powerframe.inner}}px"><div class="cell {{lit}}" data-each="powercells" style="left: {{x}}px; width: {{w}}px; height: {{powerframe.inner}}px"><div class="seg" style="height: {{powerframe.inner}}px; width: {{segw}}px"></div></div></div>diff --git a/GeneralsMD/Code/Data/Window/Html/Readout.html b/GeneralsMD/Code/Data/Window/Html/Readout.htmlindex 0d0965dea..d19a0da5d 100644--- a/GeneralsMD/Code/Data/Window/Html/Readout.html+++ b/GeneralsMD/Code/Data/Window/Html/Readout.html@@ -10,6 +10,10 @@page's own values:{{clock.x}} .y .w .h the clock's well, {{clock.shown}} "hidden" while the top page is down,and {{clock}} the match time, m:ss+ {{peace.x}} .y .w .h the peace time's well under the money's while the truce runs,+ {{peace.shown}} "hidden" otherwise; {{peace.label}} "PEACE" and+ {{peace.time}} m:ss, empty for the last ten seconds, which the game+ counts out under the plate{{selinfo.x}} .y .w .h the column beside a lone unit's portrait, {{selinfo.shown}} the same;{{sel.health}} "820/1000", {{sel.healthw}} the bar's lit length out ofselinfo.w, {{sel.healthstate}} "green", "yellow" or "red", and@@ -31,6 +35,10 @@/* the match clock, the largest figure on the top page, in the middle of its well */.clock { text-align: center; font-size: 16px; font-weight: bold; color: #f1f4f6; }+ /* the peace time in the truce's own red, the word and the time on one line in the middle of its+ well */+ .peace { text-align: center; font-size: 11px; font-weight: bold; color: #ff3030; white-space: nowrap; }+/* the health over ControlBar.html's groove, which stands at the same place */.fill { position: absolute; left: 0; top: 40px; height: 8px; background-color: #3fbf3f; }.fill.yellow { background-color: #e8c83a; }@@ -40,6 +48,7 @@</head><body><div class="piece clock {{clock.shown}}" style="left: {{clock.x}}px; top: {{clock.y}}px; width: {{clock.w}}px; height: {{clock.h}}px; line-height: {{clock.h}}px">{{clock}}</div>+<div class="piece peace {{peace.shown}}" style="left: {{peace.x}}px; top: {{peace.y}}px; width: {{peace.w}}px; height: {{peace.h}}px; line-height: {{peace.h}}px">{{peace.label}} {{peace.time}}</div><div class="piece {{selinfo.shown}}" style="left: {{selinfo.x}}px; top: {{selinfo.y}}px; width: {{selinfo.w}}px; height: {{selinfo.h}}px"><div class="{{sel.healthshown}}"><div class="fill {{sel.healthstate}}" style="width: {{sel.healthw}}px"></div>diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex aa1dce9ce..2a98f134c 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -1637,7 +1637,8 @@ protected:Int m_feedTop; ///< where the feed starts on screen, under the menu key, from the bar's pageICoord2D m_queueCorner; ///< the selection's well's left edge and the console's top on screen: the queue stands thereInt m_consoleTop; ///< the console's top on screen, the build card stands over it- Int m_topBarBottom; ///< the top page's bottom on screen, the scoreboard and the truce hang under it+ Int m_topBarBottom; ///< the top page's bottom on screen, the scoreboard and the feed hang under it+ Int m_peacePlateBottom; ///< the top page's peace time plate's bottom on screen, 0 while it is not up; the last ten seconds hang under itBool m_placementRangeRingUp; ///< the structure on the cursor is armed, so its reach is drawnReal m_placementRingRadius; ///< how far from its centre it hitsdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 4440f419e..3bfcb4d68 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -1175,6 +1175,7 @@ InGameUI::InGameUI()m_queueCorner.x = m_queueCorner.y = 0;m_consoleTop = 0;m_topBarBottom = 0;+ m_peacePlateBottom = 0;m_armedSignal = SIGNAL_KIND_COUNT;m_dozerCheckFrame = 0;for( Int index = 0; index < MAX_PLAYER_COUNT; index++ )@@ -9566,6 +9567,11 @@ void InGameUI::drawPeaceTimer( void )return;}+ // the bar's top page carries it in a plate of its own (drawControlBarPage); this loose plate is+ // for a screen without that page+ if( m_controlBarPageShown && m_peacePlateBottom > 0 )+ return;+const UnsignedInt secs = ControlBar_secondsFromFrames( (Real)left );UnicodeString text;@@ -9679,10 +9685,18 @@ void InGameUI::drawPeaceCountdown( UnsignedInt framesLeft )Int labelWidth = 0, labelHeight = 0;m_peaceTimeLabelDisplayString->getSize( &labelWidth, &labelHeight );- // the same line the plate's word was on, so the word does not move when the plate goes- const Int top = stripPixels( PEACE_TIMER_TOP_PAD );const Int alpha = REAL_TO_INT_CEIL( opacity * 255.0f );+ // with the top page up the word stays in its plate and the digit hangs from the plate's foot;+ // without it, the word and the digit stand on the line the loose plate's word was on+ if( m_controlBarPageShown && m_peacePlateBottom > 0 )+ {+ m_peaceCountdownDisplayString->draw( (TheDisplay->getWidth() - textWidth) / 2, m_peacePlateBottom + stripPixels( 2 ),+ peaceTimeColor( alpha ), GameMakeColor( 0, 0, 0, alpha ) );+ return;+ }++ const Int top = stripPixels( PEACE_TIMER_TOP_PAD );m_peaceTimeLabelDisplayString->draw( (TheDisplay->getWidth() - labelWidth) / 2, top,peaceTimeColor( 255 ), GameMakeColor( 0, 0, 0, 255 ) );@@ -11265,7 +11279,9 @@ enumTOP_WELL_HEIGHT = 22, ///< the top page's clock's wellMONEY_WELL_HEIGHT = 16, ///< the money's well under itTOP_BORDER = 4, ///< the top page's steel round each of them- TOP_BOX_GAP = 2, ///< the battlefield between the clock's plate and the money's+ TOP_BOX_GAP = 2, ///< the battlefield between two of the top page's plates+ PEACE_WELL_WIDTH = 100, ///< the peace time's well under the money, "PEACE 14:59" and a margin: at 88+ ///< the time broke onto a second line at 1920x1080CLOCK_WIDTH = 64, ///< the top page's wells at their narrowest, in the middle of the screenPOWER_BAR_HEIGHT = 12, ///< the power bar's groove in the command grid's headerPOWER_BAR_MARGIN = 6, ///< the header's steel each end of it@@ -12046,6 +12062,37 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, ImoneyBox.hi.y += topBorder;putFrame( values, "moneybar", money, moneyBox, moneyShown );m_topBarBottom = moneyShown ? moneyBox.hi.y : topShown ? clockBox.hi.y : 0;++ // the lobby's peace time in a third plate under the money, while it runs. Last, because it is+ // the one that goes: the clock and the money stay where they are when the truce ends, and what+ // hangs under the top page moves up by the plate and nothing else. Its figure is Readout.html's,+ // which is laid out again every second for the clock anyway; the last ten seconds keep the plate+ // with the word alone, and drawPeaceCountdown counts them out from under it+ const Bool peaceShown = topShown && TheGameLogic->isPeaceTime();+ IRegion2D peace;+ peace.lo.x = ( (Int)TheDisplay->getWidth() - REAL_TO_INT( PEACE_WELL_WIDTH * scale ) ) / 2;+ peace.hi.x = peace.lo.x + REAL_TO_INT( PEACE_WELL_WIDTH * scale );+ peace.lo.y = m_topBarBottom + REAL_TO_INT( TOP_BOX_GAP * scale ) + topBorder;+ peace.hi.y = peace.lo.y + REAL_TO_INT( MONEY_WELL_HEIGHT * scale );+ putPageRect( values, "peace", peace, peaceShown, scale );+ IRegion2D peaceBox = peace;+ peaceBox.lo.x -= topBorder;+ peaceBox.lo.y -= topBorder;+ peaceBox.hi.x += topBorder;+ peaceBox.hi.y += topBorder;+ putFrame( values, "peacebar", peace, peaceBox, peaceShown );+ m_peacePlateBottom = peaceShown ? peaceBox.hi.y : 0;+ if( peaceShown )+ {+ m_topBarBottom = peaceBox.hi.y;+ const UnsignedInt left = TheGameLogic->getPeaceTimeEndFrame() - TheGameLogic->getFrame();+ const UnsignedInt secs = ControlBar_secondsFromFrames( (Real)left );+ UnicodeString time;+ if( left > PEACE_COUNTDOWN_SECONDS * LOGICFRAMES_PER_SECOND )+ time.format( TheGameText->fetch( "GUI:PeaceTimeHud" ), secs / 60, secs % 60 );+ values[ "peace.label" ] = WideCharStringToMultiByte( TheGameText->fetch( "GUI:PeaceTimeHudLabel" ).str() );+ values[ "peace.time" ] = WideCharStringToMultiByte( time.str() );+ }// the event feed hangs in the top left corner under the menu key, and under the top page's foot// too, which on a 4:3 screen reaches over the feed's linesm_feedTop = max( (Int)REAL_TO_INT( MENU_FOOT * scale ), m_topBarBottom );