Move all checks into update hook

This commit is contained in:
JordanLongstaff 2024-11-04 13:43:21 -05:00
parent 3a87d3bba5
commit 24530bfbd6

View File

@ -777,11 +777,14 @@ void TimeSaverOnActorInitHandler(void* actorRef) {
}); });
} }
if (actor->id == ACTOR_BG_SPOT03_TAKI && Flags_GetEventChkInf(EVENTCHKINF_LEARNED_ZELDAS_LULLABY) && if (actor->id == ACTOR_BG_SPOT03_TAKI) {
(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 { bgSpot03UpdateHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* innerActorRef) mutable {
Actor* innerActor = static_cast<Actor*>(innerActorRef); Actor* innerActor = static_cast<Actor*>(innerActorRef);
if (innerActor->id == ACTOR_BG_SPOT03_TAKI && CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 0)) { if (innerActor->id == ACTOR_BG_SPOT03_TAKI &&
CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 0) &&
CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) &&
(INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME || INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY)
) {
BgSpot03Taki* bgSpot03 = static_cast<BgSpot03Taki*>(innerActorRef); BgSpot03Taki* bgSpot03 = static_cast<BgSpot03Taki*>(innerActorRef);
if (bgSpot03->actionFunc == func_808ADEF0) { if (bgSpot03->actionFunc == func_808ADEF0) {
bgSpot03->actionFunc = BgSpot03Taki_KeepOpen; bgSpot03->actionFunc = BgSpot03Taki_KeepOpen;