- 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:
Christoph Oelckers 2021-05-22 12:58:07 +02:00
parent e5baef837a
commit 9898ee542c
6 changed files with 39 additions and 29 deletions

View file

@ -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 (...)
{

View file

@ -14,6 +14,8 @@ enum gamestate_t : int
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,
@ -22,31 +24,6 @@ enum gamestate_t : int
GS_FORCEWIPEMELT = -4
};
extern gamestate_t gamestate;
enum gameaction_t : int
{
ga_nothing,
ga_loadlevel, // not used.
ga_newgame,
ga_newgame2,
ga_recordgame,
ga_loadgame,
ga_loadgamehidecon,
ga_loadgameplaydemo,
ga_autoloadgame,
ga_savegame,
ga_autosave,
ga_playdemo,
ga_completed,
ga_slideshow,
ga_worlddone,
ga_screenshot,
ga_togglemap,
ga_fullconsole,
ga_resumeconversation,
ga_intro,
ga_intermission,
};
extern gameaction_t gameaction;
extern int intermissiondelay;

View file

@ -34,6 +34,7 @@ struct SystemCallbacks
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated);
void (*ToggleFullConsole)();
void (*StartCutscene)(bool blockui);
};
extern SystemCallbacks sysCallbacks;

View file

@ -75,6 +75,30 @@ typedef enum
// Called by IO functions when input is detected.
void D_Render(std::function<void()> action, bool interpolate);
enum gameaction_t : int
{
ga_nothing,
ga_loadlevel, // not used.
ga_newgame,
ga_newgame2,
ga_recordgame,
ga_loadgame,
ga_loadgamehidecon,
ga_loadgameplaydemo,
ga_autoloadgame,
ga_savegame,
ga_autosave,
ga_playdemo,
ga_completed,
ga_slideshow,
ga_worlddone,
ga_screenshot,
ga_togglemap,
ga_fullconsole,
ga_resumeconversation,
ga_intro,
ga_intermission,
};
extern gameaction_t gameaction;

View file

@ -2997,6 +2997,12 @@ static void System_ToggleFullConsole()
gameaction = ga_fullconsole;
}
static void System_StartCutscene(bool blockui)
{
gameaction = blockui ? ga_intro : ga_intermission;
}
bool CheckSkipGameOptionBlock(const char* str);
//==========================================================================
@ -3048,7 +3054,7 @@ static int D_DoomMain_Internal (void)
nullptr,
nullptr,
System_ToggleFullConsole,
nullptr,
System_StartCutscene,
};

View file

@ -77,6 +77,7 @@
#include "v_palette.h"
#include "s_music.h"
#include "p_setup.h"
#include "d_event.h"
#include "v_video.h"
#include "g_hub.h"