From 2122a4345b8c73713b2ebd7b637b6117e656bb59 Mon Sep 17 00:00:00 2001 From: cadmic Date: Wed, 18 Sep 2024 07:49:01 -0700 Subject: [PATCH] [PAL N64] Match actor changes that aren't in NTSC 1.2 or GC releases (#2208) * [PAL N64] Match actor changes that aren't in NTSC 1.2 * Add bug comment about Zora's Domain waterfall --- .../ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c | 10 +++++ .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 18 ++++++++ .../actors/ovl_En_Heishi3/z_en_heishi3.c | 7 +++ src/overlays/actors/ovl_En_Ik/z_en_ik.c | 6 +++ src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 43 +++++++++++++++++++ src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 5 +++ 6 files changed, 89 insertions(+) diff --git a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c index a98f3428da..76d6ce04e7 100644 --- a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c @@ -5,6 +5,7 @@ */ #include "z_bg_spot07_taki.h" +#include "versions.h" #include "assets/objects/object_spot07_object/object_spot07_object.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -91,10 +92,19 @@ void BgSpot07Taki_Draw(Actor* thisx, PlayState* play) { if (!LINK_IS_ADULT) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); if (this->dyna.actor.params == 0) { +#if !OOT_PAL_N64 + //! @bug 64x64 texture is scrolled mod 128 instead of mod 256 (i.e. 64 << G_TEXTURE_IMAGE_FRAC), + // so there is a noticeable jump when the scrolling wraps around gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, ((frames * -1) & 0x7F), ((frames * -3) & 0xFF), 64, 64, 1, ((frames * 1) & 0x7F), ((frames * -3) & 0xFF), 64, 64)); +#else + gSPSegment(POLY_XLU_DISP++, 0x09, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, ((frames * -1) & 0xFF), + ((frames * -3) & 0xFF), 64, 64, 1, ((frames * 1) & 0xFF), + ((frames * -3) & 0xFF), 64, 64)); +#endif gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1, frames * 0, ((frames * 3) & 0x1FF), 32, 128)); diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index c71075f309..2bfee096dc 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -12,6 +12,7 @@ #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "assets/objects/object_hintnuts/object_hintnuts.h" #include "terminal.h" +#include "versions.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -39,6 +40,10 @@ void EnDntNomal_TargetGivePrize(EnDntNomal* this, PlayState* play); void EnDntNomal_TargetReturn(EnDntNomal* this, PlayState* play); void EnDntNomal_TargetBurrow(EnDntNomal* this, PlayState* play); +#if OOT_PAL_N64 +void EnDntNomal_DoNothing(EnDntNomal* this, PlayState* play); +#endif + void EnDntNomal_SetupStageWait(EnDntNomal* this, PlayState* play); void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, PlayState* play); void EnDntNomal_SetupStageDance(EnDntNomal* this, PlayState* play); @@ -411,10 +416,23 @@ void EnDntNomal_TargetBurrow(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (frame >= this->endFrame) { +#if !OOT_PAL_N64 this->actionFunc = EnDntNomal_SetupTargetWait; +#else + this->hitCounter = 0; + this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); + this->actionFunc = EnDntNomal_DoNothing; +#endif } } +#if OOT_PAL_N64 +void EnDntNomal_DoNothing(EnDntNomal* this, PlayState* play) { +} +#endif + void EnDntNomal_SetupStageWait(EnDntNomal* this, PlayState* play) { if (this->timer3 == 0) { this->endFrame = (f32)Animation_GetLastFrame(&gDntStageHideAnim); diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index aa9c72cc5a..7dc72a610b 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -7,6 +7,7 @@ #include "z_en_heishi3.h" #include "assets/objects/object_sd/object_sd.h" #include "terminal.h" +#include "versions.h" #define FLAGS 0 @@ -134,6 +135,9 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_SY_FOUND); PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); +#if OOT_PAL_N64 + this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4; +#endif this->actionFunc = EnHeishi3_CatchStart; } } @@ -162,6 +166,9 @@ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_SY_FOUND); PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); +#if OOT_PAL_N64 + this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4; +#endif this->actionFunc = EnHeishi3_CatchStart; } } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 003e5a5c3b..727bad19bb 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -8,6 +8,7 @@ #include "assets/scenes/dungeons/jyasinboss/jyasinboss_scene.h" #include "assets/objects/object_ik/object_ik.h" #include "terminal.h" +#include "versions.h" #define FLAGS ACTOR_FLAG_4 @@ -757,9 +758,11 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { } else if (this->actor.colChkInfo.health <= 10) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_LAST_DAMAGE); +#if !OOT_PAL_N64 if (this->switchFlag != 0xFF) { Flags_SetSwitch(play, this->switchFlag); } +#endif return; } else if (prevHealth == 50) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); @@ -1231,6 +1234,9 @@ void EnIk_CsAction4(EnIk* this, PlayState* play) { void EnIk_CsAction5(EnIk* this, PlayState* play) { if (EnIk_GetCue(play, 4) == NULL) { +#if OOT_PAL_N64 + Flags_SetSwitch(play, this->switchFlag); +#endif Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index b5702dc0c5..7df5129426 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -6,6 +6,7 @@ #include "z_en_ma3.h" #include "assets/objects/object_ma2/object_ma2.h" +#include "versions.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -287,6 +288,43 @@ void func_80AA3200(EnMa3* this, PlayState* play) { } } +#if OOT_PAL_N64 +// Same as Npc_UpdateTalking, but with an additional check for the subtimer state +s32 EnMa3_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId, + NpcUpdateTalkStateFunc updateTalkState) { + s16 x; + s16 y; + + if (Actor_TalkOfferAccepted(actor, play)) { + *talkState = NPC_TALK_STATE_TALKING; + return true; + } + + if (*talkState != NPC_TALK_STATE_IDLE) { + *talkState = updateTalkState(play, actor); + return false; + } + + Actor_GetScreenPos(play, actor, &x, &y); + if ((x < 0) || (x > SCREEN_WIDTH) || (y < 0) || (y > SCREEN_HEIGHT)) { + // Actor is offscreen + return false; + } + + if ((gSaveContext.subTimerState != 0) && (gSaveContext.subTimerSeconds < 6)) { + return false; + } + + if (!Actor_OfferTalk(actor, play, interactRange)) { + return false; + } + + actor->textId = getTextId(play, actor); + + return false; +} +#endif + void EnMa3_Update(Actor* thisx, PlayState* play) { EnMa3* this = (EnMa3*)thisx; s32 pad; @@ -297,8 +335,13 @@ void EnMa3_Update(Actor* thisx, PlayState* play) { EnMa3_UpdateEyes(this); this->actionFunc(this, play); func_80AA2E54(this, play); +#if !OOT_PAL_N64 Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 150.0f, EnMa3_GetTextId, EnMa3_UpdateTalkState); +#else + EnMa3_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 150.0f, + EnMa3_GetTextId, EnMa3_UpdateTalkState); +#endif if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { if (this->isNotSinging) { // Turn on singing diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index e07536cbde..024e0ff4b5 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -7,6 +7,7 @@ #include "z_en_ru1.h" #include "assets/objects/object_ru1/object_ru1.h" #include "terminal.h" +#include "versions.h" #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_26) @@ -2036,7 +2037,11 @@ void func_80AEF930(EnRu1* this, PlayState* play) { if (func_80AEB104(this) == 3) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; this->actor.textId = 0x4048; +#if !OOT_PAL_N64 Message_ContinueTextbox(play, this->actor.textId); +#else + Message_StartTextbox(play, this->actor.textId, NULL); +#endif func_80AEF4A8(this, play); this->action = 43; this->drawConfig = 0;