diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 2ac7378a9..f3ef988f9 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -6,6 +6,7 @@ #include "all.h" #include "paths.h" #include "console.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" #include diff --git a/Source/diablo.h b/Source/diablo.h index 1f55baec6..6a5279ac5 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -24,135 +24,6 @@ extern "C" { #define DEFAULT_HEIGHT 480 #endif -typedef struct DiabloOptions { - /** @brief Play game intro video on startup. */ - bool bInto; -} DiabloOptions; - -typedef struct HellfireOptions { - /** @brief Play game intro video on startup. */ - bool bInto; - /** @brief Corner stone of the world item. */ - char szItem[sizeof(PkItemStruct) * 2 + 1]; -} HellfireOptions; - -typedef struct AudioOptions { - /** @brief Movie and SFX volume. */ - Sint32 nSoundVolume; - /** @brief Music volume. */ - Sint32 nMusicVolume; - /** @brief Player emits sound when walking. */ - bool bWalkingSound; - /** @brief Automatically equipping items on pickup emits the equipment sound. */ - bool bAutoEquipSound; -} AudioOptions; - -typedef struct GraphicsOptions { - /** @brief Render width. */ - Sint32 nWidth; - /** @brief Render height. */ - Sint32 nHeight; - /** @brief Run in fullscreen or windowed mode. */ - bool bFullscreen; - /** @brief Scale the image after rendering. */ - bool bUpscale; - /** @brief Expand the aspect ratio to match the screen. */ - bool bFitToScreen; - /** @brief See SDL_HINT_RENDER_SCALE_QUALITY. */ - char szScaleQuality[2]; - /** @brief Only scale by values divisible by the width and height. */ - bool bIntegerScaling; - /** @brief Enable vsync on the output. */ - bool bVSync; - /** @brief Use blended transparency rather than stippled. */ - bool bBlendedTransparancy; - /** @brief Gamma correction level. */ - Sint32 nGammaCorrection; - /** @brief Enable color cycling animations. */ - bool bColorCycling; - /** @brief Enable FPS Limit. */ - bool bFPSLimit; -} GraphicsOptions; - -typedef struct GameplayOptions { - /** @brief Game play ticks per secound. */ - Sint32 nTickRate; - /** @brief Enable double walk speed when in town. */ - bool bJogInTown; - /** @brief Do not let the mouse leave the application window. */ - bool bGrabInput; - /** @brief Enable the Theo quest. */ - bool bTheoQuest; - /** @brief Enable the cow quest. */ - bool bCowQuest; - /** @brief Will players still damage other players in non-PvP mode. */ - bool bFriendlyFire; - /** @brief Enable the bard hero class. */ - bool bTestBard; - /** @brief Enable the babarian hero class. */ - bool bTestBarbarian; - /** @brief Show the current level progress. */ - bool bExperienceBar; - /** @brief Show enemy health at the top of the screen. */ - bool bEnemyHealthBar; - /** @brief Automatically pick up goald when walking on to it. */ - bool bAutoGoldPickup; - /** @brief Recover mana when talking to Adria. */ - bool bAdriaRefillsMana; - /** @brief Automatically attempt to equip weapon-type items when picking them up. */ - bool bAutoEquipWeapons; - /** @brief Automatically attempt to equip armor-type items when picking them up. */ - bool bAutoEquipArmor; - /** @brief Automatically attempt to equip helm-type items when picking them up. */ - bool bAutoEquipHelms; - /** @brief Automatically attempt to equip shield-type items when picking them up. */ - bool bAutoEquipShields; - /** @brief Automatically attempt to equip jewelry-type items when picking them up. */ - bool bAutoEquipJewelry; - /** @brief Only enable 2/3 quests in each game sessoin */ - bool bRandomizeQuests; - /** @brief Indicates whether or not mosnter type (Animal, Demon, Undead) is shown along with other monster information. */ - bool bShowMonsterType; -} GameplayOptions; - -typedef struct ControllerOptions { - /** @brief SDL Controller mapping, see SDL_GameControllerDB. */ - char szMapping[1024]; - /** @brief Use dpad for spell hotkeys without holding "start" */ - bool bDpadHotkeys; - /** @brief Shoulder gamepad shoulder buttons act as potions by default */ - bool bSwapShoulderButtonMode; -#ifdef __vita__ - /** @brief Enable input via rear touchpad */ - bool bRearTouch; -#endif -} ControllerOptions; - -typedef struct NetworkOptions { - /** @brief Optionally bind to a specific network interface. */ - char szBindAddress[129]; - /** @brief Most recently entered Hostname in join dialog. */ - char szPreviousHost[129]; - /** @brief What network port to use. */ - Uint16 nPort; -} NetworkOptions; - -typedef struct ChatOptions { - /** @brief Quick chat messages. */ - char szHotKeyMsgs[4][MAX_SEND_STR_LEN]; -} ChatOptions; - -typedef struct Options { - DiabloOptions Diablo; - HellfireOptions Hellfire; - AudioOptions Audio; - GameplayOptions Gameplay; - GraphicsOptions Graphics; - ControllerOptions Controller; - NetworkOptions Network; - ChatOptions Chat; -} Options; - extern SDL_Window *ghMainWnd; extern DWORD glSeedTbl[NUMLEVELS]; extern dungeon_type gnLevelTypeTbl[NUMLEVELS]; @@ -178,7 +49,6 @@ extern bool gbBarbarian; extern char sgbMouseDown; extern int gnTickRate; extern WORD gnTickDelay; -extern Options sgOptions; void FreeGameMem(); BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer); diff --git a/Source/engine.cpp b/Source/engine.cpp index 9735ae143..e3a639465 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -11,6 +11,7 @@ * - Video playback */ #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index c4573e950..5dcf6e950 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -5,6 +5,7 @@ * Implementation of the in-game menu functions. */ #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/gendung.cpp b/Source/gendung.cpp index a96b386fb..37ea34095 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -4,6 +4,7 @@ * Implementation of general dungeon generation code. */ #include "all.h" +#include "options.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/inv.cpp b/Source/inv.cpp index 867e73b18..409a8fe17 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -4,6 +4,7 @@ * Implementation of player inventory. */ #include "all.h" +#include "options.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/items.cpp b/Source/items.cpp index 0bdc3ef38..e410c7d10 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -5,6 +5,7 @@ */ #include #include "all.h" +#include "options.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index 11292a0e6..0bf538be4 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -4,6 +4,7 @@ * Implementation of functions for interacting with the main menu. */ #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" diff --git a/Source/monster.cpp b/Source/monster.cpp index bb3196e0d..d91ad038d 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -6,6 +6,7 @@ #include #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/multi.cpp b/Source/multi.cpp index 90ef6f6a9..5790b2acd 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -4,6 +4,7 @@ * Implementation of functions for keeping multiplaye games in sync. */ #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" #include "../DiabloUI/diabloui.h" #include diff --git a/Source/options.h b/Source/options.h new file mode 100644 index 000000000..b53399c43 --- /dev/null +++ b/Source/options.h @@ -0,0 +1,136 @@ +#pragma once + +DEVILUTION_BEGIN_NAMESPACE + +typedef struct DiabloOptions { + /** @brief Play game intro video on startup. */ + bool bInto; +} DiabloOptions; + +typedef struct HellfireOptions { + /** @brief Play game intro video on startup. */ + bool bInto; + /** @brief Corner stone of the world item. */ + char szItem[sizeof(PkItemStruct) * 2 + 1]; +} HellfireOptions; + +typedef struct AudioOptions { + /** @brief Movie and SFX volume. */ + Sint32 nSoundVolume; + /** @brief Music volume. */ + Sint32 nMusicVolume; + /** @brief Player emits sound when walking. */ + bool bWalkingSound; + /** @brief Automatically equipping items on pickup emits the equipment sound. */ + bool bAutoEquipSound; +} AudioOptions; + +typedef struct GraphicsOptions { + /** @brief Render width. */ + Sint32 nWidth; + /** @brief Render height. */ + Sint32 nHeight; + /** @brief Run in fullscreen or windowed mode. */ + bool bFullscreen; + /** @brief Scale the image after rendering. */ + bool bUpscale; + /** @brief Expand the aspect ratio to match the screen. */ + bool bFitToScreen; + /** @brief See SDL_HINT_RENDER_SCALE_QUALITY. */ + char szScaleQuality[2]; + /** @brief Only scale by values divisible by the width and height. */ + bool bIntegerScaling; + /** @brief Enable vsync on the output. */ + bool bVSync; + /** @brief Use blended transparency rather than stippled. */ + bool bBlendedTransparancy; + /** @brief Gamma correction level. */ + Sint32 nGammaCorrection; + /** @brief Enable color cycling animations. */ + bool bColorCycling; + /** @brief Enable FPS Limit. */ + bool bFPSLimit; +} GraphicsOptions; + +typedef struct GameplayOptions { + /** @brief Game play ticks per secound. */ + Sint32 nTickRate; + /** @brief Enable double walk speed when in town. */ + bool bJogInTown; + /** @brief Do not let the mouse leave the application window. */ + bool bGrabInput; + /** @brief Enable the Theo quest. */ + bool bTheoQuest; + /** @brief Enable the cow quest. */ + bool bCowQuest; + /** @brief Will players still damage other players in non-PvP mode. */ + bool bFriendlyFire; + /** @brief Enable the bard hero class. */ + bool bTestBard; + /** @brief Enable the babarian hero class. */ + bool bTestBarbarian; + /** @brief Show the current level progress. */ + bool bExperienceBar; + /** @brief Show enemy health at the top of the screen. */ + bool bEnemyHealthBar; + /** @brief Automatically pick up goald when walking on to it. */ + bool bAutoGoldPickup; + /** @brief Recover mana when talking to Adria. */ + bool bAdriaRefillsMana; + /** @brief Automatically attempt to equip weapon-type items when picking them up. */ + bool bAutoEquipWeapons; + /** @brief Automatically attempt to equip armor-type items when picking them up. */ + bool bAutoEquipArmor; + /** @brief Automatically attempt to equip helm-type items when picking them up. */ + bool bAutoEquipHelms; + /** @brief Automatically attempt to equip shield-type items when picking them up. */ + bool bAutoEquipShields; + /** @brief Automatically attempt to equip jewelry-type items when picking them up. */ + bool bAutoEquipJewelry; + /** @brief Only enable 2/3 quests in each game sessoin */ + bool bRandomizeQuests; + /** @brief Indicates whether or not mosnter type (Animal, Demon, Undead) is shown along with other monster information. */ + bool bShowMonsterType; +} GameplayOptions; + +typedef struct ControllerOptions { + /** @brief SDL Controller mapping, see SDL_GameControllerDB. */ + char szMapping[1024]; + /** @brief Use dpad for spell hotkeys without holding "start" */ + bool bDpadHotkeys; + /** @brief Shoulder gamepad shoulder buttons act as potions by default */ + bool bSwapShoulderButtonMode; +#ifdef __vita__ + /** @brief Enable input via rear touchpad */ + bool bRearTouch; +#endif +} ControllerOptions; + +typedef struct NetworkOptions { + /** @brief Optionally bind to a specific network interface. */ + char szBindAddress[129]; + /** @brief Most recently entered Hostname in join dialog. */ + char szPreviousHost[129]; + /** @brief What network port to use. */ + Uint16 nPort; +} NetworkOptions; + +typedef struct ChatOptions { + /** @brief Quick chat messages. */ + char szHotKeyMsgs[4][MAX_SEND_STR_LEN]; +} ChatOptions; + +typedef struct Options { + DiabloOptions Diablo; + HellfireOptions Hellfire; + AudioOptions Audio; + GameplayOptions Gameplay; + GraphicsOptions Graphics; + ControllerOptions Controller; + NetworkOptions Network; + ChatOptions Chat; +} Options; + +extern Options sgOptions; + +DEVILUTION_END_NAMESPACE diff --git a/Source/palette.cpp b/Source/palette.cpp index 7242eee44..afc9bb01d 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -4,6 +4,7 @@ * Implementation of functions for handling the engines color palette. */ #include "all.h" +#include "options.h" #include "../SourceX/display.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/Source/player.cpp b/Source/player.cpp index c00b6202e..b10cfed75 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -6,6 +6,7 @@ #include #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/quests.cpp b/Source/quests.cpp index 5345b6062..f18b4f068 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -4,6 +4,7 @@ * Implementation of functionality for handling quests. */ #include "all.h" +#include "options.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/render.cpp b/Source/render.cpp index d2090435c..3e207dce1 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -4,6 +4,7 @@ * Implementation of functionality for rendering the level tiles. */ #include "all.h" +#include "options.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/Source/stores.cpp b/Source/stores.cpp index 3921d7abc..f81613c6c 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -4,6 +4,7 @@ * Implementation of functionality for stores and towner dialogs. */ #include "all.h" +#include "options.h" #include DEVILUTION_BEGIN_NAMESPACE diff --git a/SourceX/DiabloUI/selgame.cpp b/SourceX/DiabloUI/selgame.cpp index 44da9bf4b..ba9434a09 100644 --- a/SourceX/DiabloUI/selgame.cpp +++ b/SourceX/DiabloUI/selgame.cpp @@ -7,6 +7,7 @@ #include "DiabloUI/dialogs.h" #include "DiabloUI/selok.h" #include "DiabloUI/selhero.h" +#include "options.h" namespace dvl { diff --git a/SourceX/DiabloUI/selhero.cpp b/SourceX/DiabloUI/selhero.cpp index a2d9e6d2e..8b908af89 100644 --- a/SourceX/DiabloUI/selhero.cpp +++ b/SourceX/DiabloUI/selhero.cpp @@ -12,6 +12,7 @@ #include "DiabloUI/selyesno.h" #include "DiabloUI/selok.h" #include "DiabloUI/selgame.h" +#include "options.h" #ifdef __3DS__ #include "../platform/ctr/keyboard.h" diff --git a/SourceX/controls/controller_motion.cpp b/SourceX/controls/controller_motion.cpp index acbb94ffa..01d50dc18 100644 --- a/SourceX/controls/controller_motion.cpp +++ b/SourceX/controls/controller_motion.cpp @@ -7,6 +7,7 @@ #include "controls/devices/kbcontroller.h" #include "controls/controller.h" #include "controls/game_controls.h" +#include "options.h" namespace dvl { diff --git a/SourceX/controls/game_controls.cpp b/SourceX/controls/game_controls.cpp index 103b48ea9..9f7d08461 100644 --- a/SourceX/controls/game_controls.cpp +++ b/SourceX/controls/game_controls.cpp @@ -9,6 +9,7 @@ #include "controls/menu_controls.h" #include "controls/modifier_hints.h" #include "controls/plrctrls.h" +#include "options.h" namespace dvl { diff --git a/SourceX/controls/modifier_hints.cpp b/SourceX/controls/modifier_hints.cpp index 10bd33f09..a15fa63b9 100644 --- a/SourceX/controls/modifier_hints.cpp +++ b/SourceX/controls/modifier_hints.cpp @@ -5,6 +5,7 @@ #include "all.h" #include "controls/controller.h" #include "controls/game_controls.h" +#include "options.h" namespace dvl { diff --git a/SourceX/controls/touch.cpp b/SourceX/controls/touch.cpp index dccb477ef..43667f265 100644 --- a/SourceX/controls/touch.cpp +++ b/SourceX/controls/touch.cpp @@ -1,5 +1,6 @@ #ifndef USE_SDL1 #include "display.h" +#include "options.h" #include "touch.h" #include "../../defs.h" #include diff --git a/SourceX/display.cpp b/SourceX/display.cpp index 98081c9c8..3d39f78ba 100644 --- a/SourceX/display.cpp +++ b/SourceX/display.cpp @@ -5,6 +5,7 @@ #include "controls/devices/game_controller.h" #include "controls/devices/joystick.h" #include "controls/devices/kbcontroller.h" +#include "options.h" #ifdef __vita__ #include diff --git a/SourceX/dvlnet/tcp_client.cpp b/SourceX/dvlnet/tcp_client.cpp index 8fb0c5d07..a4e823e60 100644 --- a/SourceX/dvlnet/tcp_client.cpp +++ b/SourceX/dvlnet/tcp_client.cpp @@ -1,4 +1,5 @@ #include "dvlnet/tcp_client.h" +#include "options.h" #include #include diff --git a/SourceX/dvlnet/udp_p2p.cpp b/SourceX/dvlnet/udp_p2p.cpp index 6a7286e0a..4d7992a0b 100644 --- a/SourceX/dvlnet/udp_p2p.cpp +++ b/SourceX/dvlnet/udp_p2p.cpp @@ -1,4 +1,5 @@ #include "dvlnet/udp_p2p.h" +#include "options.h" #include diff --git a/SourceX/dx.cpp b/SourceX/dx.cpp index 94ceb39c4..dd64b310c 100644 --- a/SourceX/dx.cpp +++ b/SourceX/dx.cpp @@ -6,6 +6,7 @@ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" #include "display.h" +#include "options.h" #include #ifdef __3DS__ diff --git a/SourceX/qol.cpp b/SourceX/qol.cpp index 218c37aaa..5fca1baf7 100644 --- a/SourceX/qol.cpp +++ b/SourceX/qol.cpp @@ -4,6 +4,7 @@ * Quality of life features */ #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" DEVILUTION_BEGIN_NAMESPACE diff --git a/SourceX/sound.cpp b/SourceX/sound.cpp index 8184ca38a..4fabd98d6 100644 --- a/SourceX/sound.cpp +++ b/SourceX/sound.cpp @@ -4,6 +4,7 @@ * Implementation of functions setting up the audio pipeline. */ #include "all.h" +#include "options.h" #include "../3rdParty/Storm/Source/storm.h" #include "stubs.h" #include "storm_sdl_rw.h" diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index 59dda01a9..3dad95857 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -2,6 +2,7 @@ #include #include "all.h" +#include "options.h" #include "paths.h" #include "../3rdParty/Storm/Source/storm.h" diff --git a/SourceX/storm/storm_net.cpp b/SourceX/storm/storm_net.cpp index b6f896346..2c040a243 100644 --- a/SourceX/storm/storm_net.cpp +++ b/SourceX/storm/storm_net.cpp @@ -1,6 +1,7 @@ #include #include "all.h" +#include "options.h" #include "stubs.h" #include "dvlnet/abstract_net.h"