diff --git a/Source/DiabloUI/selstart.cpp b/Source/DiabloUI/selstart.cpp index 950097e1345..9af6c0b93ba 100644 --- a/Source/DiabloUI/selstart.cpp +++ b/Source/DiabloUI/selstart.cpp @@ -18,7 +18,7 @@ std::vector> vecDialog; void ItemSelected(int value) { auto option = static_cast(vecDialogItems[value]->m_value); - sgOptions.StartUp.gameMode.SetValue(option); + sgOptions.GameMode.gameMode.SetValue(option); SaveOptions(); endMenu = true; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 18e61e69efb..cb6d331d2dd 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1133,9 +1133,9 @@ void ApplicationInit() void DiabloInit() { - if (forceSpawn || *sgOptions.StartUp.shareware) + if (forceSpawn || *sgOptions.GameMode.shareware) gbIsSpawn = true; - if (forceDiablo || *sgOptions.StartUp.gameMode == StartUpGameMode::Diablo) + if (forceDiablo || *sgOptions.GameMode.gameMode == StartUpGameMode::Diablo) gbIsHellfire = false; if (forceHellfire) gbIsHellfire = true; @@ -1156,7 +1156,7 @@ void DiabloInit() UiInitialize(); was_ui_init = true; - if (gbIsHellfire && !forceHellfire && *sgOptions.StartUp.gameMode == StartUpGameMode::Ask) { + if (gbIsHellfire && !forceHellfire && *sgOptions.GameMode.gameMode == StartUpGameMode::Ask) { UiSelStartUpGameOption(); if (!gbIsHellfire) { // Reinitialize the UI Elements cause we changed the game diff --git a/Source/options.cpp b/Source/options.cpp index a7be7db7e88..c2132ce2380 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -310,13 +310,13 @@ void OptionLanguageCodeChanged() void OptionGameModeChanged() { - gbIsHellfire = *sgOptions.StartUp.gameMode == StartUpGameMode::Hellfire; + gbIsHellfire = *sgOptions.GameMode.gameMode == StartUpGameMode::Hellfire; discord_manager::UpdateMenu(true); } void OptionSharewareChanged() { - gbIsSpawn = *sgOptions.StartUp.shareware; + gbIsSpawn = *sgOptions.GameMode.shareware; } void OptionAudioChanged() @@ -559,8 +559,8 @@ string_view OptionCategoryBase::GetDescription() const return _(description); } -StartUpOptions::StartUpOptions() - : OptionCategoryBase("StartUp", N_("Start Up"), N_("Start Up Settings")) +GameModeOptions::GameModeOptions() + : OptionCategoryBase("GameMode", N_("Game Mode"), N_("Game Mode Settings")) , gameMode("Game", OptionEntryFlags::NeedHellfireMpq | OptionEntryFlags::RecreateUI, N_("Game Mode"), N_("Play Diablo or Hellfire."), StartUpGameMode::Ask, { { StartUpGameMode::Diablo, N_("Diablo") }, @@ -568,6 +568,21 @@ StartUpOptions::StartUpOptions() { StartUpGameMode::Hellfire, N_("Hellfire") }, }) , shareware("Shareware", OptionEntryFlags::NeedDiabloMpq | OptionEntryFlags::RecreateUI, N_("Restrict to Shareware"), N_("Makes the game compatible with the demo. Enables multiplayer with friends who don't own a full copy of Diablo."), false) + +{ + gameMode.SetValueChangedCallback(OptionGameModeChanged); + shareware.SetValueChangedCallback(OptionSharewareChanged); +} +std::vector GameModeOptions::GetEntries() +{ + return { + &gameMode, + &shareware, + }; +} + +StartUpOptions::StartUpOptions() + : OptionCategoryBase("StartUp", N_("Start Up"), N_("Start Up Settings")) , diabloIntro("Diablo Intro", OptionEntryFlags::OnlyDiablo, N_("Intro"), N_("Shown Intro cinematic."), StartUpIntro::Once, { { StartUpIntro::Off, N_("OFF") }, @@ -587,14 +602,10 @@ StartUpOptions::StartUpOptions() { StartUpSplash::None, N_("None") }, }) { - gameMode.SetValueChangedCallback(OptionGameModeChanged); - shareware.SetValueChangedCallback(OptionSharewareChanged); } std::vector StartUpOptions::GetEntries() { return { - &gameMode, - &shareware, &diabloIntro, &hellfireIntro, &splash, diff --git a/Source/options.h b/Source/options.h index af297fb13c2..9a4185e16ef 100644 --- a/Source/options.h +++ b/Source/options.h @@ -411,12 +411,18 @@ struct OptionCategoryBase { const char *description; }; -struct StartUpOptions : OptionCategoryBase { - StartUpOptions(); +struct GameModeOptions : OptionCategoryBase { + GameModeOptions(); std::vector GetEntries() override; OptionEntryEnum gameMode; OptionEntryBoolean shareware; +}; + +struct StartUpOptions : OptionCategoryBase { + StartUpOptions(); + std::vector GetEntries() override; + /** @brief Play game intro video on diablo startup. */ OptionEntryEnum diabloIntro; /** @brief Play game intro video on hellfire startup. */ @@ -784,6 +790,7 @@ struct PadmapperOptions : OptionCategoryBase { }; struct Options { + GameModeOptions GameMode; StartUpOptions StartUp; DiabloOptions Diablo; HellfireOptions Hellfire; @@ -801,6 +808,7 @@ struct Options { { return { &Language, + &GameMode, &StartUp, &Graphics, &Audio,