Force Sleeping Waterfall enhancement in rando mode

This commit is contained in:
JordanLongstaff 2024-11-15 14:03:45 -05:00
parent 69d8c97602
commit 410131fb19
4 changed files with 48 additions and 37 deletions

View File

@ -43,7 +43,12 @@ void RegionTable_Init_ZorasDomain() {
Entrance(RR_ZR_FAIRY_GROTTO, {[]{return Here(RR_ZORAS_RIVER, []{return logic->BlastOrSmash();});}}), Entrance(RR_ZR_FAIRY_GROTTO, {[]{return Here(RR_ZORAS_RIVER, []{return logic->BlastOrSmash();});}}),
Entrance(RR_THE_LOST_WOODS, {[]{return logic->HasItem(RG_SILVER_SCALE) || logic->CanUse(RG_IRON_BOOTS);}}), Entrance(RR_THE_LOST_WOODS, {[]{return logic->HasItem(RG_SILVER_SCALE) || logic->CanUse(RG_IRON_BOOTS);}}),
Entrance(RR_ZR_STORMS_GROTTO, {[]{return logic->CanOpenStormsGrotto();}}), Entrance(RR_ZR_STORMS_GROTTO, {[]{return logic->CanOpenStormsGrotto();}}),
Entrance(RR_ZR_BEHIND_WATERFALL, {[]{return ctx->GetOption(RSK_SLEEPING_WATERFALL).Is(RO_WATERFALL_OPEN) || logic->CanUse(RG_ZELDAS_LULLABY) || (logic->IsChild && ctx->GetTrickOption(RT_ZR_CUCCO)) || (logic->IsAdult && logic->CanUse(RG_HOVER_BOOTS) && ctx->GetTrickOption(RT_ZR_HOVERS));}}), Entrance(RR_ZR_BEHIND_WATERFALL, {[]{
return Here(RR_ZORAS_RIVER, []{return ctx->GetOption(RSK_SLEEPING_WATERFALL).Is(RO_WATERFALL_OPEN);}) ||
logic->CanUse(RG_ZELDAS_LULLABY) ||
(logic->IsChild && ctx->GetTrickOption(RT_ZR_CUCCO)) ||
(logic->IsAdult && logic->CanUse(RG_HOVER_BOOTS) && ctx->GetTrickOption(RT_ZR_HOVERS));
}}),
}); });
areaTable[RR_ZR_BEHIND_WATERFALL] = Region("ZR Behind Waterfall", "Zora River", {RA_ZORAS_RIVER}, DAY_NIGHT_CYCLE, {}, {}, { areaTable[RR_ZR_BEHIND_WATERFALL] = Region("ZR Behind Waterfall", "Zora River", {RA_ZORAS_RIVER}, DAY_NIGHT_CYCLE, {}, {}, {

View File

@ -34,7 +34,8 @@ void Settings::CreateOptionDescriptions() {
"Open - King Zora has already mweeped out of the way in both " "Open - King Zora has already mweeped out of the way in both "
"time periods. Ruto's Letter is removed from the item pool."; "time periods. Ruto's Letter is removed from the item pool.";
mOptionDescriptions[RSK_SLEEPING_WATERFALL] = "Closed - Sleeping Waterfall obstructs the entrance to Zora's " mOptionDescriptions[RSK_SLEEPING_WATERFALL] = "Closed - Sleeping Waterfall obstructs the entrance to Zora's "
"Domain. Zelda's Lullaby must be played in order to open it.\n" "Domain. Zelda's Lullaby must be played in order to open it "
"(but only once; then it stays open in both time periods).\n"
"\n" "\n"
"Open - Sleeping Waterfall is always open. " "Open - Sleeping Waterfall is always open. "
"Link may always enter Zora's Domain."; "Link may always enter Zora's Domain.";

View File

@ -790,45 +790,44 @@ void TimeSaverOnActorInitHandler(void* actorRef) {
if (actor->id == ACTOR_BG_SPOT03_TAKI) { if (actor->id == ACTOR_BG_SPOT03_TAKI) {
bgSpot03UpdateHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* innerActorRef) mutable { bgSpot03UpdateHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* innerActorRef) mutable {
Actor* innerActor = static_cast<Actor*>(innerActorRef); Actor* innerActor = static_cast<Actor*>(innerActorRef);
bool shouldKeepOpen;
if (innerActor->id != ACTOR_BG_SPOT03_TAKI) { if (innerActor->id != ACTOR_BG_SPOT03_TAKI) {
shouldKeepOpen = false; return;
} else if (IS_RANDO) {
shouldKeepOpen = RAND_GET_OPTION(RSK_SLEEPING_WATERFALL) == RO_WATERFALL_OPEN;
} else {
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) { bool shouldKeepOpen;
BgSpot03Taki* bgSpot03 = static_cast<BgSpot03Taki*>(innerActorRef); switch (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 0)) {
if (bgSpot03->actionFunc == func_808ADEF0) { case 1:
bgSpot03->actionFunc = BgSpot03Taki_KeepOpen; shouldKeepOpen = Flags_GetEventChkInf(EVENTCHKINF_OPENED_ZORAS_DOMAIN);
bgSpot03->state = WATERFALL_OPENED; break;
bgSpot03->openingAlpha = 0.0f; case 2:
Flags_SetSwitch(gPlayState, bgSpot03->switchFlag); shouldKeepOpen = CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) &&
func_8003EBF8(gPlayState, &gPlayState->colCtx.dyna, bgSpot03->dyna.bgId); (INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME ||
BgSpot03Taki_ApplyOpeningAlpha(bgSpot03, 0); INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY);
BgSpot03Taki_ApplyOpeningAlpha(bgSpot03, 1); break;
default:
shouldKeepOpen = false;
break;
}
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnActorUpdate>(bgSpot03UpdateHook); if (!shouldKeepOpen) {
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnSceneInit>(bgSpot03KillHook); return;
bgSpot03UpdateHook = 0; }
bgSpot03KillHook = 0;
} BgSpot03Taki* bgSpot03 = static_cast<BgSpot03Taki*>(innerActorRef);
if (bgSpot03->actionFunc == func_808ADEF0) {
bgSpot03->actionFunc = BgSpot03Taki_KeepOpen;
bgSpot03->state = WATERFALL_OPENED;
bgSpot03->openingAlpha = 0.0f;
Flags_SetSwitch(gPlayState, bgSpot03->switchFlag);
func_8003EBF8(gPlayState, &gPlayState->colCtx.dyna, bgSpot03->dyna.bgId);
BgSpot03Taki_ApplyOpeningAlpha(bgSpot03, 0);
BgSpot03Taki_ApplyOpeningAlpha(bgSpot03, 1);
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnActorUpdate>(bgSpot03UpdateHook);
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnSceneInit>(bgSpot03KillHook);
bgSpot03UpdateHook = 0;
bgSpot03KillHook = 0;
} }
}); });
bgSpot03KillHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) mutable { bgSpot03KillHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) mutable {

View File

@ -795,8 +795,14 @@ void DrawEnhancementsMenu() {
"- Not within range of Ocarina playing spots"); "- Not within range of Ocarina playing spots");
UIWidgets::PaddedEnhancementCheckbox("Pause Warp", CVAR_ENHANCEMENT("PauseWarp"), true, false); UIWidgets::PaddedEnhancementCheckbox("Pause Warp", CVAR_ENHANCEMENT("PauseWarp"), true, false);
UIWidgets::Tooltip("Selection of warp song in pause menu initiates warp. Disables song playback."); UIWidgets::Tooltip("Selection of warp song in pause menu initiates warp. Disables song playback.");
uint8_t forceSleepingWaterfallValue =
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SLEEPING_WATERFALL) + 1;
static const char* forceSleepingWaterfallText =
"This setting is forcefully enabled because you are playing a randomizer.";
UIWidgets::PaddedText("Play Zelda's Lullaby to open Sleeping Waterfall", true, false); UIWidgets::PaddedText("Play Zelda's Lullaby to open Sleeping Waterfall", true, false);
UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), sleepingWaterfallOptions, 0); UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"),
sleepingWaterfallOptions, 0, IS_RANDO, forceSleepingWaterfallText, forceSleepingWaterfallValue);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Always: Link must always play Zelda's Lullaby to open " "Always: Link must always play Zelda's Lullaby to open "
"the waterfall entrance to Zora's Domain.\n" "the waterfall entrance to Zora's Domain.\n"