Skip to content

Commit e233be6

Browse files
authored
feat(gui): Implement Player Info List (TheSuperHackers#2136)
1 parent 6248db9 commit e233be6

11 files changed

Lines changed: 559 additions & 0 deletions

File tree

Core/GameEngine/Include/Common/UserPreferences.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class OptionPreferences : public UserPreferences
146146
Int getRenderFpsFontSize(void);
147147
Int getSystemTimeFontSize(void);
148148
Int getGameTimeFontSize(void);
149+
Int getPlayerInfoListFontSize(void);
149150

150151
Real getResolutionFontAdjustment(void);
151152

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ class GlobalData : public SubsystemInterface
413413
// TheSuperHackers @feature Mauller 21/06/2025 allow the system time and game time font size to be set, a size of zero disables them
414414
Int m_systemTimeFontSize;
415415
Int m_gameTimeFontSize;
416+
// TheSuperHackers @feature L3-M 05/11/2025 allow the player info list font size to be set, a size of zero disables it
417+
Int m_playerInfoListFontSize;
416418

417419
// TheSuperHackers @feature L3-M 21/08/2025 toggle the money per minute display, false shows only the original current money
418420
Bool m_showMoneyPerMinute;

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ friend class Drawable; // for selection/deselection transactions
555555
virtual void refreshRenderFpsResources(void);
556556
virtual void refreshSystemTimeResources( void );
557557
virtual void refreshGameTimeResources( void );
558+
virtual void refreshPlayerInfoListResources( void );
558559

559560
virtual void disableTooltipsUntil(UnsignedInt frameNum);
560561
virtual void clearTooltipsDisabled();
@@ -579,6 +580,7 @@ friend class Drawable; // for selection/deselection transactions
579580
void drawRenderFps(Int &x, Int &y);
580581
void drawSystemTime(Int &x, Int &y);
581582
void drawGameTime();
583+
void drawPlayerInfoList();
582584

583585
public:
584586
void registerWindowLayout(WindowLayout *layout); // register a layout for updates
@@ -777,6 +779,55 @@ friend class Drawable; // for selection/deselection transactions
777779
Color m_gameTimeColor;
778780
Color m_gameTimeDropColor;
779781

782+
struct PlayerInfoList
783+
{
784+
PlayerInfoList();
785+
void init(const AsciiString &fontName, Int pointSize, Bool bold);
786+
void clear();
787+
788+
enum LabelType
789+
{
790+
LabelType_Team,
791+
LabelType_Money,
792+
LabelType_Rank,
793+
LabelType_Xp,
794+
795+
LabelType_Count
796+
};
797+
798+
enum ValueType
799+
{
800+
ValueType_Team,
801+
ValueType_Money,
802+
ValueType_Rank,
803+
ValueType_Xp,
804+
ValueType_Name,
805+
806+
ValueType_Count
807+
};
808+
809+
struct LastValues
810+
{
811+
LastValues();
812+
UnsignedInt values[LabelType_Count][MAX_PLAYER_COUNT];
813+
UnicodeString name[MAX_PLAYER_COUNT];
814+
};
815+
816+
DisplayString *labels[LabelType_Count];
817+
DisplayString *values[ValueType_Count][MAX_PLAYER_COUNT];
818+
LastValues lastValues;
819+
};
820+
821+
PlayerInfoList m_playerInfoList;
822+
AsciiString m_playerInfoListFont;
823+
Int m_playerInfoListPointSize;
824+
Bool m_playerInfoListBold;
825+
Coord2D m_playerInfoListPosition;
826+
Color m_playerInfoListLabelColor;
827+
Color m_playerInfoListValueColor;
828+
Color m_playerInfoListDropColor;
829+
UnsignedInt m_playerInfoListBackgroundAlpha;
830+
780831
// message data
781832
UIMessage m_uiMessages[ MAX_UI_MESSAGES ];/**< messages to display to the user, the
782833
array is organized with newer messages at

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ GlobalData::GlobalData()
942942
m_renderFpsFontSize = 8;
943943
m_systemTimeFontSize = 8;
944944
m_gameTimeFontSize = 8;
945+
m_playerInfoListFontSize = 8;
945946

946947
m_showMoneyPerMinute = FALSE;
947948
m_allowMoneyPerMinuteForPlayer = FALSE;
@@ -1205,6 +1206,7 @@ void GlobalData::parseGameDataDefinition( INI* ini )
12051206
TheWritableGlobalData->m_renderFpsFontSize = optionPref.getRenderFpsFontSize();
12061207
TheWritableGlobalData->m_systemTimeFontSize = optionPref.getSystemTimeFontSize();
12071208
TheWritableGlobalData->m_gameTimeFontSize = optionPref.getGameTimeFontSize();
1209+
TheWritableGlobalData->m_playerInfoListFontSize = optionPref.getPlayerInfoListFontSize();
12081210
TheWritableGlobalData->m_showMoneyPerMinute = optionPref.getShowMoneyPerMinute();
12091211

12101212
Int val=optionPref.getGammaValue();

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,20 @@ Int OptionPreferences::getGameTimeFontSize(void)
959959
return fontSize;
960960
}
961961

962+
Int OptionPreferences::getPlayerInfoListFontSize(void)
963+
{
964+
OptionPreferences::const_iterator it = find("PlayerInfoListFontSize");
965+
if (it == end())
966+
return 8;
967+
968+
Int fontSize = atoi(it->second.str());
969+
if (fontSize < 0)
970+
{
971+
fontSize = 0;
972+
}
973+
return fontSize;
974+
}
975+
962976
Real OptionPreferences::getResolutionFontAdjustment(void)
963977
{
964978
OptionPreferences::const_iterator it = find("ResolutionFontAdjustment");
@@ -1528,6 +1542,17 @@ static void saveOptions( void )
15281542
TheInGameUI->refreshGameTimeResources();
15291543
}
15301544

1545+
//-------------------------------------------------------------------------------------------------
1546+
// Set Player Info List Font Size
1547+
val = pref->getPlayerInfoListFontSize();
1548+
if (val >= 0)
1549+
{
1550+
AsciiString prefString;
1551+
prefString.format("%d", val);
1552+
(*pref)["PlayerInfoListFontSize"] = prefString;
1553+
TheInGameUI->refreshPlayerInfoListResources();
1554+
}
1555+
15311556
//-------------------------------------------------------------------------------------------------
15321557
// Set User Font Scaling Percentage
15331558
val = pref->getResolutionFontAdjustment() * 100.0f; // TheSuperHackers @todo replace with options input when applicable

0 commit comments

Comments
 (0)