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 <jb55@jb55.com>
This commit is contained in:
William Casarin 2025-07-02 12:33:30 -07:00
commit a06f1d9814
3 changed files with 17 additions and 17 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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. Its used by horse AI but isnt 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;
}