From 5a5057d0e9646a49fcc2e7dbe1145e46768f44ee Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 10 Oct 2019 18:47:57 +1000 Subject: [PATCH] Decompile aiSetChrSpecialDeathAnimation --- src/game/chr/chraicommands.c | 41 +++++++++------------------- src/include/game/chr/chraicommands.h | 2 +- src/include/types.h | 40 ++++++++++++++------------- src/setup/setup_000000.c | 2 +- 4 files changed, 36 insertions(+), 49 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 7222718e3..fa04b28fb 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -18352,34 +18352,19 @@ bool aiSetObjHealth(void) /** * @cmd 01a0 */ -GLOBAL_ASM( -glabel ai01a0 -/* f05da4c: 3c03800a */ lui $v1,0x800a -/* f05da50: 24639fc0 */ addiu $v1,$v1,-24640 -/* f05da54: 8c6e0434 */ lw $t6,0x434($v1) -/* f05da58: 8c6f0438 */ lw $t7,0x438($v1) -/* f05da5c: 27bdffe0 */ addiu $sp,$sp,-32 -/* f05da60: afbf0014 */ sw $ra,0x14($sp) -/* f05da64: 01cf3021 */ addu $a2,$t6,$t7 -/* f05da68: 90c50002 */ lbu $a1,0x2($a2) -/* f05da6c: afa6001c */ sw $a2,0x1c($sp) -/* f05da70: 0fc126d1 */ jal chrFindById -/* f05da74: 8c640424 */ lw $a0,0x424($v1) -/* f05da78: 3c03800a */ lui $v1,0x800a -/* f05da7c: 24639fc0 */ addiu $v1,$v1,-24640 -/* f05da80: 10400003 */ beqz $v0,.L0f05da90 -/* f05da84: 8fa6001c */ lw $a2,0x1c($sp) -/* f05da88: 90d80003 */ lbu $t8,0x3($a2) -/* f05da8c: a058032f */ sb $t8,0x32f($v0) -.L0f05da90: -/* f05da90: 8c790438 */ lw $t9,0x438($v1) -/* f05da94: 8fbf0014 */ lw $ra,0x14($sp) -/* f05da98: 27bd0020 */ addiu $sp,$sp,0x20 -/* f05da9c: 27280004 */ addiu $t0,$t9,0x4 -/* f05daa0: ac680438 */ sw $t0,0x438($v1) -/* f05daa4: 03e00008 */ jr $ra -/* f05daa8: 00001025 */ or $v0,$zero,$zero -); +bool aiSetChrSpecialDeathAnimation(void) +{ + u8 *cmd = g_Vars.ailist + g_Vars.aioffset; + struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); + + if (chr) { + chr->specialdie = cmd[3]; + } + + g_Vars.aioffset += 4; + + return 0; +} /** * @cmd 01a1 diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 846197dcd..b1cbc7be0 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -383,7 +383,7 @@ /*0x0193*/ bool aiIfEepromUnset(void); /*0x019e*/ bool aiIfObjHealthLessThan(void); /*0x019f*/ bool aiSetObjHealth(void); -/*0x01a0*/ bool ai01a0(void); +/*0x01a0*/ bool aiSetChrSpecialDeathAnimation(void); /*0x01a1*/ bool ai01a1(void); /*0x01a2*/ bool ai01a2(void); /*0x01a3*/ bool ai01a3(void); diff --git a/src/include/types.h b/src/include/types.h index 88c307aca..e886352af 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -195,25 +195,27 @@ struct chrdata { /*0x2fe*/ u8 race; /*0x2ff*/ u8 blurnumtimesdied; /*0x300*/ struct position *gungroundpos; - /*0x308*/ double pushspeed; - /*0x310*/ double gunroty; - /*0x318*/ double gunrotx; - /*0x320*/ u32 onladder; - /*0x324*/ struct coord laddernormal; - /*0x330*/ u8 liftaction; - /*0x332*/ u16 BITFIELD; - /*0x334*/ u8 specialdie; - /*0x336*/ u16 roomtosearch; - /*0x337*/ u8 propsoundcount; - /*0x338*/ u8 patrolnextstep; - /*0x339*/ u8 BulletsTaken; - /*0x33a*/ u8 WoundedSplatsA; - /*0x33c*/ u16 TicksSinceSplat; - /*0x33e*/ u8 SplatsDroppedHe; - /*0x33f*/ u8 StdSplatsAdded; - /*0x340*/ u8 DeadDropSplatsA; - /*0x341*/ u8 aimtesttimer60; - /*0x344*/ struct coord LastDropPos; + /*0x304*/ u32 pushspeed[2]; + /*0x30c*/ u32 gunroty[2]; + /*0x314*/ u32 gunrotx[2]; + /*0x31c*/ u32 onladder; + /*0x320*/ struct coord laddernormal; + /*0x32c*/ u16 BITFIELD; + /*0x32d*/ u8 liftaction; + /*0x32f*/ u8 specialdie; + /*0x330*/ u16 roomtosearch; + /*0x332*/ u8 propsoundcount; + /*0x333*/ u8 patrolnextstep; + /*0x334*/ u8 BulletsTaken; + /*0x335*/ u8 WoundedSplatsAd; + /*0x336*/ u16 TicksSinceSplat; + /*0x338*/ u8 SplatsDroppedHe; + /*0x339*/ u8 StdSplatsAdded; + /*0x33a*/ u8 DeadDropSplatsA; + /*0x33b*/ u8 aimtesttimer60; + /*0x33c*/ struct coord LastDropPos; + /*0x348*/ u32 unk348; + /*0x34c*/ u32 unk34c; /*0x350*/ u32 unk350; /*0x354*/ u16 aipunchdodgelist; /*0x356*/ u16 aishootingatmelist; diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index 2071f16c6..21441de57 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14365,7 +14365,7 @@ bool (*command_pointers[])(void) = { /*0x019d*/ NULL, /*0x019e*/ aiIfObjHealthLessThan, /*0x019f*/ aiSetObjHealth, - /*0x01a0*/ ai01a0, + /*0x01a0*/ aiSetChrSpecialDeathAnimation, /*0x01a1*/ ai01a1, /*0x01a2*/ ai01a2, /*0x01a3*/ ai01a3,