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(console): director camera and hidehud commands, Classic included
Olcay Seygan45f18bd46fa3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex effc8efd4..49799b364 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1082,6 +1082,7 @@ A third pass went through the generals' powers, promotions and unit abilities.- The whole map is drawn out to its edges from wherever the camera is. The usual view draws the ground and the shadows the camera can see from above; aimed at the horizon, the old limits cut the world off a short way out and left the far half of a map dark and shadowless. In the freecam the shadows cover the whole map, with a shadow map four times as wide so the far ones are as sharp as the near ones.- The match carries on underneath, and the fog of war stays as it is: the camera sees what you could already see. It changes nothing in the battle, so it works in replays and in multiplayer too.- `freecam 1200 900 600 45 -30` flies straight to a spot: the position, then the heading and the tilt in degrees. Leaving the freecam prints where it was in that same form, so a good angle can be found again.+- `director` in the console hands an observer's camera to the director on the Classic interface too, where there is no spectator page to pick it from, and `director` again takes it back. `hidehud` takes the whole interface off the screen in any match or replay and brings it back the next time you type it.## A scoreboard on Tabdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CinemaDirector.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CinemaDirector.hindex 30b4690c3..f428ff330 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/CinemaDirector.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/CinemaDirector.h@@ -75,6 +75,11 @@ void CinemaDirector_routePoint( const Real *xs, const Real *ys, Int count, Real/// once a render pass, after the logic tickvoid CinemaDirector_update( void );+/// the console's hidehud: the interface off or back on without a shot list+void CinemaDirector_setHudHidden( Bool hidden );+Bool CinemaDirector_isHudHidden( void );+void CinemaDirector_forgetHudHidden( void );+/// the interface is off, under -cinema or the console's freecam: nothing but the world is drawnBool CinemaDirector_hidesHud( void );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cppindex a5415b373..b68b394a5 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp@@ -589,13 +589,18 @@ static void cinemaSetHud( Bool hidden )/** The match puts the control bar up and the letterbox down on its own when loading finishes, which isafter the first frame this runs on, so what the shot list asked for is re-asserted every pass. */+static void cinemaHoldTheBar( void )+{+ GameWindow *bar = cinemaControlBarWindow();+ if (bar != NULL && !bar->winIsHidden())+ HideControlBar( TRUE );+}+static void cinemaHoldTheFrame( void ){if (theCinemaHudHidden){- GameWindow *bar = cinemaControlBarWindow();- if (bar != NULL && !bar->winIsHidden())- HideControlBar( TRUE );+ cinemaHoldTheBar();// the cursor comes back whenever the game decides it should, so it is put away every passTheMouse->setVisibility( FALSE );if (TheInGameUI->getSelectCount() > 0)@@ -773,8 +778,28 @@ static void cinemaChase( Real now )cinemaCentreOn( theCinemaStillX, theCinemaStillY, obj->getPosition()->z );}+void CinemaDirector_setHudHidden( Bool hidden )+{+ cinemaSetHud( hidden );+}++/// the match is over and the next one builds its own bar, so the flag goes without touching the bar+void CinemaDirector_forgetHudHidden( void )+{+ if (TheGlobalData->m_cinemaScript.isEmpty())+ theCinemaHudHidden = FALSE;+}++Bool CinemaDirector_isHudHidden( void )+{+ return theCinemaHudHidden;+}+void CinemaDirector_update( void ){+ // the console's hidehud: no shot list, but the match still puts the bar back on its own+ if (TheGlobalData->m_cinemaScript.isEmpty() && theCinemaHudHidden && TheGameLogic->isInGame())+ cinemaHoldTheBar();if (TheGlobalData->m_cinemaScript.isEmpty() || TheTacticalView == NULL || TheTerrainLogic == NULL)return;if (!TheGameLogic->isInGame() || TheGameLogic->isInShellGame())diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cppindex 81e6c6933..2729de0e4 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp@@ -38,6 +38,7 @@#include "GameLogic/GameLogic.h"#include "GameNetwork/GameSpy/ThreadUtils.h"+#include "GameClient/CinemaDirector.h"#include "GameClient/Color.h"#include "GameClient/ControlBar.h"#include "GameClient/ControlBarScheme.h"@@ -57,6 +58,7 @@#include "GameClient/KeyDefs.h"#include "GameClient/Keyboard.h"#include "GameClient/Mouse.h"+#include "GameClient/ObserverCamera.h"#include "GameClient/View.h"GameConsole *TheGameConsole = NULL;@@ -266,6 +268,39 @@ static AsciiString describeFreeCameraPose( void )return result;}+/** The observer's director camera, for the Classic interface that has no spectator page to pick it+ * from: 'director' hands the camera to it, again gives it back. */+static AsciiString runDirector( void )+{+ AsciiString result;+ const Player *local = ThePlayerList ? ThePlayerList->getLocalPlayer() : NULL;+ if( !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() || local == NULL || local->isPlayerActive() )+ {+ result = "director: for an observer or a replay only";+ return result;+ }++ const Bool on = TheObserverCamera.getMode() != OBSERVER_CAMERA_DIRECTOR;+ TheObserverCamera.setMode( on ? OBSERVER_CAMERA_DIRECTOR : OBSERVER_CAMERA_FREE );+ result = on ? "director camera on; scrolling takes the camera back, 'director' again hands it over" : "director camera off";+ return result;+}++static AsciiString runHideHud( void )+{+ AsciiString result;+ if( !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )+ {+ result = "hidehud: in a match or a replay only";+ return result;+ }++ const Bool hide = !CinemaDirector_isHudHidden();+ CinemaDirector_setHudHidden( hide );+ result = hide ? "hud hidden; 'hidehud' again brings it back" : "hud shown";+ return result;+}+static AsciiString runFreeCamera( AsciiString arguments ){AsciiString result;@@ -490,6 +525,8 @@ void GameConsole::runCommand( AsciiString commandLine )printLine( AsciiString( " W/S forward and back, A/D left and right, R up, F down, mouse turns," ) );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( "hidehud the interface off, again brings it back" ) );if( areCheatsAvailable() ){printLine( AsciiString( "cheats single-player cheats" ) );@@ -553,6 +590,18 @@ void GameConsole::runCommand( AsciiString commandLine )return;}+ if( command == "director" )+ {+ printLine( runDirector() );+ return;+ }++ if( command == "hidehud" )+ {+ printLine( runHideHud() );+ return;+ }+if( command == "get" ){if( arguments.isEmpty() )diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 1e3e71caa..510391257 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -4278,6 +4278,7 @@ void InGameUI::reset( void )m_signalsWereShown = FALSE;m_spectatorPageLoaded = FALSE;TheObserverCamera.reset();+ CinemaDirector_forgetHudHidden();m_spectatorFlipped.clear();m_spectatorPicked.clear();m_spectatorLists.clear();