Browse Source

♻️ Move options-related structs to new 'options.h' file

pull/1284/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
800dbce066
  1. 1
      Source/diablo.cpp
  2. 130
      Source/diablo.h
  3. 1
      Source/engine.cpp
  4. 1
      Source/gamemenu.cpp
  5. 1
      Source/gendung.cpp
  6. 1
      Source/inv.cpp
  7. 1
      Source/items.cpp
  8. 1
      Source/mainmenu.cpp
  9. 1
      Source/monster.cpp
  10. 1
      Source/multi.cpp
  11. 136
      Source/options.h
  12. 1
      Source/palette.cpp
  13. 1
      Source/player.cpp
  14. 1
      Source/quests.cpp
  15. 1
      Source/render.cpp
  16. 1
      Source/stores.cpp
  17. 1
      SourceX/DiabloUI/selgame.cpp
  18. 1
      SourceX/DiabloUI/selhero.cpp
  19. 1
      SourceX/controls/controller_motion.cpp
  20. 1
      SourceX/controls/game_controls.cpp
  21. 1
      SourceX/controls/modifier_hints.cpp
  22. 1
      SourceX/controls/touch.cpp
  23. 1
      SourceX/display.cpp
  24. 1
      SourceX/dvlnet/tcp_client.cpp
  25. 1
      SourceX/dvlnet/udp_p2p.cpp
  26. 1
      SourceX/dx.cpp
  27. 1
      SourceX/qol.cpp
  28. 1
      SourceX/sound.cpp
  29. 1
      SourceX/storm/storm.cpp
  30. 1
      SourceX/storm/storm_net.cpp

1
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 <config.h>

130
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);

1
Source/engine.cpp

@ -11,6 +11,7 @@
* - Video playback
*/
#include "all.h"
#include "options.h"
#include "../3rdParty/Storm/Source/storm.h"
DEVILUTION_BEGIN_NAMESPACE

1
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

1
Source/gendung.cpp

@ -4,6 +4,7 @@
* Implementation of general dungeon generation code.
*/
#include "all.h"
#include "options.h"
DEVILUTION_BEGIN_NAMESPACE

1
Source/inv.cpp

@ -4,6 +4,7 @@
* Implementation of player inventory.
*/
#include "all.h"
#include "options.h"
DEVILUTION_BEGIN_NAMESPACE

1
Source/items.cpp

@ -5,6 +5,7 @@
*/
#include <algorithm>
#include "all.h"
#include "options.h"
DEVILUTION_BEGIN_NAMESPACE

1
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"

1
Source/monster.cpp

@ -6,6 +6,7 @@
#include <algorithm>
#include "all.h"
#include "options.h"
#include "../3rdParty/Storm/Source/storm.h"
DEVILUTION_BEGIN_NAMESPACE

1
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 <config.h>

136
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

1
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"

1
Source/player.cpp

@ -6,6 +6,7 @@
#include <algorithm>
#include "all.h"
#include "options.h"
#include "../3rdParty/Storm/Source/storm.h"
DEVILUTION_BEGIN_NAMESPACE

1
Source/quests.cpp

@ -4,6 +4,7 @@
* Implementation of functionality for handling quests.
*/
#include "all.h"
#include "options.h"
DEVILUTION_BEGIN_NAMESPACE

1
Source/render.cpp

@ -4,6 +4,7 @@
* Implementation of functionality for rendering the level tiles.
*/
#include "all.h"
#include "options.h"
DEVILUTION_BEGIN_NAMESPACE

1
Source/stores.cpp

@ -4,6 +4,7 @@
* Implementation of functionality for stores and towner dialogs.
*/
#include "all.h"
#include "options.h"
#include <algorithm>
DEVILUTION_BEGIN_NAMESPACE

1
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 {

1
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"

1
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 {

1
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 {

1
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 {

1
SourceX/controls/touch.cpp

@ -1,5 +1,6 @@
#ifndef USE_SDL1
#include "display.h"
#include "options.h"
#include "touch.h"
#include "../../defs.h"
#include <math.h>

1
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 <psp2/power.h>

1
SourceX/dvlnet/tcp_client.cpp

@ -1,4 +1,5 @@
#include "dvlnet/tcp_client.h"
#include "options.h"
#include <functional>
#include <exception>

1
SourceX/dvlnet/udp_p2p.cpp

@ -1,4 +1,5 @@
#include "dvlnet/udp_p2p.h"
#include "options.h"
#include <SDL.h>

1
SourceX/dx.cpp

@ -6,6 +6,7 @@
#include "all.h"
#include "../3rdParty/Storm/Source/storm.h"
#include "display.h"
#include "options.h"
#include <SDL.h>
#ifdef __3DS__

1
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

1
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"

1
SourceX/storm/storm.cpp

@ -2,6 +2,7 @@
#include <string>
#include "all.h"
#include "options.h"
#include "paths.h"
#include "../3rdParty/Storm/Source/storm.h"

1
SourceX/storm/storm_net.cpp

@ -1,6 +1,7 @@
#include <memory>
#include "all.h"
#include "options.h"
#include "stubs.h"
#include "dvlnet/abstract_net.h"

Loading…
Cancel
Save