Attempt to decompile chrIsStopped

This commit is contained in:
Ryan Dwyer 2019-12-26 11:50:00 +10:00
parent 0f61afa53c
commit 8e5bb6ad65
7 changed files with 76 additions and 11 deletions

View File

@ -20191,7 +20191,7 @@ glabel func0f02f530
/* f02f5d8: 10000007 */ beqz $zero,.L0f02f5f8
/* f02f5dc: ae090014 */ sw $t1,0x14($s0)
.L0f02f5e0:
/* f02f5e0: 0fc0e576 */ jal func0f0395d8
/* f02f5e0: 0fc0e576 */ jal chrIsStopped
/* f02f5e4: 02002025 */ or $a0,$s0,$zero
/* f02f5e8: 54400004 */ bnezl $v0,.L0f02f5fc
/* f02f5ec: 8fbf001c */ lw $ra,0x1c($sp)
@ -31296,7 +31296,7 @@ void chrRecordLastHearTargetTime(struct chrdata *chr)
}
GLOBAL_ASM(
glabel func0f0395d8
glabel chrIsStopped
/* f0395d8: 27bdffd8 */ addiu $sp,$sp,-40
/* f0395dc: afb00018 */ sw $s0,0x18($sp)
/* f0395e0: 00808025 */ or $s0,$a0,$zero
@ -31418,6 +31418,52 @@ glabel func0f0395d8
/* f039788: 00000000 */ sll $zero,$zero,0x0
);
//bool chrIsStopped(struct chrdata *chr)
//{
// u32 anim = func0001d13c(chr->unk020);
//
// if (anim == 0x269 || anim == 0x26b) {
// return false;
// }
//
// if (anim == 0x26a && chr->act_attack.unk034 <= chr->act_attack.unk033) {
// chrStopFiring(chr);
// return true;
// }
//
// if (chr->actiontype == ACT_ROBOTATTACK && chr->unk06e) {
// return true;
// }
//
// if (chr->actiontype == ACT_ATTACKAMOUNT && chr->act_attackamount.unk034 <= chr->act_attackamount.unk033) {
// return true;
// }
//
// if (chr->actiontype == ACT_STAND && chr->act_stand.unk02c == 0 && chr->act_stand.unk038 == 0 && chr->act_stand.unk03c != 1) {
// return true;
// }
//
// if (chr->actiontype == ACT_ANIM) {
// if (chr->act_anim.unk034) {
// return true;
// }
//
// if (func0001d260(chr->unk020) >= 0 && func0001d17c(chr->unk020) >= func0001d1a0(chr->unk020)) {
// return true;
// }
//
// if (func0001d260(chr->unk020) >= 0 || func0001d17c(chr->unk020) > 0) {
// return false;
// }
// }
//
// if (chr->actiontype == ACT_PATROL) {
// return true;
// }
//
// return false;
//}
GLOBAL_ASM(
glabel func0f03978c
/* f03978c: 27bdffb0 */ addiu $sp,$sp,-80

View File

@ -384,7 +384,7 @@ bool aiStop(void)
if (g_Vars.chrdata) {
chrTryStop(g_Vars.chrdata);
} else if (g_Vars.hovdata) {
func0f07b078(g_Vars.hovdata);
heliTryStop(g_Vars.hovdata);
}
g_Vars.aioffset += 2;
@ -672,7 +672,7 @@ bool aiBeSurprised000e(void)
*/
bool aiIfStopped(void)
{
if (func0f0395d8(g_Vars.chrdata)) {
if (chrIsStopped(g_Vars.chrdata)) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {

View File

@ -24779,7 +24779,7 @@ glabel func0f07b038
);
GLOBAL_ASM(
glabel func0f07b078
glabel heliTryStop
/* f07b078: 27bdffe8 */ addiu $sp,$sp,-24
/* f07b07c: afbf0014 */ sw $ra,0x14($sp)
/* f07b080: 0fc1eb7d */ jal objGetHeli

View File

@ -232,7 +232,7 @@ u32 func0f039474(void);
u32 func0f039558(void);
void chrRecordLastSeeTargetTime(struct chrdata *chr);
void chrRecordLastHearTargetTime(struct chrdata *chr);
u32 func0f0395d8(struct chrdata *chr);
bool chrIsStopped(struct chrdata *chr);
u32 func0f03978c(struct chrdata *chr);
u32 func0f039a18(struct chrdata *chr);
bool chrIsDead(struct chrdata *chr);

View File

@ -166,7 +166,7 @@ u32 func0f07ae18(struct heliobj *heli, u32 arg1);
u32 func0f07af34(struct heliobj *heli);
void heliSetTarget(struct heliobj *heli, s32 arg1);
u32 func0f07b038(struct heliobj *heli);
void func0f07b078(struct heliobj *heli);
void heliTryStop(struct heliobj *heli);
bool heliSetField90(struct defaultobj *obj, u32 value);
u32 heliRestartTimer(struct heliobj *heli);
f32 heliGetTimer(struct heliobj *heli);

View File

@ -55,7 +55,7 @@ u32 func0001d15c(void);
f32 func0001d17c(struct chr020 *chr020);
f32 func0001d1a0(struct chr020 *chr020);
u32 func0001d218(void);
u32 func0001d260(void);
f32 func0001d260(struct chr020 *chr020);
u32 func0001d288(void);
u32 func0001d320(void);
u32 func0001d4fc(void);

View File

@ -209,6 +209,12 @@ struct act_stand {
/*0x4c*/ s8 unk04c;
};
struct act_anim {
/*0x2c*/ u32 unk02c;
/*0x30*/ u32 unk030;
/*0x34*/ u32 unk034;
};
struct act_die {
/*0x2c*/ u32 unk02c;
/*0x30*/ f32 unk030;
@ -226,8 +232,10 @@ struct act_dead {
struct act_attack {
/*0x2c*/ u32 unk02c;
/*0x30*/ u32 unk030;
/*0x34*/ u32 unk034;
/*0x30*/ u16 unk030;
/*0x32*/ u8 unk032;
/*0x33*/ s8 unk033;
/*0x34*/ s8 unk034;
/*0x38*/ u32 unk038;
/*0x3c*/ u32 unk03c;
/*0x40*/ u32 unk040;
@ -263,6 +271,14 @@ struct act_throwgrenade {
/*0x38*/ u32 unk038;
};
struct act_attackamount {
/*0x2c*/ u32 unk02c;
/*0x30*/ u16 unk030;
/*0x32*/ u8 unk032;
/*0x33*/ s8 unk033;
/*0x34*/ s8 unk034;
};
struct chrdata {
/*0x000*/ s16 chrnum;
/*0x002*/ s8 accuracyrating;
@ -290,6 +306,7 @@ struct chrdata {
union {
struct act_stand act_stand;
struct act_anim act_anim;
struct act_die act_die;
struct act_dead act_dead;
struct act_attack act_attack;
@ -298,6 +315,7 @@ struct chrdata {
struct act_runpos act_runpos;
struct act_surprised act_surprised;
struct act_throwgrenade act_throwgrenade;
struct act_attackamount act_attackamount;
};
/*0x054*/ u32 unk054;
@ -308,7 +326,8 @@ struct chrdata {
/*0x066*/ u8 unk065;
/*0x066*/ s16 unk066;
/*0x068*/ u32 unk068;
/*0x06c*/ u32 unk06c;
/*0x06c*/ u16 unk06c;
/*0x06e*/ u8 unk06e;
/*0x070*/ u32 unk070;
/*0x074*/ u32 unk074;
/*0x078*/ u32 unk078;