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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(gameengine): twelve lines of feed history, the note mark a flag-sized plate
Olcay Seygana1cd8a343f65
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9435ea63b..ec71710ac 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 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. A smoke signal or a beacon goes in, and so does a player beaten or gone, for a player and a watcher alike. Six lines at most, ten seconds each, the newest at the bottom, and the feed steps up over the production queue's row whenever that is out. Missed something? Press Enter: while the chat is open the last six lines come back, however old they are. Every line's words start in the same column, whether it opens on a flag or on the gold mark.+- 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. A smoke signal or a beacon goes in, and so does a player beaten or gone, for a player and a watcher alike. Six lines at most, ten seconds each, the newest at the bottom, and the feed steps up over the production queue's row whenever that is out. Missed something? Press Enter: while the chat is open the last twelve lines come back, however old they are, and the chat moves up to stand clear of them. A line with no player opens on a steel plate the size of a flag with the gold mark on it, so every line's words start in the same column.- 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.diff --git a/GeneralsMD/Code/Data/Window/Html/Feed.html b/GeneralsMD/Code/Data/Window/Html/Feed.htmlindex fbac62800..46b962223 100644--- a/GeneralsMD/Code/Data/Window/Html/Feed.html+++ b/GeneralsMD/Code/Data/Window/Html/Feed.html@@ -6,7 +6,7 @@dozer. Chat has its own page, Window/Html/Chat.html. The feed stands on the radar's under-attacktab in the screen's bottom left corner, the newest line at the bottom, the way Dota's kill feedstands on its minimap. A line is up for ten seconds, six at most, and the oldest goes first;- while the chat is open the last six are up however old they are. Same+ while the chat is open the last twelve are up however old they are, and the chat stands over them. Samematerials as Window/Html/Spectator.html, whose header says what the renderer draws.The game fills in, every frame a line is up (InGameUI::drawFeed):@@ -39,9 +39,9 @@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, taking- the flag's 24 pixels with its margin so every line's words start in one column */- .chip { display: inline-block; width: 11px; height: 11px; line-height: 11px; margin: 0 8px 0 5px; vertical-align: middle;+ /* a plain message has no player, so a steel plate the flag's size with a mark on it stands where+ the flag would, and every line's words start in one column */+ .chip { display: inline-block; width: 20px; height: 10px; line-height: 10px; margin-right: 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; }diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 87702a7dd..dce89d932 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -1833,6 +1833,7 @@ enumSECONDS_PER_HOUR = 60 * 60,FEED_LINE_FRAMES = LOGICFRAMES_PER_SECOND * 10, ///< how long a line of the event feed stays upFEED_LINES_KEPT = 6, ///< the most of those on screen at once; the oldest goes first+ FEED_HISTORY_KEPT = 12, ///< the lines held for the open chat to show, however oldCOMMAND_SLOTS_PER_COLUMN = 2, ///< the command bar numbers its slots down each column, top then bottomPERCENT = 100};@@ -4072,7 +4073,7 @@ void InGameUI::watchDozers( void )}//--------------------------------------------------------------------------------------------------/** One more line at the bottom of the feed, up for FEED_LINE_FRAMES; past FEED_LINES_KEPT the oldest+/** One more line at the bottom of the feed, up for FEED_LINE_FRAMES; past FEED_HISTORY_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 )@@ -4093,7 +4094,7 @@ void InGameUI::addFeedLine( HtmlValues line )added.values = line;added.until = until;m_feedLines.push_back( added );- if( m_feedLines.size() > FEED_LINES_KEPT )+ if( m_feedLines.size() > FEED_HISTORY_KEPT )m_feedLines.erase( m_feedLines.begin() );}@@ -4130,29 +4131,27 @@ Int InGameUI::feedFloor( void ) const//-------------------------------------------------------------------------------------------------/** 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. A line is up for FEED_LINE_FRAMES, and while the chat is open every line held- * is, so Enter shows what was missed. The messages switch (toggleMessages) takes the whole feed- * away. */+ * up over the tab. The last FEED_LINES_KEPT lines are up for FEED_LINE_FRAMES each, and while the+ * chat is open every line held is, so Enter shows what was missed. The messages switch+ * (toggleMessages) takes the whole feed away. *///-------------------------------------------------------------------------------------------------void InGameUI::drawFeed( void ){+ // a frame going backwards is a loaded save, and a line from its future is not from this gameconst UnsignedInt frame = TheGameLogic->getFrame();+ for( size_t line = 0; line < m_feedLines.size(); )+ if( frame + FEED_LINE_FRAMES < m_feedLines[ line ].until )+ m_feedLines.erase( m_feedLines.begin() + line );+ else+ line++;+const Bool history = IsInGameChatActive();+ const size_t shownFrom = history ? 0 : m_feedLines.size() - min( m_feedLines.size(), (size_t)FEED_LINES_KEPT );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 + FEED_LINE_FRAMES < shown.until )- {- m_feedLines.erase( m_feedLines.begin() + line );- continue;- }- if( history || frame < shown.until )- lines.push_back( shown.values );- line++;- }+ for( size_t line = shownFrom; line < m_feedLines.size(); line++ )+ if( history || frame < m_feedLines[ line ].until )+ lines.push_back( m_feedLines[ line ].values );if( lines.empty() || !m_messagesOn || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )return;@@ -4182,7 +4181,8 @@ enumCHAT_LINES_KEPT = 8, ///< the most lines held, all of them shown while the chat is openCHAT_WIDTH = 360, ///< the chat's width, 800x600CHAT_BAR_HEIGHT = 22, ///< the typing bar's height with its padding and border, 800x600- FEED_FULL_HEIGHT = 99, ///< Feed.html with all FEED_LINES_KEPT lines up, 16 each and its 3 at the foot, 800x600+ FEED_LINE_HEIGHT = 16, ///< a line of Feed.html with the pixel over it, 800x600+ FEED_FOOT = 3, ///< Feed.html's gap under its newest line, 800x600CHAT_OVER_FEED = 12, ///< the gap between the typing bar and the full feed under it, 800x600CHAT_CARET_FRAMES = LOGICFRAMES_PER_SECOND / 2 ///< the caret's blink, on and off};@@ -4204,10 +4204,11 @@ void InGameUI::chatMessage( Player *player, const UnicodeString &text )}//--------------------------------------------------------------------------------------------------/** The chat, Window/Html/Chat.html, in the left corner over the feed, clear of it even with all its- * lines up so the chat does not move as the feed grows: shut, the talk round- * its newest line, fading out together; open, the typing bar under every line held, the chat's own- * windows moved under it so they take the keys and the clicks there and draw nothing. */+/** The chat, Window/Html/Chat.html, in the left corner over the feed, clear of it even with all+ * FEED_LINES_KEPT of its lines up so the chat does not move as the feed grows, and open, clear of+ * the feed's whole history under it too: shut, the talk round its newest line, fading out+ * together; open, the typing bar under every line held, the chat's own windows moved under it so+ * they take the keys and the clicks there and draw nothing. *///-------------------------------------------------------------------------------------------------void InGameUI::drawChat( void ){@@ -4215,7 +4216,9 @@ void InGameUI::drawChat( void )return;const Real scale = ControlBarUniformScale();- const Int bar = REAL_TO_INT_FLOOR( feedFloor() / scale ) - FEED_FULL_HEIGHT - CHAT_OVER_FEED - CHAT_BAR_HEIGHT;+ const size_t feedLines = max( (size_t)FEED_LINES_KEPT, IsInGameChatActive() ? m_feedLines.size() : 0 );+ const Int bar = REAL_TO_INT_FLOOR( feedFloor() / scale ) - (Int)feedLines * FEED_LINE_HEIGHT - FEED_FOOT - CHAT_OVER_FEED -+ CHAT_BAR_HEIGHT;UnicodeString typed, audience;const Bool open = GetInGameChatEntry( typed, audience, 0, REAL_TO_INT_FLOOR( bar * scale ),