From fe9bf7d9567f9ed75353a1ee9ff451256871519d Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Mon, 2 Dec 2024 13:40:29 -0600 Subject: [PATCH] Adjust Actor_GetProjectileActor to behave more like hardware, fixing an issue with Dark Link (#4606) --- soh/src/code/z_actor.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 8ceca43f2..4cd4d7584 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -2,6 +2,7 @@ #include "vt.h" #include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h" +#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" @@ -3854,8 +3855,14 @@ Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius) { // it can also be an arrow. // Luckily, the field at the same offset in the arrow actor is the x component of a vector // which will rarely ever be 0. So it's very unlikely for this bug to cause an issue. + // + // SoH [Port] We're making a change here, it doesn't technically fix the bug but makes it behave + // more like hardware. Because of pointer size differences in SoH this was accessing a different + // place in memory and causing issues with Dark link behavior, and probably other places too if ((Math_Vec3f_DistXYZ(&refActor->world.pos, &actor->world.pos) > radius) || - (((ArmsHook*)actor)->timer == 0)) { + (actor->id == ACTOR_ARMS_HOOK && ((ArmsHook*)actor)->timer == 0) || + (actor->id == ACTOR_EN_ARROW && ((EnArrow*)actor)->unk_210.x == 0) + ) { actor = actor->next; } else { deltaX = Math_SinS(actor->world.rot.y) * (actor->speedXZ * 10.0f);