Name and document pathfinding functions

This commit is contained in:
Ryan Dwyer
2023-06-13 21:44:29 +10:00
parent 154153b605
commit 38c478259f
9 changed files with 352 additions and 253 deletions
+7 -6
View File
@@ -53,6 +53,7 @@
#define ALIGN16(val) ((((val) + 0xf) | 0xf) ^ 0xf)
#define ALIGN64(val) (((((u32)(val)) + 0x3f) | 0x3f) ^ 0x3f)
#define ARRAYCOUNT(a) (s32)(sizeof(a) / sizeof(a[0]))
#define CHRNAVSEED(chr) ((g_Vars.lvframe60 >> 9) * 128 + chr->chrnum * 8)
#define CHRRACE(chr) (chr ? chr->race : RACE_HUMAN)
#define CRASH() *(u8 *)0 = 69
#define CYCLES_PER_FRAME ((s32) OS_CPU_COUNTER / (PAL ? 50 : 60))
@@ -3446,12 +3447,12 @@
#define PSTYPE_FOOTSTEP 16
#define PSTYPE_CHRSHOOT 17
#define QUADRANT_BACK 0x01
#define QUADRANT_SIDE1 0x02
#define QUADRANT_SIDE2 0x04
#define QUADRANT_FRONT 0x08
#define QUADRANT_2NDWPTOTARGET 0x10 // second waypoint on route to target
#define QUADRANT_20 0x20
#define QUADRANT_BACK 0x01
#define QUADRANT_SIDE1 0x02
#define QUADRANT_SIDE2 0x04
#define QUADRANT_FRONT 0x08
#define QUADRANT_TOWARDSTARGET 0x10
#define QUADRANT_AWAYFROMTARGET 0x20
#define QUIP_ATTACK1 0
#define QUIP_ATTACK2 1
+22 -22
View File
@@ -4,28 +4,28 @@
#include "data.h"
#include "types.h"
void waypointSetHashThing(s32 hash1, s32 hash2);
void navSetSeed(u32 upper, u32 lower);
struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms);
struct waygroup *func0f114810(s32 *groupnums, s32 value, u32 mask);
void func0f114958(s32 *groupnums, s32 value, u32 mask);
bool func0f1149b0(struct waygroup *group, s32 arg1, u32 mask);
bool func0f114a2c(struct waygroup *from, struct waygroup *to, struct waygroup *groups, s32 arg3, u32 mask);
bool func0f114aec(struct waygroup *from, struct waygroup *to, struct waygroup *groups);
struct waypoint *func0f114b7c(s32 *pointnums, s32 arg1, s32 groupnum, u32 mask);
void func0f114ccc(s32 *pointnums, s32 value, s32 groupnum, u32 mask);
bool func0f114d34(s32 *pointnums, s32 arg1, s32 groupnum, u32 mask);
void func0f114de0(struct waypoint *from, struct waypoint *to, s32 arg2, u32 mask);
void func0f114ee4(struct waypoint *from, struct waypoint *to);
s32 func0f114f70(struct waypoint *from, struct waypoint *to, struct waypoint **arr, s32 arrlen);
void func0f11505c(struct waygroup *arg0, struct waygroup *arg1, struct waypoint **arg2, struct waypoint **arg3);
s32 waypointFindRoute(struct waypoint *from, struct waypoint *to, struct waypoint **arr, s32 arrlen);
void func0f115390(void);
struct waypoint *func0f1153c4(s32 *pointnums, s32 arg1);
struct waygroup *func0f1154cc(s32 *groupnums, s32 arg1);
struct waypoint *func0f1155e0(struct waypoint *pointa, struct waypoint *pointb);
void waypointDisableSegmentInDirection(struct waypoint *a, struct waypoint *b);
void waypointEnableSegmentInDirection(struct waypoint *a, struct waypoint *b);
void waypointDisableSegment(struct waypoint *a, struct waypoint *b);
void waypointEnableSegment(struct waypoint *a, struct waypoint *b);
struct waygroup *waygroupChooseNeighbour(s32 *groupnums, s32 step, u32 ignoremask);
void waygroupSetStepIfUndiscovered(s32 *groupnums, s32 step, u32 ignoremask);
bool waygroupDiscoverOneStep(struct waygroup *group, s32 step, u32 ignoremask);
bool waygroupDiscoverSteps(struct waygroup *from, struct waygroup *to, struct waygroup *groups, bool discoverall, u32 ignoremask);
bool waygroupFindRoute(struct waygroup *from, struct waygroup *to, struct waygroup *groups);
struct waypoint *waypointChooseNeighbour(s32 *pointnums, s32 step, s32 groupnum, u32 ignoremask);
void waypointSetStepIfUndiscovered(s32 *pointnums, s32 value, s32 groupnum, u32 ignoremask);
bool waypointDiscoverOneStep(s32 *pointnums, s32 step, s32 groupnum, u32 ignoremask);
void waypointDiscoverSteps(struct waypoint *from, struct waypoint *to, bool discoverall, u32 ignoremask);
void waypointFindRoute(struct waypoint *from, struct waypoint *to);
s32 waypointCollectLocal(struct waypoint *from, struct waypoint *to, struct waypoint **arr, s32 arrlen);
void waypointFindSegmentIntoGroup(struct waygroup *fromgroup, struct waygroup *togroup, struct waypoint **frompoint, struct waypoint **topoint);
s32 navFindRoute(struct waypoint *from, struct waypoint *to, struct waypoint **arr, s32 arrlen);
void waypointResetAllSteps(void);
struct waypoint *waypointFindRandomAtStep(s32 *pointnums, s32 step);
struct waygroup *waygroupFindRandomAtStep(s32 *groupnums, s32 step);
struct waypoint *navChooseRetreatPoint(struct waypoint *chrpoint, struct waypoint *targetpoint);
void navDisableSegmentInDirection(struct waypoint *a, struct waypoint *b);
void navEnableSegmentInDirection(struct waypoint *a, struct waypoint *b);
void navDisableSegment(struct waypoint *a, struct waypoint *b);
void navEnableSegment(struct waypoint *a, struct waypoint *b);
#endif
+2 -2
View File
@@ -684,14 +684,14 @@ union modelrwdata {
struct waygroup {
s32 *neighbours;
s32 *waypoints;
s32 unk08;
s32 step;
};
struct waypoint {
s32 padnum;
s32 *neighbours; // most significant two bits are booleans, remaining bits are waypoint index
s32 groupnum;
s32 unk0c;
s32 step;
};
struct aibot {