diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 99a415386..366324469 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -32060,7 +32060,7 @@ glabel func0f039a18 bool chrIsDead(struct chrdata *chr) { - if (!chr || chr->actiontype == 4 || chr->actiontype == 5) { + if (!chr || chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD) { return true; } @@ -35437,14 +35437,14 @@ glabel func0f03cb74 void func0f03ccdc(struct chrdata *chr) { - if (chr->actiontype == 5 || chr->actiontype == 0x1f) { + if (chr->actiontype == ACT_DEAD || chr->actiontype == ACT_31) { chr->unk02c = 1; } } void func0f03cd04(struct chrdata *chr) { - if (chr->actiontype == 5) { + if (chr->actiontype == ACT_DEAD) { chr->unk030 = 1; } } diff --git a/src/game/chr/chrai.c b/src/game/chr/chrai.c index b6b59f0d1..18a2eb578 100644 --- a/src/game/chr/chrai.c +++ b/src/game/chr/chrai.c @@ -114,13 +114,13 @@ void chraiExecute(void *entity, s32 entity_type) && chrHasFlag(g_Vars.chrdata, 0x00000400, BANK_1) == 0 && chrHasFlag(g_Vars.chrdata, 0x00010000, BANK_0) == 0 && ailistFindById(g_Vars.chrdata->aishootingatmelist) != g_Vars.chrdata->ailist - && g_Vars.chrdata->actiontype != 8 - && g_Vars.chrdata->actiontype != 9 - && g_Vars.chrdata->actiontype != 4 - && g_Vars.chrdata->actiontype != 5 - && g_Vars.chrdata->actiontype != 6 - && g_Vars.chrdata->actiontype != 7 - && g_Vars.chrdata->actiontype != 10) { + && g_Vars.chrdata->actiontype != ACT_ATTACK + && g_Vars.chrdata->actiontype != ACT_ATTACKWALK + && g_Vars.chrdata->actiontype != ACT_DIE + && g_Vars.chrdata->actiontype != ACT_DEAD + && g_Vars.chrdata->actiontype != ACT_ARGH + && g_Vars.chrdata->actiontype != ACT_PREARGH + && g_Vars.chrdata->actiontype != ACT_ATTACKROLL) { // Set shooting at me list g_Vars.ailist = ailistFindById(g_Vars.chrdata->aishootingatmelist); g_Vars.aioffset = 0; @@ -141,9 +141,9 @@ void chraiExecute(void *entity, s32 entity_type) g_Vars.chrdata->darkroomthing = 0; if (g_Vars.chrdata->aidarkroomlist >= 0 - && g_Vars.chrdata->actiontype != 4 - && g_Vars.chrdata->actiontype != 5 - && g_Vars.chrdata->actiontype != 6) { + && g_Vars.chrdata->actiontype != ACT_DIE + && g_Vars.chrdata->actiontype != ACT_DEAD + && g_Vars.chrdata->actiontype != ACT_ARGH) { // Set darkroom list chrSetFlags(g_Vars.chrdata, 0x00000400, BANK_1); chrSetFlags(g_Vars.chrdata, 0x10000000, BANK_1); diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index f1eeec77b..5129f98ee 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -630,7 +630,7 @@ glabel ai000b */ bool aiIfIdle(void) { - if (g_Vars.chrdata->actiontype == 3) { + if (g_Vars.chrdata->actiontype == ACT_ANIM) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { @@ -715,7 +715,7 @@ bool aiIfChrDeathAnimationFinished(void) u32 playernum = posGetPlayerNum(chr->pos); pass = g_Vars.players[playernum]->isdead; } else { - pass = (chr->actiontype == 5); + pass = (chr->actiontype == ACT_DEAD); } } @@ -737,7 +737,7 @@ bool aiIfChrUnloaded(void) struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); if ((!chr || !chr->pos || chr->pos->type != POSITIONTYPE_PLAYER) && - (!chr || !chr->unk020 || chr->actiontype == 0x1f || chr->actiontype == 0x1e || chr->actiontype == 0x20)) { + (!chr || !chr->unk020 || chr->actiontype == ACT_31 || chr->actiontype == ACT_30 || chr->actiontype == ACT_32)) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]); } else { g_Vars.aioffset += 4; @@ -912,7 +912,7 @@ bool ai00f0(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (g_Vars.chrdata->actiontype == 8 && !g_Vars.chrdata->unk058 && g_Vars.chrdata->unk04c & 0x40) { + if (g_Vars.chrdata->actiontype == ACT_ATTACK && !g_Vars.chrdata->unk058 && g_Vars.chrdata->unk04c & 0x40) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; @@ -928,7 +928,7 @@ bool ai00f1(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (g_Vars.chrdata->actiontype == 8) { + if (g_Vars.chrdata->actiontype == ACT_ATTACK) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; @@ -1566,7 +1566,7 @@ bool aiIfPathStarted(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (g_Vars.chrdata->actiontype == 0x0e || (g_Vars.chrdata->actiontype == 0x0f && (g_Vars.chrdata->unk065 & 8))) { + if (g_Vars.chrdata->actiontype == ACT_PATROL || (g_Vars.chrdata->actiontype == ACT_GOPOS && (g_Vars.chrdata->unk065 & 8))) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; @@ -11049,7 +11049,7 @@ glabel ai0137 // struct chrdata *chr = chrFindByLiteralId(*chrnums); // // if (chr && chr->unk020 && chrIsDead(chr) == false && -// chr->actiontype != 5 && +// chr->actiontype != ACT_DEAD && // func0f04aa8c(g_Vars.chrdata, chr, 1) && // g_Vars.chrdata->chrnum != chr->chrnum && // chrGetDistanceToChr(g_Vars.chrdata, chr->chrnum) < 3500 && @@ -11104,11 +11104,11 @@ bool aiSetChrPresetToUnalertedTeammate(void) if (cmd[3] == 0 && chr && chr->unk020 && chrIsDead(chr) == false && - chr->actiontype != 5 && - chr->actiontype != 4 && - chr->actiontype != 0x1f && - chr->actiontype != 0x1e && - chr->actiontype != 0x20 && + chr->actiontype != ACT_DEAD && + chr->actiontype != ACT_DIE && + chr->actiontype != ACT_31 && + chr->actiontype != ACT_30 && + chr->actiontype != ACT_32 && chr->alertness < 100 && (g_Vars.chrdata->squadron == chr->squadron || g_Vars.chrdata->squadron == 0xff) && g_Vars.chrdata->chrnum != chr->chrnum) { @@ -14837,7 +14837,7 @@ bool aiChrKill(void) struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); if (chr) { - chr->actiontype = 5; + chr->actiontype = ACT_DEAD; chr->unk038 = -1; chr->unk02c = 0; chr->unk030 = 0; diff --git a/src/include/constants.h b/src/include/constants.h index c07325a38..c2124dcdb 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -4,6 +4,68 @@ #define false 0 #define true 1 +// These actions are assigned to chr->actiontype +#define ACT_STAND 1 +#define ACT_KNEEL 2 +#define ACT_ANIM 3 +#define ACT_DIE 4 +#define ACT_DEAD 5 +#define ACT_ARGH 6 +#define ACT_PREARGH 7 +#define ACT_ATTACK 8 +#define ACT_ATTACKWALK 9 +#define ACT_ATTACKROLL 10 +#define ACT_11 11 +#define ACT_12 12 +#define ACT_13 13 +#define ACT_PATROL 14 +#define ACT_GOPOS 15 +#define ACT_SURRENDER 16 +#define ACT_17 17 +#define ACT_18 18 +#define ACT_19 19 +#define ACT_20 20 +#define ACT_21 21 +#define ACT_22 22 +#define ACT_23 23 +#define ACT_24 24 +#define ACT_25 25 +#define ACT_26 26 +#define ACT_27 27 +#define ACT_28 28 +#define ACT_29 29 +#define ACT_30 30 +#define ACT_31 31 +#define ACT_32 32 +#define ACT_33 33 + +// These numbers aren't right, but the names are here for reference +// and the order of them might be useful too. +//#define ACT_RUNPOS 11 +//#define ACT_PATROL 12 +//#define ACT_GOPOS 13 +//#define ACT_SURRENDER 14 +//#define ACT_LOOKATTARGET 15 +//#define ACT_SURPRISED 16 +//#define ACT_STARTALARM 17 +//#define ACT_THROWGRENADE 18 +//#define ACT_TURNDIR 19 +//#define ACT_TEST 20 +//#define ACT_BONDINTRO 21 +//#define ACT_BONDDIE 22 +//#define ACT_BONDMULTI 23 +//#define ACT_NULL 24 +//#define ACT_BOT_ATTACKSTAND 25 +//#define ACT_BOT_ATTACKKNEEL 26 +//#define ACT_BOT_ATTACKSTRAFE 27 +//#define ACT_DRUGGEDDROP 28 +//#define ACT_DRUGGEDKO 29 +//#define ACT_DRUGGEDCOMINGUP 30 +//#define ACT_ATTACKAMOUNT 31 +//#define ACT_ROBOTATTACK 32 +//#define ACT_SKJUMP 33 + +// These actions are assigned to chr->myaction #define ACTION_SCAN 0x01 #define ACTION_UNDER_COVER 0x02 #define ACTION_GRENADE_STOP 0x03