From 295a199ecbc8f853e44f398ef5efb8571628df7e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 19 Oct 2019 15:47:22 +1000 Subject: [PATCH] Decompile aiChrCopyPadPreset --- src/game/chr/chraicommands.c | 44 +++++++--------------------- src/include/commands.h | 5 ++++ src/include/game/chr/chraicommands.h | 2 +- src/setup/setup_000000.c | 2 +- 4 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index b85dd75cc..471f100e8 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -6905,39 +6905,17 @@ bool aiChrSetPadPreset(void) /** * @cmd 00b4 */ -GLOBAL_ASM( -glabel ai00b4 -/* f054e4c: 3c03800a */ lui $v1,0x800a -/* f054e50: 24639fc0 */ addiu $v1,$v1,-24640 -/* f054e54: 8c6e0434 */ lw $t6,0x434($v1) -/* f054e58: 8c6f0438 */ lw $t7,0x438($v1) -/* f054e5c: 27bdffe0 */ addiu $sp,$sp,-32 -/* f054e60: afbf0014 */ sw $ra,0x14($sp) -/* f054e64: 01cf3021 */ addu $a2,$t6,$t7 -/* f054e68: 90c50002 */ lbu $a1,0x2($a2) -/* f054e6c: afa6001c */ sw $a2,0x1c($sp) -/* f054e70: 0fc126d1 */ jal chrFindById -/* f054e74: 8c640424 */ lw $a0,0x424($v1) -/* f054e78: 8fa6001c */ lw $a2,0x1c($sp) -/* f054e7c: 3c03800a */ lui $v1,0x800a -/* f054e80: 24639fc0 */ addiu $v1,$v1,-24640 -/* f054e84: afa20018 */ sw $v0,0x18($sp) -/* f054e88: 8c640424 */ lw $a0,0x424($v1) -/* f054e8c: 0fc126d1 */ jal chrFindById -/* f054e90: 90c50003 */ lbu $a1,0x3($a2) -/* f054e94: 8fb80018 */ lw $t8,0x18($sp) -/* f054e98: 3c03800a */ lui $v1,0x800a -/* f054e9c: 24639fc0 */ addiu $v1,$v1,-24640 -/* f054ea0: 87190128 */ lh $t9,0x128($t8) -/* f054ea4: a4590128 */ sh $t9,0x128($v0) -/* f054ea8: 8c680438 */ lw $t0,0x438($v1) -/* f054eac: 8fbf0014 */ lw $ra,0x14($sp) -/* f054eb0: 27bd0020 */ addiu $sp,$sp,0x20 -/* f054eb4: 25090004 */ addiu $t1,$t0,0x4 -/* f054eb8: ac690438 */ sw $t1,0x438($v1) -/* f054ebc: 03e00008 */ jr $ra -/* f054ec0: 00001025 */ or $v0,$zero,$zero -); +bool aiChrCopyPadPreset(void) +{ + u8 *cmd = g_Vars.ailist + g_Vars.aioffset; + struct chrdata *chrsrc = chrFindById(g_Vars.chrdata, cmd[2]); + struct chrdata *chrdst = chrFindById(g_Vars.chrdata, cmd[3]); + + chrdst->padpreset1 = chrsrc->padpreset1; + g_Vars.aioffset += 4; + + return false; +} /** * @cmd 00b5 diff --git a/src/include/commands.h b/src/include/commands.h index 75f859777..ec6c7815e 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -772,6 +772,11 @@ chr, \ mkshort(pad), +#define chr_copy_target_pad(srcchr, dstchr) \ + mkshort(0x00b4), \ + srcchr, \ + dstchr, + #define dprint \ mkshort(0x00b5), diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index e9c5c1939..479a09c2e 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -182,7 +182,7 @@ /*0x00b1*/ bool aiSetChrTarget(void); /*0x00b2*/ bool aiSetPadPreset(void); /*0x00b3*/ bool aiChrSetPadPreset(void); -/*0x00b4*/ bool ai00b4(void); +/*0x00b4*/ bool aiChrCopyPadPreset(void); /*0x00b5*/ bool ai00b5(void); /*0x00b6*/ bool aiRestartTimer(void); /*0x00b7*/ bool aiResetTimer(void); diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index 3e4cc963c..a3213999e 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14133,7 +14133,7 @@ bool (*command_pointers[])(void) = { /*0x00b1*/ aiSetChrTarget, /*0x00b2*/ aiSetPadPreset, /*0x00b3*/ aiChrSetPadPreset, - /*0x00b4*/ ai00b4, + /*0x00b4*/ aiChrCopyPadPreset, /*0x00b5*/ ai00b5, /*0x00b6*/ aiRestartTimer, /*0x00b7*/ aiResetTimer,