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): let watchers and beaten players chat

Olcay Seygand8855e9fc4d8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04f450c9f..4ec1540f8 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 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.
+- 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. Watchers can chat now as well, and so can a player who has been beaten; what they write reaches the other watchers and never the players still fighting.
- 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/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
index 913728a5e..c47b8197b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
@@ -3324,12 +3324,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
case GameMessage::MSG_META_CHAT_ALLIES:
if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame())
{
- Player *localPlayer = ThePlayerList->getLocalPlayer();
- if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers)
- {
- ToggleInGameChat();
- SetInGameChatType( INGAME_CHAT_ALLIES );
- }
+ // a watcher, or a player beaten, has no team: his line goes to everyone, and
+ // ConnectionManager::processChat shows it to the watchers alone
+ ToggleInGameChat();
+ SetInGameChatType( ThePlayerList->getLocalPlayer()->isPlayerActive() ? INGAME_CHAT_ALLIES : INGAME_CHAT_EVERYONE );
}
disp = DESTROY_MESSAGE;
break;
@@ -3338,12 +3336,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
case GameMessage::MSG_META_CHAT_EVERYONE:
if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame())
{
- Player *localPlayer = ThePlayerList->getLocalPlayer();
- if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers)
- {
- ToggleInGameChat();
- SetInGameChatType( INGAME_CHAT_EVERYONE );
- }
+ ToggleInGameChat();
+ SetInGameChatType( INGAME_CHAT_EVERYONE );
}
disp = DESTROY_MESSAGE;
break;