Matches in 80281fa0, render_courses, and create defines for sound cues. (#276)

* Matches, add permute, and add notice to quick runners

* 80281fa0 matches, render_courses, and create defines for audio

* Renamed 80281fa0.h, func naming, and deleted data_121DA0

* Added clang format

* Matched load_surface_map

* Match func in memory.c
This commit is contained in:
MegaMech
2022-11-21 04:06:12 -07:00
committed by GitHub
parent d7c9a14908
commit 0c10beae0e
39 changed files with 2693 additions and 3480 deletions
+111 -129
View File
@@ -9,6 +9,21 @@
#include "code_80281780.h"
#include "render_courses.h"
f32 gFloatArray802B8790[] = {
1.2, 1.0, 0.9, 0.7, 2.0, 1.8, 0.9, 2.3
};
s16 D_802B87B0 = 995;
s16 D_802B87B4 = 1000;
UNUSED s32 D_802B87B8 = 0;
s32 D_802B87BC = 0;
UNUSED s32 D_802B87C0 = 0;
s32 D_802B87C4 = 0;
s32 D_802B87C8 = 0;
s32 D_802B87CC = 0;
s16 D_802B87D0 = 0;
s16 D_802B87D4 = 0;
s16 D_802B87D8 = 0;
s32 func_80290C20(Camera *camera) {
if (camera->unk_54.unk34 == 0) {
return 1;
@@ -48,137 +63,119 @@ void func_80290CAC(uintptr_t arg0) {
}
}
#ifdef MIPS_TO_C
//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de
extern u16 D_80152300;
s16 gCurrentCourseId; /* unable to generate initializer */
extern u16 D_80152300[];
s16 func_802ABD40(u16);
void load_surface_map(u32 arg0, struct UnkStruct_800DC5EC *arg1) {
Player *sp34;
Camera *sp30;
void *sp24;
s16 sp22;
s16 sp1E;
Camera *temp_a2;
Gfx *temp_v1_3;
Player *temp_t1;
s16 temp_v0_3;
s16 temp_v0_4;
s16 temp_v1;
s16 temp_v1_2;
s16 var_a0;
void load_surface_map(s32 arg0, struct UnkStruct_800DC5EC *arg1) {
Player *temp_t1 = arg1->player;
Camera *temp_a2 = arg1->camera;
u32 segment = SEGMENT_NUMBER2(arg0);
u32 offset = SEGMENT_OFFSET(arg0);
s32 *addr = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
s16 var_a3;
s16 temp_v1;
s16 sp1E;
s16 temp_v0_3;
u16 temp_v0;
u16 temp_v0_2;
temp_t1 = arg1->player;
temp_a2 = arg1->camera;
sp24 = gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF) + 0x80000000;
if (gIsMirrorMode != 0) {
if (gIsMirrorMode) {
temp_v0 = (u16) temp_a2->rot[1];
if ((s32) temp_v0 < 0x2000) {
if (temp_v0 < 0x2000) {
var_a3 = 2;
} else if ((s32) temp_v0 < 0x6000) {
} else if (temp_v0 < 0x6000) {
var_a3 = 3;
} else if ((s32) temp_v0 < 0xA000) {
} else if (temp_v0 < 0xA000) {
var_a3 = 0;
} else if ((s32) temp_v0 < 0xE000) {
} else if (temp_v0 < 0xE000) {
var_a3 = 1;
} else {
var_a3 = 2;
}
} else {
temp_v0_2 = (u16) temp_a2->rot[1];
if ((s32) temp_v0_2 < 0x2000) {
temp_v0 = (u16) temp_a2->rot[1];
if (temp_v0 < 0x2000) {
var_a3 = 2;
} else if ((s32) temp_v0_2 < 0x6000) {
} else if (temp_v0 < 0x6000) {
var_a3 = 1;
} else if ((s32) temp_v0_2 < 0xA000) {
}
else if (temp_v0 < 0xA000) {
var_a3 = 0;
} else {
}
else if (temp_v0 < 0xE000) {
var_a3 = 3;
}
else {
var_a3 = 2;
if ((s32) temp_v0_2 < 0xE000) {
var_a3 = 3;
}
}
}
arg1->playerDirection = var_a3;
if (*(&D_80152300 + (((s32) (temp_a2 - camera1) / 184) * 2)) == 1) {
sp34 = temp_t1;
sp22 = var_a3;
sp30 = temp_a2;
if (D_80152300[temp_a2 - camera1] == 1) {
sp1E = func_802ABD40(temp_a2->unk_54.unk3A);
temp_v0_3 = func_802ABD40(temp_t1->unk_110.unk3A);
temp_v1 = sp1E - temp_v0_3;
if ((temp_v1 < 2) && (temp_v1 >= -1)) {
if (sp1E == 0x00FF) {
if (temp_v0_3 == 0x00FF) {
goto block_60;
if (sp1E == 255) {
if (temp_v0_3 == 255) {
temp_v1 = arg1->pathCounter;
} else if (temp_t1->unk_110.unk3C[2] > 30.0f) {
temp_v1 = arg1->pathCounter;
} else {
temp_v1 = temp_v0_3;
}
if (temp_t1->unk_110.unk44 > 30.0f) {
goto block_60;
}
var_a0 = temp_v0_3;
} else {
if (temp_a2->unk_54.unk44 > 30.0f) {
goto block_60;
}
var_a0 = sp1E;
} else if (temp_a2->unk_54.unk3C[2] > 30.0f) {
temp_v1 = arg1->pathCounter;
} else {
temp_v1 = sp1E;
}
} else {
temp_v1_2 = gCurrentCourseId;
if (temp_v1_2 != 1) {
if (temp_v1_2 == 2) {
if ((temp_v0_3 >= 0x11) && (temp_v0_3 < 0x18)) {
var_a0 = temp_v0_3;
} else if ((temp_v0_3 == 0x00FF) && (sp1E != 0x00FF)) {
var_a0 = sp1E;
} else if ((temp_v0_3 != 0x00FF) && (sp1E == 0x00FF)) {
var_a0 = temp_v0_3;
switch(gCurrentCourseId) {
case 2:
if ((temp_v0_3 >= 0x11) && (temp_v0_3 < 0x18)) {
temp_v1 = temp_v0_3;
} else if ((temp_v0_3 == 255) && (sp1E != 255)) {
temp_v1 = sp1E;
} else if ((temp_v0_3 != 255) && (sp1E == 255)) {
temp_v1 = temp_v0_3;
} else {
temp_v1 = arg1->pathCounter;
}
break;
case 1:
if ((temp_v0_3 >= 0xE) && (temp_v0_3 < 0x16)) {
temp_v1 = temp_v0_3;
} else if ((temp_v0_3 == 255) && (sp1E != 255)) {
temp_v1 = sp1E;
} else if ((temp_v0_3 != 255) && (sp1E == 255)) {
temp_v1 = temp_v0_3;
} else {
goto block_60;
temp_v1 = arg1->pathCounter;
}
} else {
if (temp_v0_3 == 0x00FF) {
goto block_60;
break;
default:
if (temp_v0_3 == 255) {
temp_v1 = arg1->pathCounter;
} else if (temp_t1->unk_110.unk3C[2] > 30.0f) {
temp_v1 = arg1->pathCounter;
} else {
temp_v1 = temp_v0_3;
}
if (temp_t1->unk_110.unk44 > 30.0f) {
goto block_60;
}
var_a0 = temp_v0_3;
}
} else if ((temp_v0_3 >= 0xE) && (temp_v0_3 < 0x16)) {
var_a0 = temp_v0_3;
} else if ((temp_v0_3 == 0x00FF) && (sp1E != 0x00FF)) {
var_a0 = sp1E;
} else if ((temp_v0_3 != 0x00FF) && (sp1E == 0x00FF)) {
var_a0 = temp_v0_3;
} else {
goto block_60;
break;
}
}
} else {
sp22 = var_a3;
sp30 = temp_a2;
temp_v0_4 = func_802ABD40(temp_a2->unk_54.unk3A);
var_a0 = temp_v0_4;
if (temp_a2->unk_54.unk44 > 30.0f) {
goto block_60;
}
if (temp_v0_4 == 0x00FF) {
block_60:
var_a0 = arg1->pathCounter;
temp_v1 = func_802ABD40(temp_a2->unk_54.unk3A);
if (temp_a2->unk_54.unk3C[2] > 30.0f) {
temp_v1 = arg1->pathCounter;
} else if (temp_v1 == 255) {
temp_v1 = arg1->pathCounter;
}
}
arg1->pathCounter = var_a0;
temp_v1_3 = gDisplayListHead;
gDisplayListHead = temp_v1_3 + 8;
temp_v1_3->words.w0 = 0x06000000;
temp_v1_3->words.w1 = *(sp24 + ((s16) (((var_a0 * 4) + var_a3) - 4) * 4));
arg1->pathCounter = temp_v1;
temp_v1 = ((temp_v1 - 1) * 4) + var_a3;
gSPDisplayList(gDisplayListHead++, addr[temp_v1]);
}
#else
GLOBAL_ASM("asm/non_matchings/render_courses/load_surface_map.s")
#endif
void func_80291198(void) {
gSPDisplayList(gDisplayListHead++, 0x07001140);
@@ -1329,21 +1326,9 @@ void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) {
}
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//extern void func_802B5D64(u32, u16, s32, s32); // extern
extern Gfx D_06013FF8[];
extern Gfx D_06014060[];
extern Lights1 D_800DC610[];
extern s16 D_802B87B0;
extern s16 D_802B87B4;
extern s16 D_802B87D4;
extern Gfx moo_moo_farm_dls[];
extern Gfx D_06013FF8[];
extern Gfx D_06014060[];
// Missing {} around if statements necessary for matching.
void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) {
s32 pad[12];
s32 pad[13];
s16 temp_s0 = arg0->pathCounter;
s16 temp_s1 = arg0->playerDirection;
@@ -1360,54 +1345,51 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) {
load_surface_map(&moo_moo_farm_dls, arg0);
if ((temp_s0 < 14) && (temp_s0 > 10)) {
if ((temp_s1 == 2) || (temp_s1 == 3) || (temp_s1 == 1)) {
if ((temp_s1 == 2) || (temp_s1 == 3) || (temp_s1 == 1))
gSPDisplayList(gDisplayListHead++, D_06013FF8);
}
} else if (temp_s0 < 16) {
gSPDisplayList(gDisplayListHead++, D_06013FF8);
} else if (temp_s0 < 19) {
if (temp_s1 != 2) {
if (temp_s1 != 2)
gSPDisplayList(gDisplayListHead++, D_06013FF8);
}
} else if (temp_s0 < 20) {
if (temp_s1 == 0) {
if (temp_s1 == 0)
gSPDisplayList(gDisplayListHead++, D_06013FF8);
}
}
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
if ((temp_s0 >= 16) && (temp_s0 < 24)) {
if ((temp_s1 == 2) || (temp_s1 == 3)) {
if ((temp_s1 == 2) || (temp_s1 == 3))
gSPDisplayList(gDisplayListHead++, 0x07005410);
}
} else if (temp_s0 < 9) {
if (temp_s1 == 2) {
if (temp_s1 == 2)
gSPDisplayList(gDisplayListHead++, 0x07005410);
}
}
if (temp_s0 < 4) {
if (temp_s1 != 0) {
if (temp_s1 != 0)
gSPDisplayList(gDisplayListHead++, D_06014060);
}
} else if (temp_s0 < 8) {
if (temp_s1 == 2) {
if (temp_s1 == 2)
gSPDisplayList(gDisplayListHead++, D_06014060);
}
} else if (temp_s0 >= 22) {
gSPDisplayList(gDisplayListHead++, D_06014060);
} else if (temp_s0 >= 18) {
if ((temp_s1 == 0) || (temp_s1 == 3)) {
if ((temp_s1 == 0) || (temp_s1 == 3))
gSPDisplayList(gDisplayListHead++, D_06014060);
}
}
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
gSPDisplayList(gDisplayListHead++, 0x070010C0);
}
#else
GLOBAL_ASM("asm/non_matchings/render_courses/render_moo_moo_farm.s")
#endif
void render_toads_turnpike(struct UnkStruct_800DC5EC *arg0) {
s32 pad[13];