Attempt to decompile chrAssignCoverByCriteria

This commit is contained in:
Ryan Dwyer
2021-06-28 22:29:38 +10:00
parent 0e8b55b265
commit f28074d92a
12 changed files with 230 additions and 55 deletions
+1 -1
View File
@@ -206,7 +206,7 @@ extern s32 *g_PadsFile;
extern u16 *g_PadOffsets;
extern u16 *g_CoverFlags;
extern s32 *g_CoverRooms;
extern void *var800a2368;
extern struct covercandidate *g_CoverCandidates;
extern u16 g_NumSpecialCovers;
extern u16 *g_SpecialCoverNums;
extern struct var800a2380 var800a2380[5];
+16 -9
View File
@@ -2633,22 +2633,29 @@
value, \
label,
// If cover exists nearby
#define cmd0121_if_something(u1, label) \
/**
* Finds cover using the given criteria. If any matches, it is assigned to the
* chr and the label is followed.
*
* Criteria is expected to be a bitfield of COVERCRITERIA constants.
*
* To actually go to the cover, go_to_cover must be used afterwards.
*/
#define find_cover(criteria, label) \
mkshort(0x0121), \
mkshort(u1), \
mkshort(criteria), \
label,
#define cmd0122(u1, flags, label) \
#define find_cover_within_dist(criteria, distance, label) \
mkshort(0x0122), \
mkshort(u1), \
mkword(flags), \
mkshort(criteria), \
mkword(distance), \
label,
#define cmd0123(u1, flags, label) \
#define find_cover_outside_dist(criteria, distance, label) \
mkshort(0x0123), \
mkshort(u1), \
mkword(flags), \
mkshort(criteria), \
mkword(distance), \
label,
#define go_to_cover(speed) \
+17
View File
@@ -566,6 +566,23 @@
#define COUNTDOWNTIMERREASON_AI 0x01
#define COUNTDOWNTIMERREASON_NOCONTROL 0x10
#define COVERCRITERIA_0001 0x0001
#define COVERCRITERIA_FURTHEREST 0x0002
#define COVERCRITERIA_DISTTOME 0x0004
#define COVERCRITERIA_DISTTOTARGET 0x0008
#define COVERCRITERIA_FORCENEWCOVER 0x0010
#define COVERCRITERIA_0020 0x0020
#define COVERCRITERIA_0040 0x0040
#define COVERCRITERIA_ALLOWNEIGHBOURINGROOMS 0x0080
#define COVERCRITERIA_ONLYNEIGHBOURINGROOMS 0x0100
#define COVERCRITERIA_0200 0x0200
#define COVERCRITERIA_ROOMSFROMTARGET 0x0400
#define COVERCRITERIA_ROOMSFROMME 0x0800
#define COVERCRITERIA_1000 0x1000
#define COVERCRITERIA_2000 0x2000
#define COVERCRITERIA_DISTTOFETCHPROP 0x4000
#define COVERCRITERIA_8000 0x8000
#define COVERFLAG_0001 0x0001
#define COVERFLAG_INUSE 0x0002
#define COVERFLAG_AIMSAMEROOM 0x0004 // look + 6 metres is in the same room
+1 -1
View File
@@ -215,7 +215,7 @@ struct prop *chrSpawnAtCoord(s32 body, s32 head, struct coord *pos, s16 *room, f
bool func0f04b658(struct chrdata *chr);
bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle, bool allowonscreen);
bool chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool arg2);
s32 func0f04ba34(struct chrdata *chr, u16 arg1, u32 arg2);
s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 arg1, s32 arg2);
s32 chrAssignCoverAwayFromDanger(struct chrdata *chr, s32 mindist, s32 maxdist);
bool chrRunFromPos(struct chrdata *chr, u32 speed, f32 distance, struct coord *frompos);
f32 func0f04c784(struct chrdata *chr);
+3 -3
View File
@@ -290,9 +290,9 @@
/*0x011e*/ bool aiIfHuman(void);
/*0x011f*/ bool aiIfSkedar(void);
/*0x0120*/ bool ai0120(void);
/*0x0121*/ bool ai0121(void);
/*0x0122*/ bool ai0122(void);
/*0x0123*/ bool ai0123(void);
/*0x0121*/ bool aiFindCover(void);
/*0x0122*/ bool aiFindCoverWithinDist(void);
/*0x0123*/ bool aiFindCoverOutsideDist(void);
/*0x0124*/ bool aiGoToCover(void);
/*0x0125*/ bool aiCheckCoverOutOfSight(void);
/*0x0126*/ bool aiIfPlayerUsingCmpOrAr34(void);
+6 -2
View File
@@ -2930,6 +2930,11 @@ struct path {
/*0x06*/ u16 len;
};
struct covercandidate {
u64 sqdist;
s32 covernum;
};
struct coverdefinition {
struct coord pos;
struct coord look;
@@ -2939,8 +2944,7 @@ struct coverdefinition {
struct cover {
/*0x00*/ struct coord *pos;
/*0x04*/ struct coord *look;
/*0x08*/ s16 room;
/*0x0a*/ s16 unk0a;
/*0x08*/ s16 rooms[2];
/*0x0c*/ u16 flags;
};