Assorted matches (#346)

Signed-off-by: Taggerung <tyler.taggerung@email.com>
This commit is contained in:
Tyler McGavran
2023-07-17 20:06:10 -04:00
committed by GitHub
parent 4bb7fa372c
commit ce15ceac10
11 changed files with 307 additions and 1312 deletions
+91 -208
View File
@@ -30,112 +30,78 @@ void func_802AAAAC(UnkActorInner *arg0) {
vec3f_set(arg0->unk60, 0.0f, 1.0f, 0.0f);
}
#ifdef MIPS_TO_C
//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b
extern f32 D_8015F8E4;
static f32 D_802B9E00 = 1859.0f;
static f32 D_802B9E04 = 1549.0f;
static f32 D_802B9E08 = -1102.0f;
static f32 D_802B9E0C = -1402.0f;
static f32 D_802B9E10 = 2405.0f;
static f32 D_802B9E14 = 2233.0f;
static f32 D_802B9E18 = 0.8f;
static f32 D_802B9E1C = -475.0f;
static f32 D_802B9E20 = -33.9f;
static f32 D_802B9E24 = -838.0f;
static f32 D_802B9E28 = -475.0f;
static f32 D_802B9E2C = -475.0f;
static f32 D_802B9E30 = -993.0f;
static f32 D_802B9E34 = -33.9f;
static f32 D_802B9E38 = -475.0f;
static f32 D_802B9E3C = -33.9f;
static f32 D_802B9E40 = -475.0f;
static f32 D_802B9E44 = -33.9f;
s16 gCurrentCourseId; /* unable to generate initializer */
f32 func_802AAB4C(Player *player) {
f32 sp1C;
f32 sp18;
f32 temp_f0;
f32 temp_f2;
s16 temp_v0;
f32 playerX;
f32 playerZ;
s32 temp_v1;
temp_v0 = gCurrentCourseId;
temp_f0 = player->pos[0];
temp_f2 = player->pos[2];
switch (temp_v0) { /* irregular */
case 2:
if (D_802B9E00 < temp_f0) {
goto block_43;
playerX = player->pos[0];
playerZ = player->pos[2];
switch (gCurrentCourseId) { /* irregular */
case COURSE_BOWSER_CASTLE:
if (playerX > 1859.0f) {
return D_8015F8E4;
}
if (temp_f0 < D_802B9E04) {
goto block_43;
if (playerX < 1549.0f) {
return D_8015F8E4;
}
if (D_802B9E08 < temp_f2) {
goto block_43;
if (playerZ > -1102.0f) {
return D_8015F8E4;
}
if (temp_f2 < D_802B9E0C) {
block_43:
default:
if (playerZ < -1402.0f) {
return D_8015F8E4;
}
return 20.0f;
case 6:
if (temp_f0 > 239.0f) {
goto block_43;
case COURSE_KOOPA_BEACH:
if (playerX > 239.0f) {
return D_8015F8E4;
}
if (temp_f0 < 67.0f) {
goto block_43;
if (playerX < 67.0f) {
return D_8015F8E4;
}
if (D_802B9E10 < temp_f2) {
goto block_43;
if (playerZ > 2405.0f) {
return D_8015F8E4;
}
if (temp_f2 < D_802B9E14) {
goto block_43;
if (playerZ < 2233.0f) {
return D_8015F8E4;
}
return D_802B9E18;
case 12:
return 0.8f;
case COURSE_SHERBET_LAND:
if ((func_802ABD10(player->unk_110.unk3A) & 0xFF) == 5) {
return (f32) (D_8015F6EE - 0xA);
}
goto block_43;
case 18:
sp18 = temp_f2;
sp1C = temp_f0;
return D_8015F8E4;
case COURSE_DK_JUNGLE:
temp_v1 = func_802ABD40(player->unk_110.unk3A) & 0xFF;
if (temp_v1 == 0xFF) {
sp18 = temp_f2;
sp1C = temp_f0;
if ((func_802ABD10(player->unk_110.unk3A) & 0xFF) == 0xF) {
return D_802B9E1C;
return -475.0f;
}
if (temp_f0 > -478.0f) {
return D_802B9E20;
if (playerX > -478.0f) {
return -33.9f;
}
if (temp_f0 < D_802B9E24) {
return D_802B9E28;
if (playerX < -838.0f) {
return -475.0f;
}
if (temp_f2 > -436.0f) {
return D_802B9E2C;
if (playerZ > -436.0f) {
return -475.0f;
}
if (temp_f2 < D_802B9E30) {
return D_802B9E34;
if (playerZ < -993.0f) {
return -33.9f;
}
if (temp_f2 < temp_f0) {
return D_802B9E38;
if (playerZ < playerX) {
return -475.0f;
}
return D_802B9E3C;
return -33.9f;
}
if (temp_v1 >= 0x14) {
return D_802B9E40;
return -475.0f;
}
return D_802B9E44;
return -33.9f;
default:
return D_8015F8E4;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_802AAA70/func_802AAB4C.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c
@@ -2163,79 +2129,17 @@ void func_802AECA0(s32 arg0, s8 arg1, u16 arg2) {
GLOBAL_ASM("asm/non_matchings/code_802AAA70/func_802AECA0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern ? D_8015F668;
extern uintptr_t gSegmentTable;
void func_802AED6C(u32 arg0, s32 arg1, s32 arg2) {
s32 temp_a2;
s32 temp_t0;
s32 temp_v0;
s32 temp_v0_2;
s32 temp_v0_3;
s32 temp_v0_4;
s32 temp_v0_5;
s32 temp_v1;
s32 temp_v1_2;
s32 phi_v0;
s32 *phi_a0;
s32 phi_v1;
s32 phi_v0_2;
void *phi_a0_2;
s32 phi_v1_2;
s32 phi_a2;
s32 phi_a2_2;
temp_v0 = *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000;
phi_v0 = temp_v0;
phi_v1 = 0;
phi_v0_2 = temp_v0;
phi_a2 = arg2;
phi_v1_2 = 0;
phi_a2_2 = arg2;
if (arg1 != 0) {
temp_t0 = arg1 & 3;
if (temp_t0 != 0) {
phi_a0 = (arg2 * 4) + &D_8015F668;
do {
*phi_a0 = phi_v0;
temp_v1 = phi_v1 + 1;
temp_v0_2 = phi_v0 + 0x10;
temp_a2 = phi_a2_2 + 1;
phi_v0 = temp_v0_2;
phi_a0 += 4;
phi_v1 = temp_v1;
phi_v0_2 = temp_v0_2;
phi_a2 = temp_a2;
phi_v1_2 = temp_v1;
phi_a2_2 = temp_a2;
} while (temp_t0 != temp_v1);
if (temp_v1 != arg1) {
goto block_5;
}
} else {
block_5:
phi_a0_2 = (phi_a2 * 4) + &D_8015F668;
do {
phi_a0_2->unk0 = phi_v0_2;
temp_v0_3 = phi_v0_2 + 0x10;
phi_a0_2->unk4 = temp_v0_3;
temp_v0_4 = temp_v0_3 + 0x10;
phi_a0_2->unk8 = temp_v0_4;
temp_v0_5 = temp_v0_4 + 0x10;
phi_a0_2->unkC = temp_v0_5;
temp_v1_2 = phi_v1_2 + 4;
phi_v0_2 = temp_v0_5 + 0x10;
phi_a0_2 += 0x10;
phi_v1_2 = temp_v1_2;
} while (temp_v1_2 != arg1);
}
void func_802AED6C(Vtx *arg0, s32 arg1, s32 arg2) {
Vtx *var_v0;
s32 var_v1;
s32 segment = SEGMENT_NUMBER2(arg0);
s32 offset = SEGMENT_OFFSET(arg0);
var_v0 = (Vtx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
for (var_v1 = 0; var_v1 != arg1; var_v1++)
{
D_8015F668[arg2++] = var_v0++;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_802AAA70/func_802AED6C.s")
#endif
s32 func_802AEE1C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7) {
f32 temp_f0;
@@ -2515,71 +2419,50 @@ void func_802AF7B4(uintptr_t addr, s32 uls, s32 ult) {
}
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern uintptr_t gSegmentTable;
void func_802AF83C(Vtx *arg0, u32 vertexCount, s32 arg2, s8 arg3, u8 arg4, u8 arg5, u8 arg6) {
s32 segment = SEGMENT_NUMBER2(arg0);
s32 offset = SEGMENT_OFFSET(arg0);
Vtx *phi_v0 = (Vtx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
u32 var_v1 = 0;
void func_802AF83C(u32 arg0, u32 arg1, ? arg2, s8 arg3, u8 arg4, u8 arg5, u8 arg6) {
u32 temp_v1;
void *phi_v0;
u32 phi_v1;
phi_v0 = *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000;
phi_v1 = 0;
if (arg1 != 0) {
do {
temp_v1 = phi_v1 + 1;
phi_v1 = temp_v1;
if (arg4 != 0) {
phi_v0->unkC = arg4;
phi_v0->unkD = arg5;
phi_v0->unkE = arg6;
}
phi_v0->unkF = arg3;
phi_v0 += 0x10;
} while (temp_v1 < arg1);
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_802AAA70/func_802AF83C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void func_802AF83C(u32, s32, u32, s8, s32, s32, s32); // extern
extern uintptr_t gSegmentTable;
void func_802AF8BC(u32 arg0, s8 arg1, s32 arg2, s32 arg3, u8 arg4) {
s32 temp_s2;
s32 temp_s3;
s32 temp_v1;
u32 temp_a0;
u32 temp_v0;
void *phi_s0;
temp_s2 = arg2 & 0xFF;
temp_s3 = arg3 & 0xFF;
phi_s0 = *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000;
loop_1:
temp_v0 = phi_s0->unk0;
temp_a0 = phi_s0->unk4;
temp_v1 = temp_v0 & 0xFF000000;
if (temp_v1 != 0xB8000000) {
if (temp_v1 == 0x6000000) {
func_802AF8BC(temp_a0, arg1, temp_s2 & 0xFF, temp_s3 & 0xFF, arg4);
phi_s0 += 8;
} else {
if (temp_v1 == 0x4000000) {
func_802AF83C(temp_a0, (temp_v0 >> 0xA) & 0x3F, ((temp_v0 >> 0x10) & 0xFF) >> 1, arg1, temp_s2, temp_s3, arg4);
}
phi_s0 += 8;
// For some, unholy reason this can't be a for loop
// I just want to turn this into
// for (var_v1 = 0; var_v1 < vertexCount; var_v1++)
// phi_v0[var_v1].n.n[0] ...
if(1){}
while (var_v1 < vertexCount) {
if (arg4) {
phi_v0->n.n[0] = arg4;
phi_v0->n.n[1] = arg5;
phi_v0->n.n[2] = arg6;
}
goto loop_1;
phi_v0->n.a = arg3;
var_v1++;
phi_v0++;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_802AAA70/func_802AF8BC.s")
#endif
void func_802AF8BC(Gfx *displayList, s8 arg1, u8 arg2, u8 arg3, u8 arg4) {
uintptr_t upperWord;
uintptr_t lowerWord;
s32 command;
s32 segment = SEGMENT_NUMBER2(displayList);
s32 offset = SEGMENT_OFFSET(displayList);
Gfx *phi_v0 = (Gfx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
do {
upperWord = phi_v0->words.w0;
lowerWord = phi_v0->words.w1;
command = upperWord & 0xFF000000;
if (command == (G_ENDDL << 24)) break;
if (command == (G_DL << 24)) {
func_802AF8BC(lowerWord, arg1, arg2, arg3, arg4);
} else if (command == (G_VTX << 24)) {
func_802AF83C(lowerWord, (upperWord >> 0xA) & 0x3F, ((upperWord >> 0x10) & 0xFF) >> 1, arg1, arg2, arg3, arg4);
}
phi_v0++;
} while(1);
}
void func_802AF9F0(Vec3f arg0, f32 arg1, Vec3f arg2) {
arg2[0] -= arg0[0] * arg1;