diff options
| author | Tyler McGavran <tyler.taggerung@gmail.com> | 2022-10-09 21:08:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-09 18:08:15 -0700 |
| commit | cc4b5bfcd2864e22933ea20dfc3891eed52eb1fe (patch) | |
| tree | 17624fa576c42533e5783e9e459111697be938ec /src | |
| parent | b7e7b34998c13eec3d61b8aa4afdacf9bc25edfc (diff) | |
Some matches and m2c refreshing for code_80027D00 (#264)
Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/code_80027D00.c | 3459 | ||||
| -rw-r--r-- | src/code_80027D00.h | 15 |
2 files changed, 1487 insertions, 1987 deletions
diff --git a/src/code_80027D00.c b/src/code_80027D00.c index 91ccd0184..e15be8bdb 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -4,6 +4,7 @@ #include "variables.h" #include "kart_attributes.h" #include "memory.h" +#include "math_util.h" #include "code_8001F980.h" #include "code_80027D00.h" #include "code_8008C1D0.h" @@ -1086,92 +1087,71 @@ void func_80029B4C(Player *player, f32 arg1, f32 arg2, f32 arg3) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80029B4C.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; +#ifdef NEEDS_RODATA +// data_0DD0A0_1_1.s +// might be plain data? +extern f32 D_800DDBD4[8];// = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; void func_8002A194(Player *player, f32 arg1, f32 arg2, f32 arg3) { - s16 sp3A; - f32 sp30; - s32 sp28; - f32 temp_f0; - f32 temp_f0_2; + s32 stackPadding[2]; f32 temp_f12; - f32 temp_f12_2; - f32 temp_f12_3; - f32 temp_f12_4; - f32 temp_f14; - f32 temp_f20; - f32 temp_f2; f32 var_f20; - s16 temp_v0; + s32 temp_v0; s16 temp_v1; s16 var_a1; - s32 temp_t0; - s32 temp_t7; - s32 temp_t8; - s32 temp_t9; - s32 temp_v0_2; - s32 temp_v0_3; - u16 temp_v1_2; + s32 test; + f32 temp_f0; - temp_v1 = -player->unk_02E - player->unk_0C0; + temp_v1 = -player->unk_02C[1] - player->unk_0C0; if ((player->unk_0BC & 0x40000000) == 0x40000000) { - var_f20 = (f32) (((f64) ((D_800DDBD4[player->characterId] * 18.0f) / 2.0f) * ((f64) player->unk_224 * 1.5)) - 1.0); + var_f20 = (((D_800DDBD4[player->characterId] * 18) / 2) * (player->unk_224 * 1.5)) - 1; } else { - var_f20 = (((D_800DDBD4[player->characterId] * 18.0f) / 2.0f) * player->unk_224) - 1.0f; + var_f20 = (((D_800DDBD4[player->characterId] * 18) / 2) * player->unk_224) - 1; } - temp_t7 = (temp_v1 + 0x2000) & 0xFFFF; - sp28 = temp_t7; - sp3A = temp_v1; - player->boundingBoxCorners[0].cornerPos[2] = (coss((u16) temp_t7) * var_f20) + arg3; - temp_f12 = (sins((u16) sp28) * var_f20) + arg1; + + player->boundingBoxCorners[0].cornerPos[2] = (coss(temp_v1 + 0x2000) * var_f20) + arg3; + temp_f12 = (sins(temp_v1 + 0x2000) * var_f20) + arg1; player->boundingBoxCorners[0].cornerPos[0] = temp_f12; player->boundingBoxCorners[0].cornerGroundY = func_802ABE30(temp_f12, arg2, player->boundingBoxCorners[0].cornerPos[2], player->unk_110.unk3A); - temp_t8 = (sp3A - 0x2000) & 0xFFFF; - sp28 = temp_t8; - player->boundingBoxCorners[1].cornerPos[2] = (coss((u16) temp_t8) * var_f20) + arg3; - temp_f12_2 = (sins((u16) sp28) * var_f20) + arg1; - player->boundingBoxCorners[1].cornerPos[0] = temp_f12_2; - player->boundingBoxCorners[1].cornerGroundY = func_802ABE30(temp_f12_2, arg2, player->boundingBoxCorners[1].cornerPos[2], player->unk_110.unk3A); - temp_t9 = (sp3A + 0x6000) & 0xFFFF; - sp28 = temp_t9; - player->boundingBoxCorners[2].cornerPos[2] = (coss((u16) temp_t9) * var_f20) + arg3; - temp_f12_3 = (sins((u16) sp28) * var_f20) + arg1; - player->boundingBoxCorners[2].cornerPos[0] = temp_f12_3; - player->boundingBoxCorners[2].cornerGroundY = func_802ABE30(temp_f12_3, arg2, player->boundingBoxCorners[2].cornerPos[2], player->unk_110.unk3A); - temp_t0 = (sp3A - 0x6000) & 0xFFFF; - sp28 = temp_t0; - player->boundingBoxCorners[3].cornerPos[2] = (coss((u16) temp_t0) * var_f20) + arg3; - player->boundingBoxCorners[3].cornerPos[0] = (sins((u16) sp28) * var_f20) + arg1; + + player->boundingBoxCorners[1].cornerPos[2] = (coss(temp_v1 - 0x2000) * var_f20) + arg3; + temp_f12 = (sins(temp_v1 - 0x2000) * var_f20) + arg1; + player->boundingBoxCorners[1].cornerPos[0] = temp_f12; + player->boundingBoxCorners[1].cornerGroundY = func_802ABE30(temp_f12, arg2, player->boundingBoxCorners[1].cornerPos[2], player->unk_110.unk3A); + + player->boundingBoxCorners[2].cornerPos[2] = (coss(temp_v1 + 0x6000) * var_f20) + arg3; + temp_f12 = (sins(temp_v1 + 0x6000) * var_f20) + arg1; + player->boundingBoxCorners[2].cornerPos[0] = temp_f12; + player->boundingBoxCorners[2].cornerGroundY = func_802ABE30(temp_f12, arg2, player->boundingBoxCorners[2].cornerPos[2], player->unk_110.unk3A); + + player->boundingBoxCorners[3].cornerPos[2] = (coss(temp_v1 - 0x6000) * var_f20) + arg3; + player->boundingBoxCorners[3].cornerPos[0] = (sins(temp_v1 - 0x6000) * var_f20) + arg1; player->boundingBoxCorners[3].cornerGroundY = func_802ABE30(player->boundingBoxCorners[2].cornerPos[0], arg2, player->boundingBoxCorners[2].cornerPos[2], player->unk_110.unk3A); + if ((player->unk_0BC & 8) != 8) { - temp_f0 = player->boundingBoxCorners[0].cornerGroundY; - temp_f2 = player->boundingBoxCorners[2].cornerGroundY; - temp_f12_4 = player->boundingBoxCorners[1].cornerGroundY; - temp_f14 = player->boundingBoxCorners[3].cornerGroundY; - player->unk_230 = (temp_f0 + temp_f2) / 2.0f; - player->unk_23C = (temp_f12_4 + temp_f14) / 2.0f; - player->unk_1FC = (temp_f0 + temp_f12_4) / 2.0f; - player->unk_1F8 = (temp_f2 + temp_f14) / 2.0f; - } - temp_v1_2 = func_802ABD10(player->unk_110.unk3A) & 0xFF; - player->unk_0F8 = temp_v1_2; - player->boundingBoxCorners[3].surfaceType = (u8) temp_v1_2; - player->boundingBoxCorners[2].surfaceType = (u8) temp_v1_2; - player->boundingBoxCorners[1].surfaceType = (u8) temp_v1_2; - player->boundingBoxCorners[0].surfaceType = (u8) temp_v1_2; - temp_f20 = (D_800DDBD4[player->characterId] * 18.0f) + 1.0f; - player->unk_206 = -func_802B7C40((player->unk_23C - player->unk_230) / temp_f20); + player->unk_230 = (player->boundingBoxCorners[2].cornerGroundY + player->boundingBoxCorners[0].cornerGroundY) / 2; + player->unk_23C = (player->boundingBoxCorners[3].cornerGroundY + player->boundingBoxCorners[1].cornerGroundY) / 2; + player->unk_1FC = (player->boundingBoxCorners[1].cornerGroundY + player->boundingBoxCorners[0].cornerGroundY) / 2; + player->unk_1F8 = (player->boundingBoxCorners[3].cornerGroundY + player->boundingBoxCorners[2].cornerGroundY) / 2; + } + player->unk_0F8 = (u8)func_802ABD10(player->unk_110.unk3A); + player->boundingBoxCorners[3].surfaceType = player->unk_0F8; + player->boundingBoxCorners[2].surfaceType = player->unk_0F8; + player->boundingBoxCorners[1].surfaceType = player->unk_0F8; + player->boundingBoxCorners[0].surfaceType = player->unk_0F8; + var_f20 = (D_800DDBD4[player->characterId] * 18) + 1; + temp_f0 = (player->unk_23C - player->unk_230); + player->unk_206 = -func_802B7C40(temp_f0 / var_f20); if ((player->unk_0BC & 8) != 8) { - move_s16_towards(&player->unk_0C4, func_802B7C40((player->unk_1F8 - player->unk_1FC) / temp_f20), 0.5f); + temp_f0 = (player->unk_1F8 - player->unk_1FC); + move_s16_towards(&player->unk_0C4, func_802B7C40(temp_f0 / var_f20), 0.5f); } else { - temp_f0_2 = player->rotY - arg2; - sp30 = temp_f0_2; - temp_v0 = func_802B7C40(temp_f0_2 / temp_f20); - var_a1 = temp_v0 * 0xA; - if (temp_f0_2 >= 0.0f) { + temp_f0 = player->rotY - arg2; + temp_v0 = func_802B7C40(temp_f0 / var_f20); + if (temp_f0 >= 0.0f) { var_a1 = temp_v0 * 2; + } else { + var_a1 = temp_v0 * 0xA; } move_s16_towards(&player->unk_0C4, var_a1, 0.5f); } @@ -1181,14 +1161,12 @@ void func_8002A194(Player *player, f32 arg1, f32 arg2, f32 arg3) { player->boundingBoxCorners[3].unk_14 &= ~1; } if (player->unk_0F8 == 0x00FE) { - temp_v0_2 = player->unk_0BC; - if (((temp_v0_2 & 0x100000) != 0x100000) && ((temp_v0_2 & 8) != 8)) { + if (((player->unk_0BC & 0x100000) != 0x100000) && ((player->unk_0BC & 8) != 8)) { player->statusEffects |= 0x800000; } } if (player->unk_0F8 == 0x00FC) { - temp_v0_3 = player->unk_0BC; - if (((temp_v0_3 & 4) != 4) && ((temp_v0_3 & 8) != 8)) { + if (((player->unk_0BC & 4) != 4) && ((player->unk_0BC & 8) != 8)) { player->statusEffects |= 0x8000; } } @@ -1485,7 +1463,7 @@ UNUSED void func_8002AE30(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b void func_8002AE38(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { s16 sp2E; f32 sp28; @@ -1503,10 +1481,10 @@ void func_8002AE38(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar s32 var_t7; s32 var_v1; - sp28 = (sins(-player->unk_02E & 0xFFFF) * player->unk_094) + arg2; + sp28 = (sins(-player->unk_02C[1] & 0xFFFF) * player->unk_094) + arg2; temp_f2 = player->unk_094; temp_v0 = player->unk_0BC; - temp_f16 = (coss(-player->unk_02E & 0xFFFF) * temp_f2) + arg3; + temp_f16 = (coss(-player->unk_02C[1] & 0xFFFF) * temp_f2) + arg3; if (((temp_v0 & 0x800) != 0x800) && ((temp_v0 & 0x10) != 0x10) && !(player->unk_044 & 0x4000) && ((((temp_f2 / 18.0f) * 216.0f) <= 8.0f) || ((temp_t2 = (s32) player->unk_07C >> 0x10, ((temp_t2 < 5) != 0)) && (temp_t2 >= -4)))) { if ((temp_v0 & 0x20) == 0x20) { temp_v0_2 = player->unk_0C0; @@ -1559,164 +1537,91 @@ block_33: GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002AE38.s") #endif -#ifdef MIPS_TO_C -UNUSED void func_8002B218(void *arg0) { - s32 temp_t0; - s32 var_v0; - u16 temp_a1; - - sp38[0].unk0 = (s32) D_800E3C70.unk0; - sp38[0].unk4 = (s32) D_800E3C70.unk4; - var_v0 = 0; - sp38[0].unk8 = (s32) D_800E3C70.unk8; - sp38[0].unkC = (s32) D_800E3C70.unkC; - sp38[0].unk10 = (s32) D_800E3C70.unk10; - sp24[0].unk0 = (s32) D_800E3C84.unk0; - sp24[0].unk4 = (s32) D_800E3C84.unk4; - sp24[0].unk8 = (s32) D_800E3C84.unk8; - sp24[0].unkC = (s32) D_800E3C84.unkC; - sp24[0].unk10 = (s32) D_800E3C84.unk10; - temp_a1 = arg0->unk6; -loop_1: - temp_t0 = (var_v0 + 1) & 0xFFFF; - if (temp_a1 == (&sp38[0])[var_v0]) { - arg0->unkBC = (s32) (arg0->unkBC | 0x10); - func_8002AA50(temp_a1, (u16 (*)[]) &sp38[0], (u16 (*)[]) &sp24[0]); - arg0->unk204 = 0; - return; - } - if (temp_a1 == (&sp24[0])[var_v0]) { - arg0->unkBC = (s32) (arg0->unkBC & ~0x10); - return; - } - var_v0 = temp_t0; - if (temp_t0 >= 0xA) { - return; +#ifdef NEEDS_RODATA +//data_0DD0A0_2.s +// Might be plain data? +extern u16 D_800E3C70[10];// = { 0x0003, 0x0016, 0x0026, 0x003c, 0x0050, 0x0069, 0x0090, 0x009d, 0x00a9, 0x00cc }; +extern u16 D_800E3C84[10];// = { 0x000c, 0x0021, 0x002f, 0x0045, 0x005f, 0x007a, 0x0098, 0x00a5, 0x00b3, 0x00d5 }; + +void func_8002B218(Player *player) { + u16 someIndex; + u16 sp38[10] = { 0x0003, 0x0016, 0x0026, 0x003c, 0x0050, 0x0069, 0x0090, 0x009d, 0x00a9, 0x00cc }; + u16 sp24[10] = { 0x000c, 0x0021, 0x002f, 0x0045, 0x005f, 0x007a, 0x0098, 0x00a5, 0x00b3, 0x00d5 }; + + for (someIndex = 0; someIndex < 10; someIndex++) { + if (player->unk_006 == sp38[someIndex]) { + player->unk_0BC |= 0x10; + func_8002AA50(player); + player->unk_204 = 0; + break; + } + + if (player->unk_006 == sp24[someIndex]) { + player->unk_0BC &= ~0x10; + break; + } } - goto loop_1; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002B218.s") #endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf -void func_8002A704(Player *, s8); /* extern */ - void func_8002B308(Player *player, s8 arg1, s8 arg2) { - s32 temp_v0; - s32 phi_v0; - s32 phi_v0_2; - s32 phi_v0_3; - s32 phi_v0_4; - s32 phi_v0_5; - s32 phi_v0_6; - s32 phi_v0_7; - s32 phi_v0_8; - s32 phi_v0_9; - s32 phi_v0_10; - s32 phi_v0_11; - s32 phi_v0_12; - s32 phi_v0_13; - s32 phi_v0_14; - s32 phi_v0_15; - s32 phi_v0_16; - s32 phi_v0_17; - - temp_v0 = player->statusEffects; - phi_v0 = temp_v0; - if ((temp_v0 & 2) == 2) { + if ((player->statusEffects & 2) == 2) { func_8008EAE0(player, arg1); - phi_v0 = player->statusEffects; } - phi_v0_2 = phi_v0; - if ((phi_v0 & 4) == 4) { + if ((player->statusEffects & 4) == 4) { func_8008C528(player, arg1); - phi_v0_2 = player->statusEffects; } - phi_v0_3 = phi_v0_2; - if ((phi_v0_2 & 1) == 1) { + if ((player->statusEffects & 1) == 1) { func_8008CDC0(player, arg1); - phi_v0_3 = player->statusEffects; } - phi_v0_4 = phi_v0_3; - if ((phi_v0_3 & 0x200) == 0x200) { + if ((player->statusEffects & 0x200) == 0x200) { func_8008D3C4(player, arg1); - phi_v0_4 = player->statusEffects; } - phi_v0_5 = phi_v0_4; - if ((phi_v0_4 & 0x02000000) == 0x02000000) { + if ((player->statusEffects & 0x02000000) == 0x02000000) { func_8002A704(player, arg1); - phi_v0_5 = player->statusEffects; } - phi_v0_6 = phi_v0_5; - if ((phi_v0_5 & 0x1000) == 0x1000) { + if ((player->statusEffects & 0x1000) == 0x1000) { func_8008D570(player, arg1); - phi_v0_6 = player->statusEffects; } - phi_v0_7 = phi_v0_6; - if ((phi_v0_6 & 0x20000) == 0x20000) { + if ((player->statusEffects & 0x20000) == 0x20000) { func_8008D7B0(player, arg1); - phi_v0_7 = player->statusEffects; } - phi_v0_8 = phi_v0_7; - if ((phi_v0_7 & 0x100) == 0x100) { + if ((player->statusEffects & 0x100) == 0x100) { func_8008DABC(player, arg1); - phi_v0_8 = player->statusEffects; } - phi_v0_9 = phi_v0_8; - if ((phi_v0_8 & 0x4000) == 0x4000) { + if ((player->statusEffects & 0x4000) == 0x4000) { func_8008DF98(player, arg1); - phi_v0_9 = player->statusEffects; } - phi_v0_10 = phi_v0_9; - if ((phi_v0_9 & 0x200000) == 0x200000) { + if ((player->statusEffects & 0x200000) == 0x200000) { func_8008C73C(player, arg1); - phi_v0_10 = player->statusEffects; } - phi_v0_11 = phi_v0_10; - if ((phi_v0_10 & 0x400000) == 0x400000) { + if ((player->statusEffects & 0x400000) == 0x400000) { func_8008E6C0(player, arg1); - phi_v0_11 = player->statusEffects; } - phi_v0_12 = phi_v0_11; - if ((phi_v0_11 & 0x01000000) == 0x01000000) { + if ((player->statusEffects & 0x01000000) == 0x01000000) { func_8008EAE0(player, arg1); - phi_v0_12 = player->statusEffects; } - phi_v0_13 = phi_v0_12; - if ((phi_v0_12 & 0x800000) == 0x800000) { + if ((player->statusEffects & 0x800000) == 0x800000) { func_8008EC88(player, arg1); - phi_v0_13 = player->statusEffects; } - phi_v0_14 = phi_v0_13; - if ((phi_v0_13 & 0x8000) == 0x8000) { + if ((player->statusEffects & 0x8000) == 0x8000) { func_8008EEE4(player, arg1); - phi_v0_14 = player->statusEffects; } - phi_v0_15 = phi_v0_14; - if ((phi_v0_14 & 0x2000) == 0x2000) { + if ((player->statusEffects & 0x2000) == 0x2000) { func_8008F778(player, arg1); - phi_v0_15 = player->statusEffects; } - phi_v0_16 = phi_v0_15; - if ((phi_v0_15 & 0x800) == 0x800) { + if ((player->statusEffects & 0x800) == 0x800) { func_8008FA38(player, arg1); - phi_v0_16 = player->statusEffects; } - phi_v0_17 = phi_v0_16; - if ((phi_v0_16 & 0x80) != 0) { + if (player->statusEffects & 0x80) { func_8008D0FC(player, arg1); - phi_v0_17 = player->statusEffects; } - if (phi_v0_17 & 0x80000) { + if (player->statusEffects & 0x80000) { func_8008E6C0(player, arg1); } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002B308.s") -#endif void func_8002B5C0(Player *player, s8 arg1, s8 arg2) { if (((player->unk_0CA & 8) != 0) || ((player->unk_0CA & 2) != 0)) { @@ -1785,10 +1690,10 @@ void func_8002B830(Player *player, s8 arg1, s8 arg2) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b extern ? D_801653C0; -UNUSED void func_8002B8A4(Player *player_one, Player *player_two) { +void func_8002B8A4(Player *player_one, Player *player_two) { s32 spC; Player *temp_a1; Player *temp_a2; @@ -1798,160 +1703,153 @@ UNUSED void func_8002B8A4(Player *player_one, Player *player_two) { Player *temp_t2; Player *temp_t3; Player *temp_v0; - s32 phi_v1; - s32 phi_v1_2; + s32 var_v1; temp_v0 = gPlayerOne; if (player_one == temp_v0) { spC = 0; } temp_a1 = gPlayerTwo; - phi_v1 = spC; + var_v1 = spC; if (player_one == temp_a1) { - phi_v1 = 1; + var_v1 = 1; } temp_a2 = gPlayerThree; if (player_one == temp_a2) { - phi_v1 = 2; + var_v1 = 2; } temp_a3 = gPlayerFour; if (player_one == temp_a3) { - phi_v1 = 3; + var_v1 = 3; } temp_t0 = gPlayerFive; if (player_one == temp_t0) { - phi_v1 = 4; + var_v1 = 4; } temp_t1 = gPlayerSix; if (player_one == temp_t1) { - phi_v1 = 5; + var_v1 = 5; } temp_t2 = gPlayerSeven; if (player_one == temp_t2) { - phi_v1 = 6; + var_v1 = 6; } temp_t3 = gPlayerEight; if (player_one == temp_t3) { - phi_v1 = 7; + var_v1 = 7; } - *(&D_801653C0 + (phi_v1 * 4)) = player_two; - phi_v1_2 = phi_v1; + *(&D_801653C0 + (var_v1 * 4)) = player_two; if (player_two == temp_v0) { - phi_v1_2 = 0; + var_v1 = 0; } if (player_two == temp_a1) { - phi_v1_2 = 1; + var_v1 = 1; } if (player_two == temp_a2) { - phi_v1_2 = 2; + var_v1 = 2; } if (player_two == temp_a3) { - phi_v1_2 = 3; + var_v1 = 3; } if (player_two == temp_t0) { - phi_v1_2 = 4; + var_v1 = 4; } if (player_two == temp_t1) { - phi_v1_2 = 5; + var_v1 = 5; } if (player_two == temp_t2) { - phi_v1_2 = 6; + var_v1 = 6; } if (player_two == temp_t3) { - phi_v1_2 = 7; + var_v1 = 7; } - *(&D_801653C0 + (phi_v1_2 * 4)) = player_one; + *(&D_801653C0 + (var_v1 * 4)) = player_one; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002B8A4.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +#ifdef NON_MATCHING +// data_0DD0A0_3_0_0.s +extern f64 D_800ED7D0;// = 4.2; void func_8002B9CC(Player *player, s8 arg1, s32 arg2) { - f32 *temp_v0_3; f32 temp_f0; - f32 temp_f0_2; - f32 temp_f14; - f32 temp_f14_2; f32 temp_f2; - s32 temp_v0_2; - s32 temp_v0_4; - struct_D_8018CE10 *temp_v0; + f32 temp_f14; if ((player->unk_046 & 2) == 2) { - temp_v0 = &D_8018CE10[arg1]; - temp_f0 = temp_v0->unk_04; - temp_f14 = temp_v0->unk_0C; - if ((f64) sqrtf((temp_f0 * temp_f0) + (0.0f * 0.0f) + (temp_f14 * temp_f14)) >= 6.5) { - temp_v0_2 = player->unk_0BC; - player->unk_08C /= 4.0f; - player->unk_09C /= 4.0f; - if (!(temp_v0_2 & 0x80) && !(temp_v0_2 & 0x40)) { + temp_f0 = D_8018CE10[arg1].unk_04; + temp_f2 = 0; + temp_f14 = D_8018CE10[arg1].unk_0C; + if (sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f14 * temp_f14)) >= 6.5) { + player->unk_08C /= 4; + player->unk_09C /= 4; + if (!(player->unk_0BC & 0x80) && !(player->unk_0BC & 0x40)) { func_8008C73C(player, arg1); } } } else { - temp_v0_3 = D_80165070[arg1]; - temp_f0_2 = temp_v0_3->unk0 - player->unk_034[0]; - temp_f2 = temp_v0_3->unk4 - player->unk_034[1]; - temp_f14_2 = temp_v0_3->unk8 - player->unk_034[2]; - if ((f64) sqrtf((temp_f0_2 * temp_f0_2) + (temp_f2 * temp_f2) + (temp_f14_2 * temp_f14_2)) >= 4.2) { - temp_v0_4 = player->unk_0BC; - player->unk_08C /= 4.0f; - player->unk_09C /= 4.0f; - if (!(temp_v0_4 & 0x80) && !(temp_v0_4 & 0x40)) { + temp_f0 = D_80165070[arg1][0] - player->unk_034[0]; + temp_f2 = D_80165070[arg1][1] - player->unk_034[1]; + temp_f14 = D_80165070[arg1][2] - player->unk_034[2]; + if (sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f14 * temp_f14)) >= 4.2) { + player->unk_08C /= 4; + player->unk_09C /= 4; + if (!(player->unk_0BC & 0x80) && !(player->unk_0BC & 0x40)) { func_8008C73C(player, arg1); } } - player->unk_234 = (s16) ((s16) (-func_802B5224(player->pos, &player->rotX) - (player->unk_02E - player->unk_0C0)) / 182); + // There's some register allocation mismatching here. Its unclear what the cause is + // and the permtuer didn't find anything + player->unk_234 = ((s16) (-func_802B5224(player->pos, &player->rotX) - (player->unk_02C[1] - player->unk_0C0))) / 182; } } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002B9CC.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_802B6540(f32 (*)[3], ?, ?, ?, s32); /* extern */ -static ? D_800E3C98; /* unable to generate initializer */ +#ifdef NON_MATCHING +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +extern s16 D_800E3C98[10];// = { 0x0000, 0x00b6, 0x016c, 0x0222, 0x02d8, 0x038e, 0x0444, 0x04fa, 0x05b0, 0x0666 }; void func_8002BB9C(Player *player, f32 *arg1, f32 *arg2, f32 *arg3) { - f32 sp60; - f32 sp5C; - f32 sp58; - f32 sp54; - f32 sp50; - f32 sp4C; - ? sp30; - s16 temp_a1; - s16 var_v0; - s32 temp_lo; - s32 temp_lo_2; + Mat3 sp64; + Vec3f sp58; + Vec3f sp4C; + s32 var_v0; s32 temp_t9; - u16 temp_v0; - - sp30.unk0 = (s32) D_800E3C98.unk0; - sp30.unk4 = (s32) D_800E3C98.unk4; - sp30.unk8 = (s32) D_800E3C98.unk8; - sp30.unkC = (s32) D_800E3C98.unkC; - sp30.unk10 = (s32) D_800E3C98.unk10; - temp_v0 = (u16) player->unk_256; - if (((s32) temp_v0 > 0) && ((s32) temp_v0 < 3) && (player->unk_046 & 0x20) && ((func_802B6540((f32 (*)[3]) &sp64[0], 0, 0x3F800000, 0, 0), sp5C = 0.0f, sp58 = *arg1, sp60 = *arg2, func_802B63B8(&sp58, (f32 (*)[3]) &sp64[0]), sp4C = player->rotX, sp50 = 0.0f, sp54 = player->rotZ, func_802B63B8(&sp4C, (f32 (*)[3]) &sp64[0]), temp_a1 = player->unk_02E, temp_lo = (s16) ((temp_a1 - -func_802B5224(&sp58, &sp4C)) + 0x10000) / 182, (((s16) temp_lo < 0x97) == 0)) || ((s16) temp_lo < -0x96))) { - temp_t9 = (s32) player->unk_07C >> 0x10; - temp_lo_2 = temp_t9 / 6; - var_v0 = (s16) temp_lo_2; - if ((s16) temp_lo_2 < 0) { - var_v0 = (s16) temp_lo_2 * -1; - } - if (var_v0 >= 8) { - var_v0 = 8; - } - if (temp_t9 < 0) { - player->unk_02E = temp_a1 - (sp + (var_v0 * 2))->unk30; - return; - } - player->unk_02E = temp_a1 + (sp + (var_v0 * 2))->unk30; + s16 sp30[10] = { 0x0000, 0x00b6, 0x016c, 0x0222, 0x02d8, 0x038e, 0x0444, 0x04fa, 0x05b0, 0x0666 }; + + if ((u16)player->unk_256 <= 0) return; + if ((u16)player->unk_256 > 2) return; + if (!(player->unk_046 & 0x20)) return; + func_802B6540(sp64, 0.0f, 1.0f, 0.0f, (s16) 0); + sp58[0] = *arg1; + sp58[1] = 0.0f; + sp58[2] = *arg2; + func_802B63B8(sp58, sp64); + sp4C[0] = player->rotX; + sp4C[1] = 0.0f; + sp4C[2] = player->rotZ; + func_802B63B8(sp4C, sp64); + // There's some wonkiness surrounding this line + temp_t9 = (s16) ((player->unk_02C[1] - -func_802B5224(sp58, sp4C)) + 0x10000) / 182; + if((s16) temp_t9 < 0x97) { + if(((s16) temp_t9 > -0x97)) return; + } + + temp_t9 = player->unk_07C >> 0x10; + var_v0 = temp_t9 / 6; + if ((s16) var_v0 < 0) { + var_v0 *= -1; + } + if ((s16) var_v0 >= 8) { + var_v0 = 8; + } + if (temp_t9 < 0) { + player->unk_02C[1] -= sp30[var_v0]; + } else { + player->unk_02C[1] += sp30[var_v0]; } } #else @@ -1996,72 +1894,59 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002BD58.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_8001FD78(void *, s32, s32, s32); // extern -void func_800C9060(u8, ?, s32); // extern -void func_800C90F4(u8, s32, s32); // extern - -void func_8002BF4C(void *arg0, u8 arg1) { +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void func_8002BF4C(Player *player, u8 arg1) { s32 sp30; - s32 temp_a2; - s32 temp_s1; + Player *var_s0; s32 temp_t2; - s32 temp_v0_2; + s32 var_s1; + s32 var_v0; u16 temp_v0; - Player *phi_s0; - s32 phi_v0; - s32 phi_s1; - s32 phi_a2; - s32 phi_a2_2; - - phi_a2_2 = 0; - if (((arg0->unk94 / 18.0f) * 216.0f) < 50.0f) { - arg0->unkE2 = 0; - arg0->unkBC = arg0->unkBC & 0xFFDFFFFF; + u16 temp_v0_2; + u16 var_a2; + + var_a2 = 0; + if (((player->unk_094 / 18.0f) * 216.0f) < 50.0f) { + player->unk_0E2 = 0; + player->unk_0BC &= 0xFFDFFFFF; return; } - phi_s0 = gPlayerOne; - phi_s1 = 0; - if ((arg0->unkBC & 0x200000) == 0x200000) { - arg0->unkE2 = arg0->unkE2 - 1; - if (arg0->unkE2 <= 0) { - arg0->unkBC = arg0->unkBC & 0xFFDFFFFF; - return; + var_s1 = 0; + var_s0 = gPlayerOne; + if ((player->unk_0BC & 0x200000) == 0x200000) { + player->unk_0E2 -= 1; + if (player->unk_0E2 <= 0) { + player->unk_0BC &= 0xFFDFFFFF; } - // Duplicate return node #18. Try simplifying control flow for better match - return; - } + } else { loop_6: - if ((arg0 != phi_s0) && (temp_v0 = phi_s0->unk_000, ((temp_v0 & 0x100) == 0)) && ((temp_v0 & 0x8000) != 0) && (temp_v0_2 = func_8001FD78(arg0, phi_s0->posX, phi_s0->posY, phi_s0->posZ), temp_a2 = temp_v0_2, phi_a2 = temp_a2, phi_a2_2 = temp_a2, (temp_v0_2 == 1))) { - arg0->unkE2 = arg0->unkE2 + 1; - if (arg0->unkE2 >= 0x3D) { - temp_t2 = arg0->unk0 & 0x100; - arg0->unkBC = arg0->unkBC | 0x200000; - phi_v0 = temp_t2; - if (temp_t2 != 0x100) { - sp30 = temp_a2; - func_800C90F4(arg1, (arg0->unk254 * 0x10) + 0x29008001, temp_a2); - phi_v0 = arg0->unk0 & 0x100; + if ((player != var_s0) && (temp_v0 = var_s0->unk_000, ((temp_v0 & 0x100) == 0)) && (temp_v0 & 0x8000) && (temp_v0_2 = func_8001FD78(player, var_s0->pos[0], var_s0->pos[1], var_s0->pos[2]), var_a2 = temp_v0_2, (temp_v0_2 == 1))) { + player->unk_0E2 += 1; + if (player->unk_0E2 >= 0x3D) { + temp_t2 = player->unk_000 & 0x100; + player->unk_0BC |= 0x200000; + var_v0 = temp_t2; + if (temp_t2 != 0x100) { + sp30 = (s32) var_a2; + func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008001); + var_v0 = player->unk_000 & 0x100; + } + if (var_v0 != 0x100) { + sp30 = (s32) var_a2; + func_800C9060(arg1, 0x19008011U); + } } - phi_a2 = temp_a2; - if (phi_v0 != 0x100) { - sp30 = temp_a2; - func_800C9060(arg1, 0x19008011, temp_a2); - phi_a2 = temp_a2; + } else { + var_s1 += 0xDD8; + var_s0 += 0xDD8; + if (var_s1 != 0x6EC0) { + goto loop_6; } } - } else { - temp_s1 = phi_s1 + 0xDD8; - phi_s0 += 0xDD8; - phi_s1 = temp_s1; - phi_a2 = phi_a2_2; - if (temp_s1 != 0x6EC0) { - goto loop_6; + if (var_a2 == 0) { + player->unk_0E2 = 0; } } - if (phi_a2 == 0) { - arg0->unkE2 = 0; - } } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002BF4C.s") @@ -2422,13 +2307,10 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002C954.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_8008C9EC(Player *, s8); /* extern */ -void func_8008CEB0(Player *, s8); /* extern */ -void func_8008D170(Player *, s8); /* extern */ -void func_8008E118(Player *, s8); /* extern */ -void func_80090970(Player *, s8, s8); /* extern */ -void func_80091298(Player *, s8); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_8008CEB0(Player *, s8); /* extern */ +? func_8008D170(Player *, s8); /* extern */ +? func_80090970(Player *, s8, s8); /* extern */ extern s32 D_800DC510; void func_8002CD48(Player *player, s8 arg1, s8 arg2) { @@ -2497,7 +2379,7 @@ void func_8002CD48(Player *player, s8 arg1, s8 arg2) { if (player->statusEffects & 0x04000000) { func_8008FC64(player, arg1); } - if ((player->statusEffects * 0x10) < 0) { + if (player->statusEffects & 0x08000000) { func_8008FCDC(player, arg1); } } @@ -2581,28 +2463,24 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002D028.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80027EDC(Player *, s8); /* extern */ -void func_80029B4C(Player *, f32, f32, f32); /* extern */ -void func_8002A194(Player *, f32, f32, f32); /* extern */ -void func_8002A79C(Player *, s8); /* extern */ -void func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ -void func_8002BB9C(Player *, f32 *, f32 *, s8, s32, f32 *); /* extern */ -void func_8002BF4C(Player *, s8); /* extern */ -void func_8002C4F8(Player *, s8); /* extern */ -void func_8002C7E4(f32, f32, Player *, s8, s8); /* extern */ -void func_8002C954(Player *, s8, f32 *); /* extern */ -void func_8002CD48(Player *, s8, s8); /* extern */ -void func_8002FCA8(Player *, s8); /* extern */ -f32 func_80030150(Player *, s8); /* extern */ -void func_80037BB4(Player *, f32 *); /* extern */ -void func_800CADD0(u8, f32); /* extern */ -void func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_80027EDC(Player *, s8); /* extern */ +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002A79C(Player *, s8); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +? func_8002BB9C(Player *, f32 *, f32 *, s8, s32, f32 *); /* extern */ +? func_8002BF4C(Player *, s8); /* extern */ +? func_8002C4F8(Player *, s8); /* extern */ +? func_8002C7E4(f32, f32, Player *, s8, s8); /* extern */ +? func_8002C954(Player *, s8, f32 *); /* extern */ +? func_8002CD48(Player *, s8, s8); /* extern */ +? func_80037BB4(Player *, f32 *); /* extern */ +? func_800CADD0(u8, f32); /* extern */ static ? D_800E3CE8; /* unable to generate initializer */ static ? D_800E3CF4; /* unable to generate initializer */ static ? D_800E3D00; /* unable to generate initializer */ static ? D_800E3D0C; /* unable to generate initializer */ -static s32 D_800E3D18[0x17]; +f32 D_800E3D18[0x17]; s16 gCurrentCourseId; /* unable to generate initializer */ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { @@ -2635,6 +2513,8 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 *temp_a1; f32 *temp_v0_18; f32 *temp_v0_19; + f32 *var_t6; + f32 temp_at; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_7; @@ -2670,8 +2550,6 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { s16 temp_v0_6; s16 temp_v0_7; s16 temp_v0_9; - s32 *var_t6; - s32 temp_at; s32 temp_t4; s32 temp_t4_2; s32 temp_v0_16; @@ -2711,7 +2589,7 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { var_t7->unk-8 = (s32) var_t6->unk-8; var_t7->unk-4 = (s32) var_t6->unk-4; } while (var_t6 != (D_800E3D18 + 0x54)); - var_t7->unk0 = (s32) var_t6->unk0; + var_t7->unk0 = (f32) var_t6->unk0; var_t7->unk4 = (s32) var_t6->unk4; sp7C = 0; func_80027EDC(player, arg3); @@ -2767,9 +2645,9 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { spB0 = player->kartGravity * -1.0f; spAC = var_f14 * 0.0f; } - sp60 = coss((player->unk_02E + player->unk_0C0) & 0xFFFF); - temp_a1 = player->unk_174; - temp_f2_2 = (sins((player->unk_02E + player->unk_0C0) & 0xFFFF) * -(player->rotX - player->pos[0])) + ((player->rotZ - player->pos[2]) * sp60); + sp60 = coss((player->unk_02C[1] + player->unk_0C0) & 0xFFFF); + temp_a1 = player->unk_174[0]; + temp_f2_2 = (sins((player->unk_02C[1] + player->unk_0C0) & 0xFFFF) * -(player->rotX - player->pos[0])) + ((player->rotZ - player->pos[2]) * sp60); if ((f64) temp_f2_2 > 0.1) { player->unk_044 |= 8; } else { @@ -2851,9 +2729,9 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { player->unk_060 = 0.0f; player->unk_05C = 1.0f; if ((player->unk_044 & 1) != 1) { - func_802B6540(sp58, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); + func_802B6540((f32 (*)[3]) sp58, player->unk_058, player->unk_05C, player->unk_060, (s16) (s32) player->unk_02C[1]); } else { - func_802B6540(sp58, player->unk_058, player->unk_05C, player->unk_060, player->unk_02E + 0x8000); + func_802B6540((f32 (*)[3]) sp58, player->unk_058, player->unk_05C, player->unk_060, (s16) (player->unk_02C[1] + 0x8000)); } player->unk_0BC |= 8; player->unk_0C2 += 1; @@ -2918,19 +2796,19 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { if (spA8 <= 0.0f) { func_8003F46C(player, &sp8C, &sp98, &sp178, &spA8, &spFC, &spF8, &spF4); } - spA8 = player->unk_110.unk3C; + spA8 = player->unk_110.unk3C[0]; if (spA8 < 0.0f) { func_8003F734(player, &sp8C, &sp98, &spA8, &spFC, &spF8, &spF4); func_8002C954(player, arg3, &sp98); } - spA8 = player->unk_110.unk40; + spA8 = player->unk_110.unk3C[1]; if (spA8 < 0.0f) { func_8003FBAC(player, &sp8C, &sp98, &spA8, &spFC, &spF8, &spF4); func_8002C954(player, arg3, &sp98); } - spA8 = player->unk_110.unk3C; + spA8 = player->unk_110.unk3C[0]; if (spA8 >= 0.0f) { - spA8 = player->unk_110.unk40; + spA8 = player->unk_110.unk3C[1]; if (spA8 >= 0.0f) { temp_v0_14 = (u16) player->unk_256; player->unk_046 &= 0xFFDF; @@ -2952,7 +2830,7 @@ void func_8002D268(Player *player, Camera *camera, s8 arg2, s8 arg3) { func_8008F5A4(player, arg3); } player->unk_074 = func_802ABE30(spFC, spF8, spF4, player->unk_110.unk3A); - if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0_16 = gActiveScreenMode, (temp_v0_16 == SCREEN_MODE_1P)) || (temp_v0_16 == SCREEN_MODE_2P_SPLITSCREEN_VERTICAL) || (temp_v0_16 == SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL))) { + if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0_16 = gActiveScreenMode, (temp_v0_16 == 0)) || (temp_v0_16 == 2) || (temp_v0_16 == 1))) { func_80029B4C(player, spFC, spF8, spF4); } else { func_8002A194(player, spFC, spF8, spF4); @@ -3027,18 +2905,14 @@ void func_8002E4C4(Player *player) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80029B4C(Player *, f32, f32, f32); /* extern */ -void func_8002A194(Player *, f32, f32, f32); /* extern */ -void func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ -void func_8002C4F8(Player *, s8); /* extern */ -void func_8002C7E4(Player *, s8, s8); /* extern */ -void func_8002C954(Player *, s8, f32 *); /* extern */ -void func_8002CD48(Player *, s8, s8); /* extern */ -void func_8002FCA8(Player *, s8); /* extern */ -f32 func_80030150(Player *, s8); /* extern */ -void func_800CADD0(u8, f32); /* extern */ -void func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +? func_8002C4F8(Player *, s8); /* extern */ +? func_8002C7E4(Player *, s8, s8); /* extern */ +? func_8002C954(Player *, s8, f32 *); /* extern */ +? func_8002CD48(Player *, s8, s8); /* extern */ +? func_800CADD0(u8, f32); /* extern */ static ? D_800E3D74; /* unable to generate initializer */ static ? D_800E3D80; /* unable to generate initializer */ static ? D_800E3D8C; /* unable to generate initializer */ @@ -3134,14 +3008,14 @@ void func_8002E594(Player *player, Camera *camera, s8 arg2, s8 arg3) { } func_8002C7E4(player, arg3, arg2); if (sp46 == 1) { - temp_a0 = player->unk_174; + temp_a0 = player->unk_174[0]; sp40 = temp_a0; - func_802B6540(temp_a0, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); - func_802B6540(player->unk_150, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_0AE); + func_802B6540((f32 (*)[3]) temp_a0, player->unk_058, player->unk_05C, player->unk_060, (s16) (s32) player->unk_02C[1]); + func_802B6540((f32 (*)[3]) player->unk_150, player->unk_058, player->unk_05C, player->unk_060, (s16) (s32) player->unk_0AE); } else { - temp_a0_2 = player->unk_174; + temp_a0_2 = player->unk_174[0]; sp40 = temp_a0_2; - func_802B6540(temp_a0_2, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); + func_802B6540((f32 (*)[3]) temp_a0_2, player->unk_058, player->unk_05C, player->unk_060, (s16) (s32) player->unk_02C[1]); } spF4 = func_80030150(player, arg3); if (sp46 == 1) { @@ -3268,21 +3142,21 @@ block_63: if (sp74 <= 0.0f) { func_8003F46C(player, &sp48, &sp54, &spE0, &sp74, &spD0, &spCC, &spC8); } - sp74 = player->unk_110.unk3C; + sp74 = player->unk_110.unk3C[0]; if (sp74 < 0.0f) { func_8003F734(player, &sp48, &sp54, &sp74, &spD0, &spCC, &spC8); func_8002C954(player, arg3, &sp54); func_80031F48(player, 6.0f); } - sp74 = player->unk_110.unk40; + sp74 = player->unk_110.unk3C[1]; if (sp74 < 0.0f) { func_8003FBAC(player, &sp48, &sp54, &sp74, &spD0, &spCC, &spC8); func_8002C954(player, arg3, &sp54); func_80031F48(player, 6.0f); } - sp74 = player->unk_110.unk3C; + sp74 = player->unk_110.unk3C[0]; if (sp74 >= 0.0f) { - sp74 = player->unk_110.unk40; + sp74 = player->unk_110.unk3C[1]; if (sp74 >= 0.0f) { temp_v0_9 = (u16) player->unk_256; player->unk_046 &= 0xFFDF; @@ -3304,7 +3178,7 @@ block_63: func_8008F5A4(player, arg3); } player->unk_074 = func_802ABE30(spD0, spCC, spC8, player->unk_110.unk3A); - if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0_11 = gActiveScreenMode, (temp_v0_11 == SCREEN_MODE_1P)) || (temp_v0_11 == SCREEN_MODE_2P_SPLITSCREEN_VERTICAL) || (temp_v0_11 == SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL))) { + if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0_11 = gActiveScreenMode, (temp_v0_11 == 0)) || (temp_v0_11 == 2) || (temp_v0_11 == 1))) { func_80029B4C(player, spD0, spCC, spC8); } else { func_8002A194(player, spD0, spCC, spC8); @@ -3346,10 +3220,8 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002E594.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_8002CD48(Player *, s8, s8); /* extern */ -f32 func_80030150(Player *, s8); /* extern */ -void func_802B6540(f32, f32, f32 *, f32, f32, f32, s32); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_8002CD48(Player *, s8, s8); /* extern */ static ? D_800E3D98; /* unable to generate initializer */ static ? D_800E3DA4; /* unable to generate initializer */ static ? D_800E3DB0; /* unable to generate initializer */ @@ -3408,7 +3280,7 @@ void control_cpu_movement(Player *player, Camera *camera, s8 arg2, s8 arg3) { player->unk_10C = 0; player->unk_256 = 0; player->unk_0BC &= 0xFFFF7FFF; - temp_a1 = player->unk_174; + temp_a1 = player->unk_174[0]; spFC = func_80030150(player, arg3); sp3C = temp_a1; func_802B63B8(&spF4, (f32 (*)[3]) temp_a1); @@ -3432,7 +3304,7 @@ void control_cpu_movement(Player *player, Camera *camera, s8 arg2, s8 arg3) { player->kartHopJerk = 0.0f; player->kartHopAcceleration = 0.0f; player->kartHopVelocity = 0.0f; - func_802B6540(temp_f12, temp_f14, sp3C, player->unk_058, player->unk_05C, player->unk_060, (s32) player->unk_02E); + func_802B6540((f32 (*)[3]) sp3C, player->unk_058, player->unk_05C, player->unk_060, (s16) (s32) player->unk_02C[1]); player->unk_0C2 = 0; temp_t1 = player->unk_0BC & ~2; player->unk_0BC = temp_t1; @@ -3469,13 +3341,10 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/control_cpu_movement.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80029B4C(Player *, f32, f32, f32); /* extern */ -void func_8002A194(Player *, f32, f32, f32); /* extern */ -void func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ -f32 func_80030150(Player *, s8); /* extern */ -void func_80037BB4(? *); /* extern */ -void func_802B6540(f32 *, f32, f32, f32, s32); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_80029B4C(Player *, f32, f32, f32); /* extern */ +? func_8002AE38(Player *, s8, f32, f32, f32, f32); /* extern */ +? func_80037BB4(? *); /* extern */ static ? D_800E3DC8; /* unable to generate initializer */ static ? D_800E3DD4; /* unable to generate initializer */ static ? D_800E3DE0; /* unable to generate initializer */ @@ -3535,7 +3404,7 @@ void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3) { func_80037BB4(&spD0); sp84 = player->unk_064 * 0.0f; sp7C = player->unk_06C * 0.0f; - temp_a1 = player->unk_174; + temp_a1 = player->unk_174[0]; spFC = func_80030150(player, arg3); sp4C = temp_a1; func_802B63B8(&spF4, (f32 (*)[3]) temp_a1); @@ -3570,14 +3439,14 @@ void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3) { player->unk_058 = 0.0f; player->unk_060 = 0.0f; player->unk_05C = 1.0f; - func_802B6540(sp4C, 0.0f, 1.0f, 0.0f, (s32) player->unk_02E); + func_802B6540((f32 (*)[3]) sp4C, 0.0f, 1.0f, 0.0f, (s16) (s32) player->unk_02C[1]); player->unk_0BC &= ~8; sp78 = player->unk_110.unk3C[2]; if (sp78 <= 0.0f) { func_8003F46C(player, &sp5C, &sp68, &spE8, &sp78, &spCC, &spC8, &spC4); } player->unk_074 = func_802ABE30(spCC, spC8, spC4, player->unk_110.unk3A); - if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0 = gActiveScreenMode, (temp_v0 == SCREEN_MODE_1P)) || (temp_v0 == SCREEN_MODE_2P_SPLITSCREEN_VERTICAL) || (temp_v0 == SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL))) { + if (((player->unk_000 & 0x4000) == 0x4000) && ((temp_v0 = gActiveScreenMode, (temp_v0 == 0)) || (temp_v0 == 2) || (temp_v0 == 1))) { func_80029B4C(player, spCC, spC8, spC4); } else { func_8002A194(player, spCC, spC8, spC4); @@ -3620,123 +3489,104 @@ void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002F730.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 void func_8002FCA8(Player *player, s8 arg1) { - f32 temp_f2; + f32 var_f0; + f32 var_f12; s32 temp_lo; - s32 temp_v0; - u8 temp_v1; - u8 temp_v1_2; - u8 temp_v1_3; - u8 temp_v1_4; - s32 phi_v1; - f32 phi_f12; - f32 phi_f0; - f32 phi_f0_2; - f32 phi_f0_3; - f32 phi_f0_4; - f32 phi_f0_5; + s32 var_v1; - temp_v0 = player->unk_0BC; - phi_f0_2 = 0.0f; - phi_f0_5 = 0.0f; - if ((temp_v0 & 0x200) != 0x200) { - temp_v1 = player->boundingBoxCorners[3].surfaceType; - if ((s32) temp_v1 < 0xF) { - phi_f0_5 = 0.0f + D_800E2A90[player->characterId][temp_v1]; - } - temp_v1_2 = player->boundingBoxCorners[2].surfaceType; - phi_f0_4 = phi_f0_5; - if ((s32) temp_v1_2 < 0xF) { - phi_f0_4 = phi_f0_5 + D_800E2A90[player->characterId][temp_v1_2]; - } - temp_v1_3 = player->boundingBoxCorners[1].surfaceType; - phi_f0_3 = phi_f0_4; - if ((s32) temp_v1_3 < 0xF) { - phi_f0_3 = phi_f0_4 + D_800E2AB0[player->characterId][temp_v1_3]; - } - temp_v1_4 = player->boundingBoxCorners[0].surfaceType; - phi_f0_2 = phi_f0_3; - if ((s32) temp_v1_4 < 0xF) { - phi_f0_2 = phi_f0_3 + D_800E2AB0[player->characterId][temp_v1_4]; - } - } - phi_v1 = 0; - phi_f0 = phi_f0_2; - if ((D_801652C0[arg1] & 4) != 0) { - phi_v1 = 2; - } - if ((player->unk_09C >= 200.0f) && (phi_v1 == 2) && ((temp_lo = (s32) player->unk_0C0 / 182, ((temp_lo < 0x10) == 0)) || (temp_lo < -0xF))) { - phi_f0 = (f32) ((f64) phi_f0_2 + 1.0); - } - if (((temp_v0 & 0x200000) == 0x200000) && ((player->unk_000 & 0x4000) != 0x4000)) { - phi_f0 = -3.0f; - } - temp_f2 = player->unk_088; - if (temp_f2 >= 0.0f) { - phi_f12 = temp_f2 * phi_f0; + var_f0 = 0.0f; + if ((player->unk_0BC & 0x200) != 0x200) { + if ((s32) player->boundingBoxCorners[3].surfaceType < 0xF) { + var_f0 += D_800E2A90[player->characterId][player->boundingBoxCorners[3].surfaceType]; + } + if ((s32) player->boundingBoxCorners[2].surfaceType < 0xF) { + var_f0 += D_800E2A90[player->characterId][player->boundingBoxCorners[2].surfaceType]; + } + if ((s32) player->boundingBoxCorners[1].surfaceType < 0xF) { + var_f0 += D_800E2AB0[player->characterId][player->boundingBoxCorners[1].surfaceType]; + } + if ((s32) player->boundingBoxCorners[0].surfaceType < 0xF) { + var_f0 += D_800E2AB0[player->characterId][player->boundingBoxCorners[0].surfaceType]; + } + } + if (D_801652C0[arg1] & 4) { + var_v1 = 2; } else { - phi_f12 = -temp_f2 * phi_f0; + var_v1 = 0; + } + if ((player->unk_09C >= 200.0f) && (var_v1 == 2)) { + temp_lo = (s16) player->unk_0C0 / 182; + if ((temp_lo > 0xF) || (temp_lo < -0xF)) { + var_f0 += 1.0; + } } - player->unk_208 = temp_f2 - phi_f12; + if (((player->unk_0BC & 0x200000) == 0x200000) && ((player->unk_000 & 0x4000) != 0x4000)) { + var_f0 = -3.0f; + } + + if (player->unk_088 >= 0.0f) { + var_f12 = player->unk_088 * var_f0; + } else { + var_f12 = -player->unk_088 * var_f0; + } + player->unk_208 = player->unk_088 - var_f12; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002FCA8.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0 +extern f64 D_800ED8D8;// = 1.1; +extern f64 D_800ED8E0;// = 1.1; +extern f64 D_800ED8E8;// = 1.0125; +extern f64 D_800ED8F0;// = 1.2; +extern f64 D_800ED8F8;// = 1.025; +extern f64 D_800ED900;// = 1.2; +extern f64 D_800ED908;// = 0.7; +extern f64 D_800ED910;// = 0.7; +extern f64 D_800ED918;// = 0.004; +extern f64 D_800ED920;// = 0.004; +extern f64 D_800ED928;// = 0.7; + void func_8002FE84(Player *player, f32 arg1) { - f32 temp_f0; - f32 temp_f0_2; f32 temp_f0_3; - s32 temp_lo; - s32 temp_lo_2; - s32 temp_v0; - u8 temp_v0_2; - u8 temp_v0_3; - f32 phi_f0; - f64 phi_f18; - f32 phi_f0_2; - f32 phi_f0_3; + f32 var_f0; + s16 temp_lo; + s32 test; - temp_v0 = player->unk_0BC; - if ((temp_v0 & 0x4000) == 0x4000) { - temp_f0 = player->unk_09C; - player->unk_098 = (f32) ((f64) ((temp_f0 * temp_f0) / 25.0f) * 1.1); + if ((player->unk_0BC & 0x4000) == 0x4000) { + player->unk_098 = ((player->unk_09C * player->unk_09C) / 25.0f) * 1.1; return; } - if ((temp_v0 & 8) == 8) { - temp_f0_2 = player->unk_09C; - player->unk_098 = (f32) ((f64) ((temp_f0_2 * temp_f0_2) / 25.0f) * 1.1); + + // Huh? + if (((player->unk_0BC & 0xFFFFFFFF) & 8) == 8) { + player->unk_098 = ((player->unk_09C * player->unk_09C) / 25.0f) * 1.1; return; } + + var_f0 = 0.0f; player->unk_098 = arg1; - temp_lo = (s32) player->unk_0C4 / 182; - if (((s32) (s16) temp_lo >= 0x12) || ((s32) (s16) temp_lo < -0x11)) { - phi_f0 = (f32) ((f64) 0.0f + (((f64) (s16) temp_lo * 0.0125) / 1.2)); + temp_lo = player->unk_0C4 / 182; + if ((temp_lo > 0x11) || (temp_lo < -0x11)) { + var_f0 += (temp_lo * 0.0125) / 1.2; } else { - phi_f0 = (f32) ((f64) 0.0f + (((f64) (s16) temp_lo * 0.025) / 1.2)); - } - temp_v0_2 = player->boundingBoxCorners[3].surfaceType; - player->unk_098 = (1.0f - phi_f0) * arg1; - phi_f0_3 = phi_f0; - if (temp_v0_2 == 8) { - phi_f0_3 = (f32) ((f64) phi_f0 + ((f64) D_800E2E90[player->characterId][temp_v0_2] * 0.7)); - } - temp_v0_3 = player->boundingBoxCorners[2].surfaceType; - phi_f0_2 = phi_f0_3; - if (temp_v0_3 == 8) { - phi_f0_2 = (f32) ((f64) phi_f0_3 + ((f64) D_800E2E90[player->characterId][temp_v0_3] * 0.7)); - } - temp_lo_2 = (s32) player->unk_0C0 / 182; - if (temp_lo_2 < 0) { - phi_f18 = (f64) phi_f0_2 + ((f64) -temp_lo_2 * 0.004); + var_f0 += (temp_lo * 0.025) / 1.2; + } + player->unk_098 = arg1 * (1.0f - var_f0); + if (player->boundingBoxCorners[3].surfaceType == 8) { + var_f0 += D_800E2E90[player->characterId][player->boundingBoxCorners[3].surfaceType] * 0.7; + } + if (player->boundingBoxCorners[2].surfaceType == 8) { + // The unecessary "* 1.0" here is to force the compiler to save this 0.7 as a separate RO value from the 0.7 just above this comment + var_f0 += D_800E2E90[player->characterId][player->boundingBoxCorners[2].surfaceType] * (0.7 * 1.0); + } + test = player->unk_0C0 / 182; + if (test < 0) { + var_f0 += -test * 0.004; } else { - phi_f18 = (f64) phi_f0_2 + ((f64) temp_lo_2 * 0.004); + var_f0 += test * 0.004; } - player->unk_098 = (f32) ((f64) arg1 * (1.0 + ((f64) (f32) phi_f18 * 0.7))); + player->unk_098 = arg1 * (1.0 + (var_f0 * 0.7)); if ((player->unk_0BC & 0x20) == 0x20) { temp_f0_3 = player->unk_09C + 180.0f; player->unk_098 = (temp_f0_3 * temp_f0_3) / 25.0f; @@ -3746,343 +3596,212 @@ void func_8002FE84(Player *player, f32 arg1) { GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002FE84.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -void func_8002FE84(f32, Player *, f32); /* extern */ -void move_f32_towards(f32 *, f32, f32, Player *); /* extern */ +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0 +extern f64 D_800ED940;// = -0.2 +extern f64 D_800ED948;// = -0.55 +extern f64 D_800ED950;// = 0.004 +extern f64 D_800ED958;// = 0.004 +extern f64 D_800ED960;// = 0.01 +extern f64 D_800ED968;// = 0.01 +extern f64 D_800ED970;// = 0.008 +extern f64 D_800ED978;// = 0.008 +extern f64 D_800ED980;// = 0.3 +extern f64 D_800ED988;// = 0.15 +extern f64 D_800ED990;// = 0.05 +extern f64 D_800ED998;// = 0.04 +extern f64 D_800ED9A0;// = -0.85 +extern f64 D_800ED9A8;// = -0.55 +extern f64 D_800ED9B0;// = 0.05 f32 func_80030150(Player *player, s8 arg1) { - f32 sp24; - f32 sp1C; - Player *temp_a0_2; - Player *temp_a0_3; - Player *temp_a3; - f32 *temp_a0; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f12; - f32 temp_f2; - f32 temp_f2_2; - f32 temp_f2_3; - f32 temp_f4; - f64 temp_f18; - s16 temp_v0_6; - s32 temp_a1; - s32 temp_a1_2; - s32 temp_a1_3; - s32 temp_a2; - s32 temp_lo; - s32 temp_lo_2; - s32 temp_lo_3; - s32 temp_t0; - s32 temp_t5; - u16 temp_v0_5; - u16 temp_v1; - u8 temp_v0; - u8 temp_v0_2; - u8 temp_v0_3; - u8 temp_v0_4; - s32 phi_v0; - f32 phi_f0; - Player *phi_a3; - f32 phi_f0_2; - s32 phi_v0_2; - Player *phi_a3_2; - f32 phi_f14; - Player *phi_a3_3; - f32 phi_f0_3; - f32 phi_f2; - f32 phi_f0_4; - f64 phi_f4; - f32 phi_f0_5; - f32 phi_f0_6; - f32 phi_f0_7; - f32 phi_f0_8; - f32 phi_f0_9; - f64 phi_f4_2; - f32 phi_f0_10; - f32 phi_f0_11; - f32 phi_f0_12; - f64 phi_f6; - - temp_a3 = player; - temp_f2 = (player->unk_094 / 18.0f) * 216.0f; - phi_a3 = temp_a3; - phi_f0_2 = 0.0f; - phi_f14 = 0.0f; - phi_f0_6 = 0.0f; - phi_f0_12 = 0.0f; - if (temp_f2 >= 8.0f) { - temp_a1 = player->unk_0BC; - temp_t0 = temp_a1 & 0x200; - temp_a2 = temp_a1 & 8; - if (temp_t0 != 0x200) { - temp_v0 = player->boundingBoxCorners[3].surfaceType; - if ((s32) temp_v0 >= 0xF) { + f32 var_f0; + s16 temp_lo; + f32 var_f2; + s32 var_v0; + var_f0 = 0.0f; + var_f2 = (player->unk_094 / 18.0f) * 216.0f; + if (var_f2 >= 8.0f) { + if ((player->unk_0BC & 0x200) != 0x200) { + if(1) {} + if ((s32) player->boundingBoxCorners[3].surfaceType >= 0xF) { + // ??????? } else { - phi_f0_12 = 0.0f + D_800E2E90[temp_a3->characterId][temp_v0]; + var_f0 += D_800E2E90[player->characterId][player->boundingBoxCorners[3].surfaceType]; } - temp_v0_2 = temp_a3->boundingBoxCorners[2].surfaceType; - phi_f0_10 = phi_f0_12; - if ((s32) temp_v0_2 < 0xF) { - phi_f0_10 = phi_f0_12 + *(*(D_800E2E90 + (temp_a3->characterId * 4)) + (temp_v0_2 * 4)); + if ((s32) player->boundingBoxCorners[2].surfaceType < 0xF) { + var_f0 += D_800E2E90[player->characterId][player->boundingBoxCorners[2].surfaceType]; } - temp_v0_3 = temp_a3->boundingBoxCorners[1].surfaceType; - phi_f0_8 = phi_f0_10; - if ((s32) temp_v0_3 < 0xF) { - phi_f0_8 = phi_f0_10 + D_800E2EB0[temp_a3->characterId][temp_v0_3]; + if ((s32) player->boundingBoxCorners[1].surfaceType < 0xF) { + var_f0 += D_800E2EB0[player->characterId][player->boundingBoxCorners[1].surfaceType]; } - temp_v0_4 = temp_a3->boundingBoxCorners[0].surfaceType; - phi_f0_6 = phi_f0_8; - if ((s32) temp_v0_4 < 0xF) { - phi_f0_6 = phi_f0_8 + *(*(D_800E2E90 + (temp_a3->characterId * 4)) + (temp_v0_4 * 4)); + if ((s32) player->boundingBoxCorners[0].surfaceType < 0xF) { + var_f0 += D_800E2E90[player->characterId][player->boundingBoxCorners[0].surfaceType]; } } - phi_f0_5 = phi_f0_6; - if ((temp_a2 != 8) && ((temp_a3->unk_0CA & 2) != 2)) { - temp_lo = (s32) temp_a3->unk_0C4 / 182; - if (temp_f2 >= 20.0f) { - if (((s32) (s16) temp_lo >= 0x12) || ((s32) (s16) temp_lo < -0x11)) { - phi_f0_11 = (f32) ((f64) phi_f0_6 - (((f64) (s16) temp_lo * 0.0126) / 3.0)); + if (((player->unk_0BC & 8) != 8) && ((player->unk_0CA & 2) != 2)) { + temp_lo = player->unk_0C4 / 182; + if (var_f2 >= 20.0f) { + if ((temp_lo > 0x11) || (temp_lo < -0x11)) { + var_f0 -= ((temp_lo * 0.0126) / 3.0); } else { - phi_f6 = (f64) phi_f0_6 - (((f64) (s16) temp_lo * 0.026) / 3.0); - goto block_20; + var_f0 -= ((temp_lo * 0.026) / 3.0); } } else { - temp_f0 = (f32) ((f64) phi_f0_6 + -0.2); - phi_f0_11 = temp_f0; - if ((temp_a1 & 0x40000000) == 0x40000000) { - phi_f6 = (f64) temp_f0 + -0.55; -block_20: - phi_f0_11 = (f32) phi_f6; + var_f0 += -0.2; + if ((player->unk_0BC & 0x40000000) == 0x40000000) { + var_f0 += -0.55; } } - if (((temp_a1 & 0x10) == 0x10) || ((s32) temp_a3->unk_204 > 0)) { - temp_lo_2 = (s32) temp_a3->unk_0C0 / 182; - phi_v0 = temp_lo_2; - if (temp_lo_2 < 0) { - phi_f0_9 = (f32) ((f64) phi_f0_11 + ((f64) -temp_lo_2 * 0.004)); + if (((player->unk_0BC & 0x10) == 0x10) || (player->unk_204 > 0)) { + var_v0 = (s16) player->unk_0C0 / 182; + if (var_v0 < 0) { + var_f0 += -var_v0 * 0.004; } else { - phi_f0_9 = (f32) ((f64) phi_f0_11 + ((f64) temp_lo_2 * 0.004)); + var_f0 += var_v0 * 0.004; } } else { - temp_v1 = temp_a3->characterId; - temp_lo_3 = (s32) temp_a3->unk_0C0 / 182; - phi_v0 = temp_lo_3; - if (temp_lo_3 < 0) { - phi_f0_9 = (f32) ((f64) phi_f0_11 + ((f64) -temp_lo_3 * (0.01 + (f64) gKartTurnSpeedReductionTable0[temp_v1]))); + var_v0 = (s16) player->unk_0C0 / 182; + if (var_v0 < 0) { + var_f0 += -var_v0 * (0.01 + gKartTurnSpeedReductionTable0[player->characterId]); } else { - phi_f0_9 = (f32) ((f64) phi_f0_11 + ((f64) temp_lo_3 * (0.01 + (f64) gKartTurnSpeedReductionTable0[temp_v1]))); + var_f0 += var_v0 * (0.01 + gKartTurnSpeedReductionTable0[player->characterId]); } } - phi_f0_7 = phi_f0_9; - if (((temp_a1 & 0x20000000) == 0x20000000) && ((s32) temp_a3->unk_228 < 0xA)) { - if (phi_v0 < 0) { - phi_f4_2 = (f64) phi_f0_9 + ((f64) -phi_v0 * 0.008); + if (((player->unk_0BC & 0x20000000) == 0x20000000) && (player->unk_228 < 0xA)) { + if (var_v0 < 0) { + var_f0 += -var_v0 * 0.008; } else { - phi_f4_2 = (f64) phi_f0_9 + ((f64) phi_v0 * 0.008); + var_f0 += var_v0 * 0.008; } - phi_f0_7 = (f32) phi_f4_2; } - phi_f0_5 = phi_f0_7; - if (temp_t0 == 0x200) { - phi_f0_5 = (f32) ((f64) phi_f0_7 + -0.25); + if ((player->unk_0BC & 0x200) == 0x200) { + var_f0 += -0.25; } } - temp_v0_5 = temp_a3->unk_0DE; - phi_f0_4 = phi_f0_5; - if ((temp_v0_5 & 1) == 1) { - phi_f4 = (f64) phi_f0_5 + 0.3; - goto block_44; - } - if ((temp_v0_5 & 2) == 2) { - phi_f0_4 = (f32) ((f64) phi_f0_5 + 0.15); - } - temp_f2_2 = D_801652A0[arg1]; - phi_f0 = phi_f0_4; - if (((f64) (temp_f2_2 - temp_a3->boundingBoxCorners[2].cornerGroundY) >= 3.5) || ((f64) (temp_f2_2 - temp_a3->boundingBoxCorners[3].cornerGroundY) >= 3.5)) { - phi_f4 = (f64) phi_f0_4 + 0.05; -block_44: - phi_f0 = (f32) phi_f4; - } - if (temp_a2 != 0) { - temp_f18 = (f64) temp_a3->unk_08C * 0.04; - sp24 = phi_f0; - player = temp_a3; - move_f32_towards(&temp_a3->unk_0A0, (f32) temp_f18, 0.15f, temp_a3); - phi_a3 = player; - phi_f0_2 = phi_f0; + if ((player->unk_0DE & 1) == 1) { + var_f0 += 0.3; } else { - player = temp_a3; - sp24 = phi_f0; - move_f32_towards(&temp_a3->unk_0A0, 0.0f, 0.1f, temp_a3); - phi_a3 = player; - phi_f0_2 = phi_f0; + if ((player->unk_0DE & 2) == 2) { + var_f0 += 0.15; + } + if (((D_801652A0[arg1] - player->boundingBoxCorners[2].cornerGroundY) >= 3.5) || ((D_801652A0[arg1] - player->boundingBoxCorners[3].cornerGroundY) >= 3.5)) { + var_f0 += 0.05; + } + } + if ((player->unk_0BC & 8) != 0) { + move_f32_towards(&player->unk_0A0, player->unk_08C * 0.04, 0.15f); + } else { + move_f32_towards(&player->unk_0A0, 0.0f, 0.1f); } } else { - temp_a3->unk_0A0 = 0.0f; - temp_a3->unk_0E8 = 0.0f; - if (((s32) temp_a3->unk_0C4 / 182) < 0) { - temp_f0_2 = (f32) ((f64) 0.0f + -0.85); - phi_f0_2 = temp_f0_2; - if ((temp_a3->unk_0BC * 2) < 0) { - phi_f0_2 = (f32) ((f64) temp_f0_2 + -0.55); + player->unk_0A0 = 0.0f; + player->unk_0E8 = 0.0f; + if (((s16) player->unk_0C4 / 182) < 0) { + var_f0 += -0.85; + if (player->unk_0BC & 0x40000000) { + var_f0 += -0.55; } } } - temp_t5 = phi_a3->unk_000 & 0x4000; - phi_v0_2 = temp_t5; - phi_a3_2 = phi_a3; - phi_f14 = 0.0f; - if (temp_t5 != 0x4000) { - if ((phi_a3->unk_0BC & 0x200000) == 0x200000) { - player = phi_a3; - sp24 = phi_f0_2; - move_f32_towards(phi_a3 + 0xE8, 380.0f, 0.5f, phi_a3); - phi_v0_2 = player->unk_000 & 0x4000; - phi_a3_2 = player; + if ((player->unk_000 & 0x4000) != 0x4000) { + if ((player->unk_0BC & 0x200000) == 0x200000) { + move_f32_towards(&player->unk_0E8, 380.0f, 0.5f); } else { - player = phi_a3; - sp24 = phi_f0_2; - move_f32_towards(phi_a3 + 0xE8, 0.0f, 0.1f, phi_a3); - phi_v0_2 = player->unk_000 & 0x4000; - phi_a3_2 = player; - } - } - phi_a3_3 = phi_a3_2; - phi_f0_3 = phi_f0_2; - if (phi_v0_2 == 0x4000) { - temp_a1_2 = phi_a3_2->unk_0BC; - temp_a0 = phi_a3_2 + 0xE8; - if (((temp_a1_2 & 0x100) == 0x100) && ((temp_a1_2 & 0x10) != 0x10)) { - player = phi_a3_2; - sp24 = phi_f0_2; - move_f32_towards(temp_a0, 580.0f, 0.2f, phi_a3_2); + move_f32_towards(&player->unk_0E8, 0.0f, 0.1f); + } + } + if ((player->unk_000 & 0x4000) == 0x4000) { + if (((player->unk_0BC & 0x100) == 0x100) && ((player->unk_0BC & 0x10) != 0x10)) { + move_f32_towards(&player->unk_0E8, 580.0f, 0.2f); } else { - player = phi_a3_2; - sp24 = phi_f0_2; - move_f32_towards(temp_a0, phi_f14, 0.01f, phi_a3_2); + move_f32_towards(&player->unk_0E8, 0.0f, 0.01f); } if ((player->unk_0BC & 0x200000) == 0x200000) { - player = player; - sp24 = sp24; - move_f32_towards(player + 0xE4, 580.0f, 0.01f, player); + move_f32_towards(&player->unk_0E4, 580.0f, 0.01f); } else { - player = player; - sp24 = sp24; - move_f32_towards(player + 0xE4, 0.0f, 0.01f, player); - } - phi_a3_3 = player; - phi_f0_3 = sp24; - } - player = phi_a3_3; - move_f32_towards(&phi_a3_3->unk_104, phi_f0_3, (f32) ((f64) gKartTurnSpeedReductionTable1[phi_a3_3->characterId] + 0.05), phi_a3_3); - temp_f0_3 = player->unk_08C; - temp_f12 = player->boostPower; - temp_f2_3 = (temp_f0_3 + player->unk_0E8 + temp_f12 + player->unk_0E4) - player->unk_0A0; - phi_f2 = temp_f2_3; - if (temp_f2_3 < 0.0f) { - phi_f2 = 0.0f; + move_f32_towards(&player->unk_0E4, 0.0f, 0.01f); + } } - temp_v0_6 = player->unk_0CA; - if (((temp_v0_6 & 2) == 2) || ((temp_v0_6 & 8) == 8) || ((player->unk_000 & 0x2000) == 0x2000)) { - return (1.0f - player->unk_104) * phi_f2; - } - temp_a1_3 = player->unk_0BC; - if (((temp_a1_3 & 0x80) == 0x80) || ((temp_a1_3 & 0x40) == 0x40) || ((temp_a1_3 & 0x01000000) == 0x01000000) || ((temp_a1_3 & 0x02000000) == 0x02000000)) { - return (1.0f - player->unk_104) * phi_f2; - } - if (((temp_a1_3 & 0x2000) == 0x2000) || ((temp_a1_3 & 0x100000) == 0x100000) || (temp_a0_2 = player, ((temp_a1_3 & 4) == 4))) { - temp_f4 = temp_f12 + temp_f0_3; - temp_a0_3 = player; - player = player; - func_8002FE84(temp_f12, temp_a0_3, temp_f4); + move_f32_towards(&player->unk_104, var_f0, gKartTurnSpeedReductionTable1[player->characterId] + 0.05); + var_f2 = (player->unk_08C + player->unk_0E8 + player->boostPower + player->unk_0E4) - player->unk_0A0; + if (var_f2 < 0.0f) { + var_f2 = 0.0f; + } + if (((player->unk_0CA & 2) == 2) || ((player->unk_0CA & 8) == 8) || ((player->unk_000 & 0x2000) == 0x2000)) { + return (1.0f - player->unk_104) * var_f2; + } + if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) || ((player->unk_0BC & 0x01000000) == 0x01000000) || ((player->unk_0BC & 0x02000000) == 0x02000000)) { + return (1.0f - player->unk_104) * var_f2; + } + // Have to `and` the 0x2000 here to force the compiler to reload the immediate + if (((player->unk_0BC & 0x2000) == (0x2000 & 0xFFFFFFFF)) || ((player->unk_0BC & 0x100000) == 0x100000) || ((player->unk_0BC & 4) == 4)) { + func_8002FE84(player, player->boostPower + player->unk_08C); return player->boostPower + player->unk_08C; } - player = player; - sp1C = phi_f2; - func_8002FE84(temp_f12, temp_a0_2, phi_f2); - return (1.0f - player->unk_104) * phi_f2; + func_8002FE84(player, var_f2); + return (1.0f - player->unk_104) * var_f2; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80030150.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_800ED9B8; -extern f32 D_800ED9BC; -extern f32 D_800ED9C0; -extern f32 D_800ED9C4; -extern f32 D_800ED9C8; -extern f32 D_800ED9CC; -extern f32 D_800ED9D0; -extern f32 D_800ED9D4; - -void func_80030A34(void *arg0) { - s16 temp_v0; - s16 temp_v0_3; - u16 temp_v0_2; - void *phi_a1; - f32 phi_f0; - f32 phi_f2; - f32 phi_f12; - - temp_v0 = arg0->unkCA; - phi_a1 = arg0; - if (((temp_v0 & 2) != 2) && ((temp_v0 & 8) != 8)) { - if ((((arg0->unk94 / 18.0f) * 216.0f) >= 8.0f) && (arg0->unkDC0 < 1.0f)) { - temp_v0_2 = arg0->unkF8; - if (temp_v0_2 != 1) { - if ((temp_v0_2 != 0xE) && (temp_v0_2 != 0x10)) { - phi_f0 = D_800ED9C8; - phi_f2 = D_800ED9CC; - phi_f12 = 0.0f; - } else { - phi_f0 = D_800ED9C0; - phi_f2 = D_800ED9C4; - phi_f12 = 0.0f; - } - } else { - arg0 = arg0; - phi_a1 = arg0; - if (random_int(0xA) != 8) { - phi_f0 = D_800ED9B8; - phi_f2 = D_800ED9BC; - phi_f12 = 0.0f; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0 +extern f32 D_800ED9B8// = 0.35f; +extern f32 D_800ED9BC// = 0.55f; +extern f32 D_800ED9C0// = 0.94f; +extern f32 D_800ED9C4// = 0.85f; +extern f32 D_800ED9C8// = 0.46f; +extern f32 D_800ED9CC// = 0.48f; +extern f32 D_800ED9D0// = 0.3f; +extern f32 D_800ED9D4// = 0.54f; +void func_80030A34(Player *player) { + f32 var_f0; + f32 var_f2; + + if (((player->unk_0CA & 2) != 2) && ((player->unk_0CA & 8) != 8)) { + if ((((player->unk_094 / 18.0f) * 216.0f) >= 8.0f) && (player->unk_DC0 < 1.0f)) { + switch (player->unk_0F8) { /* irregular */ + case 1: + if (random_int(0x000AU) != 8) { + var_f0 = 0.35f; + var_f2 = 0.55f; } else { - arg0->unk7A = 0; - arg0->unk108 = 0.0f; - goto block_16; + player->unk_07A = 0; + player->unk_108 = 0.0f; + var_f0 = 0.0f; + var_f2 = 0.0f; } + break; + case 14: + case 16: + var_f0 = 0.94f; + var_f2 = 0.85f; + break; + default: + if(1){} + var_f0 = 0.46f; + var_f2 = 0.48f; + break; } + } else if (random_int(0x000AU) != 8) { + var_f0 = 0.3f; + var_f2 = 0.54f; } else { - arg0 = arg0; - phi_a1 = arg0; - if (random_int(0xA) != 8) { - phi_f0 = D_800ED9D0; - phi_f2 = D_800ED9D4; - phi_f12 = 0.0f; - } else { - arg0->unk7A = 0; - arg0->unk108 = 0.0f; -block_16: - phi_a1 = arg0; - phi_f0 = 0.0f; - phi_f2 = 0.0f; - phi_f12 = 0.0f; - } + player->unk_07A = 0; + player->unk_108 = 0.0f; + var_f0 = 0.0f; + var_f2 = 0.0f; } - phi_a1->unk7A = phi_a1->unk7A + 1; - temp_v0_3 = phi_a1->unk7A; - phi_a1->unk108 = (temp_v0_3 * phi_f0) - (0.5 * phi_f2 * (temp_v0_3 * temp_v0_3)); - if ((temp_v0_3 != 0) && (phi_a1->unk108 < phi_f12)) { - phi_a1->unk7A = 0; + player->unk_07A += 1; + player->unk_108 = (player->unk_07A * var_f0) - (0.5 * var_f2 * (player->unk_07A * player->unk_07A)); + if ((player->unk_07A != 0) && (player->unk_108 < 0.0f)) { + player->unk_07A = 0; } - if (phi_a1->unk108 <= phi_f12) { - phi_a1->unk108 = phi_f12; + if (player->unk_108 <= 0.0f) { + player->unk_108 = 0.0f; } } } @@ -4090,193 +3809,126 @@ block_16: GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80030A34.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -// This is likely the function responsible for detecting triple-tap "A" -// for "fast" acceleration -void func_80030C34(s32 arg0) { - s32 sp4; - s32 *temp_a0; - s32 *temp_a1; - s32 *temp_a1_2; - s32 *temp_a3; - s32 *temp_v0; - s32 *temp_v0_2; - s32 *temp_v0_3; - s32 temp_a2; - s32 temp_a2_2; - s32 temp_t5; - s32 phi_v0; - s32 phi_a2; +// This is likely the function responsible for detecting triple-tap "A" for "fast" acceleration +void func_80030C34(Player *player) { + s32 var_v0; - if (arg0 == gPlayerOne) { - sp4 = 0; + if (player == gPlayerOne) { + var_v0 = 0; } - phi_v0 = sp4; - if (arg0 == gPlayerTwo) { - phi_v0 = 1; + if (player == gPlayerTwo) { + var_v0 = 1; } - if (arg0 == gPlayerThree) { - phi_v0 = 2; + if (player == gPlayerThree) { + var_v0 = 2; } - if (arg0 == gPlayerFour) { - phi_v0 = 3; + if (player == gPlayerFour) { + var_v0 = 3; } - if (arg0 == gPlayerFive) { - phi_v0 = 4; + if (player == gPlayerFive) { + var_v0 = 4; } - if (arg0 == gPlayerSix) { - phi_v0 = 5; + if (player == gPlayerSix) { + var_v0 = 5; } - if (arg0 == gPlayerSeven) { - phi_v0 = 6; + if (player == gPlayerSeven) { + var_v0 = 6; } - if (arg0 == gPlayerEight) { - phi_v0 = 7; + if (player == gPlayerEight) { + var_v0 = 7; } - temp_a0 = &D_80165460[phi_v0]; - temp_v0 = &D_80165480[phi_v0]; - if (*temp_a0 == 0) { - temp_v0_2 = &gPlayerIsThrottleActive[phi_v0]; - if (*temp_v0_2 == 1) { - temp_a1 = &D_80165420[phi_v0]; - temp_a2 = *temp_a1; - if ((temp_a2 < 2) || (temp_a2 >= 9)) { - D_80165440[phi_v0] = 0; + if (D_80165460[var_v0] == 0) { + if (gPlayerIsThrottleActive[var_v0] == 1) { + if ((D_80165420[var_v0] < 2) || (D_80165420[var_v0] >= 9)) { + D_80165440[var_v0] = 0; } - *temp_a1 = 0; - D_80165400[phi_v0] = 0; - } - temp_a1_2 = &D_80165420[phi_v0]; - *temp_v0_2 = 0; - temp_a3 = &D_80165440[phi_v0]; - temp_a2_2 = *temp_a1_2 + 1; - *temp_a1_2 = temp_a2_2; - phi_a2 = temp_a2_2; - if (temp_a2_2 >= 9) { - *temp_a1_2 = 9; - phi_a2 = 9; - } - if ((phi_a2 >= 2) && (phi_a2 < 9)) { - temp_v0_3 = &D_80165400[phi_v0]; - if (*temp_v0_3 == 0) { - *temp_a3 = *temp_a3 + 1; + D_80165420[var_v0] = 0; + D_80165400[var_v0] = 0; + } + gPlayerIsThrottleActive[var_v0] = 0; + D_80165420[var_v0]++; + if (D_80165420[var_v0] >= 9) { + D_80165420[var_v0] = 9; + } + if ((D_80165420[var_v0] >= 2) && (D_80165420[var_v0] < 9)) { + if (D_80165400[var_v0] == 0) { + D_80165440[var_v0] += 1; } - *temp_v0_3 = 1; + D_80165400[var_v0] = 1; } - if (*temp_a3 == 5) { - *temp_a0 = 1; - D_80165480[phi_v0] = 0x78; - *temp_a3 = 0; - *temp_a1_2 = 0; - return; + if (D_80165440[var_v0] == 5) { + D_80165460[var_v0] = 1; + D_80165480[var_v0] = 0x00000078; + D_80165440[var_v0] = 0; + D_80165420[var_v0] = 0; + } + } else { + D_80165480[var_v0]--; + if (D_80165480[var_v0] <= 0) { + D_80165460[var_v0] = 0; } - // Duplicate return node #33. Try simplifying control flow for better match - return; - } - temp_t5 = *temp_v0 - 1; - *temp_v0 = temp_t5; - if (temp_t5 <= 0) { - *temp_a0 = 0; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80030C34.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -// This is likely the function responsible for detecting triple-tap "A" -// for "fast" acceleration -void func_80030E00(s32 arg0) { - s32 sp4; - s32 *temp_a0; - s32 *temp_a1; - s32 *temp_a1_2; - s32 *temp_a3; - s32 *temp_v0; - s32 *temp_v0_2; - s32 *temp_v0_3; - s32 temp_a2; - s32 temp_a2_2; - s32 temp_t5; - s32 phi_v0; - s32 phi_a2; +void func_80030E00(Player *player) { + s32 var_v0; - if (arg0 == gPlayerOne) { - sp4 = 0; + if (player == gPlayerOne) { + var_v0 = 0; } - phi_v0 = sp4; - if (arg0 == gPlayerTwo) { - phi_v0 = 1; + if (player == gPlayerTwo) { + var_v0 = 1; } - if (arg0 == gPlayerThree) { - phi_v0 = 2; + if (player == gPlayerThree) { + var_v0 = 2; } - if (arg0 == gPlayerFour) { - phi_v0 = 3; + if (player == gPlayerFour) { + var_v0 = 3; } - if (arg0 == gPlayerFive) { - phi_v0 = 4; + if (player == gPlayerFive) { + var_v0 = 4; } - if (arg0 == gPlayerSix) { - phi_v0 = 5; + if (player == gPlayerSix) { + var_v0 = 5; } - if (arg0 == gPlayerSeven) { - phi_v0 = 6; + if (player == gPlayerSeven) { + var_v0 = 6; } - if (arg0 == gPlayerEight) { - phi_v0 = 7; + if (player == gPlayerEight) { + var_v0 = 7; } - temp_a0 = &D_80165460[phi_v0]; - temp_v0 = &D_80165480[phi_v0]; - if (*temp_a0 == 0) { - temp_v0_2 = &gPlayerIsThrottleActive[phi_v0]; - temp_a1 = &D_80165420[phi_v0]; - if (*temp_v0_2 == 0) { - temp_a2 = *temp_a1; - if ((temp_a2 < 2) || (temp_a2 >= 9)) { - D_80165440[phi_v0] = 0; + if (D_80165460[var_v0] == 0) { + if (gPlayerIsThrottleActive[var_v0] == 0) { + if ((D_80165420[var_v0] < 2) || (D_80165420[var_v0] >= 9)) { + D_80165440[var_v0] = 0; } - *temp_a1 = 0; - D_80165400[phi_v0] = 0; + D_80165420[var_v0] = 0; + D_80165400[var_v0] = 0; } - temp_a1_2 = &D_80165420[phi_v0]; - *temp_v0_2 = 1; - temp_a3 = &D_80165440[phi_v0]; - temp_a2_2 = *temp_a1_2 + 1; - *temp_a1_2 = temp_a2_2; - phi_a2 = temp_a2_2; - if (temp_a2_2 >= 9) { - *temp_a1_2 = 9; - phi_a2 = 9; - } - if ((phi_a2 >= 2) && (phi_a2 < 9)) { - temp_v0_3 = &D_80165400[phi_v0]; - if (*temp_v0_3 == 0) { - *temp_a3 = *temp_a3 + 1; + gPlayerIsThrottleActive[var_v0] = 1; + D_80165420[var_v0]++; + if (D_80165420[var_v0] >= 9) { + D_80165420[var_v0] = 9; + } + if ((D_80165420[var_v0] >= 2) && (D_80165420[var_v0] < 9)) { + if (D_80165400[var_v0] == 0) { + D_80165440[var_v0] += 1; } - *temp_v0_3 = 1; + D_80165400[var_v0] = 1; } - if (*temp_a3 == 5) { - *temp_a0 = 1; - D_80165480[phi_v0] = 0x78; - *temp_a3 = 0; - *temp_a1_2 = 0; - return; + if (D_80165440[var_v0] == 5) { + D_80165460[var_v0] = 1; + D_80165480[var_v0] = 0x00000078; + D_80165440[var_v0] = 0; + D_80165420[var_v0] = 0; + } + } else { + D_80165480[var_v0]--; + if (D_80165480[var_v0] <= 0) { + D_80165460[var_v0] = 0; } - // Duplicate return node #33. Try simplifying control flow for better match - return; - } - temp_t5 = *temp_v0 - 1; - *temp_v0 = temp_t5; - if (temp_t5 <= 0) { - *temp_a0 = 0; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80030E00.s") -#endif /* D_80165460 appears to track on a per-player index whether they're doing regular or "fast" accleration @@ -4400,414 +4052,281 @@ void func_80031F48(Player *player, f32 arg1) { } } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80032050(s32 arg0) { - s32 sp4; - s32 *temp_a0; - s32 *temp_a1; - s32 *temp_a1_2; - s32 *temp_a3; - s32 *temp_v0; - s32 *temp_v0_2; - s32 *temp_v0_3; - s32 temp_a2; - s32 temp_a2_2; - s32 temp_t5; - s32 phi_v0; - s32 phi_a2; +void func_80032050(Player *player) { + s32 var_v0; - if (arg0 == gPlayerOne) { - sp4 = 0; + if (player == gPlayerOne) { + var_v0 = 0; } - phi_v0 = sp4; - if (arg0 == gPlayerTwo) { - phi_v0 = 1; + if (player == gPlayerTwo) { + var_v0 = 1; } - if (arg0 == gPlayerThree) { - phi_v0 = 2; + if (player == gPlayerThree) { + var_v0 = 2; } - if (arg0 == gPlayerFour) { - phi_v0 = 3; + if (player == gPlayerFour) { + var_v0 = 3; } - if (arg0 == gPlayerFive) { - phi_v0 = 4; + if (player == gPlayerFive) { + var_v0 = 4; } - if (arg0 == gPlayerSix) { - phi_v0 = 5; + if (player == gPlayerSix) { + var_v0 = 5; } - if (arg0 == gPlayerSeven) { - phi_v0 = 6; + if (player == gPlayerSeven) { + var_v0 = 6; } - if (arg0 == gPlayerEight) { - phi_v0 = 7; + if (player == gPlayerEight) { + var_v0 = 7; } - temp_a0 = &D_80165520[phi_v0]; - temp_v0 = &D_80165540[phi_v0]; - if (*temp_a0 == 0) { - temp_v0_2 = &D_801654A0[phi_v0]; - if (*temp_v0_2 == 1) { - temp_a1 = &D_801654E0[phi_v0]; - temp_a2 = *temp_a1; - if ((temp_a2 < 2) || (temp_a2 >= 9)) { - D_80165500[phi_v0] = 0; + + if (D_80165520[var_v0] == 0) { + if (D_801654A0[var_v0] == 1) { + if ((D_801654E0[var_v0] < 2) || (D_801654E0[var_v0] >= 9)) { + D_80165500[var_v0] = 0; } - *temp_a1 = 0; - D_801654C0[phi_v0] = 0; - } - temp_a1_2 = &D_801654E0[phi_v0]; - *temp_v0_2 = 0; - temp_a3 = &D_80165500[phi_v0]; - temp_a2_2 = *temp_a1_2 + 1; - *temp_a1_2 = temp_a2_2; - phi_a2 = temp_a2_2; - if (temp_a2_2 >= 9) { - *temp_a1_2 = 9; - phi_a2 = 9; - } - if ((phi_a2 >= 2) && (phi_a2 < 9)) { - temp_v0_3 = &D_801654C0[phi_v0]; - if (*temp_v0_3 == 0) { - *temp_a3 = *temp_a3 + 1; + D_801654E0[var_v0] = 0; + D_801654C0[var_v0] = 0; + } + D_801654A0[var_v0] = 0; + D_801654E0[var_v0]++; + if (D_801654E0[var_v0] >= 9) { + D_801654E0[var_v0] = 9; + } + if ((D_801654E0[var_v0] >= 2) && (D_801654E0[var_v0] < 9)) { + if (D_801654C0[var_v0] == 0) { + D_80165500[var_v0]++; } - *temp_v0_3 = 1; + D_801654C0[var_v0] = 1; } - if (*temp_a3 == 5) { - *temp_a0 = 1; - D_80165540[phi_v0] = 0x78; - *temp_a3 = 0; - *temp_a1_2 = 0; - return; + if (D_80165500[var_v0] == 5) { + D_80165520[var_v0] = 1; + D_80165540[var_v0] = 0x00000078; + D_80165500[var_v0] = 0; + D_801654E0[var_v0] = 0; + } + } else { + D_80165540[var_v0]--; + if (D_80165540[var_v0] <= 0) { + D_80165520[var_v0] = 0; } - // Duplicate return node #33. Try simplifying control flow for better match - return; - } - temp_t5 = *temp_v0 - 1; - *temp_v0 = temp_t5; - if (temp_t5 <= 0) { - *temp_a0 = 0; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80032050.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8003221C(s32 arg0) { - s32 sp4; - s32 *temp_a0; - s32 *temp_a1; - s32 *temp_a1_2; - s32 *temp_a3; - s32 *temp_v0; - s32 *temp_v0_2; - s32 *temp_v0_3; - s32 temp_a2; - s32 temp_a2_2; - s32 temp_t5; - s32 phi_v0; - s32 phi_a2; +void func_8003221C(Player *player) { + s32 var_v0; - if (arg0 == gPlayerOne) { - sp4 = 0; + if (player == gPlayerOne) { + var_v0 = 0; } - phi_v0 = sp4; - if (arg0 == gPlayerTwo) { - phi_v0 = 1; + if (player == gPlayerTwo) { + var_v0 = 1; } - if (arg0 == gPlayerThree) { - phi_v0 = 2; + if (player == gPlayerThree) { + var_v0 = 2; } - if (arg0 == gPlayerFour) { - phi_v0 = 3; + if (player == gPlayerFour) { + var_v0 = 3; } - if (arg0 == gPlayerFive) { - phi_v0 = 4; + if (player == gPlayerFive) { + var_v0 = 4; } - if (arg0 == gPlayerSix) { - phi_v0 = 5; + if (player == gPlayerSix) { + var_v0 = 5; } - if (arg0 == gPlayerSeven) { - phi_v0 = 6; + if (player == gPlayerSeven) { + var_v0 = 6; } - if (arg0 == gPlayerEight) { - phi_v0 = 7; + if (player == gPlayerEight) { + var_v0 = 7; } - temp_a0 = &D_80165520[phi_v0]; - temp_v0 = &D_80165540[phi_v0]; - if (*temp_a0 == 0) { - temp_v0_2 = &D_801654A0[phi_v0]; - temp_a1 = &D_801654E0[phi_v0]; - if (*temp_v0_2 == 0) { - temp_a2 = *temp_a1; - if ((temp_a2 < 2) || (temp_a2 >= 9)) { - D_80165500[phi_v0] = 0; + + if (D_80165520[var_v0] == 0) { + if (D_801654A0[var_v0] == 0) { + if ((D_801654E0[var_v0] < 2) || (D_801654E0[var_v0] >= 9)) { + D_80165500[var_v0] = 0; } - *temp_a1 = 0; - D_801654C0[phi_v0] = 0; + D_801654E0[var_v0] = 0; + D_801654C0[var_v0] = 0; } - temp_a1_2 = &D_801654E0[phi_v0]; - *temp_v0_2 = 1; - temp_a3 = &D_80165500[phi_v0]; - temp_a2_2 = *temp_a1_2 + 1; - *temp_a1_2 = temp_a2_2; - phi_a2 = temp_a2_2; - if (temp_a2_2 >= 9) { - *temp_a1_2 = 9; - phi_a2 = 9; - } - if ((phi_a2 >= 2) && (phi_a2 < 9)) { - temp_v0_3 = &D_801654C0[phi_v0]; - if (*temp_v0_3 == 0) { - *temp_a3 = *temp_a3 + 1; + D_801654A0[var_v0] = 1; + D_801654E0[var_v0]++; + if (D_801654E0[var_v0] >= 9) { + D_801654E0[var_v0] = 9; + } + if ((D_801654E0[var_v0] >= 2) && (D_801654E0[var_v0] < 9)) { + if (D_801654C0[var_v0] == 0) { + D_80165500[var_v0]++; } - *temp_v0_3 = 1; + D_801654C0[var_v0] = 1; } - if (*temp_a3 == 5) { - *temp_a0 = 1; - D_80165540[phi_v0] = 0x78; - *temp_a3 = 0; - *temp_a1_2 = 0; - return; + if (D_80165500[var_v0] == 5) { + D_80165520[var_v0] = 1; + D_80165540[var_v0] = 0x00000078; + D_80165500[var_v0] = 0; + D_801654E0[var_v0] = 0; + } + } else { + D_80165540[var_v0]--; + if (D_80165540[var_v0] <= 0) { + D_80165520[var_v0] = 0; } - // Duplicate return node #33. Try simplifying control flow for better match - return; - } - temp_t5 = *temp_v0 - 1; - *temp_v0 = temp_t5; - if (temp_t5 <= 0) { - *temp_a0 = 0; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8003221C.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -void func_80031F48(f32, f32, f32); /* extern */ +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0 +extern f64 D_800EDB00;// = 0.02; +extern f64 D_800EDB08;// = 1.2; void func_800323E4(Player *player) { - s32 sp24; - f32 sp1C; - f32 temp_f0; - s32 temp_t5; - u8 temp_v0; - u8 temp_v0_2; - s32 phi_v1; - f32 phi_f2; - f32 phi_f12; - f32 phi_f2_2; - - phi_f2_2 = 0.0f; + s32 var_v1; + f32 test; + f32 var_f2; + + var_f2 = 0.0f; if (player == gPlayerOne) { - sp24 = 0; + var_v1 = 0; } - phi_v1 = sp24; if (player == gPlayerTwo) { - phi_v1 = 1; + var_v1 = 1; } if (player == gPlayerThree) { - phi_v1 = 2; + var_v1 = 2; } if (player == gPlayerFour) { - phi_v1 = 3; + var_v1 = 3; } if (player == gPlayerFive) { - phi_v1 = 4; + var_v1 = 4; } if (player == gPlayerSix) { - phi_v1 = 5; + var_v1 = 5; } if (player == gPlayerSeven) { - phi_v1 = 6; + var_v1 = 6; } if (player == gPlayerEight) { - phi_v1 = 7; - } - temp_t5 = player->unk_0BC | 1; - player->unk_0BC = temp_t5; - if ((temp_t5 & 0x20) == 0x20) { - func_80031F48(0.0f, 1.0f); - player->unk_20C = 0.0f; - return; + var_v1 = 7; } - temp_v0 = player->boundingBoxCorners[3].surfaceType; - if ((s32) temp_v0 < 0xF) { - phi_f2_2 = 0.0f + D_800E3210[player->characterId][temp_v0]; - } - temp_v0_2 = player->boundingBoxCorners[2].surfaceType; - phi_f2 = phi_f2_2; - if ((s32) temp_v0_2 < 0xF) { - phi_f2 = phi_f2_2 + D_800E3210[player->characterId][temp_v0_2]; - } - if ((player->unk_22C - player->unk_094) <= 0.0f) { - player->unk_20C = 0.0f; + player->unk_0BC |= 1; + // This check will never be true, why is it here? + if ((player->unk_0BC & 0x20) == 0x20) { + func_80031F48(player, 1.0f); + player->unk_20C = var_f2; } else { - player->unk_20C = (f32) ((f64) player->unk_20C + 0.02); - if (player->unk_20C >= 2.0f) { - player->unk_20C = 2.0f; + if ((s32) player->boundingBoxCorners[3].surfaceType < 0xF) { + var_f2 += D_800E3210[player->characterId][player->boundingBoxCorners[3].surfaceType]; } - } - phi_f12 = 2.0f; - if (D_80165520[phi_v1] == 1) { - if (player->unk_20C >= 2.0f) { - func_80031F48(2.0f, (1.0f - phi_f2) * 5.0f); - return; + if ((s32) player->boundingBoxCorners[2].surfaceType < 0xF) { + var_f2 += D_800E3210[player->characterId][player->boundingBoxCorners[2].surfaceType]; + } + test = player->unk_22C - player->unk_094; + if (test <= 0.0f) { + player->unk_20C = 0.0f; + } else { + player->unk_20C += 0.02; + if (player->unk_20C >= 2.0f) { + player->unk_20C = 2.0f; + } + } + if (D_80165520[var_v1] == 1) { + if (player->unk_20C >= 2.0f) { + func_80031F48(player, (1.0f - var_f2) * 5.0f); + } else { + func_80031F48(player, (1.0f - var_f2) * 3.0f); + } + } else { + if (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f) { + func_80031F48(player, (1.0f - var_f2) * 4.0f); + } + if (player->unk_20C >= 2.0f) { + func_80031F48(player, (1.0f - var_f2) * 2.5); + } else { + func_80031F48(player, (1.0f - var_f2) * 1.2); + } } - func_80031F48(2.0f, (1.0f - phi_f2) * 3.0f); - return; - } - if (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f) { - sp1C = phi_f2; - func_80031F48(2.0f, (1.0f - phi_f2) * 4.0f); - phi_f12 = 2.0f; - } - temp_f0 = 1.0f - phi_f2; - if (phi_f12 <= player->unk_20C) { - func_80031F48(phi_f12, (bitwise f32) player, (f32) ((f64) temp_f0 * 2.5)); - return; } - func_80031F48(phi_f12, (bitwise f32) player, (f32) ((f64) temp_f0 * 1.2)); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800323E4.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f64 D_800EDB10; -extern f64 D_800EDB18; -extern f64 D_800EDB20; -extern f64 D_800EDB28; -extern f64 D_800EDB30; -extern f64 D_800EDB38; -extern f64 D_800EDB40; -extern f64 D_800EDB48; -extern f64 D_800EDB50; -extern f64 D_800EDB58; -extern f64 D_800EDB60; -extern f64 D_800EDB68; -extern f64 D_800EDB70; -extern f64 D_800EDB78; -extern f64 D_800EDB80; -extern f64 D_800EDB88; -extern f32 D_800EDB90; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0 +extern f64 D_800EDB10// = 0.1; +extern f64 D_800EDB18// = 0.1; +extern f64 D_800EDB20// = 0.2; +extern f64 D_800EDB28// = 0.2; +extern f64 D_800EDB30// = 0.3; +extern f64 D_800EDB38// = 0.3; +extern f64 D_800EDB40// = 0.4; +extern f64 D_800EDB48// = 0.4; +extern f64 D_800EDB50// = 0.6; +extern f64 D_800EDB58// = 0.6; +extern f64 D_800EDB60// = 0.7; +extern f64 D_800EDB68// = 0.7; +extern f64 D_800EDB70// = 0.8; +extern f64 D_800EDB78// = 0.8; +extern f64 D_800EDB80// = 0.9; +extern f64 D_800EDB88// = 0.9; +extern f32 D_800EDB90// = 0.9; extern s16 D_801656F0; -extern ? gKartAccelerationTables; extern s32 gRaceFrameCounter; -void func_80032700(void *arg0) { - f32 temp_f0_2; - f64 temp_f0; - f64 temp_f2; - s32 temp_t6; +void func_80032700(Player *player) { s32 temp_v0; - f64 phi_f0; - f64 phi_f2; - f64 phi_f0_2; - f64 phi_f2_2; - f64 phi_f0_3; - f64 phi_f2_3; - f64 phi_f0_4; - f64 phi_f2_4; - f64 phi_f0_5; - f64 phi_f2_5; - f64 phi_f0_6; - f64 phi_f2_6; - f64 phi_f0_7; - f64 phi_f2_7; - f64 phi_f0_8; - f64 phi_f2_8; - f64 phi_f0_9; - s32 phi_v0; - - temp_f0 = arg0->unk9C; - phi_f0 = temp_f0; - if ((temp_f0 >= 0.0) && (temp_f0 < (arg0->unk214 * D_800EDB10))) { - arg0->unk9C = temp_f0 + (**(&gKartAccelerationTables + (arg0->unk254 * 4)) * 3.0); - phi_f0 = arg0->unk9C; - } - temp_f2 = arg0->unk214; - phi_f2 = temp_f2; - phi_f0_2 = phi_f0; - if (((temp_f2 * D_800EDB18) <= phi_f0) && (phi_f0 < (temp_f2 * D_800EDB20))) { - arg0->unk9C = phi_f0 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk4 * 3.0); - phi_f2 = arg0->unk214; - phi_f0_2 = arg0->unk9C; - } - phi_f2_2 = phi_f2; - phi_f0_3 = phi_f0_2; - if (((phi_f2 * D_800EDB28) <= phi_f0_2) && (phi_f0_2 < (phi_f2 * D_800EDB30))) { - arg0->unk9C = phi_f0_2 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk8 * 3.0); - phi_f2_2 = arg0->unk214; - phi_f0_3 = arg0->unk9C; - } - phi_f2_3 = phi_f2_2; - phi_f0_4 = phi_f0_3; - if (((phi_f2_2 * D_800EDB38) <= phi_f0_3) && (phi_f0_3 < (phi_f2_2 * D_800EDB40))) { - arg0->unk9C = phi_f0_3 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unkC * 3.0); - phi_f2_3 = arg0->unk214; - phi_f0_4 = arg0->unk9C; - } - phi_f2_4 = phi_f2_3; - phi_f0_5 = phi_f0_4; - if (((phi_f2_3 * D_800EDB48) <= phi_f0_4) && (phi_f0_4 < (phi_f2_3 * 0.5))) { - arg0->unk9C = phi_f0_4 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk10 * 3.0); - phi_f2_4 = arg0->unk214; - phi_f0_5 = arg0->unk9C; - } - phi_f2_5 = phi_f2_4; - phi_f0_6 = phi_f0_5; - if (((phi_f2_4 * 0.5) <= phi_f0_5) && (phi_f0_5 < (phi_f2_4 * D_800EDB50))) { - arg0->unk9C = phi_f0_5 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk14 * 3.0); - phi_f2_5 = arg0->unk214; - phi_f0_6 = arg0->unk9C; - } - phi_f2_6 = phi_f2_5; - phi_f0_7 = phi_f0_6; - if (((phi_f2_5 * D_800EDB58) <= phi_f0_6) && (phi_f0_6 < (phi_f2_5 * D_800EDB60))) { - arg0->unk9C = phi_f0_6 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk18 * 2.5); - phi_f2_6 = arg0->unk214; - phi_f0_7 = arg0->unk9C; - } - phi_f2_7 = phi_f2_6; - phi_f0_8 = phi_f0_7; - if (((phi_f2_6 * D_800EDB68) <= phi_f0_7) && (phi_f0_7 < (phi_f2_6 * D_800EDB70))) { - arg0->unk9C = phi_f0_7 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk1C * 2.5); - phi_f2_7 = arg0->unk214; - phi_f0_8 = arg0->unk9C; - } - phi_f2_8 = phi_f2_7; - phi_f0_9 = phi_f0_8; - if (((phi_f2_7 * D_800EDB78) <= phi_f0_8) && (phi_f0_8 < (phi_f2_7 * D_800EDB80))) { - arg0->unk9C = phi_f0_8 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk20 * 2.5); - phi_f2_8 = arg0->unk214; - phi_f0_9 = arg0->unk9C; - } - if (((phi_f2_8 * D_800EDB88) <= phi_f0_9) && (phi_f0_9 <= phi_f2_8)) { - arg0->unk9C = phi_f0_9 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk24 * 2.5); + s32 var_v0; + s32 test; + + temp_v0 = get_player_index_for_player(player); + if ((player->unk_09C >= 0.0) && (player->unk_09C < (player->unk_214 * 0.1))) { + player->unk_09C += gKartAccelerationTables[player->characterId][0] * 3.0; + } + if (((player->unk_214 * 0.1) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.2))) { + player->unk_09C += gKartAccelerationTables[player->characterId][1] * 3.0; + } + if (((player->unk_214 * 0.2) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.3))) { + player->unk_09C += gKartAccelerationTables[player->characterId][2] * 3.0; + } + if (((player->unk_214 * 0.3) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.4))) { + player->unk_09C += gKartAccelerationTables[player->characterId][3] * 3.0; + } + if (((player->unk_214 * 0.4) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.5))) { + player->unk_09C += gKartAccelerationTables[player->characterId][4] * 3.0; + } + if (((player->unk_214 * 0.5) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.6))) { + player->unk_09C += gKartAccelerationTables[player->characterId][5] * 3.0; + } + if (((player->unk_214 * 0.6) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.7))) { + player->unk_09C += gKartAccelerationTables[player->characterId][6] * 2.5; + } + if (((player->unk_214 * 0.7) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.8))) { + player->unk_09C += gKartAccelerationTables[player->characterId][7] * 2.5; + } + if (((player->unk_214 * 0.8) <= player->unk_09C) && (player->unk_09C < (player->unk_214 * 0.9))) { + player->unk_09C += gKartAccelerationTables[player->characterId][8] * 2.5; + } + if (((player->unk_214 * 0.9) <= player->unk_09C) && (player->unk_09C <= player->unk_214 * 1.0)) { + player->unk_09C += gKartAccelerationTables[player->characterId][9] * 2.5; } if (D_801656F0 == 1) { - phi_v0 = 8; - if (gModeSelection == TIME_TRIALS) { - phi_v0 = 0x14; - } - if (((gRaceFrameCounter - D_801652E0[get_player_index_for_player()]) < phi_v0) && ((arg0->unk44 & 0x20) != 0x20)) { - arg0->unkC = arg0->unkC | 0x2000000; - } else if ((arg0->unk214 * D_800EDB90) <= arg0->unk9C) { - temp_v0 = arg0->unkC; - temp_t6 = temp_v0 | 0x10000000; - if ((temp_v0 & 0x2000000) != 0x2000000) { - arg0->unkC = temp_t6; - arg0->unkC = temp_t6 & 0xFDFFFFFF; + test = gRaceFrameCounter - D_801652E0[temp_v0]; + if (gModeSelection == (s32) 1) { + var_v0 = 0x14; + } else { + var_v0 = 8; + } + if ((test < var_v0) && ((player->unk_044 & 0x20) != 0x20)) { + player->statusEffects |= 0x02000000; + } else if ((player->unk_214 * 0.9f) <= player->unk_09C) { + if ((player->statusEffects & 0x02000000) != 0x02000000) { + player->statusEffects |= 0x10000000; + player->statusEffects &= ~0x02000000; } } } - temp_f0_2 = arg0->unk9C; - arg0->unk44 = arg0->unk44 | 0x20; - arg0->unk98 = (temp_f0_2 * temp_f0_2) / 25.0f; + player->unk_044 |= 0x20; + player->unk_098 = (player->unk_09C * player->unk_09C) / 25.0f; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80032700.s") @@ -4890,157 +4409,81 @@ void func_80033280(Player *player, f32 arg1) { player->unk_098 = (player->unk_09C * player->unk_09C) / 25.0f; } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f64 D_800EDC48; -extern f64 D_800EDC50; -extern f64 D_800EDC58; -extern f64 D_800EDC60; -extern f64 D_800EDC68; -extern f64 D_800EDC70; -extern f64 D_800EDC78; -extern f64 D_800EDC80; -extern f64 D_800EDC88; -extern f64 D_800EDC90; -extern f64 D_800EDC98; -extern f64 D_800EDCA0; -extern f64 D_800EDCA8; -extern f64 D_800EDCB0; -extern f64 D_800EDCB8; -extern f64 D_800EDCC0; -extern f64 D_800EDCC8; -extern f64 D_800EDCD0; -extern f64 D_800EDCD8; -extern f64 D_800EDCE0; -extern ? gKartAccelerationTables; - -void func_800332E8(void *arg0, s32 arg1) { - f32 *temp_v0; - f64 temp_f0; - f64 temp_f12; - f64 temp_f12_2; - f64 temp_f2; - f64 phi_f0; - f64 phi_f2; - f64 phi_f0_2; - f64 phi_f2_2; - f64 phi_f0_3; - f64 phi_f2_3; - f64 phi_f0_4; - f64 phi_f2_4; - f64 phi_f0_5; - f64 phi_f2_5; - f64 phi_f0_6; - f64 phi_f2_6; - f64 phi_f0_7; - f64 phi_f2_7; - f64 phi_f0_8; - f64 phi_f2_8; - f64 phi_f0_9; - - temp_v0 = &D_80165280[arg1]; - temp_f0 = *temp_v0; - phi_f0 = temp_f0; - if ((temp_f0 >= 0.0) && (temp_f0 < (arg0->unk214 * D_800EDC48))) { - *temp_v0 = temp_f0 + (**(&gKartAccelerationTables + (arg0->unk254 * 4)) * D_800EDC50); - phi_f0 = *temp_v0; - } - temp_f12 = D_800EDC58; - temp_f2 = arg0->unk214; - phi_f2 = temp_f2; - phi_f0_2 = phi_f0; - if (((temp_f2 * D_800EDC60) <= phi_f0) && (phi_f0 < (temp_f2 * D_800EDC68))) { - *temp_v0 = phi_f0 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk4 * temp_f12); - phi_f2 = arg0->unk214; - phi_f0_2 = *temp_v0; - } - phi_f2_2 = phi_f2; - phi_f0_3 = phi_f0_2; - if (((phi_f2 * D_800EDC70) <= phi_f0_2) && (phi_f0_2 < (phi_f2 * D_800EDC78))) { - *temp_v0 = phi_f0_2 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk8 * temp_f12); - phi_f2_2 = arg0->unk214; - phi_f0_3 = *temp_v0; - } - phi_f2_3 = phi_f2_2; - phi_f0_4 = phi_f0_3; - if (((phi_f2_2 * D_800EDC80) <= phi_f0_3) && (phi_f0_3 < (phi_f2_2 * D_800EDC88))) { - *temp_v0 = phi_f0_3 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unkC * temp_f12); - phi_f2_3 = arg0->unk214; - phi_f0_4 = *temp_v0; - } - phi_f2_4 = phi_f2_3; - phi_f0_5 = phi_f0_4; - if (((phi_f2_3 * D_800EDC90) <= phi_f0_4) && (phi_f0_4 < (phi_f2_3 * 0.5))) { - *temp_v0 = phi_f0_4 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk10 * temp_f12); - phi_f2_4 = arg0->unk214; - phi_f0_5 = *temp_v0; - } - phi_f2_5 = phi_f2_4; - phi_f0_6 = phi_f0_5; - if (((phi_f2_4 * 0.5) <= phi_f0_5) && (phi_f0_5 < (phi_f2_4 * D_800EDC98))) { - *temp_v0 = phi_f0_5 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk14 * temp_f12); - phi_f2_5 = arg0->unk214; - phi_f0_6 = *temp_v0; - } - phi_f2_6 = phi_f2_5; - phi_f0_7 = phi_f0_6; - if (((phi_f2_5 * D_800EDCA0) <= phi_f0_6) && (phi_f0_6 < (phi_f2_5 * D_800EDCA8))) { - *temp_v0 = phi_f0_6 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk18 * temp_f12); - phi_f2_6 = arg0->unk214; - phi_f0_7 = *temp_v0; - } - phi_f2_7 = phi_f2_6; - phi_f0_8 = phi_f0_7; - if (((phi_f2_6 * D_800EDCB0) <= phi_f0_7) && (phi_f0_7 < (phi_f2_6 * D_800EDCB8))) { - *temp_v0 = phi_f0_7 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk1C * D_800EDCC0); - phi_f2_7 = arg0->unk214; - phi_f0_8 = *temp_v0; - } - temp_f12_2 = D_800EDCC8; - phi_f2_8 = phi_f2_7; - phi_f0_9 = phi_f0_8; - if (((phi_f2_7 * D_800EDCD0) <= phi_f0_8) && (phi_f0_8 < (phi_f2_7 * D_800EDCD8))) { - *temp_v0 = phi_f0_8 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk20 * temp_f12_2); - phi_f2_8 = arg0->unk214; - phi_f0_9 = *temp_v0; - } - if (((phi_f2_8 * D_800EDCE0) <= phi_f0_9) && (phi_f0_9 <= phi_f2_8)) { - *temp_v0 = phi_f0_9 + ((*(&gKartAccelerationTables + (arg0->unk254 * 4)))->unk24 * temp_f12_2); - } - arg0->unk44 = arg0->unk44 | 0x20; - if (*temp_v0 < 0.0f) { - *temp_v0 = 0.0f; - } - arg0->unk98 = (*temp_v0 * *temp_v0) / 25.0f; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0 +extern f64 D_800EDC48// = 0.1; +extern f64 D_800EDC50// = 3.2; +extern f64 D_800EDC58// = 3.2; +extern f64 D_800EDC60// = 0.1; +extern f64 D_800EDC68// = 0.2; +extern f64 D_800EDC70// = 0.2; +extern f64 D_800EDC78// = 0.3; +extern f64 D_800EDC80// = 0.3; +extern f64 D_800EDC88// = 0.4; +extern f64 D_800EDC90// = 0.4; +extern f64 D_800EDC98// = 0.6; +extern f64 D_800EDCA0// = 0.6; +extern f64 D_800EDCA8// = 0.7; +extern f64 D_800EDCB0// = 0.7; +extern f64 D_800EDCB8// = 0.8; +extern f64 D_800EDCC0// = 2.8; +extern f64 D_800EDCC8// = 2.8; +extern f64 D_800EDCD0// = 0.8; +extern f64 D_800EDCD8// = 0.9; +extern f64 D_800EDCE0// = 0.9; + +void func_800332E8(Player *player, s32 arg1) { + if ((D_80165280[arg1] >= 0.0) && (D_80165280[arg1] < ((f64) player->unk_214 * 0.1))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][0] * 3.2; + } + if (((player->unk_214 * 0.1) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.2))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][1] * 3.2; + } + if (((player->unk_214 * 0.2) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.3))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][2] * 3.2; + } + if (((player->unk_214 * 0.3) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.4))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][3] * 3.2; + } + if (((player->unk_214 * 0.4) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.5))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][4] * 3.2; + } + if (((player->unk_214 * 0.5) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.6))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][5] * 3.2; + } + if (((player->unk_214 * 0.6) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.7))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][6] * 3.2; + } + if (((player->unk_214 * 0.7) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.8))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][7] * 2.8; + } + if (((player->unk_214 * 0.8) <= D_80165280[arg1]) && (D_80165280[arg1] < (player->unk_214 * 0.9))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][8] * 2.8; + } + if (((player->unk_214 * 0.9) <= D_80165280[arg1]) && (D_80165280[arg1] <= (player->unk_214 * 1.0))) { + D_80165280[arg1] += gKartAccelerationTables[player->characterId][9] * 2.8; + } + player->unk_044 |= 0x20; + if (D_80165280[arg1] < 0.0f) { + D_80165280[arg1] = 0.0f; + } + player->unk_098 = (D_80165280[arg1] * D_80165280[arg1]) / 25.0f; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800332E8.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 90e635335cb052c4324a3aa7478e4761db19dfaf void func_800337CC(Player *player, f32 arg1, s32 arg2) { - f32 *temp_v0; - f32 temp_f2; - f32 phi_f0; - - player->unk_044 &= 0xFFDF; - temp_v0 = &D_80165280[arg2]; - *temp_v0 -= arg1; - if (*temp_v0 <= 0.0f) { - *temp_v0 = 0.0f; - } - temp_f2 = player->unk_214; - phi_f0 = *temp_v0; - if (temp_f2 <= *temp_v0) { - *temp_v0 = temp_f2; - phi_f0 = *temp_v0; - } - player->unk_098 = (phi_f0 * phi_f0) / 25.0f; + player->unk_044 &= ~0x20; + D_80165280[arg2] -= arg1; + if (D_80165280[arg2] <= 0.0f) { + D_80165280[arg2] = 0.0f; + } + if (player->unk_214 <= D_80165280[arg2]) { + D_80165280[arg2] = player->unk_214; + } + player->unk_098 = (D_80165280[arg2] * D_80165280[arg2]) / 25.0f; } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800337CC.s") -#endif void func_80033850(Player *arg0, f32 arg1) { arg0->unk_090 += arg1; @@ -5050,42 +4493,36 @@ void func_80033850(Player *arg0, f32 arg1) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80033884(void *arg0, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { - s32 temp_at; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void func_80033884(Player *player, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { s32 temp_v0; - s32 temp_v0_3; + s32 temp_v0_2; + s32 temp_v1; u32 temp_t8; - u32 temp_v0_2; - u32 temp_v1; - s32 phi_v1; - s32 phi_v1_2; + u32 var_v1; temp_v0 = *arg1; if ((temp_v0 >= arg4) || (-arg4 >= temp_v0)) { - temp_v1 = arg0->unk200; + temp_v1 = player->unk_200; temp_t8 = temp_v1 - 0x800; - temp_at = temp_t8 < 0xF0000000; - temp_v0_2 = temp_v1; - arg0->unk200 = temp_t8; - phi_v1 = temp_t8; - if (temp_at == 0) { - arg0->unk200 = temp_v0_2; - phi_v1 = temp_v0_2; - } - phi_v1_2 = phi_v1; - if (arg5 >= phi_v1) { - arg0->unk200 = arg5; - phi_v1_2 = arg5; - } - temp_v0_3 = *arg2; - if (arg3 < temp_v0_3) { - *arg2 = temp_v0_3 - phi_v1_2; + player->unk_200 = (s32) temp_t8; + var_v1 = temp_t8; + if (temp_t8 >= 0xF0000000U) { + player->unk_200 = temp_v1; + var_v1 = (u32) temp_v1; + } + if (arg5 >= (s32) var_v1) { + player->unk_200 = arg5; + var_v1 = (u32) arg5; + } + temp_v0_2 = *arg2; + if (arg3 < temp_v0_2) { + *arg2 = temp_v0_2 - var_v1; } else { - *arg2 = temp_v0_3 + phi_v1_2; + *arg2 = temp_v0_2 + var_v1; } - if (arg0->unk90 < arg6) { - arg0->unk90 = -arg6; + if (player->unk_090 < (f32) arg6) { + player->unk_090 = (f32) -arg6; } } } @@ -5131,78 +4568,67 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80033940.s") #endif #ifdef MIPS_TO_C -UNUSED void func_800339C4(void *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4) { - s32 temp_at; - s32 temp_v1_2; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void func_800339C4(Player *player, s32 *arg1, s32 arg2, s32 arg3, f32 arg4) { + s32 temp_v0; + s32 temp_v1; u32 temp_t6; - u32 temp_v0; - u32 temp_v1; u32 var_v0; - temp_v0 = arg0->unk200; + temp_v0 = player->unk_200; temp_t6 = temp_v0 - 0x800; - temp_at = temp_t6 < 0xF0000000U; - temp_v1 = temp_v0; - arg0->unk200 = temp_t6; + player->unk_200 = (s32) temp_t6; var_v0 = temp_t6; - if (temp_at == 0) { - arg0->unk200 = temp_v1; - var_v0 = temp_v1; + if (temp_t6 >= 0xF0000000U) { + player->unk_200 = temp_v0; + var_v0 = (u32) temp_v0; } if (arg3 >= (s32) var_v0) { - arg0->unk200 = (u32) arg3; + player->unk_200 = arg3; var_v0 = (u32) arg3; } - temp_v1_2 = *arg1; - if (arg2 < temp_v1_2) { - *arg1 = temp_v1_2 - var_v0; + temp_v1 = *arg1; + if (arg2 < temp_v1) { + *arg1 = temp_v1 - var_v0; } else { - *arg1 = temp_v1_2 + var_v0; + *arg1 = temp_v1 + var_v0; } - func_80033850(arg4); + func_80033850(player, arg4); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800339C4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80033850(s32); // extern - -void func_80033A40(void *arg0, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { - s32 temp_at; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void func_80033A40(Player *player, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { s32 temp_v0; - s32 temp_v1_2; + s32 temp_v0_2; + s32 temp_v1; u32 temp_t8; - u32 temp_v0_2; - u32 temp_v1; - s32 phi_v0; - s32 phi_v0_2; + u32 var_v0; temp_v0 = *arg1; if ((temp_v0 >= arg4) || (-arg4 >= temp_v0)) { - temp_v0_2 = arg0->unk200; + temp_v0_2 = player->unk_200; temp_t8 = temp_v0_2 - 0x800; - temp_at = temp_t8 < 0xF0000000; - temp_v1 = temp_v0_2; - arg0->unk200 = temp_t8; - phi_v0 = temp_t8; - if (temp_at == 0) { - arg0->unk200 = temp_v1; - phi_v0 = temp_v1; - } - phi_v0_2 = phi_v0; - if (arg5 >= phi_v0) { - arg0->unk200 = arg5; - phi_v0_2 = arg5; - } - temp_v1_2 = *arg2; - if (arg3 < temp_v1_2) { - *arg2 = temp_v1_2 - phi_v0_2; + player->unk_200 = (s32) temp_t8; + var_v0 = temp_t8; + if (temp_t8 >= 0xF0000000U) { + player->unk_200 = temp_v0_2; + var_v0 = (u32) temp_v0_2; + } + if (arg5 >= (s32) var_v0) { + player->unk_200 = arg5; + var_v0 = (u32) arg5; + } + temp_v1 = *arg2; + if (arg3 < temp_v1) { + *arg2 = temp_v1 - var_v0; } else { - *arg2 = temp_v1_2 + phi_v0_2; + *arg2 = temp_v1 + var_v0; } - func_80033850(arg6); + func_80033850(player, arg6); } } #else @@ -5210,12 +4636,11 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80033A40.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -void func_8002A8A4(f32, f32, Player *, s8); /* extern */ -void func_8002BD58(Player *, s32); /* extern */ -void func_80033884(Player *, s32 *, s32 *, s32, s32, s32, s32); /* extern */ -void func_80033A40(Player *, s32 *, s32 *, s32, s32, s32, f32); /* extern */ -void func_80036CB4(Player *); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_8002A8A4(f32, f32, Player *, s8); /* extern */ +? func_80033884(Player *, s32 *, s32 *, s32, s32, s32, s32); /* extern */ +? func_80033A40(Player *, s32 *, s32 *, s32, s32, s32, f32); /* extern */ +? func_80036CB4(Player *); /* extern */ s32 func_80038534(struct Controller *); /* extern */ static s32 D_800E3DF8[0x9C] = { 0, @@ -5374,9 +4799,9 @@ static s32 D_800E3DF8[0x9C] = { 0x3F4CCCCD, 0x3F4CCCCD, 0x3F4CCCCD, -}; /* const */ +}; -void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { +void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { s32 sp2E4; s32 sp2E0; s32 sp2D0; @@ -5389,19 +4814,26 @@ void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { s32 sp40; s32 sp3C; s32 sp38; - ? *temp_t6; + ? *var_t6; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; f32 temp_f0_4; - f32 temp_f0_5; - f32 temp_f0_6; - f32 temp_f0_7; + f32 var_f0; + f32 var_f0_2; + f32 var_f0_3; + f32 var_f12; + f32 var_f2; + f32 var_f2_2; + f32 var_f2_3; s16 temp_v1_3; s16 temp_v1_6; - s32 *temp_t7; + s16 var_s1_2; + s16 var_s1_3; s32 *temp_v0; s32 *temp_v0_2; + s32 *var_t7; + s32 temp_at; s32 temp_f6; s32 temp_f8; s32 temp_lo; @@ -5427,7 +4859,7 @@ void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { s32 temp_t4; s32 temp_t5; s32 temp_t5_2; - s32 temp_t7_2; + s32 temp_t7; s32 temp_t9; s32 temp_v0_10; s32 temp_v0_3; @@ -5438,73 +4870,52 @@ void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { s32 temp_v1_5; s32 temp_v1_7; s32 temp_v1_8; + s32 var_a0; + s32 var_s1; + s32 var_t0; + s32 var_t1; + s32 var_t4; + s32 var_v1; u16 temp_v0_6; u16 temp_v1_9; u8 temp_v0_4; u8 temp_v0_5; u8 temp_v0_8; u8 temp_v0_9; - s32 *phi_t7; - ? *phi_t6; - s32 phi_t1; - s32 phi_a0; - f32 phi_f2; - s32 phi_s1; - s32 phi_t0; - s32 phi_v1; - f32 phi_f2_2; - f32 phi_f2_3; - f32 phi_f12; - f32 phi_f0; - f32 phi_f0_2; - s16 phi_s1_2; - f32 phi_f0_3; - f32 phi_f0_4; - s16 phi_s1_3; - s16 phi_t4; - f32 phi_f2_4; - s32 phi_t0_2; - s32 phi_t0_3; - s32 phi_v1_2; - s32 phi_v1_3; - f32 phi_f0_5; - f32 phi_f2_5; - f32 phi_f12_2; + var_t7 = D_800E3DF8; + var_t6 = &sp44; sp2C0 = 0.0f; - phi_t7 = D_800E3DF8; - phi_t6 = &sp44; do { - temp_t7 = phi_t7 + 0xC; - temp_t6 = phi_t6 + 0xC; - temp_t6->unk-C = (s32) *phi_t7; - temp_t6->unk-8 = (s32) temp_t7->unk-8; - temp_t6->unk-4 = (s32) temp_t7->unk-4; - phi_t7 = temp_t7; - phi_t6 = temp_t6; - } while (temp_t7 != (D_800E3DF8 + 0x270)); + temp_at = *var_t7; + var_t7 += 0xC; + var_t6 += 0xC; + var_t6->unk-C = temp_at; + var_t6->unk-8 = (s32) var_t7->unk-8; + var_t6->unk-4 = (s32) var_t7->unk-4; + } while (var_t7 != (D_800E3DF8 + 0x270)); temp_v1 = player->unk_0BC; - if ((((temp_v1 & 2) != 2) && (((temp_lo = (s32) player->unk_0C0 / 182, ((temp_lo < 7) != 0)) && (temp_lo >= -6)) || ((arg1->button & 0x10) != 0x10))) || (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f) || ((temp_v1 & 0x8000) == 0x8000)) { + if ((((temp_v1 & 2) != 2) && (((temp_lo = (s16) player->unk_0C0 / 182, ((temp_lo < 7) != 0)) && (temp_lo >= -6)) || ((controller->button & 0x10) != 0x10))) || (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f) || ((temp_v1 & 0x8000) == 0x8000)) { sp2BC = 0.0f; func_80036CB4(player); } - temp_lo_2 = (s32) player->unk_0C0 / 182; + temp_lo_2 = (s16) player->unk_0C0 / 182; if (temp_lo_2 < -5) { player->unk_044 |= 4; player->unk_044 &= 0xFFFD; temp_v0 = &D_801652C0[arg2]; + var_s1 = arg2 * 4; *temp_v0 += 1; - phi_s1 = arg2 * 4; } else if (temp_lo_2 >= 6) { player->unk_044 |= 2; player->unk_044 &= 0xFFFB; temp_v0_2 = &D_801652C0[arg2]; + var_s1 = arg2 * 4; *temp_v0_2 += 1; - phi_s1 = arg2 * 4; } else { player->unk_044 &= 0xFFF9; D_801652C0[arg2] = 0; - phi_s1 = arg2 * 4; + var_s1 = arg2 * 4; } temp_v1_2 = player->unk_0BC; if (((temp_v1_2 & 2) == 2) || ((temp_v1_2 & 0x10) == 0x10)) { @@ -5512,212 +4923,207 @@ void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { } sp2BC = 0.0f; sp2E4 = player->unk_07C; - temp_v0_3 = func_80038534(arg1); + temp_v0_3 = func_80038534(controller); temp_v1_3 = player->unk_044; - phi_t1 = temp_v0_3; - phi_f2_4 = 0.0f; + var_f2 = 0.0f; + var_t1 = temp_v0_3; if (((temp_v1_3 & 1) == 1) || ((temp_v1_3 & 8) == 8)) { - phi_t1 = -temp_v0_3; + var_t1 = -temp_v0_3; } - temp_t3 = (phi_t1 << 0x10) & 0xFFFF0000; + temp_t3 = (var_t1 << 0x10) & 0xFFFF0000; player->unk_07C = temp_t3; temp_t5 = sp2E4 - temp_t3; sp2D0 = temp_t5; temp_t9 = temp_t5 >> 0x10; sp2D0 = temp_t9; player->unk_0FA = (s16) temp_t9; - if (((sp2D0 >= 0x5A) || (sp2D0 < -0x59)) && ((player->unk_044 & 0x4000) == 0)) { + if (((sp2D0 >= 0x5A) || (sp2D0 < -0x59)) && !(player->unk_044 & 0x4000)) { temp_v1_4 = player->unk_0BC; - if (((temp_v1_4 & 0x10) == 0) && (gCCSelection == CC_150) && (gModeSelection != BATTLE) && ((temp_v1_4 & 8) == 0) && (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && (player->unk_204 == 0)) { + if (!(temp_v1_4 & 0x10) && (gCCSelection == 2) && (gModeSelection != 3) && !(temp_v1_4 & 8) && (((player->unk_094 / 18.0f) * 216.0f) >= 40.0f) && (player->unk_204 == 0)) { player->statusEffects |= 0x80; } } temp_v0_4 = player->boundingBoxCorners[3].surfaceType; temp_v1_5 = player->unk_0BC; if ((s32) temp_v0_4 < 0xF) { - phi_f2_4 = 0.0f + D_800E3610[player->characterId][temp_v0_4]; + var_f2 = 0.0f + D_800E3610[player->characterId][temp_v0_4]; } temp_v0_5 = player->boundingBoxCorners[2].surfaceType; - phi_f2 = phi_f2_4; if ((s32) temp_v0_5 < 0xF) { - phi_f2 = phi_f2_4 + D_800E3610[player->characterId][temp_v0_5]; + var_f2 += D_800E3610[player->characterId][temp_v0_5]; } if ((temp_v1_5 & 0x20) == 0x20) { - phi_t0_2 = 0xA; - phi_v1_2 = 0xA; + var_v1 = 0x0000000A; + var_t0 = 0x0000000A; } else { - phi_a0 = 0; - phi_t0_2 = 8; + var_a0 = 0; + var_t0 = 8; if (((temp_v1_5 & 0x10) == 0x10) && ((temp_v1_5 & 2) != 2)) { - phi_a0 = 3; + var_a0 = 3; } - phi_v1_2 = 8; + var_v1 = 8; if (((player->unk_094 / 18.0f) * 216.0f) >= 15.0f) { temp_v1_6 = player->unk_044; if ((temp_v1_6 & 2) == 2) { if ((sp2D0 < 0x24) && (sp2D0 >= 0)) { - temp_f8 = (s32) ((gKartTable800E3650[player->characterId] + 1.0f) * ((f32) (phi_a0 + 0xF) * (1.0f + phi_f2))); + temp_f8 = (s32) ((gKartTable800E3650[player->characterId] + 1.0f) * ((f32) (var_a0 + 0xF) * (1.0f + var_f2))); sp2C8 = temp_f8; sp2CC = temp_f8; } else { - temp_f0 = 1.0f + phi_f2; - sp2C8 = (s32) ((f32) (phi_a0 + 5) * temp_f0); - sp2CC = (s32) ((f32) (phi_a0 + 9) * temp_f0); + temp_f0 = 1.0f + var_f2; + sp2C8 = (s32) ((f32) (var_a0 + 5) * temp_f0); + sp2CC = (s32) ((f32) (var_a0 + 9) * temp_f0); } } else if ((temp_v1_6 & 4) == 4) { if ((sp2D0 >= -0x23) && (sp2D0 <= 0)) { - temp_f6 = (s32) ((gKartTable800E3650[player->characterId] + 1.0f) * ((f32) (phi_a0 + 0xF) * (1.0f + phi_f2))); + temp_f6 = (s32) ((gKartTable800E3650[player->characterId] + 1.0f) * ((f32) (var_a0 + 0xF) * (1.0f + var_f2))); sp2C8 = temp_f6; sp2CC = temp_f6; } else { - temp_f0_2 = 1.0f + phi_f2; - sp2C8 = (s32) ((f32) (phi_a0 + 5) * temp_f0_2); - sp2CC = (s32) ((f32) (phi_a0 + 9) * temp_f0_2); + temp_f0_2 = 1.0f + var_f2; + sp2C8 = (s32) ((f32) (var_a0 + 5) * temp_f0_2); + sp2CC = (s32) ((f32) (var_a0 + 9) * temp_f0_2); } } else { - temp_f0_3 = 1.0f + phi_f2; - sp2C8 = (s32) ((f32) (phi_a0 + 3) * temp_f0_3); - sp2CC = (s32) ((f32) (phi_a0 + 6) * temp_f0_3); + temp_f0_3 = 1.0f + var_f2; + sp2C8 = (s32) ((f32) (var_a0 + 3) * temp_f0_3); + sp2CC = (s32) ((f32) (var_a0 + 6) * temp_f0_3); } - phi_t0_2 = sp2CC; - phi_v1_2 = sp2C8; + var_t0 = sp2CC; + var_v1 = sp2C8; } else { sp2C8 = 8; sp2CC = 8; } } temp_v0_6 = player->unk_0DE; - phi_t0_3 = phi_t0_2; - phi_v1_3 = phi_v1_2; if ((temp_v0_6 & 1) == 1) { - phi_t0 = (s32) ((f64) phi_t0_2 * 1.5); - phi_v1 = (s32) ((f64) phi_v1_2 * 1.5); + var_v1 = (s32) ((f64) var_v1 * 1.5); + var_t0 = (s32) ((f64) var_t0 * 1.5); } else { if ((temp_v0_6 & 2) == 2) { - phi_t0_3 = (s32) ((f64) phi_t0_2 * 1.2); - phi_v1_3 = (s32) ((f64) phi_v1_2 * 1.2); + var_v1 = (s32) ((f64) var_v1 * 1.2); + var_t0 = (s32) ((f64) var_t0 * 1.2); } - temp_f0_4 = *(D_801652A0 + phi_s1); - phi_t0 = phi_t0_3; - phi_v1 = phi_v1_3; + temp_f0_4 = *(D_801652A0 + var_s1); if (((f64) (temp_f0_4 - player->boundingBoxCorners[2].cornerGroundY) >= 3.5) || ((f64) (temp_f0_4 - player->boundingBoxCorners[3].cornerGroundY) >= 3.5)) { - phi_t0 = (s32) ((f64) phi_t0_3 * 1.05); - phi_v1 = (s32) ((f64) phi_v1_3 * 1.05); - } - } - sp2E0 = phi_t1; - sp2CC = phi_t0; - sp2C8 = phi_v1; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x5A, 0x78000 / phi_v1, 0x1C2); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x59, 0x76000 / sp2C8, 0x1B8); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x58, 0x74000 / sp2C8, 0x1AE); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x57, 0x72000 / sp2C8, 0x1A4); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x56, 0x70000 / sp2C8, 0x19A); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x55, 0x58000 / sp2C8, 0x190); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x54, 0x56000 / sp2C8, 0x18B); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x53, 0x50000 / sp2C8, 0x186); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x52, 0x4F000 / sp2C8, 0x186); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x51, 0x4E000 / sp2C8, 0x17C); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x50, 0x4D000 / sp2C8, 0x172); + var_v1 = (s32) ((f64) var_v1 * 1.05); + var_t0 = (s32) ((f64) var_t0 * 1.05); + } + } + sp2E0 = var_t1; + sp2CC = var_t0; + sp2C8 = var_v1; + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000005A, 0x78000 / var_v1, 0x000001C2); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000059, 0x76000 / sp2C8, 0x000001B8); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000058, 0x74000 / sp2C8, 0x000001AE); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000057, 0x72000 / sp2C8, 0x000001A4); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000056, 0x70000 / sp2C8, 0x0000019A); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000055, 0x58000 / sp2C8, 0x00000190); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000054, 0x56000 / sp2C8, 0x0000018B); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000053, 0x50000 / sp2C8, 0x00000186); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000052, 0x4F000 / sp2C8, 0x00000186); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000051, 0x4E000 / sp2C8, 0x0000017C); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000050, 0x4D000 / sp2C8, 0x00000172); temp_lo_3 = 0x4C000 / sp2C8; sp40 = temp_lo_3; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x4F, temp_lo_3, 0x168); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x4E, sp40, 0x168); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x4D, 0x4B000 / sp2C8, 0x15E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x4C, 0x4A000 / sp2C8, 0x154); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004F, temp_lo_3, 0x00000168); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004E, sp40, 0x00000168); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004D, 0x4B000 / sp2C8, 0x0000015E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004C, 0x4A000 / sp2C8, 0x00000154); temp_lo_4 = 0x49000 / sp2C8; sp40 = temp_lo_4; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x4B, temp_lo_4, 0x14A); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x4A, sp40, 0x14A); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x49, sp40, 0x14A); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x48, 0x48000 / sp2C8, 0x140); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004B, temp_lo_4, 0x0000014A); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004A, sp40, 0x0000014A); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000049, sp40, 0x0000014A); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000048, 0x48000 / sp2C8, 0x00000140); temp_lo_5 = 0x47000 / sp2C8; sp40 = temp_lo_5; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x47, temp_lo_5, 0x13B); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x46, sp40, 0x13B); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000047, temp_lo_5, 0x0000013B); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000046, sp40, 0x0000013B); temp_lo_6 = 0x46000 / sp2C8; sp40 = temp_lo_6; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x45, temp_lo_6, 0x131); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x44, sp40, 0x131); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000045, temp_lo_6, 0x00000131); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000044, sp40, 0x00000131); temp_lo_7 = 0x45000 / sp2C8; sp3C = temp_lo_7; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x43, temp_lo_7, 0x118); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x42, sp40, 0x10E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x41, sp3C, 0x10E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x40, 0x44000 / sp2C8, 0x104); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000043, temp_lo_7, 0x00000118); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000042, sp40, 0x0000010E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000041, sp3C, 0x0000010E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000040, 0x44000 / sp2C8, 0x00000104); temp_lo_8 = 0x43000 / sp2C8; sp40 = temp_lo_8; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x3F, temp_lo_8, 0xFA); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x3E, sp40, 0xFA); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x3D, sp40, 0xFA); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x3C, 0x3D000 / sp2C8, 0xF5); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x3B, 0x3C000 / sp2C8, 0xF5); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x3A, 0x3B000 / sp2C8, 0xF5); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x39, 0x3A000 / sp2C8, 0xF5); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003F, temp_lo_8, 0x000000FA); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003E, sp40, 0x000000FA); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003D, sp40, 0x000000FA); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003C, 0x3D000 / sp2C8, 0x000000F5); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003B, 0x3C000 / sp2C8, 0x000000F5); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003A, 0x3B000 / sp2C8, 0x000000F5); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000039, 0x3A000 / sp2C8, 0x000000F5); temp_lo_9 = 0x38000 / sp2C8; sp40 = temp_lo_9; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x38, temp_lo_9, 0xF5); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x37, sp40, 0xE6); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x36, sp40, 0xE6); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x35, sp40, 0xE6); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x34, sp40, 0xE6); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x33, sp40, 0xE6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000038, temp_lo_9, 0x000000F5); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000037, sp40, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000036, sp40, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000035, sp40, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000034, sp40, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000033, sp40, 0x000000E6); temp_lo_10 = 0x32000 / sp2C8; sp40 = temp_lo_10; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x32, temp_lo_10, 0xDC); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x31, sp40, 0xDC); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x30, sp40, 0xDC); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x2F, sp40, 0xDC); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x2E, sp40, 0xDC); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x2D, 0x30000 / sp2C8, 0x6E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000032, temp_lo_10, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000031, sp40, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000030, sp40, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002F, sp40, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002E, sp40, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002D, 0x30000 / sp2C8, 0x0000006E); temp_lo_11 = 0x2E000 / sp2C8; sp40 = temp_lo_11; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x2C, temp_lo_11, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x2B, sp40, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x2A, sp40, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x29, sp40, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x28, sp40, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x27, 0x2C000 / sp2C8, 0x6E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002C, temp_lo_11, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002B, sp40, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002A, sp40, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000029, sp40, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000028, sp40, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000027, 0x2C000 / sp2C8, 0x0000006E); temp_lo_12 = 0x28000 / sp2C8; sp40 = temp_lo_12; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x26, temp_lo_12, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x25, sp40, 0x6E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000026, temp_lo_12, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000025, sp40, 0x0000006E); temp_lo_13 = 0x24000 / sp2C8; sp40 = temp_lo_13; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x24, temp_lo_13, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x23, sp40, 0x6E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x22, 0x22000 / sp2C8, 0x6E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000024, temp_lo_13, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000023, sp40, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000022, 0x22000 / sp2C8, 0x0000006E); temp_lo_14 = 0x20000 / sp2C8; sp40 = temp_lo_14; - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x20, temp_lo_14, 0x64); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x1F, sp40, 0x64); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x1E, 0x1F000 / sp2CC, 0.9f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x1D, 0x1E000 / sp2CC, 0.9f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x1C, 0x1D000 / sp2CC, 0.9f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x1B, 0x1C000 / sp2CC, 0.9f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x1A, 0x1B000 / sp2CC, 0.9f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x19, 0x1A000 / sp2CC, 1.0f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x18, 0x19000 / sp2CC, 1.0f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x17, 0x18000 / sp2CC, 1.0f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x16, 0x17000 / sp2CC, 1.0f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x15, 0x16000 / sp2CC, 1.0f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x14, 0x15000 / sp2CC, 1.05f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x13, 0x14000 / sp2CC, 1.05f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x12, 0x13000 / sp2CC, 1.05f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x11, 0x12000 / sp2CC, 1.05f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x10, 0x11000 / sp2CC, 1.05f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0xF, 0x10000 / sp2CC, 1.2f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0xE, 0xF000 / sp2CC, 1.2f); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000020, temp_lo_14, 0x00000064); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001F, sp40, 0x00000064); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001E, 0x1F000 / sp2CC, 0.9f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001D, 0x1E000 / sp2CC, 0.9f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001C, 0x1D000 / sp2CC, 0.9f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001B, 0x1C000 / sp2CC, 0.9f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001A, 0x1B000 / sp2CC, 0.9f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000019, 0x1A000 / sp2CC, 1.0f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000018, 0x19000 / sp2CC, 1.0f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000017, 0x18000 / sp2CC, 1.0f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000016, 0x17000 / sp2CC, 1.0f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000015, 0x16000 / sp2CC, 1.0f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000014, 0x15000 / sp2CC, 1.05f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000013, 0x14000 / sp2CC, 1.05f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000012, 0x13000 / sp2CC, 1.05f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000011, 0x12000 / sp2CC, 1.05f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000010, 0x11000 / sp2CC, 1.05f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000F, 0x10000 / sp2CC, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000E, 0xF000 / sp2CC, 1.2f); temp_lo_15 = 0xE000 / sp2CC; sp40 = temp_lo_15; - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0xD, temp_lo_15, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000D, temp_lo_15, 1.2f); temp_lo_16 = 0xD000 / sp2CC; sp3C = temp_lo_16; - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0xC, temp_lo_16, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000C, temp_lo_16, 1.2f); temp_lo_17 = 0xC000 / sp2CC; sp38 = temp_lo_17; - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0xB, temp_lo_17, 1.2f); - func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0xA, sp40, 1.6f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000B, temp_lo_17, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000A, sp40, 1.6f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 9, sp3C, 1.6f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 8, sp38, 1.6f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 7, 0xB000 / sp2CC, 1.6f); @@ -5731,84 +5137,79 @@ void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { temp_v1_7 = player->unk_0BC; temp_v0_7 = temp_v1_7 & 0x10; if (temp_v0_7 == 0x10) { - phi_f2_2 = (f32) ((s32) (sp2E4 >> 0x10) / 8); - phi_f0_5 = (player->unk_094 / 18.0f) * 216.0f; + var_f2_2 = (f32) ((s32) (sp2E4 >> 0x10) / 8); + var_f0 = (player->unk_094 / 18.0f) * 216.0f; } else { - temp_f0_5 = (player->unk_094 / 18.0f) * 216.0f; - phi_f0_5 = temp_f0_5; - if (temp_f0_5 <= 25.0f) { - phi_f2_2 = (f32) ((s32) (sp2E4 >> 0x10) / 12); + var_f0 = (player->unk_094 / 18.0f) * 216.0f; + if (var_f0 <= 25.0f) { + var_f2_2 = (f32) ((s32) (sp2E4 >> 0x10) / 12); } else { - phi_f2_2 = (f32) (sp2E4 >> 0x10) / (8.0f + (player->unk_09C / 50.0f)); + var_f2_2 = (f32) (sp2E4 >> 0x10) / (8.0f + (player->unk_09C / 50.0f)); } } - phi_f2_5 = phi_f2_2; - if (phi_f2_2 < 0.0f) { - phi_f2_5 = -phi_f2_2; + if (var_f2_2 < 0.0f) { + var_f2_2 = -var_f2_2; } if ((temp_v1_7 & 0x20) == 0x20) { - phi_f2_3 = (sp + ((s16) (s32) phi_f0_5 * 4))->unk6C * 1.5f * phi_f2_5; + var_f2_3 = (sp + ((s16) (s32) var_f0 * 4))->unk6C * 1.5f * var_f2_2; } else if (temp_v0_7 == 0x10) { - phi_f2_3 = (sp + ((s16) (s32) phi_f0_5 * 4))->unk44 * phi_f2_5; + var_f2_3 = (sp + ((s16) (s32) var_f0 * 4))->unk44 * var_f2_2; } else { - phi_f2_3 = (sp + ((s16) (s32) phi_f0_5 * 4))->unk44 * 1.5f * phi_f2_5; + var_f2_3 = (sp + ((s16) (s32) var_f0 * 4))->unk44 * 1.5f * var_f2_2; } player->unk_07C = sp2E4; if (player->unk_10C != 0) { - sp2C4 = phi_f2_3; - func_8002BD58(player, 0x10); + sp2C4 = var_f2_3; + func_8002BD58(player); } temp_v0_8 = player->boundingBoxCorners[3].surfaceType; player->unk_0BC &= 0xDFFFFFFF; if ((s32) temp_v0_8 >= 0xF) { - phi_f12_2 = sp2C0; + var_f12 = sp2C0; } else { - phi_f12_2 = 0.0f + D_800E3410[player->characterId][temp_v0_8]; + var_f12 = 0.0f + D_800E3410[player->characterId][temp_v0_8]; } temp_v0_9 = player->boundingBoxCorners[2].surfaceType; - phi_f12 = phi_f12_2; if ((s32) temp_v0_9 < 0xF) { - phi_f12 = phi_f12_2 + D_800E3410[player->characterId][temp_v0_9]; + var_f12 += D_800E3410[player->characterId][temp_v0_9]; } temp_v1_8 = player->unk_0BC; temp_v0_10 = temp_v1_8 & 2; if ((temp_v0_10 != 2) && ((temp_v1_8 & 0x10) != 0x10)) { if ((temp_v1_8 & 0x20) == 0x20) { - player->unk_078 = (s16) (s32) ((f32) (((s32) player->unk_07C >> 0x10) * 5) * phi_f2_3); + player->unk_078 = (s16) (s32) ((f32) (((s32) player->unk_07C >> 0x10) * 5) * var_f2_3); } else { if ((temp_v1_8 & 1) != 1) { temp_v1_9 = player->characterId; temp_t3_2 = (s32) player->unk_07C >> 0x10; if ((temp_t3_2 >= 0x2D) || (temp_t3_2 < -0x2C)) { - player->unk_078 = (s16) (s32) (((f64) gKartHandlingTable[temp_v1_9] + 0.15) * (f64) ((f32) temp_t3_2 * (phi_f2_3 + (phi_f2_3 * phi_f12)))); + player->unk_078 = (s16) (s32) (((f64) gKartHandlingTable[temp_v1_9] + 0.15) * (f64) ((f32) temp_t3_2 * (var_f2_3 + (var_f2_3 * var_f12)))); } else { - player->unk_078 = (s16) (s32) (gKartHandlingTable[temp_v1_9] * ((f32) temp_t3_2 * (phi_f2_3 + (phi_f2_3 * phi_f12)))); + player->unk_078 = (s16) (s32) (gKartHandlingTable[temp_v1_9] * ((f32) temp_t3_2 * (var_f2_3 + (var_f2_3 * var_f12)))); } } else { - temp_f0_6 = (player->unk_094 / 18.0f) * 216.0f; - phi_f0 = temp_f0_6; - if ((temp_f0_6 >= 0.0f) && (temp_f0_6 < 8.0f)) { - player->unk_078 = (s16) (s32) ((f32) ((s32) player->unk_07C >> 0x10) * (phi_f2_3 + (phi_f2_3 * phi_f12))); - phi_f0 = (player->unk_094 / 18.0f) * 216.0f; + var_f0_2 = (player->unk_094 / 18.0f) * 216.0f; + if ((var_f0_2 >= 0.0f) && (var_f0_2 < 8.0f)) { + player->unk_078 = (s16) (s32) ((f32) ((s32) player->unk_07C >> 0x10) * (var_f2_3 + (var_f2_3 * var_f12))); + var_f0_2 = (player->unk_094 / 18.0f) * 216.0f; } - phi_f0_2 = phi_f0; - if ((phi_f0 >= 8.0f) && (phi_f0 < 65.0f)) { - player->unk_078 = (s16) (s32) ((f64) ((s32) player->unk_07C >> 0x10) * ((f64) phi_f2_3 + 1.5 + (f64) (phi_f2_3 * phi_f12))); - phi_f0_2 = (player->unk_094 / 18.0f) * 216.0f; + if ((var_f0_2 >= 8.0f) && (var_f0_2 < 65.0f)) { + player->unk_078 = (s16) (s32) ((f64) ((s32) player->unk_07C >> 0x10) * ((f64) var_f2_3 + 1.5 + (f64) (var_f2_3 * var_f12))); + var_f0_2 = (player->unk_094 / 18.0f) * 216.0f; } - if (phi_f0_2 >= 65.0f) { - player->unk_078 = (s16) (s32) ((f64) ((s32) player->unk_07C >> 0x10) * ((f64) phi_f2_3 + 1.6 + (f64) (phi_f2_3 * phi_f12))); + if (var_f0_2 >= 65.0f) { + player->unk_078 = (s16) (s32) ((f64) ((s32) player->unk_07C >> 0x10) * ((f64) var_f2_3 + 1.6 + (f64) (var_f2_3 * var_f12))); } } player->unk_228 = 0; - if ((s32) player->unk_22A < 2) { + if (player->unk_22A < 2) { player->unk_22A = 0; } } } else if (((temp_v1_8 & 8) != 8) && (temp_v0_10 != 2)) { - if (((s32) player->unk_0C0 / 182) > 0) { + if (((s16) player->unk_0C0 / 182) > 0) { temp_t5_2 = (s32) player->unk_07C >> 0x10; - phi_s1_2 = (s16) (((s32) ((temp_t5_2 * 0xD) + 0x2B1) / 106) + 0x28); + var_s1_2 = ((s32) ((temp_t5_2 * 0xD) + 0x2B1) / 106) + 0x28; if (temp_t5_2 < -0x27) { temp_t2 = temp_v1_8 | 0x20000000; player->unk_0BC = temp_t2; @@ -5816,57 +5217,55 @@ void func_80033AE0(Player *player, struct Controller *arg1, s8 arg2) { player->unk_0BC = temp_t2 | 0x20000000; } } - sp2C4 = phi_f2_3; - sp2C0 = phi_f12; - func_8002A8A4(phi_f12, 0.0f, player, arg2); + sp2C4 = var_f2_3; + sp2C0 = var_f12; + func_8002A8A4(var_f12, 0.0f, player, arg2); } else { - temp_t7_2 = (s32) player->unk_07C >> 0x10; - phi_s1_2 = (s16) (((s32) ((temp_t7_2 * 0xD) + 0x2B1) / 106) - 0x35); - if (temp_t7_2 >= 0x28) { + temp_t7 = (s32) player->unk_07C >> 0x10; + var_s1_2 = ((s32) ((temp_t7 * 0xD) + 0x2B1) / 106) - 0x35; + if (temp_t7 >= 0x28) { temp_t4 = temp_v1_8 | 0x20000000; player->unk_0BC = temp_t4; - if (temp_t7_2 < -0x31) { + if (temp_t7 < -0x31) { player->unk_0BC = temp_t4 | 0x20000000; } } - sp2C4 = phi_f2_3; - sp2C0 = phi_f12; - func_8002A8A4(phi_f12, 0.0f, player, arg2); + sp2C4 = var_f2_3; + sp2C0 = var_f12; + func_8002A8A4(var_f12, 0.0f, player, arg2); } - temp_f0_7 = (player->unk_094 / 18.0f) * 216.0f; - phi_f0_3 = temp_f0_7; - if ((temp_f0_7 >= 0.0f) && (temp_f0_7 < 8.0f)) { - player->unk_078 = (s16) (s32) ((f32) phi_s1_2 * (sp2C4 + 2.0f + (sp2C4 * sp2C0))); - phi_f0_3 = (player->unk_094 / 18.0f) * 216.0f; + var_f0_3 = (player->unk_094 / 18.0f) * 216.0f; + if ((var_f0_3 >= 0.0f) && (var_f0_3 < 8.0f)) { + player->unk_078 = (s16) (s32) ((f32) var_s1_2 * (sp2C4 + 2.0f + (sp2C4 * sp2C0))); + var_f0_3 = (player->unk_094 / 18.0f) * 216.0f; } - phi_f0_4 = phi_f0_3; - if ((phi_f0_3 >= 8.0f) && (phi_f0_3 < 65.0f)) { - player->unk_078 = (s16) (s32) ((f32) phi_s1_2 * (sp2C4 + 3.0f + (sp2C4 * sp2C0))); - phi_f0_4 = (player->unk_094 / 18.0f) * 216.0f; + if ((var_f0_3 >= 8.0f) && (var_f0_3 < 65.0f)) { + player->unk_078 = (s16) (s32) ((f32) var_s1_2 * (sp2C4 + 3.0f + (sp2C4 * sp2C0))); + var_f0_3 = (player->unk_094 / 18.0f) * 216.0f; } - if (phi_f0_4 >= 65.0f) { - player->unk_078 = (s16) (s32) ((f64) phi_s1_2 * ((f64) sp2C4 + 3.5 + (f64) (sp2C4 * sp2C0))); + if (var_f0_3 >= 65.0f) { + player->unk_078 = (s16) (s32) ((f64) var_s1_2 * ((f64) sp2C4 + 3.5 + (f64) (sp2C4 * sp2C0))); } if ((player->unk_0BC & 0x20000000) == 0x20000000) { player->unk_078 = (s16) (s32) ((f64) player->unk_078 * 0.9); } else { - phi_t4 = (s16) (s32) ((f64) player->unk_078 * 0.65); + var_t4 = (s32) ((f64) player->unk_078 * 0.65); goto block_125; } } else { - phi_s1_3 = (s16) ((s32) player->unk_07C >> 0x10); + var_s1_3 = (s16) ((s32) player->unk_07C >> 0x10); if (sp2E0 == 0) { - phi_s1_3 = 0; + var_s1_3 = 0; } if (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) { - player->unk_078 = (s16) (s32) ((f32) phi_s1_3 * (phi_f2_3 + 6.0f)); + player->unk_078 = (s16) (s32) ((f32) var_s1_3 * (var_f2_3 + 6.0f)); } else { - phi_t4 = (s16) (s32) ((f32) phi_s1_3 * (phi_f2_3 + 1.5f)); + var_t4 = (s32) ((f32) var_s1_3 * (var_f2_3 + 1.5f)); block_125: - player->unk_078 = phi_t4; + player->unk_078 = (s16) var_t4; } } - if (gModeSelection == BATTLE) { + if (gModeSelection == 3) { player->unk_078 = (s16) (s32) ((f64) player->unk_078 * 1.7); } } @@ -5875,113 +5274,266 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80033AE0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void move_s32_towards(f32, s32 *, s16, ?, void *); // extern -void func_80036CB4(f32, void *, s32); // extern -extern s32 D_800E4068; -extern ? D_800E4308; -extern f64 D_800EDD88; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +? func_80036CB4(f32, Player *, s32); /* extern */ +static s32 D_800E4068[0xA8] = { + 0, + 0x3DCCCCCD, + 0x3DCCCCCD, + 0x3E4CCCCD, + 0x3E99999A, + 0x3ECCCCCD, + 0x3F000000, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F19999A, + 0x3F000000, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3ECCCCCD, + 0x3F000000, + 0x3F000000, + 0x3F000000, + 0x3F000000, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F333333, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F4CCCCD, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, + 0x3F19999A, +}; +static ? D_800E4308; /* unable to generate initializer */ -void func_8003680C(void *arg0, s16 arg1) { +void func_8003680C(Player *player, s16 arg1) { s32 sp304; - ? sp44; ? sp24; - ? *temp_t1; + f32 *var_t1; + f32 var_f0; + f32 var_f0_2; s16 temp_v1_2; - s32 *temp_a0; - s32 *temp_t6; - s32 temp_t4; + s16 var_v0; + s16 var_v0_2; + s32 *var_t6; + s32 temp_at; s32 temp_t8; s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; s32 temp_v1; - void *temp_a3; - s32 *phi_t6; - ? *phi_t1; - f32 phi_f0; - f32 phi_f0_2; - s16 phi_v0; - s16 phi_v0_2; - f32 phi_f0_3; - - temp_a3 = arg0; + + var_t6 = D_800E4068; + var_t1 = &sp44[0]; sp304 = 0; - phi_t6 = &D_800E4068; - phi_t1 = &sp44; do { - temp_t6 = phi_t6 + 0xC; - temp_t1 = phi_t1 + 0xC; - temp_t1->unk-C = *phi_t6; - temp_t1->unk-8 = temp_t6->unk-8; - temp_t1->unk-4 = temp_t6->unk-4; - phi_t6 = temp_t6; - phi_t1 = temp_t1; - } while (temp_t6 != (&D_800E4068 + 0x2A0)); - sp24.unk0 = D_800E4308.unk0; - sp24.unk4 = D_800E4308.unk4; - sp24.unkC = D_800E4308.unkC; - sp24.unk8 = D_800E4308.unk8; - sp24.unk10 = D_800E4308.unk10; - sp24.unk14 = D_800E4308.unk14; - sp24.unk1C = D_800E4308.unk1C; - sp24.unk18 = D_800E4308.unk18; - temp_v0 = temp_a3->unkBC; - if (((temp_v0 & 0x80) == 0) && ((temp_v0 & 0x40) == 0) && ((temp_v0 & 0x400) == 0) && ((temp_v0 << 0xF) >= 0) && ((temp_v0 << 0xE) >= 0) && ((temp_v0 << 7) >= 0) && ((temp_v0 << 6) >= 0) && ((temp_v0 << 5) >= 0)) { + temp_at = *var_t6; + var_t6 += 0xC; + var_t1 += 0xC; + var_t1->unk-C = temp_at; + var_t1->unk-8 = (s32) var_t6->unk-8; + var_t1->unk-4 = (s32) var_t6->unk-4; + } while (var_t6 != (D_800E4068 + 0x2A0)); + sp24.unk0 = (s32) D_800E4308.unk0; + sp24.unk4 = (s32) D_800E4308.unk4; + sp24.unkC = (s32) D_800E4308.unkC; + sp24.unk8 = (s32) D_800E4308.unk8; + sp24.unk10 = (s32) D_800E4308.unk10; + sp24.unk14 = (s32) D_800E4308.unk14; + sp24.unk1C = (s32) D_800E4308.unk1C; + sp24.unk18 = (s32) D_800E4308.unk18; + temp_v0 = player->unk_0BC; + if (!(temp_v0 & 0x80) && !(temp_v0 & 0x40) && !(temp_v0 & 0x400) && !(temp_v0 & 0x10000) && !(temp_v0 & 0x20000) && !(temp_v0 & 0x01000000) && !(temp_v0 & 0x02000000) && !(temp_v0 & 0x04000000)) { temp_t8 = temp_v0 & 0xDFFFFFFF; - if (!(((temp_a3->unk94 / 18.0f) * 216.0f) >= 110.0f)) { - temp_a3->unkBC = temp_t8; - temp_a3->unk228 = 0; - if ((temp_t8 & 0x80) == 0) { - temp_a0 = &sp304; - if ((temp_t8 & 0x40) == 0) { - sp304 = temp_a3->unk7C >> 0x10; - arg0 = temp_a3; - move_s32_towards(216.0f, temp_a0, arg1, 0x3EB33333, temp_a3); - temp_t4 = sp304 << 0x10; - sp304 = temp_t4; - temp_v0_2 = arg0->unkBC; - temp_v1 = temp_v0_2 & 0x10; - if (temp_v1 == 0x10) { - phi_f0 = (temp_t4 >> 0x10) / 5; - } else { - phi_f0 = (sp304 >> 0x10) / (8.0f + (arg0->unk9C / 50.0f)); - } - phi_f0_3 = phi_f0; - if (phi_f0 < 0.0f) { - phi_f0_3 = -phi_f0; - } - if (temp_v1 == 0x10) { - phi_f0_2 = *(&sp44 + (((arg0->unk94 / 18.0f) * 216.0f) * 4)) * phi_f0_3; + if (!(((player->unk_094 / 18.0f) * 216.0f) >= 110.0f)) { + player->unk_0BC = temp_t8; + player->unk_228 = 0; + if (!(temp_t8 & 0x80) && !(temp_t8 & 0x40)) { + sp304 = (s32) player->unk_07C >> 0x10; + move_s32_towards(&sp304, (s32) arg1, 0.35f); + sp304 <<= 0x10; + temp_v0_2 = player->unk_0BC; + temp_v1 = temp_v0_2 & 0x10; + if (temp_v1 == 0x10) { + var_f0 = (f32) ((s16) sp304 / 5); + } else { + var_f0 = (f32) (sp304 >> 0x10) / (8.0f + (player->unk_09C / 50.0f)); + } + if (var_f0 < 0.0f) { + var_f0 = -var_f0; + } + if (temp_v1 == 0x10) { + var_f0_2 = (&sp44[0])[(s16) (s32) ((player->unk_094 / 18.0f) * 216.0f)] * var_f0; + } else { + var_f0_2 = (sp + (player->characterId * 4))->unk24 * (&sp44[0])[(s16) (s32) ((player->unk_094 / 18.0f) * 216.0f)] * var_f0; + } + player->unk_07C = sp304; + if (((temp_v0_2 & 2) != 2) && (temp_v1 != 0x10)) { + if ((temp_v0_2 & 1) != 1) { + player->unk_078 = (s16) (s32) ((f32) (sp304 >> 0x10) * var_f0_2); } else { - phi_f0_2 = (sp + (arg0->unk254 * 4))->unk24 * *(&sp44 + (((arg0->unk94 / 18.0f) * 216.0f) * 4)) * phi_f0_3; + player->unk_078 = (s16) (s32) ((f64) ((s32) player->unk_07C >> 0x10) * ((f64) var_f0_2 + 1.5)); } - arg0->unk7C = sp304; - if (((temp_v0_2 & 2) != 2) && (temp_v1 != 0x10)) { - if ((temp_v0_2 & 1) != 1) { - arg0->unk78 = (sp304 >> 0x10) * phi_f0_2; - } else { - arg0->unk78 = (arg0->unk7C >> 0x10) * (phi_f0_2 + 1.5); - } - } else if ((temp_v0_2 & 8) != 8) { - if ((arg0->unkC0 / 0xB6) > 0) { - phi_v0 = arg0->unk7C >> 0x10; - } else { - phi_v0 = arg0->unk7C >> 0x10; - } - arg0->unk78 = phi_v0 * (phi_f0_2 + 3.0); - arg0->unk78 = arg0->unk78 * D_800EDD88; + } else if ((temp_v0_2 & 8) != 8) { + if (((s16) player->unk_0C0 / 182) > 0) { + var_v0 = (s16) ((s32) player->unk_07C >> 0x10); } else { - phi_v0_2 = arg0->unk7C >> 0x10; - if (arg1 == 0) { - phi_v0_2 = 0; - } - arg0->unk78 = phi_v0_2 * phi_f0_2; + var_v0 = (s16) ((s32) player->unk_07C >> 0x10); } - temp_v0_3 = arg0->unkBC; - if ((((temp_v0_3 & 2) != 2) && (temp_v1_2 = arg0->unkC0, ((temp_v1_2 < 0x3D) != 0)) && (temp_v1_2 >= -0x3C)) || (((arg0->unk94 / 18.0f) * 216.0f) <= 20.0f) || ((temp_v0_3 & 0x8000) == 0x8000)) { - func_80036CB4(216.0f, arg0, 2); + player->unk_078 = (s16) (s32) ((f64) var_v0 * ((f64) var_f0_2 + 3.0)); + player->unk_078 = (s16) (s32) ((f64) player->unk_078 * 0.8); + } else { + var_v0_2 = (s16) ((s32) player->unk_07C >> 0x10); + if (arg1 == 0) { + var_v0_2 = 0; } + player->unk_078 = (s16) (s32) ((f32) var_v0_2 * var_f0_2); + } + temp_v0_3 = player->unk_0BC; + if ((((temp_v0_3 & 2) != 2) && (temp_v1_2 = player->unk_0C0, ((temp_v1_2 < 0x3D) != 0)) && (temp_v1_2 >= -0x3C)) || (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f) || ((temp_v0_3 & 0x8000) == 0x8000)) { + func_80036CB4(216.0f, player, 2); } } } @@ -6000,37 +5552,29 @@ void func_80036C5C(Player *arg0) { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80036CB4(void *arg0) { - s32 temp_lo; - s32 temp_v0; - s32 temp_v0_2; - s32 temp_v1; - s32 phi_v0; - s32 phi_v1; - s32 phi_v0_2; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void func_80036CB4(Player *player) { + s32 var_v0; + s32 var_v0_2; + s32 var_v1; - temp_v0 = arg0->unkBC; - temp_v1 = temp_v0 & 0x10; - phi_v1 = temp_v1; - phi_v0_2 = temp_v0; - if ((temp_v1 == 0x10) && ((arg0->unk0 & 0x4000) == 0x4000)) { - temp_lo = arg0->unkC0 / 0xB6; - phi_v0 = temp_lo; - if (temp_lo > 0) { - arg0->unk7C = (((((arg0->unk7C >> 0x10) * 0xD) + 0x2B1) / 0x6A) + 0x28) << 0x10; - phi_v0 = arg0->unkC0 / 0xB6; - } - if (phi_v0 < 0) { - arg0->unk7C = (((((arg0->unk7C >> 0x10) * 0xD) + 0x2B1) / 0x6A) - 0x35) << 0x10; - } - temp_v0_2 = arg0->unkBC & ~0x10; - arg0->unkBC = temp_v0_2; - phi_v1 = temp_v0_2 & 0x10; - phi_v0_2 = temp_v0_2; - } - if ((phi_v1 == 0x10) && ((arg0->unk0 & 0x4000) != 0x4000)) { - arg0->unkBC = phi_v0_2 & ~0x10; + var_v0 = player->unk_0BC; + var_v1 = var_v0 & 0x10; + if ((var_v1 == 0x10) && ((player->unk_000 & 0x4000) == 0x4000)) { + var_v0_2 = (s16) player->unk_0C0 / 182; + if (var_v0_2 > 0) { + var_v0_2 = (s16) player->unk_0C0 / 182; + player->unk_07C = (((s32) ((((s32) player->unk_07C >> 0x10) * 0xD) + 0x2B1) / 106) + 0x28) << 0x10; + } + if (var_v0_2 < 0) { + player->unk_07C = (((s32) ((((s32) player->unk_07C >> 0x10) * 0xD) + 0x2B1) / 106) - 0x35) << 0x10; + } + var_v0 = player->unk_0BC & ~0x10; + player->unk_0BC = var_v0; + var_v1 = var_v0 & 0x10; + } + if ((var_v1 == 0x10) && ((player->unk_000 & 0x4000) != 0x4000)) { + player->unk_0BC = var_v0 & ~0x10; } } #else @@ -6038,138 +5582,85 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80036CB4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_802B63B8(f32, f32, void *, void *, void *); // extern -extern f64 D_800EDD90; -extern f64 D_800EDD98; -extern f64 D_800EDDA0; -extern f64 D_800EDDA8; -extern f64 D_800EDDB0; -extern f64 D_800EDDB8; -extern f64 D_800EDDC0; - -void func_80036DB4(void *arg0, void *arg1, void *arg2) { +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +void func_80036DB4(Player *player, f32 *arg1, f32 *arg2) { f32 sp20; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f12; - f32 temp_f12_2; - f32 temp_f12_3; - f32 temp_f14; - f32 temp_f14_2; - f32 temp_f14_3; - f32 temp_f14_4; - f32 temp_f14_5; - f32 temp_f2; - f32 temp_f2_2; - f32 temp_f2_3; - f32 temp_f2_4; - f32 temp_f2_5; - s16 temp_v0; + f32 var_f14; + f32 var_f18; + f32 var_f2; + f64 var_f10; + s16 var_v0; s32 temp_a0; s32 temp_t0; s32 temp_t6; - s32 phi_v0; - f32 phi_f18; - f32 phi_f12; - f32 phi_f14; - f32 phi_f0; - f32 phi_f2; - f64 phi_f10; - - temp_t0 = arg0->unkBC; + + temp_t0 = player->unk_0BC; if (((temp_t0 & 0x1000) == 0x1000) || ((temp_t0 & 0x20) == 0x20)) { arg1->unk0 = 0.0f; arg1->unk4 = 0.0f; arg1->unk8 = 0.0f; - func_802B63B8((bitwise f32) arg1, (bitwise f32) (arg0 + 0x174), arg0); + func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); } else { temp_a0 = temp_t0 & 0x10; if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - temp_f12 = arg0->unk94; - temp_f0 = arg0->unk208; - temp_f14 = -arg0->unk20C; - temp_f2 = -(temp_f12 / 18.0f) * 216.0f; - sp20 = arg0->unk84 * 3.0f; - phi_f12 = temp_f12; - phi_f14 = temp_f14; - phi_f18 = temp_f0 + (temp_f2 * 3.0f) + (temp_f14 * 10.0f); - phi_f0 = temp_f0; - phi_f2 = temp_f2; - } else if (((temp_t0 & 0x800) == 0) && ((arg0->unk44 & 0x4000) == 0)) { - temp_v0 = arg0->unkFA; - phi_v0 = temp_v0; - if (temp_v0 > 0) { - phi_v0 = temp_v0 * -1; + var_f14 = -player->unk_20C; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f18 = player->unk_208 + (var_f2 * 3.0f) + (var_f14 * 10.0f); + sp20 = player->unk_084 * 3.0f; + } else if (!(temp_t0 & 0x800) && !(player->unk_044 & 0x4000)) { + var_v0 = player->unk_0FA; + if (var_v0 > 0) { + var_v0 *= -1; } - temp_t6 = arg0->unk7C >> 0x10; + temp_t6 = (s32) player->unk_07C >> 0x10; if ((temp_t6 < 0x15) && (temp_t6 >= -0x14)) { - if (phi_v0 < 0x14) { - temp_f14_2 = -arg0->unk20C; - temp_f2_2 = -(arg0->unk94 / 18.0f) * 216.0f; - phi_f14 = temp_f14_2; - phi_f10 = (arg0->unk208 + (temp_f2_2 / 3.0f)) + (-arg0->unk9C * D_800EDD90) + (temp_f14_2 * 50.0f); - phi_f2 = temp_f2_2; + if (var_v0 < 0x14) { + var_f14 = -player->unk_20C; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f10 = (f64) (player->unk_208 + (var_f2 / 3.0f)) + ((f64) -player->unk_09C * 0.02) + (f64) (var_f14 * 50.0f); goto block_16; } - temp_f12_2 = arg0->unk94; - temp_f0_2 = arg0->unk208; - temp_f14_3 = -arg0->unk20C; - temp_f2_3 = -(temp_f12_2 / 18.0f) * 216.0f; - phi_f12 = temp_f12_2; - phi_f14 = temp_f14_3; - phi_f18 = (temp_f0_2 + (temp_f2_3 / 3.0f)) + ((temp_t6 * D_800EDD98) + (-arg0->unk9C * D_800EDDA0)) + (temp_f14_3 * 50.0f); - phi_f0 = temp_f0_2; - phi_f2 = temp_f2_3; + var_f14 = -player->unk_20C; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f18 = (f32) ((f64) (player->unk_208 + (var_f2 / 3.0f)) + (((f64) temp_t6 * 0.01) + ((f64) -player->unk_09C * 0.05)) + (f64) (var_f14 * 50.0f)); } else { - temp_f14_4 = -arg0->unk20C; - temp_f2_4 = -(arg0->unk94 / 18.0f) * 216.0f; - phi_f14 = temp_f14_4; - phi_f10 = (arg0->unk208 + (temp_f2_4 / 3.0f)) + ((temp_t6 * D_800EDDA8) + (-arg0->unk9C * D_800EDDB0)) + (temp_f14_4 * 50.0f); - phi_f2 = temp_f2_4; + var_f14 = -player->unk_20C; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f10 = (f64) (player->unk_208 + (var_f2 / 3.0f)) + (((f64) temp_t6 * 0.1) + ((f64) -player->unk_09C * 0.15)) + (f64) (var_f14 * 50.0f); block_16: - phi_f12 = arg0->unk94; - phi_f18 = phi_f10; - phi_f0 = arg0->unk208; + var_f18 = (f32) var_f10; } - sp20 = arg0->unk84; + sp20 = player->unk_084; } else { - temp_f12_3 = arg0->unk94; - temp_f0_3 = arg0->unk208; - temp_f14_5 = -arg0->unk20C; - temp_f2_5 = -(temp_f12_3 / 18.0f) * 216.0f; - sp20 = arg0->unk84; - phi_f12 = temp_f12_3; - phi_f14 = temp_f14_5; - phi_f18 = temp_f0_3 + (temp_f2_5 * 1.5) + (((arg0->unk7C >> 0x10) * D_800EDDB8) + (-arg0->unk9C * D_800EDDC0)) + (temp_f14_5 * 50.0f); - phi_f0 = temp_f0_3; - phi_f2 = temp_f2_5; + var_f14 = -player->unk_20C; + var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + sp20 = player->unk_084; + var_f18 = (f32) ((f64) player->unk_208 + ((f64) var_f2 * 1.5) + (((f64) ((s32) player->unk_07C >> 0x10) * 0.1) + ((f64) -player->unk_09C * 0.05)) + (f64) (var_f14 * 50.0f)); } if ((temp_t0 & 0x200) == 0x200) { if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - sp20 = arg0->unk84 * 3.0f; - phi_f18 = phi_f0 + (phi_f2 * 3.0f) + (phi_f14 * 10.0f); + var_f18 = player->unk_208 + (var_f2 * 3.0f) + (var_f14 * 10.0f); + sp20 = player->unk_084 * 3.0f; } else { - sp20 = arg0->unk84; - phi_f18 = phi_f0 + (phi_f2 / 3.0f); + sp20 = player->unk_084; + var_f18 = player->unk_208 + (var_f2 / 3.0f); } } arg1->unk4 = 0.0f; - arg1->unk0 = (arg0->unk90 + phi_f18) * phi_f12; - arg1->unk8 = arg0->unk94 * sp20; - func_802B63B8(phi_f12, phi_f14, arg1, arg0 + 0x174, arg0); + arg1->unk0 = (player->unk_090 + var_f18) * player->unk_094; + arg1->unk8 = (f32) (player->unk_094 * sp20); + func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); } arg2->unk0 = arg1->unk0; - arg2->unk4 = arg1->unk4; - arg2->unk8 = arg1->unk8; + arg2->unk4 = (f32) arg1->unk4; + arg2->unk8 = (f32) arg1->unk8; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80036DB4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b void func_800371F4(Player *player, f32 *arg1, f32 *arg2) { f32 sp20; f32 var_f14; @@ -6185,7 +5676,7 @@ void func_800371F4(Player *player, f32 *arg1, f32 *arg2) { arg1->unk0 = 0.0f; arg1->unk4 = 0.0f; arg1->unk8 = 0.0f; - func_802B63B8(arg1, (f32 (*)[3]) player->unk_174); + func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); } else { temp_a0 = temp_t0 & 0x10; if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { @@ -6233,7 +5724,7 @@ void func_800371F4(Player *player, f32 *arg1, f32 *arg2) { arg1->unk4 = 0.0f; arg1->unk0 = -(player->unk_090 + var_f18) * player->unk_094; arg1->unk8 = (f32) (player->unk_094 * sp20); - func_802B63B8(arg1, (f32 (*)[3]) player->unk_174); + func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); } arg2->unk0 = arg1->unk0; arg2->unk4 = (f32) arg1->unk4; @@ -6400,15 +5891,9 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80037BB4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80030C34(Player *); /* extern */ -void func_80030E00(Player *); /* extern */ -void func_80032050(Player *); /* extern */ -void func_8003221C(Player *); /* extern */ -void func_800323E4(Player *); /* extern */ -void func_800332E8(Player *, s8); /* extern */ -void func_800337CC(Player *, ?, s8); /* extern */ -void func_80033AE0(Player *, struct Controller *, s8); /* extern */ +//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) { @@ -6443,7 +5928,7 @@ void func_80037CFC(Player *player, struct Controller *controller, u8 arg2) { temp_t4 = player->unk_0BC & ~1; player->unk_0BC = temp_t4; var_v0_2 = temp_t4; - if (((temp_t4 << 0xB) >= 0) && !(temp_t4 & 4)) { + 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) { @@ -6467,7 +5952,7 @@ void func_80037CFC(Player *player, struct Controller *controller, u8 arg2) { func_80030FC8(player); func_80030E00(player); } else { - if (gModeSelection == BATTLE) { + if (gModeSelection == 3) { func_80031F48(player, 2.0f); } else { func_80031F48(player, 1.0f); @@ -6483,7 +5968,7 @@ void func_80037CFC(Player *player, struct Controller *controller, u8 arg2) { } } temp_v0_3 = player->unk_0BC; - if (((temp_v0_3 << 0xB) >= 0) && !(temp_v0_3 & 4)) { + 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; @@ -6512,11 +5997,11 @@ void func_80037CFC(Player *player, struct Controller *controller, u8 arg2) { 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, (s8) arg2); + func_800332E8(player, (s32) (s8) arg2); return; } func_80030C34(player); - func_800337CC(player, 0x40A00000, (s8) arg2); + func_800337CC(player, 5.0f, (s32) (s8) arg2); } } } diff --git a/src/code_80027D00.h b/src/code_80027D00.h index 3d698033b..26c7ae7f6 100644 --- a/src/code_80027D00.h +++ b/src/code_80027D00.h @@ -16,24 +16,39 @@ void func_800291F0(); void func_800291F8(); void func_80029200(Player*, s8); void func_8002934C(Player*, Camera*, s8, s8); +void func_8002A194(Player*, f32, f32, f32); void func_8002A5F4(Vec3f, f32, Vec3f, f32, f32); +void func_8002A704(Player*, s8); void func_8002AA50(Player*); void func_8002AAC0(Player*); void func_8002AB70(Player*); void func_8002AE20(); void func_8002AE28(); void func_8002AE30(); +void func_8002B218(Player*); void func_8002B308(Player*, s8, s8); void func_8002B5C0(Player*, s8, s8); void func_8002B830(Player*, s8, s8); +void func_8002BD58(Player*); void func_8002C11C(Player*); void func_8002D268(Player*, Camera*, s8, s8); void func_8002E4C4(Player*); +void func_8002FCA8(Player*, s8); +void func_8002FE84(Player*, f32); +f32 func_80030150(Player*, s8); +void func_80030A34(Player*); +void func_80030E00(Player*); void func_80030FC8(Player*); void func_80031F48(Player*, f32); +void func_80032050(Player*); +void func_8003221C(Player*); +void func_800323E4(Player*); +void func_80032700(Player*); void func_80032CB0(Player*, f32); void func_80032D94(Player*); void func_80033280(Player*, f32); +void func_800332E8(Player*, s32); +void func_800337CC(Player*, f32, s32); void func_80033850(Player*, f32); void func_80036C5C(Player*); void func_80037614(Player*, Vec3f, Vec3f); |
