From a06f1d9814d4bc11f9fd2c5ee2cd13fc846ad47b Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 2 Jul 2025 12:33:30 -0700 Subject: [PATCH] z_actor: move Actor_RotateToPoint from z_horse Now that this function is identified, let's move it to the right spot. Signed-off-by: William Casarin --- soh/include/functions.h | 2 +- soh/src/code/z_actor.c | 16 ++++++++++++++++ soh/src/code/z_horse.c | 16 ---------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index 49330bc95..cab37b7cc 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -403,6 +403,7 @@ void Actor_MoveXZGravity(Actor* actor); void Actor_UpdateVelocityXYZ(Actor* actor); void Actor_MoveXYZ(Actor* actor); void Actor_SetProjectileSpeed(Actor* actor, f32 arg1); +void Actor_RotateToPoint(Actor* actor, Vec3f* target, s16 speed); s16 Actor_WorldYawTowardActor(Actor* actorA, Actor* actorB); s16 Actor_WorldYawTowardPoint(Actor* actor, Vec3f* refPoint); f32 Actor_WorldDistXYZToActor(Actor* actorA, Actor* actorB); @@ -895,7 +896,6 @@ void Horse_PatchLakeHyliaSpawn(PlayState* play); void Horse_SetNormal(PlayState* play, Player* player); void Horse_SetCutsceneMount(PlayState* play, Player* player); void Horse_InitForScene(PlayState* play, Player* player); -void Actor_RotateToPoint(Actor* actor, Vec3f* target, s16 speed); s32 Jpeg_Decode(void* data, void* zbuffer, void* workBuff, u32 workSize); void KaleidoSetup_Update(PlayState* play); void KaleidoSetup_Init(PlayState* play); diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 4575d9644..258abcc8d 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -6470,4 +6470,20 @@ s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f func_80037FC8(actor, &sp24, arg2, arg3); return true; + +} + +// Generic helper: smoothly yaw an actor toward a target point, clamping the turn speed. +void Actor_RotateToPoint(Actor* actor, Vec3f* arg1, s16 arg2) { + s16 x = Math_Vec3f_Yaw(&actor->world.pos, arg1) - actor->world.rot.y; + + if (x > arg2) { + actor->world.rot.y += arg2; + } else if (x < -arg2) { + actor->world.rot.y -= arg2; + } else { + actor->world.rot.y += x; + } + + actor->shape.rot.y = actor->world.rot.y; } diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c index 48e748acb..eb3124e38 100644 --- a/soh/src/code/z_horse.c +++ b/soh/src/code/z_horse.c @@ -288,19 +288,3 @@ void Horse_InitForScene(PlayState* play, Player* player) { } } } - -// Generic helper: smoothly yaw an actor toward a target point, clamping the -// turn speed. It’s used by horse AI but isn’t horse-specific. -void Actor_RotateToPoint(Actor* actor, Vec3f* arg1, s16 arg2) { - s16 x = Math_Vec3f_Yaw(&actor->world.pos, arg1) - actor->world.rot.y; - - if (x > arg2) { - actor->world.rot.y += arg2; - } else if (x < -arg2) { - actor->world.rot.y -= arg2; - } else { - actor->world.rot.y += x; - } - - actor->shape.rot.y = actor->world.rot.y; -}