From a843df1a1cf53d4aa1e04ade057eb19897463a9b Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 20 Oct 2019 23:07:17 +1000 Subject: [PATCH] Decompile aiIfNotListening --- src/game/chr/chraicommands.c | 40 +++++++++------------------- src/include/game/chr/chraicommands.h | 2 +- src/setup/setup_000000.c | 2 +- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index d7f8ff0a4..ee526bd23 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -14282,34 +14282,18 @@ bool ai014a(void) /** * @cmd 014b */ -GLOBAL_ASM( -glabel ai014b -/* f05c110: 3c03800a */ lui $v1,0x800a -/* f05c114: 24639fc0 */ addiu $v1,$v1,-24640 -/* f05c118: 8c6e0424 */ lw $t6,0x424($v1) -/* f05c11c: 27bdffe8 */ addiu $sp,$sp,-24 -/* f05c120: afbf0014 */ sw $ra,0x14($sp) -/* f05c124: 8c650438 */ lw $a1,0x438($v1) -/* f05c128: 91cf02a3 */ lbu $t7,0x2a3($t6) -/* f05c12c: 8c640434 */ lw $a0,0x434($v1) -/* f05c130: 24b80003 */ addiu $t8,$a1,0x3 -/* f05c134: 15e00007 */ bnez $t7,.L0f05c154 -/* f05c138: 00851021 */ addu $v0,$a0,$a1 -/* f05c13c: 0fc13583 */ jal chraiGoToLabel -/* f05c140: 90460002 */ lbu $a2,0x2($v0) -/* f05c144: 3c03800a */ lui $v1,0x800a -/* f05c148: 24639fc0 */ addiu $v1,$v1,-24640 -/* f05c14c: 10000002 */ beqz $zero,.L0f05c158 -/* f05c150: ac620438 */ sw $v0,0x438($v1) -.L0f05c154: -/* f05c154: ac780438 */ sw $t8,0x438($v1) -.L0f05c158: -/* f05c158: 8fbf0014 */ lw $ra,0x14($sp) -/* f05c15c: 27bd0018 */ addiu $sp,$sp,0x18 -/* f05c160: 00001025 */ or $v0,$zero,$zero -/* f05c164: 03e00008 */ jr $ra -/* f05c168: 00000000 */ sll $zero,$zero,0x0 -); +bool aiIfNotListening(void) +{ + u8 *cmd = g_Vars.ailist + g_Vars.aioffset; + + if (g_Vars.chrdata->listening == 0) { + g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); + } else { + g_Vars.aioffset += 3; + } + + return false; +} /** * @cmd 0157 diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index bf0b7f70e..990663a0a 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -329,7 +329,7 @@ /*0x0148*/ bool aiChrSetListening(void); /*0x0149*/ bool ai0149(void); /*0x014a*/ bool ai014a(void); -/*0x014b*/ bool ai014b(void); +/*0x014b*/ bool aiIfNotListening(void); /*0x0152*/ bool ai0152(void); /*0x0157*/ bool ai0157(void); /*0x015b*/ bool aiAudioPlayMusic(void); diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index 89cb2aae0..6b5ec5e15 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14284,7 +14284,7 @@ bool (*command_pointers[])(void) = { /*0x0148*/ aiChrSetListening, /*0x0149*/ ai0149, /*0x014a*/ ai014a, - /*0x014b*/ ai014b, + /*0x014b*/ aiIfNotListening, /*0x014c*/ NULL, /*0x014d*/ NULL, /*0x014e*/ NULL,