Finished matching code_8008C1D0 (#357)

* Matched code_8008C1D0.c

Signed-off-by: Taggerung <tyler.taggerung@email.com>
This commit is contained in:
Tyler McGavran
2023-08-08 22:58:36 -04:00
committed by GitHub
parent e631ca224f
commit ccd33e9e10
6 changed files with 113 additions and 1033 deletions
+108 -185
View File
@@ -1,6 +1,7 @@
#include <ultra64.h>
#include <macros.h>
#include "types.h"
#include "math_util.h"
#include "functions.h"
#include "variables.h"
#include "kart_attributes.h"
@@ -409,80 +410,56 @@ void func_8008CDC0(Player* player, s8 arg1) {
}
}
#ifdef MIPS_TO_C
//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-14-2022
void func_8008CEB0(Player *player, s8 arg1) {
f32 sp2C;
s16 sp2A;
s16 sp28;
s16 sp26;
f32 var_f0;
s16 temp_a2;
s16 var_a2;
s16 var_a3;
s16 var_v1;
s32 temp_f16;
s32 temp_v0;
s32 temp_v0_2;
s16 var_a3;
s16 temp_f16;
var_v1 = (s16) player->unk_0B4 + 1;
var_f0 = player->unk_0B8;
var_v1 = player->unk_0B4;
var_a3 = player->unk_0AC;
temp_f16 = (s32) ((f64) ((f32) var_v1 * var_f0) - (0.2 * (f64) (var_v1 * var_v1)));
temp_a2 = (s16) temp_f16;
if ((var_v1 != 0) && ((s16) temp_f16 < 0)) {
temp_v0 = player->unk_0BC;
var_v1++;
temp_f16 = (var_v1 * var_f0) - (0.2 * (var_v1 * var_v1));
if ((var_v1 != 0) && (temp_f16 < 0)) {
var_v1 = 0;
var_a3 *= -1;
var_f0 = (f32) ((f64) var_f0 * 0.8);
if ((temp_v0 & 1) == 1) {
player->unk_0BC = temp_v0 | 0x40000;
var_a3 = -var_a3;
var_f0 *= 0.8;
if ((player->unk_0BC & 1) == 1) {
player->unk_0BC |= 0x40000;
}
if (var_f0 <= 1.0f) {
temp_v0_2 = player->unk_0BC & ~0x800;
player->unk_0BC = temp_v0_2;
if ((temp_v0_2 & 0x40000) != 0x40000) {
sp2A = 0;
sp26 = temp_a2;
sp28 = var_a3;
sp2C = var_f0;
player->unk_0BC &= ~0x800;
if ((player->unk_0BC & 0x40000) != 0x40000) {
func_8008C73C(player, arg1);
var_v1 = 0;
goto block_9;
}
player->unk_0B6 |= 0x20;
player->unk_0BC = temp_v0_2 & 0xFFFBFFFF;
if ((player->unk_000 & 0x4000) == 0x4000) {
sp2C = var_f0;
sp28 = var_a3;
sp26 = temp_a2;
sp2A = 0;
func_800C90F4((u8) arg1, (player->characterId * 0x10) + 0x29008008);
var_v1 = 0;
block_9:
var_f0 = sp2C;
} else {
player->unk_0B6 |= 0x20;
player->unk_0BC &= ~0x40000;
if ((player->unk_000 & 0x4000) == 0x4000)
{
func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008008);
var_v1 = 0;
}
}
}
}
var_a2 = temp_a2 * var_a3;
if ((var_a2 <= 0) && (var_a3 == 1)) {
var_a2 = 0;
temp_f16 *= var_a3;
if ((temp_f16 <= 0) && (var_a3 == 1)) {
temp_f16 = 0;
}
if ((var_a2 >= 0) && (var_a3 == -1)) {
var_a2 = 0;
if ((temp_f16 >= 0) && (var_a3 == -1)) {
temp_f16 = 0;
}
player->unk_078 += var_a2 * 0x12;
player->unk_078 += temp_f16 * 0x12;
player->unk_0B8 = var_f0;
player->unk_0B4 = (u16) var_v1;
player->unk_0B4 = var_v1;
player->unk_0AC = var_a3;
if (player->unk_0BC & 8) {
func_8008C73C(player, arg1);
player->unk_0BC &= ~0x800;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_8008CEB0.s")
#endif
void func_8008D0E4(Player* player, UNUSED s8 arg1) {
player->unk_0BC &= ~0x800;
@@ -499,80 +476,56 @@ void func_8008D0FC(Player *player, s8 arg1) {
player->unk_044 |= 0x4000;
}
#ifdef MIPS_TO_C
//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
void func_8008D170(Player *player, s8 arg1) {
f32 sp2C;
s16 sp2A;
s16 sp28;
s16 sp26;
f32 var_f0;
s16 temp_a2;
s16 var_a2;
s16 var_a3;
s16 var_v1;
s32 temp_f16;
s32 temp_v0;
s32 temp_v0_2;
s16 var_a3;
s16 temp_f16;
var_v1 = player->unk_0B4 + 1;
var_f0 = player->unk_0B8;
var_v1 = player->unk_0B4;
var_a3 = player->unk_0AC;
temp_f16 = (s32) ((f64) ((f32) var_v1 * var_f0) - (0.1 * (f64) (var_v1 * var_v1)));
temp_a2 = (s16) temp_f16;
if ((var_v1 != 0) && ((s16) temp_f16 < 0)) {
temp_v0 = player->unk_0BC;
var_v1++;
temp_f16 = (var_v1 * var_f0) - (0.1 * (var_v1 * var_v1));
if ((var_v1 != 0) && (temp_f16 < 0)) {
var_v1 = 0;
var_a3 *= -1;
var_f0 = (f32) ((f64) var_f0 * 0.9);
if (((temp_v0 & 1) == 1) || !(player->unk_044 & 0x20)) {
player->unk_0BC = temp_v0 | 0x40000;
var_a3 = -var_a3;
var_f0 *= 0.9;
if (((player->unk_0BC & 1) == 1) || !(player->unk_044 & 0x20)) {
player->unk_0BC |= 0x40000;
}
if ((f64) var_f0 <= 1.3) {
temp_v0_2 = player->unk_0BC;
player->unk_044 &= 0xBFFF;
if ((temp_v0_2 & 0x40000) != 0x40000) {
sp2A = 0;
sp26 = temp_a2;
sp28 = var_a3;
sp2C = var_f0;
if (var_f0 <= 1.3) {
player->unk_044 &= ~0x4000;
if ((player->unk_0BC & 0x40000) != 0x40000) {
func_8008C73C(player, arg1);
var_v1 = 0;
goto block_10;
}
player->unk_0B6 |= 0x20;
player->unk_0BC = temp_v0_2 & 0xFFFBFFFF;
if ((player->unk_000 & 0x4000) == 0x4000) {
sp2C = var_f0;
sp28 = var_a3;
sp26 = temp_a2;
sp2A = 0;
func_800C90F4((u8) arg1, (player->characterId * 0x10) + 0x29008008);
var_v1 = 0;
block_10:
var_f0 = sp2C;
} else {
player->unk_0B6 |= 0x20;
player->unk_0BC &= ~0x40000;
if ((player->unk_000 & 0x4000) == 0x4000)
{
func_800C90F4(arg1, (player->characterId * 0x10) + 0x29008008);
var_v1 = 0;
}
}
}
}
var_a2 = temp_a2 * var_a3;
if ((var_a2 <= 0) && (var_a3 == 1)) {
var_a2 = 0;
temp_f16 *= var_a3;
if ((temp_f16 <= 0) && (var_a3 == 1)) {
temp_f16 = 0;
}
if ((var_a2 >= 0) && (var_a3 == -1)) {
var_a2 = 0;
if ((temp_f16 >= 0) && (var_a3 == -1)) {
temp_f16 = 0;
}
player->unk_078 += var_a2 * 0x14;
player->unk_078 += temp_f16 * 0x14;
player->unk_0B8 = var_f0;
player->unk_0B4 = var_v1;
player->unk_0AC = var_a3;
if (player->unk_0BC & 8) {
func_8008C73C(player, arg1);
player->unk_044 &= 0xBFFF;
player->unk_044 &= ~0x4000;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_8008D170.s")
#endif
void func_8008D3B0(Player* player, UNUSED s8 arg1) {
player->unk_044 &= 0xBFFF;
@@ -1866,29 +1819,14 @@ void func_80090868(Player* player) {
}
}
#ifdef MIPS_TO_C
//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b
? func_8009E020(s8, ?); /* extern */
? func_8009E088(s8, ?); /* extern */
? func_800C9018(u8, ?); /* extern */
extern ? D_80165330;
void func_80090970(Player *player, s8 arg1, s8 arg2) {
f32 sp44;
f32 sp38;
f32 *sp28; /* compiler-managed */
f32 *temp_v0_2;
f32 temp_f6;
s16 temp_v0;
s16 temp_v0_6;
s16 temp_v1;
s16 temp_v1_2;
s32 temp_v0_5;
s32 temp_v0_8;
struct TrackWayPoint *temp_v0_7;
u16 temp_t7;
u16 temp_v0_3;
u16 temp_v0_4;
s32 stackPadding0;
s32 stackPadding1;
Vec3f sp44;
Vec3f sp38;
struct TrackWayPoint *wayPoint;
s32 stackPadding2;
s32 stackPadding3;
player->unk_0C2 = 0x000C;
player->unk_078 = 0;
@@ -1896,35 +1834,30 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) {
player->unk_0C0 = 0;
player->unk_08C = 0.0f;
func_8008C354(player, arg1);
temp_t7 = (u16) player->unk_222;
switch (temp_t7) {
switch (player->unk_222) {
case 0:
temp_v1 = player->unk_0CA;
if ((temp_v1 & 1) == 1) {
temp_v0 = player->unk_0C8;
if ((temp_v0 < 0x3C) || ((temp_v1 & 2) != 2)) {
player->unk_0C8 = temp_v0 + 1;
if ((player->unk_0CA & 1) == 1) {
if ((player->unk_0C8 < 0x3C) || ((player->unk_0CA & 2) != 2)) {
player->unk_0C8++;
if (player->unk_0C8 >= 0x3C) {
player->unk_0C8 = 0x003C;
}
} else {
temp_v0_2 = &D_801652A0[arg1];
sp28 = temp_v0_2;
move_f32_towards(&player->pos[1], *temp_v0_2 + 100.0f, 0.012f);
move_s16_towards(player + (arg2 * 2) + 0xCC, 0, 0.2f);
if ((*sp28 + 40.0f) <= player->pos[1]) {
move_f32_towards(&player->pos[1], D_801652A0[arg1] + 100.0f, 0.012f);
move_s16_towards(&player->unk_0CC[arg2], 0, 0.2f);
if ((D_801652A0[arg1] + 40.0f) <= player->pos[1]) {
player->unk_222 = 1;
player->unk_0C6 = 0x00FF;
player->unk_0CA |= 4;
player->unk_0C6 = 0x00FF;
}
}
} else if ((temp_v1 & 2) == 2) {
} else if ((player->unk_0CA & 2) == 2) {
move_f32_towards(&player->pos[1], player->unk_074 + 100.0f, 0.025f);
move_s16_towards(player + (arg2 * 2) + 0xCC, 0, 0.2f);
move_s16_towards(&player->unk_0CC[arg2], 0, 0.2f);
if ((player->unk_074 + 40.0f) <= player->pos[1]) {
player->unk_222 = 1;
player->unk_0C6 = 0x00FF;
player->unk_0CA |= 4;
player->unk_0C6 = 0x00FF;
}
}
if ((player->unk_0BC & 0x80000000) == 0x80000000) {
@@ -1932,8 +1865,7 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) {
}
break;
case 1:
temp_v0_3 = player->unk_000;
if (((temp_v0_3 & 0x4000) == 0x4000) && !(temp_v0_3 & 0x1000)) {
if (((player->unk_000 & 0x4000) == 0x4000) && ((player->unk_000 & 0x1000) == 0)) {
func_8009E088(arg1, 0xA);
}
if ((player->unk_0CA & 1) == 1) {
@@ -1942,7 +1874,7 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) {
if (player->unk_0C6 < 9) {
player->unk_0C6 = 0;
player->unk_222 = 2;
player->unk_0CA &= 0xFFFE;
player->unk_0CA &= ~0x0001;
}
} else {
move_f32_towards(&player->pos[1], player->rotY + 40.0f, 0.02f);
@@ -1952,69 +1884,63 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) {
player->unk_222 = 2;
}
}
player->unk_0CA &= 0xDFFF;
player->unk_0CA &= ~0x2000;
break;
case 2:
func_80090178(player, arg1, &sp44, &sp38);
player->unk_02C[1] = -func_802B5224(&sp44, &sp38);
player->pos[0] = sp44;
player->pos[1] = sp48 + 40.0f;
func_80090178(player, arg1, sp44, sp38);
// Fakematch found by Verti, who knows what's going on here
player->unk_02C[1] = (u16) -func_802B5224(sp44, sp38) & 0xFFFF;
player->pos[0] = sp44[0];
player->pos[1] = sp44[1] + 40.0f;
player->pos[2] = sp44[2];
player->unk_222 = 3;
player->pos[2] = sp4C;
break;
case 3:
*(&D_80165330 + (arg1 * 2)) = 0;
temp_v0_4 = player->unk_000;
if (((temp_v0_4 & 0x4000) == 0x4000) && !(temp_v0_4 & 0x1000)) {
D_80165330[arg1] = 0;
if (((player->unk_000 & 0x4000) == 0x4000) && ((player->unk_000 & 0x1000) == 0)) {
func_8009E020(arg1, 0x14);
}
func_80090178(player, arg1, &sp44, &sp38);
player->pos[0] = sp44;
player->pos[1] = sp48 + 40.0f;
player->pos[2] = sp4C;
temp_v0_5 = arg1 * 0x1C70;
sp28 = temp_v0_5;
player->pos[2] += coss((temp_v0_5 - player->unk_02C[1]) & 0xFFFF) * -5.0f;
temp_f6 = sins((temp_v0_5 - player->unk_02C[1]) & 0xFFFF) * -5.0f;
func_80090178(player, arg1, sp44, sp38);
player->pos[0] = sp44[0];
player->pos[1] = sp44[1] + 40.0f;
player->pos[2] = sp44[2];
player->pos[2] = player->pos[2] + coss((arg1 * 0x1C70) - player->unk_02C[1]) * -5.0f;
player->pos[0] = player->pos[0] + sins((arg1 * 0x1C70) - player->unk_02C[1]) * -5.0f;
player->unk_0C6 += 8;
player->pos[0] += temp_f6;
if (player->unk_0C6 >= 0xF0) {
player->unk_0C6 = 0x00FF;
player->unk_222 = 4;
player->unk_0CA &= 0xFFFB;
player->unk_0CA &= ~0x0004;
player->unk_0C8 = 0;
}
break;
case 4:
temp_v0_6 = player->unk_0C8;
if ((temp_v0_6 == 0x0096) || (temp_v0_6 == 0x00C8) || (temp_v0_6 == 0x00FA)) {
player->pos[2] += coss(-player->unk_02C[1] & 0xFFFF) * -10.0f;
player->pos[0] += sins(-player->unk_02C[1] & 0xFFFF) * -10.0f;
if ((player->unk_0C8 == 0x0096) || (player->unk_0C8 == 0x00C8) || (player->unk_0C8 == 0x00FA)) {
player->pos[2] = player->pos[2] + coss(-player->unk_02C[1]) * -10.0f;
player->pos[0] = player->pos[0] + sins(-player->unk_02C[1]) * -10.0f;
}
if (player->unk_0C8 == 0x00FC) {
temp_v0_7 = *D_80164550;
player->pos[0] = (f32) temp_v0_7->wayPointX;
player->pos[1] = (f32) temp_v0_7->wayPointY;
player->pos[2] = (f32) temp_v0_7->wayPointZ;
wayPoint = D_80164550[0];
player->pos[0] = wayPoint->wayPointX;
player->pos[1] = wayPoint->wayPointY;
player->pos[2] = wayPoint->wayPointZ;
}
move_f32_towards(&player->pos[1], (player->unk_074 + player->boundingBoxSize) - 2.0f, 0.04f);
temp_v0_8 = player->unk_0BC;
player->unk_0C8 += 1;
if (((temp_v0_8 & 8) != 8) || (temp_v0_8 & 0x8000)) {
player->unk_0CA &= 0xEFFF;
player->unk_0C8++;
if (((player->unk_0BC & 8) != 8) || (player->unk_0BC & 0x8000)) {
player->unk_0CA &= ~0x1000;
if (player->unk_0C8 >= 0x5B) {
if (player->unk_000 & 0x4000) {
func_800C9018((u8) arg1, 0x0100FA28);
func_800C9018(arg1, 0x0100FA28);
}
if (gModeSelection == BATTLE) {
func_8006B8B4(player, arg1);
}
player->unk_0CA &= 0xFFFD;
temp_v1_2 = player->unk_0CA;
player->unk_0DE &= 0xFFFB;
if ((temp_v1_2 & 0x80) != 0x80) {
player->unk_0CA = temp_v1_2 & 0xFFF7;
if (((f64) player->unk_214 * 0.9) <= (f64) player->unk_09C) {
player->unk_0CA &= ~0x0002;
player->unk_0DE &= ~0x0004;
if ((player->unk_0CA & 0x80) != 0x80) {
player->unk_0CA &= ~0x0008;
if ((player->unk_214 * 0.9) <= player->unk_09C) {
func_8008F104(player, arg1);
}
}
@@ -2041,9 +1967,6 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) {
}
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_8008C1D0/func_80090970.s")
#endif
s32 func_800910E4(Player *arg0) {
s32 phi_v0 = 0;
+3
View File
@@ -54,8 +54,10 @@ void func_8008C73C(Player*, s8);
void func_8008C8C4(Player*, s8);
void func_8008C9EC(Player*, s8);
void func_8008CDC0(Player*, s8);
void func_8008CEB0(Player*, s8);
void func_8008D0E4(Player*, s8);
void func_8008D0FC(Player*, s8);
void func_8008D170(Player*, s8);
void func_8008D3B0(Player*, s8);
void func_8008D3C4(Player*, s8);
void func_8008D4B4(Player*);
@@ -108,6 +110,7 @@ void func_8008FF08(Player*, s8);
void func_80090178(Player*, s8, Vec3f, Vec3f);
void func_80090778(Player*);
void func_80090868(Player*);
void func_80090970(Player*, s8, s8);
s32 func_800910E4(Player*);
void func_800911B4(Player*, s8);
void func_80091298(Player*, s8);
+2
View File
@@ -172,6 +172,8 @@ void func_8009DF4C(s32);
void func_8009DF6C(s32);
void func_8009DFE0(s32);
void func_8009E000(s32);
void func_8009E020(s32, s32);
void func_8009E088(s32, s32);
void func_8009E0F0(s32);
void func_8009E1C0();
void func_8009E1E4();