From 8155269f9915278d59e194545f90efbcfe1bfb75 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 23 Nov 2020 23:15:42 +1000 Subject: [PATCH] Decompile currentPlayerUpdateHead --- src/game/bondbike.c | 2 +- src/game/bondmove.c | 2 +- src/game/game_113220.c | 629 +++++++--------------------- src/include/game/data/data_01a3a0.h | 2 +- src/include/game/game_096b20.h | 2 +- src/include/game/game_113220.h | 2 +- src/include/lib/lib_1a500.h | 4 +- src/include/lib/lib_233c0.h | 2 +- src/include/types.h | 42 +- 9 files changed, 168 insertions(+), 519 deletions(-) diff --git a/src/game/bondbike.c b/src/game/bondbike.c index ac00fdce9..470a017d1 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -2216,7 +2216,7 @@ glabel var7f1adb9c /* f0d4164: 0fc44fc4 */ jal currentPlayerAdjustHeadAnimation /* f0d4168: afae0060 */ sw $t6,0x60($sp) /* f0d416c: 44806000 */ mtc1 $zero,$f12 -/* f0d4170: 0fc44e29 */ jal func0f1138a4 +/* f0d4170: 0fc44e29 */ jal currentPlayerUpdateHead /* f0d4174: 46006386 */ mov.s $f14,$f12 /* f0d4178: 8e0f0284 */ lw $t7,0x284($s0) /* f0d417c: 3c0143b4 */ lui $at,0x43b4 diff --git a/src/game/bondmove.c b/src/game/bondmove.c index f700f24b9..d548b554e 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -5579,7 +5579,7 @@ void func0f0cc3b8(f32 arg0, f32 arg1, f32 arg2, f32 *arg3, f32 arg4) arg2 = 0; } - func0f1138a4(sp244, arg2); + currentPlayerUpdateHead(sp244, arg2); func000162e8(BADDEG2RAD(360 - g_Vars.currentplayer->vv_verta360), sp180); if (optionsGetHeadRoll(g_Vars.currentplayerstats->mpindex)) { diff --git a/src/game/game_113220.c b/src/game/game_113220.c index 8db9721cb..34e91a40f 100644 --- a/src/game/game_113220.c +++ b/src/game/game_113220.c @@ -22,34 +22,7 @@ struct var80075c00 var80075c00[] = { { ANIM_29, 7.5, 17, 0, 1.5, 100 }, }; -u32 var80075c30 = 0x00000000; -u32 var80075c34 = 0x00000000; -u32 var80075c38 = 0x00000000; -u32 var80075c3c = 0x00000000; -u32 var80075c40 = 0x00000000; -u32 var80075c44 = 0x3f800000; -u32 var80075c48 = 0x00000000; -u32 var80075c4c = 0x3f800000; -u32 var80075c50 = 0x00000000; -u32 var80075c54 = 0x00000000; -u32 var80075c58 = 0x00000001; -u32 var80075c5c = 0x00000003; -u32 var80075c60 = 0x00000000; -u32 var80075c64 = 0x00000000; -u32 var80075c68 = 0x00000000; -u32 var80075c6c = 0x00000000; -u32 var80075c70 = 0x00000000; -u32 var80075c74 = 0x00000000; -u32 var80075c78 = 0x00000000; -u32 var80075c7c = 0x00000000; -u32 var80075c80 = 0x00000000; -u32 var80075c84 = 0x00000000; -u32 var80075c88 = 0x00000000; -u32 var80075c8c = 0x00000000; -u32 var80075c90 = 0x00000000; -u32 var80075c94 = 0x00000000; -u32 var80075c98 = 0x00000000; -u32 var80075c9c = 0x00000000; +struct coord var80075c30 = {0, 0, 0}; void currentPlayerFlipAnimation(void) { @@ -145,461 +118,151 @@ void currentPlayerSetHeadDamp(f32 headdamp) } } -GLOBAL_ASM( -glabel func0f1138a4 -.late_rodata -glabel var7f1b3a44 -.word 0x3f333333 -glabel var7f1b3a48 -.word 0x3dcccccd -glabel var7f1b3a4c -.word 0x3f19999a -glabel var7f1b3a50 -.word 0x3f199999 -glabel var7f1b3a54 -.word 0x3ecccccd -glabel var7f1b3a58 -.word 0x3ecccccd -glabel var7f1b3a5c -.word 0x3f666666 -glabel var7f1b3a60 -.word 0x3f7b645a -glabel var7f1b3a64 -.word 0x3f7f5b81 -glabel var7f1b3a68 -.word 0x3f75c28f -glabel var7f1b3a6c -.word 0x3f7f5b81 -glabel var7f1b3a70 -.word 0x3cccccce -glabel var7f1b3a74 -.word 0x3c088889 -.text -/* f1138a4: 27bdff18 */ addiu $sp,$sp,-232 -/* f1138a8: 3c0f8007 */ lui $t7,%hi(var80075c30) -/* f1138ac: afbf001c */ sw $ra,0x1c($sp) -/* f1138b0: afb00018 */ sw $s0,0x18($sp) -/* f1138b4: e7ac00e8 */ swc1 $f12,0xe8($sp) -/* f1138b8: e7ae00ec */ swc1 $f14,0xec($sp) -/* f1138bc: 25ef5c30 */ addiu $t7,$t7,%lo(var80075c30) -/* f1138c0: 8de10000 */ lw $at,0x0($t7) -/* f1138c4: 27ae00dc */ addiu $t6,$sp,0xdc -/* f1138c8: 8de80004 */ lw $t0,0x4($t7) -/* f1138cc: adc10000 */ sw $at,0x0($t6) -/* f1138d0: 8de10008 */ lw $at,0x8($t7) -/* f1138d4: 3c0a8007 */ lui $t2,%hi(var80075c3c) -/* f1138d8: 254a5c3c */ addiu $t2,$t2,%lo(var80075c3c) -/* f1138dc: adc80004 */ sw $t0,0x4($t6) -/* f1138e0: adc10008 */ sw $at,0x8($t6) -/* f1138e4: 8d410000 */ lw $at,0x0($t2) -/* f1138e8: 27a900d0 */ addiu $t1,$sp,0xd0 -/* f1138ec: 8d4d0004 */ lw $t5,0x4($t2) -/* f1138f0: ad210000 */ sw $at,0x0($t1) -/* f1138f4: 8d410008 */ lw $at,0x8($t2) -/* f1138f8: 3c188007 */ lui $t8,%hi(var80075c48) -/* f1138fc: 27185c48 */ addiu $t8,$t8,%lo(var80075c48) -/* f113900: ad2d0004 */ sw $t5,0x4($t1) -/* f113904: ad210008 */ sw $at,0x8($t1) -/* f113908: 8f010000 */ lw $at,0x0($t8) -/* f11390c: 27b900c4 */ addiu $t9,$sp,0xc4 -/* f113910: 8f080004 */ lw $t0,0x4($t8) -/* f113914: af210000 */ sw $at,0x0($t9) -/* f113918: 8f010008 */ lw $at,0x8($t8) -/* f11391c: 3c10800a */ lui $s0,%hi(g_Vars) -/* f113920: 44802000 */ mtc1 $zero,$f4 -/* f113924: 26109fc0 */ addiu $s0,$s0,%lo(g_Vars) -/* f113928: af280004 */ sw $t0,0x4($t9) -/* f11392c: af210008 */ sw $at,0x8($t9) -/* f113930: 8e0c0284 */ lw $t4,0x284($s0) -/* f113934: e7a400c0 */ swc1 $f4,0xc0($sp) -/* f113938: 8d8b047c */ lw $t3,0x47c($t4) -/* f11393c: 0c008de5 */ jal func00023794 -/* f113940: 85640000 */ lh $a0,0x0($t3) -/* f113944: 50400088 */ beqzl $v0,.L0f113b68 -/* f113948: 44800000 */ mtc1 $zero,$f0 -/* f11394c: 8e040284 */ lw $a0,0x284($s0) -/* f113950: 0c0074a2 */ jal modelGetAbsAnimSpeed -/* f113954: 2484045c */ addiu $a0,$a0,0x45c -/* f113958: 8e020284 */ lw $v0,0x284($s0) -/* f11395c: e7a000c0 */ swc1 $f0,0xc0($sp) -/* f113960: 3c0d8007 */ lui $t5,%hi(var80075c54) -/* f113964: 8c4303ac */ lw $v1,0x3ac($v0) -/* f113968: 25ad5c54 */ addiu $t5,$t5,%lo(var80075c54) -/* f11396c: 25ae003c */ addiu $t6,$t5,0x3c -/* f113970: 14600024 */ bnez $v1,.L0f113a04 -/* f113974: 27aa0080 */ addiu $t2,$sp,0x80 -/* f113978: 3c017f1b */ lui $at,%hi(var7f1b3a44) -/* f11397c: c4263a44 */ lwc1 $f6,%lo(var7f1b3a44)($at) -/* f113980: 3c017f1b */ lui $at,%hi(var7f1b3a48) -/* f113984: 4600303c */ c.lt.s $f6,$f0 -/* f113988: 00000000 */ nop -/* f11398c: 45000005 */ bc1f .L0f1139a4 -/* f113990: 00000000 */ nop -/* f113994: 3c013f80 */ lui $at,0x3f80 -/* f113998: 44814000 */ mtc1 $at,$f8 -/* f11399c: 10000015 */ b .L0f1139f4 -/* f1139a0: e44803b8 */ swc1 $f8,0x3b8($v0) -.L0f1139a4: -/* f1139a4: c4223a48 */ lwc1 $f2,%lo(var7f1b3a48)($at) -/* f1139a8: 3c017f1b */ lui $at,%hi(var7f1b3a58) -/* f1139ac: 4600103c */ c.lt.s $f2,$f0 -/* f1139b0: 00000000 */ nop -/* f1139b4: 4500000d */ bc1f .L0f1139ec -/* f1139b8: 00000000 */ nop -/* f1139bc: 46020281 */ sub.s $f10,$f0,$f2 -/* f1139c0: 3c017f1b */ lui $at,%hi(var7f1b3a4c) -/* f1139c4: c4303a4c */ lwc1 $f16,%lo(var7f1b3a4c)($at) -/* f1139c8: 3c017f1b */ lui $at,%hi(var7f1b3a50) -/* f1139cc: c4243a50 */ lwc1 $f4,%lo(var7f1b3a50)($at) -/* f1139d0: 46105482 */ mul.s $f18,$f10,$f16 -/* f1139d4: 3c017f1b */ lui $at,%hi(var7f1b3a54) -/* f1139d8: c4283a54 */ lwc1 $f8,%lo(var7f1b3a54)($at) -/* f1139dc: 46049183 */ div.s $f6,$f18,$f4 -/* f1139e0: 46083280 */ add.s $f10,$f6,$f8 -/* f1139e4: 10000003 */ b .L0f1139f4 -/* f1139e8: e44a03b8 */ swc1 $f10,0x3b8($v0) -.L0f1139ec: -/* f1139ec: c4303a58 */ lwc1 $f16,%lo(var7f1b3a58)($at) -/* f1139f0: e45003b8 */ swc1 $f16,0x3b8($v0) -.L0f1139f4: -/* f1139f4: 8e020284 */ lw $v0,0x284($s0) -/* f1139f8: c45203b8 */ lwc1 $f18,0x3b8($v0) -/* f1139fc: 10000012 */ b .L0f113a48 -/* f113a00: e45203bc */ swc1 $f18,0x3bc($v0) -.L0f113a04: -/* f113a04: 24010001 */ addiu $at,$zero,0x1 -/* f113a08: 14610008 */ bne $v1,$at,.L0f113a2c -/* f113a0c: 3c017f1b */ lui $at,%hi(var7f1b3a5c) -/* f113a10: c4243a5c */ lwc1 $f4,%lo(var7f1b3a5c)($at) -/* f113a14: 3c013f00 */ lui $at,0x3f00 -/* f113a18: 44813000 */ mtc1 $at,$f6 -/* f113a1c: e44403b8 */ swc1 $f4,0x3b8($v0) -/* f113a20: 8e090284 */ lw $t1,0x284($s0) -/* f113a24: 10000008 */ b .L0f113a48 -/* f113a28: e52603bc */ swc1 $f6,0x3bc($t1) -.L0f113a2c: -/* f113a2c: 3c013f80 */ lui $at,0x3f80 -/* f113a30: 44814000 */ mtc1 $at,$f8 -/* f113a34: 00000000 */ nop -/* f113a38: e44803b8 */ swc1 $f8,0x3b8($v0) -/* f113a3c: 8e020284 */ lw $v0,0x284($s0) -/* f113a40: c44a03b8 */ lwc1 $f10,0x3b8($v0) -/* f113a44: e44a03bc */ swc1 $f10,0x3bc($v0) -.L0f113a48: -/* f113a48: 8da10000 */ lw $at,0x0($t5) -/* f113a4c: 25ad000c */ addiu $t5,$t5,0xc -/* f113a50: 254a000c */ addiu $t2,$t2,0xc -/* f113a54: ad41fff4 */ sw $at,-0xc($t2) -/* f113a58: 8da1fff8 */ lw $at,-0x8($t5) -/* f113a5c: ad41fff8 */ sw $at,-0x8($t2) -/* f113a60: 8da1fffc */ lw $at,-0x4($t5) -/* f113a64: 15aefff8 */ bne $t5,$t6,.L0f113a48 -/* f113a68: ad41fffc */ sw $at,-0x4($t2) -/* f113a6c: 8da10000 */ lw $at,0x0($t5) -/* f113a70: 3c188007 */ lui $t8,%hi(var80075c94) -/* f113a74: 27185c94 */ addiu $t8,$t8,%lo(var80075c94) -/* f113a78: ad410000 */ sw $at,0x0($t2) -/* f113a7c: 8f010000 */ lw $at,0x0($t8) -/* f113a80: 27b90034 */ addiu $t9,$sp,0x34 -/* f113a84: 8f0c0004 */ lw $t4,0x4($t8) -/* f113a88: af210000 */ sw $at,0x0($t9) -/* f113a8c: 8f010008 */ lw $at,0x8($t8) -/* f113a90: af2c0004 */ sw $t4,0x4($t9) -/* f113a94: 0c0078aa */ jal func0001e2a8 -/* f113a98: af210008 */ sw $at,0x8($t9) -/* f113a9c: 8e0b0284 */ lw $t3,0x284($s0) -/* f113aa0: afa20030 */ sw $v0,0x30($sp) -/* f113aa4: 00002025 */ or $a0,$zero,$zero -/* f113aa8: 0c0078a7 */ jal func0001e29c -/* f113aac: ad6003a8 */ sw $zero,0x3a8($t3) -/* f113ab0: 8e040284 */ lw $a0,0x284($s0) -/* f113ab4: 8e050034 */ lw $a1,0x34($s0) -/* f113ab8: 24060001 */ addiu $a2,$zero,0x1 -/* f113abc: 0c007b86 */ jal func0001ee18 -/* f113ac0: 2484045c */ addiu $a0,$a0,0x45c -/* f113ac4: 0c0078a7 */ jal func0001e29c -/* f113ac8: 8fa40030 */ lw $a0,0x30($sp) -/* f113acc: 8e040284 */ lw $a0,0x284($s0) -/* f113ad0: 0c006cef */ jal func0001b3bc -/* f113ad4: 2484045c */ addiu $a0,$a0,0x45c -/* f113ad8: 0c00566c */ jal func000159b0 -/* f113adc: 27a40040 */ addiu $a0,$sp,0x40 -/* f113ae0: 8e020284 */ lw $v0,0x284($s0) -/* f113ae4: 27a90040 */ addiu $t1,$sp,0x40 -/* f113ae8: afa90080 */ sw $t1,0x80($sp) -/* f113aec: 244f0510 */ addiu $t7,$v0,0x510 -/* f113af0: afaf0090 */ sw $t7,0x90($sp) -/* f113af4: 27a40080 */ addiu $a0,$sp,0x80 -/* f113af8: 0c0073af */ jal func0001cebc -/* f113afc: 2445045c */ addiu $a1,$v0,0x45c -/* f113b00: 8e020284 */ lw $v0,0x284($s0) -/* f113b04: 27a50034 */ addiu $a1,$sp,0x34 -/* f113b08: c4500418 */ lwc1 $f16,0x418($v0) -/* f113b0c: e4500408 */ swc1 $f16,0x408($v0) -/* f113b10: 8e020284 */ lw $v0,0x284($s0) -/* f113b14: c452041c */ lwc1 $f18,0x41c($v0) -/* f113b18: e452040c */ swc1 $f18,0x40c($v0) -/* f113b1c: 8e020284 */ lw $v0,0x284($s0) -/* f113b20: c4440420 */ lwc1 $f4,0x420($v0) -/* f113b24: e4440410 */ swc1 $f4,0x410($v0) -/* f113b28: 8e040284 */ lw $a0,0x284($s0) -/* f113b2c: 0c006b43 */ jal modelGetRootPosition -/* f113b30: 2484045c */ addiu $a0,$a0,0x45c -/* f113b34: 8e020284 */ lw $v0,0x284($s0) -/* f113b38: c7a60034 */ lwc1 $f6,0x34($sp) -/* f113b3c: c7b0003c */ lwc1 $f16,0x3c($sp) -/* f113b40: c4480540 */ lwc1 $f8,0x540($v0) -/* f113b44: 27a50034 */ addiu $a1,$sp,0x34 -/* f113b48: 2444045c */ addiu $a0,$v0,0x45c -/* f113b4c: 46083281 */ sub.s $f10,$f6,$f8 -/* f113b50: e7aa0034 */ swc1 $f10,0x34($sp) -/* f113b54: c4520548 */ lwc1 $f18,0x548($v0) -/* f113b58: 46128101 */ sub.s $f4,$f16,$f18 -/* f113b5c: 0c006b4d */ jal modelSetRootPosition -/* f113b60: e7a4003c */ swc1 $f4,0x3c($sp) -/* f113b64: 44800000 */ mtc1 $zero,$f0 -.L0f113b68: -/* f113b68: c7a600c0 */ lwc1 $f6,0xc0($sp) -/* f113b6c: 4606003c */ c.lt.s $f0,$f6 -/* f113b70: 00000000 */ nop -/* f113b74: 4502006d */ bc1fl .L0f113d2c -/* f113b78: 8e020284 */ lw $v0,0x284($s0) -/* f113b7c: 8e020284 */ lw $v0,0x284($s0) -/* f113b80: c7aa00ec */ lwc1 $f10,0xec($sp) -/* f113b84: c4480540 */ lwc1 $f8,0x540($v0) -/* f113b88: 460a4400 */ add.s $f16,$f8,$f10 -/* f113b8c: e4500540 */ swc1 $f16,0x540($v0) -/* f113b90: 8e020284 */ lw $v0,0x284($s0) -/* f113b94: c7a400e8 */ lwc1 $f4,0xe8($sp) -/* f113b98: c4520548 */ lwc1 $f18,0x548($v0) -/* f113b9c: 46049182 */ mul.s $f6,$f18,$f4 -/* f113ba0: e4460548 */ swc1 $f6,0x548($v0) -/* f113ba4: 8e0e0034 */ lw $t6,0x34($s0) -/* f113ba8: 59c0000c */ blezl $t6,.L0f113bdc -/* f113bac: 8e020284 */ lw $v0,0x284($s0) -/* f113bb0: 8e020284 */ lw $v0,0x284($s0) -/* f113bb4: c60a004c */ lwc1 $f10,0x4c($s0) -/* f113bb8: c4480540 */ lwc1 $f8,0x540($v0) -/* f113bbc: 460a4403 */ div.s $f16,$f8,$f10 -/* f113bc0: e4500540 */ swc1 $f16,0x540($v0) -/* f113bc4: 8e020284 */ lw $v0,0x284($s0) -/* f113bc8: c604004c */ lwc1 $f4,0x4c($s0) -/* f113bcc: c4520548 */ lwc1 $f18,0x548($v0) -/* f113bd0: 46049183 */ div.s $f6,$f18,$f4 -/* f113bd4: e4460548 */ swc1 $f6,0x548($v0) -/* f113bd8: 8e020284 */ lw $v0,0x284($s0) -.L0f113bdc: -/* f113bdc: c4480540 */ lwc1 $f8,0x540($v0) -/* f113be0: c44a03b8 */ lwc1 $f10,0x3b8($v0) -/* f113be4: 460a4402 */ mul.s $f16,$f8,$f10 -/* f113be8: e7b000dc */ swc1 $f16,0xdc($sp) -/* f113bec: c4520544 */ lwc1 $f18,0x544($v0) -/* f113bf0: c4400414 */ lwc1 $f0,0x414($v0) -/* f113bf4: c44603b8 */ lwc1 $f6,0x3b8($v0) -/* f113bf8: 46009101 */ sub.s $f4,$f18,$f0 -/* f113bfc: 46062202 */ mul.s $f8,$f4,$f6 -/* f113c00: 46004280 */ add.s $f10,$f8,$f0 -/* f113c04: e7aa00e0 */ swc1 $f10,0xe0($sp) -/* f113c08: c45203b8 */ lwc1 $f18,0x3b8($v0) -/* f113c0c: c4500548 */ lwc1 $f16,0x548($v0) -/* f113c10: 46128102 */ mul.s $f4,$f16,$f18 -/* f113c14: e7a400e4 */ swc1 $f4,0xe4($sp) -/* f113c18: 8c4d03ac */ lw $t5,0x3ac($v0) -/* f113c1c: 05a20032 */ bltzl $t5,.L0f113ce8 -/* f113c20: c4520530 */ lwc1 $f18,0x530($v0) -/* f113c24: c4460530 */ lwc1 $f6,0x530($v0) -/* f113c28: c44803bc */ lwc1 $f8,0x3bc($v0) -/* f113c2c: 3c013f80 */ lui $at,0x3f80 -/* f113c30: 44810000 */ mtc1 $at,$f0 -/* f113c34: 46083282 */ mul.s $f10,$f6,$f8 -/* f113c38: 8e080038 */ lw $t0,0x38($s0) -/* f113c3c: e7aa00d0 */ swc1 $f10,0xd0($sp) -/* f113c40: c45203b8 */ lwc1 $f18,0x3b8($v0) -/* f113c44: c4500534 */ lwc1 $f16,0x534($v0) -/* f113c48: 46128102 */ mul.s $f4,$f16,$f18 -/* f113c4c: e7a400d4 */ swc1 $f4,0xd4($sp) -/* f113c50: c4460538 */ lwc1 $f6,0x538($v0) -/* f113c54: c44a03b8 */ lwc1 $f10,0x3b8($v0) -/* f113c58: 46003201 */ sub.s $f8,$f6,$f0 -/* f113c5c: 460a4402 */ mul.s $f16,$f8,$f10 -/* f113c60: 46008480 */ add.s $f18,$f16,$f0 -/* f113c64: e7b200d8 */ swc1 $f18,0xd8($sp) -/* f113c68: c44603b8 */ lwc1 $f6,0x3b8($v0) -/* f113c6c: c4440520 */ lwc1 $f4,0x520($v0) -/* f113c70: 46062202 */ mul.s $f8,$f4,$f6 -/* f113c74: e7a800c4 */ swc1 $f8,0xc4($sp) -/* f113c78: c44a0524 */ lwc1 $f10,0x524($v0) -/* f113c7c: c45203b8 */ lwc1 $f18,0x3b8($v0) -/* f113c80: 46005401 */ sub.s $f16,$f10,$f0 -/* f113c84: 46128102 */ mul.s $f4,$f16,$f18 -/* f113c88: 46002180 */ add.s $f6,$f4,$f0 -/* f113c8c: e7a600c8 */ swc1 $f6,0xc8($sp) -/* f113c90: c44a03b8 */ lwc1 $f10,0x3b8($v0) -/* f113c94: c4480528 */ lwc1 $f8,0x528($v0) -/* f113c98: 460a4402 */ mul.s $f16,$f8,$f10 -/* f113c9c: e7b000cc */ swc1 $f16,0xcc($sp) -/* f113ca0: 8c4a03b4 */ lw $t2,0x3b4($v0) -/* f113ca4: 0148c821 */ addu $t9,$t2,$t0 -/* f113ca8: ac5903b4 */ sw $t9,0x3b4($v0) -/* f113cac: 8e180284 */ lw $t8,0x284($s0) -/* f113cb0: 8f0c03b4 */ lw $t4,0x3b4($t8) -/* f113cb4: 2981003d */ slti $at,$t4,0x3d -/* f113cb8: 14200005 */ bnez $at,.L0f113cd0 -/* f113cbc: 3c017f1b */ lui $at,%hi(var7f1b3a60) -/* f113cc0: 0fc44df2 */ jal currentPlayerSetHeadDamp -/* f113cc4: c42c3a60 */ lwc1 $f12,%lo(var7f1b3a60)($at) -/* f113cc8: 10000087 */ b .L0f113ee8 -/* f113ccc: 00000000 */ nop -.L0f113cd0: -/* f113cd0: 3c017f1b */ lui $at,%hi(var7f1b3a64) -/* f113cd4: 0fc44df2 */ jal currentPlayerSetHeadDamp -/* f113cd8: c42c3a64 */ lwc1 $f12,%lo(var7f1b3a64)($at) -/* f113cdc: 10000082 */ b .L0f113ee8 -/* f113ce0: 00000000 */ nop -/* f113ce4: c4520530 */ lwc1 $f18,0x530($v0) -.L0f113ce8: -/* f113ce8: 3c017f1b */ lui $at,%hi(var7f1b3a68) -/* f113cec: c42c3a68 */ lwc1 $f12,%lo(var7f1b3a68)($at) -/* f113cf0: e7b200d0 */ swc1 $f18,0xd0($sp) -/* f113cf4: c4440534 */ lwc1 $f4,0x534($v0) -/* f113cf8: e7a400d4 */ swc1 $f4,0xd4($sp) -/* f113cfc: c4460538 */ lwc1 $f6,0x538($v0) -/* f113d00: e7a600d8 */ swc1 $f6,0xd8($sp) -/* f113d04: c4480520 */ lwc1 $f8,0x520($v0) -/* f113d08: e7a800c4 */ swc1 $f8,0xc4($sp) -/* f113d0c: c44a0524 */ lwc1 $f10,0x524($v0) -/* f113d10: e7aa00c8 */ swc1 $f10,0xc8($sp) -/* f113d14: c4500528 */ lwc1 $f16,0x528($v0) -/* f113d18: 0fc44df2 */ jal currentPlayerSetHeadDamp -/* f113d1c: e7b000cc */ swc1 $f16,0xcc($sp) -/* f113d20: 10000071 */ b .L0f113ee8 -/* f113d24: 00000000 */ nop -/* f113d28: 8e020284 */ lw $v0,0x284($s0) -.L0f113d2c: -/* f113d2c: 3c017f1b */ lui $at,%hi(var7f1b3a6c) -/* f113d30: c4520418 */ lwc1 $f18,0x418($v0) -/* f113d34: e4520408 */ swc1 $f18,0x408($v0) -/* f113d38: 8e020284 */ lw $v0,0x284($s0) -/* f113d3c: c444041c */ lwc1 $f4,0x41c($v0) -/* f113d40: e444040c */ swc1 $f4,0x40c($v0) -/* f113d44: 8e020284 */ lw $v0,0x284($s0) -/* f113d48: c4460420 */ lwc1 $f6,0x420($v0) -/* f113d4c: e4460410 */ swc1 $f6,0x410($v0) -/* f113d50: 8e020284 */ lw $v0,0x284($s0) -/* f113d54: e7a000dc */ swc1 $f0,0xdc($sp) -/* f113d58: c4480414 */ lwc1 $f8,0x414($v0) -/* f113d5c: e7a000e4 */ swc1 $f0,0xe4($sp) -/* f113d60: e7a800e0 */ swc1 $f8,0xe0($sp) -/* f113d64: ac4003b4 */ sw $zero,0x3b4($v0) -/* f113d68: 0fc44df2 */ jal currentPlayerSetHeadDamp -/* f113d6c: c42c3a6c */ lwc1 $f12,%lo(var7f1b3a6c)($at) -/* f113d70: 0fc331a0 */ jal currentPlayerGetCrouchPos -/* f113d74: 00000000 */ nop -/* f113d78: 1040005b */ beqz $v0,.L0f113ee8 -/* f113d7c: 00000000 */ nop -/* f113d80: 8e020284 */ lw $v0,0x284($s0) -/* f113d84: 3c017f1b */ lui $at,%hi(var7f1b3a70) -/* f113d88: c42a3a70 */ lwc1 $f10,%lo(var7f1b3a70)($at) -/* f113d8c: c4500198 */ lwc1 $f16,0x198($v0) -/* f113d90: 3c017f1b */ lui $at,%hi(var7f1b3a74) -/* f113d94: c4243a74 */ lwc1 $f4,%lo(var7f1b3a74)($at) -/* f113d98: 46105482 */ mul.s $f18,$f10,$f16 -/* f113d9c: c608004c */ lwc1 $f8,0x4c($s0) -/* f113da0: c4500424 */ lwc1 $f16,0x424($v0) -/* f113da4: 3c013f80 */ lui $at,0x3f80 -/* f113da8: 46122180 */ add.s $f6,$f4,$f18 -/* f113dac: 44819000 */ mtc1 $at,$f18 -/* f113db0: 46083282 */ mul.s $f10,$f6,$f8 -/* f113db4: 460a8100 */ add.s $f4,$f16,$f10 -/* f113db8: e4440424 */ swc1 $f4,0x424($v0) -/* f113dbc: 8e020284 */ lw $v0,0x284($s0) -/* f113dc0: c4400424 */ lwc1 $f0,0x424($v0) -/* f113dc4: 4600903e */ c.le.s $f18,$f0 -/* f113dc8: 00000000 */ nop -/* f113dcc: 4502000c */ bc1fl .L0f113e00 -/* f113dd0: 8c430458 */ lw $v1,0x458($v0) -/* f113dd4: 0fc44c8f */ jal currentPlayerUpdateIdleHeadRoll -/* f113dd8: 00000000 */ nop -/* f113ddc: 8e020284 */ lw $v0,0x284($s0) -/* f113de0: 3c013f80 */ lui $at,0x3f80 -/* f113de4: 44814000 */ mtc1 $at,$f8 -/* f113de8: c4460424 */ lwc1 $f6,0x424($v0) -/* f113dec: 46083401 */ sub.s $f16,$f6,$f8 -/* f113df0: e4500424 */ swc1 $f16,0x424($v0) -/* f113df4: 8e020284 */ lw $v0,0x284($s0) -/* f113df8: c4400424 */ lwc1 $f0,0x424($v0) -/* f113dfc: 8c430458 */ lw $v1,0x458($v0) -.L0f113e00: -/* f113e00: 44060000 */ mfc1 $a2,$f0 -/* f113e04: 27a700d0 */ addiu $a3,$sp,0xd0 -/* f113e08: 00035880 */ sll $t3,$v1,0x2 -/* f113e0c: 01635823 */ subu $t3,$t3,$v1 -/* f113e10: 000b1880 */ sll $v1,$t3,0x2 -/* f113e14: 00034823 */ negu $t1,$v1 -/* f113e18: 00492821 */ addu $a1,$v0,$t1 -/* f113e1c: 00432021 */ addu $a0,$v0,$v1 -/* f113e20: 24840428 */ addiu $a0,$a0,0x428 -/* f113e24: 0fc25ac8 */ jal func0f096b20 -/* f113e28: 24a50434 */ addiu $a1,$a1,0x434 -/* f113e2c: 8e020284 */ lw $v0,0x284($s0) -/* f113e30: 3c0140a0 */ lui $at,0x40a0 -/* f113e34: 44810000 */ mtc1 $at,$f0 -/* f113e38: c4440198 */ lwc1 $f4,0x198($v0) -/* f113e3c: 3c013f80 */ lui $at,0x3f80 -/* f113e40: 44811000 */ mtc1 $at,$f2 -/* f113e44: 46040482 */ mul.s $f18,$f0,$f4 -/* f113e48: c7aa00d0 */ lwc1 $f10,0xd0($sp) -/* f113e4c: c7b000d4 */ lwc1 $f16,0xd4($sp) -/* f113e50: 27a700c4 */ addiu $a3,$sp,0xc4 -/* f113e54: 46121180 */ add.s $f6,$f2,$f18 -/* f113e58: 46065202 */ mul.s $f8,$f10,$f6 -/* f113e5c: e7a800d0 */ swc1 $f8,0xd0($sp) -/* f113e60: c4440198 */ lwc1 $f4,0x198($v0) -/* f113e64: 46040482 */ mul.s $f18,$f0,$f4 -/* f113e68: 46121280 */ add.s $f10,$f2,$f18 -/* f113e6c: 460a8182 */ mul.s $f6,$f16,$f10 -/* f113e70: e7a600d4 */ swc1 $f6,0xd4($sp) -/* f113e74: 8c430458 */ lw $v1,0x458($v0) -/* f113e78: 8c460424 */ lw $a2,0x424($v0) -/* f113e7c: 00037880 */ sll $t7,$v1,0x2 -/* f113e80: 01e37823 */ subu $t7,$t7,$v1 -/* f113e84: 000f1880 */ sll $v1,$t7,0x2 -/* f113e88: 00037023 */ negu $t6,$v1 -/* f113e8c: 004e2821 */ addu $a1,$v0,$t6 -/* f113e90: 00432021 */ addu $a0,$v0,$v1 -/* f113e94: 24840440 */ addiu $a0,$a0,0x440 -/* f113e98: 0fc25ac8 */ jal func0f096b20 -/* f113e9c: 24a5044c */ addiu $a1,$a1,0x44c -/* f113ea0: 8e020284 */ lw $v0,0x284($s0) -/* f113ea4: 3c0140a0 */ lui $at,0x40a0 -/* f113ea8: 44810000 */ mtc1 $at,$f0 -/* f113eac: c4440198 */ lwc1 $f4,0x198($v0) -/* f113eb0: 3c013f80 */ lui $at,0x3f80 -/* f113eb4: 44814000 */ mtc1 $at,$f8 -/* f113eb8: 46040482 */ mul.s $f18,$f0,$f4 -/* f113ebc: c7aa00c4 */ lwc1 $f10,0xc4($sp) -/* f113ec0: 44812000 */ mtc1 $at,$f4 -/* f113ec4: 46124400 */ add.s $f16,$f8,$f18 -/* f113ec8: 46105182 */ mul.s $f6,$f10,$f16 -/* f113ecc: c7b000cc */ lwc1 $f16,0xcc($sp) -/* f113ed0: e7a600c4 */ swc1 $f6,0xc4($sp) -/* f113ed4: c4480198 */ lwc1 $f8,0x198($v0) -/* f113ed8: 46080482 */ mul.s $f18,$f0,$f8 -/* f113edc: 46122280 */ add.s $f10,$f4,$f18 -/* f113ee0: 460a8182 */ mul.s $f6,$f16,$f10 -/* f113ee4: e7a600cc */ swc1 $f6,0xcc($sp) -.L0f113ee8: -/* f113ee8: 0fc44d2f */ jal currentPlayerUpdateHeadPos -/* f113eec: 27a400dc */ addiu $a0,$sp,0xdc -/* f113ef0: 27a400d0 */ addiu $a0,$sp,0xd0 -/* f113ef4: 0fc44d6c */ jal currentPlayerUpdateHeadRot -/* f113ef8: 27a500c4 */ addiu $a1,$sp,0xc4 -/* f113efc: 8fbf001c */ lw $ra,0x1c($sp) -/* f113f00: 8fb00018 */ lw $s0,0x18($sp) -/* f113f04: 27bd00e8 */ addiu $sp,$sp,0xe8 -/* f113f08: 03e00008 */ jr $ra -/* f113f0c: 00000000 */ nop -); +void currentPlayerUpdateHead(f32 arg0, f32 arg1) +{ + struct coord headpos = var80075c30; + struct coord lookvel = {0, 0, 1}; + struct coord upvel = {0, 1, 0}; + f32 animspeed = 0; + + if (func00023794(g_Vars.currentplayer->model.anim->animnum)) { + animspeed = modelGetAbsAnimSpeed(&g_Vars.currentplayer->model); + + if (g_Vars.currentplayer->headanim == 0) { + if (animspeed > 0.69999998807907f) { + g_Vars.currentplayer->headamplitude = 1; + } else if (animspeed > 0.1f) { + g_Vars.currentplayer->headamplitude = 0.4f + (animspeed - 0.1f) * 0.60000002384186f / 0.59999996423721f; + } else { + g_Vars.currentplayer->headamplitude = 0.4f; + } + + g_Vars.currentplayer->sideamplitude = g_Vars.currentplayer->headamplitude; + } else { + if (g_Vars.currentplayer->headanim == 1) { + g_Vars.currentplayer->headamplitude = 0.89999997615814f; + g_Vars.currentplayer->sideamplitude = 0.5f; + } else { + g_Vars.currentplayer->headamplitude = 1; + g_Vars.currentplayer->sideamplitude = g_Vars.currentplayer->headamplitude; + } + } + + { + struct objticksp476 sp80 = {NULL, 1, 3}; + f32 sp40[16]; + struct coord modelpos = {0, 0, 0}; + bool somebool = func0001e2a8(); + + g_Vars.currentplayer->unk03a8 = false; + + func0001e29c(false); + func0001ee18(&g_Vars.currentplayer->model, g_Vars.lvupdate240, true); + func0001e29c(somebool); + func0001b3bc(&g_Vars.currentplayer->model); + func000159b0(sp40); + + sp80.matrix = sp40; + sp80.model0c = &g_Vars.currentplayer->unk0510; + func0001cebc(&sp80, &g_Vars.currentplayer->model); + + g_Vars.currentplayer->headbodyoffset.x = g_Vars.currentplayer->standbodyoffset.x; + g_Vars.currentplayer->headbodyoffset.y = g_Vars.currentplayer->standbodyoffset.y; + g_Vars.currentplayer->headbodyoffset.z = g_Vars.currentplayer->standbodyoffset.z; + + modelGetRootPosition(&g_Vars.currentplayer->model, &modelpos); + + modelpos.x -= g_Vars.currentplayer->unk0510.unk30; + modelpos.z -= g_Vars.currentplayer->unk0510.unk38; + + modelSetRootPosition(&g_Vars.currentplayer->model, &modelpos); + } + } + + if (animspeed > 0) { + g_Vars.currentplayer->unk0510.unk30 += arg1; + g_Vars.currentplayer->unk0510.unk38 *= arg0; + + if (g_Vars.lvupdate240 > 0) { + g_Vars.currentplayer->unk0510.unk30 /= g_Vars.lvupdate240freal; + g_Vars.currentplayer->unk0510.unk38 /= g_Vars.lvupdate240freal; + } + + headpos.x = g_Vars.currentplayer->unk0510.unk30 * g_Vars.currentplayer->headamplitude; + headpos.y = (g_Vars.currentplayer->unk0510.unk34 - g_Vars.currentplayer->standheight) * + g_Vars.currentplayer->headamplitude + g_Vars.currentplayer->standheight; + headpos.z = g_Vars.currentplayer->unk0510.unk38 * g_Vars.currentplayer->headamplitude; + + if (g_Vars.currentplayer->headanim >= 0) { + lookvel.x = g_Vars.currentplayer->unk0510.unk20 * g_Vars.currentplayer->sideamplitude; + lookvel.y = g_Vars.currentplayer->unk0510.unk24 * g_Vars.currentplayer->headamplitude; + lookvel.z = (g_Vars.currentplayer->unk0510.unk28 - 1.0f) * g_Vars.currentplayer->headamplitude + 1.0f; + + upvel.x = g_Vars.currentplayer->unk0510.unk10 * g_Vars.currentplayer->headamplitude; + upvel.y = (g_Vars.currentplayer->unk0510.unk14 - 1.0f) * g_Vars.currentplayer->headamplitude + 1.0f; + upvel.z = g_Vars.currentplayer->unk0510.unk18 * g_Vars.currentplayer->headamplitude; + + g_Vars.currentplayer->headwalkingtime60 += g_Vars.lvupdate240_60; + + if (g_Vars.currentplayer->headwalkingtime60 > 60) { + currentPlayerSetHeadDamp(0.982f); + } else { + currentPlayerSetHeadDamp(0.99748998880386f); + } + } else { + lookvel.x = g_Vars.currentplayer->unk0510.unk20; + lookvel.y = g_Vars.currentplayer->unk0510.unk24; + lookvel.z = g_Vars.currentplayer->unk0510.unk28; + + upvel.x = g_Vars.currentplayer->unk0510.unk10; + upvel.y = g_Vars.currentplayer->unk0510.unk14; + upvel.z = g_Vars.currentplayer->unk0510.unk18; + + currentPlayerSetHeadDamp(0.96f); + } + } else { + g_Vars.currentplayer->headbodyoffset.x = g_Vars.currentplayer->standbodyoffset.x; + g_Vars.currentplayer->headbodyoffset.y = g_Vars.currentplayer->standbodyoffset.y; + g_Vars.currentplayer->headbodyoffset.z = g_Vars.currentplayer->standbodyoffset.z; + + headpos.x = 0; + headpos.y = g_Vars.currentplayer->standheight; + headpos.z = 0; + + g_Vars.currentplayer->headwalkingtime60 = 0; + currentPlayerSetHeadDamp(0.99748998880386f); + + if (currentPlayerGetCrouchPos() != CROUCH_SQUAT) { + g_Vars.currentplayer->standfrac += + (0.0083333337679505f + 0.025000002235174f * g_Vars.currentplayer->bondbreathing) + * g_Vars.lvupdate240freal; + + if (g_Vars.currentplayer->standfrac >= 1) { + currentPlayerUpdateIdleHeadRoll(); + g_Vars.currentplayer->standfrac -= 1; + } + + func0f096b20( + &g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt], + &g_Vars.currentplayer->standlook[1 - g_Vars.currentplayer->standcnt], + g_Vars.currentplayer->standfrac, &lookvel); + + lookvel.x *= 1 + 5 * g_Vars.currentplayer->bondbreathing; + lookvel.y *= 1 + 5 * g_Vars.currentplayer->bondbreathing; + + func0f096b20( + &g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt], + &g_Vars.currentplayer->standup[1 - g_Vars.currentplayer->standcnt], + g_Vars.currentplayer->standfrac, &upvel); + + upvel.x *= 1 + 5 * g_Vars.currentplayer->bondbreathing; + upvel.z *= 1 + 5 * g_Vars.currentplayer->bondbreathing; + } + } + + currentPlayerUpdateHeadPos(&headpos); + currentPlayerUpdateHeadRot(&lookvel, &upvel); +} void currentPlayerAdjustHeadAnimation(f32 speed) { diff --git a/src/include/game/data/data_01a3a0.h b/src/include/game/data/data_01a3a0.h index a11b5ba60..17c8fc349 100644 --- a/src/include/game/data/data_01a3a0.h +++ b/src/include/game/data/data_01a3a0.h @@ -37,7 +37,7 @@ extern struct filelist *g_FileLists[4]; extern bool var80075bd0[4]; extern u32 var80075be0; extern struct var80075c00 var80075c00[]; -extern u32 var80075c30; +extern struct coord var80075c30; extern u32 var80075c3c; extern u32 var80075c48; extern u32 var80075c54; diff --git a/src/include/game/game_096b20.h b/src/include/game/game_096b20.h index 2f75c31fe..47c6d860e 100644 --- a/src/include/game/game_096b20.h +++ b/src/include/game/game_096b20.h @@ -3,7 +3,7 @@ #include #include "types.h" -u32 func0f096b20(void); +void func0f096b20(struct coord *arg0, struct coord *arg1, f32 standfrac, struct coord *vel); u32 func0f096b70(void); #endif diff --git a/src/include/game/game_113220.h b/src/include/game/game_113220.h index 0b6a65158..381a54f51 100644 --- a/src/include/game/game_113220.h +++ b/src/include/game/game_113220.h @@ -8,7 +8,7 @@ void currentPlayerUpdateIdleHeadRoll(void); void currentPlayerUpdateHeadPos(struct coord *vel); void currentPlayerUpdateHeadRot(struct coord *lookvel, struct coord *upvel); void currentPlayerSetHeadDamp(f32 headdamp); -void func0f1138a4(f32 arg0, f32 arg1); +void currentPlayerUpdateHead(f32 arg0, f32 arg1); void currentPlayerAdjustHeadAnimation(f32 speed); void currentPlayerStartDeathAnimation(s16 animnum, u32 flip, f32 fstarttime, f32 speed); void currentPlayerSetAnimSpeed(f32 speed); diff --git a/src/include/lib/lib_1a500.h b/src/include/lib/lib_1a500.h index 21c3e02d1..c5061fed8 100644 --- a/src/include/lib/lib_1a500.h +++ b/src/include/lib/lib_1a500.h @@ -73,8 +73,8 @@ void modelSetAnimPlaySpeed(struct model *model, f32 speed, f32 frame); void modelSetAnim70(struct model *model, void *callback); u32 func0001e018(void); u32 func0001e14c(void); -u32 func0001e29c(void); -u32 func0001e2a8(void); +void func0001e29c(bool arg0); +bool func0001e2a8(void); u32 func0001e2b4(void); void func0001ee18(struct model *model, s32 lvupdate240, bool arg2); u32 func0001f314(void); diff --git a/src/include/lib/lib_233c0.h b/src/include/lib/lib_233c0.h index 742c813bd..c36819ac9 100644 --- a/src/include/lib/lib_233c0.h +++ b/src/include/lib/lib_233c0.h @@ -7,7 +7,7 @@ void func000233c0(void); u32 func00023640(void); void func0002373c(void); s32 animGetNumFrames(s16 anim_id); -u32 func00023794(void); +bool func00023794(s16 animnum); u32 func000237dc(void); u32 func000237e8(void); s32 func0002384c(s32 animnum, s32 frame); diff --git a/src/include/types.h b/src/include/types.h index d517ef80d..cd0c6a01e 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -280,17 +280,18 @@ struct model0c { // matrix /*0x04*/ u32 unk04; /*0x08*/ u32 unk08; /*0x0c*/ u32 unk0c; - /*0x10*/ u32 unk10; - /*0x14*/ u32 unk14; - /*0x18*/ u32 unk18; + /*0x10*/ f32 unk10; + /*0x14*/ f32 unk14; + /*0x18*/ f32 unk18; /*0x1c*/ u32 unk1c; - /*0x20*/ u32 unk20; - /*0x24*/ u32 unk24; - /*0x28*/ u32 unk28; + /*0x20*/ f32 unk20; + /*0x24*/ f32 unk24; + /*0x28*/ f32 unk28; /*0x2c*/ u32 unk2c; - /*0x30*/ u32 unk30; - /*0x34*/ u32 unk34; + /*0x30*/ f32 unk30; + /*0x34*/ f32 unk34; /*0x38*/ f32 unk38; + /*0x3c*/ u32 unk3c; }; struct model { @@ -2364,12 +2365,12 @@ struct player { /*0x036c*/ struct playerbond bond2; /*0x03a0*/ bool resetheadpos; /*0x03a4*/ bool resetheadrot; - /*0x03a8*/ u32 unk03a8; + /*0x03a8*/ bool unk03a8; /*0x03ac*/ s32 headanim; /*0x03b0*/ f32 headdamp; - /*0x03b4*/ u32 unk03b4; - /*0x03b8*/ u32 unk03b8; - /*0x03bc*/ u32 unk03bc; + /*0x03b4*/ s32 headwalkingtime60; + /*0x03b8*/ f32 headamplitude; + /*0x03bc*/ f32 sideamplitude; /*0x03c0*/ struct coord headpos; /*0x03cc*/ struct coord headlook; /*0x03d8*/ struct coord headup; @@ -2420,22 +2421,7 @@ struct player { /*0x0504*/ u32 unk0504; /*0x0508*/ u32 unk0508; /*0x050c*/ u32 unk050c; - /*0x0510*/ u32 unk0510; - /*0x0514*/ u32 unk0514; - /*0x0518*/ u32 unk0518; - /*0x051c*/ u32 unk051c; - /*0x0520*/ u32 unk0520; - /*0x0524*/ u32 unk0524; - /*0x0528*/ u32 unk0528; - /*0x052c*/ u32 unk052c; - /*0x0530*/ u32 unk0530; - /*0x0534*/ u32 unk0534; - /*0x0538*/ u32 unk0538; - /*0x053c*/ u32 unk053c; - /*0x0540*/ u32 unk0540; - /*0x0544*/ u32 unk0544; - /*0x0548*/ u32 unk0548; - /*0x054c*/ u32 unk054c; + /*0x0510*/ struct model0c unk0510; /*0x0550*/ u32 unk0550; /*0x0554*/ u32 unk0554; /*0x0558*/ u32 unk0558;