Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ class GlobalData : public SubsystemInterface
// Generals Online @feature 11/01/2026 allow the observer stats font size to be set, a size of zero disables it
Int m_observerStatsFontSize;

// Generals Online @feature 16/1/2025 allow the observer notification font size to be set, a size of zero disables it
Int m_observerNotificationFontSize;

Real m_shakeSubtleIntensity; ///< Intensity for shaking a camera with SHAKE_SUBTLE
Real m_shakeNormalIntensity; ///< Intensity for shaking a camera with SHAKE_NORMAL
Real m_shakeStrongIntensity; ///< Intensity for shaking a camera with SHAKE_STRONG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class OptionPreferences : public UserPreferences
Int getSystemTimeFontSize(void);
Int getGameTimeFontSize(void);
Int getObserverStatsFontSize(void);
Int getObserverNotificationFontSize(void);

Real getResolutionFontAdjustment(void);

Expand Down
39 changes: 37 additions & 2 deletions GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ friend class Drawable; // for selection/deselection transactions
virtual ~InGameUI( void );

void refreshObserverStatsResources();
void toggleObserverStats() { m_observerStatsHidden = !m_observerStatsHidden; } // Toggle visibility of the observer stats overlay
// Toggle visibility of the observer stats overlay and notifications
void toggleObserverStats() {
m_observerStatsHidden = !m_observerStatsHidden;
m_observerNotificationsHidden = !m_observerNotificationsHidden;
}

// Inherited from subsystem interface -----------------------------------------------------------
virtual void init( void ); ///< Initialize the in-game user interface
Expand Down Expand Up @@ -613,7 +617,15 @@ friend class Drawable; // for selection/deselection transactions

void triggerDoubleClickAttackMoveGuardHint( void );


void drawObserverNotifications(Int& x, Int& y);
void updateObserverNotifications(UnsignedInt currentFrame);
void checkObserverMilestones(UnsignedInt currentFrame);
void addObserverNotification(const UnicodeString& playerName, const wchar_t* message, Color playerColor);
void addObserverNotificationRaw(const UnicodeString& message, Color color);
void notifyGeneralPromotion(Player* player, ScienceType science);
void notifySpecialPowerUsed(Player* player, const SpecialPowerTemplate* powerTemplate);
void refreshObserverNotificationResources(void);
Bool m_observerNotificationsHidden; // hide/show observer notifications

public:
// World 2D animation methods
Expand Down Expand Up @@ -658,6 +670,23 @@ friend class Drawable; // for selection/deselection transactions

enum { MAX_MOVE_HINTS = 256 };

struct ObserverNotification {
UnicodeString message;
Color color;
UnsignedInt createdRenderMs;
Bool active;
};

struct ObserverMilestone {
Bool reachedLevel3;
Bool reachedLevel5;
Bool reached10kCPM;
Bool reached20kCPM;
Bool reached50kCPM;
Bool reached100kCPM;
Bool warnedFloating100k;
};

struct PlayerData {
UnicodeString name;
UnicodeString faction;
Expand Down Expand Up @@ -841,6 +870,12 @@ friend class Drawable; // for selection/deselection transactions
Coord2D m_observerStatsPosition;
Int m_observerStatsLineStep;

// Observer notifications
std::vector<ObserverNotification> m_observerNotifications;
std::vector<ObserverMilestone> m_observerMilestones;
DisplayString* m_observerNotificationString;
Int m_observerNotificationPointSize;

#if defined(GENERALS_ONLINE)
Color m_colorGood;
Color m_colorBad;
Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ GlobalData::GlobalData()
m_systemTimeFontSize = 8;
m_gameTimeFontSize = 8;
m_observerStatsFontSize = 7;
m_observerNotificationFontSize = 10;

m_showMoneyPerMinute = FALSE;
m_allowMoneyPerMinuteForPlayer = FALSE;
Expand Down Expand Up @@ -1236,6 +1237,7 @@ void GlobalData::parseGameDataDefinition( INI* ini )
TheWritableGlobalData->m_gameTimeFontSize = optionPref.getGameTimeFontSize();
TheWritableGlobalData->m_showMoneyPerMinute = optionPref.getShowMoneyPerMinute();
TheWritableGlobalData->m_observerStatsFontSize = optionPref.getObserverStatsFontSize();
TheWritableGlobalData->m_observerNotificationFontSize = optionPref.getObserverNotificationFontSize();

Int val=optionPref.getGammaValue();
//generate a value between 0.6 and 2.0.
Expand Down
4 changes: 4 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2605,6 +2605,10 @@ Bool Player::attemptToPurchaseScience(ScienceType science)
TheControlBar->markUIDirty();
}

if (TheInGameUI) {
TheInGameUI->notifyGeneralPromotion(this, science);
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,16 @@ Int OptionPreferences::getRenderFpsFontSize(void)
return fontSize;
}

Int OptionPreferences::getObserverNotificationFontSize(void) {
OptionPreferences::const_iterator it = find("ObserverNotificationFontSize");
if (it == end())
return 10;
Int fontSize = atoi(it->second.str());
if (fontSize < 0)
fontSize = 0;
return fontSize;
}

Int OptionPreferences::getObserverStatsFontSize(void)
{
OptionPreferences::const_iterator it = find("ObserverStatsFontSize");
Expand Down Expand Up @@ -1545,6 +1555,16 @@ static void saveOptions( void )
TheInGameUI->refreshRenderFpsResources();
}

//-------------------------------------------------------------------------------------------------
// Set Observer notification Font Size
val = pref->getObserverNotificationFontSize();
if (val >= 0) {
AsciiString prefString;
prefString.format("%d", val);
(*pref)["ObserverNotificationFontSize"] = prefString;
TheInGameUI->refreshObserverNotificationResources();
}

//-------------------------------------------------------------------------------------------------
// Set Observer Stats Font Size
val = pref->getObserverStatsFontSize();
Expand Down
Loading
Loading