diff --git a/Source/DiabloUI/settingsmenu.cpp b/Source/DiabloUI/settingsmenu.cpp index b737a9877..581c2d75f 100644 --- a/Source/DiabloUI/settingsmenu.cpp +++ b/Source/DiabloUI/settingsmenu.cpp @@ -26,7 +26,6 @@ Rectangle rectDescription; enum class SpecialMenuEntry { None = -1, PreviousMenu = -2, - ToggleSpawn = -4, }; bool IsValidEntry(OptionEntryBase *pOptionEntry) @@ -70,11 +69,6 @@ void ItemSelected(int value) case SpecialMenuEntry::PreviousMenu: endMenu = true; break; - case SpecialMenuEntry::ToggleSpawn: - gbIsSpawn = !gbIsSpawn; - endMenu = true; - recreateUI = true; - break; } return; } @@ -130,13 +124,8 @@ void UiSettingsMenu() vecDialog.push_back(std::make_unique(&ArtScrollBarBackground, &ArtScrollBarThumb, &ArtScrollBarArrow, MakeSdlRect(rectList.position.x + rectList.size.width + 5, rectList.position.y, 25, rectList.size.height))); vecDialog.push_back(std::make_unique(optionDescription, MakeSdlRect(rectDescription), UiFlags::FontSize12 | UiFlags::ColorUiSilverDark | UiFlags::AlignCenter, 1, IsSmallFontTall() ? 22 : 18)); - if (diabdat_mpq) - vecDialogItems.push_back(std::make_unique(gbIsSpawn ? _("Switch to Fullgame") : _("Switch to Shareware"), static_cast(SpecialMenuEntry::ToggleSpawn), UiFlags::ColorUiGold)); - - bool switchOptionExists = vecDialogItems.size() > 0; - int catCount = switchOptionExists ? 1 : 0; - - size_t itemToSelect = switchOptionExists ? 0 : 1; + size_t catCount = 0; + size_t itemToSelect = 1; for (auto *pCategory : sgOptions.GetCategories()) { bool categoryCreated = false; diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 5ee5c0aa4..b308dcd1c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -914,7 +914,7 @@ void DiabloInit() init_archives(); was_archives_init = true; - if (forceSpawn) + if (forceSpawn || *sgOptions.StartUp.shareware) gbIsSpawn = true; if (forceDiablo || *sgOptions.StartUp.gameMode == StartUpGameMode::Diablo) gbIsHellfire = false; diff --git a/Source/options.cpp b/Source/options.cpp index 80ec2cec1..66f271bcf 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -247,6 +247,11 @@ void OptionGameModeChanged() gbIsHellfire = *sgOptions.StartUp.gameMode == StartUpGameMode::Hellfire; } +void OptionSharewareChanged() +{ + gbIsSpawn = *sgOptions.StartUp.shareware; +} + } // namespace void SetIniValue(const char *sectionName, const char *keyName, const char *value, int len) @@ -521,6 +526,7 @@ StartUpOptions::StartUpOptions() // Ask is missing, cause we want to hide it from UI-Settings. { 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) , diabloIntro("Diablo Intro", OptionEntryFlags::OnlyDiablo, N_("Intro"), N_("Shown Intro cinematic."), StartUpIntro::Once, { { StartUpIntro::Off, N_("OFF") }, @@ -541,11 +547,13 @@ StartUpOptions::StartUpOptions() }) { 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 26f341e1f..3a559fbd1 100644 --- a/Source/options.h +++ b/Source/options.h @@ -236,6 +236,7 @@ struct StartUpOptions : OptionCategoryBase { std::vector GetEntries() override; OptionEntryEnum gameMode; + OptionEntryBoolean shareware; /** @brief Play game intro video on diablo startup. */ OptionEntryEnum diabloIntro; /** @brief Play game intro video on hellfire startup. */