1
0
Fork 0
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:
Roman971 2020-03-23 21:19:54 +01:00
parent a9d4fec113
commit e88ea64835
2 changed files with 19 additions and 68 deletions

View file

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