mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- route all accesses to gameaction from the backend through the sysCallbacks.
gameactions are frontend specific so this needs to be decoupled.
This commit is contained in:
parent
6ae09f8ec9
commit
d7a47b2f3a
10 changed files with 87 additions and 66 deletions
|
@ -592,8 +592,7 @@ void C_DrawConsole ()
|
|||
|
||||
oldbottom = ConBottom;
|
||||
|
||||
if (ConsoleState == c_up && gamestate != GS_INTRO && gamestate != GS_INTERMISSION &&
|
||||
gamestate != GS_FULLCONSOLE && gamestate != GS_MENUSCREEN)
|
||||
if (ConsoleState == c_up && gamestate == GS_LEVEL)
|
||||
{
|
||||
if (NotifyStrings) NotifyStrings->Draw();
|
||||
return;
|
||||
|
@ -731,7 +730,7 @@ void C_ToggleConsole ()
|
|||
}
|
||||
if (gamestate == GS_MENUSCREEN)
|
||||
{
|
||||
gameaction = ga_fullconsole;
|
||||
if (sysCallbacks.ToggleFullConsole) sysCallbacks.ToggleFullConsole();
|
||||
togglestate = c_down;
|
||||
}
|
||||
else if (!chatmodeon && (ConsoleState == c_up || ConsoleState == c_rising) && menuactive == MENU_Off)
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "s_music.h"
|
||||
#include "m_argv.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
CVAR(Bool, inter_subtitles, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
||||
|
@ -316,7 +317,7 @@ bool StartCutscene(CutsceneDef& cs, int flags, const CompletionFunc& completion_
|
|||
}
|
||||
if (flags & SJ_DELAY) intermissiondelay = 10; // need to wait a bit at the start to let the timer catch up.
|
||||
else intermissiondelay = 0;
|
||||
gameaction = (flags & SJ_BLOCKUI) ? ga_intro : ga_intermission;
|
||||
if (sysCallbacks.StartCutscene) sysCallbacks.StartCutscene(flags & SJ_BLOCKUI);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
29
source/common/engine/gamestate.h
Normal file
29
source/common/engine/gamestate.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
// The current state of the game: whether we are
|
||||
// playing, gazing at the intermission screen,
|
||||
// the game final animation, or a demo.
|
||||
enum gamestate_t : int
|
||||
{
|
||||
GS_LEVEL,
|
||||
GS_INTERMISSION,
|
||||
GS_FINALE,
|
||||
GS_DEMOSCREEN,
|
||||
GS_FULLCONSOLE, // [RH] Fullscreen console
|
||||
GS_HIDECONSOLE, // [RH] The menu just did something that should hide fs console
|
||||
GS_STARTUP, // [RH] Console is fullscreen, and game is just starting
|
||||
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_DEMOSCREEN
|
||||
GS_INTRO,
|
||||
GS_CUTSCENE,
|
||||
|
||||
GS_MENUSCREEN = GS_DEMOSCREEN,
|
||||
|
||||
GS_FORCEWIPE = -1,
|
||||
GS_FORCEWIPEFADE = -2,
|
||||
GS_FORCEWIPEBURN = -3,
|
||||
GS_FORCEWIPEMELT = -4
|
||||
};
|
||||
|
||||
|
||||
extern gamestate_t gamestate;
|
||||
extern int intermissiondelay;
|
|
@ -32,6 +32,8 @@ struct SystemCallbacks
|
|||
void (*ConsoleToggled)(int state);
|
||||
bool (*PreBindTexture)(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated);
|
||||
void (*ToggleFullConsole)();
|
||||
void (*StartCutscene)(bool blockui);
|
||||
};
|
||||
|
||||
extern SystemCallbacks sysCallbacks;
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
bool G_Responder (event_t *ev)
|
||||
{
|
||||
if (gamestate == GS_INTRO || gamestate == GS_INTERMISSION)
|
||||
if (gamestate == GS_INTRO || gamestate == GS_CUTSCENE)
|
||||
{
|
||||
return ScreenJobResponder(ev);
|
||||
}
|
||||
|
|
|
@ -511,6 +511,16 @@ void CheckFrontend(int flags)
|
|||
}
|
||||
}
|
||||
|
||||
static void System_ToggleFullConsole()
|
||||
{
|
||||
gameaction = ga_fullconsole;
|
||||
}
|
||||
|
||||
static void System_StartCutscene(bool blockui)
|
||||
{
|
||||
gameaction = blockui ? ga_intro : ga_intermission;
|
||||
}
|
||||
|
||||
void I_StartupJoysticks();
|
||||
void I_ShutdownInput();
|
||||
int RunGame();
|
||||
|
@ -545,7 +555,9 @@ int GameMain()
|
|||
nullptr,
|
||||
nullptr,
|
||||
PreBindTexture,
|
||||
FontCharCreated
|
||||
FontCharCreated,
|
||||
System_ToggleFullConsole,
|
||||
System_StartCutscene,
|
||||
};
|
||||
|
||||
try
|
||||
|
|
|
@ -220,3 +220,30 @@ extern int lastTic;
|
|||
|
||||
extern int PlayClock;
|
||||
|
||||
enum gameaction_t : int
|
||||
{
|
||||
ga_nothing,
|
||||
ga_level, // Switch to play mode without any initialization
|
||||
ga_intro,
|
||||
ga_intermission,
|
||||
|
||||
ga_startup, // go back to intro after uninitializing the game state
|
||||
ga_mainmenu, // go back to main menu after uninitializing the game state
|
||||
ga_mainmenunostopsound, // Same but doesn't stop playing sounds.
|
||||
ga_creditsmenu, // go to the credits menu after uninitializing the game state
|
||||
ga_newgame, // start a new game
|
||||
ga_recordgame, // start a new demo recording (later)
|
||||
ga_loadgame, // load a savegame and resume play.
|
||||
ga_loadgameplaydemo, // load a savegame and play a demo.
|
||||
ga_autoloadgame, // load last autosave and resume play.
|
||||
ga_savegame, // save the game
|
||||
ga_autosave, // autosave the game (for triggering a save from within the game.)
|
||||
ga_completed, // Level was exited.
|
||||
ga_nextlevel, // Actually start the next level.
|
||||
ga_loadgamehidecon,
|
||||
ga_newgamenostopsound, // start a new game
|
||||
ga_endscreenjob,
|
||||
|
||||
ga_fullconsole,
|
||||
};
|
||||
extern gameaction_t gameaction;
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// The current state of the game: whether we are
|
||||
// playing, gazing at the intermission screen,
|
||||
// the game final animation, or a demo.
|
||||
enum gamestate_t : int
|
||||
{
|
||||
GS_LEVEL,
|
||||
GS_INTRO,
|
||||
GS_INTERMISSION,
|
||||
GS_FINALE,
|
||||
GS_MENUSCREEN,
|
||||
GS_FULLCONSOLE, // [RH] Fullscreen console
|
||||
GS_HIDECONSOLE, // [RH] The menu just did something that should hide fs console
|
||||
GS_STARTUP, // [RH] Console is fullscreen, and game is just starting
|
||||
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_MENUSCREEN
|
||||
|
||||
GS_FORCEWIPE = -1,
|
||||
GS_FORCEWIPEFADE = -2,
|
||||
GS_FORCEWIPEBURN = -3,
|
||||
GS_FORCEWIPEMELT = -4
|
||||
};
|
||||
|
||||
enum gameaction_t : int
|
||||
{
|
||||
ga_nothing,
|
||||
ga_level, // Switch to play mode without any initialization
|
||||
ga_intro,
|
||||
ga_intermission,
|
||||
|
||||
ga_startup, // go back to intro after uninitializing the game state
|
||||
ga_mainmenu, // go back to main menu after uninitializing the game state
|
||||
ga_mainmenunostopsound, // Same but doesn't stop playing sounds.
|
||||
ga_creditsmenu, // go to the credits menu after uninitializing the game state
|
||||
ga_newgame, // start a new game
|
||||
ga_recordgame, // start a new demo recording (later)
|
||||
ga_loadgame, // load a savegame and resume play.
|
||||
ga_loadgameplaydemo, // load a savegame and play a demo.
|
||||
ga_autoloadgame, // load last autosave and resume play.
|
||||
ga_savegame, // save the game
|
||||
ga_autosave, // autosave the game (for triggering a save from within the game.)
|
||||
ga_completed, // Level was exited.
|
||||
ga_nextlevel, // Actually start the next level.
|
||||
ga_loadgamehidecon,
|
||||
ga_newgamenostopsound, // start a new game
|
||||
ga_endscreenjob,
|
||||
|
||||
ga_fullconsole,
|
||||
};
|
||||
extern gamestate_t gamestate;
|
||||
extern gameaction_t gameaction;
|
||||
extern int intermissiondelay;
|
|
@ -280,7 +280,7 @@ static void GameTicker()
|
|||
break;
|
||||
|
||||
case ga_intermission:
|
||||
gamestate = GS_INTERMISSION;
|
||||
gamestate = GS_CUTSCENE;
|
||||
break;
|
||||
|
||||
case ga_fullconsole:
|
||||
|
@ -370,7 +370,7 @@ static void GameTicker()
|
|||
case GS_MENUSCREEN:
|
||||
case GS_FULLCONSOLE:
|
||||
break;
|
||||
case GS_INTERMISSION:
|
||||
case GS_CUTSCENE:
|
||||
case GS_INTRO:
|
||||
if (intermissiondelay > 0)
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ void Display()
|
|||
break;
|
||||
|
||||
case GS_INTRO:
|
||||
case GS_INTERMISSION:
|
||||
case GS_CUTSCENE:
|
||||
// screen jobs are not bound by the game ticker so they need to be ticked in the display loop.
|
||||
if (intermissiondelay <= 0) ScreenJobDraw();
|
||||
break;
|
||||
|
@ -515,7 +515,7 @@ void TryRunTics (void)
|
|||
|
||||
// If paused, do not eat more CPU time than we need, because it
|
||||
// will all be wasted anyway.
|
||||
bool doWait = (cl_capfps || pauseext || (r_NoInterpolate && !M_IsAnimated() && gamestate != GS_INTERMISSION && gamestate != GS_INTRO));
|
||||
bool doWait = (cl_capfps || pauseext || (r_NoInterpolate && !M_IsAnimated() && gamestate != GS_CUTSCENE && gamestate != GS_INTRO));
|
||||
|
||||
// get real tics
|
||||
if (doWait)
|
||||
|
|
|
@ -76,11 +76,14 @@ enum EGameState
|
|||
GS_INTERMISSION,
|
||||
GS_FINALE,
|
||||
GS_DEMOSCREEN,
|
||||
GS_FULLCONSOLE, // [RH] Fullscreen console
|
||||
GS_HIDECONSOLE, // [RH] The menu just did something that should hide fs console
|
||||
GS_STARTUP, // [RH] Console is fullscreen, and game is just starting
|
||||
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_DEMOSCREEN
|
||||
GS_INTRO,
|
||||
GS_CUTSCENE,
|
||||
|
||||
GS_MENUSCREEN = GS_DEMOSCREEN,
|
||||
GS_FULLCONSOLE,
|
||||
GS_HIDECONSOLE,
|
||||
GS_STARTUP,
|
||||
GS_TITLELEVEL,
|
||||
}
|
||||
|
||||
const TEXTCOLOR_BRICK = "\034A";
|
||||
|
|
Loading…
Reference in a new issue