Skip to content

Commit 38b1a25

Browse files
author
Ibra
committed
bugfix: Fix obs overlay font adjustment after merge, normalize notification content, fix spectre multi notifs, add per type toggles and observer notification keybinds
1 parent d48d6aa commit 38b1a25

12 files changed

Lines changed: 356 additions & 161 deletions

File tree

Core/GameEngine/Include/Common/OptionPreferences.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,7 @@ class OptionPreferences : public UserPreferences
131131

132132
Int getObserverStatsFontSize(void);
133133
Int getObserverNotificationFontSize(void);
134+
Bool getObserverNotificationSpecialPowerUsage(void);
135+
Bool getObserverNotificationSpecialPowerPurchase(void);
136+
Bool getObserverNotificationMilestone(void);
134137
};

Core/GameEngine/Source/Common/OptionPreferences.cpp

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,27 +116,73 @@ Int OptionPreferences::getCampaignDifficulty()
116116
return factor;
117117
}
118118

119-
Int OptionPreferences::getObserverNotificationFontSize(void) {
120-
OptionPreferences::const_iterator it = find("ObserverNotificationFontSize");
121-
if (it == end())
122-
return 10;
123-
Int fontSize = atoi(it->second.str());
124-
if (fontSize < 0)
125-
fontSize = 0;
126-
return fontSize;
119+
Int OptionPreferences::getObserverNotificationFontSize(void)
120+
{
121+
OptionPreferences::const_iterator it = find("ObserverNotificationFontSize");
122+
if (it == end())
123+
return 10;
124+
Int fontSize = atoi(it->second.str());
125+
if (fontSize < 0)
126+
{
127+
fontSize = 0;
128+
}
129+
if (fontSize > 15)
130+
{
131+
fontSize = 15;
132+
}
133+
return fontSize;
134+
}
135+
136+
Bool OptionPreferences::getObserverNotificationSpecialPowerUsage(void)
137+
{
138+
OptionPreferences::const_iterator it = find("ObserverNotificationSpecialPowerUsage");
139+
if (it == end())
140+
return TheGlobalData->m_observerNotificationSpecialPowerUsage;
141+
if (stricmp(it->second.str(), "yes") == 0)
142+
{
143+
return TRUE;
144+
}
145+
return FALSE;
146+
}
147+
148+
Bool OptionPreferences::getObserverNotificationSpecialPowerPurchase(void)
149+
{
150+
OptionPreferences::const_iterator it = find("ObserverNotificationSpecialPowerPurchase");
151+
if (it == end())
152+
return TheGlobalData->m_observerNotificationSpecialPowerPurchase;
153+
if (stricmp(it->second.str(), "yes") == 0)
154+
{
155+
return TRUE;
156+
}
157+
return FALSE;
158+
}
159+
160+
Bool OptionPreferences::getObserverNotificationMilestone(void)
161+
{
162+
OptionPreferences::const_iterator it = find("ObserverNotificationMilestone");
163+
if (it == end())
164+
return TheGlobalData->m_observerNotificationMilestone;
165+
if (stricmp(it->second.str(), "yes") == 0)
166+
{
167+
return TRUE;
168+
}
169+
return FALSE;
127170
}
128171

129172
Int OptionPreferences::getObserverStatsFontSize(void)
130173
{
131174
OptionPreferences::const_iterator it = find("ObserverStatsFontSize");
132175
if (it == end())
133176
return 7;
134-
135177
Int fontSize = atoi(it->second.str());
136178
if (fontSize < 0)
137179
{
138180
fontSize = 0;
139181
}
182+
if (fontSize > 15)
183+
{
184+
fontSize = 15;
185+
}
140186
return fontSize;
141187
}
142188

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ class GlobalData : public SubsystemInterface
437437

438438
// Generals Online @feature 16/1/2025 allow the observer notification font size to be set, a size of zero disables it
439439
Int m_observerNotificationFontSize;
440+
Bool m_observerNotificationSpecialPowerUsage;
441+
Bool m_observerNotificationSpecialPowerPurchase;
442+
Bool m_observerNotificationMilestone;
440443

441444
Real m_shakeSubtleIntensity; ///< Intensity for shaking a camera with SHAKE_SUBTLE
442445
Real m_shakeNormalIntensity; ///< Intensity for shaking a camera with SHAKE_NORMAL

GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ class GameMessage : public MemoryPoolObject
248248

249249
MSG_META_INCREASE_OBSERVER_STATS_FONT, ///< Generals Online @feature Increase observer overlay size
250250
MSG_META_DECREASE_OBSERVER_STATS_FONT, ///< Generals Online @feature Decrease observer overlay size
251+
MSG_META_INCREASE_OBSERVER_NOTIFICATION_FONT, ///< Generals Online @feature Increase observer notification size
252+
MSG_META_DECREASE_OBSERVER_NOTIFICATION_FONT, ///< Generals Online @feature Decrease observer notification size
251253

252254
MSG_META_BEGIN_PATH_BUILD, ///< enter path-building mode
253255
MSG_META_END_PATH_BUILD, ///< exit path-building mode

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@ class InGameUI : public SubsystemInterface, public Snapshot
622622
void triggerDoubleClickAttackMoveGuardHint();
623623

624624
void drawObserverNotifications(Int& x, Int& y);
625-
void updateObserverNotifications(UnsignedInt currentFrame);
626625
void checkObserverMilestones(UnsignedInt currentFrame);
627626
void addObserverNotification(const UnicodeString& playerName, const wchar_t* message, Color playerColor);
628627
void addObserverNotificationRaw(const UnicodeString& message, Color color);
@@ -685,10 +684,8 @@ class InGameUI : public SubsystemInterface, public Snapshot
685684
Bool reachedLevel3;
686685
Bool reachedLevel5;
687686
Bool reached10kCPM;
688-
Bool reached20kCPM;
689-
Bool reached50kCPM;
690-
Bool reached100kCPM;
691-
Bool warnedFloating100k;
687+
Bool stolenPower;
688+
Bool gotHunted;
692689
};
693690

