Browse Source

*Options implement OptionCategoryBase

pull/3594/head
obligaron 4 years ago committed by Anders Jenbo
parent
commit
618f8820cb
  1. 83
      Source/options.cpp
  2. 59
      Source/options.h

83
Source/options.cpp

@ -536,7 +536,7 @@ void OptionEntryEnumBase::SaveToIni(string_view category) const
{
SetIniValue(category.data(), key.data(), value);
}
int OptionEntryEnumBase::GetValueInternal()
int OptionEntryEnumBase::GetValueInternal() const
{
return value;
}
@ -585,4 +585,85 @@ string_view OptionCategoryBase::GetDescription() const
return _(description.data());
}
DiabloOptions::DiabloOptions()
: OptionCategoryBase("Diablo", N_("Diablo"), N_("Diablo specific Settings"))
{
}
std::vector<OptionEntryBase *> DiabloOptions::GetEntries()
{
return {};
}
HellfireOptions::HellfireOptions()
: OptionCategoryBase("Hellfire", N_("Hellfire"), N_("Hellfire specific Settings"))
{
}
std::vector<OptionEntryBase *> HellfireOptions::GetEntries()
{
return {};
}
AudioOptions::AudioOptions()
: OptionCategoryBase("Audio", N_("Audio"), N_("Audio Settings"))
{
}
std::vector<OptionEntryBase *> AudioOptions::GetEntries()
{
return {};
}
GraphicsOptions::GraphicsOptions()
: OptionCategoryBase("Graphics", N_("Graphics"), N_("Graphics Settings"))
{
}
std::vector<OptionEntryBase *> GraphicsOptions::GetEntries()
{
return {};
}
GameplayOptions::GameplayOptions()
: OptionCategoryBase("Game", N_("Gameplay"), N_("Gameplay Settings"))
{
}
std::vector<OptionEntryBase *> GameplayOptions::GetEntries()
{
return {};
}
ControllerOptions::ControllerOptions()
: OptionCategoryBase("Controller", N_("Controller"), N_("Controller Settings"))
{
}
std::vector<OptionEntryBase *> ControllerOptions::GetEntries()
{
return {};
}
NetworkOptions::NetworkOptions()
: OptionCategoryBase("Network", N_("Network"), N_("Network Settings"))
{
}
std::vector<OptionEntryBase *> NetworkOptions::GetEntries()
{
return {};
}
ChatOptions::ChatOptions()
: OptionCategoryBase("NetMsg", N_("Chat"), N_("Chat Settings"))
{
}
std::vector<OptionEntryBase *> ChatOptions::GetEntries()
{
return {};
}
LanguageOptions::LanguageOptions()
: OptionCategoryBase("Language", N_("Language"), N_("Language Settings"))
{
}
std::vector<OptionEntryBase *> LanguageOptions::GetEntries()
{
return {};
}
} // namespace devilution

59
Source/options.h

@ -124,7 +124,7 @@ protected:
{
}
int GetValueInternal();
[[nodiscard]] int GetValueInternal() const;
void AddEntry(int value, string_view name);
@ -166,7 +166,10 @@ protected:
string_view description;
};
struct DiabloOptions {
struct DiabloOptions : OptionCategoryBase {
DiabloOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Play game intro video on startup. */
bool bIntro;
/** @brief Remembers what singleplayer hero/save was last used. */
@ -175,7 +178,10 @@ struct DiabloOptions {
std::uint32_t lastMultiplayerHero;
};
struct HellfireOptions {
struct HellfireOptions : OptionCategoryBase {
HellfireOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Play game intro video on startup. */
bool bIntro;
/** @brief Cornerstone of the world item. */
@ -188,7 +194,10 @@ struct HellfireOptions {
StartUpGameOption startUpGameOption;
};
struct AudioOptions {
struct AudioOptions : OptionCategoryBase {
AudioOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Movie and SFX volume. */
int nSoundVolume;
/** @brief Music volume. */
@ -210,7 +219,10 @@ struct AudioOptions {
std::uint8_t nResamplingQuality;
};
struct GraphicsOptions {
struct GraphicsOptions : OptionCategoryBase {
GraphicsOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Render width. */
int nWidth;
/** @brief Render height. */
@ -247,7 +259,10 @@ struct GraphicsOptions {
bool bShowFPS;
};
struct GameplayOptions {
struct GameplayOptions : OptionCategoryBase {
GameplayOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Gameplay ticks per second. */
int nTickRate;
/** @brief Enable double walk speed when in town. */
@ -292,7 +307,10 @@ struct GameplayOptions {
bool bDisableCripplingShrines;
};
struct ControllerOptions {
struct ControllerOptions : OptionCategoryBase {
ControllerOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief SDL Controller mapping, see SDL_GameControllerDB. */
char szMapping[1024];
/** @brief Use dpad for spell hotkeys without holding "start" */
@ -307,7 +325,10 @@ struct ControllerOptions {
#endif
};
struct NetworkOptions {
struct NetworkOptions : OptionCategoryBase {
NetworkOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Optionally bind to a specific network interface. */
char szBindAddress[129];
/** @brief Most recently entered Hostname in join dialog. */
@ -316,12 +337,18 @@ struct NetworkOptions {
uint16_t nPort;
};
struct ChatOptions {
struct ChatOptions : OptionCategoryBase {
ChatOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Quick chat messages. */
char szHotKeyMsgs[QUICK_MESSAGE_OPTIONS][MAX_SEND_STR_LEN];
};
struct LanguageOptions {
struct LanguageOptions : OptionCategoryBase {
LanguageOptions();
std::vector<OptionEntryBase *> GetEntries() override;
/** @brief Language code (IETF) for text. */
char szCode[6];
};
@ -339,7 +366,17 @@ struct Options {
[[nodiscard]] std::vector<OptionCategoryBase *> GetCategories()
{
return {};
return {
&Diablo,
&Hellfire,
&Audio,
&Gameplay,
&Graphics,
&Controller,
&Network,
&Chat,
&Language,
};
}
};

Loading…
Cancel
Save