Zora's River waterfall always open, take two

This commit is contained in:
JordanLongstaff 2024-10-21 01:22:13 -04:00
parent 6d1d57d19a
commit a24ee18480
5 changed files with 49 additions and 2 deletions

View File

@ -303,6 +303,7 @@ const std::vector<const char*> enhancementsCvars = {
CVAR_ENHANCEMENT("TimeSavers.SkipChildStealth"),
CVAR_ENHANCEMENT("TimeSavers.SkipTowerEscape"),
CVAR_ENHANCEMENT("TimeSavers.SkipForcedDialog"),
CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"),
CVAR_ENHANCEMENT("SlowTextSpeed"),
};

View File

@ -22,6 +22,7 @@ extern "C" {
#include "src/overlays/actors/ovl_En_Tk/z_en_tk.h"
#include "src/overlays/actors/ovl_En_Fu/z_en_fu.h"
#include "src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h"
#include "src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h"
#include "src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h"
#include "src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h"
#include "src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h"
@ -92,6 +93,9 @@ void EnDntDemo_JudgeSkipToReward(EnDntDemo* enDntDemo, PlayState* play) {
}
}
void BgSpot03Taki_KeepOpen(BgSpot03Taki* bgSpot03Taki, PlayState* play) {
}
static int successChimeCooldown = 0;
void RateLimitedSuccessChime() {
if (successChimeCooldown == 0) {
@ -676,6 +680,8 @@ static uint32_t enFuUpdateHook = 0;
static uint32_t enFuKillHook = 0;
static uint32_t bgSpot02UpdateHook = 0;
static uint32_t bgSpot02KillHook = 0;
static uint32_t bgSpot03UpdateHook = 0;
static uint32_t bgSpot03KillHook = 0;
static uint32_t enPoSistersUpdateHook = 0;
static uint32_t enPoSistersKillHook = 0;
void TimeSaverOnActorInitHandler(void* actorRef) {
@ -753,6 +759,41 @@ void TimeSaverOnActorInitHandler(void* actorRef) {
});
}
if (actor->id == ACTOR_BG_SPOT03_TAKI && Flags_GetEventChkInf(EVENTCHKINF_LEARNED_ZELDAS_LULLABY) &&
(INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME ||
INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY)) {
bgSpot03UpdateHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* innerActorRef) mutable {
Actor* innerActor = static_cast<Actor*>(innerActorRef);
if (innerActor->id == ACTOR_BG_SPOT03_TAKI && Flags_GetEventChkInf(EVENTCHKINF_LEARNED_ZELDAS_LULLABY) &&
(INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME ||
INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY) &&
(IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), IS_RANDO))
) {
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 {
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnActorUpdate>(bgSpot03UpdateHook);
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnSceneInit>(bgSpot03KillHook);
bgSpot03UpdateHook = 0;
bgSpot03KillHook = 0;
});
}
if (actor->id == ACTOR_EN_DNT_DEMO && (IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO))) {
EnDntDemo* enDntDemo = static_cast<EnDntDemo*>(actorRef);
enDntDemo->actionFunc = EnDntDemo_JudgeSkipToReward;

View File

@ -761,6 +761,9 @@ 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.");
ImGui::EndTable();
ImGui::EndMenu();

View File

@ -14,8 +14,6 @@ void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play);
void BgSpot03Taki_Update(Actor* thisx, PlayState* play);
void BgSpot03Taki_Draw(Actor* thisx, PlayState* play);
void func_808ADEF0(BgSpot03Taki* this, PlayState* play);
const ActorInit Bg_Spot03_Taki_InitVars = {
ACTOR_BG_SPOT03_TAKI,
ACTORCAT_BG,

View File

@ -26,4 +26,8 @@ typedef struct BgSpot03Taki {
/* 0x0174 */ u8 bufferIndex;
} BgSpot03Taki; // size = 0x0178
void func_808ADEF0(BgSpot03Taki* bgSpot03Taki, PlayState* play);
void BgSpot03Taki_ApplyOpeningAlpha(BgSpot03Taki* bgSpot03Taki, s32 bufferIndex);
#endif