694691
struct PlayerData {
@@ -1051,7 +1048,7 @@ class InGameUI : public SubsystemInterface, public Snapshot
10511048
// Obs overlay
10521049
static const Int numCols = 8;
10531050
const wchar_t* headers[numCols] = {
1054-
L"(T) Name", L"Army", L"Cash", L"Cash/m", L"(R) XP", L"SP", L"K/D", L"Power"
1051+
L"(T) Player", L"Army", L"Cash", L"Cash/m", L"(R) XP", L"SP", L"K/D", L"Power"
10551052
};
10561053

10571054
struct ObsOverlayPlayerData

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,9 @@ GlobalData::GlobalData()
963963

964964
m_observerStatsFontSize = 7;
965965
m_observerNotificationFontSize = 10;
966+
m_observerNotificationSpecialPowerUsage = TRUE;
967+
m_observerNotificationSpecialPowerPurchase = TRUE;
968+
m_observerNotificationMilestone = TRUE;
966969

967970
m_showMoneyPerMinute = FALSE;
968971
m_allowMoneyPerMinuteForPlayer = FALSE;
@@ -1258,6 +1261,9 @@ void GlobalData::parseGameDataDefinition( INI* ini )
12581261
TheWritableGlobalData->m_showMoneyPerMinute = optionPref.getShowMoneyPerMinute();
12591262
TheWritableGlobalData->m_observerStatsFontSize = optionPref.getObserverStatsFontSize();
12601263
TheWritableGlobalData->m_observerNotificationFontSize = optionPref.getObserverNotificationFontSize();
1264+
TheWritableGlobalData->m_observerNotificationSpecialPowerUsage = optionPref.getObserverNotificationSpecialPowerUsage();
1265+
TheWritableGlobalData->m_observerNotificationSpecialPowerPurchase = optionPref.getObserverNotificationSpecialPowerPurchase();
1266+
TheWritableGlobalData->m_observerNotificationMilestone = optionPref.getObserverNotificationMilestone();
12611267

12621268
TheWritableGlobalData->m_antiAliasLevel = optionPref.getAntiAliasing();
12631269
TheWritableGlobalData->m_textureFilteringMode = optionPref.getTextureFilterMode();

GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t)
348348

349349
CASE_LABEL(MSG_META_INCREASE_OBSERVER_STATS_FONT)
350350
CASE_LABEL(MSG_META_DECREASE_OBSERVER_STATS_FONT)
351+
CASE_LABEL(MSG_META_INCREASE_OBSERVER_NOTIFICATION_FONT)
352+
CASE_LABEL(MSG_META_DECREASE_OBSERVER_NOTIFICATION_FONT)
351353
CASE_LABEL(MSG_META_INCREASE_MAX_RENDER_FPS)
352354
CASE_LABEL(MSG_META_DECREASE_MAX_RENDER_FPS)
353355
CASE_LABEL(MSG_META_INCREASE_LOGIC_TIME_SCALE)

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,17 @@ static void saveOptions()
837837
TheWritableGlobalData->m_showMoneyPerMinute = show;
838838
}
839839

840+
//-------------------------------------------------------------------------------------------------
841+
// Set Observer Stats Font Size
842+
val = pref->getObserverStatsFontSize();
843+
if (val >= 0)
844+
{
845+
AsciiString prefString;
846+
prefString.format("%d", val);
847+
(*pref)["ObserverStatsFontSize"] = prefString;
848+
TheInGameUI->initObserverOverlay();
849+
}
850+
840851
//-------------------------------------------------------------------------------------------------
841852
// Resolution
842853
//

0 commit comments

Comments
 (0)