diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 32221f4a1..d4b7dc44f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -13,6 +13,7 @@ set(libdevilutionx_SRCS diablo.cpp diablo_msg.cpp doom.cpp + game_mode.cpp gamemenu.cpp gmenu.cpp help.cpp diff --git a/Source/DiabloUI/hero/selhero.cpp b/Source/DiabloUI/hero/selhero.cpp index e6fb8c8b3..109e7d631 100644 --- a/Source/DiabloUI/hero/selhero.cpp +++ b/Source/DiabloUI/hero/selhero.cpp @@ -15,6 +15,7 @@ #include "DiabloUI/selyesno.h" #include "control.h" #include "controls/plrctrls.h" +#include "game_mode.hpp" #include "menu.h" #include "options.h" #include "pfile.h" diff --git a/Source/DiabloUI/mainmenu.cpp b/Source/DiabloUI/mainmenu.cpp index f25920386..d36ff3b2e 100644 --- a/Source/DiabloUI/mainmenu.cpp +++ b/Source/DiabloUI/mainmenu.cpp @@ -4,6 +4,7 @@ #include "DiabloUI/selok.h" #include "control.h" #include "engine/load_clx.hpp" +#include "game_mode.hpp" #include "utils/language.h" namespace devilution { diff --git a/Source/DiabloUI/selok.cpp b/Source/DiabloUI/selok.cpp index 81f63989a..b0d0244c6 100644 --- a/Source/DiabloUI/selok.cpp +++ b/Source/DiabloUI/selok.cpp @@ -3,6 +3,7 @@ #include "DiabloUI/diabloui.h" #include "control.h" #include "engine/render/text_render.hpp" +#include "game_mode.hpp" #include "utils/language.h" #include "utils/utf8.hpp" diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 0d55ce466..762eb605e 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -38,6 +38,7 @@ #include "engine/random.hpp" #include "engine/render/clx_render.hpp" #include "engine/sound.h" +#include "game_mode.hpp" #include "gamemenu.h" #include "gmenu.h" #include "help.h" diff --git a/Source/engine/assets.cpp b/Source/engine/assets.cpp index bbb2c4f69..f5caa393e 100644 --- a/Source/engine/assets.cpp +++ b/Source/engine/assets.cpp @@ -5,7 +5,7 @@ #include #include -#include "init.h" +#include "game_mode.hpp" #include "utils/file_util.h" #include "utils/log.hpp" #include "utils/paths.h" diff --git a/Source/engine/assets.hpp b/Source/engine/assets.hpp index 203d296aa..13ea7976e 100644 --- a/Source/engine/assets.hpp +++ b/Source/engine/assets.hpp @@ -14,6 +14,7 @@ #include "appfat.h" #include "diablo.h" +#include "game_mode.hpp" #include "utils/file_util.h" #include "utils/language.h" #include "utils/str_cat.hpp" diff --git a/Source/game_mode.cpp b/Source/game_mode.cpp new file mode 100644 index 000000000..6a881b723 --- /dev/null +++ b/Source/game_mode.cpp @@ -0,0 +1,8 @@ +#include "game_mode.hpp" + +namespace devilution { +bool gbIsSpawn; +bool gbIsHellfire; +bool gbVanilla; +bool forceHellfire; +} // namespace devilution diff --git a/Source/game_mode.hpp b/Source/game_mode.hpp new file mode 100644 index 000000000..60ac5e8f0 --- /dev/null +++ b/Source/game_mode.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "utils/attributes.h" + +namespace devilution { + +/** Indicate if we only have access to demo data */ +extern DVL_API_FOR_TEST bool gbIsSpawn; +/** Indicate if we have loaded the Hellfire expansion data */ +extern DVL_API_FOR_TEST bool gbIsHellfire; +/** Indicate if we want vanilla savefiles */ +extern DVL_API_FOR_TEST bool gbVanilla; +/** Whether the Hellfire mode is required (forced). */ +extern bool forceHellfire; + +} // namespace devilution diff --git a/Source/init.cpp b/Source/init.cpp index fc429e100..290837aae 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -21,6 +21,7 @@ #include "engine/backbuffer_state.hpp" #include "engine/dx.h" #include "engine/events.hpp" +#include "game_mode.hpp" #include "hwcursor.hpp" #include "options.h" #include "pfile.h" @@ -46,14 +47,6 @@ namespace devilution { /** True if the game is the current active window */ bool gbActive; -/** Indicate if we only have access to demo data */ -bool gbIsSpawn; -/** Indicate if we have loaded the Hellfire expansion data */ -bool gbIsHellfire; -/** Indicate if we want vanilla savefiles */ -bool gbVanilla; -/** Whether the Hellfire mode is required (forced). */ -bool forceHellfire; namespace { diff --git a/Source/init.h b/Source/init.h index 30d7ac545..8429fd5a1 100644 --- a/Source/init.h +++ b/Source/init.h @@ -20,10 +20,6 @@ namespace devilution { /** True if the game is the current active window */ extern bool gbActive; -extern DVL_API_FOR_TEST bool gbIsSpawn; -extern DVL_API_FOR_TEST bool gbIsHellfire; -extern DVL_API_FOR_TEST bool gbVanilla; -extern bool forceHellfire; inline bool HaveSpawn() { diff --git a/Source/levels/trigs.cpp b/Source/levels/trigs.cpp index 3b1374dc3..c52549463 100644 --- a/Source/levels/trigs.cpp +++ b/Source/levels/trigs.cpp @@ -14,6 +14,7 @@ #include "controls/plrctrls.h" #include "cursor.h" #include "diablo_msg.hpp" +#include "game_mode.hpp" #include "init.h" #include "utils/algorithm/container.hpp" #include "utils/is_of.hpp" diff --git a/Source/lighting.cpp b/Source/lighting.cpp index e09b1e3d9..bcc06cff0 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -13,7 +13,6 @@ #include #include "automap.h" -#include "diablo.h" #include "engine/load_file.hpp" #include "engine/points_in_rectangle_range.hpp" #include "player.h" diff --git a/Source/menu.cpp b/Source/menu.cpp index 7979e860c..0b7a58a26 100644 --- a/Source/menu.cpp +++ b/Source/menu.cpp @@ -9,6 +9,7 @@ #include "DiabloUI/diabloui.h" #include "DiabloUI/settingsmenu.h" #include "engine/demomode.h" +#include "game_mode.hpp" #include "init.h" #include "movie.h" #include "options.h" diff --git a/Source/monster.cpp b/Source/monster.cpp index 892f8fa21..182e9520a 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -30,6 +30,7 @@ #include "engine/render/clx_render.hpp" #include "engine/sound_position.hpp" #include "engine/world_tile.hpp" +#include "game_mode.hpp" #include "init.h" #include "levels/crypt.h" #include "levels/drlg_l4.h" diff --git a/Source/monster.h b/Source/monster.h index 17df89efc..006e8736b 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -21,6 +21,7 @@ #include "engine/point.hpp" #include "engine/sound.h" #include "engine/world_tile.hpp" +#include "game_mode.hpp" #include "init.h" #include "levels/dun_tile.hpp" #include "misdat.h" diff --git a/Source/options.cpp b/Source/options.cpp index 752e53f68..8311457fd 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -21,6 +21,7 @@ #include "discord/discord.h" #include "engine/demomode.h" #include "engine/sound_defs.hpp" +#include "game_mode.hpp" #include "hwcursor.hpp" #include "options.h" #include "platform/locale.hpp" diff --git a/Source/pack.cpp b/Source/pack.cpp index 29fbf6ade..c8b029bc1 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -8,6 +8,7 @@ #include #include "engine/random.hpp" +#include "game_mode.hpp" #include "init.h" #include "items/validation.h" #include "loadsave.h" diff --git a/Source/panels/spell_icons.cpp b/Source/panels/spell_icons.cpp index dbfe26b0c..9d0230abb 100644 --- a/Source/panels/spell_icons.cpp +++ b/Source/panels/spell_icons.cpp @@ -8,6 +8,7 @@ #include "engine/palette.h" #include "engine/render/clx_render.hpp" #include "engine/render/primitive_render.hpp" +#include "game_mode.hpp" #include "init.h" namespace devilution { diff --git a/Source/pfile.cpp b/Source/pfile.cpp index aa9381d65..3e660b956 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -16,6 +16,7 @@ #include "codec.h" #include "engine/load_file.hpp" #include "engine/render/primitive_render.hpp" +#include "game_mode.hpp" #include "init.h" #include "loadsave.h" #include "menu.h" diff --git a/Source/player.cpp b/Source/player.cpp index 4e771bc59..4cdc01c2a 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -24,6 +24,7 @@ #include "engine/render/clx_render.hpp" #include "engine/trn.hpp" #include "engine/world_tile.hpp" +#include "game_mode.hpp" #include "gamemenu.h" #include "help.h" #include "init.h" diff --git a/Source/player.h b/Source/player.h index fd112c7b3..8f9e838f0 100644 --- a/Source/player.h +++ b/Source/player.h @@ -18,6 +18,7 @@ #include "engine/displacement.hpp" #include "engine/path.h" #include "engine/point.hpp" +#include "game_mode.hpp" #include "interfac.h" #include "items.h" #include "items/validation.h" diff --git a/Source/quests.cpp b/Source/quests.cpp index ecf573f32..f7e69a3b4 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -17,6 +17,7 @@ #include "engine/render/clx_render.hpp" #include "engine/render/text_render.hpp" #include "engine/world_tile.hpp" +#include "game_mode.hpp" #include "init.h" #include "levels/gendung.h" #include "levels/town.h" diff --git a/Source/spells.cpp b/Source/spells.cpp index be5b9ae38..7f4435578 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -14,6 +14,7 @@ #include "engine/point.hpp" #include "engine/random.hpp" #include "engine/world_tile.hpp" +#include "game_mode.hpp" #include "gamemenu.h" #include "inv.h" #include "missiles.h" diff --git a/Source/stores.h b/Source/stores.h index 81c4d75ea..af6e8e1df 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -12,6 +12,7 @@ #include "control.h" #include "engine/clx_sprite.hpp" #include "engine/surface.hpp" +#include "game_mode.hpp" #include "utils/attributes.h" namespace devilution { diff --git a/Source/towners.cpp b/Source/towners.cpp index 0894c5be5..d07d45cfb 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -7,6 +7,7 @@ #include "engine/load_cel.hpp" #include "engine/load_file.hpp" #include "engine/random.hpp" +#include "game_mode.hpp" #include "inv.h" #include "minitext.h" #include "stores.h" diff --git a/test/items_test.cpp b/test/items_test.cpp index 0a3caa2bc..2225b83dd 100644 --- a/test/items_test.cpp +++ b/test/items_test.cpp @@ -4,6 +4,7 @@ #include #include "engine/random.hpp" +#include "game_mode.hpp" #include "items.h" #include "player.h" #include "spells.h" diff --git a/test/pack_test.cpp b/test/pack_test.cpp index 9a436ea09..862427c5e 100644 --- a/test/pack_test.cpp +++ b/test/pack_test.cpp @@ -3,6 +3,7 @@ #include #include "cursor.h" +#include "game_mode.hpp" #include "monstdat.h" #include "pack.h" #include "playerdat.hpp" diff --git a/test/timedemo_test.cpp b/test/timedemo_test.cpp index ac04292e4..9d370e3f5 100644 --- a/test/timedemo_test.cpp +++ b/test/timedemo_test.cpp @@ -4,6 +4,7 @@ #include "diablo.h" #include "engine/demomode.h" +#include "game_mode.hpp" #include "lua/lua.hpp" #include "monstdat.h" #include "options.h" diff --git a/test/writehero_test.cpp b/test/writehero_test.cpp index 09f147c44..fb3922ec6 100644 --- a/test/writehero_test.cpp +++ b/test/writehero_test.cpp @@ -9,6 +9,7 @@ #include #include "cursor.h" +#include "game_mode.hpp" #include "init.h" #include "loadsave.h" #include "pack.h"