Decompile chrResetNearMiss

This commit is contained in:
Ryan Dwyer 2019-12-22 16:27:30 +10:00
parent 12ab88c974
commit 45bc7aecf8
6 changed files with 14 additions and 17 deletions

View File

@ -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)
{

View File

@ -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) {

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -14207,7 +14207,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x0048*/ ai0048,
/*0x0049*/ ai0049,
/*0x004a*/ ai004a,
/*0x004b*/ ai004b,
/*0x004b*/ aiIfNearMiss,
/*0x004c*/ ai004c,
/*0x004d*/ ai004d,
/*0x004e*/ ai004e,