From fa3312e2a99bd01601507f5c8772d8c6e20be4bb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 31 Jan 2019 00:28:43 +0100 Subject: [PATCH] - moved gamestate_t to g_game.h. This made reviewing the code for accessing the global state hard, because the doomdef.h contains mainly constants, this particular item was the only thing in there that represents actual engine state. --- src/am_map.cpp | 1 + src/b_bot.cpp | 2 +- src/c_cvars.cpp | 2 +- src/c_dispatch.cpp | 2 +- src/ct_chat.cpp | 2 +- src/doomdef.h | 27 ------------------------- src/events.cpp | 1 + src/g_game.h | 27 +++++++++++++++++++++++++ src/g_statusbar/shared_sbar.cpp | 1 + src/hu_scores.cpp | 1 + src/intermission/intermission.cpp | 2 +- src/intermission/intermission.h | 1 + src/intermission/intermission_parse.cpp | 2 +- src/p_effect.cpp | 1 + src/p_tick.cpp | 1 + src/p_user.cpp | 1 + src/r_utility.cpp | 1 + src/s_sound.cpp | 1 + src/win32/i_main.cpp | 2 +- src/win32/i_mouse.cpp | 2 +- 20 files changed, 45 insertions(+), 35 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 54e769883..4a5520a9e 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -46,6 +46,7 @@ #include "sbar.h" #include "d_player.h" #include "p_blockmap.h" +#include "g_game.h" #include "m_cheat.h" #include "c_dispatch.h" diff --git a/src/b_bot.cpp b/src/b_bot.cpp index 39067dfa9..54e8991c4 100644 --- a/src/b_bot.cpp +++ b/src/b_bot.cpp @@ -40,7 +40,7 @@ #include "c_cvars.h" #include "c_dispatch.h" #include "b_bot.h" -#include "doomstat.h" +#include "g_game.h" #include "p_local.h" #include "cmdlib.h" #include "teaminfo.h" diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 0345a7bd1..667e811a0 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -40,7 +40,7 @@ #include "c_console.h" #include "c_dispatch.h" -#include "doomstat.h" +#include "g_game.h" #include "d_player.h" #include "d_netinf.h" diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index feccd2d8b..127f5f2f6 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -45,7 +45,7 @@ #include "c_console.h" #include "c_dispatch.h" #include "m_argv.h" -#include "doomstat.h" +#include "g_game.h" #include "d_player.h" #include "configfile.h" #include "v_text.h" diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index ec3c4f4e2..5a8878eb2 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -27,7 +27,7 @@ #include "m_swap.h" #include "hu_stuff.h" #include "s_sound.h" -#include "doomstat.h" +#include "g_game.h" #include "st_stuff.h" #include "c_console.h" #include "c_dispatch.h" diff --git a/src/doomdef.h b/src/doomdef.h index b324fa90f..a8f0250d5 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -71,33 +71,6 @@ enum }; -// 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_FORCEWIPE = -1, - GS_FORCEWIPEFADE = -2, - GS_FORCEWIPEBURN = -3, - GS_FORCEWIPEMELT = -4 -}; - -extern gamestate_t gamestate; - -// wipegamestate can be set to -1 -// to force a wipe on the next draw -extern gamestate_t wipegamestate; - - typedef float skill_t; /* diff --git a/src/events.cpp b/src/events.cpp index e85706a85..74afb1b67 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -39,6 +39,7 @@ #include "actor.h" #include "c_dispatch.h" #include "d_net.h" +#include "g_game.h" #include "info.h" DStaticEventHandler* E_FirstEventHandler = nullptr; diff --git a/src/g_game.h b/src/g_game.h index 96ca6d8e2..a21c80cc6 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -32,6 +32,33 @@ struct event_t; #include "dobjgc.h" +// 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_FORCEWIPE = -1, + GS_FORCEWIPEFADE = -2, + GS_FORCEWIPEBURN = -3, + GS_FORCEWIPEMELT = -4 +}; + +extern gamestate_t gamestate; + +// wipegamestate can be set to -1 +// to force a wipe on the next draw +extern gamestate_t wipegamestate; + + class AActor; struct FLevelLocals; diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 6a17fda2f..2c012c81d 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -56,6 +56,7 @@ #include "p_acs.h" #include "sbarinfo.h" #include "events.h" +#include "g_game.h" #include "../version.h" diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index ceddaca23..290621884 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -49,6 +49,7 @@ #include "d_net.h" #include "c_dispatch.h" #include "g_levellocals.h" +#include "g_game.h" #include "sbar.h" // MACROS ------------------------------------------------------------------ diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 2c014c78b..2d395a48e 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -33,7 +33,7 @@ */ #include "doomtype.h" -#include "doomstat.h" +#include "g_game.h" #include "d_event.h" #include "w_wad.h" #include "gi.h" diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index f159ebb7a..435b38ed6 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -7,6 +7,7 @@ #include "textures/textures.h" #include "s_sound.h" #include "v_font.h" +#include "g_game.h" struct event_t; diff --git a/src/intermission/intermission_parse.cpp b/src/intermission/intermission_parse.cpp index c0fa4a337..50fd050a2 100644 --- a/src/intermission/intermission_parse.cpp +++ b/src/intermission/intermission_parse.cpp @@ -37,7 +37,7 @@ #include "intermission/intermission.h" #include "g_level.h" #include "w_wad.h" - + static void ReplaceIntermission(FName intname,FIntermissionDescriptor *desc) { diff --git a/src/p_effect.cpp b/src/p_effect.cpp index ce93fcdea..689191e5b 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -48,6 +48,7 @@ #include "g_levellocals.h" #include "vm.h" #include "actorinlines.h" +#include "g_game.h" CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE); CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE); diff --git a/src/p_tick.cpp b/src/p_tick.cpp index 6b7b42b1c..8d1b7481d 100644 --- a/src/p_tick.cpp +++ b/src/p_tick.cpp @@ -37,6 +37,7 @@ #include "g_levellocals.h" #include "events.h" #include "actorinlines.h" +#include "g_game.h" extern gamestate_t wipegamestate; extern uint8_t globalfreeze, globalchangefreeze; diff --git a/src/p_user.cpp b/src/p_user.cpp index d4e20a79f..4fb9a0f6d 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -89,6 +89,7 @@ #include "actorinlines.h" #include "p_acs.h" #include "events.h" +#include "g_game.h" static FRandom pr_skullpop ("SkullPop"); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index e44ca7c4c..ebe1e9ef4 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -62,6 +62,7 @@ #include "vm.h" #include "i_time.h" #include "actorinlines.h" +#include "g_game.h" // EXTERNAL DATA DECLARATIONS ---------------------------------------------- diff --git a/src/s_sound.cpp b/src/s_sound.cpp index fd609cabe..7bcff4d67 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -82,6 +82,7 @@ #include "d_player.h" #include "g_levellocals.h" #include "vm.h" +#include "g_game.h" // MACROS ------------------------------------------------------------------ diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 878ba29a1..40115490c 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -67,7 +67,7 @@ #include "i_input.h" #include "w_wad.h" #include "cmdlib.h" -#include "doomstat.h" +#include "g_game.h" #include "r_utility.h" #include "g_levellocals.h" #include "s_sound.h" diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index 00103d746..749940824 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -42,7 +42,7 @@ #include "i_input.h" #include "d_event.h" #include "d_gui.h" -#include "doomstat.h" +#include "g_game.h" #include "hardware.h" #include "rawinput.h" #include "menu/menu.h"