From cf9841d39f775f4c9f42e18297aa6d523df359d5 Mon Sep 17 00:00:00 2001 From: tomas <93524600+TommiRommi@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:41:17 +0000 Subject: [PATCH] small changes. One matching func, Two nonmatching funcs (#355) * Various decomp and non_matchings. --- .../code_80027D00/func_80037CFC.s | 327 ------------- include/common_structs.h | 8 +- include/mk64.h | 2 + src/audio/external.h | 1 + src/code_80027D00.c | 452 +++++++----------- src/code_80027D00.h | 2 + 6 files changed, 194 insertions(+), 598 deletions(-) delete mode 100644 asm/non_matchings/code_80027D00/func_80037CFC.s diff --git a/asm/non_matchings/code_80027D00/func_80037CFC.s b/asm/non_matchings/code_80027D00/func_80037CFC.s deleted file mode 100644 index bbcc38ba3..000000000 --- a/asm/non_matchings/code_80027D00/func_80037CFC.s +++ /dev/null @@ -1,327 +0,0 @@ -glabel func_80037CFC -/* 0388FC 80037CFC 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 038900 80037D00 AFBF001C */ sw $ra, 0x1c($sp) -/* 038904 80037D04 AFB00018 */ sw $s0, 0x18($sp) -/* 038908 80037D08 AFA50024 */ sw $a1, 0x24($sp) -/* 03890C 80037D0C AFA60028 */ sw $a2, 0x28($sp) -/* 038910 80037D10 8C8200BC */ lw $v0, 0xbc($a0) -/* 038914 80037D14 24010080 */ li $at, 128 -/* 038918 80037D18 00808025 */ move $s0, $a0 -/* 03891C 80037D1C 30430080 */ andi $v1, $v0, 0x80 -/* 038920 80037D20 106100E9 */ beq $v1, $at, .L800380C8 -/* 038924 80037D24 304E0040 */ andi $t6, $v0, 0x40 -/* 038928 80037D28 24010040 */ li $at, 64 -/* 03892C 80037D2C 11C100E6 */ beq $t6, $at, .L800380C8 -/* 038930 80037D30 304F0400 */ andi $t7, $v0, 0x400 -/* 038934 80037D34 24010400 */ li $at, 1024 -/* 038938 80037D38 11E100E3 */ beq $t7, $at, .L800380C8 -/* 03893C 80037D3C 30584000 */ andi $t8, $v0, 0x4000 -/* 038940 80037D40 24014000 */ li $at, 16384 -/* 038944 80037D44 130100E0 */ beq $t8, $at, .L800380C8 -/* 038948 80037D48 3C060100 */ lui $a2, 0x100 -/* 03894C 80037D4C 0046C824 */ and $t9, $v0, $a2 -/* 038950 80037D50 10D900DD */ beq $a2, $t9, .L800380C8 -/* 038954 80037D54 3C070200 */ lui $a3, 0x200 -/* 038958 80037D58 00474024 */ and $t0, $v0, $a3 -/* 03895C 80037D5C 10E800DA */ beq $a3, $t0, .L800380C8 -/* 038960 80037D60 3C040001 */ lui $a0, 1 -/* 038964 80037D64 00444824 */ and $t1, $v0, $a0 -/* 038968 80037D68 108900D7 */ beq $a0, $t1, .L800380C8 -/* 03896C 80037D6C 3C040002 */ lui $a0, 2 -/* 038970 80037D70 00445024 */ and $t2, $v0, $a0 -/* 038974 80037D74 508A00D5 */ beql $a0, $t2, .L800380CC -/* 038978 80037D78 30584000 */ andi $t8, $v0, 0x4000 -/* 03897C 80037D7C 3C030400 */ lui $v1, 0x400 -/* 038980 80037D80 00435824 */ and $t3, $v0, $v1 -/* 038984 80037D84 106B001B */ beq $v1, $t3, .L80037DF4 -/* 038988 80037D88 304C0008 */ andi $t4, $v0, 8 -/* 03898C 80037D8C 24010008 */ li $at, 8 -/* 038990 80037D90 11810018 */ beq $t4, $at, .L80037DF4 -/* 038994 80037D94 304D0002 */ andi $t5, $v0, 2 -/* 038998 80037D98 24010002 */ li $at, 2 -/* 03899C 80037D9C 11A10015 */ beq $t5, $at, .L80037DF4 -/* 0389A0 80037DA0 304E0010 */ andi $t6, $v0, 0x10 -/* 0389A4 80037DA4 24010010 */ li $at, 16 -/* 0389A8 80037DA8 51C10013 */ beql $t6, $at, .L80037DF8 -/* 0389AC 80037DAC 8E0200BC */ lw $v0, 0xbc($s0) -/* 0389B0 80037DB0 94B80006 */ lhu $t8, 6($a1) -/* 0389B4 80037DB4 33190010 */ andi $t9, $t8, 0x10 -/* 0389B8 80037DB8 5320000F */ beql $t9, $zero, .L80037DF8 -/* 0389BC 80037DBC 8E0200BC */ lw $v0, 0xbc($s0) -/* 0389C0 80037DC0 0C00AA94 */ jal func_8002AA50 -/* 0389C4 80037DC4 02002025 */ move $a0, $s0 -/* 0389C8 80037DC8 96020000 */ lhu $v0, ($s0) -/* 0389CC 80037DCC 24014000 */ li $at, 16384 -/* 0389D0 80037DD0 30484000 */ andi $t0, $v0, 0x4000 -/* 0389D4 80037DD4 15010007 */ bne $t0, $at, .L80037DF4 -/* 0389D8 80037DD8 30490100 */ andi $t1, $v0, 0x100 -/* 0389DC 80037DDC 24010100 */ li $at, 256 -/* 0389E0 80037DE0 11210004 */ beq $t1, $at, .L80037DF4 -/* 0389E4 80037DE4 93A4002B */ lbu $a0, 0x2b($sp) -/* 0389E8 80037DE8 3C051900 */ lui $a1, (0x19008000 >> 16) # lui $a1, 0x1900 -/* 0389EC 80037DEC 0C032418 */ jal func_800C9060 -/* 0389F0 80037DF0 34A58000 */ ori $a1, (0x19008000 & 0xFFFF) # ori $a1, $a1, 0x8000 -.L80037DF4: -/* 0389F4 80037DF4 8E0200BC */ lw $v0, 0xbc($s0) -.L80037DF8: -/* 0389F8 80037DF8 24010008 */ li $at, 8 -/* 0389FC 80037DFC 02002025 */ move $a0, $s0 -/* 038A00 80037E00 304A0008 */ andi $t2, $v0, 8 -/* 038A04 80037E04 11410006 */ beq $t2, $at, .L80037E20 -/* 038A08 80037E08 304B0002 */ andi $t3, $v0, 2 -/* 038A0C 80037E0C 8FA50024 */ lw $a1, 0x24($sp) -/* 038A10 80037E10 0C00CEB8 */ jal func_80033AE0 -/* 038A14 80037E14 83A6002B */ lb $a2, 0x2b($sp) -/* 038A18 80037E18 1000000F */ b .L80037E58 -/* 038A1C 80037E1C 8E0200BC */ lw $v0, 0xbc($s0) -.L80037E20: -/* 038A20 80037E20 24010002 */ li $at, 2 -/* 038A24 80037E24 1561000C */ bne $t3, $at, .L80037E58 -/* 038A28 80037E28 3C0140A0 */ li $at, 0x40A00000 # 5.000000 -/* 038A2C 80037E2C 44812000 */ mtc1 $at, $f4 -/* 038A30 80037E30 C6060124 */ lwc1 $f6, 0x124($s0) -/* 038A34 80037E34 02002025 */ move $a0, $s0 -/* 038A38 80037E38 8FA50024 */ lw $a1, 0x24($sp) -/* 038A3C 80037E3C 4604303E */ c.le.s $f6, $f4 -/* 038A40 80037E40 00000000 */ nop -/* 038A44 80037E44 45020005 */ bc1fl .L80037E5C -/* 038A48 80037E48 2401FFFE */ li $at, -2 -/* 038A4C 80037E4C 0C00CEB8 */ jal func_80033AE0 -/* 038A50 80037E50 83A6002B */ lb $a2, 0x2b($sp) -/* 038A54 80037E54 8E0200BC */ lw $v0, 0xbc($s0) -.L80037E58: -/* 038A58 80037E58 2401FFFE */ li $at, -2 -.L80037E5C: -/* 038A5C 80037E5C 00416024 */ and $t4, $v0, $at -/* 038A60 80037E60 000C6AC0 */ sll $t5, $t4, 0xb -/* 038A64 80037E64 AE0C00BC */ sw $t4, 0xbc($s0) -/* 038A68 80037E68 05A0002F */ bltz $t5, .L80037F28 -/* 038A6C 80037E6C 01801025 */ move $v0, $t4 -/* 038A70 80037E70 318E0004 */ andi $t6, $t4, 4 -/* 038A74 80037E74 15C0002C */ bnez $t6, .L80037F28 -/* 038A78 80037E78 3C014140 */ li $at, 0x41400000 # 12.000000 -/* 038A7C 80037E7C 44814000 */ mtc1 $at, $f8 -/* 038A80 80037E80 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038A84 80037E84 44818000 */ mtc1 $at, $f16 -/* 038A88 80037E88 C60A0094 */ lwc1 $f10, 0x94($s0) -/* 038A8C 80037E8C 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 038A90 80037E90 44812000 */ mtc1 $at, $f4 -/* 038A94 80037E94 46105483 */ div.s $f18, $f10, $f16 -/* 038A98 80037E98 8FAF0024 */ lw $t7, 0x24($sp) -/* 038A9C 80037E9C 46049182 */ mul.s $f6, $f18, $f4 -/* 038AA0 80037EA0 4608303E */ c.le.s $f6, $f8 -/* 038AA4 80037EA4 00000000 */ nop -/* 038AA8 80037EA8 45020013 */ bc1fl .L80037EF8 -/* 038AAC 80037EAC 304A0020 */ andi $t2, $v0, 0x20 -/* 038AB0 80037EB0 95E30004 */ lhu $v1, 4($t7) -/* 038AB4 80037EB4 30788000 */ andi $t8, $v1, 0x8000 -/* 038AB8 80037EB8 1300000E */ beqz $t8, .L80037EF4 -/* 038ABC 80037EBC 30794000 */ andi $t9, $v1, 0x4000 -/* 038AC0 80037EC0 1320000C */ beqz $t9, .L80037EF4 -/* 038AC4 80037EC4 35880020 */ ori $t0, $t4, 0x20 -/* 038AC8 80037EC8 31090020 */ andi $t1, $t0, 0x20 -/* 038ACC 80037ECC 24010020 */ li $at, 32 -/* 038AD0 80037ED0 AE0800BC */ sw $t0, 0xbc($s0) -/* 038AD4 80037ED4 11210007 */ beq $t1, $at, .L80037EF4 -/* 038AD8 80037ED8 01001025 */ move $v0, $t0 -/* 038ADC 80037EDC 3C0142C8 */ li $at, 0x42C80000 # 100.000000 -/* 038AE0 80037EE0 44818000 */ mtc1 $at, $f16 -/* 038AE4 80037EE4 C60A009C */ lwc1 $f10, 0x9c($s0) -/* 038AE8 80037EE8 01001025 */ move $v0, $t0 -/* 038AEC 80037EEC 46105480 */ add.s $f18, $f10, $f16 -/* 038AF0 80037EF0 E612009C */ swc1 $f18, 0x9c($s0) -.L80037EF4: -/* 038AF4 80037EF4 304A0020 */ andi $t2, $v0, 0x20 -.L80037EF8: -/* 038AF8 80037EF8 24010020 */ li $at, 32 -/* 038AFC 80037EFC 1541000A */ bne $t2, $at, .L80037F28 -/* 038B00 80037F00 8FAB0024 */ lw $t3, 0x24($sp) -/* 038B04 80037F04 95630004 */ lhu $v1, 4($t3) -/* 038B08 80037F08 2401FFDF */ li $at, -33 -/* 038B0C 80037F0C 00417024 */ and $t6, $v0, $at -/* 038B10 80037F10 306C4000 */ andi $t4, $v1, 0x4000 -/* 038B14 80037F14 11800003 */ beqz $t4, .L80037F24 -/* 038B18 80037F18 306D8000 */ andi $t5, $v1, 0x8000 -/* 038B1C 80037F1C 55A00003 */ bnel $t5, $zero, .L80037F2C -/* 038B20 80037F20 860F0044 */ lh $t7, 0x44($s0) -.L80037F24: -/* 038B24 80037F24 AE0E00BC */ sw $t6, 0xbc($s0) -.L80037F28: -/* 038B28 80037F28 860F0044 */ lh $t7, 0x44($s0) -.L80037F2C: -/* 038B2C 80037F2C 24010001 */ li $at, 1 -/* 038B30 80037F30 8FB90024 */ lw $t9, 0x24($sp) -/* 038B34 80037F34 31F80001 */ andi $t8, $t7, 1 -/* 038B38 80037F38 53010029 */ beql $t8, $at, .L80037FE0 -/* 038B3C 80037F3C 8E0200BC */ lw $v0, 0xbc($s0) -/* 038B40 80037F40 97280004 */ lhu $t0, 4($t9) -/* 038B44 80037F44 3C0A800E */ lui $t2, %hi(gModeSelection) # $t2, 0x800e -/* 038B48 80037F48 31098000 */ andi $t1, $t0, 0x8000 -/* 038B4C 80037F4C 11200007 */ beqz $t1, .L80037F6C -/* 038B50 80037F50 00000000 */ nop -/* 038B54 80037F54 0C00C3F2 */ jal func_80030FC8 -/* 038B58 80037F58 02002025 */ move $a0, $s0 -/* 038B5C 80037F5C 0C00C380 */ jal func_80030E00 -/* 038B60 80037F60 02002025 */ move $a0, $s0 -/* 038B64 80037F64 1000000F */ b .L80037FA4 -/* 038B68 80037F68 8FAB0024 */ lw $t3, 0x24($sp) -.L80037F6C: -/* 038B6C 80037F6C 8D4AC53C */ lw $t2, %lo(gModeSelection)($t2) -/* 038B70 80037F70 24010003 */ li $at, 3 -/* 038B74 80037F74 3C054000 */ lui $a1, 0x4000 -/* 038B78 80037F78 15410005 */ bne $t2, $at, .L80037F90 -/* 038B7C 80037F7C 02002025 */ move $a0, $s0 -/* 038B80 80037F80 0C00C7D2 */ jal func_80031F48 -/* 038B84 80037F84 02002025 */ move $a0, $s0 -/* 038B88 80037F88 10000003 */ b .L80037F98 -/* 038B8C 80037F8C 00000000 */ nop -.L80037F90: -/* 038B90 80037F90 0C00C7D2 */ jal func_80031F48 -/* 038B94 80037F94 3C053F80 */ lui $a1, 0x3f80 -.L80037F98: -/* 038B98 80037F98 0C00C30D */ jal func_80030C34 -/* 038B9C 80037F9C 02002025 */ move $a0, $s0 -/* 038BA0 80037FA0 8FAB0024 */ lw $t3, 0x24($sp) -.L80037FA4: -/* 038BA4 80037FA4 956C0004 */ lhu $t4, 4($t3) -/* 038BA8 80037FA8 318D4000 */ andi $t5, $t4, 0x4000 -/* 038BAC 80037FAC 51A00008 */ beql $t5, $zero, .L80037FD0 -/* 038BB0 80037FB0 44802000 */ mtc1 $zero, $f4 -/* 038BB4 80037FB4 0C00C8F9 */ jal func_800323E4 -/* 038BB8 80037FB8 02002025 */ move $a0, $s0 -/* 038BBC 80037FBC 0C00C887 */ jal func_8003221C -/* 038BC0 80037FC0 02002025 */ move $a0, $s0 -/* 038BC4 80037FC4 10000006 */ b .L80037FE0 -/* 038BC8 80037FC8 8E0200BC */ lw $v0, 0xbc($s0) -/* 038BCC 80037FCC 44802000 */ mtc1 $zero, $f4 -.L80037FD0: -/* 038BD0 80037FD0 02002025 */ move $a0, $s0 -/* 038BD4 80037FD4 0C00C814 */ jal func_80032050 -/* 038BD8 80037FD8 E604020C */ swc1 $f4, 0x20c($s0) -/* 038BDC 80037FDC 8E0200BC */ lw $v0, 0xbc($s0) -.L80037FE0: -/* 038BE0 80037FE0 000272C0 */ sll $t6, $v0, 0xb -/* 038BE4 80037FE4 05C0006C */ bltz $t6, .L80038198 -/* 038BE8 80037FE8 304F0004 */ andi $t7, $v0, 4 -/* 038BEC 80037FEC 55E0006B */ bnel $t7, $zero, .L8003819C -/* 038BF0 80037FF0 8FBF001C */ lw $ra, 0x1c($sp) -/* 038BF4 80037FF4 0C00E22C */ jal func_800388B0 -/* 038BF8 80037FF8 8FA40024 */ lw $a0, 0x24($sp) -/* 038BFC 80037FFC 2841FFCF */ slti $at, $v0, -0x31 -/* 038C00 80038000 1020001F */ beqz $at, .L80038080 -/* 038C04 80038004 3C0140A0 */ li $at, 0x40A00000 # 5.000000 -/* 038C08 80038008 44814000 */ mtc1 $at, $f8 -/* 038C0C 8003800C 3C014190 */ li $at, 0x41900000 # 18.000000 -/* 038C10 80038010 44815000 */ mtc1 $at, $f10 -/* 038C14 80038014 C6060094 */ lwc1 $f6, 0x94($s0) -/* 038C18 80038018 3C014358 */ li $at, 0x43580000 # 216.000000 -/* 038C1C 8003801C 44819000 */ mtc1 $at, $f18 -/* 038C20 80038020 460A3403 */ div.s $f16, $f6, $f10 -/* 038C24 80038024 8FB80024 */ lw $t8, 0x24($sp) -/* 038C28 80038028 46128102 */ mul.s $f4, $f16, $f18 -/* 038C2C 8003802C 4608203E */ c.le.s $f4, $f8 -/* 038C30 80038030 00000000 */ nop -/* 038C34 80038034 45000012 */ bc1f .L80038080 -/* 038C38 80038038 00000000 */ nop -/* 038C3C 8003803C 97190004 */ lhu $t9, 4($t8) -/* 038C40 80038040 3C01430C */ li $at, 0x430C0000 # 140.000000 -/* 038C44 80038044 33284000 */ andi $t0, $t9, 0x4000 -/* 038C48 80038048 1100000D */ beqz $t0, .L80038080 -/* 038C4C 8003804C 00000000 */ nop -/* 038C50 80038050 44810000 */ mtc1 $at, $f0 -/* 038C54 80038054 3C0141C8 */ li $at, 0x41C80000 # 25.000000 -/* 038C58 80038058 44815000 */ mtc1 $at, $f10 -/* 038C5C 8003805C 46000182 */ mul.s $f6, $f0, $f0 -/* 038C60 80038060 86090044 */ lh $t1, 0x44($s0) -/* 038C64 80038064 44809000 */ mtc1 $zero, $f18 -/* 038C68 80038068 E600009C */ swc1 $f0, 0x9c($s0) -/* 038C6C 8003806C 352A0001 */ ori $t2, $t1, 1 -/* 038C70 80038070 A60A0044 */ sh $t2, 0x44($s0) -/* 038C74 80038074 E612020C */ swc1 $f18, 0x20c($s0) -/* 038C78 80038078 460A3403 */ div.s $f16, $f6, $f10 -/* 038C7C 8003807C E610008C */ swc1 $f16, 0x8c($s0) -.L80038080: -/* 038C80 80038080 0C00E22C */ jal func_800388B0 -/* 038C84 80038084 8FA40024 */ lw $a0, 0x24($sp) -/* 038C88 80038088 2841FFE3 */ slti $at, $v0, -0x1d -/* 038C8C 8003808C 10200005 */ beqz $at, .L800380A4 -/* 038C90 80038090 8FAB0024 */ lw $t3, 0x24($sp) -/* 038C94 80038094 956C0004 */ lhu $t4, 4($t3) -/* 038C98 80038098 318D4000 */ andi $t5, $t4, 0x4000 -/* 038C9C 8003809C 55A0003F */ bnel $t5, $zero, .L8003819C -/* 038CA0 800380A0 8FBF001C */ lw $ra, 0x1c($sp) -.L800380A4: -/* 038CA4 800380A4 86020044 */ lh $v0, 0x44($s0) -/* 038CA8 800380A8 24010001 */ li $at, 1 -/* 038CAC 800380AC 304E0001 */ andi $t6, $v0, 1 -/* 038CB0 800380B0 15C10039 */ bne $t6, $at, .L80038198 -/* 038CB4 800380B4 304FFFFE */ andi $t7, $v0, 0xfffe -/* 038CB8 800380B8 44804000 */ mtc1 $zero, $f8 -/* 038CBC 800380BC A60F0044 */ sh $t7, 0x44($s0) -/* 038CC0 800380C0 10000035 */ b .L80038198 -/* 038CC4 800380C4 E608009C */ swc1 $f8, 0x9c($s0) -.L800380C8: -/* 038CC8 800380C8 30584000 */ andi $t8, $v0, 0x4000 -.L800380CC: -/* 038CCC 800380CC 24014000 */ li $at, 16384 -/* 038CD0 800380D0 3C060100 */ lui $a2, 0x100 -/* 038CD4 800380D4 17010014 */ bne $t8, $at, .L80038128 -/* 038CD8 800380D8 3C070200 */ lui $a3, 0x200 -/* 038CDC 800380DC 8FB90024 */ lw $t9, 0x24($sp) -/* 038CE0 800380E0 02002025 */ move $a0, $s0 -/* 038CE4 800380E4 97280004 */ lhu $t0, 4($t9) -/* 038CE8 800380E8 31098000 */ andi $t1, $t0, 0x8000 -/* 038CEC 800380EC 11200008 */ beqz $t1, .L80038110 -/* 038CF0 800380F0 00000000 */ nop -/* 038CF4 800380F4 0C00C3F2 */ jal func_80030FC8 -/* 038CF8 800380F8 02002025 */ move $a0, $s0 -/* 038CFC 800380FC 8E0200BC */ lw $v0, 0xbc($s0) -/* 038D00 80038100 3C070200 */ lui $a3, 0x200 -/* 038D04 80038104 3C060100 */ lui $a2, 0x100 -/* 038D08 80038108 10000007 */ b .L80038128 -/* 038D0C 8003810C 30430080 */ andi $v1, $v0, 0x80 -.L80038110: -/* 038D10 80038110 0C00C7D2 */ jal func_80031F48 -/* 038D14 80038114 3C0540A0 */ lui $a1, 0x40a0 -/* 038D18 80038118 8E0200BC */ lw $v0, 0xbc($s0) -/* 038D1C 8003811C 3C070200 */ lui $a3, 0x200 -/* 038D20 80038120 3C060100 */ lui $a2, 0x100 -/* 038D24 80038124 30430080 */ andi $v1, $v0, 0x80 -.L80038128: -/* 038D28 80038128 24010080 */ li $at, 128 -/* 038D2C 8003812C 10610008 */ beq $v1, $at, .L80038150 -/* 038D30 80038130 304A0040 */ andi $t2, $v0, 0x40 -/* 038D34 80038134 24010040 */ li $at, 64 -/* 038D38 80038138 11410005 */ beq $t2, $at, .L80038150 -/* 038D3C 8003813C 00465824 */ and $t3, $v0, $a2 -/* 038D40 80038140 10CB0003 */ beq $a2, $t3, .L80038150 -/* 038D44 80038144 00476024 */ and $t4, $v0, $a3 -/* 038D48 80038148 54EC0014 */ bnel $a3, $t4, .L8003819C -/* 038D4C 8003814C 8FBF001C */ lw $ra, 0x1c($sp) -.L80038150: -/* 038D50 80038150 8FAD0024 */ lw $t5, 0x24($sp) -/* 038D54 80038154 95AE0004 */ lhu $t6, 4($t5) -/* 038D58 80038158 31CF8000 */ andi $t7, $t6, 0x8000 -/* 038D5C 8003815C 11E00008 */ beqz $t7, .L80038180 -/* 038D60 80038160 00000000 */ nop -/* 038D64 80038164 0C00C380 */ jal func_80030E00 -/* 038D68 80038168 02002025 */ move $a0, $s0 -/* 038D6C 8003816C 02002025 */ move $a0, $s0 -/* 038D70 80038170 0C00CCBA */ jal func_800332E8 -/* 038D74 80038174 83A5002B */ lb $a1, 0x2b($sp) -/* 038D78 80038178 10000008 */ b .L8003819C -/* 038D7C 8003817C 8FBF001C */ lw $ra, 0x1c($sp) -.L80038180: -/* 038D80 80038180 0C00C30D */ jal func_80030C34 -/* 038D84 80038184 02002025 */ move $a0, $s0 -/* 038D88 80038188 02002025 */ move $a0, $s0 -/* 038D8C 8003818C 3C0540A0 */ lui $a1, 0x40a0 -/* 038D90 80038190 0C00CDF3 */ jal func_800337CC -/* 038D94 80038194 83A6002B */ lb $a2, 0x2b($sp) -.L80038198: -/* 038D98 80038198 8FBF001C */ lw $ra, 0x1c($sp) -.L8003819C: -/* 038D9C 8003819C 8FB00018 */ lw $s0, 0x18($sp) -/* 038DA0 800381A0 27BD0020 */ addiu $sp, $sp, 0x20 -/* 038DA4 800381A4 03E00008 */ jr $ra -/* 038DA8 800381A8 00000000 */ nop diff --git a/include/common_structs.h b/include/common_structs.h index a7a66c44f..7b3db41d7 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -12,6 +12,12 @@ typedef s16 Vec4s[4]; typedef f32 Mat3[3][3]; typedef f32 Mat4[4][4]; +// might not be real, used by func_8002C954 +typedef struct +{ + f32 x, y, z; +} Vec3fs; + #define COURSE_NULL 0xFF typedef enum { @@ -327,7 +333,7 @@ typedef struct { /* 0x0244 */ u16 unk_244[4]; // [0] Active texture group /* 0x024C */ u16 unk_24C[4]; /* 0x0254 */ u16 characterId; - /* 0x0256 */ s16 unk_256; + /* 0x0256 */ u16 unk_256; /* 0x0258 */ UnkPlayerStruct258 unk_258[40]; /* 0x0D98 */ s16 unk_D98; /* 0x0D9A */ s16 unk_D9A; diff --git a/include/mk64.h b/include/mk64.h index 2ee6eed95..6b299596c 100644 --- a/include/mk64.h +++ b/include/mk64.h @@ -26,4 +26,6 @@ #define SET_HIGH_S16_OF_32(var, x) ((((s16 *)&(var))[0]) = (x)) #endif +#define SQUARE(x) ((x) * (x)) + #endif // MK64_H diff --git a/src/audio/external.h b/src/audio/external.h index 78ce26135..1a91f0712 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -146,6 +146,7 @@ void func_800CA388(u8); void func_800CA414(u16, u16); void func_800CA49C(u8); void func_800CAACC(u8); +void func_800CAEC4(u8, f32); void func_800CB134(); void func_800CB2C4(void); void func_800C5CB8(void); diff --git a/src/code_80027D00.c b/src/code_80027D00.c index b2c2a2536..335bbb773 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "variables.h" #include "kart_attributes.h" #include "memory.h" @@ -2056,71 +2057,66 @@ void func_8002C7E4(Player *player, s8 arg1, s8 arg2) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_800CAEC4(u8, f32); /* extern */ - -void func_8002C954(Player *player, s8 arg1, f32 *arg2) { - f32 *temp_v0_3; +#ifdef NON_MATCHING +void func_8002C954(Player *player, s8 arg1, Vec3fs *arg2) { f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_4; - f32 temp_f14; - f32 temp_f2; f32 var_f14; - f64 temp_f0_3; - s16 temp_t1; - s16 temp_v0_2; - s32 temp_v0; - s32 temp_v1; - - temp_v0 = player->unk_0BC; - temp_v1 = temp_v0 & 0x10000; + Vec3fs *new_var; + temp_f0 = player->pos[1] - player->unk_074; - if ((((temp_v1 != 0x10000) && ((temp_v0 & 0x100000) == 0x100000)) || (((temp_f0 >= 20.0f) || (temp_f0 < -1.0f)) && (temp_v1 == 0) && (temp_v0 & 8)) || ((player->unk_110.unk34 == 0) && (temp_v1 == 0))) && ((temp_v0_2 = player->unk_0CA, ((temp_v0_2 & 2) == 0)) || !(temp_v0_2 & 8))) { - func_8008F494(player, arg1); + if ((((player->unk_0BC & 0x10000) != 0x10000) && + ((player->unk_0BC & 0x100000) == 0x100000) || + ((((temp_f0 >= 20.0f) || + (temp_f0 < (-1.0f))) && + ((player->unk_0BC & 0x10000) == 0)) && + (player->unk_0BC & 8)) || + ((player->unk_110.unk34 == 0) && + ((player->unk_0BC & 0x10000) == 0))) && + (((player->unk_0CA & 2) == 0) || + (!(player->unk_0CA & 8)))) { + func_8008F494(player, arg1); } if ((player->unk_046 & 0x20) != 0x20) { - if ((player->unk_110.unk3C < -1.0f) || (player->unk_110.unk40 < -1.0f)) { + if ((player->unk_110.unk3C[0] < (-1.0f)) || (player->unk_110.unk3C[1] < (-1.0f))) { player->unk_256 = 1; } player->unk_046 |= 0x20; } + new_var = arg2; if (((player->unk_000 & 0x4000) == 0x4000) && (((player->unk_094 / 18.0f) * 216.0f) > 30.0f)) { func_8001CA24(player, 3.0f); } - temp_t1 = (u16) player->unk_256 + 1; player->unk_046 |= 0x10; - player->unk_256 = temp_t1; - if ((temp_t1 & 0xFFFF) >= 0xA) { + player->unk_256++; + if (player->unk_256 >= 0xA) { player->unk_256 = 0; } if ((player->unk_0C4 >= 0) && (((player->unk_094 / 18.0f) * 216.0f) > 5.0f)) { func_80031F48(player, 18.0f); } if ((player->unk_000 & 0x4000) == 0x4000) { - temp_v0_3 = D_80165070[arg1]; - temp_f0_2 = temp_v0_3->unk0 - arg2->unk0; - temp_f14 = temp_v0_3->unk4 - arg2->unk4; - temp_f2 = temp_v0_3->unk8 - arg2->unk8; - var_f14 = sqrtf((temp_f0_2 * temp_f0_2) + (temp_f14 * temp_f14) + (temp_f2 * temp_f2)) / 3.0f; - if ((f64) var_f14 >= 1.0) { + Vec3fs *vec = &D_80165070[arg1]; + var_f14 = sqrtf((((vec->x - arg2->x) * (vec->x - arg2->x)) + ((vec->y - new_var->y) * (vec->y - new_var->y))) + ((vec->z - arg2->z) * (vec->z - arg2->z))) / 3; + if (var_f14 >= 1.0) { var_f14 = 1.0f; } - temp_f0_3 = (f64) var_f14; - if ((temp_f0_3 <= 0.6) && (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && !(player->unk_000 & 0x100)) { - func_800CAEC4((u8) arg1, 0.6f); + if ((var_f14 <= 0.6) && + (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && + (!(player->unk_000 & 0x100))) { + func_800CAEC4(arg1, 0.6F); } else if (!(player->unk_000 & 0x100)) { - if ((temp_f0_3 <= 0.6) && (temp_f0_4 = (player->unk_094 / 18.0f) * 216.0f, (temp_f0_4 < 40.0f)) && (temp_f0_4 >= 10.0f)) { - func_800CAEC4((u8) arg1, 0.3f); + if ((var_f14 <= 0.6) && + (((player->unk_094 / 18.0f) * 216.0f) < 40.0f) && + (((player->unk_094 / 18.0f) * 216.0f) >= 10.0f)) { + func_800CAEC4(arg1, 0.3F); } else { - func_800CAEC4((u8) arg1, var_f14); + func_800CAEC4(arg1, var_f14); } } } if (player->unk_0BC & 0x2000) { func_8008D554(player); - player->unk_08C /= 2.0f; + player->unk_08C /= 2; } } #else @@ -5234,124 +5230,108 @@ void func_80037BB4(Player *player, Vec3f arg1) { } } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80030C34(Player *); /* extern */ -? func_80033AE0(Player *, struct Controller *, s8); /* extern */ -s32 func_800388B0(struct Controller *); /* extern */ - -void func_80037CFC(Player *player, struct Controller *controller, u8 arg2) { - s16 temp_v0_4; - s32 temp_t0; - s32 temp_t4; - s32 temp_v0_2; - s32 temp_v0_3; - s32 var_v0; - s32 var_v0_2; - s32 var_v1; - u16 temp_v0; - u16 temp_v1; - u16 temp_v1_2; - - var_v0 = player->unk_0BC; - var_v1 = var_v0 & 0x80; - if ((var_v1 != 0x80) && ((var_v0 & 0x40) != 0x40) && ((var_v0 & 0x400) != 0x400) && ((var_v0 & 0x4000) != 0x4000) && ((var_v0 & 0x01000000) != 0x01000000) && ((var_v0 & 0x02000000) != 0x02000000) && ((var_v0 & 0x10000) != 0x10000) && ((var_v0 & 0x20000) != 0x20000)) { - if (((var_v0 & 0x04000000) != 0x04000000) && ((var_v0 & 8) != 8) && ((var_v0 & 2) != 2) && ((var_v0 & 0x10) != 0x10) && (controller->buttonPressed & 0x10)) { - func_8002AA50(player); - temp_v0 = player->unk_000; - if (((temp_v0 & 0x4000) == 0x4000) && ((temp_v0 & 0x100) != 0x100)) { - func_800C9060(arg2, 0x19008000U); +void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { + if (((player->unk_0BC & 0x80) != 0x80) && + ((player->unk_0BC & 0x40) != 0x40) && + ((player->unk_0BC & 0x400) != 0x400) && + ((player->unk_0BC & 0x4000) != 0x4000) && + ((player->unk_0BC & 0x01000000) != 0x01000000) && + ((player->unk_0BC & 0x02000000) != 0x02000000) && ((player->unk_0BC & 0x10000) != 0x10000) && + ((player->unk_0BC & 0x20000) != 0x20000)) { + if (((player->unk_0BC & 0x04000000) != 0x04000000) && + ((player->unk_0BC & 8) != 8) && + ((player->unk_0BC & 2) != 2) && + ((player->unk_0BC & 0x10) != 0x10) && + (controller->buttonPressed & 0x10)) { + func_8002AA50(player); + if (((player->unk_000 & 0x4000) == 0x4000) && ((player->unk_000 & 0x100) != 0x100)) { + func_800C9060(arg2, 0x19008000); + } } - } - temp_v0_2 = player->unk_0BC; - if ((temp_v0_2 & 8) != 8) { - func_80033AE0(player, controller, (s8) arg2); - } else if (((temp_v0_2 & 2) == 2) && (player->unk_110.unk3C[2] <= 5.0f)) { - func_80033AE0(player, controller, (s8) arg2); - } - temp_t4 = player->unk_0BC & ~1; - player->unk_0BC = temp_t4; - var_v0_2 = temp_t4; - if (!(temp_t4 & 0x100000) && !(temp_t4 & 4)) { - if (((player->unk_094 / 18.0f) * 216.0f) <= 12.0f) { - temp_v1 = controller->button; - if (temp_v1 & 0x8000) { - temp_t0 = temp_t4 | 0x20; - if (temp_v1 & 0x4000) { - player->unk_0BC = temp_t0; - var_v0_2 = temp_t0; - if ((temp_t0 & 0x20) != 0x20) { - var_v0_2 = temp_t0; - player->unk_09C += 100.0f; + if ((player->unk_0BC & 8) != 8) { + func_80033AE0(player, controller, arg2); + } else if (((player->unk_0BC & 2) == 2) && (player->unk_110.unk3C[2] <= 5.0f)) { + func_80033AE0(player, controller, arg2); + } + player->unk_0BC &= ~1; + if ((!(player->unk_0BC & 0x100000)) && (!(player->unk_0BC & 4))) { + if (((player->unk_094 / 18.0f) * 216.0f) <= 12.0f) { + if (controller->button & 0x8000) { + if (controller->button & 0x4000) { + player->unk_0BC |= 0x20; + if ((player->unk_0BC & 0x20) != 0x20) { + player->unk_09C += 100.0f; + } } } } + if (((player->unk_0BC & 0x20) == 0x20) && + (((controller->button & 0x4000) == 0) || + (!(controller->button & 0x8000)))) { + player->unk_0BC &= ~0x20; + } } - if (((var_v0_2 & 0x20) == 0x20) && ((temp_v1_2 = controller->button, ((temp_v1_2 & 0x4000) == 0)) || !(temp_v1_2 & 0x8000))) { - player->unk_0BC = var_v0_2 & ~0x20; - } - } - if ((player->unk_044 & 1) != 1) { - if (controller->button & 0x8000) { - func_80030FC8(player); - func_80030E00(player); - } else { - if (gModeSelection == 3) { - func_80031F48(player, 2.0f); + if ((player->unk_044 & 1) != 1) { + if (controller->button & 0x8000) { + func_80030FC8(player); + func_80030E00(player); } else { - func_80031F48(player, 1.0f); + if (gModeSelection == 3) + { + func_80031F48(player, 2.0f); + } + else + { + func_80031F48(player, 1.0f); + } + func_80030C34(player); } - func_80030C34(player); - } - if (controller->button & 0x4000) { - func_800323E4(player); - func_8003221C(player); - } else { - player->unk_20C = 0.0f; - func_80032050(player); - } - } - temp_v0_3 = player->unk_0BC; - if (!(temp_v0_3 & 0x100000) && !(temp_v0_3 & 4)) { - if ((func_800388B0(controller) < -0x31) && (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) && (controller->button & 0x4000)) { - player->unk_09C = 140.0f; - player->unk_044 |= 1; - player->unk_20C = 0.0f; - player->unk_08C = (140.0f * 140.0f) / 25.0f; - } - if ((func_800388B0(controller) >= -0x1D) || !(controller->button & 0x4000)) { - temp_v0_4 = player->unk_044; - if ((temp_v0_4 & 1) == 1) { - player->unk_044 = temp_v0_4 & 0xFFFE; - player->unk_09C = 0.0f; + if (controller->button & 0x4000) { + func_800323E4(player); + func_8003221C(player); + } else { + player->unk_20C = 0.0f; + func_80032050(player); + } + } + if ((!(player->unk_0BC & 0x100000)) && (!(player->unk_0BC & 4))) { + if (((func_800388B0(controller) < (-0x31)) && + (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f)) && + (controller->button & 0x4000)) { + player->unk_09C = 140.0f; + player->unk_044 |= 1; + player->unk_08C = (player->unk_09C * player->unk_09C) / 25.0f; + player->unk_20C = 0.0f; + } + if ((func_800388B0(controller) >= -0x1D) || (!(controller->button & 0x4000))) { + if ((player->unk_044 & 1) == 1) { + player->unk_044 &= 0xFFFE; + player->unk_09C = 0.0f; + } } } - } } else { - if ((var_v0 & 0x4000) == 0x4000) { + if ((player->unk_0BC & 0x4000) == 0x4000){ if (controller->button & 0x8000) { func_80030FC8(player); - var_v0 = player->unk_0BC; } else { func_80031F48(player, 5.0f); - var_v0 = player->unk_0BC; } - var_v1 = var_v0 & 0x80; } - if ((var_v1 == 0x80) || ((var_v0 & 0x40) == 0x40) || ((var_v0 & 0x01000000) == 0x01000000) || ((var_v0 & 0x02000000) == 0x02000000)) { - if (controller->button & 0x8000) { - func_80030E00(player); - func_800332E8(player, (s32) (s8) arg2); - return; - } - func_80030C34(player); - func_800337CC(player, 5.0f, (s32) (s8) arg2); + if (((((player->unk_0BC & 0x80) == 0x80) || + ((player->unk_0BC & 0x40) == 0x40)) || + ((player->unk_0BC & 0x01000000) == 0x01000000)) || + ((player->unk_0BC & 0x02000000) == 0x02000000)) { + if (controller->button & 0x8000) { + func_80030E00(player); + func_800332E8(player, arg2); + return; + } + func_80030C34(player); + func_800337CC(player, 5.0f, arg2); } } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037CFC.s") -#endif void func_800381AC(Player *player, struct Controller *controller, s8 arg2) { if (((player->unk_000 & 0x8000) == 0x8000) && @@ -5389,13 +5369,13 @@ void func_800382DC(void) { u16 temp_v0_5; u16 temp_v0_6; - switch (gActiveScreenMode) { /* irregular */ + switch (gActiveScreenMode) { case SCREEN_MODE_1P: - switch (gModeSelection) { /* switch 1; irregular */ - case 0: /* switch 1 */ + switch (gModeSelection) { + case 0: func_800381AC(gPlayerOne, gControllerOne, 0); return; - case 1: /* switch 1 */ + case 1: if (D_8015F890 != 1) { func_800381AC(gPlayerOne, gControllerOne, 0); temp_v0_3 = gPlayerTwo->unk_000; @@ -5560,28 +5540,10 @@ void func_80038BE4(Player *player, s16 arg1) { player->unk_08C = (player->unk_09C * player->unk_09C) / 25.0f; } -#ifdef MIPS_TO_C -//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b -? func_80029B4C(Player *, f32, f32, f32); /* extern */ -? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ -? func_8002C4F8(Player *, s8); /* extern */ -? func_8002C954(Player *, s8, f32 *); /* extern */ -? func_8002CD48(Player *, s8, s8); /* extern */ -static ? D_800E4328; /* unable to generate initializer */ -static ? D_800E4334; /* unable to generate initializer */ -static ? D_800E4340; /* unable to generate initializer */ -static ? D_800E434C; /* unable to generate initializer */ - +#ifdef NON_MATCHING +// 70.22% matching +// really could use some working void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { - f32 sp11C; - f32 sp114; - f32 sp110; - f32 sp10C; - f32 sp108; - f32 spFC; - f32 spF8; - f32 spF4; - f32 spF0; f32 spEC; f32 spE8; f32 spE4; @@ -5595,108 +5557,64 @@ void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 sp8C; f32 sp88; f32 sp7C; - f32 *sp50; - f32 *temp_a1; - f32 *temp_v0_2; - f32 *temp_v0_3; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f0_4; - f32 temp_f10; - f32 temp_f10_2; - f32 temp_f12_2; - f32 temp_f16; - f32 temp_f2_2; - f32 temp_f2_3; - f32 temp_f2_4; - f32 temp_f4; - f32 temp_f8; - f64 temp_f0; - f64 temp_f12; - f64 temp_f2; - s16 temp_v0; - s32 temp_t6; - - sp114.unk0 = D_800E4328.unk0; - sp114.unk4 = (s32) D_800E4328.unk4; - sp114.unk8 = (s32) D_800E4328.unk8; - sp108.unk0 = D_800E4334.unk0; - sp108.unk4 = (s32) D_800E4334.unk4; - sp108.unk8 = (s32) D_800E4334.unk8; - spFC.unk0 = D_800E4340.unk0; - spFC.unk4 = (s32) D_800E4340.unk4; - spFC.unk8 = (s32) D_800E4340.unk8; - spF0.unk0 = D_800E434C.unk0; - spF0.unk4 = (s32) D_800E434C.unk4; - spF0.unk8 = (s32) D_800E434C.unk8; + f32 divOptimize; + + // data + Vec3f sp114 = {0.0, 0.0, 1.0}; + Vec3f sp108 = {0.0, 0.0, 0.0}; + Vec3f spFC = {0.0, 0.0, 0.0}; + Vec3f spF0 = {0.0, 0.0, 0.0}; + player->unk_084 = -10.0f; player->unk_088 = 28.0f; player->unk_214 = 250.0f; func_8002B830(player, arg3, arg2); func_8002CD48(player, arg3, arg2); - player->unk_02E += player->unk_078; - spF0 = 0.0f; - spF4 = 0.0f; - spF8 = 0.0f; + player->unk_02C[1] += player->unk_078; + spF0[0] = 0.0f; + spF0[1] = 0.0f; + spF0[2] = 0.0f; func_8002AB70(player); - temp_a1 = player->unk_174[0]; - spA4 = (spFC + player->unk_064) * 0.0f; + spA4 = (spFC[0] + player->unk_064) * 0.0f; spA0 = player->kartGravity * -1.0f; - sp110 = 0.0f; - sp10C = 0.0f; - sp108 = 0.0f; - sp50 = temp_a1; - sp9C = (sp104 + player->unk_06C) * 0.0f; - func_802B63B8(&sp108, (f32 (*)[3]) temp_a1); - spA4 += sp108; - sp9C += sp110; - sp11C = player->unk_08C; - func_802B63B8(&sp114, (f32 (*)[3]) sp50); - sp88 = player->unk_034[0]; - temp_f8 = player->unk_034[1]; - sp8C = temp_f8; - temp_f0 = (f64) sp88; - sp90 = player->unk_034[2]; - temp_f2 = (f64) sp90; - sp88 = (f32) (temp_f0 + ((((f64) (sp114 + spA4 + spF0) - (temp_f0 * (0.12 * (f64) player->kartFriction))) / 6000.0) / 1.0)); - temp_f12 = (f64) temp_f8; - sp90 = (f32) (temp_f2 + ((((f64) (sp11C + sp9C + spF8) - (temp_f2 * (0.12 * (f64) player->kartFriction))) / 6000.0) / 1.0)); - sp8C = (f32) (temp_f12 + ((((f64) (sp118 + spA0 + spF4) - (temp_f12 * (0.12 * (f64) player->kartFriction))) / 6000.0) / 1.0)); - temp_v0 = player->unk_044; - if ((temp_v0 & 0x10) == 0x10) { - player->unk_044 = temp_v0 & 0xFFEF; + sp108[2] = 0.0f; + sp108[1] = 0.0f; + sp108[0] = 0.0f; + sp9C = (spFC[2] + player->unk_06C) * 0.0f; + func_802B63B8(sp108, player->unk_174); + spA4 += sp108[0]; + sp9C += sp108[2]; + sp114[2] = player->unk_08C; + func_802B63B8(sp114, player->unk_174); + sp88 = (player->unk_034[0] + ((((((sp114[0] + spA4) + spF0[0])) - (player->unk_034[0] * (0.12 * (player->kartFriction)))) / 6000.0) / 1.0)); + sp90 = (player->unk_034[2] + ((((((sp114[2] + sp9C) + spF0[2])) - (player->unk_034[2] * (0.12 * (player->kartFriction)))) / 6000.0) / 1.0)); + sp8C = (player->unk_034[1] + ((((((sp114[1] + spA0) + spF0[1])) - (player->unk_034[1] * (0.12 * (player->kartFriction)))) / 6000.0) / 1.0)); + if ((player->unk_044 & 0x10) == 0x10) { + player->unk_044 &= 0xFFEF; } - temp_f0_2 = player->pos[0]; - spE0 = temp_f0_2; - temp_f2_2 = player->pos[1]; - temp_f16 = player->pos[2]; - player->rotX = temp_f0_2; - player->rotY = temp_f2_2; - player->rotZ = temp_f16; - spEC = player->unk_034[0] + temp_f0_2; - spE8 = player->unk_034[1] + temp_f2_2; - spD8 = temp_f16; - temp_f4 = player->unk_034[2] + temp_f16; - spE4 = temp_f4; + player->rotX = player->pos[0]; + player->rotY = player->pos[1]; + player->rotZ = player->pos[2]; + spEC = player->unk_034[0] + player->pos[0]; + spE8 = player->unk_034[1] + player->pos[1]; + spD8 = player->pos[2]; + spE4 = player->unk_034[2] + player->pos[2]; func_8002AAC0(player); - temp_f10 = spE8 + player->kartHopVelocity; - spE8 = temp_f10; - temp_f10_2 = (f32) ((f64) temp_f10 - 0.02); - spE8 = temp_f10_2; - func_802AD950(&player->unk_110, player->boundingBoxSize, spEC, temp_f10_2, temp_f4, player->rotX, player->rotY, player->rotZ); + spE8 += player->kartHopVelocity; + spE8 -= 0.02; + func_802AD950(&player->unk_110, player->boundingBoxSize, spEC, spE8, spE4, player->rotX, player->rotY, player->rotZ); player->unk_058 = 0.0f; player->unk_060 = 0.0f; player->unk_05C = 1.0f; - func_802B6540((f32 (*)[3]) sp50, 0.0f, 1.0f, 0.0f, (s16) (s32) player->unk_02E); + func_802B6540(player->unk_174, 0.0f, 1.0f, 0.0f, player->unk_02C[1]); player->unk_0BC |= 8; player->unk_0C2 += 1; sp98 = player->unk_110.unk3C[2]; if (sp98 <= 0.0f) { player->unk_0C2 = 0; - temp_t6 = player->unk_0BC & ~2; - player->unk_0BC = temp_t6; - player->unk_0BC = temp_t6 & ~8; - player->kartHopVelocity = (f32) player->unk_0C2; + player->unk_0BC &= ~2; + player->unk_0BC &= ~8; + player->kartHopVelocity = player->unk_0C2; } sp98 = player->unk_110.unk3C[2]; if (sp98 <= 0.0f) { @@ -5720,46 +5638,40 @@ void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { } } player->unk_074 = func_802ABE30(spEC, spE8, spE4, player->unk_110.unk3A); - func_80029B4C(player, spEC, spE8, spE4); + func_80029B4C(player, &spEC, &spE8, &spE4); func_8002AE38(player, arg3, spE0, spD8, spEC, spE4); player->unk_22C = player->unk_094; player->unk_094 = sqrtf((sp90 * sp90) + (sp88 * sp88)); player->pos[0] = spEC; player->pos[2] = spE4; player->pos[1] = spE8; - player->unk_064 = sp108; - player->unk_06C = sp110; + player->unk_064 = sp108[0]; + player->unk_06C = sp108[2]; player->unk_034[0] = sp88; player->unk_034[1] = sp8C; player->unk_034[2] = sp90; - temp_v0_2 = D_80165070[arg3]; - temp_v0_2->unk0 = sp88; - temp_v0_2->unk4 = sp8C; - temp_v0_2->unk8 = sp90; + D_80165070[arg3][0] = sp88; + D_80165070[arg3][1] = sp8C; + D_80165070[arg3][2] = sp90; if ((player->unk_000 & 0x4000) == 0x4000) { - temp_f2_3 = player->unk_094; - temp_v0_3 = &gKartTopSpeedTable[player->characterId]; - temp_f12_2 = *temp_v0_3; - if (temp_f12_2 < temp_f2_3) { - temp_f0_3 = temp_f12_2 / temp_f2_3; - player->unk_034[0] *= temp_f0_3; - player->unk_034[1] *= temp_f0_3; - player->unk_034[2] *= temp_f0_3; - player->unk_094 = *temp_v0_3; + if (gKartTopSpeedTable[player->characterId] < player->unk_094) { + divOptimize = gKartTopSpeedTable[player->characterId] / player->unk_094; + player->unk_034[0] *= divOptimize; + player->unk_034[1] *= divOptimize; + player->unk_034[2] *= divOptimize; + player->unk_094 = gKartTopSpeedTable[player->characterId]; } } - if ((player->unk_044 & 1) == 1) { - temp_f2_4 = player->unk_094; - if (temp_f2_4 > 1.0f) { - temp_f0_4 = 1.0f / temp_f2_4; + if ((player->unk_044 & 1) == 1){ + if (player->unk_094 > 1.0f){ player->unk_094 = 1.0f; - player->unk_034[0] *= temp_f0_4; - player->unk_034[1] *= temp_f0_4; - player->unk_034[2] *= temp_f0_4; + player->unk_034[0] *= 1.0f / player->unk_094; + player->unk_034[1] *= 1.0f / player->unk_094; + player->unk_034[2] *= 1.0f / player->unk_094; } } if (player->unk_110.unk3C[2] >= 500.0f) { - player->unk_078 = (s16) ((s16) player->unk_078 / 2); + player->unk_078 = (s16) player->unk_078 / 2; } func_8002C4F8(player, arg3); } diff --git a/src/code_80027D00.h b/src/code_80027D00.h index b332c46cc..72fe717e0 100644 --- a/src/code_80027D00.h +++ b/src/code_80027D00.h @@ -68,10 +68,12 @@ void func_8003777C(Player*, Vec3f, Vec3f); void func_800378E8(Player*, Vec3f, Vec3f); void func_80037A4C(Player*, Vec3f, Vec3f); void func_80037BB4(Player*player, Vec3f); +void func_80033AE0(Player*, struct Controller*, s8); void func_800382DC(); s16 func_80038534(struct Controller*); s16 func_800388B0(struct Controller*); void func_80038BE4(Player*, s16); +void func_80038C6C(Player*, Camera*, s8, s8); /* This is where I'd put my static data, if I had any */