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): signals in the sender's colour, named by a word
Olcay Seyganb3351ffe38a4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d3bccc244..1ecd34729 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -502,7 +502,7 @@ found and fixed — EA's own, not port damage.**- Allies only, and only mutual ones. Your position is sent to the players you are actually allied with and to nobody else; an enemy is never sent it at all, and a machine that has been made to send it anyway is ignored by everyone who is not your ally.- An ally who alt-tabs away fades out over a couple of seconds instead of freezing on the map, so a marker that is still there is a marker somebody is still behind.- Off in one place. `ShowAllyCursors = no` in `Options.ini` stops both halves: nothing is sent from your machine and nothing is drawn on it.-- Alt+Z, Alt+X and Alt+C put up a puff of smoke where your mouse is. Red says attack here, blue says defend here, yellow says look at this. Point at the radar instead and the smoke goes up on that spot of the map.+- Alt+Z, Alt+X and Alt+C put up a puff of smoke in your own colour where your mouse is, with ATTACK, DEFEND or LOOK written over it. The colour says who, the word says what. Point at the radar instead and the smoke goes up on that spot of the map.- Your allies see the smoke and their radar blinks at the spot, and the message area says who sent it. Three seconds later the smoke has cleared, so the call you made a minute ago is never still standing next to the one you are making now. Enemies see none of it.- One signal a second per player. Hammering the key gets you the first puff and nothing else, and a teammate who tries it cannot bury your screen in smoke either, because every machine in the game holds everyone to the same limit.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 60fa5e54c..05295ab8b 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -185,13 +185,14 @@ GUI:HoldPositionDescription"Every selected unit guards the spot it is standing on: it shoots what comes into range and never chases it."END-// Smoke signals. The three ...Placed lines are what an ally reads; %s is the sender's name.+// Smoke signals. The three ...Placed lines are what an ally reads; %s is the sender's name. The+// ...Label words are written over the smoke, which is in the sender's colour.GUI:SignalAttack"Signal: Attack"ENDGUI:SignalAttackDescription-"Red smoke for three seconds where the cursor is, or on the radar spot under it. Only your allies see it."+"Smoke in your colour marked ATTACK for three seconds, where the cursor is or on the radar spot under it. Only your allies see it."ENDGUI:SignalDefend@@ -199,7 +200,7 @@ GUI:SignalDefendENDGUI:SignalDefendDescription-"Blue smoke for three seconds where the cursor is, or on the radar spot under it. Only your allies see it."+"Smoke in your colour marked DEFEND for three seconds, where the cursor is or on the radar spot under it. Only your allies see it."ENDGUI:SignalAttention@@ -207,7 +208,19 @@ GUI:SignalAttentionENDGUI:SignalAttentionDescription-"Yellow smoke for three seconds where the cursor is, or on the radar spot under it. Only your allies see it."+"Smoke in your colour marked LOOK for three seconds, where the cursor is or on the radar spot under it. Only your allies see it."+END++GUI:SignalAttackLabel+"ATTACK"+END++GUI:SignalDefendLabel+"DEFEND"+END++GUI:SignalAttentionLabel+"LOOK"ENDGUI:SignalAttackPlaceddiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex cca2743a8..5f19342d9 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -276,6 +276,7 @@ public:Coord3D m_pos3D; ///< the 3d position in game coordsInt m_frameTimeOut; ///< when we want this thing to disappearInt m_frameCount; ///< how many frames have we been displaying text?+ Bool m_seenThroughShroud; ///< drawn over fogged ground too; a signal word is about a place nobody may be watching (fork)};typedef std::list<FloatingTextData *> FloatingTextList;@@ -834,7 +835,8 @@ public: // ********************************************************************virtual void setDisplayedMaxWarning( Bool selected ) { m_displayedMaxWarning = selected; }// Floating Test Methods- virtual void addFloatingText(const UnicodeString& text,const Coord3D * pos, Color color);+ /// the text it added, for a caller that wants to hold it longer; NULL while icons are not drawn+ virtual FloatingTextData *addFloatingText(const UnicodeString& text,const Coord3D * pos, Color color);// Drawable caption stuffAsciiString getDrawableCaptionFontName( void ) { return m_drawableCaptionFont; }diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 4d5856a45..4f9815e28 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -6901,9 +6901,11 @@ void InGameUI::buildRegion( const ICoord2D *anchor, const ICoord2D *dest, IRegio//-------------------------------------------------------------------------------------------------/** Add a new floating text to our list *///--------------------------------------------------------------------------------------------------void InGameUI::addFloatingText(const UnicodeString& text,const Coord3D *pos, Color color)+FloatingTextData *InGameUI::addFloatingText(const UnicodeString& text,const Coord3D *pos, Color color){- if( TheGameLogic->getDrawIconUI() )+ if( !TheGameLogic->getDrawIconUI() )+ return NULL;+{FloatingTextData *newFTD = newInstance( FloatingTextData );newFTD->m_frameCount = 0;@@ -6923,6 +6925,7 @@ void InGameUI::addFloatingText(const UnicodeString& text,const Coord3D *pos, ColnewFTD->m_frameTimeOut = TheGameLogic->getFrame() + m_floatingTextTimeOut;m_floatingTextList.push_front( newFTD ); // add to the list+ return newFTD;}}@@ -8521,7 +8524,7 @@ void InGameUI::drawFloatingText( void )// translate it's 3d pos into a 2d screen posif( TheTacticalView->worldToScreen(&ftd->m_pos3D, &pos)&& ftd->m_dString- && ThePartitionManager->getShroudStatusForPlayer(playerNdx, pCX, pCY) == CELLSHROUD_CLEAR )+ && ( ftd->m_seenThroughShroud || ThePartitionManager->getShroudStatusForPlayer(playerNdx, pCX, pCY) == CELLSHROUD_CLEAR ) ){pos.y -= ftd->m_frameCount * m_floatingTextMoveUpSpeed;Color dropColor;@@ -8640,6 +8643,7 @@ FloatingTextData::FloatingTextData(void)m_color = 0;m_frameCount = 0;m_frameTimeOut = 0;+ m_seenThroughShroud = FALSE;m_pos3D.zero();m_text.clear();//diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cppindex 707335d95..95abffae0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp@@ -131,6 +131,7 @@ static void considerBuilderProc( Object *obj, void *userData )#include "GameClient/KeyDefs.h"#include "GameClient/Mouse.h"#include "GameClient/ParticleSys.h"+#include "GameClient/PlayerColorScheme.h"#include "GameClient/Shell.h"#include "GameClient/Module/BeaconClientUpdate.h"#include "GameClient/LookAtXlat.h"@@ -399,23 +400,23 @@ void GameLogic::prepareNewGame( Int gameMode, GameDifficulty diff, Int rankPoint} // end prepareNewGame//--------------------------------------------------------------------------------------------------/** What each smoke signal looks like on an ally's screen, indexed by SignalKind. The smoke is the- * beacon's white template tinted, which is all the coloured beacon templates are: they differ- * from it in their second colour key and nowhere else. No signal uses RADAR_EVENT_UNDER_ATTACK,- * because Radar::tryEvent refuses a real attack warning within ten seconds of one of those. */+/** What each smoke signal says on an ally's screen, indexed by SignalKind. The smoke is the sender's+ * colour, so the kind is told apart by the word floated over it. No signal uses+ * RADAR_EVENT_UNDER_ATTACK, because Radar::tryEvent refuses a real attack warning within ten+ * seconds of one of those. *///-------------------------------------------------------------------------------------------------struct SignalLook{- Color smokeColor;RadarEventType radarEvent;+ const char *wordLabel;const char *announcementLabel;};static const SignalLook SIGNAL_LOOKS[ SIGNAL_KIND_COUNT ] ={- { 0xFF0000, RADAR_EVENT_BATTLE_PLAN, "GUI:SignalAttackPlaced" },- { 0x4368FE, RADAR_EVENT_CONSTRUCTION, "GUI:SignalDefendPlaced" },- { 0xDDE20D, RADAR_EVENT_INFORMATION, "GUI:SignalAttentionPlaced" },+ { RADAR_EVENT_BATTLE_PLAN, "GUI:SignalAttackLabel", "GUI:SignalAttackPlaced" },+ { RADAR_EVENT_CONSTRUCTION, "GUI:SignalDefendLabel", "GUI:SignalDefendPlaced" },+ { RADAR_EVENT_INFORMATION, "GUI:SignalAttentionLabel", "GUI:SignalAttentionPlaced" },};static const char *SIGNAL_SMOKE_TEMPLATE = "BeaconSmokeFFFFFF";@@ -435,6 +436,9 @@ static const Real SIGNAL_SMOKE_RISE_SCALE = 3.0f;static const Real SIGNAL_SMOKE_ALPHA_MIN = 0.6f;static const Real SIGNAL_SMOKE_ALPHA_MAX = 0.8f;+/// the word starts this far above the ground, at about the top of the plume, and floats up from there+static const Real SIGNAL_LABEL_HEIGHT = 40.0f;+//-------------------------------------------------------------------------------------------------/** Is a signal on this frame too soon after the player's last one? A last frame ahead of now is* left over from an earlier match, whose clock ran further, and holds nothing back. */@@ -2117,7 +2121,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )if( smoke ){smoke->setPosition( &pos );- smoke->tintAllColors( look.smokeColor );+ smoke->tintAllColors( clientPlayerColor( thisPlayer ) );// the tint leaves the first key alone, and in this template that key is an orange flashsmoke->m_colorKey[ 0 ].color = smoke->m_colorKey[ 1 ].color;smoke->setFiniteSystemLifetime( SIGNAL_HALF_FRAMES );@@ -2133,6 +2137,17 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )TheRadar->createEvent( &pos, look.radarEvent, SIGNAL_SECONDS );+ // addFloatingText runs the colour through the viewer's scheme itself, so it takes the logic one+ Coord3D labelPos = pos;+ labelPos.z += SIGNAL_LABEL_HEIGHT;+ FloatingTextData *word = TheInGameUI->addFloatingText( TheGameText->fetch( look.wordLabel ), &labelPos, thisPlayer->getPlayerColor() );+ if( word )+ {+ // a money pop-up is gone in a third of a second and only over ground in plain sight+ word->m_frameTimeOut = getFrame() + SIGNAL_HALF_FRAMES;+ word->m_seenThroughShroud = TRUE;+ }+UnicodeString announcement;announcement.format( TheGameText->fetch( look.announcementLabel ), thisPlayer->getPlayerDisplayName().str() );TheInGameUI->message( announcement );