diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 1ff36caf6..f1d3cafcb 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -50202,16 +50202,13 @@ glabel func0f049fcc /* f04a0e0: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f04a0e4 -/* f04a0e4: 8c850018 */ lw $a1,0x18($a0) -/* f04a0e8: 2401fffb */ addiu $at,$zero,-5 -/* f04a0ec: 30a30004 */ andi $v1,$a1,0x4 -/* f04a0f0: 00a17824 */ and $t7,$a1,$at -/* f04a0f4: 0003102b */ sltu $v0,$zero,$v1 -/* f04a0f8: 03e00008 */ jr $ra -/* f04a0fc: ac8f0018 */ sw $t7,0x18($a0) -); +bool chrResetNearMiss(struct chrdata *chr) +{ + bool has_flag = (chr->chrflags & CHRCFLAG_NEAR_MISS) != 0; + chr->chrflags &= ~CHRCFLAG_NEAR_MISS; + + return has_flag; +} s32 chrGetNumArghs(struct chrdata *chr) { diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index d9a744bf6..959685cfa 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -1922,9 +1922,9 @@ bool ai004a(void) /** * @cmd 004b */ -bool ai004b(void) +bool aiIfNearMiss(void) { - if (func0f04a0e4(g_Vars.chrdata)) { + if (chrResetNearMiss(g_Vars.chrdata)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { @@ -8579,7 +8579,7 @@ bool aiSetTarget(void) g_Vars.chrdata->lastseetarget60 = 0; g_Vars.chrdata->lastheartarget60 = 0; g_Vars.chrdata->hidden &= ~CHRHFLAG_00000002; - g_Vars.chrdata->chrflags &= ~CHRCFLAG_00000004; + g_Vars.chrdata->chrflags &= ~CHRCFLAG_NEAR_MISS; g_Vars.chrdata->target = prop_id; } } else if (g_Vars.hovdata) { diff --git a/src/include/constants.h b/src/include/constants.h index e39beb28c..54a1e1aad 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -214,7 +214,7 @@ // chr->chrflags #define CHRCFLAG_00000001 0x00000001 // Villa takers, Attack Ship Cass and skedar - both set at end of intros #define CHRCFLAG_00000002 0x00000002 // Seems to be set on guards who can spawn clones? -#define CHRCFLAG_00000004 0x00000004 // Not used in scripts +#define CHRCFLAG_NEAR_MISS 0x00000004 #define CHRCFLAG_NEVER_BEEN_ON_SCREEN 0x00000008 #define CHRCFLAG_INVINCIBLE_TO_GUNFIRE 0x00000010 #define CHRCFLAG_00000020 0x00000020 // Chicago, Infiltration, AF1, Ruins, WAR diff --git a/src/include/game/chr/chr.h b/src/include/game/chr/chr.h index 37c631eb6..c3685575c 100644 --- a/src/include/game/chr/chr.h +++ b/src/include/game/chr/chr.h @@ -364,7 +364,7 @@ u32 func0f04911c(void); s32 func0f0495d0(struct chrdata *chr, s32 pad_id); u32 func0f049644(void); u32 func0f049fcc(struct chrdata *chr); -u32 func0f04a0e4(struct chrdata *chr); +u32 chrResetNearMiss(struct chrdata *chr); s32 chrGetNumArghs(struct chrdata *chr); s32 chrGetNumCloseArghs(struct chrdata *chr); bool chrSawInjury(struct chrdata *chr, u8 arg1); diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index e49fc16a5..610e9fca4 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -78,7 +78,7 @@ /*0x0048*/ bool ai0048(void); /*0x0049*/ bool ai0049(void); /*0x004a*/ bool ai004a(void); -/*0x004b*/ bool ai004b(void); +/*0x004b*/ bool aiIfNearMiss(void); /*0x004c*/ bool ai004c(void); /*0x004d*/ bool ai004d(void); /*0x004e*/ bool ai004e(void); diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index d15360e11..d0dd3e7b8 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14207,7 +14207,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0048*/ ai0048, /*0x0049*/ ai0049, /*0x004a*/ ai004a, - /*0x004b*/ ai004b, + /*0x004b*/ aiIfNearMiss, /*0x004c*/ ai004c, /*0x004d*/ ai004d, /*0x004e*/ ai004e,