mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 23:05:08 -04:00
666cb6ad4a
* low hanging fruits on variables.h
* z_actor functions
* Move RomFile to z64object.h
* Revert "z_actor functions"
This reverts commit aa99967d16.
* yeet
* z64actor_dlftbls.h
* Move object segment declarations to object_table.c
* Move Camera functions
* z64nmi_buff.h
* fix merge
* su_mtx.h, sys_cmpdma.h and sys_initial_check.h
* sys_ucode.h
* sys_flashrom.h
* Remove unnecessary includes
* z64kanfont.h
* flg_set.h
* z64DLF.h
* z64lifemeter.h
* z64path.h
* format
* ObjectOverlay
* bss
* Yeet ObjectOverlay
* review
* review
* format
* bss
* z64font.h
49 lines
985 B
C
49 lines
985 B
C
#include "z64path.h"
|
|
#include "global.h"
|
|
|
|
#include "z64lib.h"
|
|
|
|
Path* Path_GetByIndex(PlayState* play, s16 index, s16 indexNone) {
|
|
Path* path;
|
|
|
|
if (index != indexNone) {
|
|
path = &play->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 = Lib_SegmentedToVirtual(path->points);
|
|
pointPos = &pointPos[waypoint];
|
|
|
|
dx = pointPos->x - actor->world.pos.x;
|
|
dz = pointPos->z - actor->world.pos.z;
|
|
|
|
*yaw = Math_Atan2S(dx, dz);
|
|
|
|
return SQ(dx) + SQ(dz);
|
|
}
|
|
|
|
void Path_CopyLastPoint(Path* path, Vec3f* dest) {
|
|
Vec3s* pointPos;
|
|
|
|
if (path != NULL) {
|
|
pointPos = &((Vec3s*)Lib_SegmentedToVirtual(path->points))[path->count - 1];
|
|
|
|
dest->x = pointPos->x;
|
|
dest->y = pointPos->y;
|
|
dest->z = pointPos->z;
|
|
}
|
|
}
|