#include "preset.hpp" #include "Z2AudioLib/Z2SeMgr.h" #include "button.hpp" #include "dusk/config.hpp" #include "dusk/settings.h" #include "m_Do/m_Do_audio.h" #include "ui.hpp" #include namespace dusk::ui { namespace { void applyPresetClassic() { auto& s = getSettings(); s.video.lockAspectRatio.setValue(true); s.game.bloomMode.setValue(BloomMode::Classic); AuroraSetViewportPolicy(AURORA_VIEWPORT_FIT); } void applyPresetHD() { auto& s = getSettings(); s.game.bloomMode.setValue(BloomMode::Classic); s.game.hideTvSettingsScreen.setValue(true); s.game.skipWarningScreen.setValue(true); s.game.noReturnRupees.setValue(true); s.game.disableRupeeCutscenes.setValue(true); s.game.noSwordRecoil.setValue(true); s.game.fastClimbing.setValue(true); s.game.noMissClimbing.setValue(true); s.game.fastTears.setValue(true); s.game.biggerWallets.setValue(true); s.game.invertCameraXAxis.setValue(true); s.game.freeCamera.setValue(true); s.game.no2ndFishForCat.setValue(true); } void applyPresetDusk() { applyPresetHD(); auto& s = getSettings(); s.game.enableAchievementNotifications.setValue(true); s.game.enableQuickTransform.setValue(true); s.game.instantSaves.setValue(true); s.game.midnasLamentNonStop.setValue(true); s.game.enableFrameInterpolation.setValue(true); s.game.sunsSong.setValue(true); s.game.bloomMode.setValue(BloomMode::Dusk); s.game.autoSave.setValue(true); } Rml::Element* createElement(Rml::Element* parent, const Rml::String& tag) { auto* doc = parent->GetOwnerDocument(); auto elem = doc->CreateElement(tag); return parent->AppendChild(std::move(elem)); } const Rml::String kDocumentSource = R"RML(
)RML"; } // namespace PresetWindow::PresetWindow() : Document(kDocumentSource), mRoot(mDocument->GetElementById("window")) { listen(mRoot, Rml::EventId::Transitionend, [this](Rml::Event& event) { if (event.GetTargetElement() == mRoot && !mRoot->HasAttribute("open") && Document::visible()) { Document::hide(mPendingClose); } }); auto* dialog = mDocument->GetElementById("preset-dialog"); auto* title = createElement(dialog, "div"); title->SetClass("preset-title", true); title->SetInnerRML("Welcome to Dusk!"); auto* intro = createElement(dialog, "div"); intro->SetClass("preset-intro", true); intro->SetInnerRML( "Choose a preset to get started. " "You can change any setting later from the Enhancements menu."); auto* grid = createElement(dialog, "div"); grid->SetClass("preset-grid", true); struct PresetInfo { const char* name; const char* desc; void (*apply)(); }; static constexpr PresetInfo kPresets[] = { {"Classic", "All enhancements disabled to match the GameCube version. " "Good for speedrunning or simple nostalgia!", applyPresetClassic}, {"HD", "Some enhancements enabled to match the HD version. " "A good starting point for most players!", applyPresetHD}, {"Dusk", "More enhancements enabled than the HD preset. " "Veteran players will appreciate the additional tweaks!", applyPresetDusk}, }; for (const auto& preset : kPresets) { auto* col = createElement(grid, "div"); col->SetClass("preset-col", true); auto btn = std::make_unique