Skip to content

Commit 8cfddf6

Browse files
committed
Replicate to Generals
1 parent 98b1454 commit 8cfddf6

File tree

6 files changed

+309
-12
lines changed

6 files changed

+309
-12
lines changed

Generals/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ class GlobalData : public SubsystemInterface
399399
Bool m_saveCameraInReplay;
400400
Bool m_useCameraInReplay;
401401

402+
// TheSuperHackers @feature L3-M 05/09/2025 allow the network latency counter and render fps counter font size to be set, a size of zero disables them
403+
Int m_networkLatencyFontSize;
404+
Int m_renderFpsFontSize;
402405
// TheSuperHackers @feature Mauller 21/06/2025 allow the system time and game time font size to be set, a size of zero disables them
403406
Int m_systemTimeFontSize;
404407
Int m_gameTimeFontSize;

Generals/Code/GameEngine/Include/Common/UserPreferences.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class OptionPreferences : public UserPreferences
135135
Int getCampaignDifficulty(void);
136136
void setCampaignDifficulty( Int diff );
137137

138+
Int getNetworkLatencyFontSize(void);
139+
Int getRenderFpsFontSize(void);
138140
Int getSystemTimeFontSize(void);
139141
Int getGameTimeFontSize(void);
140142

Generals/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ friend class Drawable; // for selection/deselection transactions
554554

555555
virtual void recreateControlBar( void );
556556
virtual void refreshCustomUiResources( void );
557+
virtual void refreshNetworkLatencyResources(void);
558+
virtual void refreshRenderFpsResources(void);
557559
virtual void refreshSystemTimeResources( void );
558560
virtual void refreshGameTimeResources( void );
559561

@@ -575,7 +577,10 @@ friend class Drawable; // for selection/deselection transactions
575577
virtual void updateIdleWorker( void );
576578
virtual void resetIdleWorker( void );
577579

578-
void drawSystemTime();
580+
void updateRenderFpsString();
581+
void drawNetworkLatency(Int &x, Int &y);
582+
void drawRenderFps(Int &x, Int &y);
583+
void drawSystemTime(Int &x, Int &y);
579584
void drawGameTime();
580585

581586
public:
@@ -731,6 +736,31 @@ friend class Drawable; // for selection/deselection transactions
731736
VideoBuffer* m_cameoVideoBuffer;///< video playback buffer
732737
VideoStreamInterface* m_cameoVideoStream;///< Video stream;
733738

739+
// Network Latency Counter
740+
DisplayString * m_networkLatencyString;
741+
AsciiString m_networkLatencyFont;
742+
Int m_networkLatencyPointSize;
743+
Bool m_networkLatencyBold;
744+
Coord2D m_networkLatencyPosition;
745+
Color m_networkLatencyColor;
746+
Color m_networkLatencyDropColor;
747+
UnsignedInt m_lastNetworkLatencyFrames;
748+
749+
// Render FPS Counter
750+
DisplayString * m_renderFpsString;
751+
DisplayString * m_renderFpsLimitString;
752+
AsciiString m_renderFpsFont;
753+
Int m_renderFpsPointSize;
754+
Bool m_renderFpsBold;
755+
Coord2D m_renderFpsPosition;
756+
Color m_renderFpsColor;
757+
Color m_renderFpsLimitColor;
758+
Color m_renderFpsDropColor;
759+
UnsignedInt m_renderFpsRefreshMs;
760+
UnsignedInt m_lastRenderFps;
761+
UnsignedInt m_lastRenderFpsLimit;
762+
UnsignedInt m_lastRenderFpsUpdateMs;
763+
734764
// System Time
735765
DisplayString * m_systemTimeString;
736766
AsciiString m_systemTimeFont;

Generals/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,8 @@ GlobalData::GlobalData()
933933
m_saveCameraInReplay = FALSE;
934934
m_useCameraInReplay = FALSE;
935935

936+
m_networkLatencyFontSize = 8;
937+
m_renderFpsFontSize = 8;
936938
m_systemTimeFontSize = 8;
937939
m_gameTimeFontSize = 8;
938940

@@ -1184,6 +1186,8 @@ void GlobalData::parseGameDataDefinition( INI* ini )
11841186
TheWritableGlobalData->m_saveCameraInReplay = optionPref.saveCameraInReplays();
11851187
TheWritableGlobalData->m_useCameraInReplay = optionPref.useCameraInReplays();
11861188

1189+
TheWritableGlobalData->m_networkLatencyFontSize = optionPref.getNetworkLatencyFontSize();
1190+
TheWritableGlobalData->m_renderFpsFontSize = optionPref.getRenderFpsFontSize();
11871191
TheWritableGlobalData->m_systemTimeFontSize = optionPref.getSystemTimeFontSize();
11881192
TheWritableGlobalData->m_gameTimeFontSize = optionPref.getGameTimeFontSize();
11891193

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,34 @@ Real OptionPreferences::getMoneyTransactionVolume(void) const
814814
return volume;
815815
}
816816

817+
Int OptionPreferences::getNetworkLatencyFontSize(void)
818+
{
819+
OptionPreferences::const_iterator it = find("NetworkLatencyFontSize");
820+
if (it == end())
821+
return 8;
822+
823+
Int fontSize = atoi(it->second.str());
824+
if (fontSize < 0)
825+
{
826+
fontSize = 0;
827+
}
828+
return fontSize;
829+
}
830+
831+
Int OptionPreferences::getRenderFpsFontSize(void)
832+
{
833+
OptionPreferences::const_iterator it = find("RenderFpsFontSize");
834+
if (it == end())
835+
return 8;
836+
837+
Int fontSize = atoi(it->second.str());
838+
if (fontSize < 0)
839+
{
840+
fontSize = 0;
841+
}
842+
return fontSize;
843+
}
844+
817845
Int OptionPreferences::getSystemTimeFontSize(void)
818846
{
819847
OptionPreferences::const_iterator it = find("SystemTimeFontSize");
@@ -1370,6 +1398,28 @@ static void saveOptions( void )
13701398
}
13711399
}
13721400

1401+
//-------------------------------------------------------------------------------------------------
1402+
// Set Network Latency Font Size
1403+
val = pref->getNetworkLatencyFontSize();
1404+
if (val >= 0)
1405+
{
1406+
AsciiString prefString;
1407+
prefString.format("%d", val);
1408+
(*pref)["NetworkLatencyFontSize"] = prefString;
1409+
TheInGameUI->refreshNetworkLatencyResources();
1410+
}
1411+
1412+
//-------------------------------------------------------------------------------------------------
1413+
// Set Render FPS Font Size
1414+
val = pref->getRenderFpsFontSize();
1415+
if (val >= 0)
1416+
{
1417+
AsciiString prefString;
1418+
prefString.format("%d", val);
1419+
(*pref)["RenderFpsFontSize"] = prefString;
1420+
TheInGameUI->refreshRenderFpsResources();
1421+
}
1422+
13731423
//-------------------------------------------------------------------------------------------------
13741424
// Set System Time Font Size
13751425
val = pref->getSystemTimeFontSize(); // TheSuperHackers @todo replace with options input when applicable

0 commit comments

Comments
 (0)