From 8fc2fcd9e9aa8d4c3a0415524727c78338b99e77 Mon Sep 17 00:00:00 2001 From: obligaron Date: Sun, 28 Nov 2021 08:43:00 +0100 Subject: [PATCH] Move Intro Options to StartUp-Section and add a "Once"-Option --- Source/diablo.cpp | 14 +++++++++----- Source/options.cpp | 24 ++++++++++++++++-------- Source/options.h | 14 ++++++++++---- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 8f931552a..c23d594a3 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -973,11 +973,15 @@ void DiabloSplash() if (*sgOptions.StartUp.splash == StartUpSplash::LogoAndTitleDialog) play_movie("gendata\\logo.smk", true); - if (gbIsHellfire && *sgOptions.Hellfire.intro) { - play_movie("gendata\\Hellfire.smk", true); - } - if (!gbIsHellfire && !gbIsSpawn && *sgOptions.Diablo.intro) { - play_movie("gendata\\diablo1.smk", true); + auto &intro = gbIsHellfire ? sgOptions.StartUp.hellfireIntro : sgOptions.StartUp.diabloIntro; + + if (*intro != StartUpIntro::Off) { + if (gbIsHellfire) + play_movie("gendata\\Hellfire.smk", true); + else + play_movie("gendata\\diablo1.smk", true); + if (*intro == StartUpIntro::Once) + intro.SetValue(StartUpIntro::Off); } if (IsAnyOf(*sgOptions.StartUp.splash, StartUpSplash::TitleDialog, StartUpSplash::LogoAndTitleDialog)) diff --git a/Source/options.cpp b/Source/options.cpp index 9aa8bae67..279031ab5 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -565,6 +565,18 @@ string_view OptionCategoryBase::GetDescription() const 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") }, + // Once is missing, cause we want to hide it from UI-Settings. + { StartUpIntro::On, N_("ON") }, + }) + , hellfireIntro("Hellfire Intro", OptionEntryFlags::OnlyHellfire, N_("Intro"), N_("Shown Intro cinematic."), StartUpIntro::Once, + { + { StartUpIntro::Off, N_("OFF") }, + // Once is missing, cause we want to hide it from UI-Settings. + { StartUpIntro::On, N_("ON") }, + }) , splash("Splash", OptionEntryFlags::None, N_("Splash"), N_("Shown splash screen."), StartUpSplash::LogoAndTitleDialog, { { StartUpSplash::LogoAndTitleDialog, N_("Logo and Title Screen") }, @@ -576,32 +588,28 @@ StartUpOptions::StartUpOptions() std::vector StartUpOptions::GetEntries() { return { + &diabloIntro, + &hellfireIntro, &splash, }; } DiabloOptions::DiabloOptions() : OptionCategoryBase("Diablo", N_("Diablo"), N_("Diablo specific Settings")) - , intro("Intro", OptionEntryFlags::OnlyDiablo, N_("Intro"), N_("Enable/disable Intro cinematic."), true) { } std::vector DiabloOptions::GetEntries() { - return { - &intro, - }; + return {}; } HellfireOptions::HellfireOptions() : OptionCategoryBase("Hellfire", N_("Hellfire"), N_("Hellfire specific Settings")) - , intro("Intro", OptionEntryFlags::OnlyHellfire, N_("Intro"), N_("Enable/disable Intro cinematic."), true) { } std::vector HellfireOptions::GetEntries() { - return { - &intro, - }; + return {}; } AudioOptions::AudioOptions() diff --git a/Source/options.h b/Source/options.h index 91a3cd4bf..9ca5f8a9b 100644 --- a/Source/options.h +++ b/Source/options.h @@ -16,6 +16,12 @@ enum class StartUpGameOption { Diablo, }; +enum class StartUpIntro { + Off = 0, + Once = 1, + On = 2, +}; + /** @brief Defines what splash screen should be shown at startup. */ enum class StartUpSplash { /** @brief Show no splash screen. */ @@ -197,6 +203,10 @@ 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. */ + OptionEntryEnum hellfireIntro; OptionEntryEnum splash; }; @@ -204,8 +214,6 @@ struct DiabloOptions : OptionCategoryBase { DiabloOptions(); std::vector GetEntries() override; - /** @brief Play game intro video on startup. */ - OptionEntryBoolean intro; /** @brief Remembers what singleplayer hero/save was last used. */ std::uint32_t lastSinglePlayerHero; /** @brief Remembers what multiplayer hero/save was last used. */ @@ -216,8 +224,6 @@ struct HellfireOptions : OptionCategoryBase { HellfireOptions(); std::vector GetEntries() override; - /** @brief Play game intro video on startup. */ - OptionEntryBoolean intro; /** @brief Cornerstone of the world item. */ char szItem[sizeof(ItemPack) * 2 + 1]; /** @brief Remembers what singleplayer hero/save was last used. */