mirror of
https://github.com/zeldaret/oot.git
synced 2024-09-23 05:45:03 +00:00
00a5edea71
* reformat header * type -> category * done for now i think * some more stuff * first -> head * focus * flag comment * ground -> floor * remove asm, name wrapper funcs * name func, format * review * targetPriority, format * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0305ec2c2" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0305ec2c2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * comment * review * feet flags * horse shadow
46 lines
959 B
C
46 lines
959 B
C
#include "global.h"
|
|
|
|
Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max) {
|
|
Path* path;
|
|
|
|
if (index != max) {
|
|
path = &globalCtx->setupPathList[index];
|
|
} else {
|
|
path = NULL;
|
|
}
|
|
|
|
return path;
|
|
}
|
|
|
|
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->world.pos.x;
|
|
dz = pointPos->z - actor->world.pos.z;
|
|
|
|
*yaw = Math_FAtan2F(dx, dz) * (32768 / M_PI);
|
|
|
|
return SQ(dx) + SQ(dz);
|
|
}
|
|
|
|
void Path_CopyLastPoint(Path* path, Vec3f* dest) {
|
|
Vec3s* pointPos;
|
|
|
|
if (path != NULL) {
|
|
pointPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[path->count - 1];
|
|
|
|
dest->x = pointPos->x;
|
|
dest->y = pointPos->y;
|
|
dest->z = pointPos->z;
|
|
}
|
|
}
|