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): signal buttons arm a click, signals leave a ground mark

Olcay Seygana8a142365bfa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e311e7976..54af494ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -508,7 +508,7 @@ found and fixed — EA's own, not port damage.**
- Every panel of the bar is only as big as what it holds now, and stands on the bottom of the screen. The radar's border runs out to the screen's left edge, the portrait's to the right edge, and the middle is built up like bricks laid flush: the command grid's panel at the bottom, the power bar standing on its border in a steel frame of its own, a row of forty cells that light up from the left with your production and fill the frame from edge to edge when full, the consumption marked by a white needle, and on top of that a narrower block no taller than the money written on it. Everything the old painting filled round them is battlefield again, and a click there lands on the battlefield.
- The bar's own buttons are drawn to match, steel caps lit gold under the pointer and pressed in when pushed. The menu is a small square with three bars in the screen's top left corner. The idle worker button is a key like the smoke signals', a hard hat on it, in a steel step against the middle panel's bottom left corner, where it no longer hides the end of the power bar, and the build buttons sit down level with it, a few pixels over the bottom of the screen. Each of the fourteen build places is its own dark cell with steel running between them, so an empty place reads as a slot waiting for a button, and the steel is laid over the edge of every picture the way a frame holds a card, the whole picture showing inside it. The production queue and the general's powers are framed the same way. The power bar is sunk into the same steel plate as the build grid, the plate carried on upward as wide as it, and the money's block sits on top of that plate with no seam between them: the build grid, the power and the money read as one piece. The power bar is as long as the build grid on every side, where it used to change length from one faction to the next, and the money sits over the grid's middle. The build grid's panel no longer carries an empty strip down its left side. There is no chat button any more: Enter opens the chat as it always did. The beacon button is gone from the bar too; the smoke signals over the radar are how you point your team at a spot. The portrait sits in the radar's lit steel too. The experience bar beside it is ten gold rungs in a sunk groove, climbing from the bottom as you earn your way to the next rank, and your rank stands in a steel tab on the portrait's top right corner, a key sunk in it like the idle worker's with one star for every rank there is, gold up to the one you hold. The portrait's grid is steel between dark cells on every side, where America's was drawn in blue lines that matched nothing else on the bar. That key is the promotions button: point at it and it comes up with a gold rim, it blinks bright in your side's own steel while you have a promotion to spend, and a click opens the promotion screen. That screen is rebuilt in the same steel and half its old size: each rank's promotions stand in a grid of build-button cells five wide, like the command grid, an empty place a dark hole, each rank in a steel well of its own with its heading, the wells a plate's thickness apart, the grid's steel laid over the edge of every picture so the picture sits in its cell like a card in a frame, your rank and the points to spend on one line over the experience bar, and Done in the last row's spare place. A gold rim marks what you have bought and a light one what you can buy now. The bar has no minimise arrow any more: it is only as big as what it holds. The radar sits sunk in a bezel of lit steel, bright along the top and shadowed down the right, and the build grid and the money wear the same steel, the figure in a dark window of its own, and the under-attack light is a long red lamp set in a steel tab on its top left corner, dark until you are hit and then blinking. No words on it, so it reads the same in any language.
- The general's powers you have bought and can fire, the column that climbed the right edge of the screen, stand over the portrait now in a tray of the bar's own steel. The first sits in the corner against the right edge of the screen, and each one you gain takes the place to the left of the last, three to a row before a new row starts above, so the tray is only ever as big as what you hold and an empty one takes no room at all. Each power sits on a dark cell three quarters the size of a build button, where the side's old tray art used to frame it. It is always out; there is no button to fold it away.
-- Three buttons sit in a step of the radar's own steel, on its right: the smoke signals Alt+Z, X and C send, placed in the middle of your view for your allies to see. Each is a key sunk into the steel with a sharp white picture on it instead of a word: a crosshair to attack, a shield to defend, an eye to look. Point at one and it comes up out of its well as lit steel with a gold rim, and it sinks in darker while you hold the button down. They rise into place one after another from the bottom of the screen when the match starts. A game with nobody on your side to see the smoke, a skirmish against the computer or a replay, has no signal buttons at all.
+- Three buttons sit in a step of the radar's own steel, on its right: the smoke signals Alt+Z, X and C send. Press one and the pointer turns to a cross; your next click puts the signal there, on the ground or on the radar, and a right click or Escape takes it back; until now a button dropped its smoke in the middle of your view. Every signal now leaves a mark on the ground in your colour for ten seconds, and the radar ping lasts as long: crossed swords to attack, a shield to defend, an eye to look, each in a ring a few tanks across, fading out over its last two seconds. Each is a key sunk into the steel with a sharp white picture on it instead of a word: a crosshair to attack, a shield to defend, an eye to look. Point at one and it comes up out of its well as lit steel with a gold rim, and it sinks in darker while you hold the button down. They rise into place one after another from the bottom of the screen when the match starts. A game with nobody on your side to see the smoke, a skirmish against the computer or a replay, has no signal buttons at all.
- Tooltips wear the bar's steel. Point at a build button and a card opens right above it rather than in a fixed box at the side: the name on a steel header in your side's colour with the price in gold at its end, every "Power Supplied: 5" or "Strong: infantry" line of the description laid out as a label and a bold figure, then the unit's health, damage, attacks a second, damage a second, range and build time in gold, counted with the upgrades you own. Under them every upgrade that touches the unit and what it does to it: a Gattling Tank's card says Chain Guns takes its damage from 15 to 18 and its damage a second from 37 to 46, a Humvee's that TOW adds a 50 damage missile with a range of 317, and an upgrade you already bought turns gold. Point at the upgrade itself and the card lists the units it changes, Composite Armor putting a Crusader from 480 health to 680. At the bottom, "not enough money" or what you still need in a sunk red note at the bottom. Point at something on the battlefield and a small dark box beside the pointer names it, its owner's colour in a stripe down the left edge.
- The readout in the top right corner is a box of its own and always there: the time of day, the match time and the real time beside it, the logic rate and the frame rate, the renderer and the frame number. In a network game it adds how many frames are ready out of the input delay, the room's frame rate and the traffic in and out, and under a unit limit your count against it.
- The top of the screen is battlefield. The players, their teams, their superweapons with the seconds left and the match clock are all on Tab, which already had every one of them, so the column of superweapon countdowns that used to sit in the top right is gone while you play, and so is a strip of flags that repeated the scoreboard across the top edge.
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index 57be7b1b8..7ae597095 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -665,8 +665,9 @@ add_custom_command(TARGET generals POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/Data/Install_Final.bmp
${CMAKE_CURRENT_SOURCE_DIR}/../Run/
- # The three command bar plates per side. A loose texture beats every .big, so
- # these land in Run/Art/Textures where the W3D file system looks first.
+ # The three command bar plates per side and the smoke signals' ground marks. A loose
+ # texture beats every .big, so these land in Run/Art/Textures where the W3D file
+ # system looks first.
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/Data/Art/Textures
${CMAKE_CURRENT_SOURCE_DIR}/../Run/Art/Textures
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalAttack.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalAttack.tga
new file mode 100644
index 000000000..513c9625b
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalAttack.tga differ
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalDefend.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalDefend.tga
new file mode 100644
index 000000000..9a7c06e24
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalDefend.tga differ
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalLook.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalLook.tga
new file mode 100644
index 000000000..dad6db318
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedSignalLook.tga differ
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h
index 37fed47c3..d4e20b6ef 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h
@@ -145,17 +145,6 @@ extern Bool Command_stopMeansCancelConstruction( Int selectionCount, Bool locall
extern Bool Command_formationDragArmed( Bool setting, Bool haveMovableSelection,
Bool guiCommandPending );
-/** The smoke signals a player drops for their allies, carried as the integer argument of
- * MSG_PLACE_SIGNAL. The value arrives from another machine, so the receiving side range-checks
- * it against SIGNAL_KIND_COUNT. */
-enum SignalKind
-{
- SIGNAL_ATTACK,
- SIGNAL_DEFEND,
- SIGNAL_ATTENTION,
- SIGNAL_KIND_COUNT
-};
-
/** Which signal a SIGNAL_* meta key drops; SIGNAL_KIND_COUNT for every other message. */
extern SignalKind Command_signalKindForMeta( GameMessage::Type meta );
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 8ac055e3d..1cec66c32 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -76,6 +76,17 @@ enum ShadowType;
enum CanAttackResult;
enum ScienceType;
+/** The smoke signals a player drops for their allies, carried as the integer argument of
+ * MSG_PLACE_SIGNAL. The value arrives from another machine, so the receiving side range-checks
+ * it against SIGNAL_KIND_COUNT. */
+enum SignalKind
+{
+ SIGNAL_ATTACK,
+ SIGNAL_DEFEND,
+ SIGNAL_ATTENTION,
+ SIGNAL_KIND_COUNT
+};
+
// ------------------------------------------------------------------------------------------------
enum RadiusCursorType
{
@@ -887,6 +898,14 @@ public: // ********************************************************************
virtual FloatingTextData *addFloatingText(const UnicodeString& text,const Coord3D * pos, Color color);
/// a smoke signal's word, written on the smoke for holdFrames and then faded like any floating text
void addSignalWord( const UnicodeString& text, const Coord3D *pos, Color color, UnsignedInt holdFrames );
+ /// a smoke signal's mark laid on the ground in the sender's colour, faded in and out over holdFrames
+ void addSignalMark( SignalKind kind, const Coord3D &pos, Color color, UnsignedInt holdFrames );
+ /// a signal button pressed: the next left click on the ground or the radar drops that signal there
+ void armSignal( SignalKind kind ) { m_armedSignal = kind; }
+ void disarmSignal( void ) { m_armedSignal = SIGNAL_KIND_COUNT; }
+ Bool isSignalArmed( void ) const { return m_armedSignal != SIGNAL_KIND_COUNT; }
+ /// sends the armed signal to `world` and disarms; FALSE, doing nothing, when none is armed
+ Bool placeArmedSignal( const Coord3D &world );
// Drawable caption stuff
AsciiString getDrawableCaptionFontName( void ) { return m_drawableCaptionFont; }
@@ -1275,6 +1294,16 @@ protected:
UnsignedInt until; ///< the logic frame it leaves on
};
std::vector< FeedLine > m_feedLines;
+ SignalKind m_armedSignal; ///< the signal the next click drops; SIGNAL_KIND_COUNT for none
+ struct SignalMark
+ {
+ Shadow *decal;
+ UnsignedInt born; ///< the logic frame it went down on
+ UnsignedInt until; ///< and the one it is gone by
+ };
+ std::vector< SignalMark > m_signalMarks;
+ void updateSignalMarks( void );
+ void clearSignalMarks( void );
void addFeedLine( HtmlValues line );
void feedAct( Player *player, const Image *cameo, const std::string &what, const char *tag, const char *label );
void watchDozers( void );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp
index 570eb9f27..c13be4dfa 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp
@@ -305,6 +305,17 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg,
if( radarPixelToWorld( &mouse, &world ) )
{
+ // a signal armed off the command bar goes down on the map spot a left press is over,
+ // and a right press takes it back
+ if( TheInGameUI->isSignalArmed() )
+ {
+ if( msg == GWM_LEFT_DOWN )
+ TheInGameUI->placeArmedSignal( world );
+ else
+ TheInGameUI->disarmSignal();
+ break;
+ }
+
// No drawables, or a right click automatically means its a look at.
// Having drawables and being in attack move mode means that we should attack move.
// Having drawables and not being in attack move mode means that we should move.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index dce89d932..366abc8dd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -83,6 +83,7 @@
#include "GameClient/GadgetStaticText.h"
#include "GameClient/View.h"
#include "GameClient/TerrainVisual.h"
+#include "GameClient/CinemaDirector.h"
#include "GameClient/ControlBar.h"
#include "GameClient/Display.h"
#include "GameClient/WindowLayout.h"
@@ -1166,6 +1167,7 @@ InGameUI::InGameUI()
m_feedPageLoaded = FALSE;
m_feedFloor = 0;
m_queueTrayTop = 0;
+ m_armedSignal = SIGNAL_KIND_COUNT;
m_dozerCheckFrame = 0;
for( Int index = 0; index < MAX_PLAYER_COUNT; index++ )
m_hadDozer[ index ] = FALSE;
@@ -3411,6 +3413,7 @@ void InGameUI::update( void )
UnsignedInt currLogicFrame = TheGameLogic->getFrame();
if( TheGameLogic->isInGame() && !TheGameLogic->isInShellGame() )
watchDozers();
+ updateSignalMarks();
UnsignedByte r, g, b, a;
Int amount;
@@ -3749,6 +3752,8 @@ void InGameUI::reset( void )
m_feedPageLoaded = FALSE;
m_chatPageLoaded = FALSE;
m_chatLines.clear();
+ clearSignalMarks();
+ m_armedSignal = SIGNAL_KIND_COUNT;
m_dozerCheckFrame = 0;
for( Int index = 0; index < MAX_PLAYER_COUNT; index++ )
m_hadDozer[ index ] = FALSE;
@@ -5703,6 +5708,13 @@ void InGameUI::createMouseoverHint( const GameMessage *msg )
if (m_isScrolling || m_isSelecting)
return; // no mouseover for you
+ // a signal armed off the bar is where the next click goes, over a unit, the ground or the radar
+ if( isSignalArmed() )
+ {
+ setMouseCursor( Mouse::CROSS );
+ return;
+ }
+
GameWindow *window = NULL;
const MouseIO *io = TheMouse->getMouseStatus();
Bool underWindow = false;
@@ -5986,6 +5998,12 @@ void InGameUI::createCommandHint( const GameMessage *msg )
if (m_isScrolling || m_isSelecting || TheRecorder->getMode() == RECORDERMODETYPE_PLAYBACK)
return;
+ if( isSignalArmed() )
+ {
+ setMouseCursor( Mouse::CROSS );
+ return;
+ }
+
const Drawable *draw = TheGameClient->findDrawableByID(m_mousedOverDrawableID);
GameMessage::Type t = msg->getType();
//#ifdef DO_SHROUD_PROJECTION
@@ -8797,6 +8815,97 @@ void InGameUI::addSignalWord( const UnicodeString& text, const Coord3D *pos, Col
TheGlobalLanguageData->adjustFontSize( SIGNAL_WORD_POINT_SIZE ), TRUE ) );
}
+/** Each signal's mark on the ground, by SignalKind: Art/Textures/<name>.tga, drawn by
+ * Tools/signal_marks.py, white where the sender's colour goes. */
+static const char *const SIGNAL_MARK_TEXTURES[ SIGNAL_KIND_COUNT ] =
+{
+ "ReforgedSignalAttack", "ReforgedSignalDefend", "ReforgedSignalLook"
+};
+
+enum
+{
+ SIGNAL_MARK_SIZE = 160, ///< across, in world units: 90 read as a coin from the default camera
+ SIGNAL_MARK_OPACITY = 230, ///< out of 255, so the ground under it still shows a little
+ SIGNAL_MARK_FADE_IN_FRAMES = LOGICFRAMES_PER_SECOND / 4,
+ SIGNAL_MARK_FADE_OUT_FRAMES = LOGICFRAMES_PER_SECOND * 2
+};
+
+//-------------------------------------------------------------------------------------------------
+/** The mark a signal lays on the ground: crossed swords, a shield or an eye in a ring, in `color`,
+ * turned to this viewer's camera as it stands now so it reads upright. */
+//-------------------------------------------------------------------------------------------------
+void InGameUI::addSignalMark( SignalKind kind, const Coord3D &pos, Color color, UnsignedInt holdFrames )
+{
+ Shadow::ShadowTypeInfo decalInfo;
+ decalInfo.allowUpdates = FALSE;
+ decalInfo.allowWorldAlign = TRUE; // wrapped over the terrain it lands on
+ // SHADOW_ALPHA_DECAL is the kind setColor and setOpacity reach, and removeShadow takes off
+ decalInfo.m_type = SHADOW_ALPHA_DECAL;
+ strcpy( decalInfo.m_ShadowName, SIGNAL_MARK_TEXTURES[ kind ] );
+ decalInfo.m_sizeX = SIGNAL_MARK_SIZE;
+ decalInfo.m_sizeY = SIGNAL_MARK_SIZE;
+ decalInfo.m_offsetX = 0.0f;
+ decalInfo.m_offsetY = 0.0f;
+
+ SignalMark mark;
+ mark.decal = TheProjectedShadowManager->addDecal( &decalInfo );
+ mark.decal->setAngle( TheTacticalView->getAngle() );
+ mark.decal->setColor( color );
+ mark.decal->setOpacity( 0 );
+ mark.decal->setPosition( pos.x, pos.y, pos.z );
+ mark.born = TheGameLogic->getFrame();
+ mark.until = mark.born + holdFrames;
+ m_signalMarks.push_back( mark );
+}
+
+//-------------------------------------------------------------------------------------------------
+/** Fades each mark in and out by the logic frame, so a paused game holds them, and takes off the
+ * ones whose time is up. Hidden while scripts or -cinema hide the icons, like a radius decal. */
+//-------------------------------------------------------------------------------------------------
+void InGameUI::updateSignalMarks( void )
+{
+ const UnsignedInt frame = TheGameLogic->getFrame();
+ const Bool shown = TheGameLogic->getDrawIconUI() && !CinemaDirector_hidesHud();
+ for( size_t index = 0; index < m_signalMarks.size(); )
+ {
+ // a frame going backwards is a loaded save, and the mark is not from this game any more
+ SignalMark &mark = m_signalMarks[ index ];
+ if( frame >= mark.until || frame < mark.born )
+ {
+ mark.decal->release();
+ m_signalMarks.erase( m_signalMarks.begin() + index );
+ continue;
+ }
+
+ const UnsignedInt rising = ( frame - mark.born ) * SIGNAL_MARK_OPACITY / SIGNAL_MARK_FADE_IN_FRAMES;
+ const UnsignedInt falling = ( mark.until - frame ) * SIGNAL_MARK_OPACITY / SIGNAL_MARK_FADE_OUT_FRAMES;
+ mark.decal->setOpacity( shown ? (Int)min( (UnsignedInt)SIGNAL_MARK_OPACITY, min( rising, falling ) ) : 0 );
+ index++;
+ }
+}
+
+void InGameUI::clearSignalMarks( void )
+{
+ for( size_t index = 0; index < m_signalMarks.size(); index++ )
+ m_signalMarks[ index ].decal->release();
+ m_signalMarks.clear();
+}
+
+//-------------------------------------------------------------------------------------------------
+/** The same logic message as the Alt+Z/X/C keys, so the same throttle and the same allies see it. */
+//-------------------------------------------------------------------------------------------------
+Bool InGameUI::placeArmedSignal( const Coord3D &world )
+{
+ if( !isSignalArmed() )
+ return FALSE;
+
+ GameMessage *message = TheMessageStream->appendMessage( GameMessage::MSG_PLACE_SIGNAL );
+ message->appendLocationArgument( world );
+ message->appendIntegerArgument( m_armedSignal );
+ disarmSignal();
+ return TRUE;
+}
+
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
#if defined(_DEBUG) || defined(_INTERNAL)
@@ -10568,29 +10677,25 @@ static Bool signalsAllowed( void )
}
//-------------------------------------------------------------------------------------------------
-/** data-click="signal:attack", "signal:defend" or "signal:look": the smoke the Alt+Z/X/C keys send,
- * in the middle of the view, since a button has no cursor over the ground to put it under. The
- * same logic message as the keys, so the same throttle and the same allies see it. */
+/** data-click="signal:attack", "signal:defend" or "signal:look": arms the smoke the Alt+Z/X/C keys
+ * send, and the next left click on the ground or the radar drops it there; the right button or
+ * Escape takes it back. */
//-------------------------------------------------------------------------------------------------
-static void placeSignalAtView( const std::string &kind )
+static void armSignalFromPage( const std::string &kind )
{
static const struct { const char *name; SignalKind kind; } KINDS[] =
{
{ "attack", SIGNAL_ATTACK }, { "defend", SIGNAL_DEFEND }, { "look", SIGNAL_ATTENTION }
};
- if( !signalsAllowed() || TheTacticalView == NULL )
+ if( !signalsAllowed() )
return;
for( Int each = 0; each < (Int)ARRAY_SIZE( KINDS ); each++ )
{
if( kind != KINDS[ each ].name )
continue;
- Coord3D world;
- TheTacticalView->getPosition( &world );
- GameMessage *message = TheMessageStream->appendMessage( GameMessage::MSG_PLACE_SIGNAL );
- message->appendLocationArgument( world );
- message->appendIntegerArgument( KINDS[ each ].kind );
+ TheInGameUI->armSignal( KINDS[ each ].kind );
return;
}
DEBUG_LOG(( "Command bar page: data-click=\"signal:%s\" names no signal\n", kind.c_str() ));
@@ -11343,7 +11448,7 @@ Bool InGameUI::handleControlBarPageClick( const ICoord2D *mouse, Bool act )
if( action.compare( 0, SIGNAL_ACTION.size(), SIGNAL_ACTION ) == 0 )
{
if( act )
- placeSignalAtView( action.substr( SIGNAL_ACTION.size() ) );
+ armSignalFromPage( action.substr( SIGNAL_ACTION.size() ) );
return TRUE;
}
if( action.compare( 0, PRESS_ACTION.size(), PRESS_ACTION ) != 0 )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
index c47b8197b..02c2e20dc 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
@@ -3449,6 +3449,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
cancelledSomething = TRUE;
}
+ if( TheInGameUI->isSignalArmed() )
+ {
+ TheInGameUI->disarmSignal();
+ cancelledSomething = TRUE;
+ }
+
if( cancelledSomething == FALSE )
ToggleQuitMenu();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp
index 54eb0987e..f91d4f6dd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp
@@ -648,6 +648,18 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
//-----------------------------------------------------------------------------
case GameMessage::MSG_MOUSE_LEFT_CLICK:
{
+ // a signal armed off the command bar goes down where this click is, and the click selects nothing
+ if( TheInGameUI->isSignalArmed() )
+ {
+ const IRegion2D &clicked = msg->getArgument(0)->pixelRegion;
+ const ICoord2D centre = { ( clicked.lo.x + clicked.hi.x ) / 2, ( clicked.lo.y + clicked.hi.y ) / 2 };
+ Coord3D world;
+ if( TheTacticalView->screenToTerrain( &centre, &world ) )
+ TheInGameUI->placeArmedSignal( world );
+ disp = DESTROY_MESSAGE;
+ break;
+ }
+
// the release that ended an attack circle still arrives here as a click. Letting it
// through would reselect whatever sat under the anchor, and a changed selection is exactly
// what drops the queue that was just built
@@ -1168,6 +1180,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
//-----------------------------------------------------------------------------
case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP:
{
+ // a signal armed off the command bar is all the right button takes back
+ if( TheInGameUI->isSignalArmed() )
+ {
+ TheInGameUI->disarmSignal();
+ break;
+ }
+
//
// Legacy is the game as shipped: a right drag scrolled the camera and did nothing else, and
// a right click cancelled whatever was armed or, with nothing armed, deselected everyone.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
index a9e134572..0bdb58bdc 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
@@ -427,6 +427,9 @@ static const Real SIGNAL_SECONDS = 3.0f;
/// the smoke is fed for the first half of the signal and its last puff fades out over the second
static const UnsignedInt SIGNAL_HALF_FRAMES = (UnsignedInt)( SIGNAL_SECONDS * LOGICFRAMES_PER_SECOND / 2 );
+/// the mark on the ground and the radar ping outlast the smoke, as long as the feed's line about it
+static const Real SIGNAL_MARK_SECONDS = 10.0f;
+
static const UnsignedInt SIGNAL_COOLDOWN_FRAMES = LOGICFRAMES_PER_SECOND;
// The beacon template draws a column nine units wide that needs five seconds to climb, which at the
@@ -2147,7 +2150,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
smoke->setVelocityMultiplier( &rise );
}
- TheRadar->createEvent( &pos, look.radarEvent, SIGNAL_SECONDS );
+ TheRadar->createEvent( &pos, look.radarEvent, SIGNAL_MARK_SECONDS );
+ TheInGameUI->addSignalMark( (SignalKind)kind, pos, clientPlayerColor( thisPlayer ),
+ (UnsignedInt)( SIGNAL_MARK_SECONDS * LOGICFRAMES_PER_SECOND ) );
// floating text runs the colour through the viewer's scheme itself, so it takes the logic one
Coord3D labelPos = pos;
diff --git a/GeneralsMD/Code/Tools/signal_marks.py b/GeneralsMD/Code/Tools/signal_marks.py
new file mode 100644
index 000000000..ad1a3d726
--- /dev/null
+++ b/GeneralsMD/Code/Tools/signal_marks.py
@@ -0,0 +1,111 @@
+"""The ground marks a smoke signal leaves: crossed swords for attack, a shield for defend, an eye for
+look, each in a ring. The game lays them on the terrain as decals tinted the sender's colour, so they
+are white where the colour goes and black round the edge so they read on any ground.
+
+ python Tools/signal_marks.py # writes Data/Art/Textures/ReforgedSignal*.tga
+
+Drawn four times too big and brought down, which is the antialiasing."""
+import math
+import os
+import sys
+
+from PIL import Image, ImageChops, ImageDraw, ImageFilter
+
+DRAWN = 512
+SHIPPED = 128
+CENTRE = DRAWN // 2
+OUTLINE = 17 # a MaxFilter size, odd: the black edge round every white shape, 8 drawn pixels
+GAP = 13 # the black kept between two swords where they cross
+RING_OUTER = 236
+RING_INNER = 204
+INSIDE_ALPHA = 80 # the ring's inside darkened a little, so the mark reads on bright ground
+OUT_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures")
+
+
+def blank():
+ return Image.new("L", (DRAWN, DRAWN), 0)
+
+
+def disc(mask, radius, fill):
+ ImageDraw.Draw(mask).ellipse((CENTRE - radius, CENTRE - radius, CENTRE + radius, CENTRE + radius), fill=fill)
+
+
+def polygon(mask, points, fill, turn=0.0):
+ cosine, sine = math.cos(turn), math.sin(turn)
+ placed = [(CENTRE + x * cosine - y * sine, CENTRE + x * sine + y * cosine) for x, y in points]
+ ImageDraw.Draw(mask).polygon(placed, fill=fill)
+
+
+def sword(turn):
+ mask = blank()
+ polygon(mask, [(-19, -125), (0, -172), (19, -125), (19, 62), (-19, 62)], 255, turn)
+ polygon(mask, [(-64, 62), (64, 62), (64, 86), (-64, 86)], 255, turn)
+ polygon(mask, [(-12, 86), (12, 86), (12, 136), (-12, 136)], 255, turn)
+ cosine, sine = math.cos(turn), math.sin(turn)
+ x, y = CENTRE - 152 * sine, CENTRE + 152 * cosine
+ ImageDraw.Draw(mask).ellipse((x - 21, y - 21, x + 21, y + 21), fill=255)
+ return mask
+
+
+def swords():
+ under, over = sword(math.radians(-45)), sword(math.radians(45))
+ return ImageChops.lighter(ImageChops.subtract(under, over.filter(ImageFilter.MaxFilter(GAP))), over)
+
+
+def shield_outline(scale, lift):
+ points = [(-120, -140), (120, -140), (120, 10)]
+ points += [(120 * math.cos(step / 20 * math.pi / 2), 10 + 160 * math.sin(step / 20 * math.pi / 2)) for step in range(1, 20)]
+ points += [(0, 170)]
+ points += [(-x, y) for x, y in reversed(points[2:-1])]
+ return [(x * scale, y * scale + lift) for x, y in points]
+
+
+def shield():
+ mask = blank()
+ polygon(mask, shield_outline(1.0, 0), 255)
+ polygon(mask, shield_outline(0.78, -4), 0)
+ polygon(mask, shield_outline(0.6, -8), 255)
+ return mask
+
+
+def lens(mask, half_width, half_height, fill):
+ # two circles through the lens's corners, the one below giving its top edge and the one above its bottom
+ radius = (half_width ** 2 + half_height ** 2) / (2 * half_height)
+ top, bottom = blank(), blank()
+ ImageDraw.Draw(top).ellipse((CENTRE - radius, CENTRE - half_height, CENTRE + radius, CENTRE - half_height + 2 * radius), fill=255)
+ ImageDraw.Draw(bottom).ellipse((CENTRE - radius, CENTRE + half_height - 2 * radius, CENTRE + radius, CENTRE + half_height), fill=255)
+ shape = ImageChops.darker(top, bottom)
+ return ImageChops.lighter(mask, shape) if fill else ImageChops.subtract(mask, shape)
+
+
+def eye():
+ mask = lens(blank(), 168, 88, True)
+ mask = lens(mask, 138, 62, False)
+ disc(mask, 58, 255)
+ disc(mask, 24, 0)
+ return mask
+
+
+def finish(icon):
+ white = blank()
+ disc(white, RING_OUTER, 255)
+ disc(white, RING_INNER, 0)
+ white = ImageChops.lighter(white, icon)
+ alpha = white.filter(ImageFilter.MaxFilter(OUTLINE))
+ inside = blank()
+ disc(inside, RING_INNER, INSIDE_ALPHA)
+ alpha = ImageChops.lighter(alpha, inside)
+ mark = Image.merge("RGBA", (white, white, white, alpha))
+ return mark.resize((SHIPPED, SHIPPED), Image.LANCZOS)
+
+
+def main():
+ out_folder = sys.argv[1] if len(sys.argv) > 1 else OUT_FOLDER
+ for name, icon in (("Attack", swords()), ("Defend", shield()), ("Look", eye())):
+ path = os.path.join(out_folder, "ReforgedSignal%s.tga" % name)
+ finish(icon).save(path)
+ print(path)
+
+
+if __name__ == "__main__":
+ main()