From 0e85b1acb135f3b984cc223d45f5297f517bcd67 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Fri, 25 Aug 2023 22:14:08 -0600 Subject: [PATCH] Some matches in 80027D00 (#385) --- diff | 3 +- include/common_structs.h | 2 +- src/code_80005FD0.c | 2 +- src/code_8001F980.c | 2 +- src/code_80027D00.c | 794 +++++++++++++++++---------------------- src/code_80027D00.h | 3 + src/code_8003DC40.c | 8 +- src/code_80057C60.c | 4 +- src/code_80071F00.c | 2 +- src/code_8008C1D0.c | 4 +- 10 files changed, 353 insertions(+), 471 deletions(-) diff --git a/diff b/diff index 8a901541c..a46d5e7e4 100755 --- a/diff +++ b/diff @@ -3,4 +3,5 @@ # note, this quick hack only works with five arguments. # if you're trying to use six arguments, you need to add another `$6` etc. -python3 tools/asm-differ/diff.py $1 $2 $3 $4 $5 +python3 tools/asm-differ/diff.py $1 $2 $3 $4 $5 $6 $7 $8 + diff --git a/include/common_structs.h b/include/common_structs.h index a718ac995..90b599d57 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -297,7 +297,7 @@ typedef struct { /* 0x00B4 */ u16 unk_0B4; /* 0x00B6 */ u16 unk_0B6; /* 0x00B8 */ f32 unk_0B8; - /* 0x00BC */ s32 unk_0BC; + /* 0x00BC */ u32 unk_0BC; /* 0x00C0 */ s16 unk_0C0; /* 0x00C2 */ s16 unk_0C2; /* 0x00C4 */ s16 unk_0C4; diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 416fa9cc6..603ce8c9a 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -6392,7 +6392,7 @@ void func_80013854(Player *player) { f32 playerZ; f32 playerY; - if (((player->unk_0BC << 7) >= 0) && ((player->unk_0BC << 6) >= 0)) { + if (!((player->unk_0BC & 0x01000000)) && (!(player->unk_0BC & 0x02000000))) { playerX = player->pos[0]; playerY = player->pos[1]; playerZ = player->pos[2]; diff --git a/src/code_8001F980.c b/src/code_8001F980.c index a1bb06fca..35eb1c341 100644 --- a/src/code_8001F980.c +++ b/src/code_8001F980.c @@ -1359,7 +1359,7 @@ void func_800248D0(Player *player, s8 arg1, s8 arg2, s8 arg3) { } sp14C[1] = player->unk_048[arg2]; sp14C[2] = player->unk_050[arg2]; - if ((player->unk_0BC & 0x04000000) == 0x04000000) { + if (((s32)player->unk_0BC & 0x04000000) == 0x04000000) { func_80062B18(&sp148, &sp144, &sp140, 0.0f, 8.0f, 0.0f, -player->unk_048[arg2], player->unk_050[arg2]); sp154[1] = (player->pos[1] - player->boundingBoxSize) + player->unk_108; sp154[0] = player->pos[0] + sp148; diff --git a/src/code_80027D00.c b/src/code_80027D00.c index ba9bfa3d3..93b4c75ee 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -2128,7 +2128,7 @@ void func_8002CD48(Player *player, s8 arg1, s8 arg2) { if ((player->unk_0BC & 4) == 4) { func_8008F008(player); } - if ((player->unk_0BC & 0x04000000) == 0x04000000) { + if ((s32)(player->unk_0BC & 0x04000000) == 0x04000000) { func_8008DC08(player, arg1); } if ((player->unk_0BC & 0x40000000) == 0x40000000) { @@ -3058,107 +3058,71 @@ void control_cpu_movement(Player *player, Camera *camera, s8 arg2, s8 arg3) { } } -#ifdef MIPS_TO_C -//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-16-2023 -? func_80029B4C(Player *, f32, f32, f32); /* extern */ -static ? D_800E3DC8; /* unable to generate initializer */ -static ? D_800E3DD4; /* unable to generate initializer */ -static ? D_800E3DE0; /* unable to generate initializer */ -static ? D_800E3DEC; /* unable to generate initializer */ - +#ifdef NEEDS_DATA void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3) { - f32 spFC; - f32 spF4; - f32 spE8; - ? spDC; - f32 spD0; + Vec3f spF4 = {0.0f, 0.0f, 1.0f}; + Vec3f spE8 = {0.0f, 0.0f, 0.0f}; + Vec3f spDC = {0.0f, 0.0f, 0.0f}; + Vec3f spD0 = {0.0f, 0.0f, 0.0f}; f32 spCC; f32 spC8; f32 spC4; + f32 spC0; - f32 spBC; + f32 sp44; f32 spB8; + f32 temp_f0_2; + s32 pad[11]; f32 sp84; + s32 pad1; f32 sp7C; f32 sp78; - f32 sp70; - f32 sp6C; - f32 sp68; - f32 sp5C; - f32 *sp4C; - f32 sp44; - f32 sp34; - f32 *temp_a1; - f32 *temp_v0; - f32 *temp_v0_2; - f32 temp_f0_2; - f32 temp_f10; - f32 temp_f12_2; - f32 temp_f14; - f32 temp_f2_2; - f32 temp_f2_3; - f32 temp_f6; - f32 temp_f6_2; - f32 temp_f8; - f64 temp_f0; - f64 temp_f12; - f64 temp_f2; + f32 sqrt; + Vec3f sp68; + Vec3f sp5C; + s32 pad3[3]; + + func_80037BB4(player, spD0); + sp84 = player->unk_064 * 0; + sp7C = player->unk_06C * 0; + spF4[2] = func_80030150(player, arg3); + + func_802B63B8(spF4, player->unk_174); + + sp68[0] = player->unk_034[0]; + sp68[1] = player->unk_034[1]; + sp68[2] = player->unk_034[2]; + + sp68[0] += (((f64) (spF4[0] + sp84) - (sp68[0] * 780.0)) / 6500.0); + sp68[2] += (((f64) (spF4[2] + sp7C) - (sp68[2] * 780.0)) / 6500.0); + sp68[1] += (((f64) (spF4[1] + -1100.0f) - (sp68[1] * 780.0)) / 6500.0); + + spC0 = player->pos[0]; + sp44 = player->pos[1]; + spB8 = player->pos[2]; + + + player->rotX = player->pos[0]; + player->rotY = player->pos[1]; + player->rotZ = player->pos[2]; + + spCC = player->unk_034[0] + spC0; + spC8 = player->unk_034[1] + sp44; + spC4 = player->unk_034[2] + spB8; - spF4.unk0 = D_800E3DC8.unk0; - spF4.unk4 = (s32) D_800E3DC8.unk4; - spF4.unk8 = (s32) D_800E3DC8.unk8; - spE8.unk0 = D_800E3DD4.unk0; - spE8.unk4 = (s32) D_800E3DD4.unk4; - spE8.unk8 = (s32) D_800E3DD4.unk8; - spDC.unk0 = (s32) D_800E3DE0.unk0; - spDC.unk4 = (s32) D_800E3DE0.unk4; - spDC.unk8 = (s32) D_800E3DE0.unk8; - spD0.unk0 = D_800E3DEC.unk0; - spD0.unk4 = (s32) D_800E3DEC.unk4; - spD0.unk8 = (s32) D_800E3DEC.unk8; - func_80037BB4(player, &spD0); - sp84 = player->unk_064 * 0.0f; - sp7C = player->unk_06C * 0.0f; - temp_a1 = player->unk_174[0]; - spFC = func_80030150(player, arg3); - sp4C = temp_a1; - func_802B63B8(&spF4, (f32 (*)[3]) temp_a1); - sp68 = player->unk_034[0]; - sp6C = player->unk_034[1]; - temp_f0 = (f64) sp68; - sp70 = player->unk_034[2]; - temp_f2 = (f64) sp70; - sp68 = (f32) (temp_f0 + (((f64) (spF4 + sp84) - (temp_f0 * 780.0)) / 6500.0)); - temp_f12 = (f64) sp6C; - sp70 = (f32) (temp_f2 + (((f64) (spFC + sp7C) - (temp_f2 * 780.0)) / 6500.0)); - sp6C = (f32) (temp_f12 + (((f64) (spF8 + -1100.0f) - (temp_f12 * 780.0)) / 6500.0)); - temp_f14 = player->pos[0]; - spC0 = temp_f14; - temp_f6 = player->pos[1]; - sp44 = temp_f6; - spBC = sp44; - sp34 = player->pos[2]; - spB8 = sp34; - player->rotX = temp_f14; - player->rotY = temp_f6; - player->rotZ = sp34; - spCC = player->unk_034[0] + temp_f14; - temp_f10 = player->unk_034[1] + sp44; - spC8 = temp_f10; - temp_f8 = player->unk_034[2] + spB8; - spC4 = temp_f8; func_8002AAC0(player); - temp_f6_2 = temp_f10 + player->kartHopVelocity; - spC8 = temp_f6_2; - func_802AD950(&player->unk_110, player->boundingBoxSize, spCC, temp_f6_2, temp_f8, player->rotX, player->rotY, player->rotZ); + + spC8 += player->kartHopVelocity; + func_802AD950(&player->unk_110, player->boundingBoxSize, spCC, spC8, spC4, player->rotX, player->rotY, player->rotZ); player->unk_058 = 0.0f; - player->unk_060 = 0.0f; player->unk_05C = 1.0f; - func_802B6540((f32 (*)[3]) sp4C, 0.0f, 1.0f, 0.0f, (s16) (s32) player->unk_02C[1]); + player->unk_060 = 0.0f; + func_802B6540(player->unk_174, 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); + if(1); + 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) && ((gActiveScreenMode == 0) || (gActiveScreenMode == 2) || (gActiveScreenMode == 1))) { @@ -3167,36 +3131,36 @@ void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3) { func_8002A194(player, spCC, spC8, spC4); } func_8002AE38(player, arg3, spC0, spB8, spCC, spC4); + sqrt = (sp68[0] * sp68[0]) + (sp68[1] * sp68[1]) + (sp68[2] * sp68[2]); player->unk_22C = player->unk_094; - temp_f2_2 = player->unk_08C; - player->unk_094 = sqrtf((sp70 * sp70) + ((sp68 * sp68) + (sp6C * sp6C))); - if (((temp_f2_2 <= 0.0f) && ((f64) player->unk_094 < 0.13)) || ((temp_f2_2 <= 0.0f) && ((f64) player->unk_094 < 0.2) && ((player->unk_0BC & 1) == 1))) { - sp68 += sp68 * -1.0f; - sp70 += sp70 * -1.0f; + player->unk_094 = sqrtf(sqrt); + if (((player->unk_08C <= 0.0f) && ((f64) player->unk_094 < 0.13)) || ((player->unk_08C <= 0.0f) && ((f64) player->unk_094 < 0.2) && ((player->unk_0BC & 1) == 1))) { + sp68[0] = sp68[0] + (sp68[0] * -1.0f); + sp68[2] = sp68[2] + (sp68[2] * -1.0f); } else { player->pos[0] = spCC; player->pos[2] = spC4; } - player->pos[1] = (f32) ((f64) spC8 - 0.018); - player->unk_064 = spE8; - player->unk_06C = spF0; - player->unk_034[0] = sp68; - player->unk_034[1] = sp6C; - player->unk_034[2] = sp70; - temp_v0 = D_80165070[arg3]; - temp_v0->unk0 = sp68; - temp_v0->unk4 = sp6C; - temp_v0->unk8 = sp70; + player->pos[1] = spC8 - 0.018; + + player->unk_064 = spE8[0]; + player->unk_06C = spE8[2]; + + player->unk_034[0] = sp68[0]; + player->unk_034[1] = sp68[1]; + player->unk_034[2] = sp68[2]; + + D_80165070[arg3][0] = sp68[0]; + D_80165070[arg3][1] = sp68[1]; + D_80165070[arg3][2] = sp68[2]; + if ((player->unk_000 & 0x4000) == 0x4000) { - temp_f2_3 = player->unk_094; - temp_v0_2 = &gKartTopSpeedTable[player->characterId]; - temp_f12_2 = *temp_v0_2; - if (temp_f12_2 < temp_f2_3) { - temp_f0_2 = temp_f12_2 / temp_f2_3; + if (gKartTopSpeedTable[player->characterId] < player->unk_094) { + temp_f0_2 = gKartTopSpeedTable[player->characterId] / player->unk_094; player->unk_034[0] *= temp_f0_2; player->unk_034[1] *= temp_f0_2; player->unk_034[2] *= temp_f0_2; - player->unk_094 = *temp_v0_2; + player->unk_094 = gKartTopSpeedTable[player->characterId]; } } } @@ -3675,7 +3639,7 @@ void func_80030FC8(Player *player) { if (player->unk_214 <= player->unk_09C) { player->unk_09C = player->unk_214; } - if (((player->unk_0BC & 8) == 0) || ((player->unk_0BC * 2) < 0)) { + if (!((player->unk_0BC & 8)) || ((player->unk_0BC & 0x40000000))) { player->unk_08C = (player->unk_09C * player->unk_09C) / 25.0f; } player->unk_044 |= 0x20; @@ -4160,212 +4124,149 @@ void func_80033A40(Player *player, s32 *arg1, s32 *arg2, s32 arg3, s32 arg4, s32 } } -#ifdef MIPS_TO_C +#ifdef NEEDS_DATA //generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-16-2023 -static ? D_800E3DF8; /* unable to generate initializer */ void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { s32 sp2E4; - s32 sp2E0; + s32 temp_v0_3; + s32 pad[2]; + s16 pad2; + s16 var_s1_2; s32 sp2D0; s32 sp2CC; s32 sp2C8; - f32 sp2C4; - f32 sp2C0; - f32 sp2BC; - ? sp44; - s32 sp40; - s32 sp3C; - s32 sp38; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f0_4; - 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_v0_3; - s16 temp_v1_3; - s16 temp_v1_6; - s16 var_s1_2; - s16 var_s1_3; - s16 var_t1; - s32 *temp_v0; - s32 *temp_v0_2; - s32 temp_f6; - s32 temp_f8; - s32 temp_lo; - s32 temp_lo_10; - s32 temp_lo_11; - s32 temp_lo_12; - s32 temp_lo_13; - s32 temp_lo_14; - s32 temp_lo_15; - s32 temp_lo_16; - s32 temp_lo_17; - s32 temp_lo_2; - s32 temp_lo_3; - s32 temp_lo_4; - s32 temp_lo_5; - s32 temp_lo_6; - s32 temp_lo_7; - s32 temp_lo_8; - s32 temp_lo_9; - s32 temp_t2; - s32 temp_t3; - s32 temp_t3_2; - s32 temp_t4; - s32 temp_t5; - s32 temp_t5_2; - s32 temp_t7; - s32 temp_t9; - s32 temp_v0_10; - s32 temp_v0_7; - s32 temp_v1; - s32 temp_v1_2; - s32 temp_v1_4; - s32 temp_v1_5; - s32 temp_v1_7; - s32 temp_v1_8; + f32 var_f12 = 0.0f; + f32 var_f2 = 0; + s32 pad4; s32 var_a0; - s32 var_s1; - s32 var_t0; - 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; - - sp2C0 = 0.0f; - M2C_MEMCPY_ALIGNED(&sp44, &D_800E3DF8, 0x270); - temp_v1 = player->unk_0BC; - 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; + f32 sp44[156] = {0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8}; + if (((((player->unk_0BC & 2) != 2) && ((((player->unk_0C0 / 182) <= 6) && ((player->unk_0C0 / 182) >= (-6))) || ((controller->button & 0x0010) != 0x0010))) || (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f)) || ((player->unk_0BC & 0x8000) == 0x8000)) + { func_80036CB4(player); } - temp_lo_2 = (s16) player->unk_0C0 / 182; - if (temp_lo_2 < -5) { + if ((player->unk_0C0 / 182) < (-5)) { player->unk_044 |= 4; player->unk_044 &= 0xFFFD; - temp_v0 = &D_801652C0[arg2]; - var_s1 = arg2 * 4; - *temp_v0 += 1; - } else if (temp_lo_2 >= 6) { + D_801652C0[arg2]++; + } + else + if ((player->unk_0C0 / 182) >= 6) + { player->unk_044 |= 2; player->unk_044 &= 0xFFFB; - temp_v0_2 = &D_801652C0[arg2]; - var_s1 = arg2 * 4; - *temp_v0_2 += 1; - } else { + D_801652C0[arg2]++; + } + else + { player->unk_044 &= 0xFFF9; D_801652C0[arg2] = 0; - var_s1 = arg2 * 4; } - temp_v1_2 = player->unk_0BC; - if (((temp_v1_2 & 2) == 2) || ((temp_v1_2 & 0x10) == 0x10)) { + if (((player->unk_0BC & 2) == 2) || ((player->unk_0BC & 0x10) == 0x10)) + { player->unk_044 &= 0xFFF9; } - sp2BC = 0.0f; sp2E4 = player->unk_07C; temp_v0_3 = func_80038534(controller); - temp_v1_3 = player->unk_044; - var_f2 = 0.0f; - var_t1 = temp_v0_3; - if (((temp_v1_3 & 1) == 1) || ((temp_v1_3 & 8) == 8)) { - var_t1 = -temp_v0_3; + if (((player->unk_044 & 1) == 1) || ((player->unk_044 & 8) == 8)) + { + temp_v0_3 = -temp_v0_3; } - 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)) { - temp_v1_4 = player->unk_0BC; - 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; + player->unk_07C = (temp_v0_3 << 16) & 0xFFFF0000; + sp2D0 = sp2E4 - player->unk_07C; + sp2D0 = sp2D0 >> 16; + player->unk_0FA = (s16) sp2D0; + if (((sp2D0 >= 0x5A) || (sp2D0 < (-0x59))) && (!(player->unk_044 & 0x4000))) + { + if ((((((!(player->unk_0BC & 0x10)) && (gCCSelection == 2)) && (gModeSelection != 3)) && (!(player->unk_0BC & 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) { - var_f2 = 0.0f + D_800E3610[player->characterId][temp_v0_4]; + if (((s32) player->boundingBoxCorners[3].surfaceType) < 0xF) + { + var_f2 += D_800E3610[player->characterId][player->boundingBoxCorners[3].surfaceType]; } - temp_v0_5 = player->boundingBoxCorners[2].surfaceType; - if ((s32) temp_v0_5 < 0xF) { - var_f2 += D_800E3610[player->characterId][temp_v0_5]; + if (((s32) player->boundingBoxCorners[2].surfaceType) < 0xF) + { + var_f2 += D_800E3610[player->characterId][player->boundingBoxCorners[2].surfaceType]; } - if ((temp_v1_5 & 0x20) == 0x20) { - var_v1 = 0x0000000A; - var_t0 = 0x0000000A; - } else { + if ((player->unk_0BC & 0x20) == 0x20) + { + sp2C8 = 10; + sp2CC = 10; + } + else + { + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) + { + var_a0 = 3; + } + else + { var_a0 = 0; - var_t0 = 8; - if (((temp_v1_5 & 0x10) == 0x10) && ((temp_v1_5 & 2) != 2)) { - var_a0 = 3; } - 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) (var_a0 + 0xF) * (1.0f + var_f2))); - sp2C8 = temp_f8; - sp2CC = temp_f8; - } else { - 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) (var_a0 + 0xF) * (1.0f + var_f2))); - sp2C8 = temp_f6; - sp2CC = temp_f6; - } else { - 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 + var_f2; - sp2C8 = (s32) ((f32) (var_a0 + 3) * temp_f0_3); - sp2CC = (s32) ((f32) (var_a0 + 6) * temp_f0_3); + if (((player->unk_094 / 18.0f) * 216.0f) >= 15.0f) + { + if ((player->unk_044 & 2) == 2) + { + if ((sp2D0 < 36) && (sp2D0 >= 0)) + { + sp2C8 = (gKartTable800E3650[player->characterId] + 1.0f) * (((f32) (var_a0 + 0xF)) * (1.0f + var_f2)); + sp2CC = (gKartTable800E3650[player->characterId] + 1.0f) * (((f32) (var_a0 + 0xF)) * (1.0f + var_f2)); } - var_t0 = sp2CC; - var_v1 = sp2C8; - } else { - sp2C8 = 8; - sp2CC = 8; + else + { + sp2C8 = (s32) (((f32) (var_a0 + 5)) * (1.0f + var_f2)); + sp2CC = (s32) (((f32) (var_a0 + 9)) * (1.0f + var_f2)); + } + } + else + if ((player->unk_044 & 4) == 4) + { + if ((sp2D0 >= (-0x23)) && (sp2D0 <= 0)) + { + sp2C8 = (gKartTable800E3650[player->characterId] + 1.0f) * (((f32) (var_a0 + 0xF)) * (1.0f + var_f2)); + sp2CC = (gKartTable800E3650[player->characterId] + 1.0f) * (((f32) (var_a0 + 0xF)) * (1.0f + var_f2)); + } + else + { + sp2C8 = (s32) (((f32) (var_a0 + 5)) * (1.0f + var_f2)); + sp2CC = (s32) (((f32) (var_a0 + 9)) * (1.0f + var_f2)); + } + } + else + { + sp2C8 = (s32) (((f32) (var_a0 + 3)) * (1.0f + var_f2)); + sp2CC = (s32) (((f32) (var_a0 + 6)) * (1.0f + var_f2)); + } + } + else + { + sp2C8 = 8; + sp2CC = 8; } } - temp_v0_6 = player->unk_0DE; - if ((temp_v0_6 & 1) == 1) { - var_v1 = (s32) ((f64) var_v1 * 1.5); - var_t0 = (s32) ((f64) var_t0 * 1.5); - } else { - if ((temp_v0_6 & 2) == 2) { - var_v1 = (s32) ((f64) var_v1 * 1.2); - var_t0 = (s32) ((f64) var_t0 * 1.2); + if ((player->unk_0DE & 1) == 1) + { + sp2C8 *= 1.5; + sp2CC *= 1.5; + } + else + { + if ((player->unk_0DE & 2) == 2) + { + sp2C8 *= 1.2; + sp2CC *= 1.2; } - 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)) { - var_v1 = (s32) ((f64) var_v1 * 1.05); - var_t0 = (s32) ((f64) var_t0 * 1.05); + if ((((f64) (D_801652A0[arg2] - player->boundingBoxCorners[2].cornerGroundY)) >= 3.5) || (((f64) (D_801652A0[arg2] - player->boundingBoxCorners[3].cornerGroundY)) >= 3.5)) + { + sp2C8 *= 1.05; + sp2CC *= 1.05; } } - sp2E0 = (s32) 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, 0x0000005A, 0x78000 / sp2C8, 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); @@ -4376,78 +4277,54 @@ void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { 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, 0x0000004F, temp_lo_3, 0x00000168); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004E, sp40, 0x00000168); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004F, 0x4C000 / sp2C8, 0x00000168); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004E, 0x4C000 / sp2C8, 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, 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, 0x0000004B, 0x49000 / sp2C8, 0x0000014A); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000004A, 0x49000 / sp2C8, 0x0000014A); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000049, 0x49000 / sp2C8, 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, 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, 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, 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, 0x00000047, 0x47000 / sp2C8, 0x0000013B); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000046, 0x47000 / sp2C8, 0x0000013B); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000045, 0x46000 / sp2C8, 0x00000131); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000044, 0x46000 / sp2C8, 0x00000131); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000043, 0x45000 / sp2C8, 0x00000118); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000042, 0x46000 / sp2C8, 0x0000010E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000041, 0x45000 / sp2C8, 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, 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, 0x0000003F, 0x43000 / sp2C8, 0x000000FA); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003E, 0x43000 / sp2C8, 0x000000FA); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000003D, 0x43000 / sp2C8, 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, 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, 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, 0x00000038, 0x38000 / sp2C8, 0x000000F5); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000037, 0x38000 / sp2C8, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000036, 0x38000 / sp2C8, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000035, 0x38000 / sp2C8, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000034, 0x38000 / sp2C8, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000033, 0x38000 / sp2C8, 0x000000E6); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000032, 0x32000 / sp2C8, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000031, 0x32000 / sp2C8, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000030, 0x32000 / sp2C8, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002F, 0x32000 / sp2C8, 0x000000DC); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002E, 0x32000 / sp2C8, 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, 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, 0x0000002C, 0x2E000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002B, 0x2E000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000002A, 0x2E000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000029, 0x2E000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000028, 0x2E000 / sp2C8, 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, 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, 0x00000024, temp_lo_13, 0x0000006E); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000023, sp40, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000026, 0x28000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000025, 0x28000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000024, 0x24000 / sp2C8, 0x0000006E); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000023, 0x24000 / sp2C8, 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, 0x00000020, temp_lo_14, 0x00000064); - func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001F, sp40, 0x00000064); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x00000020, 0x20000 / sp2C8, 0x00000064); + func_80033884(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000001F, 0x20000 / sp2C8, 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); @@ -4465,18 +4342,12 @@ void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { 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, 0x0000000D, temp_lo_15, 1.2f); - temp_lo_16 = 0xD000 / sp2CC; - sp3C = temp_lo_16; - 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, 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, 0x0000000D, 0xE000 / sp2CC, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000C, 0xD000 / sp2CC, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000B, 0xC000 / sp2CC, 1.2f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0x0000000A, 0xE000 / sp2CC, 1.6f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 9, 0xD000 / sp2CC, 1.6f); + func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 8, 0xC000 / sp2CC, 1.6f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 7, 0xB000 / sp2CC, 1.6f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 6, 0xA000 / sp2CC, 1.6f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 5, 0x9000 / sp2CC, 1.9f); @@ -4485,139 +4356,146 @@ void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 2, 0x6000 / sp2CC, 1.9f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 1, 0x5000 / sp2CC, 1.9f); func_80033A40(player, &sp2D0, &sp2E4, player->unk_07C, 0, 0 / sp2CC, 1.9f); - temp_v1_7 = player->unk_0BC; - temp_v0_7 = temp_v1_7 & 0x10; - if (temp_v0_7 == 0x10) { - var_f2_2 = (f32) ((s32) (sp2E4 >> 0x10) / 8); - var_f0 = (player->unk_094 / 18.0f) * 216.0f; - } else { - var_f0 = (player->unk_094 / 18.0f) * 216.0f; - if (var_f0 <= 25.0f) { - var_f2_2 = (f32) ((s32) (sp2E4 >> 0x10) / 12); - } else { - var_f2_2 = (f32) (sp2E4 >> 0x10) / (8.0f + (player->unk_09C / 50.0f)); - } + if ((player->unk_0BC & 0x10) == 0x10) + { + var_f2_2 = (f32) (((s32) (sp2E4 >> 16)) / 8); } - if (var_f2_2 < 0.0f) { + else + if (((player->unk_094 / 18.0f) * 216.0f) <= 25.0f) + { + var_f2_2 = (f32) ((sp2E4 >> 16) / 12); + } + else + { + var_f2_2 = ((f32) (sp2E4 >> 0x10)) / (8.0f + (player->unk_09C / 50.0f)); + } + if (var_f2_2 < 0.0f) + { var_f2_2 = -var_f2_2; } - if ((temp_v1_7 & 0x20) == 0x20) { - var_f2_3 = (sp + ((s16) (s32) var_f0 * 4))->unk6C * 1.5f * var_f2_2; - } else if (temp_v0_7 == 0x10) { - var_f2_3 = (sp + ((s16) (s32) var_f0 * 4))->unk44 * var_f2_2; - } else { - var_f2_3 = (sp + ((s16) (s32) var_f0 * 4))->unk44 * 1.5f * var_f2_2; + if ((player->unk_0BC & 0x20) == 0x20) + { + var_f2_2 = var_f2_2 * (sp44[((s16) ((player->unk_094 / 18.0f) * 216.0f)) + 10] * 1.5f); + } + else + if ((player->unk_0BC & 0x10) == 0x10) + { + var_f2_2 = var_f2_2 * sp44[(s16) ((player->unk_094 / 18.0f) * 216.0f)]; + } + else + { + var_f2_2 = var_f2_2 * (sp44[(s16) ((player->unk_094 / 18.0f) * 216.0f)] * 1.5f); } player->unk_07C = sp2E4; - if (player->unk_10C != 0) { - sp2C4 = var_f2_3; + if (player->unk_10C != 0) + { func_8002BD58(player); } - temp_v0_8 = player->boundingBoxCorners[3].surfaceType; player->unk_0BC &= 0xDFFFFFFF; - if ((s32) temp_v0_8 >= 0xF) { - var_f12 = sp2C0; - } else { - var_f12 = 0.0f + D_800E3410[player->characterId][temp_v0_8]; + if (((s32) player->boundingBoxCorners[3].surfaceType) > 0xE) + { + var_f12 = var_f12; } - temp_v0_9 = player->boundingBoxCorners[2].surfaceType; - if ((s32) temp_v0_9 < 0xF) { - var_f12 += D_800E3410[player->characterId][temp_v0_9]; + else + { + var_f12 += D_800E3410[player->characterId][player->boundingBoxCorners[3].surfaceType]; } - 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) * 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 * (var_f2_3 + (var_f2_3 * var_f12)))); - } else { - player->unk_078 = (s16) (s32) (gKartHandlingTable[temp_v1_9] * ((f32) temp_t3_2 * (var_f2_3 + (var_f2_3 * var_f12)))); - } - } else { - 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; - } - 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 (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))); - } + if (((s32) player->boundingBoxCorners[2].surfaceType) < 0xF) + { + var_f12 += D_800E3410[player->characterId][player->boundingBoxCorners[2].surfaceType]; + } + if (((player->unk_0BC & 2) != 2) && ((player->unk_0BC & 0x10) != 0x10)) + { + if ((player->unk_0BC & 0x20) == 0x20) + { + player->unk_078 = (s16) ((s32) (((f32) ((((s32) player->unk_07C) >> 0x10) * 5)) * var_f2_2)); + } + else + { + if ((player->unk_0BC & 0x1) != 0x1) + { + if (((player->unk_07C >> 16) >= 45) || ((player->unk_07C >> 16) <= (-45))) + { + player->unk_078 = ((player->unk_07C >> 16) * (var_f2_2 + (var_f2_2 * var_f12))) * (0.15 + gKartHandlingTable[player->characterId]); } - player->unk_228 = 0; - if (player->unk_22A < 2) { - player->unk_22A = 0; + else + { + player->unk_078 = ((player->unk_07C >> 16) * (var_f2_2 + (var_f2_2 * var_f12))) * gKartHandlingTable[player->characterId]; } } - } else if (((temp_v1_8 & 8) != 8) && (temp_v0_10 != 2)) { - if (((s16) player->unk_0C0 / 182) > 0) { - temp_t5_2 = (s32) player->unk_07C >> 0x10; - 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; - if (temp_t5_2 < -0x31) { - player->unk_0BC = temp_t2 | 0x20000000; + else + { + if ((((player->unk_094 / 18.0f) * 216.0f) >= 0.0f) && (((player->unk_094 / 18.0f) * 216.0f) < 8.0f)) + { + player->unk_078 = (player->unk_07C >> 16) * (var_f2_2 + (var_f2_2 * var_f12)); + } + if ((((player->unk_094 / 18.0f) * 216.0f) >= 8.0f) && (((player->unk_094 / 18.0f) * 216.0f) < 65.0f)) + { + player->unk_078 = (player->unk_07C >> 16) * ((var_f2_2 + 1.5) + (var_f2_2 * var_f12)); + } + if (((player->unk_094 / 18.0f) * 216.0f) >= 65.0f) + { + player->unk_078 = (player->unk_07C >> 16) * ((var_f2_2 + 1.6) + (var_f2_2 * var_f12)); + } + } + player->unk_228 = 0; + if (player->unk_22A < 2) { + player->unk_22A = 0; + } + } + } + else + if (((player->unk_0BC & 8) != 8) && ((player->unk_0BC & 2) != 2)) { + if ((((s16) player->unk_0C0) / 182) > 0) + { + var_s1_2 = (((s32) (((player->unk_07C >> 0x10) * 0xD) + 0x2B1)) / 106) + 0x28; + if ((player->unk_07C >> 0x10) < (-0x27)) { + player->unk_0BC = player->unk_0BC | 0x20000000; + if ((player->unk_07C >> 0x10) < (-0x31)) { + player->unk_0BC |= 0x20000000; } } - sp2C4 = var_f2_3; - sp2C0 = var_f12; - func_8002A8A4(player, arg2); - } else { - 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 < -0x31) { - player->unk_0BC = temp_t4 | 0x20000000; - } - } - sp2C4 = var_f2_3; - sp2C0 = var_f12; func_8002A8A4(player, arg2); } - 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; + else { + var_s1_2 = (((s32) (((player->unk_07C >> 0x10) * 0xD) + 0x2B1)) / 106) - 0x35; + if ((player->unk_07C >> 0x10) >= 0x28) { + player->unk_0BC = player->unk_0BC | 0x20000000; + if ((player->unk_07C >> 0x10) < (-0x31)) { + player->unk_0BC |= 0x20000000; + } + } + func_8002A8A4(player, arg2); } - 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 ((((player->unk_094 / 18.0f) * 216.0f) >= 0.0f) && (((player->unk_094 / 18.0f) * 216.0f) < 8.0f)) { + player->unk_078 = (s16) ((s32) (var_s1_2 * ((var_f2_2 + 2.0f) + (var_f2_2 * var_f12)))); } - 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_094 / 18.0f) * 216.0f) >= 8.0f) && (((player->unk_094 / 18.0f) * 216.0f) < 65.0f)) { + player->unk_078 = var_s1_2 * ((var_f2_2 + 3) + (var_f2_2 * var_f12)); + } + if (((player->unk_094 / 18.0f) * 216.0f) >= 65.0f) { + player->unk_078 = var_s1_2 * ((((f64) var_f2_2) + 3.5) + (var_f2_2 * var_f12)); } if ((player->unk_0BC & 0x20000000) == 0x20000000) { - player->unk_078 = (s16) (s32) ((f64) player->unk_078 * 0.9); - } else { - var_t4 = (s32) ((f64) player->unk_078 * 0.65); - goto block_123; + player->unk_078 *= 0.9; + } + else { + player->unk_078 *= 0.65; } } else { - var_s1_3 = (s16) ((s32) player->unk_07C >> 0x10); - if (sp2E0 == 0) { - var_s1_3 = 0; + var_s1_2 = (s16) (((s32) player->unk_07C) >> 16); + if (temp_v0_3 == 0) { + var_s1_2 = 0; } if (((player->unk_094 / 18.0f) * 216.0f) <= 5.0f) { - player->unk_078 = (s16) (s32) ((f32) var_s1_3 * (var_f2_3 + 6.0f)); - } else { - var_t4 = (s32) ((f32) var_s1_3 * (var_f2_3 + 1.5f)); -block_123: - player->unk_078 = (s16) var_t4; + player->unk_078 = (s16) ((s32) (((f32) var_s1_2) * (var_f2_2 + 6.0f))); + } + else { + player->unk_078 = ((s16) var_s1_2) * (var_f2_2 + 1.5f); } } if (gModeSelection == 3) { - player->unk_078 = (s16) (s32) ((f64) player->unk_078 * 1.7); + player->unk_078 *= 1.7; } } #else @@ -5409,7 +5287,7 @@ void func_80038C6C(Player *player, Camera *camera, s8 arg2, s8 arg3) { } } player->unk_074 = func_802ABE30(spEC, spE8, spE4, player->unk_110.unk3A); - func_80029B4C(player, &spEC, &spE8, &spE4); + func_80029B4C(player, spEC, spE8, spE4); func_8002AE38(player, arg3, spE0, spD8, spEC, spE4); player->unk_22C = player->unk_094; player->unk_094 = sqrtf((sp90 * sp90) + (sp88 * sp88)); diff --git a/src/code_80027D00.h b/src/code_80027D00.h index d5542be0e..7bf82a336 100644 --- a/src/code_80027D00.h +++ b/src/code_80027D00.h @@ -10,6 +10,9 @@ s32 get_player_index_for_player(Player*); void func_80027DA8(Player*, s8); void func_80027EDC(Player*, s8); +void func_80029B4C(Player *, f32, f32, f32); +void func_8002F730(Player *player, Camera *camera, s8 arg2, s8 arg3); + void func_80028864(Player*, Camera*, s8, s8); void func_80028C44(Player*, Camera*, s8, s8); void func_80028D3C(Player*, Camera*, s8, s8); diff --git a/src/code_8003DC40.c b/src/code_8003DC40.c index b66a28fc5..9aa7e16f6 100644 --- a/src/code_8003DC40.c +++ b/src/code_8003DC40.c @@ -278,7 +278,7 @@ void func_8003F734(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 *arg4 *arg5 += arg1[1] * player->unk_110.unk3C[0] * 0.1; *arg6 += arg1[2] * player->unk_110.unk3C[0] * 1; func_8002A5F4(arg1, *arg3, arg2, 1, 0); - if (((player->unk_0BC << 0xF) >= 0) && ((player->unk_0BC & 8) == 0)) { + if ((!(player->unk_0BC & 0x10000)) && ((player->unk_0BC & 8) == 0)) { arg2[1] *= -1e-05; } } else { @@ -291,7 +291,7 @@ void func_8003F734(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 *arg4 } *arg6 += arg1[2] * player->unk_110.unk3C[0] * 1; func_8002A5F4(arg1, *arg3, arg2, 1.2f, 0); - if (((player->unk_0BC << 0xF) >= 0) && ((player->unk_0BC & 8) == 0)) { + if ((!(player->unk_0BC & 0x10000)) && ((player->unk_0BC & 8) == 0)) { arg2[1] *= -1e-05; } } @@ -332,7 +332,7 @@ void func_8003FBAC(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 *arg4 *arg5 += arg1[1] * player->unk_110.unk3C[1] * 0.1; *arg6 += arg1[2] * player->unk_110.unk3C[1] * 1; func_8002A5F4(arg1, *arg3, arg2, 1, 0); - if (((player->unk_0BC << 0xF) >= 0) && ((player->unk_0BC & 8) == 0)) { + if ((!(player->unk_0BC & 0x10000)) && ((player->unk_0BC & 8) == 0)) { arg2[1] *= -1e-05; } } else { @@ -345,7 +345,7 @@ void func_8003FBAC(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 *arg4 } *arg6 += arg1[2] * player->unk_110.unk3C[1] * 1; func_8002A5F4(arg1, *arg3, arg2, 1.2f, 0); - if (((player->unk_0BC << 0xF) >= 0) && ((player->unk_0BC & 8) == 0)) { + if ((!(player->unk_0BC & 0x10000)) && ((player->unk_0BC & 8) == 0)) { arg2[1] *= -1e-05; } } diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 329e2aac3..2cf0d111d 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -4180,7 +4180,7 @@ void func_800635D4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { f32 sp3C; if (player->unk_258[10 + arg1].unk_010 == 1) { - if ((player->unk_0BC * 2) < 0) { + if ((player->unk_0BC & 0x40000000)) { func_80062B18(&sp44, &sp40, &sp3C, -2.0f, 0.0f, (-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16, -player->unk_258[10 + arg1].unk_020, 2 * -player->unk_206); player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + sp44; player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + sp3C; @@ -4188,7 +4188,7 @@ void func_800635D4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) { player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[2].cornerPos[2] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * coss(player->unk_258[10 + arg1].unk_020); player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[2].cornerPos[0] + ((-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16) * sins(player->unk_258[10 + arg1].unk_020); } - } else if ((player->unk_0BC * 2) < 0) { + } else if ((player->unk_0BC & 0x40000000)) { func_80062B18(&sp44, &sp40, &sp3C, 2.0f, 0.0f, (-player->unk_258[10 + arg1].unk_01E * (player->unk_094 / 18.0f) * 216.0f) / 16, - player->unk_258[10 + arg1].unk_020, 2 * -player->unk_206); player->unk_258[10 + arg1].unk_000[0] = player->boundingBoxCorners[3].cornerPos[0] + sp44; player->unk_258[10 + arg1].unk_000[2] = player->boundingBoxCorners[3].cornerPos[2] + sp3C; diff --git a/src/code_80071F00.c b/src/code_80071F00.c index 54a5c3a22..e4e6b72d6 100644 --- a/src/code_80071F00.c +++ b/src/code_80071F00.c @@ -3543,7 +3543,7 @@ void func_8007A4D4(s32 objectIndex, s32 playerId) { } switch (D_80165C18[objectIndex].unk_0D6) { /* switch 1; irregular */ case 1: /* switch 1 */ - if ((D_80165C18[objectIndex].unk_0A6 >= 3) && ((sp2C->unk_0BC << 9) >= 0)) { + if ((D_80165C18[objectIndex].unk_0A6 >= 3) && (!(sp2C->unk_0BC & 0x400000))) { func_80086F10(objectIndex, 6, D_800E69F4); D_80165C18[objectIndex].unk_0D6 = 2; D_80165C18[objectIndex].unk_04C = 0x00000050; diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index b7f4b3bbe..91b5cc6a0 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -1341,8 +1341,8 @@ void func_8008F3F4(Player* player, UNUSED s8 arg1) { void func_8008F494(Player* player, s8 arg1) { if ((((player->unk_0BC & 0x80) != 0) || ((player->unk_0BC & 0x40) != 0) || - ((player->unk_0BC << 7) < 0) || - ((player->unk_0BC << 6) < 0) || + ((player->unk_0BC & 0x01000000)) || + ((player->unk_0BC & 0x02000000)) || ((player->unk_0BC & 0x400) != 0)) && (gModeSelection == BATTLE)) { player->unk_044 |= 0x8000; }