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(gameclient): pause and resume console commands, avenger scenario

Olcay Seyganf289c60cff3e
diff --git a/GeneralsMD/Code/Data/Scenarios/avengerlasers.txt b/GeneralsMD/Code/Data/Scenarios/avengerlasers.txt
new file mode 100644
index 000000000..54c8bfc11
--- /dev/null
+++ b/GeneralsMD/Code/Data/Scenarios/avengerlasers.txt
@@ -0,0 +1,26 @@
+# The Avenger's three lasers, one station each, 500 apart on Twilight Flame so no beam crosses into
+# another's frame. Seat 0 America, seat 1 GLA, -takeover so only these fire.
+#
+# A 3150,3600: the target designator (AvengerTargetingLaserBeam) painting an unarmed Radar Van.
+# Ordered at 40, before the other two Avengers exist, so the order cannot land on them.
+# B 2900,3800: the anti-air laser (AvengerLaserBeam) on Helixes hovering over it, one every 4 s.
+# C 3400,3800: the point defense lasers (AvengerPointDefenseLaserBeam) on Rocket Buggy rockets.
+# The buggies stand 260 away and pick the Avenger up on their own (range 300), outside the
+# designator's 200.
+
+30 spawn 0 AmericaTankAvenger 1 3150 3600
+30 spawn 1 GLAVehicleRadarVan 1 3040 3560
+40 attack 0 AmericaTankAvenger 1 GLAVehicleRadarVan
+
+50 spawn 0 AmericaTankAvenger 1 2900 3800
+50 spawn 1 ChinaVehicleHelix 1 2900 4150
+60 move 1 ChinaVehicleHelix 2950 3880
+170 spawn 1 ChinaVehicleHelix 1 2900 4150
+180 move 1 ChinaVehicleHelix 2950 3880
+290 spawn 1 ChinaVehicleHelix 1 2900 4150
+300 move 1 ChinaVehicleHelix 2950 3880
+410 spawn 1 ChinaVehicleHelix 1 2900 4150
+420 move 1 ChinaVehicleHelix 2950 3880
+
+50 spawn 0 AmericaTankAvenger 1 3400 3800
+50 spawn 1 GLAVehicleRocketBuggy 1 3400 4060
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp
index 98ec107b1..df65bf63e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp
@@ -48,6 +48,8 @@
#include "GameClient/GameFont.h"
#include "GameClient/Gadget.h"
#include "GameClient/GadgetListBox.h"
+#include "GameClient/GUICallbacks.h"
+#include "GameClient/InGameUI.h"
#include "GameClient/GameWindowManager.h"
#include "GameClient/WindowLayout.h"
#include "Common/GlobalData.h"
@@ -327,6 +329,29 @@ static AsciiString runHideHud( AsciiString arguments )
return result;
}
+/** 'pause' opens the Esc menu, which stops the game, and 'resume' closes it again. Not in a LAN or
+ * internet game, where the Esc menu stops nothing. */
+static AsciiString runPause( Bool pause )
+{
+ AsciiString result;
+ const char *name = pause ? "pause" : "resume";
+ if( !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() || TheGameLogic->isInMultiplayerGame() )
+ {
+ result.format( "%s: in a single player match or a replay only", name );
+ return result;
+ }
+
+ if( TheInGameUI->isQuitMenuVisible() == pause )
+ {
+ result.format( "%s: already %s", name, pause ? "paused" : "running" );
+ return result;
+ }
+
+ ToggleQuitMenu();
+ result = pause ? "paused; 'resume' closes the menu" : "resumed";
+ return result;
+}
+
static AsciiString runFreeCamera( AsciiString arguments )
{
AsciiString result;
@@ -552,6 +577,7 @@ void GameConsole::runCommand( AsciiString commandLine )
printLine( AsciiString( " Shift faster; Esc or 'freecam' again lands. 'freecam x y z heading tilt'" ) );
printLine( AsciiString( " flies to a pose, angles in degrees" ) );
printLine( AsciiString( "director observer: the director camera on, again gives the camera back" ) );
+ printLine( AsciiString( "pause, resume open and close the Esc menu, single player only" ) );
printLine( AsciiString( "hidehud the interface off, again brings it back; showmap=true keeps the radar" ) );
if( areCheatsAvailable() )
{
@@ -616,6 +642,15 @@ void GameConsole::runCommand( AsciiString commandLine )
return;
}
+ if( command == "pause" || command == "resume" )
+ {
+ printLine( runPause( command == "pause" ) );
+ // out of the way of the menu it opens
+ if( TheInGameUI->isQuitMenuVisible() )
+ close();
+ return;
+ }
+
if( command == "director" )
{
printLine( runDirector() );