From ae23057e08fba303f9f628e95fc4986196d39a67 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 20 Jun 2020 13:14:03 +1000 Subject: [PATCH] Identify chrIsAvoiding --- src/game/chr/chraction.c | 17 ++++++++++++++--- src/game/game_0601b0.c | 2 +- src/include/game/chr/chraction.h | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 076810da3..7fca4baab 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -29263,14 +29263,25 @@ glabel var7f1a9448 /* f04d448: 00000000 */ sll $zero,$zero,0x0 ); -bool func0f04d44c(struct chrdata *chr) +/** + * Checks if the chr is doing an avoiding animation. + * + * These animations are possibly unused. In each one, the chr jumps backwards or + * to the side as if avoiding something, then looks at whatever it was that just + * went past. + */ +bool chrIsAvoiding(struct chrdata *chr) { - s32 val = modelGetAnimNum(chr->model); + s32 anim = modelGetAnimNum(chr->model); chr->chrflags &= ~CHRCFLAG_10000000; // Possible @bug or just sloppy code: The flag check below can never pass // because that flag was just turned off above. - if (val == 100 || val == 101 || val == 102 || val == 103 || (chr->chrflags & CHRCFLAG_10000000)) { + if (anim == 0x64 + || anim == 0x65 + || anim == 0x66 + || anim == 0x67 + || (chr->chrflags & CHRCFLAG_10000000)) { return true; } diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index a21737504..f27a7743e 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -2621,7 +2621,7 @@ glabel var7f1a9ec4 /* f0625ac: afa000a4 */ sw $zero,0xa4($sp) /* f0625b0: afaa00a0 */ sw $t2,0xa0($sp) /* f0625b4: afab009c */ sw $t3,0x9c($sp) -/* f0625b8: 0fc13513 */ jal func0f04d44c +/* f0625b8: 0fc13513 */ jal chrIsAvoiding /* f0625bc: 02202025 */ or $a0,$s1,$zero /* f0625c0: 14400047 */ bnez $v0,.L0f0626e0 /* f0625c4: 27a400b8 */ addiu $a0,$sp,0xb8 diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index 893920af5..4ca6263f5 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -324,7 +324,7 @@ s16 *squadronGetChrIds(s32 squadron_id); void audioMarkAsRecentlyPlayed(s16 audioid); bool audioWasNotPlayedRecently(s16 audioid); void func0f04cf90(struct chrdata *chr, s32 arg1); -bool func0f04d44c(struct chrdata *chr); +bool chrIsAvoiding(struct chrdata *chr); void chrEmitSparks(struct chrdata *chr); #endif