Document game state related logic (#244)

* Document game state logic

* More namings
This commit is contained in:
MegaMech
2022-07-15 01:44:33 -06:00
committed by GitHub
parent 7508cd2761
commit 7042a3eab5
63 changed files with 500 additions and 447 deletions
+55 -57
View File
@@ -400,7 +400,7 @@ void func_80297340(Camera *arg0) {
Mat4 sp38;
s16 temp = D_8015F8D0[2];
if (D_800DC50C == CREDITS_SEQUENCE) { return; }
if (gGamestate == CREDITS_SEQUENCE) { return; }
mtxf_translate(sp38, D_8015F8D0);
@@ -715,8 +715,8 @@ void update_obj_train_engine(struct TrainCar *arg0) {
}
// wheels
void update_obj_train_car1(struct TrainCar *arg0) {
arg0->wheelRot -= 0x4FA;
void update_obj_train_car1(struct TrainCar *tender) {
tender->wheelRot -= 0x4FA;
}
// wheels
@@ -1128,7 +1128,7 @@ void func_80298D7C(Camera *camera, f32 (*arg1)[4], struct Actor *arg2) {
sp88.unk0 = (s32) D_802B87E0.unk0;
sp88.unk4 = (u16) D_802B87E0.unk4;
phi_s1 = temp_s1;
if (D_800DC50C == 9) {
if (gGamestate == 9) {
phi_f22 = D_802B9650;
} else {
phi_f22 = D_802B9654;
@@ -1614,18 +1614,18 @@ void update_obj_wario_stadium_sign(struct Actor *arg0) {
/**
* If train close activate bell sound according to timing
**/
void update_obj_railroad_crossing(struct RailroadCrossing *arg0) {
void update_obj_railroad_crossing(struct RailroadCrossing *crossing) {
// If train close?
if (D_801637B8[arg0->crossingId] != 0) {
if (D_801637B8[crossing->crossingId] != 0) {
// Timer++
arg0->someTimer++;
crossing->someTimer++;
// Reset timer
if (arg0->someTimer > 40) {
arg0->someTimer = 1;
if (crossing->someTimer > 40) {
crossing->someTimer = 1;
}
// Play Bell sound when timer hits 20 or 1.
if ((arg0->someTimer == 1) || (arg0->someTimer == 20)) {
func_800C98B8(arg0->pos, arg0->velocity, 0x19017016);
if ((crossing->someTimer == 1) || (crossing->someTimer == 20)) {
func_800C98B8(crossing->pos, crossing->velocity, 0x19017016);
}
}
}
@@ -2491,7 +2491,7 @@ void place_segment_06(u32 arg0) {
break;
}
temp_s0 = &gActorList[func_8029EC88(&sp8C, &sp78, &sp80, var_s2)];
if (D_800DC50C == 9) {
if (gGamestate == 9) {
func_802976D8(temp_s0->rot);
} else {
temp_s1 = &temp_s0->unk30;
@@ -2825,8 +2825,6 @@ static ? gTextureShrub; /* unable to generate initia
s16 gCurrentCourseId; /* unable to generate initializer */
void func_8029E158(void) {
u16 temp_t6;
set_segment_base_addr(3, gPrevLoadedAddress);
D_802BA050 = func_802A84F4((s32) &D_0F04CBE0, 0x00000257U, 0x00000400U);
func_802A84F4((s32) &D_0F04CE30, 0x00000242U, 0x00000400U);
@@ -2854,8 +2852,8 @@ void func_8029E158(void) {
func_802A84F4((s32) &D_0F0561AC, 0x0000025BU, 0x00000800U);
func_802A84F4((s32) &gTexture671A88, 0x00000400U, 0x00000800U);
func_802A84F4((s32) &gTexture6774D8, 0x00000400U, 0x00000800U);
temp_t6 = (u16) gCurrentCourseId;
switch (temp_t6) {
switch (gCurrentCourseId) {
case 0:
func_802A84F4((s32) &D_0F04F45C, 0x0000035BU, 0x00000800U);
D_802BA058 = func_802A84F4((s32) &D_0F056408, 0x000003E8U, 0x00000800U);
@@ -4100,7 +4098,7 @@ block_89:
GLOBAL_ASM("asm/non_matchings/actors/func_802A0450.s")
#endif
void func_802A0D54(void) {
void evaluate_player_collision(void) {
struct Actor *temp_a1;
s32 i, j;
Player *phi_s1;
@@ -4973,7 +4971,7 @@ void func_802A27A0(Camera *arg0, Mat4 arg1, struct YoshiValleyEgg *egg, u16 arg3
Vec3f sp54;
f32 temp_f0;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
temp_f0 = func_802B80D0(arg0->pos, egg->pos, arg0->rot[1], 200.0f, D_80150130[arg0 - camera1], D_802B9A2C);
if (temp_f0 < 0.0f) {
return;
@@ -5139,7 +5137,7 @@ void func_802A3008(struct UnkStruct_800DC5EC *arg0) {
s32 pad[12];
s32 i;
struct Actor *phi_s0;
struct Actor *actor;
Vec3f sp4C = {0.0f, 5.0f, 10.0f};
f32 sp48 = sins(temp_s1->rot[1] - 0x8000); // unk26;
f32 temp_f0 = coss(temp_s1->rot[1] - 0x8000);
@@ -5170,119 +5168,119 @@ void func_802A3008(struct UnkStruct_800DC5EC *arg0) {
D_8015F8E0 = 0;
for (i = 0; i < ACTOR_LIST_SIZE; i++) {
phi_s0 = &gActorList[i];
actor = &gActorList[i];
if (phi_s0->flags == 0) {
if (actor->flags == 0) {
continue;
}
switch (phi_s0->type) {
switch (actor->type) {
case 2:
func_80299144(temp_s1, D_801502C0, phi_s0);
func_80299144(temp_s1, D_801502C0, actor);
break;
case 3:
func_8029930C(temp_s1, D_801502C0, phi_s0);
func_8029930C(temp_s1, D_801502C0, actor);
break;
case 4:
func_802994D4(temp_s1, D_801502C0, phi_s0);
func_802994D4(temp_s1, D_801502C0, actor);
break;
case 19:
func_8029969C(temp_s1, D_801502C0, phi_s0);
func_8029969C(temp_s1, D_801502C0, actor);
break;
case 26:
func_80299864(temp_s1, D_801502C0, phi_s0);
func_80299864(temp_s1, D_801502C0, actor);
break;
case 28:
func_80299A2C(temp_s1, D_801502C0, phi_s0);
func_80299A2C(temp_s1, D_801502C0, actor);
break;
case 33:
func_80299BF4(temp_s1, D_801502C0, phi_s0);
func_80299BF4(temp_s1, D_801502C0, actor);
break;
case 29:
func_80299DBC(temp_s1, D_801502C0, phi_s0);
func_80299DBC(temp_s1, D_801502C0, actor);
break;
case 30:
func_80299EDC(temp_s1, D_801502C0, phi_s0);
func_80299EDC(temp_s1, D_801502C0, actor);
break;
case 31:
func_80299FFC(temp_s1, D_801502C0, phi_s0);
func_80299FFC(temp_s1, D_801502C0, actor);
break;
case 32:
func_8029A11C(temp_s1, D_801502C0, phi_s0);
func_8029A11C(temp_s1, D_801502C0, actor);
break;
case ACTOR_FALLING_ROCK:
func_8029CA90(temp_s1, (struct FallingRock *) phi_s0);
func_8029CA90(temp_s1, (struct FallingRock *) actor);
break;
case ACTOR_KIWANO_FRUIT:
func_8029A23C(temp_s1, D_801502C0, phi_s0);
func_8029A23C(temp_s1, D_801502C0, actor);
break;
case ACTOR_BANANA:
func_8029A8F4(temp_s1, D_801502C0, phi_s0);
func_8029A8F4(temp_s1, D_801502C0, actor);
break;
case ACTOR_GREEN_SHELL:
func_8029A690(temp_s1, D_801502C0, (struct ShellActor *) phi_s0);
func_8029A690(temp_s1, D_801502C0, (struct ShellActor *) actor);
break;
case ACTOR_RED_SHELL:
func_8029A75C(temp_s1, D_801502C0, (struct ShellActor *) phi_s0);
func_8029A75C(temp_s1, D_801502C0, (struct ShellActor *) actor);
break;
case ACTOR_BLUE_SPINY_SHELL:
func_8029A828(temp_s1, D_801502C0, (struct ShellActor *) phi_s0);
func_8029A828(temp_s1, D_801502C0, (struct ShellActor *) actor);
break;
case ACTOR_PIRANHA_PLANT:
func_80298328(temp_s1, D_801502C0, phi_s0);
func_80298328(temp_s1, D_801502C0, actor);
break;
case ACTOR_TRAIN_ENGINE:
func_8029B8E8(temp_s1, (struct TrainCar *) phi_s0);
func_8029B8E8(temp_s1, (struct TrainCar *) actor);
break;
case ACTOR_TRAIN_TENDER:
func_8029BFB0(temp_s1, (struct TrainCar *) phi_s0);
func_8029BFB0(temp_s1, (struct TrainCar *) actor);
break;
case ACTOR_TRAIN_PASSENGER_CAR:
func_8029C3CC(temp_s1, (struct TrainCar *) phi_s0);
func_8029C3CC(temp_s1, (struct TrainCar *) actor);
break;
case 18:
func_80297A50(temp_s1, D_801502C0, phi_s0);
func_80297A50(temp_s1, D_801502C0, actor);
break;
case 20:
func_8029AC18(temp_s1, D_801502C0, phi_s0);
func_8029AC18(temp_s1, D_801502C0, actor);
break;
case ACTOR_MARIO_RACEWAY_SIGN:
func_802A29BC(temp_s1, D_801502C0, phi_s0);
func_802A29BC(temp_s1, D_801502C0, actor);
break;
case ACTOR_WARIO_STADIUM_SIGN:
func_802A269C(temp_s1, phi_s0);
func_802A269C(temp_s1, actor);
break;
case 25:
func_802A2C78(temp_s1, D_801502C0, phi_s0);
func_802A2C78(temp_s1, D_801502C0, actor);
break;
case ACTOR_PADDLE_WHEEL_BOAT:
func_8029AE1C(temp_s1, phi_s0, D_801502C0, sp92);
func_8029AE1C(temp_s1, actor, D_801502C0, sp92);
break;
case 37:
func_8029B06C(temp_s1, phi_s0);
func_8029B06C(temp_s1, actor);
break;
case 40:
func_8029B2E4(temp_s1, phi_s0);
func_8029B2E4(temp_s1, actor);
break;
case 41:
func_8029B6EC(temp_s1, phi_s0);
func_8029B6EC(temp_s1, actor);
break;
case 44:
func_8029B4E0(temp_s1, phi_s0);
func_8029B4E0(temp_s1, actor);
break;
case 39:
func_802A2AD0(temp_s1, phi_s0);
func_802A2AD0(temp_s1, actor);
break;
case ACTOR_YOSHI_VALLEY_EGG:
func_802A27A0(temp_s1, D_801502C0, phi_s0, sp92);
func_802A27A0(temp_s1, D_801502C0, actor, sp92);
break;
}
}
switch (gCurrentCourseId) {
case COURSE_MOO_MOO_FARM:
func_802986B4(temp_s1, D_801502C0, phi_s0);
func_802986B4(temp_s1, D_801502C0, actor);
break;
case COURSE_DK_JUNGLE:
func_80298D7C(temp_s1, D_801502C0, phi_s0);
func_80298D7C(temp_s1, D_801502C0, actor);
break;
}
}
+3 -3
View File
@@ -85,7 +85,7 @@ void func_8029FDC8(struct Actor*);
void func_802A00E8(struct Actor*, struct Actor*);
void func_802A0350(struct Actor*, struct Actor*);
void func_802A0450(Player*, struct Actor*);
void func_802A0D54();
void evaluate_player_collision();
void func_802A0E44();
void func_802A1064(struct FakeItemBox*);
void update_obj_fake_item_box(struct FakeItemBox*);
@@ -267,8 +267,8 @@ extern Mat4 D_801502C0;
extern s16 D_8015F6EC;
extern s16 D_8015F6EE;
extern s32 D_800DC50C;
extern s32 D_800DC50C;
extern s32 gGamestate;
extern s32 gGamestate;
extern s32 D_8015F8DC;
extern s32 D_8015F8E0;
extern s32 D_801625EC;
+1 -1
View File
@@ -8,7 +8,7 @@
extern f32 D_80150148, D_8015014C, D_80150150;
extern f32 D_80150130[];
void func_80281610(void) {
void setup_camera_ending_sequence(void) {
Camera *camera;
f32 x_dist;
f32 y_dist;
+6 -6
View File
@@ -111,15 +111,15 @@ void func_800029B0(void) {
}
}
void func_80002A18(void) {
void setup_race(void) {
struct Controller *controller;
int tmp;
int i;
gPlayerCountSelection1 = D_8018EDF3;
if (D_800DC50C != RACING) {
if (gGamestate != RACING) {
gIsMirrorMode = 0;
}
if (gIsMirrorMode != 0) {
if (gIsMirrorMode) {
gCourseDirection = -1.0f;
} else {
gCourseDirection = 1.0f;
@@ -175,7 +175,7 @@ void func_80002A18(void) {
controller = *gControllerOne;
for (tmp = 0; tmp < 7; tmp++, controller++){
for (i = 0; i < 7; i++, controller++){
controller->rawStickX = 0;
controller->rawStickY = 0;
controller->buttonPressed = 0;
@@ -244,7 +244,7 @@ void func_80003040(void) {
gCourseDirection = 1.0f;
gPlayerCountSelection1 = 1;
set_segment_base_addr(0x03, (gPrevLoadedAddress + 0xFFFF7000));
set_segment_base_addr(3, (gPrevLoadedAddress + 0xFFFF7000));
destroy_all_actors();
switch (gCurrentCourseId) {
case COURSE_MARIO_RACEWAY:
+1 -1
View File
@@ -818,7 +818,7 @@ void func_80021B0C(void) {
func_8006E7CC(gPlayerSeven, 6, 0);
func_8006E7CC(gPlayerEight, 7, 0);
}
if (D_800DC50C == ENDING_SEQUENCE) {
if (gGamestate == ENDING_SEQUENCE) {
temp_a0 = gPlayerOne;
if ((temp_a0->unk_044 & 0x2000) != 0) {
func_80024374(temp_a0, 0, 0);
+1 -1
View File
@@ -731,7 +731,7 @@ void func_80028E70(void *arg0, s32 arg1, s8 arg2, s8 arg3) {
temp_v0 = arg0->unk0;
if ((temp_v0 & 0x8000) == 0x8000) {
if (D_800DC50C == ENDING_SEQUENCE) {
if (gGamestate == ENDING_SEQUENCE) {
if ((temp_v0 & 0x2000) == 0) {
func_80038C6C(arg3, arg2);
return;
+4 -4
View File
@@ -7684,7 +7684,7 @@ void func_80053870(s32 arg0) {
do {
temp_s1_2 = *phi_s0_2;
temp_v0 = (&D_80165C18 + (temp_s1_2 * 0xE0))->unkDF;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
temp_v0_2 = *(&D_8018CF68 + (arg0 * 2));
if ((temp_v0_2 >= (temp_v0 - 1)) && ((temp_v0 + 1) >= temp_v0_2) && (func_8008A140(temp_s1_2, sp84, 0x8000) != 0)) {
func_800536C8(temp_s1_2);
@@ -9085,7 +9085,7 @@ void func_80055E68(s32 arg0) {
s32 temp_s0;
temp_s0 = D_80183EA0;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_8008A1D0(temp_s0, arg0, 0x5DC, 0xBB8);
if (func_8007223C(temp_s0, 0x40000) != 0) {
func_80055CCC(temp_s0, arg0);
@@ -9683,7 +9683,7 @@ void func_80057114(s32 arg0) {
s32 phi_s2_2;
phi_fp = arg0;
if (D_800DC50C == ENDING_SEQUENCE) {
if (gGamestate == ENDING_SEQUENCE) {
phi_fp = 0;
}
temp_s7 = (phi_fp * 0xB8) + camera1;
@@ -9694,7 +9694,7 @@ void func_80057114(s32 arg0) {
temp_s0 = *phi_s1;
if (func_8007223C(temp_s0, 0x200000) != 0) {
(&D_80163DE8 + (phi_s2 * 0x54))->unk4A = 0;
} else if (D_800DC50C != ENDING_SEQUENCE) {
} else if (gGamestate != ENDING_SEQUENCE) {
(&D_80163DE8 + (phi_s2 * 0x54))->unk4A = 1;
}
func_800721E8(temp_s0, 0x200000);
+27 -27
View File
@@ -163,7 +163,7 @@ void func_80058090(u32 arg0) {
}
void func_8005217C(s32);
extern s32 D_800DC50C;
extern s32 gGamestate;
extern u16 D_800DC51C;
void func_800581C8(void) {
@@ -172,7 +172,7 @@ void func_800581C8(void) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(0);
if (D_800DC50C == ENDING_SEQUENCE) {
if (gGamestate == ENDING_SEQUENCE) {
func_80055F48(0);
func_80056160(0);
func_8005217C(0);
@@ -267,7 +267,7 @@ void func_80058640(void) {
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
if (D_800DC50C != ENDING_SEQUENCE) {
if (gGamestate != ENDING_SEQUENCE) {
func_80058B58(0);
}
}
@@ -332,7 +332,7 @@ void func_800588F4(s32 arg0) {
func_80054664(arg0);
break;
case COURSE_BANSHEE_BOARDWALK:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800527D8(arg0);
func_80052590(arg0);
func_8005217C(arg0);
@@ -341,20 +341,20 @@ void func_800588F4(s32 arg0) {
break;
case COURSE_YOSHI_VALLEY:
func_80055228(arg0);
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_8005568C(arg0);
}
break;
case COURSE_FRAPPE_SNOWLAND:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_8005327C(arg0);
}
break;
case COURSE_KOOPA_BEACH:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80055528(arg0);
}
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
if ((D_8018EDF3 == 1) || (D_8018EDF3 == 2)) {
func_80055380(arg0);
@@ -371,7 +371,7 @@ void func_800588F4(s32 arg0) {
}
break;
case COURSE_MOO_MOO_FARM:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800550A4(arg0);
}
break;
@@ -381,13 +381,13 @@ void func_800588F4(s32 arg0) {
func_800541BC(arg0);
break;
case COURSE_SHERBET_LAND:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80052E30(arg0);
}
func_8005592C(arg0);
break;
case COURSE_RAINBOW_ROAD:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80056188(arg0);
func_80055C38(arg0);
}
@@ -401,7 +401,7 @@ void func_800588F4(s32 arg0) {
case COURSE_DOUBLE_DECK:
break;
case COURSE_DK_JUNGLE:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80054414(arg0);
}
break;
@@ -423,7 +423,7 @@ extern u16 D_8015F894;
void func_80058B58() {
switch(gCurrentCourseId) {
case 5:
if (D_800DC50C != 9) {
if (gGamestate != 9) {
if ((D_8015F894 == 0) && (gPlayerCountSelection1 == COURSE_CHOCO_MOUNTAIN)) {
func_800517C8();
}
@@ -1044,7 +1044,7 @@ void func_80059AC8(void) {
switch (gScreenModeSelection) {
case SCREEN_MODE_1P:
if (D_800DC50C != 9) {
if (gGamestate != 9) {
func_80059A88(0);
if (gModeSelection == 1) {
func_8005995C();
@@ -1231,12 +1231,12 @@ void func_8005A070(void) {
func_80041D34();
if (D_800DC5FC == 0) {
func_8005C728();
if (D_800DC50C == ENDING_SEQUENCE) {
if (gGamestate == ENDING_SEQUENCE) {
func_80086604();
func_80086D80();
func_8007C2F8(1);
func_80077640();
} else if (D_800DC50C == CREDITS_SEQUENCE) {
} else if (gGamestate == CREDITS_SEQUENCE) {
func_80059820(0);
func_80078C70(0);
func_8005A74C();
@@ -1342,7 +1342,7 @@ void func_8005A380(void) {
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
? func_8006F824(?, s8, s32); /* extern */
extern s32 D_800DC50C;
extern s32 gGamestate;
extern u16 D_800DC51C;
extern s8 D_801657E4;
extern s8 D_801657E6;
@@ -1358,7 +1358,7 @@ void func_8005A3C0(s32 arg2) {
s8 phi_a1;
s32 phi_a2;
temp_v0 = D_800DC50C;
temp_v0 = gGamestate;
phi_a1 = 0;
phi_a2 = arg2;
phi_a1 = 0;
@@ -1488,7 +1488,7 @@ void func_8005A74C(void) {
func_80076B84();
break;
case 3:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_8007E1AC();
func_8007E4C4();
if (gModeSelection != TIME_TRIALS) {
@@ -1500,22 +1500,22 @@ void func_8005A74C(void) {
break;
case 4:
func_80083080();
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800834B8();
}
break;
case 5:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80083D60();
}
func_80078838();
break;
case 6:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80082E5C();
}
temp_v0 = D_8018EDF3;
if ((temp_v0 == 1) || (temp_v0 == 2) || (D_800DC50C == CREDITS_SEQUENCE)) {
if ((temp_v0 == 1) || (temp_v0 == 2) || (gGamestate == CREDITS_SEQUENCE)) {
func_80082870();
}
break;
@@ -1525,7 +1525,7 @@ void func_8005A74C(void) {
}
break;
case 9:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800821FC();
}
break;
@@ -1533,13 +1533,13 @@ void func_8005A74C(void) {
func_80075838();
break;
case 12:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800842C8();
}
func_80085214();
break;
case 13:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800861E0();
func_80085AA8();
}
@@ -11508,7 +11508,7 @@ void func_8006E420(Player* player, s8 arg1, s8 arg2) {
for (temp_s0 = 0; temp_s0 < 10; ++temp_s0)
{
func_8006CEC0(player, temp_s0, arg1, arg2);
if (((player->unk_000 & 0x4000) == 0x4000) || (D_800DC50C == ENDING_SEQUENCE)) {
if (((player->unk_000 & 0x4000) == 0x4000) || (gGamestate == ENDING_SEQUENCE)) {
func_8006C9B8(player, temp_s0, arg1, arg2);
}
func_8006C6AC(player, temp_s0, arg1, arg2);
+10 -10
View File
@@ -1462,7 +1462,7 @@ void func_80070780(void) {
temp_t6 = gCurrentCourseId;
switch (temp_t6) {
case 0:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
if (gModeSelection == GRAND_PRIX) {
func_80070714();
}
@@ -1553,7 +1553,7 @@ void func_80070780(void) {
} while (temp_s0_4 != &D_8018C0B0);
return;
case 3:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
temp_s0_5 = D_80183EA0.unk0;
func_80073444(temp_s0_5, &D_06007BB8, &D_06007DB8, 0x20, 0x40);
temp_v0_5 = &D_80165C18 + (temp_s0_5 * 0xE0);
@@ -1574,7 +1574,7 @@ void func_80070780(void) {
phi_s1_3 = temp_s1;
} while (temp_s1 < &D_80183EB0);
phi_s2_3 = &D_80183F28;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
phi_v1 = D_800E5E8C;
phi_s1_4 = &D_800E5E14;
do {
@@ -1612,7 +1612,7 @@ void func_80070780(void) {
phi_s1_5 = temp_s1_2;
} while (temp_s1_2 < &D_8018C278);
phi_s1_6 = &D_80183EA0;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
phi_v1_2 = &D_800E5EE8;
phi_s2_4 = &D_80183F28;
do {
@@ -1641,7 +1641,7 @@ void func_80070780(void) {
return;
case 6:
phi_s1_7 = &D_80183EA0;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
phi_v1_3 = D_800E5F80;
do {
temp_s0_9 = *phi_s1_7;
@@ -1676,7 +1676,7 @@ void func_80070780(void) {
} while (temp_s2 != &D_80183F50);
return;
case 7:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
if (gModeSelection == GRAND_PRIX) {
func_80070714();
}
@@ -1698,7 +1698,7 @@ void func_80070780(void) {
/* Duplicate return node #106. Try simplifying control flow for better match */
return;
case 8:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
if (gModeSelection == GRAND_PRIX) {
func_80070714();
}
@@ -1722,7 +1722,7 @@ void func_80070780(void) {
/* Duplicate return node #106. Try simplifying control flow for better match */
return;
case 9:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
temp_v0_10 = D_8018EDF3;
phi_s1_8 = &D_80183EA0;
if ((temp_v0_10 == ONE_PLAYERS_SELECTED) || ((temp_v0_10 == TWO_PLAYERS_SELECTED) && (gModeSelection == VERSUS))) {
@@ -1811,7 +1811,7 @@ block_75:
/* Duplicate return node #106. Try simplifying control flow for better match */
return;
case 11:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
find_unused_obj_index(&D_8018CF10);
func_800723A4(D_8018CF10, 0);
phi_s1_12 = &D_8018C1B0;
@@ -1846,7 +1846,7 @@ block_75:
return;
case 13:
phi_s1_14 = &D_80183EA0;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
do {
func_800723A4(*phi_s1_14, 0);
temp_s1_5 = phi_s1_14 + 4;
+9 -9
View File
@@ -3783,7 +3783,7 @@ void func_80078288(s32 arg0) {
temp_s0->unkB4 = func_800872D8(arg0, camera1);
return;
}
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
sp3A = ((gPlayerOneCopy->unk_094 / 18.0f) * 216.0f) / 2.0f;
sp3E = (random_int(0xF) - sp3A) + 0x2D;
sp3C = random_int(0x12C) + 0x1E;
@@ -3941,7 +3941,7 @@ void func_80078838(void) {
s32 temp_a0;
s32 *phi_s0;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80078790();
} else {
func_80078790();
@@ -9099,7 +9099,7 @@ void func_80080524(s32 arg0) {
temp_s0->unk14 = 70.0f;
temp_s0->unk20 = 0.0f;
func_8008B888(arg0, 0, 0, 0);
if ((gIsMirrorMode != 0) || (D_800DC50C == CREDITS_SEQUENCE)) {
if ((gIsMirrorMode != 0) || (gGamestate == CREDITS_SEQUENCE)) {
func_8008B8BC(arg0, 0, 0xC000, 0);
} else {
func_8008B8BC(arg0, 0, 0x4000, 0);
@@ -9285,7 +9285,7 @@ block_6:
func_8007E63C(arg0);
func_8008085C(arg0);
func_80073514(arg0);
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
if ((D_8018D40C == 0) && (phi_t0->unkA6 == 2)) {
func_800C98B8(phi_t0 + 4, phi_t0 + 0x38, 0x19036045);
return;
@@ -10481,7 +10481,7 @@ void func_8008241C(s32 arg0, s32 arg1) {
phi_f10 = temp_f10 + 4294967296.0;
}
temp_f4 = phi_f10 + -100.0;
if (D_800DC50C == CREDITS_SEQUENCE) {
if (gGamestate == CREDITS_SEQUENCE) {
func_8008B7D4(arg0, sp22 + D_800EF170, sp20 + 60.0, temp_f4 + D_800EF178);
} else if (temp_s0->unkD5 != 0) {
func_8008B7D4(arg0, (sp22 + D_800EF180) * D_8018D01C, sp20 + 20.0, temp_f4 + D_800EF188);
@@ -10602,7 +10602,7 @@ void func_80082870(void) {
D_80183E40.unk0 = 0.0f;
D_80183E40.unk4 = 0.0f;
D_80183E40.unk8 = 0.0f;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_800C98B8(temp_s1 + 4, &D_80183E40, 0x19017043);
} else if (D_802876D2 < 0x97) {
func_800C98B8(&D_80165C18 + (D_80183F2C * 0xE0) + 4, &D_80183E40, 0x19017043);
@@ -10618,7 +10618,7 @@ void func_80082870(void) {
if (temp_v0 != 0) {
D_80165900 = temp_v0 - 1;
} else {
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
D_80165900 = 0x3C;
} else {
D_80165900 = 0xF;
@@ -11812,7 +11812,7 @@ block_14:
} else if ((arg1 >= 9) && (arg1 < 0xF)) {
switch (arg1) {
case 9:
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_8008B7D4(arg0, D_8018D01C * 146.0, 0, 0xC3BE0000);
} else {
func_8008B7D4(arg0, D_8018D01C * 380.0, 0, 0xC405C000);
@@ -12226,7 +12226,7 @@ void func_800853DC(s32 arg0) {
temp_v0 = (arg0 * 0xE0) + &D_80165C18;
temp_v0->unk70 = &D_0600F960;
temp_v0->unk0 = 1.0f;
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
sp2C = temp_v0;
func_8008B7D4(D_8018D01C * -176.0, 0.0f, -2323.0f);
func_8008B80C(arg0, 0.0f, 0x43960000, 0.0f);
+15 -14
View File
@@ -271,7 +271,7 @@ void func_80091B78(void) {
var_s0_2 += 1;
} while (var_s0_2 != 8);
func_800B44BC();
osViSetSpecialFeatures(0x00000040U);
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80091B78.s")
@@ -1491,7 +1491,8 @@ void func_800947B4(struct GfxPool *arg0, s32 unused) {
#ifdef NEEDS_RODATA
// Non-matching due to .rodata diffs resulting from the switch/case
// jump table
void func_80094A64(Mtx *arg0) {
// Renders menu graphics?
void func_80094A64(GfxPool *arg0) {
D_8018D120 = 0;
D_80164AF0 = 0;
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_802B8880));
@@ -4127,7 +4128,7 @@ void func_80099AEC(void) {
void *temp_v0;
void *temp_v0_2;
if (D_800DC50C == 4) {
if (gGamestate == 4) {
sp60 = 0x00000500;
} else {
sp60 = 0x00001000;
@@ -5819,7 +5820,7 @@ void func_8009CBE4(s32 arg0, s32 arg1, s32 arg2) {
sp40 = temp_t4;
gDisplayListHead = draw_box(gDisplayListHead, phi_t2 - temp_v1_3, phi_t3 - temp_t0, temp_v1_3 + phi_t2, temp_t0 + phi_t3, temp_v0_5->unk0, temp_v0_5->unk2, temp_v0_5->unk4, 0xFF - ((*temp_t4 * 0xFF) / *temp_t9));
if ((arg1 == 0) && (temp_t6 = *temp_t4 + 1, *temp_t4 = temp_t6, ((temp_t6 < *sp3C) == 0))) {
if (D_800DC50C == RACING) {
if (gGamestate == RACING) {
*(&D_8018E7AC + arg0) = 6;
return;
}
@@ -5856,7 +5857,7 @@ void func_8009CE1C(void) {
? func_80290360(); /* extern */
? func_80290388(); /* extern */
? func_802903B0(); /* extern */
extern s32 D_800DC524;
extern s32 gGamestateNext;
extern s32 D_800E86A4;
extern s16 D_8015F892;
extern ? D_8018E7AC;
@@ -5906,7 +5907,7 @@ void func_8009CE64(s32 *arg0, s32 arg2, s32 arg3) {
var_a0 = arg0;
var_a2 = arg3;
temp_v0 = D_800DC50C;
temp_v0 = gGamestate;
var_a1 = 0;
if (temp_v0 == (s32) 5) {
temp_v1 = gCCSelection;
@@ -5917,7 +5918,7 @@ void func_8009CE64(s32 *arg0, s32 arg2, s32 arg3) {
}
if (var_a1 != 0) {
gMenuSelectionFromEndingSequence = 9;
gCreditsCourseId = 8;
gCreditsCourseId = COURSE_LUIGI_RACEWAY;
return;
}
gMenuSelectionFromEndingSequence = 1;
@@ -6065,7 +6066,7 @@ block_74:
case 2: /* switch 3 */
D_800DC51C = 1;
D_8018EE08 = 1;
D_800DC524 = 4;
gGamestateNext = 4;
gCCSelection = (s32) 1;
temp_v1_4 = (s8) gNextDemoId;
switch (temp_v1_4) { /* switch 4 */
@@ -6165,7 +6166,7 @@ block_74:
D_800E86A4 = 1;
}
if (gMenuSelection >= 0xE) {
D_800DC524 = 4;
gGamestateNext = 4;
if (gModeSelection == 1) {
D_8018EDFB = (s8) 1;
}
@@ -6177,15 +6178,15 @@ block_74:
temp_v1_7 = gDebugGotoScene;
switch (temp_v1_7) { /* switch 5; irregular */
case 1: /* switch 5 */
D_800DC524 = (s32) 5;
gGamestateNext = (s32) 5;
break;
case 2: /* switch 5 */
case 3: /* switch 5 */
D_800DC524 = 9;
gCreditsCourseId = 8;
gGamestateNext = 9;
gCreditsCourseId = COURSE_LUIGI_RACEWAY;
break;
default: /* switch 5 */
D_800DC524 = 4;
gGamestateNext = 4;
if (gModeSelection == (s32) 1) {
D_8018EDFB = 1;
}
@@ -10492,7 +10493,7 @@ void func_800A474C(s32 recordType, s32 column, s32 row) {
u32 phi_v0_2;
u32 phi_v0_3;
if (D_800DC50C == 4) {
if (gGamestate == 4) {
sp30 = 0;
} else {
sp30 = 1;
+2 -2
View File
@@ -1038,7 +1038,7 @@ s32 func_800B6178(s32 arg0) {
if ((arg0 != 0) && (arg0 != 1)) {
return -1;
}
if (D_800DC50C == RACING) {
if (gGamestate == RACING) {
func_800051C4();
}
temp_s3 = (arg0 << 7) + &D_8018EE10;
@@ -1065,7 +1065,7 @@ s32 func_800B6178(s32 arg0) {
phi_v1 = temp_v0_2;
if (temp_v0_2 == 0) {
temp_s3->unk4 = 1;
if (D_800DC50C == RACING) {
if (gGamestate == RACING) {
temp_s3->unk5 = (gCupSelection * 4) + gCupCourseSelection;
}
temp_s3->unk0 = D_80162DFC;
+13 -12
View File
@@ -7,6 +7,7 @@
#include "types.h"
#include "camera.h"
#include "code_80281780.h"
#include <config.h>
extern Gfx *gDisplayListHead;
@@ -26,7 +27,7 @@ extern s32 D_802874A0;
extern u16 atan2s(f32, f32);
extern u16 D_80164714, D_80164716, D_80164718;
extern u16 D_800DC5E4;
extern u32 D_800DC50C;
extern u32 gGamestate;
extern u32 D_802874FC;
extern u16 D_800DC518;
@@ -45,9 +46,9 @@ void func_80280038(void) {
D_80150112 = 0;
D_80164AF0 = 0;
D_8018D120 = 0;
func_802A3E3C();
init_rdp();
func_802A53A4();
func_802A3E3C();
init_rdp();
func_80057FC4(0);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
guPerspective(&gGfxPool->mtxPool[1], &sp44[37], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
@@ -64,9 +65,9 @@ void func_80280038(void) {
func_80058538(0);
func_80284CC0();
func_80281C40();
func_802A3E3C();
init_rdp();
func_80093F10();
func_802A3E3C();
init_rdp();
}
void func_80280268(s32 arg0) {
@@ -79,7 +80,7 @@ void func_80280268(s32 arg0) {
gCreditsCourseId = arg0;
}
void func_802802AC(void) {
void credits_loop(void) {
Camera *camera = &cameras[0];
f32 temp_f12;
@@ -87,12 +88,12 @@ void func_802802AC(void) {
f32 temp_f14;
D_802874A0 = 0;
if (gIsInQuitToMenuTransition != 0) {
if (gIsInQuitToMenuTransition) {
gQuitToMenuTransitionCounter--;
if (gQuitToMenuTransitionCounter == 0) {
gIsInQuitToMenuTransition = 0;
D_800DC524 = CREDITS_SEQUENCE;
D_800DC50C = 255;
gGamestateNext = CREDITS_SEQUENCE;
gGamestate = 255;
}
} else {
@@ -115,7 +116,7 @@ void func_802802AC(void) {
}
}
void func_80280420(void) {
void load_credits(void) {
Camera *camera = &cameras[0];
gCurrentCourseId = gCreditsCourseId;
@@ -125,8 +126,8 @@ void func_80280420(void) {
func_802A74BC();
camera->unk_B4 = 60.0f;
D_80150130[0] = 60.0f;
D_800DC5EC->screenWidth = 320;
D_800DC5EC->screenHeight = 240;
D_800DC5EC->screenWidth = SCREEN_WIDTH;
D_800DC5EC->screenHeight = SCREEN_HEIGHT;
D_800DC5EC->screenStartX = 160;
D_800DC5EC->screenStartY = 120;
gScreenModeSelection = SCREEN_MODE_1P;
+2 -5
View File
@@ -600,13 +600,10 @@ void func_80281540(void) {
extern s16 D_80150112;
extern s32 D_802874FC;
void func_80281548(void) {
void *temp_v0;
void *temp_v0_2;
void ending_sequence_loop(void) {
D_80150112 = 0;
D_802874FC = 0;
func_80281610();
setup_camera_ending_sequence();
func_80028F70();
func_80022744();
func_80059AC8();
+3 -3
View File
@@ -49,12 +49,12 @@ void func_80281D00(void) {
u16 sp64[46];
func_802A53A4();
func_802A3E3C();
init_rdp();
if (gMenuSelectionFromEndingSequence != 0xFFFF) {
clear_framebuffer(0);
if (D_80287554 >= 4) {
gIsInQuitToMenuTransition = 0;
D_800DC524 = gMenuSelectionFromEndingSequence;
gGamestateNext = gMenuSelectionFromEndingSequence;
}
D_80287554++;
return;
@@ -78,5 +78,5 @@ void func_80281D00(void) {
func_80093F10();
func_80284CC0();
func_80281C40();
func_802A3E3C();
init_rdp();
}
+3 -3
View File
@@ -584,7 +584,7 @@ s32 func_8028336C(s32 arg0, Camera *camera) {
if (temp_v1 != 0) {
return temp_v1;
}
temp_v1_2 = D_800DC50C;
temp_v1_2 = gGamestate;
switch (temp_v1_2) { /* irregular */
case 5:
D_802876D8 = (s32) *(&sp20 + D_802874F5);
@@ -675,7 +675,7 @@ void func_80283430(void) {
var_s1 += 0x14;
} while (var_s0 != &D_80287824);
D_802856C0 = 0.0f;
if (D_800DC50C == 5) {
if (gGamestate == 5) {
D_802856B0 = 120.0f;
D_802856B4 = 12.0f;
D_802856B8 = 120.0f;
@@ -768,7 +768,7 @@ s32 func_80283648(Camera *camera) {
camera->angleZ = sins((u16) sp6C) * -sp38;
vec3f_copy_dupe(camera->pos, &D_802876EC);
vec3f_copy_dupe(sp34, (f32 *) &D_802876E0);
if ((D_800DC50C == 9) && (gIsMirrorMode != 0)) {
if ((gGamestate == 9) && (gIsMirrorMode != 0)) {
camera->pos[0] = -camera->pos[0];
camera->unk = -camera->unk;
}
+101 -68
View File
@@ -17,10 +17,10 @@
void func_8008C214(void);
void func_80091B78(void);
void func_802A4D18(void);
void func_802A3E3C(void);
void func_802A4160(void);
void func_802A41D4(void);
void func_802A3CB0(void);
void init_rdp(void);
void set_viewport(void);
void select_framebuffer(void);
void init_z_buffer(void);
void audio_init();
void profiler_log_gfx_time(enum ProfilerGfxEvent eventID);
void profiler_log_vblank_time(void);
@@ -150,13 +150,13 @@ u32 gGfxSPTaskStack[256];
OSMesg gPIMesgBuf[32];
OSMesgQueue gPIMesgQueue;
s32 D_800DC50C = 0xFFFF;
s32 gGamestate = 0xFFFF;
u16 D_800DC510 = 0;
u16 D_800DC514 = 0;
u16 D_800DC518 = 0;
u16 D_800DC51C = 0;
u16 gEnableDebugMode = 0;
s32 D_800DC524 = 7; // = COURSE_DATA_MENU?;
s32 gGamestateNext = 7; // = COURSE_DATA_MENU?;
UNUSED s32 D_800DC528 = 1;
s32 gActiveScreenMode = SCREEN_MODE_1P;
s32 gScreenModeSelection = 0;
@@ -179,7 +179,7 @@ s32 D_800DC568 = 0;
s32 D_800DC56C[8] = {0};
s16 sNumVBlanks = 0;
UNUSED s16 D_800DC590 = 0;
f32 D_800DC594 = 0.0f;
f32 gVBlankTimer = 0.0f;
f32 gCourseTimer = 0.0f;
@@ -298,7 +298,7 @@ void create_gfx_task_structure(void) {
gGfxSPTask->task.t.flags = (1 << 1);
gGfxSPTask->task.t.ucode_boot = rspbootTextStart;
gGfxSPTask->task.t.ucode_boot_size = ((u8 *) rspbootTextEnd - (u8 *) rspbootTextStart);
if (D_800DC50C != RACING || gPlayerCountSelection1 - 1 == 0) {
if (gGamestate != RACING || gPlayerCountSelection1 - 1 == 0) {
gGfxSPTask->task.t.ucode = gspF3DEXTextStart;
gGfxSPTask->task.t.ucode_data = gspF3DEXDataStart;
} else {
@@ -407,12 +407,15 @@ void exec_display_list(struct SPTask *spTask) {
}
}
void func_80000CA8(void) {
/**
* Set default RCP (Reality Co-Processor) settings.
*/
void init_rcp(void) {
move_segment_table_to_dmem();
func_802A3E3C();
func_802A4160();
func_802A41D4();
func_802A3CB0();
init_rdp();
set_viewport();
select_framebuffer();
init_z_buffer();
}
/**
@@ -446,7 +449,7 @@ void rendering_init(void) {
set_segment_base_addr(1, gGfxPool);
gGfxSPTask = &gGfxPool->spTask;
gDisplayListHead = gGfxPool->gfxPool;
func_80000CA8();
init_rcp();
clear_framebuffer(0);
end_master_display_list();
exec_display_list(&gGfxPool->spTask);
@@ -518,8 +521,10 @@ void dma_copy(u8 *dest, u8 *arg1, u32 size) {
}
}
// Resembles setup_game_memory from SM64
void init_game(void) {
/**
* Setup main segments and framebuffers.
*/
void setup_game_memory(void) {
UNUSED u32 pad[2];
u32 sp2C;
u32 sp40;
@@ -552,15 +557,19 @@ void init_game(void) {
D_8015F734 = gPrevLoadedAddress;
}
void func_80001404(void) {
D_800DC524 = 0; // = START_MENU_FROM_QUIT?
/**
* @brief
*
*/
void game_init_clear_framebuffer(void) {
gGamestateNext = 0; // = START_MENU_FROM_QUIT?
clear_framebuffer(0);
}
void func_8000142C(void) {
void race_logic_loop(void) {
s16 i;
s32 pad;
u16 temp_v0;
u16 rotY;
f32 pad2 = 0;
D_80150112 = 0;
@@ -581,9 +590,9 @@ void func_8000142C(void) {
func_802A4EF4();
switch(gActiveScreenMode) {
case 0:
case SCREEN_MODE_1P:
D_80150114 = 2;
func_80005F44();
staff_ghosts_loop();
if (D_800DC5FC == 0) {
for (i = 0; i < D_80150114; i++) {
@@ -591,7 +600,7 @@ void func_8000142C(void) {
gCourseTimer += 0.01666666;
}
func_802909F0();
func_802A0D54();
evaluate_player_collision();
func_800382DC();
func_8001EE98(gPlayerOneCopy, camera1, 0);
func_80028F70();
@@ -620,15 +629,15 @@ void func_8000142C(void) {
D_800DC514 = 0;
}
temp_v0 = camera1->rot[1];
rotY = camera1->rot[1];
D_801625E8 = D_800DC5EC->pathCounter;
if (temp_v0 < 0x2000) {
if (rotY < 0x2000) {
func_80057A50(40, 100, "SOUTH ", D_801625E8);
} else if (temp_v0 < 0x6000) {
} else if (rotY < 0x6000) {
func_80057A50(40, 100, "EAST ", D_801625E8);
} else if (temp_v0 < 0xA000) {
} else if (rotY < 0xA000) {
func_80057A50(40, 100, "NORTH ", D_801625E8);
} else if (temp_v0 < 0xE000) {
} else if (rotY < 0xE000) {
func_80057A50(40, 100, "WEST ", D_801625E8);
} else {
func_80057A50(40, 100, "SOUTH ", D_801625E8);
@@ -644,7 +653,7 @@ void func_8000142C(void) {
}
break;
case 2:
case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL:
if (gCurrentCourseId == COURSE_DK_JUNGLE) {
D_80150114 = 3;
} else {
@@ -656,7 +665,7 @@ void func_8000142C(void) {
gCourseTimer += 0.01666666;
}
func_802909F0();
func_802A0D54();
evaluate_player_collision();
func_800382DC();
func_8001EE98(gPlayerOneCopy, camera1, 0);
func_80029060();
@@ -674,9 +683,9 @@ void func_8000142C(void) {
profiler_log_thread5_time(LEVEL_SCRIPT_EXECUTE);
sNumVBlanks = 0;
move_segment_table_to_dmem();
func_802A3E3C();
init_rdp();
if (D_800DC5B0 != 0) {
func_802A41D4();
select_framebuffer();
}
D_8015F788 = 0;
if (gPlayerWinningIndex == 0) {
@@ -688,7 +697,7 @@ void func_8000142C(void) {
}
break;
case 1:
case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL:
if (gCurrentCourseId == COURSE_DK_JUNGLE) {
D_80150114 = 3;
@@ -702,7 +711,7 @@ void func_8000142C(void) {
gCourseTimer += 0.01666666;
}
func_802909F0();
func_802A0D54();
evaluate_player_collision();
func_800382DC();
func_8001EE98(gPlayerOneCopy, camera1, 0);
func_80029060();
@@ -720,9 +729,9 @@ void func_8000142C(void) {
sNumVBlanks = (u16)0;
func_8005A070();
move_segment_table_to_dmem();
func_802A3E3C();
init_rdp();
if (D_800DC5B0 != 0) {
func_802A41D4();
select_framebuffer();
}
D_8015F788 = 0;
if (gPlayerWinningIndex == 0) {
@@ -735,7 +744,7 @@ void func_8000142C(void) {
break;
case 3:
case SCREEN_MODE_3P_4P_SPLITSCREEN:
if (gPlayerCountSelection1 == 3) {
switch(gCurrentCourseId) {
case COURSE_BOWSER_CASTLE:
@@ -749,6 +758,7 @@ void func_8000142C(void) {
break;
}
} else {
// Four players
switch(gCurrentCourseId) {
case COURSE_BLOCK_FORT:
case COURSE_DOUBLE_DECK:
@@ -769,7 +779,7 @@ void func_8000142C(void) {
gCourseTimer += 0.01666666;
}
func_802909F0();
func_802A0D54();
evaluate_player_collision();
func_800382DC();
func_8001EE98(gPlayerOneCopy, camera1, 0);
func_80029158();
@@ -791,9 +801,9 @@ void func_8000142C(void) {
sNumVBlanks = 0;
profiler_log_thread5_time(LEVEL_SCRIPT_EXECUTE);
move_segment_table_to_dmem();
func_802A3E3C();
init_rdp();
if (D_800DC5B0 != 0) {
func_802A41D4();
select_framebuffer();
}
D_8015F788 = 0;
if (gPlayerWinningIndex == 0) {
@@ -845,29 +855,42 @@ void func_8000142C(void) {
gSPEndDisplayList(gDisplayListHead++);
}
void func_80001ECC(void) {
switch (D_800DC50C) {
/**
* mk64's game loop depends on a series of states.
* It runs a wide branching series of code based on these states.
* State 1) Clear framebuffer
* State 2) Run menus
* State 3) Process race related logic
* State 4) Ending sequence
* State 5) Credits
*
* Note that the state doesn't flip-flop at random but is permanent
* until the state changes (ie. Exit menus and start a race).
*/
void game_state_handler(void) {
switch (gGamestate) {
case 7:
func_80001404();
game_init_clear_framebuffer();
break;
case 0:
case 1:
case 2:
case 3:
case START_MENU_FROM_QUIT:
case MAIN_MENU_FROM_QUIT:
case PLAYER_SELECT_MENU_FROM_QUIT:
case COURSE_SELECT_MENU_FROM_QUIT:
// Display black
osViBlack(0);
func_800B0350();
func_80000CA8();
func_80094A64(gGfxPool);
update_menus();
init_rcp();
// gGfxPool->mtxPool->m or gGfxPool?
func_80094A64(gGfxPool->mtxPool->m);
break;
case 4:
func_8000142C();
case RACING:
race_logic_loop();
break;
case 5:
func_80281548();
case ENDING_SEQUENCE:
ending_sequence_loop();
break;
case 9:
func_802802AC();
case CREDITS_SEQUENCE:
credits_loop();
break;
}
}
@@ -927,7 +950,7 @@ void start_gfx_sptask(void) {
}
void handle_vblank(void) {
D_800DC594 += 0.01666666;
gVBlankTimer += 0.01666666;
sNumVBlanks++;
receive_new_tasks();
@@ -1035,9 +1058,11 @@ void thread3_video(UNUSED void *arg0) {
}
setup_mesg_queues();
init_game();
setup_game_memory();
create_thread(&gAudioThread, 4, &thread4_audio, 0, gAudioThreadStack + ARRAY_COUNT(gAudioThreadStack), 20);
osStartThread(&gAudioThread);
create_thread(&gGameLoopThread, 5, &thread5_game_loop, 0, gGameLoopThreadStack + ARRAY_COUNT(gGameLoopThreadStack), 10);
osStartThread(&gGameLoopThread);
@@ -1084,8 +1109,13 @@ void func_80002658(void) {
func_802A4D18();
}
void func_80002684(void) {
switch (D_800DC50C) {
/**
* Sets courseId to NULL if
*
*
*/
void update_gamestate(void) {
switch (gGamestate) {
case START_MENU_FROM_QUIT:
func_80002658();
gCurrentlyLoadedCourseId = COURSE_NULL;
@@ -1104,7 +1134,7 @@ void func_80002684(void) {
break;
case RACING:
init_seg_8028DF00();
func_80002A18();
setup_race();
break;
case ENDING_SEQUENCE:
gCurrentlyLoadedCourseId = COURSE_NULL;
@@ -1115,7 +1145,7 @@ void func_80002684(void) {
gCurrentlyLoadedCourseId = COURSE_NULL;
init_seg_8028DF00();
init_seg_80280000();
func_80280420();
load_credits();
break;
}
}
@@ -1128,7 +1158,8 @@ void thread5_game_loop(UNUSED void *arg) {
clear_nmi_buffer();
}
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) OS_EVENT_SW2);
// Potentially unused?
// These variables track stats such as player wins.
// In the event of a console reset, it remembers them.
gNmiUnknown1 = (s32) pAppNmiBuffer;
gNmiUnknown2 = (s32) pAppNmiBuffer + 2;
gNmiUnknown3 = (s32) pAppNmiBuffer + 11;
@@ -1141,14 +1172,16 @@ void thread5_game_loop(UNUSED void *arg) {
while(TRUE) {
func_800CB2C4();
if (D_800DC524 != D_800DC50C) {
D_800DC50C = (s32) D_800DC524;
func_80002684();
// Update the gamestate if it has changed.
if (gGamestateNext != gGamestate) {
gGamestate = gGamestateNext;
update_gamestate();
}
profiler_log_thread5_time(THREAD5_START);
config_gfx_pool();
read_controllers();
func_80001ECC();
game_state_handler();
end_master_display_list();
display_and_vsync();
}
+6 -6
View File
@@ -30,7 +30,7 @@ void read_controllers();
void func_80000BEC();
void dispatch_audio_sptask(struct SPTask*);
void exec_display_list(struct SPTask*);
void func_80000CA8();
void init_rcp();
void end_master_display_list();
void *clear_framebuffer(s32);
void rendering_init();
@@ -39,8 +39,8 @@ void display_and_vsync();
void init_seg_80280000();
void init_seg_8028DF00();
void dma_copy(u8*, u8*, u32);
void init_game();
void func_80001ECC();
void setup_game_memory();
void game_state_handler();
void interrupt_gfx_sptask();
void receive_new_tasks();
void set_vblank_handler(s32, struct VblankHandler*, OSMesgQueue*, OSMesg*);
@@ -53,7 +53,7 @@ void func_800025D4();
void func_80002600();
void func_8000262C();
void func_80002658();
void func_80002684();
void update_gamestate();
void thread5_game_loop(void*);
void thread4_audio(void*);
@@ -64,9 +64,9 @@ extern struct Controller gControllers[8];
extern OSIoMesg gDmaIoMesg;
extern OSMesg gMainReceivedMesg;
extern OSMesgQueue gDmaMesgQueue;
extern s32 D_800DC524;
extern s32 gGamestateNext;
extern s32 gActiveScreenMode;
extern f32 D_800DC594;
extern f32 gVBlankTimer;
extern uintptr_t pAppNmiBuffer;
extern s32 gNmiUnknown1, gNmiUnknown2, gNmiUnknown3, gNmiUnknown4, gNmiUnknown5, gNmiUnknown6;
extern s32 gScreenModeSelection;
+2 -2
View File
@@ -1526,7 +1526,7 @@ void load_course(s32 arg0) {
u32 *temp_a2;
temp_v0 = &gCourseTable[arg0];
temp_v1 = D_800DC50C;
temp_v1 = gGamestate;
temp_a2 = temp_v0->offsetRomStart;
sp48 = temp_v0->dlRomStart;
sp44 = temp_v0->dlRomEnd;
@@ -1544,7 +1544,7 @@ void load_course(s32 arg0) {
gHeapEndPtr = 0x8028DF00;
}
set_segment_base_addr(9, func_802A7D70(temp_a2, temp_v0->offsetRomEnd, temp_a2));
if (D_800DC50C != ENDING_SEQUENCE) {
if (gGamestate != ENDING_SEQUENCE) {
set_segment_base_addr(6, func_802AA88C(sp48, sp44));
}
sp18 = gPrevLoadedAddress;
+55 -45
View File
@@ -148,24 +148,29 @@ union GameModePack {
const union GameModePack D_800F2BE4 = { {0, 1, 2, 3} };
/** forward decs **/
void func_800B053C(struct Controller *, u16);
void func_800B13B0(struct Controller *, u16);
void func_800B15AC(struct Controller *, u16);
void func_800B1C40(struct Controller *, u16);
void func_800B1C90(struct Controller *, u16);
void func_800B20F4(struct Controller *, u16);
void func_800B29D8(struct Controller *, u16);
void func_800B3554(struct Controller *, u16);
void func_800B3B58(struct Controller *, u16);
void options_menu_act(struct Controller *, u16);
void data_menu_act(struct Controller *, u16);
void course_data_menu_act(struct Controller *, u16);
void logo_intro_menu_act(struct Controller *, u16);
void controller_pak_menu_act(struct Controller *, u16);
void splash_menu_act(struct Controller *, u16);
void main_menu_act(struct Controller *, u16);
void player_select_menu_act(struct Controller *, u16);
void course_select_menu_act(struct Controller *, u16);
void func_800B44AC(void);
/**************************/
void func_800B0350(void) {
/**
* Includes opening logo and splash screens
*/
void update_menus(void) {
u16 controllerIdx;
if (D_800E86A4 == 0) {
for (controllerIdx = 0; controllerIdx < 4; controllerIdx++) {
if ((func_800B4520() == 0) && (gEnableDebugMode != 0) && ((gControllers[controllerIdx].buttonPressed & 0x1000) != 0)) {
// Quick jump through menus using the start button.
if ((func_800B4520() == 0) && (gEnableDebugMode) && ((gControllers[controllerIdx].buttonPressed & START_BUTTON) != 0)) {
// this is certainly a way to write these...
switch (gMenuSelection) {
case COURSE_SELECT_MENU:
@@ -188,37 +193,37 @@ void func_800B0350(void) {
osViSetSpecialFeatures(sVIGammaOffDitherOn);
switch (gMenuSelection) {
case OPTIONS_MENU:
func_800B053C(&gControllers[controllerIdx], controllerIdx);
options_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case DATA_MENU:
func_800B13B0(&gControllers[controllerIdx], controllerIdx);
data_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case COURSE_DATA_MENU:
func_800B15AC(&gControllers[controllerIdx], controllerIdx);
course_data_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case LOGO_INTRO_MENU:
func_800B1C40(&gControllers[controllerIdx], controllerIdx);
logo_intro_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case CONTROLLER_PAK_MENU:
if (controllerIdx == 0) {
func_800B1C90(&gControllers[controllerIdx], controllerIdx);
if (controllerIdx == PLAYER_ONE) {
controller_pak_menu_act(&gControllers[controllerIdx], controllerIdx);
}
break;
case START_MENU_FROM_QUIT:
case START_MENU:
func_800B20F4(&gControllers[controllerIdx], controllerIdx);
splash_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case MAIN_MENU_FROM_QUIT:
case MAIN_MENU:
func_800B29D8(&gControllers[controllerIdx], controllerIdx);
main_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case PLAYER_SELECT_MENU_FROM_QUIT:
case PLAYER_SELECT_MENU:
func_800B3554(&gControllers[controllerIdx], controllerIdx);
player_select_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
case COURSE_SELECT_MENU_FROM_QUIT:
case COURSE_SELECT_MENU:
func_800B3B58(&gControllers[controllerIdx], controllerIdx);
course_select_menu_act(&gControllers[controllerIdx], controllerIdx);
break;
}
}
@@ -234,7 +239,7 @@ enum MenuOptionsCursorPositions {
};
// navigation of the options menu
void func_800B053C(struct Controller *controller, u16 arg1) {
void options_menu_act(struct Controller *controller, u16 arg1) {
u16 btnAndStick; // sp3E
struct_8018D9E0_entry *sp38;
s32 res;
@@ -648,11 +653,11 @@ void func_800B053C(struct Controller *controller, u16 arg1) {
// L800B13A0 return
}
#else
GLOBAL_ASM("asm/non_matchings/menus/func_800B053C.s")
GLOBAL_ASM("asm/non_matchings/menus/options_menu_act.s")
#endif
// Handle navigating the data menu interface
void func_800B13B0(struct Controller *controller, UNUSED u16 arg1) {
void data_menu_act(struct Controller *controller, UNUSED u16 arg1) {
u16 buttonAndStickPress = (controller->buttonPressed | controller->stickPressed);
// Make pressing Start have the same effect as pressing A
@@ -712,7 +717,7 @@ void func_800B13B0(struct Controller *controller, UNUSED u16 arg1) {
}
}
void func_800B15AC(struct Controller *controller, UNUSED u16 arg1) {
void course_data_menu_act(struct Controller *controller, UNUSED u16 arg1) {
u16 btnAndStick; // sp2E
struct_8018D9E0_entry *sp28;
CourseTimeTrialRecords *sp24;
@@ -874,17 +879,21 @@ void func_800B15AC(struct Controller *controller, UNUSED u16 arg1) {
}
}
// Handle controller input during the logo screen
void func_800B1C40(struct Controller *arg0, UNUSED u16 arg1) {
u16 sp1E = arg0->buttonPressed | arg0->stickPressed;
/**
* On input skip logo screen
**/
void logo_intro_menu_act(struct Controller *arg0, UNUSED u16 arg1) {
u16 anyInput = arg0->buttonPressed | arg0->stickPressed;
if ((func_800B4520() == 0) && (sp1E != 0)) {
if ((func_800B4520() == 0) && (anyInput)) {
// Audio related
func_800CA388(0x3C);
func_8009E1E4();
}
}
void func_800B1C90(struct Controller* controller, UNUSED u16 arg1) {
void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) {
u16 buttonAndStickPress;
OSPfsState* osPfsState;
s32 selectedTableRow;
@@ -1026,7 +1035,7 @@ void func_800B1C90(struct Controller* controller, UNUSED u16 arg1) {
}
}
void func_800B20F4(struct Controller *controller, u16 arg1) {
void splash_menu_act(struct Controller *controller, u16 arg1) {
u16 btnAndStick;
u16 i;
s32 sp28;
@@ -1279,7 +1288,7 @@ void func_800B28C8(void) {
#ifdef NON_MATCHING
// nonmatching: regalloc; arg1 is not AND-ed back into $a1, reg chaos follows
void func_800B29D8(struct Controller *controller, u16 arg1) {
void main_menu_act(struct Controller *controller, u16 arg1) {
u16 btnAndStick; // sp2E
s32 sp28;
s32 sp24;
@@ -1514,7 +1523,7 @@ void func_800B29D8(struct Controller *controller, u16 arg1) {
}
}
#else
GLOBAL_ASM("asm/non_matchings/menus/func_800B29D8.s")
GLOBAL_ASM("asm/non_matchings/menus/main_menu_act.s")
#endif
// check if there is no currently selected and/or hovered character at grid position `gridId`
@@ -1531,7 +1540,7 @@ s32 is_character_spot_free(s32 gridId) {
#ifdef NON_MATCHING
// grid positions are from right to left, then top to bottom
// nonmatching: the gCharacterGridSelections pointer is not promoted to $s0
void func_800B3554(struct Controller *controller, u16 arg1) {
void player_select_menu_act(struct Controller *controller, u16 arg1) {
u16 btnAndStick; // sp36
s8 selected;
s8 i;
@@ -1698,11 +1707,11 @@ void func_800B3554(struct Controller *controller, u16 arg1) {
// L800B3B44
}
#else
GLOBAL_ASM("asm/non_matchings/menus/func_800B3554.s")
GLOBAL_ASM("asm/non_matchings/menus/player_select_menu_act.s")
#endif
// Handle navigating the course menu interface
void func_800B3B58(struct Controller *arg0, u16 arg1) {
void course_select_menu_act(struct Controller *arg0, u16 arg1) {
u16 buttonAndStickPress = (arg0->buttonPressed | arg0->stickPressed);
if ((gEnableDebugMode == 0) && ((buttonAndStickPress & 0x1000) != 0)) {
@@ -1868,11 +1877,11 @@ void func_800B3F74(s32 menuSelection) {
func_800B5F30();
func_8000F0E0();
if (D_800DC50C != 0) {
if (gGamestate != 0) {
func_800CA008(0, 0);
func_800CB2C4();
D_800DC50C = 0;
D_800DC524 = 0;
gGamestate = 0;
gGamestateNext = 0;
func_800C8EAC(2);
}
@@ -1921,7 +1930,7 @@ void func_800B3F74(s32 menuSelection) {
case 0:
{
D_8018EDEE = 1;
if (D_800DC50C == 0) {
if (gGamestate == 0) {
for (i = 0; i < 4; i++) {
if (i < D_8018EDF3) {
gCharacterGridSelections[i] = i + 1;
@@ -1935,8 +1944,8 @@ void func_800B3F74(s32 menuSelection) {
} else {
func_800CA008(0, 0);
func_800CB2C4();
D_800DC50C = 0;
D_800DC524 = 0;
gGamestate = 0;
gGamestateNext = 0;
func_800C8EAC(2);
for (i = 0; i < ARRAY_COUNT(D_8018EDE8); i++) {
D_8018EDE8[i] = FALSE;
@@ -1972,11 +1981,11 @@ void func_800B3F74(s32 menuSelection) {
}
D_8018EDEC = 1;
}
if (D_800DC50C != 0) {
if (gGamestate != 0) {
func_800CA008(0, 0);
func_800CB2C4();
D_800DC50C = 0;
D_800DC524 = 0;
gGamestate = 0;
gGamestateNext = 0;
func_800C8EAC(2);
}
play_sound2(0x49009013);
@@ -2008,6 +2017,7 @@ void func_800B44BC(void) {
}
}
// Likely checks that the user is actually in the menus and not racing.
s32 func_800B4520(void) {
if ((D_8018E7B0 == 2) || (D_8018E7B0 == 3) || (D_8018E7B0 == 4) || (D_8018E7B0 == 7)) {
+1 -1
View File
@@ -7,7 +7,7 @@
#include <defines.h>
/* functions */
void func_800B0350(void);
void update_menus(void);
void func_800B3F74(s32 menuSelection);
void func_800B44BC(void);
s32 func_800B4520(void);
+2 -2
View File
@@ -61,7 +61,7 @@ extern f32 D_80150118;
extern u16 D_800DC518;
extern u16 D_8015011E;
extern float gCourseTimer;
extern float D_800DC594;
extern float gVBlankTimer;
extern s32 gScreenModeSelection;
extern s32 D_8018D2AC;
extern s32 gActiveScreenMode;
@@ -1071,7 +1071,7 @@ void func_8028FCBC(void) {
D_802BA032 = 0;
D_8015011E = 0;
gCourseTimer = 0.0f;
D_800DC594 = 0.0f;
gVBlankTimer = 0.0f;
D_800DC5B0 = 1;
D_800DC5B4 = 1;
D_802BA034 = 0.008f;
+4 -4
View File
@@ -230,7 +230,7 @@ void func_802911C4(void) {
#ifdef MIPS_TO_C
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
? func_802A3E3C(); /* extern */
? init_rdp(); /* extern */
? func_802B4FF8(? *, ?); /* extern */
? mtxf_identity(? *, s32 *, Gfx **); /* extern */
? mtxf_translate(? *, f32 *, Gfx **); /* extern */
@@ -385,7 +385,7 @@ void func_8029122C(void *arg0, s32 *arg1) {
Gfx *phi_v1_3;
sp268 = arg0->unk8;
func_802A3E3C();
init_rdp();
sp21A = arg0->unk38;
sp218 = arg0->unk4->unk26;
temp_t3 = arg0->unk36;
@@ -2010,7 +2010,7 @@ extern Gfx D_06023B68[];
extern Vec3f D_8015F590;
extern u16 D_800DC5BC; /* unable to generate initializer */
extern s16 D_800DC5C8; /* unable to generate initializer */
extern s32 D_800DC50C;
extern s32 gGamestate;
extern s32 gModeSelection;
extern u16 gNumActors;
extern s16 D_8015F6EC;
@@ -2150,7 +2150,7 @@ void func_80295D88(void) {
func_802AF8BC(0x07002068, -0x6A, 255, 255, 255);
func_802AF8BC(0x07001E18, -0x6A, 255, 255, 255);
func_802AF8BC(0x07001318, 255, 255, 255, 0);
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_802AF8BC(0x07001FB8, -0x6A, 255, 255, 255);
}
break;
+51 -43
View File
@@ -8,7 +8,7 @@
#include <config.h>
#include "camera.h"
void func_802A41D4();
void select_framebuffer();
extern Gfx *gDisplayListHead;
@@ -19,8 +19,8 @@ extern struct UnkStruct_800DC5EC *D_800DC5F8;
extern u16 D_800DC5B0;
void func_802A3E3C();
extern s32 D_800DC524;
void init_rdp();
extern s32 gGamestateNext;
extern s16 gIsInQuitToMenuTransition;
extern u16 gQuitToMenuTransitionCounter;
extern s32 gMenuSelection;
@@ -133,8 +133,8 @@ void func_802A38B4(void) {
void *temp_v0;
void *temp_v0_2;
func_802A3E3C();
func_802A41D4();
init_rdp();
select_framebuffer();
gDPFullSync(gDisplayListHead++);
gSPEndDisplayList(gDisplayListHead++);
@@ -143,8 +143,8 @@ void func_802A38B4(void) {
gQuitToMenuTransitionCounter--;
return;
}
D_800DC524 = gMenuSelectionFromQuit;
D_800DC50C = 255;
gGamestateNext = gMenuSelectionFromQuit;
gGamestate = 255;
gIsInQuitToMenuTransition = 0;
gQuitToMenuTransitionCounter = 0;
D_800E86A4 = 1;
@@ -208,7 +208,10 @@ void func_802A39E0(struct UnkStruct_800DC5EC *arg0) {
gDPSetDepthSource(gDisplayListHead++, G_ZS_PIXEL);
}
void func_802A3CB0(void) {
/**
* Initialize the z-buffer for the current frame.
*/
void init_z_buffer(void) {
gDPPipeSync(gDisplayListHead++);
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
gDPSetDepthImage(gDisplayListHead++, D_801502B4);
@@ -223,8 +226,10 @@ void func_802A3CB0(void) {
gDPSetDepthSource(gDisplayListHead++, G_ZS_PIXEL);
}
void func_802A3E3C(void) {
/**
* Sets the initial RDP (Reality Display Processor) rendering settings.
**/
void init_rdp(void) {
gDPPipeSync(gDisplayListHead++);
gDPPipelineMode(gDisplayListHead++, G_PM_1PRIMITIVE);
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -242,7 +247,7 @@ void func_802A3E3C(void) {
gDPSetColorDither(gDisplayListHead++, G_CD_DISABLE);
gDPPipeSync(gDisplayListHead++);
gSPClipRatio(gDisplayListHead++);
// FRUSTRATIO_1
// F3DEX2 may need FRUSTRATIO_1 as an argument to clip ratio.
}
UNUSED void func_802A40A4(void) {}
@@ -254,26 +259,29 @@ UNUSED void func_802A40CC(void) {}
UNUSED void func_802A40D4(void) {}
UNUSED void func_802A40DC(void) {}
UNUSED s32 func_802A40E4(void) {
#define G_CLEAR_ALL_MODES 0xFFFFFFFF
UNUSED s32 set_viewport2(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_800DC5EC->viewport));
gSPClearGeometryMode(gDisplayListHead++, 0xFFFFFFFF);
gSPClearGeometryMode(gDisplayListHead++, G_CLEAR_ALL_MODES);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE |
G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH | G_CLIPPING);
}
void func_802A4160(void) {
void set_viewport(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_802B8880));
gSPClearGeometryMode(gDisplayListHead++, 0xFFFFFFFF);
gSPClearGeometryMode(gDisplayListHead++, G_CLEAR_ALL_MODES);
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
}
extern s32 D_800DC5D0;
extern s32 D_800DC5D4;
extern s32 D_800DC5D8;
void func_802A41D4(void) {
/**
* Tells the RDP which of the three framebuffers it shall draw to.
*/
void select_framebuffer(void) {
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, VIRTUAL_TO_PHYSICAL(gPhysicalFramebuffers[sRenderingFramebuffer]));
gDPSetFillColor(gDisplayListHead++, ((D_800DC5D0 << 8 & 0xF800 | (D_800DC5D4 * 8) & 0x7C0 | D_800DC5D8 >> 2 & 0x3E | 1) << 16) |
(D_800DC5D0 << 8 & 0xF800 | (D_800DC5D4 * 8) & 0x7C0 | (D_800DC5D8 >> 2) & 0x3E | 1));
@@ -456,7 +464,7 @@ extern struct GfxPool *gGfxPool;
void func_802A487C(Vtx *arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3, UNUSED s32 arg4) {
func_802A3E3C();
init_rdp();
if (gCurrentCourseId != COURSE_RAINBOW_ROAD) {
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
@@ -472,7 +480,7 @@ void func_802A487C(Vtx *arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3,
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//? func_802A3E3C(); // extern
//? init_rdp(); // extern
//? func_802A450C(); // extern
//? func_802B5564(? *, ? *, s32, s32, f32, f32, f32); // extern
//? func_802B5794(? *, void *, void *); // extern
@@ -527,7 +535,7 @@ void func_802A4A0C(Vtx *arg0, struct UnkStruct_800DC5EC *arg1, s32 arg2, s32 arg
arg0->v.ob[1] = temp_t5; // = temp_t5; //unk22
arg0->v.ob[4] = temp_t5;//unk42 = temp_t5;
arg0->v.ob[7] = temp_t5;//unk72 = temp_t5;
func_802A3E3C();
init_rdp();
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING);
@@ -586,7 +594,7 @@ extern s32 gScreenModeSelection;
void func_802A4D18(void) {
f32 phi_f10;
if (D_800DC50C != RACING) {
if (gGamestate != RACING) {
D_8015014C = 6800.0f; // D_802B9BB4
D_80150150 = 3.0f;
} else {
@@ -692,7 +700,7 @@ extern u16 D_800DC5B4;
void func_802A5004(void) {
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5F0);
gSPClearGeometryMode(gDisplayListHead++, 0xFFFFFFFF);
@@ -710,7 +718,7 @@ void func_802A5004(void) {
void func_802A50EC(void) {
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5EC);
gSPClearGeometryMode(gDisplayListHead++, 0xFFFFFFFF);
@@ -727,7 +735,7 @@ void func_802A50EC(void) {
void func_802A51D4(void) {
func_802A3E3C();
init_rdp();
func_802A39E0(D_800DC5EC);
func_802A3730(D_800DC5EC);
@@ -744,7 +752,7 @@ void func_802A51D4(void) {
void func_802A52BC(void) {
func_802A3E3C();
init_rdp();
func_802A39E0(D_800DC5F0);
func_802A3730(D_800DC5F0);
@@ -762,17 +770,17 @@ void func_802A52BC(void) {
void func_802A53A4(void) {
move_segment_table_to_dmem();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5EC);
gSPClearGeometryMode(gDisplayListHead++, 0xFFFFFFFF);
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
func_802A3CB0();
func_802A41D4();
init_z_buffer();
select_framebuffer();
if (D_800DC5B4 != 0) {
func_802A4A0C(&D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
if (D_800DC50C != CREDITS_SEQUENCE) {
if (gGamestate != CREDITS_SEQUENCE) {
func_80057FC4(0);
}
func_802A487C(&D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
@@ -782,7 +790,7 @@ void func_802A53A4(void) {
void func_802A54A8(void) {
func_802A3E3C();
init_rdp();
func_802A39E0(D_800DC5EC);
func_802A3730(D_800DC5EC);
@@ -799,7 +807,7 @@ void func_802A54A8(void) {
void func_802A5590(void) {
func_802A3E3C();
init_rdp();
func_802A39E0(D_800DC5F0);
func_802A3730(D_800DC5F0);
@@ -816,7 +824,7 @@ void func_802A5590(void) {
void func_802A5678(void) {
func_802A3E3C();
init_rdp();
func_802A39E0(D_800DC5F4);
func_802A3730(D_800DC5F4);
@@ -835,7 +843,7 @@ void func_802A5678(void) {
void func_802A5760(void) {
func_802A3E3C();
init_rdp();
gSPClearGeometryMode(gDisplayListHead++, 0xFFFFFFFF);
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
@@ -883,7 +891,7 @@ void func_802A59A4(void) {
s32 sp5C[8];
func_802A53A4();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5EC);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
@@ -933,7 +941,7 @@ void func_802A5CB4(void) {
s32 sp58[8];
func_802A50EC();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5EC);
@@ -983,7 +991,7 @@ void func_802A5FAC(void) {
s32 sp58[8];
func_802A5004();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5F0);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
@@ -1032,7 +1040,7 @@ void func_802A62A4(void) {
func_802A51D4();
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5EC);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
@@ -1080,7 +1088,7 @@ void func_802A65B8(void) {
func_802A52BC();
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5F0);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
guPerspective(&gGfxPool->mtxPool[2], &sp9A[17], D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
@@ -1125,7 +1133,7 @@ void func_802A68CC(void) {
s32 sp58[8];
func_802A54A8();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5EC);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
@@ -1171,7 +1179,7 @@ void func_802A6BB0(void) {
s32 sp58[8];
func_802A5590();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5F0);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
@@ -1217,7 +1225,7 @@ void func_802A6E94(void) {
s32 sp58[8];
func_802A5678();
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5F4);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
guPerspective(&gGfxPool->mtxPool[3], &sp9A[17], D_80150130[2], D_80150148, D_80150150, D_8015014C, 1.0f);
@@ -1271,7 +1279,7 @@ void func_802A7178(void) {
return;
}
func_802A3E3C();
init_rdp();
func_802A3730(D_800DC5F8);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
+2 -2
View File
@@ -310,7 +310,7 @@ void spawn_player(Player *player, s8 playerIndex, f32 arg2, f32 arg3, f32 arg4,
void func_80039AE4(void) {
switch (gActiveScreenMode) {
case SCREEN_MODE_1P:
if (D_800DC50C == ENDING_SEQUENCE) {
if (gGamestate == ENDING_SEQUENCE) {
D_80165578 = 0x898;
D_8016557A = 0;
D_8016557C = 0x384;
@@ -1041,7 +1041,7 @@ void func_8003D080(void) {
Player* ptr = &gPlayers[0];
func_8005D290();
if (D_800DC50C == 5) {
if (gGamestate == 5) {
func_8003CD78();
} else {
func_8003C0F0();
+2 -2
View File
@@ -587,12 +587,12 @@ void func_80005E6C(void) {
}
}
void func_80005F44(void) {
void staff_ghosts_loop(void) {
if (D_8015F890 == 1) {
func_80005E6C();
return;
}
if (D_80162DF0 == 0) {
if (!D_80162DF0) {
func_80005B18();
return;
}