Skip to content

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.

fix(gameclient): tidy the watched queue and the superweapon timers

Olcay Seygan9ff13765d790
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c8df72b1..43b8b2457 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -238,6 +238,7 @@ found and fixed — EA's own, not port damage.**
- Workers go back to collecting supplies when they finish.
- Every countdown reads real seconds and answers the game speed.
- The clock and frame-rate readout is drawn on top of everything.
+- The superweapon countdowns start below that readout instead of behind it.
- A game opens with nothing selected, so your first click is not a rally point.
- The tilde key opens the general's promotions.
- `S` stops your units again; the key was simply never bound.
@@ -249,7 +250,7 @@ found and fixed — EA's own, not port damage.**
- Aircraft always show how many attack runs they have left.
- The corner readout separates game time from real time, and sim rate from fps.
- Pausing stops both clocks.
-- Watching a match, the strip becomes every player's queue at once: one row each, bordered in that player's colour.
+- Watching a match, the strip becomes every player's queue at once: one row each, bordered in that player's colour, showing the five that land soonest and a count of the rest.
- Watching, the bars over the buildings are everyone's too - what each factory is turning out, and how long the superweapons have left. An observer used to see none of it.
## Placing buildings
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 743e57e99..0f12bb187 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -585,6 +585,7 @@ public: // ********************************************************************
// producer's queue it is, and where it was drawn this frame.
//
enum { PRODUCTION_STRIP_ROW_MAX = 16 }; ///< cameos one row will draw; the rest become a "+N"
+ enum { PRODUCTION_STRIP_WATCH_MAX = 5 }; ///< and while watching, where eight rows share the screen
enum { PRODUCTION_STRIP_ROWS = 8 }; ///< playing: the global row and the selected producer's row.
/// watching: one row per player, so eight of them
struct ProductionStripSlot
@@ -916,6 +917,7 @@ protected:
Real m_hudLogicHz; ///< logic frames actually simulated per real second
UnsignedInt m_hudRealClockBaseMs; ///< wall clock the two elapsed-time readouts were aligned at
UnsignedInt m_hudLastDrawMs; ///< wall clock of the previous overlay draw, so a pause can be taken back out of it
+ Int m_hudOverlayBottom; ///< bottom of that corner plate, so the superweapon timers start under it
// A script time freeze stops the logic clock, and the military subtitle's counters are
// logic frames, so they have to be stepped by hand while it lasts. These two turn the
// wall clock into that step without drift: every update works out how many 30Hz frames
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index f0b21253c..6a3f99bb7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1076,6 +1076,7 @@ InGameUI::InGameUI()
m_hudLogicHz = 0.0f;
m_hudRealClockBaseMs = 0;
m_hudLastDrawMs = 0;
+ m_hudOverlayBottom = 0;
for( Int incomeBucket = 0; incomeBucket < INCOME_SAMPLES; incomeBucket++ )
m_incomeSamples[ incomeBucket ] = 0;
m_incomeSampleCount = 0;
@@ -4107,6 +4108,14 @@ void InGameUI::postDraw( void )
// Int superweaponCount = 0;
Int startX = (Int)(m_superweaponPosition.x * TheDisplay->getWidth());
Int startY = (Int)(m_superweaponPosition.y * TheDisplay->getHeight());
+
+ //
+ // The corner clock plate owns the top right, and the first timer was drawn straight
+ // underneath it - a superweapon counting down behind the readout is one nobody can read.
+ // The list starts below the plate whenever the plate is up.
+ //
+ if( TheGlobalData->m_showHudOverlay && startY < m_hudOverlayBottom + 4 )
+ startY = m_hudOverlayBottom + 4;
Int bottomMargin = (Int)( (Real)TheTacticalView->getHeight() * 0.82f );
@@ -5895,6 +5904,9 @@ void InGameUI::drawHudOverlay( void )
TheDisplay->drawFillRect( x - pad, y - 1, textWidth + pad*2, textHeight + 2,
GameMakeColor( 0, 0, 0, 140 ) );
+ // the superweapon timers read this to start below the plate rather than behind it
+ m_hudOverlayBottom = y - 1 + textHeight + 2;
+
m_hudDisplayString->draw( x, y, GameMakeColor( 235, 235, 235, 255 ), GameMakeColor( 0, 0, 0, 255 ) );
}
@@ -6007,12 +6019,13 @@ struct ProductionStripGather
InGameUI::ProductionStripSlot *slot;
Int *count;
Int *total;
+ Int max; ///< cameos this row will draw; the rest are counted into the "+N"
};
static void gatherProductionStrip( Object *obj, void *userData )
{
ProductionStripGather *g = (ProductionStripGather *)userData;
- appendProducerQueue( obj, g->slot, g->count, InGameUI::PRODUCTION_STRIP_ROW_MAX, g->total );
+ appendProducerQueue( obj, g->slot, g->count, g->max, g->total );
}
//-------------------------------------------------------------------------------------------------
@@ -6214,6 +6227,8 @@ void InGameUI::drawProductionStrip( void )
watch.slot = m_productionStrip[ row ];
watch.count = &m_productionStripCount[ row ];
watch.total = &m_productionStripTotal[ row ];
+ // eight rows are on screen at once here, so each one is the five soonest and a "+N"
+ watch.max = PRODUCTION_STRIP_WATCH_MAX;
p->iterateObjects( gatherProductionStrip, &watch );
if( m_productionStripCount[ row ] > 0 )
@@ -6229,6 +6244,7 @@ void InGameUI::drawProductionStrip( void )
gather.slot = m_productionStrip[ 0 ];
gather.count = &m_productionStripCount[ 0 ];
gather.total = &m_productionStripTotal[ 0 ];
+ gather.max = PRODUCTION_STRIP_ROW_MAX;
player->iterateObjects( gatherProductionStrip, &gather );
//