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): event feed over the radar replaces the message list

Olcay Seygand899b026a977
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 066294e77..9e3c08c9e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -457,7 +457,7 @@ found and fixed — EA's own, not port damage.**
- The clock and frame-rate readout is drawn on top of everything.
- The superweapon countdowns are pictures now, not a list of names: the same strip treatment, in the top right corner, under that readout. Each one wears its own seconds and a sweeping clock, the next to land sits at the right hand end, and if you are watching more than eighteen of them the rest become a count.
- Every button's corner markings - the hotkey, the price, the time, the number queued - sit flush in the corners instead of floating a few pixels inside them, and are set a size smaller than the button's own text: four labels at full size were eating the picture they were meant to annotate.
-- The messages in the top left corner - out of money, building captured, a unit lost - are set a size smaller, the same notch the superweapon countdowns were taken down by. They are notes on the battlefield, not part of the panel, and at full size a run of them was climbing over the fight they were reporting.
+- The messages that ran down the top left corner, out of money or a structure under attack, are lines of a feed standing on the radar now, the way Dota's kill feed stands on its minimap. Each line sits on a black band that thins out over the battlefield. A line about a player opens on his general's flag with his name in his colour; the rest open on a gold mark. Chat goes in, a player beaten or gone goes in, and so does every superweapon, for a player and a watcher alike. Six lines at most, the newest at the bottom, and the feed steps up over the production queue's row whenever that is out.
- A superweapon's wait is written in plain seconds - 200, not 3:20 - so it compares with every other countdown on the screen at a glance. Once it is charged the number goes away entirely and the picture itself breathes in your colour, which is the one thing you want to catch out of the corner of your eye.
- The countdown inside a strip picture moved down into its bottom left corner and carries the unit with it - 45s, 200s - on a translucent plate. In the middle of the picture it sat on the one thing the picture is there to show, and the plate it lost when it was in the middle earns its place down in the corner, where a pale cameo was swallowing the digits and their shadow together. This applies to the superweapon countdowns in the top right as well.
- Every picture in the row stands in a tray - the same tray your general's powers stand in down in the corner, your own side's copy of it, so the American, Chinese and GLA strips each carry their own metal. The tray is turned back to front, because that bar grows out of the right hand corner and the strip grows out of the left, so its heavy rail leads the row instead of standing between every pair of pictures. It is never stretched to fit, and side by side the trays close up behind each other by exactly what that bar closes its own up by, so a row of them reads as one run of metal rather than a line of loose boxes. Stacked they stand clear of each other instead: a picture in a column carries its whole tray, with none of the one above it cutting across its top edge. The strip is flush against the left edge, and a black rectangle laid over the battlefield is gone.
@@ -499,7 +499,7 @@ found and fixed — EA's own, not port damage.**
- A button under the list opens the armies: every player's six most expensive kinds of unit in cameo trays, with how many of each he has on the field. The generals' emblems on the board stand bare, with no tray round them.
- The drop-downs on the right open over the board instead of pushing it down the screen.
- The superweapon countdowns and the promotions each general has bought moved into a panel on the left, one row per player with his general at the head of it, where they used to be two strips down the right-hand edge.
-- When a superweapon comes ready, the left side says so for eight seconds: whose it is, its picture and its name, "ready to fire". The newest is at the bottom, four at most.
+- A superweapon coming ready or being fired is a line of that feed: whose it is, its picture and its name, then "ready to fire" in green or "launched" in red. Only a watcher used to be told, and only when one came ready.
- Both are an ordinary web page with a stylesheet, in the game's Window folder. Change the colours, the sizes or the order there and the next match you watch draws it that way, and the page opens in a browser too.
- A minimised command bar stays minimised. Changing seats, or clicking another player's unit while watching, put the whole bar back up over the battlefield you had just cleared. A new match still opens with the bar up.
- The command bar's frame is drawn new, in the same steel as the boards. Each panel holds one thing and is exactly its size, the radar, the command grid, the portrait with the experience bar, and wears a steel border outside it. Grey for America, red for China, sand for GLA. It slides and minimises with the bar, and like the boards it is a page in the Window folder; take the page away and the old painted bar comes back.
@@ -604,7 +604,7 @@ found and fixed — EA's own, not port damage.**
- Healing a unit counted as attacking it, so guards chased the wrong target.
- A supply centre could stop accepting trucks permanently.
- Selling a building mid-research gave no refund and left the upgrade in limbo.
-- On-screen messages now hold for two and a half seconds and fade in one.
+- A line of the event feed holds for eight seconds and then goes.
- Closing a dialog while another one sits on top of it no longer leaves the game holding a pointer to the window it just freed. Every click, every keypress and the tab order all read that list, so what it caused was a crash with no pattern to it.
- A dialog asked to open twice closes once. It went on the list of windows that take every click a second time, closing took one copy off, and the other kept eating input for a window nobody could see.
- Ordering a group to use a special power that can kill the units casting it, the GLA rebel ambush over water being the one that does it every time, no longer walks a list of units that the ambush is deleting underneath.
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 4e5aad48b..504490381 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1203,11 +1203,16 @@ GUI:HudFog
"Fog of war"
END
-// under a superweapon's name in the spectator's feed, the moment it can fire
+// after a superweapon's name in the event feed over the radar, the moment it can fire
GUI:HudSuperweaponReady
"ready to fire"
END
+// after a superweapon's name in the event feed, the moment it is fired
+GUI:HudSuperweaponLaunched
+"launched"
+END
+
// the command bar's own buttons, written on them now that the bar is drawn from a page
GUI:BarIdleWorker
"Worker"
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index d74c7d0fe..f6a77ff3c 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15725,6 +15725,10 @@ GUI:HudSuperweaponReady
"ateşe hazır"
END
+GUI:HudSuperweaponLaunched
+"ateşlendi"
+END
+
GUI:BarIdleWorker
"İşçi"
END
diff --git a/GeneralsMD/Code/Data/Window/Html/Feed.html b/GeneralsMD/Code/Data/Window/Html/Feed.html
new file mode 100644
index 000000000..c4cbc1e75
--- /dev/null
+++ b/GeneralsMD/Code/Data/Window/Html/Feed.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<!--
+ The event feed, for a player and a watcher alike: every message the game writes, a superweapon
+ coming ready or being fired, a player beaten or gone, a line of chat. It stands on the radar's
+ under-attack tab in the screen's bottom left corner, the newest line at the bottom, the way Dota's
+ kill feed stands on its minimap. A line is up for eight seconds, six at most, and the oldest goes
+ first. Same materials as Window/Html/Spectator.html, whose header says what the renderer draws.
+
+ The game fills in, every frame a line is up (InGameUI::drawFeed):
+ {{floor}} where the feed stands: the top of the radar's tab, or of the production
+ queue's row while that is over the tab
+ data-each="feed" one entry a line, the oldest first, {{kind}} one of
+ "note" a plain message, all of it in {{before}}
+ "player" a message about one player: {{portrait}} his general's flag,
+ {{color}} his colour, and the text as {{before}} {{name}}
+ {{after}}, his name cut out of it wherever it says it
+ "weapon" a superweapon: {{portrait}} {{color}} {{name}} of its owner,
+ {{image}} its cameo, {{what}} the building's name and
+ {{tagtext}} what happened, {{tag}} "ready" or "launched"
+ All in the page's pixels, a pixel of an 800x600 screen.
+-->
+<html>
+<head>
+<meta charset="utf-8">
+<title>Feed</title>
+<style>
+ html, body { margin: 0; padding: 0; }
+ body { background-color: #3b4a36; color: #e6ebef; font-size: 9px; }
+
+ #feed { position: absolute; left: 0; top: 0; width: 400px; }
+ #lines { position: absolute; left: 0; bottom: 3px; width: 400px; }
+ .line { height: 15px; margin-top: 1px; }
+ /* a black band under the words that thins out to nothing on the right, over the battlefield */
+ .strip { display: inline-block; height: 15px; line-height: 15px; padding: 0 40px 0 2px; white-space: nowrap;
+ background: linear-gradient(to right, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.6) 65%, rgba(0, 0, 0, 0)); }
+
+ .flag { width: 20px; height: 12px; margin-right: 4px; vertical-align: middle; }
+ /* a plain message has no player, so a steel chip with a mark stands where the flag would */
+ .chip { display: inline-block; width: 11px; height: 11px; line-height: 11px; margin: 0 5px 0 4px; vertical-align: middle;
+ text-align: center; font-size: 8px; font-weight: bold; color: #f2cf4a;
+ background: linear-gradient(to bottom, #6f7782, #3f4650); border-top: 1px solid #aab4bf; border-bottom: 1px solid #0c1114; }
+ .who { font-weight: bold; }
+ .cameo { width: 18px; height: 13px; margin: 0 4px; vertical-align: middle; }
+ .what { color: #e8d27a; }
+ .tag { margin-left: 4px; font-weight: bold; }
+ .tag.ready { color: #b8f08a; }
+ .tag.launched { color: #ff6a55; }
+
+ .knote .flag, .knote .cameo, .knote .what, .knote .tag { display: none; }
+ .kplayer .chip, .kplayer .cameo, .kplayer .what, .kplayer .tag { display: none; }
+ .kweapon .chip { display: none; }
+</style>
+</head>
+<body>
+<div id="feed" style="height: {{floor}}px">
+ <div id="lines">
+ <div class="line" data-each="feed">
+ <div class="strip k{{kind}}"><span class="chip">!</span><img class="flag" src="{{portrait}}">{{before}}<span class="who" style="color: {{color}}">{{name}}</span>{{after}}<img class="cameo" src="{{image}}"><span class="what">{{what}}</span><span class="tag {{tag}}">{{tagtext}}</span></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/GeneralsMD/Code/Data/Window/Html/Spectator.html b/GeneralsMD/Code/Data/Window/Html/Spectator.html
index 272d83c78..ed0c3e5a0 100644
--- a/GeneralsMD/Code/Data/Window/Html/Spectator.html
+++ b/GeneralsMD/Code/Data/Window/Html/Spectator.html
@@ -3,12 +3,9 @@
What a spectator sees over the battlefield, dressed in the command bar's own materials: steel
plates with a lit top edge and a dark bottom one, the cameo tray the production strips stand in,
the power bar's fills. The steel follows the side whose bar is on screen, so selecting a Chinese
- unit turns it red. Two pieces, and the players themselves are on the Tab scoreboard:
-
- #hud-top #feed, a superweapon coming ready, on the left for a few seconds, the way Dota's kill
- feed runs
- #right down the right: #watch, the camera, the followed player and the fog, and under it
- #board, every player ranked by a picked stat and the armies
+ unit turns it red. One piece: #right down the right, #watch with the camera, the followed player
+ and the fog, and under it #board, every player ranked by a picked stat and the armies. The players
+ themselves are on the Tab scoreboard and what happens is in Window/Html/Feed.html over the radar.
Laid out by litehtml and drawn by the game (GameClient/HtmlOverlay.h). A CSS pixel is a pixel of
an 800x600 screen and font-size is the game font's point size there; the page is scaled with the
@@ -31,8 +28,6 @@
data-each="army", every player's run: a {{kind}} "head" entry carrying {{image}} (his general),
{{color}} and {{name}}, then up to six "unit" entries, the most money first, with {{image}}
{{count}}
- data-each="toasts", the superweapons that came ready in the last eight seconds, oldest first:
- {{portrait}} {{color}} {{name}} of the owner, {{image}} the weapon's cameo and {{what}} its name
{{camera}} names who drives the camera (GameClient/ObserverCamera.h), and {{camerafree}}
{{cameradirector}} {{cameraplayer}} are "on" while it is that one. A data-click of
camera:free, camera:director or camera:player hands it over and folds up flip:camera
@@ -43,7 +38,7 @@
{{fog}} "on" while the fog is drawn for the followed player, flipped with data-click="fog"
The stats: networth, cash, income, army, kills, rank, power. A data-click of flip:name flips the
- name for the rest of the match; pick:group:choice picks and folds up flip:group. #hud-top's bottom edge is where the message list starts.
+ name for the rest of the match; pick:group:choice picks and folds up flip:group.
Edit the copy under Run/Window/Html and the next match reads it.
-->
@@ -84,17 +79,6 @@
.box { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border: 1px solid #778391; background-color: #091417; vertical-align: middle; }
.on .box { background-image: url(PowerBarGreen); border-color: #b8f08a; }
- /* ---- the feed on the left ---- */
- /* it stands clear of the command bar's menu button in the screen's top left corner */
- #hud-top { position: absolute; left: 26px; top: 4px; width: 260px; }
- .toast { position: relative; height: 18px; margin-bottom: 2px;
- background: linear-gradient(to right, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0)); }
- .toast .tray { position: absolute; left: 2px; top: 0; }
- .toast .who { position: absolute; left: 34px; top: 0; line-height: 18px; font-weight: bold; }
- .toast .weapon { position: absolute; left: 104px; top: 1px; width: 20px; height: 16px; }
- .toast .what { position: absolute; left: 128px; top: 0; line-height: 10px; color: #e8d27a; }
- .toast .ready { position: absolute; left: 128px; top: 10px; line-height: 8px; font-size: 7px; color: #b8f08a; }
-
/* ---- the right column: the camera, and under it the board ---- */
/* under ControlBar.html's #net, 37px tall with the network line a player knocked out of an
online match still gets */
@@ -155,19 +139,6 @@
<body>
<div class="{{side}}">
-<div id="hud-top">
- <div id="feed">
- <div class="toast" data-each="toasts">
- <div class="tray"><img class="emblem" src="{{portrait}}"></div>
- <span class="who" style="color: {{color}}">{{name}}</span>
- <img class="weapon" src="{{image}}">
- <span class="what">{{what}}</span>
- <span class="ready">{{text:GUI:HudSuperweaponReady}}</span>
- </div>
- </div>
-
-</div>
-
<div id="right">
<div id="watch" class="well">
<div class="head plate">
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 8f4ab7620..f420ad63a 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -396,9 +396,11 @@ public: // ********************************************************************
// interface for messages to the user
// srj sez: passing as const-ref screws up varargs for some reason. dunno why. just pass by value.
- virtual void messageColor( const RGBColor *rgbColor, UnicodeString format, ... ); ///< display a colored message to the user
virtual void message( UnicodeString format, ... ); ///< display a message to the user
virtual void message( AsciiString stringManagerLabel, ... );///< display a message to the user
+ void playerMessage( Player *player, const UnicodeString &text ); ///< a message about that player, his flag at its head
+ /** The feed's line for a superweapon that came ready, or was fired when `launched`. */
+ void feedSuperweapon( const Object *weapon, const AsciiString &powerName, const SpecialPowerTemplate *power, Bool launched );
virtual void toggleMessages( void ) { m_messagesOn = 1 - m_messagesOn; } ///< toggle messages on/off
void openScoreboard( void ) { m_scoreboardOpen = TRUE; } ///< the Tab scoreboard, up while Tab is held
void closeScoreboard( void ) { m_scoreboardOpen = FALSE; }
@@ -430,7 +432,7 @@ public: // ********************************************************************
* page is not ready, and the caller draws the old way. */
Bool drawTooltipPage( const UnicodeString &cursorText, const RGBColor *accent );
virtual Bool isMessagesOn( void ) { return m_messagesOn; } ///< are the display messages on
- void freeMessageResources( void ); ///< free resources for the ui messages
+ void freeMessageResources( void ); ///< empty the event feed
Color getMessageColor(Bool altColor) { return (altColor)?m_messageColor2:m_messageColor1; }
// interface for military style messages
@@ -1001,15 +1003,6 @@ protected:
MOUSEMODE_MAX
};
- struct UIMessage
- {
- UnicodeString fullText; ///< the whole text message
- DisplayString *displayString; ///< display string used to render the message
- UnsignedInt timestamp; ///< logic frame message was created on
- Color color; ///< color to render this in
- };
- enum { MAX_UI_MESSAGES = 6 };
-
struct MilitarySubtitleData
{
UnicodeString subtitle; ///< The complete subtitle to be drawn, each line is separated by L"\n"
@@ -1047,8 +1040,7 @@ protected:
void setMouseCursor(Mouse::MouseCursor c);
- void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = NULL ); ///< internal workhorse for adding plain text for messages
- void removeMessageAtIndex( Int i ); ///< remove the message at index i
+ void addMessageText( const UnicodeString& formattedMessage ); ///< a plain message, a line of the event feed
void updateFloatingText( void ); ///< Update function to move our floating text
void drawFloatingText( void ); ///< Draw all our floating text
@@ -1178,10 +1170,6 @@ protected:
VideoBuffer* m_cameoVideoBuffer;///< video playback buffer
VideoStreamInterface* m_cameoVideoStream;///< Video stream;
- // message data
- UIMessage m_uiMessages[ MAX_UI_MESSAGES ];/**< messages to display to the user, the
- array is organized with newer messages at
- index 0, and increasing to older ones */
// superweapon timer data
SuperweaponMap m_superweapons[MAX_PLAYER_COUNT];
enum { HUD_OVERLAY_POINT_SIZE = 9 }; ///< small: this sits over the battlefield, not in a panel
@@ -1269,17 +1257,26 @@ protected:
HtmlValues m_spectatorTotals; ///< the page's values that are not per player, gathered with the lists
UnsignedInt m_spectatorListsFrame; ///< the logic frame the lists were last gathered on
const Player *m_spectatorListsWatched; ///< the player being watched when they were, whose seat they mark
- Int m_hudTogglesBottom; ///< the bottom of the page's #hud-top, so the message list starts under it
std::vector< SpectatorSuperweapon > m_spectatorSuperweapons; ///< every countdown the superweapon pass found, rebuilt each pass
- /** A superweapon that came ready, on the page for SPECTATOR_TOAST_FRAMES after that. */
- struct SpectatorToast
+
+ //
+ // The event feed over the radar, Window/Html/Feed.html: every message, a superweapon ready or
+ // fired, a player beaten or gone, the newest at the bottom. A player's and a watcher's alike.
+ //
+ struct FeedLine
{
HtmlValues values;
UnsignedInt until; ///< the logic frame it leaves on
};
- std::vector< SpectatorToast > m_spectatorToasts;
- void addSpectatorToast( Int playerIndex, const Object *weapon, const Image *cameo );
+ std::vector< FeedLine > m_feedLines;
+ void addFeedLine( HtmlValues line );
+ void drawFeed( void );
+ HtmlOverlay * m_feedOverlay;
+ Bool m_feedPageLoaded;
+ std::string m_feedPage;
+ Int m_feedFloor; ///< the radar's tab top on screen, from the bar's page
+ Int m_queueTrayTop; ///< the queue row's top on screen, while it is drawn
Bool m_placementRangeRingUp; ///< the structure on the cursor is armed, so its reach is drawn
Real m_placementRingRadius; ///< how far from its centre it hits
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 4dce5c2e2..d48323bc8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1144,16 +1144,10 @@ InGameUI::InGameUI()
m_cameoVideoStream = NULL;
m_cameoVideoBuffer = NULL;
- // message info
- for( i = 0; i < MAX_UI_MESSAGES; i++ )
- {
-
- m_uiMessages[ i ].fullText.clear();
- m_uiMessages[ i ].displayString = NULL;
- m_uiMessages[ i ].timestamp = 0;
- m_uiMessages[ i ].color = 0;
-
- } // end for i
+ m_feedOverlay = NULL;
+ m_feedPageLoaded = FALSE;
+ m_feedFloor = 0;
+ m_queueTrayTop = 0;
m_replayWindow = NULL;
m_messagesOn = TRUE;
@@ -1195,7 +1189,6 @@ InGameUI::InGameUI()
m_spectatorPageShown = FALSE;
m_spectatorListsFrame = 0;
m_spectatorListsWatched = NULL;
- m_hudTogglesBottom = 0;
m_scoreboardOpen = FALSE;
m_scoreboardOverlay = NULL;
m_scoreboardPageLoaded = FALSE;
@@ -1333,6 +1326,8 @@ InGameUI::~InGameUI()
delete m_spectatorOverlay;
m_spectatorOverlay = NULL;
+ delete m_feedOverlay;
+ m_feedOverlay = NULL;
delete m_scoreboardOverlay;
m_scoreboardOverlay = NULL;
delete m_controlBarOverlay;
@@ -1805,16 +1800,14 @@ static const std::string STAT_GROUP = "stat";
enum
{
- HUD_TOGGLES_INSET = 6, ///< between the page's #hud-top and the messages under it, 800x600
- MENU_BUTTON_CLEARANCE = 26, ///< where the messages start, right of the command bar page's menu button, 800x600
NET_WORTH_REFRESH_FRAMES = LOGICFRAMES_PER_SECOND / 2, ///< how often every player's worth is counted again
FRAMES_PER_MINUTE = LOGICFRAMES_PER_SECOND * 60,
ARMY_CHART_UNITS = 6, ///< kinds of unit shown per player, the most money first
PLAYER_NAME_CHARS = 11, ///< a name longer than this is cut, there is no clipping to hide it
SECONDS_IN_MINUTE = 60,
SECONDS_PER_HOUR = 60 * 60,
- SPECTATOR_TOAST_FRAMES = LOGICFRAMES_PER_SECOND * 8, ///< how long a "superweapon ready" message stays up
- SPECTATOR_TOASTS_KEPT = 4, ///< the most of those on screen at once; the oldest goes first
+ FEED_LINE_FRAMES = LOGICFRAMES_PER_SECOND * 8, ///< how long a line of the event feed stays up
+ FEED_LINES_KEPT = 6, ///< the most of those on screen at once; the oldest goes first
COMMAND_SLOTS_PER_COLUMN = 2, ///< the command bar numbers its slots down each column, top then bottom
PERCENT = 100
};
@@ -2172,32 +2165,6 @@ static void fillSpectatorCameraValues( std::vector< HtmlValues > &follows, HtmlV
values[ "followcolor" ] = head.at( "color" );
}
-//-------------------------------------------------------------------------------------------------
-/** A superweapon of player `playerIndex` came ready: the page says so on its left edge for
- * SPECTATOR_TOAST_FRAMES, newest at the bottom, the way Dota's kill feed runs. Only a watcher's
- * page draws them, so nobody else collects any. */
-//-------------------------------------------------------------------------------------------------
-void InGameUI::addSpectatorToast( Int playerIndex, const Object *weapon, const Image *cameo )
-{
- Player *owner = ThePlayerList->getNthPlayer( playerIndex );
- if( owner == NULL || weapon == NULL || !localPlayerWatching() )
- return;
-
- SpectatorToast toast;
- toast.values = spectatorHead( owner );
- toast.values[ "kind" ] = "toast";
- toast.values[ "portrait" ] = toast.values[ "image" ];
- toast.values[ "image" ] = cameo ? cameo->getName().str() : "";
- toast.values[ "what" ] = WideCharStringToMultiByte( weapon->getTemplate()->getDisplayName().str() );
- toast.until = TheGameLogic->getFrame() + SPECTATOR_TOAST_FRAMES;
-
- DEBUG_LOG(( "Spectator page: %s is ready for player %d on frame %u\n", weapon->getTemplate()->getName().str(),
- playerIndex, TheGameLogic->getFrame() ));
- m_spectatorToasts.push_back( toast );
- if( m_spectatorToasts.size() > SPECTATOR_TOASTS_KEPT )
- m_spectatorToasts.erase( m_spectatorToasts.begin() );
-}
-
//-------------------------------------------------------------------------------------------------
/** The key a command bar slot is bound to right now, "Q" for KEY_Q, so the page names the key the
* player really has: the WASD camera moves the whole top row along by one. Empty when unbound. */
@@ -2237,12 +2204,12 @@ Bool InGameUI::pickSpectatorStat( Int commandSlot )
//-------------------------------------------------------------------------------------------------
/** The spectator's page: the camera, every player ranked by the number picked in the stat drop-down
- * and each army's most expensive units, and a superweapon coming ready on the left. The players
- * themselves, the promotions and the production are on the Tab scoreboard. Only while watching: the other side's worth is not a player's to know. */
+ * and each army's most expensive units. The players themselves, the promotions and the production
+ * are on the Tab scoreboard, and what happens is in the feed over the radar. Only while watching:
+ * the other side's worth is not a player's to know. */
//-------------------------------------------------------------------------------------------------
void InGameUI::drawSpectatorPage( void )
{
- m_hudTogglesBottom = 0;
m_spectatorPageShown = FALSE;
if( TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )
@@ -2282,21 +2249,6 @@ void InGameUI::drawSpectatorPage( void )
m_spectatorListsWatched = watched;
}
- // the messages come and go on their own clock, not the lists' half second
- std::vector< HtmlValues > &toasts = m_spectatorLists[ "toasts" ];
- toasts.clear();
- for( size_t toast = 0; toast < m_spectatorToasts.size(); )
- {
- const SpectatorToast &shown = m_spectatorToasts[ toast ];
- if( frame >= shown.until || frame + SPECTATOR_TOAST_FRAMES < shown.until )
- {
- m_spectatorToasts.erase( m_spectatorToasts.begin() + toast );
- continue;
- }
- toasts.push_back( shown.values );
- toast++;
- }
-
HtmlValues values = m_spectatorTotals;
fillSpectatorCameraValues( m_spectatorLists[ "follows" ], values );
for( std::map< std::string, std::string >::const_iterator pick = m_spectatorPicked.begin(); pick != m_spectatorPicked.end(); ++pick )
@@ -2311,7 +2263,6 @@ void InGameUI::drawSpectatorPage( void )
m_spectatorOverlay->hover( TheMouse->getMouseStatus()->pos );
m_spectatorOverlay->draw();
m_spectatorPageShown = TRUE;
- m_hudTogglesBottom = m_spectatorOverlay->bottomOf( "#hud-top" );
}
//-------------------------------------------------------------------------------------------------
@@ -3400,7 +3351,6 @@ DECLARE_PERF_TIMER(InGameUI_update)
void InGameUI::update( void )
{
USE_PERF_TIMER(InGameUI_update)
- Int i;
/// @todo make sure this code gets called even when the UI is not being drawn
if ( m_videoStream && m_videoBuffer )
@@ -3431,67 +3381,10 @@ void InGameUI::update( void )
}
}
- //
- // remove any message strings that have expired, note that the oldest strings are
- // always at the end of the array (higher index numbers) so we can just remove things
- // from the rear and never have to worry about shifting entries cause we check every
- // frame
- //
+ // the messages are lines of the event feed now, which drops them at drawing by their frame
UnsignedInt currLogicFrame = TheGameLogic->getFrame();
- // ms -> logic frames. This used to divide by LOGICFRAMES_PER_SECOND instead of multiplying and
- // then divide by 1000 again, so with the shipped MessageDelayMS (~5000) it was 5000/30 = 166,
- // 166/1000 = 0 - every UI message started fading on the frame it was posted.
- //
- // ...and the shipped value holds a message for five whole seconds before the fade even
- // starts, on top of a fade that took three more: the corner was still showing what you did
- // eight seconds ago, stacked under what you have done since. Cap the hold at MESSAGE_HOLD_MS
- // and take the fade down at a fixed rate, which is about a second.
- //
- // That rate is per LOGIC frame, not per call: this runs once per render frame, so a fixed
- // step per call would empty the alpha (fps/30) times too fast - the same trap the military
- // subtitle countdown below fell into.
- //
- const int MESSAGE_HOLD_MS = 2500;
- const int MESSAGE_FADE_PER_FRAME = 8;
- static UnsignedInt s_lastMessageFadeFrame = 0xffffffff;
- const Bool fadeThisPass = ( currLogicFrame != s_lastMessageFadeFrame );
- s_lastMessageFadeFrame = currLogicFrame;
- int messageDelayMS = m_messageDelayMS;
- if( messageDelayMS > MESSAGE_HOLD_MS )
- messageDelayMS = MESSAGE_HOLD_MS;
- const int messageTimeout = messageDelayMS * LOGICFRAMES_PER_SECOND / 1000;
UnsignedByte r, g, b, a;
Int amount;
- for( i = MAX_UI_MESSAGES - 1; i >= 0; i-- )
- {
- // removeMessageAtIndex NULLs displayString; without this empty slots counted as expired
- // every frame and were re-cleared forever.
- if( m_uiMessages[ i ].displayString == NULL )
- continue;
-
- if( fadeThisPass && currLogicFrame - m_uiMessages[ i ].timestamp > messageTimeout )
- {
-
- // get the current color of this text
- GameGetColorComponents( m_uiMessages[ i ].color, &r, &g, &b, &a );
-
- // start fading the alpha on this color down
- amount = MESSAGE_FADE_PER_FRAME;
- if( a - amount < 0 )
- a = 0;
- else
- a -= amount;
-
- // set the new color
- m_uiMessages[ i ].color = GameMakeColor( r, g, b, a );
-
- // when alpha is completely zero we remove this string
- if( a == 0 )
- removeMessageAtIndex( i );
-
- } // end if
-
- } // end for i
//
// Update the Military Subtitle display
@@ -3825,7 +3718,7 @@ void InGameUI::reset( void )
m_spectatorLists.clear();
m_spectatorTotals.clear();
m_spectatorSuperweapons.clear();
- m_spectatorToasts.clear();
+ m_feedPageLoaded = FALSE;
m_inputEnabled = true;
// reset the command bar
TheControlBar->reset();
@@ -3920,29 +3813,11 @@ void InGameUI::reset( void )
} // end reset
//-------------------------------------------------------------------------------------------------
-/** Free any resources we used for our messages */
+/** Empty the event feed: a new match, and the score screen, start without the last one's lines */
//-------------------------------------------------------------------------------------------------
void InGameUI::freeMessageResources( void )
{
- Int i;
-
- // release display strings and set text to empty
- for( i = 0; i < MAX_UI_MESSAGES; i++ )
- {
-
- // emtpy text
- m_uiMessages[ i ].fullText.clear();
-
- // free display string
- if( m_uiMessages[ i ].displayString )
- TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString );
- m_uiMessages[ i ].displayString = NULL;
-
- // set timestamp to zero
- m_uiMessages[ i ].timestamp = 0;
-
- } // end for i
-
+ m_feedLines.clear();
} // end freeMessageResources
//-------------------------------------------------------------------------------------------------
@@ -4001,91 +3876,146 @@ void InGameUI::message( UnicodeString format, ... )
} // end message
//-------------------------------------------------------------------------------------------------
-/** Interface for display text messages to the user */
+/** A message is a line of the event feed over the radar, Window/Html/Feed.html, the way the kill
+ * feed runs in Dota. It used to be a column of text written over the battlefield's top left. */
//-------------------------------------------------------------------------------------------------
-// srj sez: passing as const-ref screws up varargs for some reason. dunno why. just pass by value.
-void InGameUI::messageColor( const RGBColor *rgbColor, UnicodeString format, ... )
+void InGameUI::addMessageText( const UnicodeString& formattedMessage )
{
- UnicodeString formattedMessage;
-
- // construct the final text after formatting
- va_list args;
- va_start( args, format );
- WideChar buf[ UnicodeString::MAX_FORMAT_BUF_LEN ];
- // truncate rather than throw: an uncaught engine exception aborts with 0xC0000409 and no log
- // at all, so an over-long chat or script message used to be a silent hard crash.
- if( _vsnwprintf(buf, sizeof( buf )/sizeof( WideChar ) - 1, format.str(), args ) < 0 )
- DEBUG_LOG(("InGameUI::message - text truncated to %d characters\n", (Int)(sizeof( buf )/sizeof( WideChar ) - 1)));
- buf[ sizeof( buf )/sizeof( WideChar ) - 1 ] = 0;
- formattedMessage.set( buf );
- va_end(args);
-
- // add the text to the ui
- addMessageText( formattedMessage, rgbColor );
-
-} // end message
+ HtmlValues line;
+ line[ "kind" ] = "note";
+ line[ "before" ] = WideCharStringToMultiByte( formattedMessage.str() );
+ addFeedLine( line );
+}
//-------------------------------------------------------------------------------------------------
+/** A message about one player: his general's flag at its head and his name in his colour where the
+ * text says it. A chat line, a player beaten, a player gone. */
//-------------------------------------------------------------------------------------------------
-void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor )
+void InGameUI::playerMessage( Player *player, const UnicodeString &text )
{
- Int i;
- Color color1 = m_messageColor1;
- Color color2 = m_messageColor2;
-
- if (rgbColor)
+ HtmlValues line = spectatorHead( player );
+ line[ "kind" ] = "player";
+ line[ "portrait" ] = line[ "image" ];
+ const std::string whole = WideCharStringToMultiByte( text.str() );
+ const std::string name = WideCharStringToMultiByte( player->getPlayerDisplayName().str() );
+ const size_t at = name.empty() ? std::string::npos : whole.find( name );
+ if( at == std::string::npos )
+ {
+ line[ "before" ] = whole;
+ line[ "name" ] = "";
+ }
+ else
{
- color1 = rgbColor->getAsInt() | GameMakeColor( 0, 0, 0, 255 );
- color2 = rgbColor->getAsInt() | GameMakeColor( 0, 0, 0, 255 );
+ line[ "before" ] = whole.substr( 0, at );
+ line[ "name" ] = name;
+ line[ "after" ] = whole.substr( at + name.size() );
}
+ addFeedLine( line );
+}
- // delete the message stuff at the last index
- m_uiMessages[ MAX_UI_MESSAGES - 1 ].fullText.clear();
- if( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString )
- TheDisplayStringManager->freeDisplayString( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString );
- m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = NULL;
- m_uiMessages[ MAX_UI_MESSAGES - 1 ].timestamp = 0;
+//-------------------------------------------------------------------------------------------------
+/** A superweapon that came ready or was fired: whose, its picture, its name. Only the ones with a
+ * countdown on everybody's screen, so a general's power fired from a command button is not one. */
+//-------------------------------------------------------------------------------------------------
+void InGameUI::feedSuperweapon( const Object *weapon, const AsciiString &powerName, const SpecialPowerTemplate *power,
+ Bool launched )
+{
+ Player *owner = weapon->getControllingPlayer();
+ const SuperweaponInfo *info = findSWInfo( owner->getPlayerIndex(), powerName, weapon->getID(), power );
+ if( info == NULL || info->m_hiddenByScript || info->m_hiddenByScience )
+ return;
- // shift all the messages down one index and remove the last one
- for( i = MAX_UI_MESSAGES - 1; i >= 1; i-- )
- m_uiMessages[ i ] = m_uiMessages[ i - 1 ];
+ HtmlValues line = spectatorHead( owner );
+ line[ "kind" ] = "weapon";
+ line[ "portrait" ] = line[ "image" ];
+ const Image *cameo = superweaponCameo( power );
+ line[ "image" ] = cameo ? cameo->getName().str() : "";
+ line[ "what" ] = WideCharStringToMultiByte( weapon->getTemplate()->getDisplayName().str() );
+ line[ "tag" ] = launched ? "launched" : "ready";
+ line[ "tagtext" ] = WideCharStringToMultiByte( TheGameText->fetch( launched ? "GUI:HudSuperweaponLaunched" : "GUI:HudSuperweaponReady" ).str() );
+ addFeedLine( line );
+}
- //
- // set the new message in index 0, note that we need to allocate a display string, but
- // we do not need to free the one that is already there because it has been moved
- // "up" an index
- //
- m_uiMessages[ 0 ].fullText = formattedMessage;
- m_uiMessages[ 0 ].timestamp = TheGameLogic->getFrame();
- m_uiMessages[ 0 ].displayString = TheDisplayStringManager->newDisplayString();
- m_uiMessages[ 0 ].displayString->setFont( TheFontLibrary->getFont( m_messageFont,
- TheGlobalLanguageData->adjustFontSize(m_messagePointSize), m_messageBold ) );
- m_uiMessages[ 0 ].displayString->setText( m_uiMessages[ 0 ].fullText );
-
- //
- // assign a color for this string instance that will stay with it no matter what
- // line it is rendered on
- //
- if( m_uiMessages[ 1 ].displayString == NULL || m_uiMessages[ 1 ].color == color2 )
- m_uiMessages[ 0 ].color = color1;
- else
- m_uiMessages[ 0 ].color = color2;
+//-------------------------------------------------------------------------------------------------
+/** One more line at the bottom of the feed, up for FEED_LINE_FRAMES; past FEED_LINES_KEPT the oldest
+ * goes. Every line is logged too, so a run can be read for what the feed said. */
+//-------------------------------------------------------------------------------------------------
+void InGameUI::addFeedLine( HtmlValues line )
+{
+ DEBUG_LOG(( "FEED frame %u %s: %s%s%s %s %s\n", TheGameLogic->getFrame(), line[ "kind" ].c_str(), line[ "before" ].c_str(),
+ line[ "name" ].c_str(), line[ "after" ].c_str(), line[ "what" ].c_str(), line[ "tagtext" ].c_str() ));
+ FeedLine added;
+ added.values = line;
+ added.until = TheGameLogic->getFrame() + FEED_LINE_FRAMES;
+ m_feedLines.push_back( added );
+ if( m_feedLines.size() > FEED_LINES_KEPT )
+ m_feedLines.erase( m_feedLines.begin() );
+}
-} // end addFormattedMessage
+//-------------------------------------------------------------------------------------------------
+/** Where the command bar starts on screen, or the screen's bottom while the bar is hidden: it is
+ * hidden while the game loads and in the observer views. */
+//-------------------------------------------------------------------------------------------------
+static Int controlBarTop( void )
+{
+ static NameKeyType controlBarKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" );
+ GameWindow *bar = TheWindowManager->winGetWindowFromId( NULL, controlBarKey );
+ if( bar == NULL || bar->winIsHidden() )
+ return TheDisplay->getHeight();
+
+ ICoord2D barPos;
+ bar->winGetScreenPosition( &barPos.x, &barPos.y );
+ return barPos.y;
+}
+
+static const char *const FEED_PAGE = "Window\\Html\\Feed.html";
//-------------------------------------------------------------------------------------------------
-/** Remove the message on screen at index i */
+/** The event feed, Window/Html/Feed.html, for a player and a watcher alike: the newest line at the
+ * bottom, standing on the radar's under-attack tab, or on the production queue's row while that is
+ * up over the tab. The messages switch (toggleMessages) takes the whole feed away. */
//-------------------------------------------------------------------------------------------------
-void InGameUI::removeMessageAtIndex( Int i )
+void InGameUI::drawFeed( void )
{
+ const UnsignedInt frame = TheGameLogic->getFrame();
+ HtmlLists lists;
+ std::vector< HtmlValues > &lines = lists[ "feed" ];
+ for( size_t line = 0; line < m_feedLines.size(); )
+ {
+ // a frame going backwards is a loaded save, and the line is not from this game any more
+ const FeedLine &shown = m_feedLines[ line ];
+ if( frame >= shown.until || frame + FEED_LINE_FRAMES < shown.until )
+ {
+ m_feedLines.erase( m_feedLines.begin() + line );
+ continue;
+ }
+ lines.push_back( shown.values );
+ line++;
+ }
+ if( lines.empty() || !m_messagesOn || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )
+ return;
- m_uiMessages[ i ].fullText.clear();
- if( m_uiMessages[ i ].displayString )
- TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString );
- m_uiMessages[ i ].displayString = NULL;
- m_uiMessages[ i ].timestamp = 0;
+ if( !m_feedPageLoaded )
+ {
+ m_feedPageLoaded = TRUE;
+ readHtmlPage( FEED_PAGE, m_feedPage );
+ }
+ if( m_feedPage.empty() )
+ return;
+ if( m_feedOverlay == NULL )
+ m_feedOverlay = new HtmlOverlay( m_superweaponNormalFont );
-} // end removeMessageAtIndex
+ // ponytail: with no bar page the old queue column climbs the same corner under the feed; the
+ // page always ships, so that column's top is not measured
+ Int floor = m_controlBarPageShown ? m_feedFloor : controlBarTop();
+ if( m_productionStripThemed && m_productionStripCount > 0 )
+ floor = min( floor, m_queueTrayTop );
+
+ HtmlValues values;
+ values[ "floor" ] = std::to_string( REAL_TO_INT_FLOOR( floor / ControlBarUniformScale() ) );
+ m_feedOverlay->setPage( HtmlTemplate_expand( m_feedPage, values, lists, lookupGameText ) );
+ m_feedOverlay->draw();
+}
//-------------------------------------------------------------------------------------------------
/** An area selection is occurring, start graphical "hint". */
@@ -7145,45 +7075,7 @@ void InGameUI::postDraw( void )
drawBlindSpots();
drawPlacementReach(); // after the shade, so the outline stays bright over it
drawSpectatorPage();
-
-
- // render our display strings for the messages if on
- if( m_messagesOn )
- {
- Int i, x, y;
- Color dropColor;
- UnsignedByte r, g, b, a;
-
- x = m_messagePosition.x;
- y = m_messagePosition.y;
- // the messages start under the strip drop-down rather than being written across it, and
- // right of the command bar page's menu button in the corner, which sat on their first letters
- if( m_hudTogglesBottom + stripPixels( HUD_TOGGLES_INSET ) > y )
- y = m_hudTogglesBottom + stripPixels( HUD_TOGGLES_INSET );
- if( m_controlBarPageShown && x < stripPixels( MENU_BUTTON_CLEARANCE ) )
- x = stripPixels( MENU_BUTTON_CLEARANCE );
- for( i = MAX_UI_MESSAGES - 1; i >= 0; i-- )
- {
-
- if( m_uiMessages[ i ].displayString )
- {
-
- // make drop color black, but use the alpha setting of the fill color specified (for fading)
- GameGetColorComponents( m_uiMessages[ i ].color, &r, &g, &b, &a );
- dropColor = GameMakeColor( 0, 0, 0, a );
-
- // draw the text
- m_uiMessages[ i ].displayString->draw( x, y, m_uiMessages[ i ].color, dropColor );
-
- // increment text spot to next location
- GameFont *font = m_uiMessages[ i ].displayString->getFont();
- y += font->height;
-
- } //end if
-
- } // end for i
-
- } // end if
+ drawFeed();
if( m_militarySubtitle )
{
@@ -7269,7 +7161,7 @@ void InGameUI::postDraw( void )
{
if ( TheGameLogic->getFrame() > 0 )
{
- addSpectatorToast( i, owningObject, superweaponCameo( info->getSpecialPowerTemplate() ) );
+ feedSuperweapon( owningObject, mapIt->first, info->getSpecialPowerTemplate(), FALSE );
SpecialPowerType type = module->getSpecialPowerTemplate()->getSpecialPowerType();
@@ -9915,15 +9807,7 @@ void InGameUI::drawSkillStrip( void )
// with, which is where the eye is not: watching a match you read the bottom of the screen, and
// the two strips now sit at either end of the same shelf.
//
- Int barTop = TheDisplay->getHeight();
- static NameKeyType controlBarKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" );
- GameWindow *bar = TheWindowManager->winGetWindowFromId( NULL, controlBarKey );
- if( bar && !bar->winIsHidden() )
- {
- ICoord2D barPos;
- bar->winGetScreenPosition( &barPos.x, &barPos.y );
- barTop = barPos.y;
- }
+ const Int barTop = controlBarTop();
const Int lowerY = barTop - ( trayH - trayHole.y ) - stripPixels( PRODUCTION_STRIP_LIFT );
const Int right = TheDisplay->getWidth();
@@ -11009,7 +10893,10 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
const Bool leftFound = controlBarUnion( CONTROL_BAR_LEFT, content );
const IRegion2D leftBox = framed( content, border, TRUE, FALSE );
putFrame( values, "left", content, leftBox, leftFound && leftShown );
- putPageRect( values, "alerttab", tabOn( leftBox, ALERT_TAB_WIDTH, PANEL_TAB_HEIGHT, FALSE ), leftFound && leftShown );
+ const IRegion2D alertTab = tabOn( leftBox, ALERT_TAB_WIDTH, PANEL_TAB_HEIGHT, FALSE );
+ putPageRect( values, "alerttab", alertTab, leftFound && leftShown );
+ // the event feed stands on that tab, or on the screen's bottom with the radar folded away
+ m_feedFloor = leftFound && leftShown ? alertTab.lo.y : barBottom();
// the three smoke signal buttons, a column standing on the screen's bottom edge against the left
// panel's border; not there at all where the keys would do nothing either, a game with no allies
@@ -12003,6 +11890,7 @@ void InGameUI::drawQueueTray( void )
tray.lo.y -= trayBorder;
tray.hi.x += trayBorder;
tray.hi.y += trayBorder;
+ m_queueTrayTop = tray.lo.y;
m_productionStripCameoW = cell.x;
m_productionStripCameoH = cell.y;
@@ -12127,15 +12015,7 @@ void InGameUI::drawProductionStrip( void )
// sit on top of the control bar. If the bar is not up (it is hidden while the game is loading,
// and in the observer views) fall back to the bottom of the screen.
//
- Int barTop = TheDisplay->getHeight();
- static NameKeyType controlBarKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" );
- GameWindow *bar = TheWindowManager->winGetWindowFromId( NULL, controlBarKey );
- if( bar && !bar->winIsHidden() )
- {
- ICoord2D barPos;
- bar->winGetScreenPosition( &barPos.x, &barPos.y );
- barTop = barPos.y;
- }
+ const Int barTop = controlBarTop();
//
// A queue cameo is one cameo of the general's power bar, to the pixel: the row is built out of
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
index 8f215930b..c103b0257 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
@@ -678,6 +678,8 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
// the same place so the two can never end up describing different events.
// It stamps a frame on the client side and returns; nothing here changes.
chromaSuperweaponLaunched( type );
+ // and the event feed, which writes a line only for a superweapon with a public countdown
+ TheInGameUI->feedSuperweapon( getObject(), getPowerName(), getSpecialPowerModuleData()->m_specialPowerTemplate, TRUE );
}
// get module data
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp
index eafb55b7e..2fce3dad5 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp
@@ -195,7 +195,9 @@ void VictoryConditions::update( void )
ThePartitionManager->revealMapForPlayerPermanently( p->getPlayerIndex() );
TheGameClient->updateFakeDrawables();
- TheInGameUI->message("GUI:PlayerHasBeenDefeated", p->getPlayerDisplayName().str() );
+ UnicodeString defeated;
+ defeated.format( TheGameText->fetch( "GUI:PlayerHasBeenDefeated" ), p->getPlayerDisplayName().str() );
+ TheInGameUI->playerMessage( p, defeated );
// People are boneheads. Also play a sound
static AudioEventRTS leftGameSound("GUIMessageReceived");
TheAudio->addAudioEvent(&leftGameSound);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp
index 3941e5647..498a8fae4 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp
@@ -700,7 +700,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg)
AsciiString playerName;
playerName.format("player%d", msg->getPlayerID());
- const Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) );
+ Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) );
if (!player)
{
TheInGameUI->message(UnicodeString(L"%ls"), unitext.str());
@@ -713,9 +713,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg)
if ( ((1<<m_localSlot) & msg->getPlayerMask() ) && canSeeChat )
{
- RGBColor rgb;
- rgb.setFromInt(clientPlayerColor(player));
- TheInGameUI->messageColor(&rgb, UnicodeString(L"%ls"), unitext.str());
+ TheInGameUI->playerMessage(player, unitext);
// feedback for received chat messages in-game
AudioEventRTS audioEvent("GUICommunicatorIncoming");
@@ -1854,7 +1852,15 @@ PlayerLeaveCode ConnectionManager::disconnectPlayer(Int slot) {
UnicodeString unicodeName;
unicodeName = getPlayerName(slot);
if (unicodeName.getLength() > 0 && m_connections[slot]) {
- TheInGameUI->message("Network:PlayerLeftGame", unicodeName.str());
+ UnicodeString left;
+ left.format( TheGameText->fetch( "Network:PlayerLeftGame" ), unicodeName.str() );
+ AsciiString slotName;
+ slotName.format( "player%d", slot );
+ Player *player = ThePlayerList->findPlayerWithNameKey( TheNameKeyGenerator->nameToKey( slotName ) );
+ if( player )
+ TheInGameUI->playerMessage( player, left );
+ else
+ TheInGameUI->message( UnicodeString( L"%ls" ), left.str() );
// People are boneheads. Also play a sound
static AudioEventRTS leftGameSound("GUIMessageReceived");
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 72a6e9018..b1a058000 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -13740,8 +13740,8 @@ TEST(the_spectator_page_has_its_pieces_and_no_option_clicks)
fclose( fp );
CHECK( page.find( "data-click=\"option:" ) == std::string::npos );
- // the message list starts under #hud-top
- CHECK( page.find( "id=\"hud-top\"" ) != std::string::npos );
+ // the superweapons coming ready are lines of the feed over the radar, Feed.html, for everybody
+ CHECK( page.find( "data-each=\"toasts\"" ) == std::string::npos );
CHECK( page.find( "data-each=\"players\"" ) != std::string::npos );
// the players are on the Tab scoreboard, not in a strip across the top
CHECK( page.find( "data-each=\"seats\"" ) == std::string::npos );