Add "play only once" option

This commit is contained in:
JordanLongstaff 2024-11-10 09:13:58 -05:00
parent 139e9b2891
commit 69d8c97602
2 changed files with 31 additions and 10 deletions

View File

@ -761,6 +761,10 @@ void TimeSaverOnActorInitHandler(void* actorRef) {
});
}
if (actor->id == ACTOR_EN_OWL && gPlayState->sceneNum == SCENE_ZORAS_RIVER && CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 0) == 2) {
Actor_Kill(actor);
}
if (actor->id == ACTOR_BG_SPOT02_OBJECTS && actor->params == 2) {
bgSpot02UpdateHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* innerActorRef) mutable {
Actor* innerActor = static_cast<Actor*>(innerActorRef);
@ -792,12 +796,21 @@ void TimeSaverOnActorInitHandler(void* actorRef) {
shouldKeepOpen = false;
} else if (IS_RANDO) {
shouldKeepOpen = RAND_GET_OPTION(RSK_SLEEPING_WATERFALL) == RO_WATERFALL_OPEN;
} else if (!CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 0) ||
!CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) {
shouldKeepOpen = false;
} else {
shouldKeepOpen = INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME ||
INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY;
switch (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 0)) {
case 1:
shouldKeepOpen = Flags_GetEventChkInf(EVENTCHKINF_OPENED_ZORAS_DOMAIN);
break;
case 2:
shouldKeepOpen = CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) &&
(INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME ||
INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY);
break;
default:
shouldKeepOpen = false;
break;
}
}
if (shouldKeepOpen) {

View File

@ -80,6 +80,7 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large
static const char* chestStyleMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" };
static const char* skipGetItemAnimationOptions[3] = { "Disabled", "Junk Items", "All Items" };
static const char* skipForcedDialogOptions[4] = { "None", "Navi Only", "NPCs Only", "All" };
static const char* sleepingWaterfallOptions[3] = { "Always", "Once", "Never" };
static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" };
static const char* mirroredWorldModes[9] = {
"Disabled", "Always", "Random", "Random (Seeded)", "Dungeons",
@ -120,7 +121,7 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large
CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"),
CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"),
};
static const char* itemCountMessageOptions[sizeof(itemCountMessageCVars) / sizeof(const char*)] = {
static const char* itemCountMessageOptions[ARRAY_COUNT(itemCountMessageCVars)] = {
"Gold Skulltula Tokens",
"Pieces of Heart",
"Heart Containers",
@ -794,9 +795,16 @@ void DrawEnhancementsMenu() {
"- Not within range of Ocarina playing spots");
UIWidgets::PaddedEnhancementCheckbox("Pause Warp", CVAR_ENHANCEMENT("PauseWarp"), true, false);
UIWidgets::Tooltip("Selection of warp song in pause menu initiates warp. Disables song playback.");
UIWidgets::PaddedEnhancementCheckbox("Open Sleeping Waterfall", CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), true, false);
UIWidgets::Tooltip("If Link has an ocarina and has learned Zelda's Lullaby, "
"the waterfall in Zora's River will be open without having to play it.");
UIWidgets::PaddedText("Play Zelda's Lullaby to open Sleeping Waterfall", true, false);
UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), sleepingWaterfallOptions, 0);
UIWidgets::Tooltip(
"Always: Link must always play Zelda's Lullaby to open "
"the waterfall entrance to Zora's Domain.\n"
"Once: Link only needs to play Zelda's Lullaby once to "
"open the waterfall; after that, it stays open permanently.\n"
"Never: Link never needs to play Zelda's Lullaby to open the "
"waterfall; he only needs to have learned it and have an ocarina."
);
ImGui::EndTable();
ImGui::EndMenu();
@ -867,7 +875,7 @@ void DrawEnhancementsMenu() {
UIWidgets::Spacer(0);
if (ImGui::BeginMenu("Item Count Messages")) {
int numOptions = sizeof(itemCountMessageCVars) / sizeof(const char*);
int numOptions = ARRAY_COUNT(itemCountMessageCVars);
bool allItemCountsChecked = std::all_of(itemCountMessageCVars, itemCountMessageCVars + numOptions,
[](const char* cvar) { return CVarGetInteger(cvar, 0); });
bool someItemCountsChecked = std::any_of(itemCountMessageCVars, itemCountMessageCVars + numOptions,