From 77b63d2a05aae58f9104ee538393ba1d2d786ed8 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 19 Jun 2020 23:07:04 +1000 Subject: [PATCH] Decompile chrAttackWalkChooseAnimation --- src/game/chr/chraction.c | 38 ++++++++------------------------ src/include/game/chr/chraction.h | 2 +- src/include/types.h | 16 +++++++++++++- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index ef04204e3..c12fbbe19 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -1492,33 +1492,13 @@ glabel chrAttackKneel /* f030580: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f030584 -/* f030584: 27bdffe0 */ addiu $sp,$sp,-32 -/* f030588: afbf001c */ sw $ra,0x1c($sp) -/* f03058c: afa40020 */ sw $a0,0x20($sp) -/* f030590: 8c8f02d4 */ lw $t7,0x2d4($a0) -/* f030594: 00807025 */ or $t6,$a0,$zero -/* f030598: 3c013f00 */ lui $at,0x3f00 -/* f03059c: 55e0000d */ bnezl $t7,.L0f0305d4 -/* f0305a0: 8fbf001c */ lw $ra,0x1c($sp) -/* f0305a4: 8dc2003c */ lw $v0,0x3c($t6) -/* f0305a8: 44812000 */ mtc1 $at,$f4 -/* f0305ac: 3c014180 */ lui $at,0x4180 -/* f0305b0: 44813000 */ mtc1 $at,$f6 -/* f0305b4: 8c840020 */ lw $a0,0x20($a0) -/* f0305b8: 91c6004e */ lbu $a2,0x4e($t6) -/* f0305bc: 84450000 */ lh $a1,0x0($v0) -/* f0305c0: 8c470010 */ lw $a3,0x10($v0) -/* f0305c4: e7a40010 */ swc1 $f4,0x10($sp) -/* f0305c8: 0c007733 */ jal modelSetAnimation -/* f0305cc: e7a60014 */ swc1 $f6,0x14($sp) -/* f0305d0: 8fbf001c */ lw $ra,0x1c($sp) -.L0f0305d4: -/* f0305d4: 27bd0020 */ addiu $sp,$sp,0x20 -/* f0305d8: 03e00008 */ jr $ra -/* f0305dc: 00000000 */ sll $zero,$zero,0x0 -); +void chrAttackWalkChooseAnimation(struct chrdata *chr) +{ + if (chr->aibot == NULL) { + modelSetAnimation(chr->model, chr->act_attackwalk.anim->animnum, + chr->act_attackwalk.flip, chr->act_attackwalk.anim->frac, 0.5, 16); + } +} GLOBAL_ASM( glabel chrAttackWalk @@ -1821,7 +1801,7 @@ glabel chrAttackWalk /* f030a08: 10000008 */ beqz $zero,.L0f030a2c /* f030a0c: ae2a0014 */ sw $t2,0x14($s1) .L0f030a10: -/* f030a10: 0fc0c161 */ jal func0f030584 +/* f030a10: 0fc0c161 */ jal chrAttackWalkChooseAnimation /* f030a14: 02202025 */ or $a0,$s1,$zero /* f030a18: 8e2d0014 */ lw $t5,0x14($s1) /* f030a1c: 3c01ffdf */ lui $at,0xffdf @@ -21236,7 +21216,7 @@ glabel chrTickAttackWalk /* f044248: 8e040020 */ lw $a0,0x20($s0) /* f04424c: 544000d8 */ bnezl $v0,.L0f0445b0 /* f044250: 8fbf002c */ lw $ra,0x2c($sp) -/* f044254: 0fc0c161 */ jal func0f030584 +/* f044254: 0fc0c161 */ jal chrAttackWalkChooseAnimation /* f044258: 02002025 */ or $a0,$s0,$zero /* f04425c: 8e190014 */ lw $t9,0x14($s0) /* f044260: 3c01ffdf */ lui $at,0xffdf diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index a15857b76..2b8a714a7 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -30,7 +30,7 @@ void chrRunPosChooseAnimation(struct chrdata *chr); void chrAttackStand(struct chrdata *chr, s32 entitytype, s32 entityid); void chrAttackLie(struct chrdata *chr, s32 entitytype, s32 entityid); void chrAttackKneel(struct chrdata *chr, s32 entitytype, s32 entityid); -u32 func0f030584(void); +void chrAttackWalkChooseAnimation(struct chrdata *chr); void chrAttackWalk(struct chrdata *chr, u32 speed); u32 func0f030a40(void); void chrAttackRoll(struct chrdata *chr, bool direction); diff --git a/src/include/types.h b/src/include/types.h index ff9e1490d..c95d0a5a0 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -93,7 +93,7 @@ struct anim { /*0x0a*/ u8 looping; /*0x0b*/ u8 average; /*0x0c*/ f32 frame; - /*0x10*/ u32 frac; + /*0x10*/ f32 frac; /*0x14*/ s16 framea; /*0x16*/ s16 frameb; /*0x18*/ u32 endrame; @@ -463,6 +463,19 @@ struct act_attack { /*0x58*/ u32 unk058; }; +struct act_attackwalk { + /*0x2c*/ u32 unk02c; + /*0x30*/ u32 unk030; + /*0x34*/ u32 unk034; + /*0x38*/ u32 unk038; + /*0x3c*/ struct anim *anim; + /*0x40*/ u32 unk040; + /*0x44*/ u32 unk044; + /*0x48*/ u32 unk048; + /*0x4c*/ u16 unk04c; + /*0x4e*/ u8 flip; +}; + struct act_sidestep { /*0x2c*/ bool side; }; @@ -662,6 +675,7 @@ struct chrdata { struct act_dead act_dead; struct act_preargh act_preargh; struct act_attack act_attack; + struct act_attackwalk act_attackwalk; struct act_sidestep act_sidestep; struct act_jumpout act_jumpout; struct act_runpos act_runpos;