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.

feat(gameclient): bouncing wireframe notice over the reforged hud

Olcay Seygan7088e1eb0597
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index eaf0a8f5a..7d1fe948d 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1314,6 +1314,10 @@ GUI:PeaceTimeHudLabel
"PEACE"
END
+GUI:WireframeNotice
+"UI is wireframe, will be updated."
+END
+
GUI:LobbyTabChat
"Chat"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 0001b88f1..7c1fed3b1 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15641,6 +15641,10 @@ GUI:PeaceTimeHudLabel
"BARIŞ"
END
+GUI:WireframeNotice
+"Arayüz taslak, güncellenecek."
+END
+
GUI:LobbyTabChat
"Sohbet"
END
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 8b5c8c06a..32c5a226f 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -1574,6 +1574,7 @@ protected:
void drawPeaceTimer( void ); ///< the lobby's peace time, counting down at the top of the screen
void drawPeaceCountdown( UnsignedInt framesLeft ); ///< the last seconds of it, one big digit in the middle of the screen
void drawHudOverlay( void ); ///< the small elapsed-time / fps plate (ShowHudOverlay)
+ void drawWireframeNotice( void ); ///< "the interface is a draft" bouncing round the command bar's band
void drawProductionStrip( void ); ///< the production queue rows above the control bar
///< the run of cells, a column, with its left edge at 'left' and its first cell's top edge at 'bottomY'
void drawProductionStripColumn( Int left, Int bottomY );
@@ -1783,6 +1784,10 @@ protected:
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 everything drawn in the top right corner, so the superweapon timers start under it
+ DisplayString * m_wireframeNotice; ///< the draft notice drawWireframeNotice bounces
+ Coord2D m_wireframePos; ///< its top left corner on screen
+ Coord2D m_wireframeDir; ///< which way it is going, each axis +1 or -1
+ UnsignedInt m_wireframeLastMs; ///< wall clock of its previous draw, 0 before the first
// 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 87c46c63a..0ab9d9beb 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1233,6 +1233,10 @@ InGameUI::InGameUI()
m_hudRealClockBaseMs = 0;
m_hudLastDrawMs = 0;
m_hudOverlayBottom = 0;
+ m_wireframeNotice = NULL;
+ m_wireframePos.x = m_wireframePos.y = 0.0f;
+ m_wireframeDir.x = m_wireframeDir.y = 1.0f;
+ m_wireframeLastMs = 0;
m_productionStripCount = 0;
m_productionStripTotal = 0;
m_productionStripCameoW = PRODUCTION_STRIP_CAMEO;
@@ -11603,6 +11607,65 @@ void InGameUI::drawDirectorIntroPlate( void )
drawBroadcastPlate( under, underLeft, top + nameHeight, shown );
}
+//-------------------------------------------------------------------------------------------------
+/** The Reforged command bar is still a draft, and players kept reporting it as one. This says so
+ * first: a line of text drifting diagonally over the bar's band and turning back off its edges.
+ * It moves on the wall clock, so 120 frames a second and 30 cross the bar at the same speed, and
+ * it is only drawn, never a window, so a click goes straight through it. */
+//-------------------------------------------------------------------------------------------------
+void InGameUI::drawWireframeNotice( void )
+{
+ if( TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )
+ return;
+ // hidden while the game loads and in the observer views, and then there is nothing to excuse
+ if( TheControlBar->getMasterParent()->winIsHidden() )
+ return;
+
+ // the three plates' laid out rectangles: radar on the left to the powers on the right
+ IRegion2D box = *TheControlBar->getPanelRect( 0 );
+ for( Int p = 1; p < ControlBar::CB_PANEL_COUNT; p++ )
+ {
+ const IRegion2D *panel = TheControlBar->getPanelRect( p );
+ box.lo.x = min( box.lo.x, panel->lo.x );
+ box.lo.y = min( box.lo.y, panel->lo.y );
+ box.hi.x = max( box.hi.x, panel->hi.x );
+ box.hi.y = max( box.hi.y, panel->hi.y );
+ }
+ box.hi.y = min( box.hi.y, (Int)TheDisplay->getHeight() );
+
+ if( m_wireframeNotice == NULL )
+ {
+ m_wireframeNotice = TheDisplayStringManager->newDisplayString();
+ m_wireframeNotice->setFont( TheFontLibrary->getFont( m_superweaponNormalFont,
+ TheGlobalLanguageData->adjustFontSize( 16 ), TRUE ) );
+ m_wireframeNotice->setText( TheGameText->fetch( "GUI:WireframeNotice" ) );
+ m_wireframePos.x = (Real)box.lo.x;
+ m_wireframePos.y = (Real)box.lo.y;
+ }
+
+ Int width = 0, height = 0;
+ m_wireframeNotice->getSize( &width, &height );
+
+ // a tenth of the screen's height a second; a frame after a stall or a pause moves at most 100 ms
+ // worth, rather than jumping the text across the bar
+ const UnsignedInt nowMs = Clock_Milliseconds();
+ const UnsignedInt stepMs = m_wireframeLastMs == 0 ? 0 : min( nowMs - m_wireframeLastMs, 100u );
+ m_wireframeLastMs = nowMs;
+ const Real step = TheDisplay->getHeight() * 0.1f * stepMs / 1000.0f;
+ m_wireframePos.x += m_wireframeDir.x * step;
+ m_wireframePos.y += m_wireframeDir.y * step;
+
+ const Real right = (Real)( box.hi.x - width );
+ const Real bottom = (Real)( box.hi.y - height );
+ if( m_wireframePos.x >= right ) { m_wireframePos.x = right; m_wireframeDir.x = -1.0f; }
+ if( m_wireframePos.x <= box.lo.x ) { m_wireframePos.x = (Real)box.lo.x; m_wireframeDir.x = 1.0f; }
+ if( m_wireframePos.y >= bottom ) { m_wireframePos.y = bottom; m_wireframeDir.y = -1.0f; }
+ if( m_wireframePos.y <= box.lo.y ) { m_wireframePos.y = (Real)box.lo.y; m_wireframeDir.y = 1.0f; }
+
+ m_wireframeNotice->draw( REAL_TO_INT( m_wireframePos.x ), REAL_TO_INT( m_wireframePos.y ),
+ GameMakeColor( 255, 220, 120, 170 ), GameMakeColor( 0, 0, 0, 170 ) );
+}
+
//-------------------------------------------------------------------------------------------------
void InGameUI::drawHudOverlay( void )
{
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index 1ff730acb..3e94e3906 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -805,6 +805,7 @@ void W3DInGameUI::draw( void )
{
drawPeaceTimer();
drawHudOverlay();
+ drawWireframeNotice();
drawScoreboard();
}