mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 06:54:33 +00:00
Decompile Path_OrientAndGetDistSq
This commit is contained in:
parent
a9d4fec113
commit
e88ea64835
2 changed files with 19 additions and 68 deletions
|
@ -13,6 +13,24 @@ Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max) {
|
|||
return path;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_path/Path_OrientAndGetDistSq.s")
|
||||
f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) {
|
||||
f32 dx;
|
||||
f32 dz;
|
||||
Vec3s* pointPos;
|
||||
|
||||
if (path == NULL) {
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
|
||||
pointPos = &pointPos[waypoint];
|
||||
|
||||
dx = pointPos->x - actor->posRot.pos.x;
|
||||
dz = pointPos->z - actor->posRot.pos.z;
|
||||
|
||||
*yaw = Math_atan2f(dx, dz) * (32768 / M_PI);
|
||||
|
||||
return SQ(dx) + SQ(dz);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_path/Path_CopyLastPoint.s")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue