Add in a struct for surface map entires (#150)

Sourced from https://github.com/micro500/mariokart64/wiki/Surface-Map,
 only minor adjustments were made.

Updated the bounding box corner struct a little based on information from
 the surface map struct.

Refreshed several mips_to_c outputs

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2022-01-24 23:22:05 -05:00
committed by GitHub
parent f0e40cb746
commit e371625acb
11 changed files with 389 additions and 336 deletions
+226 -206
View File
@@ -2508,17 +2508,17 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802ABDF4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75
f32 func_802ABE30(f32 arg0, f32 arg1, f32 arg2, s32 arg3) {
f32 temp_f2;
void *temp_v0;
mk64_surface_map_ram *temp_v0;
temp_v0 = ((arg3 & 0xFFFF) * 0x2C) + D_8015F580;
temp_f2 = temp_v0->unk20;
temp_v0 = &(*D_8015F580)[arg3 & 0xFFFF];
temp_f2 = temp_v0->gravity;
if (temp_f2 == 0.0f) {
return arg1;
}
return ((temp_v0->unk1C * arg0) + (temp_v0->unk24 * arg2) + temp_v0->unk28) / -temp_f2;
return ((temp_v0->height * arg0) + (temp_v0->rotation * arg2) + temp_v0->height2) / -temp_f2;
}
#else
GLOBAL_ASM("asm/non_matchings/memory/func_802ABE30.s")
@@ -3264,14 +3264,18 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AD278.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802AC760(void *, f32, f32, f32, f32, ?32, ?32, ?32, ?32); // extern
s32 func_802ACBA4(void *, void *, f32, f32, f32, s32, ?32, ?32, ?32); // extern
s32 func_802AD278(void *, void *, f32, f32, f32, s32, ?32, ?32, ?32); // extern
//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75
s32 func_802AC760(void *, f32, f32, f32, f32, f32, f32, f32, f32); /* extern */
s32 func_802ACBA4(void *, void *, f32, f32, f32, s32, f32, f32, f32); /* extern */
s32 func_802AD278(void *, void *, f32, f32, f32, s32, f32, f32, f32); /* extern */
extern ? D_8014F110;
extern s32 D_8015F584;
extern s16 D_8015F6E8;
extern s16 D_8015F6EA;
extern s16 D_8015F6F0;
extern s16 D_8015F6F2;
s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, ?32 arg5, ?32 arg6, ?32 arg7) {
s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) {
s16 temp_v0_4;
s16 temp_v1;
s32 temp_f10;
@@ -3301,17 +3305,17 @@ s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, ?32 arg5
arg0->unk14 = 1000.0f;
temp_v0 = arg0->unkA;
phi_s4_6 = 0;
if ((temp_v0 < D_8015F588) && (func_802AC760(arg1, arg2, arg3, arg4, (bitwise f32) temp_v0, arg5, arg6, arg7) == 1)) {
if (((s32) temp_v0 < (s32) D_8015F588) && (func_802AC760(arg1, arg2, arg3, arg4, (bitwise f32) temp_v0, arg5, arg6, arg7) == 1)) {
phi_s4_6 = 0x4000;
}
temp_v0_2 = arg0->unk6;
phi_s4_4 = phi_s4_6;
if ((temp_v0_2 < D_8015F588) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, temp_v0_2, arg5, arg6, arg7) == 1)) {
if (((s32) temp_v0_2 < (s32) D_8015F588) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_2, arg5, arg6, arg7) == 1)) {
phi_s4_4 = (phi_s4_6 | 0x2000) & 0xFFFF;
}
temp_v0_3 = arg0->unk8;
phi_s4 = phi_s4_4;
if ((temp_v0_3 < D_8015F588) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, temp_v0_3, arg5, arg6, arg7) == 1)) {
if (((s32) temp_v0_3 < (s32) D_8015F588) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_3, arg5, arg6, arg7) == 1)) {
phi_s4 = (phi_s4_4 | 0x8000) & 0xFFFF;
}
phi_s4_2 = phi_s4;
@@ -3321,28 +3325,28 @@ s32 func_802AD950(void *arg0, void *arg1, f32 arg2, f32 arg3, f32 arg4, ?32 arg5
}
temp_v0_4 = D_8015F6EA;
temp_v1 = D_8015F6F2;
temp_f10 = (arg2 - temp_v0_4) / ((D_8015F6E8 - temp_v0_4) / 0x20);
temp_f16 = (arg4 - temp_v1) / ((D_8015F6F0 - temp_v1) / 0x20);
if (temp_f10 < 0) {
temp_f10 = (s32) ((arg2 - (f32) temp_v0_4) / (f32) ((s32) (D_8015F6E8 - temp_v0_4) / 32));
temp_f16 = (s32) ((arg4 - (f32) temp_v1) / (f32) ((s32) (D_8015F6F0 - temp_v1) / 32));
if ((s32) (s16) temp_f10 < 0) {
return 0;
}
if (temp_f16 < 0) {
if ((s32) (s16) temp_f16 < 0) {
return 0;
}
if (temp_f10 >= 0x20) {
if ((s32) (s16) temp_f10 >= 0x20) {
return 0;
}
if (temp_f16 >= 0x20) {
if ((s32) (s16) temp_f16 >= 0x20) {
return 0;
}
temp_v1_2 = ((temp_f10 + (temp_f16 << 5)) * 4) + &D_8014F110;
temp_v1_2 = ((s16) ((s16) temp_f10 + ((s16) temp_f16 << 5)) * 4) + &D_8014F110;
temp_s6 = temp_v1_2->unk2;
phi_s3 = 0;
if (temp_s6 == 0) {
} else {
phi_s2 = temp_v1_2->unk0;
if (temp_s6 > 0) {
if ((s32) temp_s6 > 0) {
loop_22:
phi_s4_3 = phi_s4_2;
phi_s4_5 = phi_s4_2;
@@ -3350,16 +3354,16 @@ loop_22:
} else {
temp_v0_5 = *(D_8015F584 + (phi_s2 * 2));
temp_v1_3 = *(D_8015F580 + (temp_v0_5 * 0x2C));
temp_v1_3 = (*D_8015F580)[temp_v0_5].flags;
if ((temp_v1_3 & 0x4000) != 0) {
if (((phi_s4_2 & 0x4000) == 0) && (arg0->unkA != temp_v0_5) && (func_802AC760(arg0, (bitwise f32) arg1, arg2, arg3, arg4, temp_v0_5, arg5, arg6, arg7) == 1)) {
if (((phi_s4_2 & 0x4000) == 0) && (arg0->unkA != temp_v0_5) && (func_802AC760(arg0, (bitwise f32) arg1, arg2, arg3, arg4, (bitwise f32) temp_v0_5, arg5, arg6, arg7) == 1)) {
phi_s4_5 = (phi_s4_2 | 0x4000) & 0xFFFF;
}
} else if ((temp_v1_3 & 0x8000) != 0) {
if (((phi_s4_2 & 0x8000) == 0) && (arg0->unk8 != temp_v0_5) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, temp_v0_5, arg5, arg6, arg7) == 1)) {
if (((phi_s4_2 & 0x8000) == 0) && (arg0->unk8 != temp_v0_5) && (func_802AD278(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_5, arg5, arg6, arg7) == 1)) {
phi_s4_5 = (phi_s4_2 | 0x8000) & 0xFFFF;
}
} else if (((phi_s4_2 & 0x2000) == 0) && (arg0->unk6 != temp_v0_5) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, temp_v0_5, arg5, arg6, arg7) == 1)) {
} else if (((phi_s4_2 & 0x2000) == 0) && (arg0->unk6 != temp_v0_5) && (func_802ACBA4(arg0, arg1, arg2, arg3, arg4, (s32) temp_v0_5, arg5, arg6, arg7) == 1)) {
phi_s4_5 = (phi_s4_2 | 0x2000) & 0xFFFF;
}
temp_t7 = (phi_s3 + 1) & 0xFFFF;
@@ -3367,7 +3371,7 @@ loop_22:
phi_s2 = (phi_s2 + 1) & 0xFFFF;
phi_s3 = temp_t7;
phi_s4_3 = phi_s4_5;
if (temp_t7 < temp_s6) {
if (temp_t7 < (s32) temp_s6) {
goto loop_22;
}
}
@@ -3498,17 +3502,21 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802ADDC8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802ABB04(f32, f32, s32); // extern
f32 func_802ABE30(f32, f32, f32, s32); // extern
//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75
s32 func_802ABB04(f32, f32, s32); /* extern */
f32 func_802ABE30(f32, f32, f32, s32); /* extern */
extern ? D_8014F110;
extern s32 D_8015F584;
extern f32 D_802B9E4C;
extern f32 D_802B9E50;
extern f32 D_802B9E54;
extern f32 D_802B9E58;
extern f32 D_802B9E5C;
extern f32 D_802B9E60;
extern s16 D_8015F6E8;
extern s16 D_8015F6EA;
extern s16 D_8015F6F0;
extern s16 D_8015F6F2;
static f32 D_802B9E4C = -3000.0f;
static f32 D_802B9E50 = 3000.0f;
static f32 D_802B9E54 = 3000.0f;
static f32 D_802B9E58 = 3000.0f;
static f32 D_802B9E5C = 3000.0f;
static f32 D_802B9E60 = 3000.0f;
f32 func_802AE1C0(f32 arg0, f32 arg1, f32 arg2) {
f32 temp_f0;
@@ -3531,20 +3539,20 @@ f32 func_802AE1C0(f32 arg0, f32 arg1, f32 arg2) {
temp_v0 = D_8015F6EA;
temp_f20 = D_802B9E4C;
temp_v1 = D_8015F6F2;
temp_f4 = (arg0 - temp_v0) / ((D_8015F6E8 - temp_v0) / 0x20);
temp_f6 = (arg2 - temp_v1) / ((D_8015F6F0 - temp_v1) / 0x20);
temp_t0 = temp_f6 << 5;
temp_t2 = ((temp_f4 + temp_t0) * 4) + &D_8014F110;
temp_f4 = (s32) ((arg0 - (f32) temp_v0) / (f32) ((s32) (D_8015F6E8 - temp_v0) / 32));
temp_f6 = (s32) ((arg2 - (f32) temp_v1) / (f32) ((s32) (D_8015F6F0 - temp_v1) / 32));
temp_t0 = (s16) temp_f6 << 5;
temp_t2 = ((s16) ((s16) temp_f4 + temp_t0) * 4) + &D_8014F110;
temp_t1 = temp_t2->unk2;
phi_f20 = temp_f20;
phi_f20_2 = temp_f20;
if (temp_f4 < 0) {
if ((s32) (s16) temp_f4 < 0) {
return D_802B9E50;
}
if (temp_f6 & 0x4000000) {
if ((s16) temp_f6 & 0x04000000) {
return D_802B9E54;
}
if (temp_f4 >= 0x20) {
if ((s32) (s16) temp_f4 >= 0x20) {
return D_802B9E58;
}
if (temp_t0 >= 0x400) {
@@ -3555,11 +3563,11 @@ f32 func_802AE1C0(f32 arg0, f32 arg1, f32 arg2) {
}
phi_s1 = temp_t2->unk0;
phi_s2 = 0;
if (temp_t1 > 0) {
if ((s32) temp_t1 > 0) {
do {
temp_s0 = *(D_8015F584 + (phi_s1 * 2));
phi_f20_3 = phi_f20;
if (((*(D_8015F580 + (temp_s0 * 0x2C)) & 0x4000) != 0) && (func_802ABB04(arg0, arg2, temp_s0 & 0xFFFF) == 1)) {
if ((((*D_8015F580)[temp_s0].flags & 0x4000) != 0) && (func_802ABB04(arg0, arg2, temp_s0 & 0xFFFF) == 1)) {
temp_f0 = func_802ABE30(arg0, arg1, arg2, temp_s0 & 0xFFFF);
if ((temp_f0 <= arg1) && (phi_f20 < temp_f0)) {
phi_f20_3 = temp_f0;
@@ -3570,7 +3578,7 @@ f32 func_802AE1C0(f32 arg0, f32 arg1, f32 arg2) {
phi_f20 = phi_f20_3;
phi_s2 = temp_t9;
phi_f20_2 = phi_f20_3;
} while (temp_t9 < temp_t1);
} while (temp_t9 < (s32) temp_t1);
}
return phi_f20_2;
}
@@ -3579,16 +3587,24 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AE1C0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75
extern s32 D_8015F59C;
extern s32 D_8015F5A0;
extern s32 D_8015F5A4;
extern s16 D_8015F6E8;
extern s16 D_8015F6EA;
extern s16 D_8015F6EC;
extern s16 D_8015F6EE;
extern s16 D_8015F6F0;
extern s16 D_8015F6F2;
extern s16 D_8015F6FA;
extern s16 D_8015F6FC;
extern f32 D_802B9E64;
extern f32 D_802B9E68;
extern f32 D_802B9E6C;
extern f32 D_802B9E70;
static f32 D_802B9E64 = -0.9f;
static f32 D_802B9E68 = 0.9f;
static f32 D_802B9E6C = 0.1f;
static f32 D_802B9E70 = -0.1f;
void func_802AE434(void *arg0, void *arg1, void *arg2, s8 arg3, u16 arg4) {
void func_802AE434(mk_Vtx_Flag *arg0, mk_Vtx_Flag *arg1, mk_Vtx_Flag *arg2, s8 arg3, u16 arg4) {
s16 spBA;
s16 spB8;
s16 spB6;
@@ -3603,7 +3619,7 @@ void func_802AE434(void *arg0, void *arg1, void *arg2, s8 arg3, u16 arg4) {
s16 sp48;
s16 sp44;
s16 sp42;
void *sp1C;
mk_Vtx_Flag *sp1C; /* compiler-managed */
f64 sp10;
f64 sp8;
f64 sp0;
@@ -3617,6 +3633,10 @@ void func_802AE434(void *arg0, void *arg1, void *arg2, s8 arg3, u16 arg4) {
f64 temp_f2;
f64 temp_f4;
f64 temp_f8;
mk64_surface_map_ram *temp_t0;
mk_Vtx_Flag *temp_t1;
mk_Vtx_Flag *temp_t2;
mk_Vtx_Flag *temp_t6;
s16 temp_a0;
s16 temp_a1;
s16 temp_t3;
@@ -3630,10 +3650,6 @@ void func_802AE434(void *arg0, void *arg1, void *arg2, s8 arg3, u16 arg4) {
u16 temp_a0_3;
u16 temp_a3_2;
u16 temp_v1_2;
void *temp_t0;
void *temp_t1;
void *temp_t2;
void *temp_t6;
s32 phi_a0;
s32 phi_t3;
s32 phi_t5;
@@ -3649,168 +3665,168 @@ void func_802AE434(void *arg0, void *arg1, void *arg2, s8 arg3, u16 arg4) {
u16 phi_t9;
u16 phi_t8;
temp_t0 = (D_8015F588 * 0x2C) + D_8015F580;
temp_t0->unk10 = arg0;
temp_t0->unk14 = arg1;
temp_t0->unk18 = arg2;
if ((arg0->unk6 != 4) || (arg1->unk6 != 4) || (temp_t0->unk18->unk6 != 4)) {
temp_t6 = temp_t0->unk10;
temp_t0 = &(*D_8015F580)[D_8015F588];
temp_t0->vtxs[0] = arg0;
temp_t0->vtxs[1] = arg1;
temp_t0->vtxs[2] = arg2;
if (((u16) arg0->tc[0] != 4) || ((u16) arg1->tc[0] != 4) || ((u16) temp_t0->vtxs[2]->tc[0] != 4)) {
temp_t6 = temp_t0->vtxs[0];
sp1C = temp_t6;
temp_t1 = temp_t0->unk14;
temp_t2 = temp_t0->unk18;
temp_a0 = temp_t6->unk0;
temp_t3 = temp_t1->unk0;
temp_a1 = temp_t6->unk4;
temp_t4 = temp_t1->unk4;
phi_a0 = temp_a0;
phi_t3 = temp_t3;
phi_t5 = temp_t2->unk0;
phi_a1 = temp_a1;
phi_t4 = temp_t4;
phi_v1 = temp_t2->unk4;
phi_a2 = temp_t6->unk2;
phi_a3 = temp_t1->unk2;
phi_v0 = temp_t2->unk2;
temp_t1 = temp_t0->vtxs[1];
temp_t2 = temp_t0->vtxs[2];
temp_a0 = temp_t6->ob[0];
temp_t3 = temp_t1->ob[0];
temp_a1 = temp_t6->ob[2];
temp_t4 = temp_t1->ob[2];
phi_a0 = (s32) temp_a0;
phi_t3 = (s32) temp_t3;
phi_t5 = (s32) temp_t2->ob[0];
phi_a1 = (s32) temp_a1;
phi_t4 = (s32) temp_t4;
phi_v1 = (s32) temp_t2->ob[2];
phi_a2 = (s32) temp_t6->ob[1];
phi_a3 = (s32) temp_t1->ob[1];
phi_v0 = (s32) temp_t2->ob[1];
if ((temp_a0 == temp_t3) && (temp_a1 == temp_t4)) {
temp_t0->unk18 = arg1;
temp_t0->unk14 = arg2;
phi_a0 = arg0->unk0;
phi_t3 = arg1->unk0;
phi_t5 = arg2->unk0;
phi_a1 = arg0->unk4;
phi_t4 = arg1->unk4;
phi_v1 = arg2->unk4;
phi_a2 = arg0->unk2;
phi_a3 = arg1->unk2;
phi_v0 = arg2->unk2;
temp_t0->vtxs[2] = arg1;
temp_t0->vtxs[1] = arg2;
phi_a0 = (s32) arg0->ob[0];
phi_t3 = (s32) arg1->ob[0];
phi_t5 = (s32) arg2->ob[0];
phi_a1 = (s32) arg0->ob[2];
phi_t4 = (s32) arg1->ob[2];
phi_v1 = (s32) arg2->ob[2];
phi_a2 = (s32) arg0->ob[1];
phi_a3 = (s32) arg1->ob[1];
phi_v0 = (s32) arg2->ob[1];
}
if (phi_a0 >= phi_t3) {
if (phi_a0 >= phi_t5) {
sp4A = phi_a0;
sp4A = (s16) phi_a0;
} else {
goto block_12;
}
} else if (phi_t3 >= phi_t5) {
sp4A = phi_t3;
sp4A = (s16) phi_t3;
} else {
block_12:
sp4A = phi_t5;
sp4A = (s16) phi_t5;
}
if (phi_a1 >= phi_t4) {
if (phi_a1 >= phi_v1) {
sp48 = phi_a1;
sp48 = (s16) phi_a1;
} else {
goto block_19;
}
} else if (phi_t4 >= phi_v1) {
sp48 = phi_t4;
sp48 = (s16) phi_t4;
} else {
block_19:
sp48 = phi_v1;
sp48 = (s16) phi_v1;
}
if (phi_a2 >= phi_a3) {
if (phi_a2 >= phi_v0) {
sp42 = phi_a2;
sp42 = (s16) phi_a2;
} else {
goto block_26;
}
} else if (phi_a3 >= phi_v0) {
sp42 = phi_a3;
sp42 = (s16) phi_a3;
} else {
block_26:
sp42 = phi_v0;
sp42 = (s16) phi_v0;
}
if (phi_t3 >= phi_a0) {
if (phi_t5 >= phi_a0) {
sp44 = phi_a0;
sp44 = (s16) phi_a0;
} else {
goto block_33;
}
} else if (phi_t5 >= phi_t3) {
sp44 = phi_t3;
sp44 = (s16) phi_t3;
} else {
block_33:
sp44 = phi_t5;
sp44 = (s16) phi_t5;
}
if (phi_a3 >= phi_a2) {
if (phi_v0 >= phi_a2) {
phi_t2 = phi_a2;
phi_t2 = (s16) phi_a2;
} else {
phi_t2 = phi_v0;
phi_t2 = (s16) phi_v0;
}
} else if (phi_v0 >= phi_a3) {
phi_t2 = phi_a3;
phi_t2 = (s16) phi_a3;
} else {
phi_t2 = phi_v0;
phi_t2 = (s16) phi_v0;
}
if (phi_t4 >= phi_a1) {
if (phi_v1 >= phi_a1) {
phi_t1 = phi_a1;
phi_t1 = (s16) phi_a1;
} else {
phi_t1 = phi_v1;
phi_t1 = (s16) phi_v1;
}
} else if (phi_v1 >= phi_t4) {
phi_t1 = phi_t4;
phi_t1 = (s16) phi_t4;
} else {
phi_t1 = phi_v1;
phi_t1 = (s16) phi_v1;
}
spAA = phi_v1;
spB8 = phi_a2;
spB2 = phi_a3;
spAC = phi_v0;
spAA = (s16) phi_v1;
spB8 = (s16) phi_a2;
spB2 = (s16) phi_a3;
spAC = (s16) phi_v0;
temp_v0 = spB2 - spB8;
temp_v1 = spAA - phi_t4;
spB6 = phi_a1;
spBA = phi_a0;
spB6 = (s16) phi_a1;
spBA = (s16) phi_a0;
temp_a0_2 = phi_t4 - spB6;
temp_a1_2 = spAC - spB2;
temp_a2 = phi_t5 - phi_t3;
temp_a3 = phi_t3 - spBA;
temp_f12 = (temp_v0 * temp_v1) - (temp_a0_2 * temp_a1_2);
temp_f12 = (f64) ((temp_v0 * temp_v1) - (temp_a0_2 * temp_a1_2));
temp_f18 = temp_f12 * temp_f12;
sp10 = temp_f18;
temp_f14 = (temp_a0_2 * temp_a2) - (temp_a3 * temp_v1);
temp_f14 = (f64) ((temp_a0_2 * temp_a2) - (temp_a3 * temp_v1));
temp_f8 = temp_f14 * temp_f14;
sp8 = temp_f8;
temp_f16 = (temp_a3 * temp_a1_2) - (temp_v0 * temp_a2);
temp_f16 = (f64) ((temp_a3 * temp_a1_2) - (temp_v0 * temp_a2));
temp_f4 = temp_f16 * temp_f16;
sp0 = temp_f4;
temp_f2 = sqrtf(temp_f18 + temp_f8 + temp_f4);
if ((temp_f2 != 0.0) && ((temp_f0 = temp_f12 / temp_f2, sp58 = temp_f0, temp_f4_2 = temp_f14 / temp_f2, sp1C = (bitwise void *) temp_f4_2, sp54 = temp_f4_2, temp_f18_2 = temp_f16 / temp_f2, sp50 = temp_f18_2, sp4C = -((spBA * temp_f0) + (temp_f4_2 * spB8) + (temp_f18_2 * spB6)), (D_8015F59C == 0)) || (!(temp_f4_2 < D_802B9E64) && !(D_802B9E68 < temp_f4_2))) && ((D_8015F5A0 == 0) || !((bitwise f32) sp1C < D_802B9E6C) || !(D_802B9E70 < (bitwise f32) sp1C))) {
temp_t0->unkA = sp4A;
temp_t0->unk8 = phi_t1;
temp_t0->unk6 = phi_t2;
temp_t0->unk4 = sp44;
temp_t0->unkC = sp42;
temp_t0->unkE = sp48;
if (sp44 < D_8015F6EA) {
temp_f2 = (f64) sqrtf((f32) (temp_f18 + temp_f8 + temp_f4));
if ((temp_f2 != 0.0) && ((temp_f0 = (f32) ((f64) (f32) temp_f12 / temp_f2), sp58 = temp_f0, temp_f4_2 = (f32) ((f64) (f32) temp_f14 / temp_f2), sp1C = temp_f4_2, sp54 = temp_f4_2, temp_f18_2 = (f32) ((f64) (f32) temp_f16 / temp_f2), sp50 = temp_f18_2, sp4C = -(((f32) spBA * temp_f0) + (temp_f4_2 * (f32) spB8) + (temp_f18_2 * (f32) spB6)), (D_8015F59C == 0)) || (!(temp_f4_2 < D_802B9E64) && !(D_802B9E68 < temp_f4_2))) && ((D_8015F5A0 == 0) || !(sp1C < D_802B9E6C) || !(D_802B9E70 < sp1C))) {
temp_t0->vtx2[0] = sp4A;
temp_t0->vtx3[2] = phi_t1;
temp_t0->vtx3[1] = phi_t2;
temp_t0->vtx3[0] = sp44;
temp_t0->vtx2[1] = sp42;
temp_t0->vtx2[2] = sp48;
if ((s32) sp44 < (s32) D_8015F6EA) {
D_8015F6EA = sp44;
}
if (phi_t2 < D_8015F6EE) {
if ((s32) phi_t2 < (s32) D_8015F6EE) {
D_8015F6EE = phi_t2;
}
if (phi_t1 < D_8015F6F2) {
if ((s32) phi_t1 < (s32) D_8015F6F2) {
D_8015F6F2 = phi_t1;
}
if (D_8015F6E8 < sp4A) {
if ((s32) D_8015F6E8 < (s32) sp4A) {
D_8015F6E8 = sp4A;
}
if (D_8015F6EC < sp42) {
if ((s32) D_8015F6EC < (s32) sp42) {
D_8015F6EC = sp42;
}
if (D_8015F6F0 < sp48) {
if ((s32) D_8015F6F0 < (s32) sp48) {
D_8015F6F0 = sp48;
}
temp_t0->unk1C = sp58;
temp_t0->unk20 = sp54;
temp_t0->unk24 = sp50;
temp_t0->unk28 = sp4C;
temp_t0->unk2 = arg3;
temp_t0->height = sp58;
temp_t0->gravity = sp54;
temp_t0->rotation = sp50;
temp_t0->height2 = sp4C;
temp_t0->unk2 = (s16) arg3;
D_8015F6FA = 0;
D_8015F6FC = 0;
temp_a3_2 = temp_t0->unk10->unk6;
temp_v1_2 = temp_t0->unk14->unk6;
temp_a0_3 = temp_t0->unk18->unk6;
temp_a3_2 = (u16) temp_t0->vtxs[0]->tc[0];
temp_v1_2 = (u16) temp_t0->vtxs[1]->tc[0];
temp_a0_3 = (u16) temp_t0->vtxs[2]->tc[0];
phi_a1_2 = arg4;
if ((temp_a3_2 == 1) && (temp_v1_2 == 1) && (temp_a0_3 == 1)) {
phi_t8 = (arg4 | 0x400) & 0xFFFF;
@@ -3825,16 +3841,19 @@ block_33:
block_81:
phi_a1_2 = phi_t8;
}
temp_t0->unk0 = phi_a1_2;
if ((sp10 <= sp8) && (phi_t9 = phi_a1_2 | 0x4000, (sp0 <= sp8))) {
goto block_89;
temp_t0->flags = phi_a1_2;
if (sp10 <= sp8) {
phi_t9 = phi_a1_2 | 0x4000;
if (sp0 <= sp8) {
goto block_89;
}
}
if ((sp8 < sp10) && (sp0 <= sp10)) {
temp_t0->unk0 = temp_t0->unk0 | 0x8000;
temp_t0->flags |= 0x8000;
} else {
phi_t9 = temp_t0->unk0 | 0x2000;
phi_t9 = temp_t0->flags | 0x2000;
block_89:
temp_t0->unk0 = phi_t9;
temp_t0->flags = phi_t9;
}
D_8015F588 = D_8015F588 + 1;
}
@@ -4061,16 +4080,20 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AEE1C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802AEE1C(s16, s16, s16, s16, s32, s32, s32, s32); // extern
//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75
s32 func_802AEE1C(s16, s16, s16, s16, s32, s32, s32, s32); /* extern */
? func_802AF0FC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u16 arg4) {
s32 func_802AF0FC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u16 arg4) {
s16 sp32;
s16 sp30;
s16 sp2E;
s16 sp2C;
s16 sp2A;
s16 sp28;
mk64_surface_map_ram *temp_v0;
mk_Vtx_Flag *temp_t0;
mk_Vtx_Flag *temp_t1;
mk_Vtx_Flag *temp_v1;
s16 temp_a0;
s16 temp_a0_2;
s16 temp_a1;
@@ -4084,32 +4107,28 @@ s32 func_802AEE1C(s16, s16, s16, s16, s32, s32, s32, s32); // extern
s16 temp_t3;
s16 temp_t4;
s16 temp_t5;
void *temp_t0;
void *temp_t1;
void *temp_v0;
void *temp_v1;
temp_a0 = arg0;
temp_a2 = arg2;
temp_a1 = arg1;
temp_a3 = arg3;
temp_v0 = (arg4 * 0x2C) + D_8015F580;
temp_v1 = temp_v0->unk10;
temp_t0 = temp_v0->unk14;
temp_t1 = temp_v0->unk18;
temp_t2 = temp_v1->unk0;
temp_t3 = temp_v1->unk4;
temp_t4 = temp_t0->unk0;
temp_t5 = temp_t0->unk4;
temp_ra = temp_t1->unk0;
sp28 = temp_t1->unk4;
if ((temp_t2 >= temp_a0) && (temp_a1 >= temp_t2) && (temp_t3 >= temp_a2) && (temp_a3 >= temp_t3)) {
temp_v0 = &(*D_8015F580)[arg4];
temp_v1 = temp_v0->vtxs[0];
temp_t0 = temp_v0->vtxs[1];
temp_t1 = temp_v0->vtxs[2];
temp_t2 = temp_v1->ob[0];
temp_t3 = temp_v1->ob[2];
temp_t4 = temp_t0->ob[0];
temp_t5 = temp_t0->ob[2];
temp_ra = temp_t1->ob[0];
sp28 = temp_t1->ob[2];
if (((s32) temp_t2 >= (s32) temp_a0) && ((s32) temp_a1 >= (s32) temp_t2) && ((s32) temp_t3 >= (s32) temp_a2) && ((s32) temp_a3 >= (s32) temp_t3)) {
return 1;
}
if ((temp_t4 >= temp_a0) && (temp_a1 >= temp_t4) && (temp_t5 >= temp_a2) && (temp_a3 >= temp_t5)) {
if (((s32) temp_t4 >= (s32) temp_a0) && ((s32) temp_a1 >= (s32) temp_t4) && ((s32) temp_t5 >= (s32) temp_a2) && ((s32) temp_a3 >= (s32) temp_t5)) {
return 1;
}
if ((temp_ra >= temp_a0) && (temp_a1 >= temp_ra) && (sp28 >= temp_a2) && (temp_a3 >= sp28)) {
if (((s32) temp_ra >= (s32) temp_a0) && ((s32) temp_a1 >= (s32) temp_ra) && ((s32) sp28 >= (s32) temp_a2) && ((s32) temp_a3 >= (s32) sp28)) {
return 1;
}
sp2A = temp_ra;
@@ -4125,7 +4144,7 @@ s32 func_802AEE1C(s16, s16, s16, s16, s32, s32, s32, s32); // extern
temp_a1_2 = arg1;
temp_a2_2 = arg2;
temp_a3_2 = arg3;
if (func_802AEE1C(temp_a0, temp_a1, temp_a2, temp_a3, temp_t2, temp_t3, temp_t4, temp_t5) == 1) {
if (func_802AEE1C(temp_a0, temp_a1, temp_a2, temp_a3, (s32) temp_t2, (s32) temp_t3, (s32) temp_t4, (s32) temp_t5) == 1) {
return 1;
}
sp2A = temp_ra;
@@ -4135,10 +4154,10 @@ s32 func_802AEE1C(s16, s16, s16, s16, s32, s32, s32, s32); // extern
arg3 = temp_a3_2;
sp32 = temp_t2;
sp30 = temp_t3;
if (func_802AEE1C(temp_a0_2, temp_a1_2, temp_a2_2, temp_a3_2, temp_t4, temp_t5, temp_ra, sp28) == 1) {
if (func_802AEE1C(temp_a0_2, temp_a1_2, temp_a2_2, temp_a3_2, (s32) temp_t4, (s32) temp_t5, (s32) temp_ra, (s32) sp28) == 1) {
return 1;
}
if (func_802AEE1C(arg0, arg1, arg2, arg3, temp_ra, sp28, temp_t2, temp_t3) == 1) {
if (func_802AEE1C(arg0, arg1, arg2, arg3, (s32) temp_ra, (s32) sp28, (s32) temp_t2, (s32) temp_t3) == 1) {
return 1;
}
return 0;
@@ -4148,12 +4167,16 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AF0FC.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_802AF0FC(s16, s16, s16, s16, s32); // extern
//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75
s32 func_802AF0FC(s16, s16, s16, s16, s32); /* extern */
extern ? D_8014F110;
extern ? D_80150110;
extern s32 D_8015F584;
extern u16 D_8015F58A;
extern s16 D_8015F6E8;
extern s16 D_8015F6EA;
extern s16 D_8015F6F0;
extern s16 D_8015F6F2;
extern s32 gPrevLoadedAddress;
void func_802AF314(void) {
@@ -4190,10 +4213,10 @@ void func_802AF314(void) {
} while (temp_v0 != &D_80150110);
D_8015F58A = 0;
D_8015F584 = gPrevLoadedAddress;
temp_s6 = (D_8015F6E8 - D_8015F6EA) / 0x20;
temp_fp = (D_8015F6F0 - D_8015F6F2) / 0x20;
temp_s6 = (s32) (D_8015F6E8 - D_8015F6EA) / 32;
temp_fp = (s32) (D_8015F6F0 - D_8015F6F2) / 32;
phi_s7 = 0;
phi_v1 = D_8015F588;
phi_v1 = (s32) D_8015F588;
do {
sp4C = temp_fp * phi_s7;
phi_s5 = 0;
@@ -4208,19 +4231,19 @@ loop_4:
do {
temp_a3 = temp_s2 + temp_fp + 0x28;
temp_v0_2 = phi_s3 + D_8015F580;
if ((temp_v0_2->unkE >= temp_s2) && (temp_a3 >= temp_v0_2->unk8)) {
if (((s32) temp_v0_2->unkE >= (s32) temp_s2) && ((s32) temp_a3 >= (s32) temp_v0_2->unk8)) {
temp_a1 = temp_s1 + temp_s6 + 0x28;
if ((temp_v0_2->unkA >= temp_s1) && (temp_a1 >= temp_v0_2->unk4)) {
if (((s32) temp_v0_2->unkA >= (s32) temp_s1) && ((s32) temp_a1 >= (s32) temp_v0_2->unk4)) {
if (func_802AF0FC(temp_s1, temp_a1, temp_s2, temp_a3, phi_s0) == 1) {
temp_v0_3 = (((phi_s7 << 5) + phi_s5) * 4) + &D_8014F110;
if (temp_v0_3->unk2 == 0) {
temp_v0_3->unk0 = D_8015F58A;
temp_v0_3->unk0 = (u16) D_8015F58A;
}
temp_v0_3->unk2 = temp_v0_3->unk2 + 1;
*(D_8015F584 + (D_8015F58A * 2)) = phi_s0;
D_8015F58A = D_8015F58A + 1;
temp_v0_3->unk2 = (u16) (temp_v0_3->unk2 + 1);
*(D_8015F584 + (D_8015F58A * 2)) = (s16) phi_s0;
D_8015F58A += 1;
}
phi_v1_2 = D_8015F588;
phi_v1_2 = (s32) D_8015F588;
}
}
temp_s0 = phi_s0 + 1;
@@ -4445,7 +4468,6 @@ s32 func_802ACBA4(s16 *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */
s32 func_802AD278(s16 *, f32, f32, f32, f32, s32, f32, f32, f32); /* extern */
? func_802AF9F0(f32, ? *, ?32, kartBoundingBoxCorner *); /* extern */
extern ? D_8014F110;
extern s32 D_8015F580;
extern s32 D_8015F584;
extern s16 D_8015F6E8;
extern s16 D_8015F6EA;
@@ -4483,17 +4505,16 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3
f32 temp_f2_4;
f32 temp_f2_5;
f32 temp_f2_6;
mk64_surface_map_ram *temp_v0_4;
s16 temp_v0_2;
s16 temp_v1;
s32 temp_f10;
s32 temp_f16;
s32 temp_s4;
s32 temp_t6;
u16 temp_s0;
u16 temp_v0_3;
u16 temp_v1_3;
u8 temp_v0;
void *temp_v0_4;
void *temp_v1_2;
u16 phi_s1;
s16 *phi_s7;
@@ -4510,7 +4531,7 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3
spF8 = 0;
spFA = 0;
spFC = 0;
temp_v0 = corner->unk_0D;
temp_v0 = corner->surfaceFlags;
temp_f22 = corner->cornerX;
temp_f24 = corner->cornerY;
temp_f26 = corner->cornerZ;
@@ -4523,8 +4544,8 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3
if (temp_v0 != 0x80) {
goto block_21;
}
if (func_802AD278(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->tileIndex, cornerX, cornerY, cornerZ) == 1) {
temp_f0 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->tileIndex);
if (func_802AD278(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerX, cornerY, cornerZ) == 1) {
temp_f0 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex);
temp_f2 = player->posY;
if (!(temp_f2 < temp_f0) && !((2.0f * temp_f20) < (temp_f2 - temp_f0))) {
corner->cornerGroundY = temp_f0;
@@ -4535,8 +4556,8 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3
phi_f30 = 2.0f;
goto block_22;
}
if (func_802AC760(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->tileIndex, cornerX, cornerY, cornerZ) == 1) {
temp_f0_2 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->tileIndex);
if (func_802AC760(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerX, cornerY, cornerZ) == 1) {
temp_f0_2 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex);
temp_f2_2 = player->posY;
if (!(temp_f2_2 < temp_f0_2) && !((2.0f * temp_f20) < (temp_f2_2 - temp_f0_2))) {
corner->cornerGroundY = temp_f0_2;
@@ -4547,8 +4568,8 @@ s32 func_802AFA34(Player *player, kartBoundingBoxCorner *corner, f32 cornerX, f3
phi_f30 = 2.0f;
goto block_22;
}
if (func_802ACBA4(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->tileIndex, cornerX, cornerY, cornerZ) == 1) {
temp_f0_3 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->tileIndex);
if (func_802ACBA4(&spF8, temp_f20, temp_f22, temp_f24, temp_f26, (s32) corner->surfaceMapIndex, cornerX, cornerY, cornerZ) == 1) {
temp_f0_3 = func_802ABE30(temp_f22, temp_f24, temp_f26, corner->surfaceMapIndex);
temp_f2_3 = player->posY;
if (!(temp_f2_3 < temp_f0_3) && !((2.0f * temp_f20) < (temp_f2_3 - temp_f0_3))) {
corner->cornerGroundY = temp_f0_3;
@@ -4590,21 +4611,20 @@ block_22:
if (sp8C > 0) {
loop_34:
temp_s0 = *(D_8015F584 + (phi_s1 * 2));
temp_s4 = temp_s0 * 0x2C;
temp_v0_4 = D_8015F580 + temp_s4;
temp_v1_3 = temp_v0_4->unk0;
temp_v0_4 = &(*D_8015F580)[temp_s0];
temp_v1_3 = temp_v0_4->flags;
if ((temp_v1_3 & 0x4000) != 0) {
if ((corner->tileIndex != temp_s0) && (func_802AC760(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) {
if ((corner->surfaceMapIndex != temp_s0) && (func_802AC760(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) {
temp_f0_4 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF);
temp_f2_4 = player->posY;
if (!(temp_f2_4 < temp_f0_4) && !((phi_f30 * temp_f20) < (temp_f2_4 - temp_f0_4))) {
spD4 = temp_f0_4;
func_802AF9F0(temp_f0_4, &sp128, sp10C, corner);
corner->cornerGroundY = spD4;
corner->unk_0D = 0x40;
corner->tileIndex = temp_s0;
corner->surfaceType = (u8) (D_8015F580 + temp_s4)->unk2;
if ((*(D_8015F580 + temp_s4) & 0x1000) != 0) {
corner->surfaceFlags = 0x40;
corner->surfaceMapIndex = temp_s0;
corner->surfaceType = (u8) (*D_8015F580)[temp_s0].surfaceType;
if (((*D_8015F580)[temp_s0].flags & 0x1000) != 0) {
corner->unk_14 = 1;
return 1;
}
@@ -4615,30 +4635,30 @@ loop_34:
goto block_55;
}
if ((temp_v1_3 & 0x8000) != 0) {
if ((temp_v0_4->unk20 != 0.0f) && (corner->tileIndex != temp_s0) && (func_802AD278(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) {
if ((temp_v0_4->gravity != 0.0f) && (corner->surfaceMapIndex != temp_s0) && (func_802AD278(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) {
temp_f0_5 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF);
temp_f2_5 = player->posY;
if (!(temp_f2_5 < temp_f0_5) && !((phi_f30 * temp_f20) < (temp_f2_5 - temp_f0_5))) {
corner->cornerGroundY = temp_f0_5;
func_802AF9F0(temp_f0_5, &sp11C, sp108, corner);
corner->cornerGroundY = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF);
corner->unk_0D = 0x80;
corner->tileIndex = temp_s0;
corner->surfaceType = (u8) (D_8015F580 + temp_s4)->unk2;
corner->surfaceFlags = 0x80;
corner->surfaceMapIndex = temp_s0;
corner->surfaceType = (u8) (*D_8015F580)[temp_s0].surfaceType;
return 1;
}
}
goto block_55;
}
if ((temp_v0_4->unk20 != 0.0f) && (corner->tileIndex != temp_s0) && (func_802ACBA4(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) {
if ((temp_v0_4->gravity != 0.0f) && (corner->surfaceMapIndex != temp_s0) && (func_802ACBA4(phi_s7, temp_f20, temp_f22, temp_f24, temp_f26, (s32) temp_s0, cornerX, cornerY, cornerZ) == 1)) {
temp_f0_6 = func_802ABE30(temp_f22, temp_f24, temp_f26, temp_s0 & 0xFFFF);
temp_f2_6 = player->posY;
if (!(temp_f2_6 < temp_f0_6) && !((phi_f30 * temp_f20) < (temp_f2_6 - temp_f0_6))) {
corner->cornerGroundY = temp_f0_6;
func_802AF9F0(temp_f0_6, &sp110, sp104, corner);
corner->unk_0D = 0x20;
corner->tileIndex = temp_s0;
corner->surfaceType = (u8) (D_8015F580 + temp_s4)->unk2;
corner->surfaceFlags = 0x20;
corner->surfaceMapIndex = temp_s0;
corner->surfaceType = (u8) (*D_8015F580)[temp_s0].surfaceType;
return 1;
}
}