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(gameengine): chat over the feed, enter to team, shift+enter to all

Olcay Seygan4c9de42b266e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1b02cca9..4db4b67c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -501,7 +501,7 @@ found and fixed — EA's own, not port damage.**
- 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.
- 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.
- The feed also says when a general's power is used, when a promotion is bought, and when a superweapon, a Strategy Center, a Propaganda Center or a Palace goes up and when it is finished, each with its picture. A player is told that about himself and his allies, a watcher about everybody; a finished superweapon is told to everybody, as the announcer already did. A Spectre Gunship called from three command centers on the same frame is one line, not three. A player whose last dozer dies, or last worker for the GLA, gets a line too, since he can build nothing more until he makes another.
-- Chat sits a little under the middle of the screen, the way Dota writes it: each line opens on the speaker's general's flag and his name in his colour, and is up for ten seconds. Enter opens a dark typing bar under the lines, saying whom it goes to, with the last eight lines kept up while you type.
+- Chat sits in the bottom left corner over the event feed, with room left for the whole feed so neither covers the other, the way Dota writes it: each line opens on the speaker's general's flag and his name in his colour. A conversation stays up for ten seconds after its last line and then fades out as one. Enter talks to your team and Shift+Enter to everybody, in a dark typing bar under the lines that says whom it goes to, with the last eight lines kept up while you type. The next Enter after sending opens the chat again straight away.
- 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.
diff --git a/GeneralsMD/Code/Data/INI/CommandMapReforged.ini b/GeneralsMD/Code/Data/INI/CommandMapReforged.ini
index d118684fd..0557c9193 100644
--- a/GeneralsMD/Code/Data/INI/CommandMapReforged.ini
+++ b/GeneralsMD/Code/Data/INI/CommandMapReforged.ini
@@ -441,6 +441,23 @@ CommandMap SIGNAL_ATTENTION
DisplayName = GUI:SignalAttention
End
+; Chat the way Dota opens it: Enter to your team, Shift+Enter to everybody.
+; Retail had Enter for everybody and Backspace for allies, and Backspace is also
+; the key a player reaches for while typing.
+CommandMap CHAT_ALLIES
+ Key = KEY_ENTER
+ Transition = DOWN
+ Modifiers = NONE
+ UseableIn = GAME
+End
+
+CommandMap CHAT_EVERYONE
+ Key = KEY_ENTER
+ Transition = DOWN
+ Modifiers = SHIFT
+ UseableIn = GAME
+End
+
; single player and replays only
CommandMap TOGGLE_PAUSE
Key = KEY_P
diff --git a/GeneralsMD/Code/Data/Window/Html/Chat.html b/GeneralsMD/Code/Data/Window/Html/Chat.html
index 398f8935b..c040438b4 100644
--- a/GeneralsMD/Code/Data/Window/Html/Chat.html
+++ b/GeneralsMD/Code/Data/Window/Html/Chat.html
@@ -1,15 +1,17 @@
<!DOCTYPE html>
<!--
- The chat, a little under the middle of the screen, the way Dota writes it: each line opens on the
- speaker's general's flag and his name in his colour. With the chat shut the lines of the last ten
- seconds are up; Enter opens the typing bar under them and every line held, eight at most, stays
- up until it shuts. The chat's own windows sit under the bar and take the keys; this page draws
- everything. Same materials as Window/Html/Spectator.html, whose header says what the renderer
- draws.
+ The chat, in the screen's bottom left corner over the event feed (Window/Html/Feed.html) and
+ clear of it even with all six of its lines up, the way Dota writes it: each line opens on the
+ speaker's general's flag and his name in his colour. With the chat shut the talk round the
+ newest line is up, every line that came in the ten seconds before it, for ten seconds after it,
+ the whole of it fading out over the last second and a half; the game fades the page, since the
+ renderer draws no opacity. Enter opens the typing bar to the team, Shift+Enter to everybody, and
+ every line held, eight at most, stays up until it shuts. The chat's own windows sit under the bar
+ and take the keys; this page draws everything. Same materials as Window/Html/Spectator.html,
+ whose header says what the renderer draws.
The game fills in, every frame the chat is up (InGameUI::drawChat):
- {{left}} the chat's left edge, the chat 360 wide and centred
- {{bar}} the typing bar's top edge; the lines stand on it
+ {{bar}} the typing bar's top edge; the lines stand on it
{{open}} "open" while the chat is open
{{typed}} what has been typed so far, {{caret}} "lit" for half of every second
{{audience}} whom it goes to: everyone, allies or observers, in the player's language
@@ -25,14 +27,14 @@
html, body { margin: 0; padding: 0; }
body { background-color: #3b4a36; color: #eef2f5; font-size: 9px; }
- #chat { position: absolute; top: 0; width: 360px; }
+ #chat { position: absolute; left: 0; top: 0; width: 360px; }
#lines { position: absolute; left: 0; bottom: 2px; width: 360px; }
.line { height: 15px; line-height: 15px; margin-top: 1px; padding-left: 2px; white-space: nowrap;
background: linear-gradient(to right, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.3) 70%, rgba(0, 0, 0, 0)); }
.flag { width: 20px; height: 12px; margin-right: 4px; vertical-align: middle; }
.who { font-weight: bold; }
- #bar { display: none; position: absolute; width: 356px; height: 12px; line-height: 12px; padding: 0 2px;
+ #bar { display: none; position: absolute; left: 0; width: 342px; height: 14px; line-height: 14px; padding: 3px 8px;
background-color: rgba(0, 0, 0, 0.88); border: 1px solid #3a414a; border-top-color: #000000; }
.open #bar { display: block; }
.audience { color: #8a949f; margin-right: 5px; }
@@ -42,12 +44,12 @@
</head>
<body>
<div class="{{open}}">
- <div id="chat" style="left: {{left}}px; height: {{bar}}px">
+ <div id="chat" style="height: {{bar}}px">
<div id="lines">
<div class="line" data-each="chat"><img class="flag" src="{{image}}"><span class="who" style="color: {{color}}">{{name}}:</span> {{text}}</div>
</div>
</div>
- <div id="bar" style="left: {{left}}px; top: {{bar}}px"><span class="audience">{{audience}}</span>{{typed}}<span class="caret {{caret}}">|</span></div>
+ <div id="bar" style="top: {{bar}}px"><span class="audience">{{audience}}</span>{{typed}}<span class="caret {{caret}}">|</span></div>
</div>
</body>
</html>
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h b/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h
index 7901336a4..f7f7a1e82 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h
@@ -57,6 +57,9 @@ public:
void draw( void );
+ /** Fade everything the page draws, text, fills and images, 0 to 255; 255 until it is set. */
+ void setAlpha( Int alpha );
+
/** Move the pointer over the page, for :hover. TRUE when it is on something the page drew
* rather than on the empty body round it. */
Bool hover( const ICoord2D &mouse );
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 4cc6ad66e..8ac055e3d 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -1279,9 +1279,10 @@ protected:
void feedAct( Player *player, const Image *cameo, const std::string &what, const char *tag, const char *label );
void watchDozers( void );
void drawFeed( void );
+ Int feedFloor( void ) const;
UnsignedInt m_dozerCheckFrame; ///< the logic frame watchDozers last looked on
Bool m_hadDozer[ MAX_PLAYER_COUNT ]; ///< that player had a dozer or worker then
- // the chat under the middle of the screen, Window/Html/Chat.html, the same lines kept a while
+ // the chat over the feed, Window/Html/Chat.html, the same lines kept a while
std::vector< FeedLine > m_chatLines;
void drawChat( void );
HtmlOverlay * m_chatOverlay;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp
index de2acb63d..8dfe3cc3c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp
@@ -51,6 +51,7 @@ static GameWindow *chatTextEntry = NULL;
static GameWindow *chatTypeStaticText = NULL;
static UnicodeString s_savedChat;
static InGameChatType inGameChatType;
+static const UnsignedInt SAME_PRESS_MS = 150; ///< ToggleInGameChat: two calls this close are one Enter
// ------------------------------------------------------------------------------------------------
/** Window/Html/Chat.html draws the chat: the typed line with the lines over it. The layout's
@@ -223,12 +224,14 @@ Bool handleInGameSlashCommands(UnicodeString uText)
// ------------------------------------------------------------------------------------------------
void ToggleInGameChat( Bool immediate )
{
- static Bool justHid = false;
- if (justHid)
- {
- justHid = false;
+ // One Enter that sends reaches here twice, once as the text entry's end of edit and once as the
+ // chat key, in either order; the second must not open the chat straight back up. A flag that
+ // swallowed the next call ate the following Enter instead whenever the text entry took the key,
+ // so opening the chat again after a line took two presses. The second of one press comes within
+ // the same few frames; a press of its own does not.
+ static UnsignedInt hiddenAtMs = 0;
+ if (timeGetTime() - hiddenAtMs < SAME_PRESS_MS)
return;
- }
if (TheGameLogic->isInReplayGame())
return;
@@ -283,7 +286,7 @@ void ToggleInGameChat( Bool immediate )
}
GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString );
HideInGameChat( immediate );
- justHid = true;
+ hiddenAtMs = timeGetTime();
}
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp
index 16feb42fd..1250bb07b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp
@@ -65,10 +65,7 @@ const char *const SVG_UNITS = "px";
const Int RGBA_BYTES = 4;
const char *const GENERIC_FAMILIES[] = { "serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui" };
-Color gameColor( const litehtml::web_color &color )
-{
- return GameMakeColor( color.red, color.green, color.blue, color.alpha );
-}
+const Int OPAQUE_ALPHA = 255;
/** The first family in a CSS font-family list, without its quotes. */
std::string firstFamily( const std::string &families )
@@ -108,6 +105,7 @@ public:
std::string click( const ICoord2D &mouse );
Int bottomOf( const char *selector );
void rectsOf( const char *selector, std::vector< IRegion2D > &rects );
+ void setAlpha( Int alpha ) { m_alpha = alpha; }
litehtml::uint_ptr create_font( const litehtml::font_description &description, const litehtml::document *document,
litehtml::font_metrics *metrics ) override;
@@ -168,6 +166,10 @@ private:
};
typedef std::vector< SvgRun > SvgRuns;
+ /** A colour with its alpha scaled by the whole page's, setAlpha's. */
+ Color tint( Int red, Int green, Int blue, Int alpha ) const { return GameMakeColor( red, green, blue, alpha * m_alpha / OPAQUE_ALPHA ); }
+ Color tint( const litehtml::web_color &color ) const { return tint( color.red, color.green, color.blue, color.alpha ); }
+
Int screen( litehtml::pixel_t pagePixels ) const { return (Int)floorf( pagePixels * m_scale + 0.5f ); }
litehtml::pixel_t page( Int screenPixels ) const { return screenPixels / m_scale; }
litehtml::pixel_t viewportWidth( void ) const { return page( m_screenWidth ); }
@@ -190,6 +192,7 @@ private:
StringCache m_strings;
UnsignedInt m_stamp;
std::string m_clicked;
+ Int m_alpha; ///< the whole page's, OPAQUE_ALPHA unless it is fading
};
//-------------------------------------------------------------------------------------------------
@@ -199,7 +202,8 @@ HtmlOverlayContainer::HtmlOverlayContainer( const AsciiString &defaultFont ) :
m_scale( 1.0f ),
m_screenWidth( 0 ),
m_screenHeight( 0 ),
- m_stamp( 0 )
+ m_stamp( 0 ),
+ m_alpha( OPAQUE_ALPHA )
{
}
@@ -405,8 +409,8 @@ void HtmlOverlayContainer::draw_text( litehtml::uint_ptr hdc, const char *text,
if( font == 0 || color.alpha == 0 )
return;
- displayString( (GameFont *)font, text )->draw( screen( place.x ), screen( place.y ), gameColor( color ),
- GameMakeColor( 0, 0, 0, color.alpha ) );
+ displayString( (GameFont *)font, text )->draw( screen( place.x ), screen( place.y ), tint( color ),
+ tint( 0, 0, 0, color.alpha ) );
}
//-------------------------------------------------------------------------------------------------
@@ -443,13 +447,17 @@ void HtmlOverlayContainer::draw_image( litehtml::uint_ptr hdc, const litehtml::b
{
const SvgRuns &runs = svgRuns( url, right - left, bottom - top );
for( SvgRuns::const_iterator run = runs.begin(); run != runs.end(); ++run )
- TheDisplay->drawFillRect( left + run->x, top + run->y, run->length, 1, run->color );
+ {
+ UnsignedByte red, green, blue, alpha;
+ GameGetColorComponents( run->color, &red, &green, &blue, &alpha );
+ TheDisplay->drawFillRect( left + run->x, top + run->y, run->length, 1, tint( red, green, blue, alpha ) );
+ }
return;
}
const Image *image = TheMappedImageCollection->findImageByName( AsciiString( url.c_str() ) );
if( image )
- TheDisplay->drawImage( image, left, top, right, bottom );
+ TheDisplay->drawImage( image, left, top, right, bottom, tint( OPAQUE_ALPHA, OPAQUE_ALPHA, OPAQUE_ALPHA, OPAQUE_ALPHA ) );
}
//-------------------------------------------------------------------------------------------------
@@ -532,7 +540,7 @@ void HtmlOverlayContainer::fillBox( const litehtml::position &box, const litehtm
const Int right = screen( box.x + box.width );
const Int bottom = screen( box.y + box.height );
if( color.alpha > 0 && right > left && bottom > top )
- TheDisplay->drawFillRect( left, top, right - left, bottom - top, gameColor( color ) );
+ TheDisplay->drawFillRect( left, top, right - left, bottom - top, tint( color ) );
}
//-------------------------------------------------------------------------------------------------
@@ -586,10 +594,10 @@ void HtmlOverlayContainer::draw_linear_gradient( litehtml::uint_ptr hdc, const l
const litehtml::web_color &to = stops[ stop + 1 ].color;
const Real span = stops[ stop + 1 ].offset - stops[ stop ].offset;
const Real share = span > 0 ? std::min( 1.0f, std::max( 0.0f, ( offset - stops[ stop ].offset ) / span ) ) : 0.0f;
- const Color color = GameMakeColor( REAL_TO_INT( from.red + ( to.red - from.red ) * share ),
- REAL_TO_INT( from.green + ( to.green - from.green ) * share ),
- REAL_TO_INT( from.blue + ( to.blue - from.blue ) * share ),
- REAL_TO_INT( from.alpha + ( to.alpha - from.alpha ) * share ) );
+ const Color color = tint( REAL_TO_INT( from.red + ( to.red - from.red ) * share ),
+ REAL_TO_INT( from.green + ( to.green - from.green ) * share ),
+ REAL_TO_INT( from.blue + ( to.blue - from.blue ) * share ),
+ REAL_TO_INT( from.alpha + ( to.alpha - from.alpha ) * share ) );
if( across )
TheDisplay->drawFillRect( pixel, top, 1, bottom - top, color );
else
@@ -730,6 +738,7 @@ HtmlOverlay::~HtmlOverlay( void )
void HtmlOverlay::setPage( const std::string &html ) { m_container->setPage( html ); }
void HtmlOverlay::draw( void ) { m_container->draw(); }
+void HtmlOverlay::setAlpha( Int alpha ) { m_container->setAlpha( alpha ); }
Bool HtmlOverlay::hover( const ICoord2D &mouse ) { return m_container->hover( mouse ); }
std::string HtmlOverlay::click( const ICoord2D &mouse ) { return m_container->click( mouse ); }
Int HtmlOverlay::bottomOf( const char *selector ) { return m_container->bottomOf( selector ); }
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 0c1674e03..660d7a2e2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -4115,6 +4115,18 @@ static Int controlBarTop( void )
static const char *const FEED_PAGE = "Window\\Html\\Feed.html";
+//-------------------------------------------------------------------------------------------------
+/** Where the feed stands on screen: the radar's under-attack tab, or the production queue's row
+ * while that is up over the tab. */
+//-------------------------------------------------------------------------------------------------
+Int InGameUI::feedFloor( void ) const
+{
+ // 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
+ const Int floor = m_controlBarPageShown ? m_feedFloor : controlBarTop();
+ return m_productionStripThemed && m_productionStripCount > 0 ? min( floor, m_queueTrayTop ) : floor;
+}
+
//-------------------------------------------------------------------------------------------------
/** 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
@@ -4150,14 +4162,8 @@ void InGameUI::drawFeed( void )
if( m_feedOverlay == NULL )
m_feedOverlay = new HtmlOverlay( m_superweaponNormalFont );
- // 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() ) );
+ values[ "floor" ] = std::to_string( REAL_TO_INT_FLOOR( feedFloor() / ControlBarUniformScale() ) );
m_feedOverlay->setPage( HtmlTemplate_expand( m_feedPage, values, lists, lookupGameText ) );
m_feedOverlay->draw();
}
@@ -4167,10 +4173,13 @@ static const char *const CHAT_PAGE = "Window\\Html\\Chat.html";
enum
{
CHAT_LINE_FRAMES = LOGICFRAMES_PER_SECOND * 10, ///< how long a chat line stays up with the chat shut
+ CHAT_FADE_FRAMES = LOGICFRAMES_PER_SECOND * 3 / 2, ///< the last of that, over which the shut chat fades out
+ OPAQUE_PAGE = 255, ///< HtmlOverlay::setAlpha's full strength
CHAT_LINES_KEPT = 8, ///< the most lines held, all of them shown while the chat is open
CHAT_WIDTH = 360, ///< the chat's width, 800x600
- CHAT_BAR_HEIGHT = 14, ///< the typing bar's height, 800x600
- CHAT_BAR_PERCENT = 58, ///< how far down the screen the typing bar's top stands
+ CHAT_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
+ CHAT_OVER_FEED = 12, ///< the gap between the typing bar and the full feed under it, 800x600
CHAT_CARET_FRAMES = LOGICFRAMES_PER_SECOND / 2 ///< the caret's blink, on and off
};
@@ -4191,9 +4200,10 @@ void InGameUI::chatMessage( Player *player, const UnicodeString &text )
}
//-------------------------------------------------------------------------------------------------
-/** The chat, Window/Html/Chat.html, a little under the middle of the screen: the lines of the last
- * ten seconds, and with Enter pressed 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 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. */
//-------------------------------------------------------------------------------------------------
void InGameUI::drawChat( void )
{
@@ -4201,21 +4211,24 @@ void InGameUI::drawChat( void )
return;
const Real scale = ControlBarUniformScale();
- const Int pageWidth = REAL_TO_INT_FLOOR( TheDisplay->getWidth() / scale );
- const Int left = ( pageWidth - CHAT_WIDTH ) / 2;
- const Int bar = REAL_TO_INT_FLOOR( TheDisplay->getHeight() / scale ) * CHAT_BAR_PERCENT / 100;
+ const Int bar = REAL_TO_INT_FLOOR( feedFloor() / scale ) - FEED_FULL_HEIGHT - CHAT_OVER_FEED - CHAT_BAR_HEIGHT;
UnicodeString typed, audience;
- const Bool open = GetInGameChatEntry( typed, audience, REAL_TO_INT_FLOOR( left * scale ), REAL_TO_INT_FLOOR( bar * scale ),
+ const Bool open = GetInGameChatEntry( typed, audience, 0, REAL_TO_INT_FLOOR( bar * scale ),
REAL_TO_INT_CEIL( CHAT_WIDTH * scale ), REAL_TO_INT_CEIL( CHAT_BAR_HEIGHT * scale ) );
+
+ // shut, the chat is the talk around its newest line: every line that came within CHAT_LINE_FRAMES
+ // before it, up until CHAT_LINE_FRAMES after it and fading out together over the last
+ // CHAT_FADE_FRAMES of that
const UnsignedInt frame = TheGameLogic->getFrame();
+ const UnsignedInt newestUntil = m_chatLines.empty() ? 0 : m_chatLines.back().until;
+ if( !open && ( frame >= newestUntil || frame + CHAT_LINE_FRAMES < newestUntil ) )
+ return;
HtmlLists lists;
std::vector< HtmlValues > &lines = lists[ "chat" ];
for( size_t line = 0; line < m_chatLines.size(); line++ )
- if( open || ( frame < m_chatLines[ line ].until && frame + CHAT_LINE_FRAMES >= m_chatLines[ line ].until ) )
+ if( open || m_chatLines[ line ].until + CHAT_LINE_FRAMES >= newestUntil )
lines.push_back( m_chatLines[ line ].values );
- if( !open && lines.empty() )
- return;
if( !m_chatPageLoaded )
{
@@ -4228,13 +4241,13 @@ void InGameUI::drawChat( void )
m_chatOverlay = new HtmlOverlay( m_superweaponNormalFont );
HtmlValues values;
- values[ "left" ] = std::to_string( left );
values[ "bar" ] = std::to_string( bar );
values[ "open" ] = open ? "open" : "";
values[ "typed" ] = WideCharStringToMultiByte( typed.str() );
values[ "caret" ] = frame / CHAT_CARET_FRAMES % 2 == 0 ? "lit" : "";
values[ "audience" ] = WideCharStringToMultiByte( audience.str() );
m_chatOverlay->setPage( HtmlTemplate_expand( m_chatPage, values, lists, lookupGameText ) );
+ m_chatOverlay->setAlpha( open ? OPAQUE_PAGE : min( (Int)OPAQUE_PAGE, (Int)( newestUntil - frame ) * OPAQUE_PAGE / CHAT_FADE_FRAMES ) );
m_chatOverlay->draw();
}