summaryrefslogtreecommitdiff
path: root/src/racing
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-01-23 11:22:07 -0700
committerGitHub <noreply@github.com>2025-01-23 11:22:07 -0700
commit1f189dfa804a05177f99dda1044898eb63fdcb3f (patch)
tree598e0a6c26a5554afd1fcbcd801079fd1df090d3 /src/racing
parent24ecfc3db43bfa606f41c42ef8778f96b5047c6b (diff)
Game.cpp and World.cpp Cleanup (#159)
* Remove CProperties and delete dup Properties from World.h * Improvement * Fix compile * Cleanup * Document gRaceState * wip cleanup * compile * Impl PlayerBombKart * Rename CourseManager_ to CM_ * Finish renames m_ to CM_ * cleanup * Remove extra printf --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/racing')
-rw-r--r--src/racing/actors.c85
-rw-r--r--src/racing/actors_extended.c6
-rw-r--r--src/racing/memory.c2
-rw-r--r--src/racing/race_logic.c81
-rw-r--r--src/racing/render_courses.c12
-rw-r--r--src/racing/skybox_and_splitscreen.c9
6 files changed, 95 insertions, 100 deletions
diff --git a/src/racing/actors.c b/src/racing/actors.c
index caf623554..4b586cf75 100644
--- a/src/racing/actors.c
+++ b/src/racing/actors.c
@@ -55,7 +55,7 @@ void cleanup_red_and_green_shells(struct ShellActor* shell) {
// try finding the dead green shell
for (actorIndex = gNumPermanentActors; actorIndex < ACTOR_LIST_SIZE; actorIndex++) {
- compare = (struct ShellActor*) m_GetActor(actorIndex);
+ compare = (struct ShellActor*) CM_GetActor(actorIndex);
if ((shell != compare) && !(compare->flags & ACTOR_IS_NOT_EXPIRED) && (compare->type == ACTOR_GREEN_SHELL)) {
if (compare->state == MOVING_SHELL) {
delete_actor_in_unexpired_actor_list(actorIndex);
@@ -68,7 +68,7 @@ void cleanup_red_and_green_shells(struct ShellActor* shell) {
// try finding the dead red shell
for (actorIndex = gNumPermanentActors; actorIndex < ACTOR_LIST_SIZE; actorIndex++) {
- compare = (struct ShellActor*) m_GetActor(actorIndex);
+ compare = (struct ShellActor*) CM_GetActor(actorIndex);
if ((shell != compare) && !(compare->flags & ACTOR_IS_NOT_EXPIRED) && (compare->type == ACTOR_RED_SHELL)) {
switch (compare->state) {
case MOVING_SHELL:
@@ -90,7 +90,7 @@ void cleanup_red_and_green_shells(struct ShellActor* shell) {
// try finding the green shell
for (actorIndex = gNumPermanentActors; actorIndex < ACTOR_LIST_SIZE; actorIndex++) {
- compare = (struct ShellActor*) m_GetActor(actorIndex);
+ compare = (struct ShellActor*) CM_GetActor(actorIndex);
if ((shell != compare) && (compare->type == ACTOR_GREEN_SHELL)) {
switch (compare->state) {
case MOVING_SHELL:
@@ -105,7 +105,7 @@ void cleanup_red_and_green_shells(struct ShellActor* shell) {
// try finding the red or blue shell
for (actorIndex = gNumPermanentActors; actorIndex < ACTOR_LIST_SIZE; actorIndex++) {
- compare = (struct ShellActor*) m_GetActor(actorIndex);
+ compare = (struct ShellActor*) CM_GetActor(actorIndex);
if ((shell != compare) && (compare->type == ACTOR_RED_SHELL)) {
switch (compare->state) {
case MOVING_SHELL:
@@ -838,7 +838,7 @@ void spawn_piranha_plants(struct ActorSpawnData* spawnData) {
startingPos[1] = temp_s0->pos[1];
startingPos[2] = temp_s0->pos[2];
temp = add_actor_to_empty_slot(startingPos, startingRot, startingVelocity, ACTOR_PIRANHA_PLANT);
- temp_v1 = (struct PiranhaPlant*) m_GetActor(temp);
+ temp_v1 = (struct PiranhaPlant*) CM_GetActor(temp);
temp_v1->visibilityStates[0] = 0;
temp_v1->visibilityStates[1] = 0;
temp_v1->visibilityStates[2] = 0;
@@ -867,7 +867,7 @@ void spawn_palm_trees(struct ActorSpawnData* spawnData) {
startingPos[1] = temp_s0->pos[1];
startingPos[2] = temp_s0->pos[2];
temp = add_actor_to_empty_slot(startingPos, startingRot, startingVelocity, ACTOR_PALM_TREE);
- temp_v1 = (struct PalmTree*) m_GetActor(temp);
+ temp_v1 = (struct PalmTree*) CM_GetActor(temp);
temp_v1->variant = temp_s0->someId;
check_bounding_collision((Collision*) &temp_v1->unk30, 5.0f, temp_v1->pos[0], temp_v1->pos[1], temp_v1->pos[2]);
@@ -934,7 +934,7 @@ void spawn_foliage(struct ActorSpawnData* actor) {
}
}
- temp_s0 = m_GetActor(add_actor_to_empty_slot(position, rotation, velocity, actorType));
+ temp_s0 = CM_GetActor(add_actor_to_empty_slot(position, rotation, velocity, actorType));
if (gGamestate == CREDITS_SEQUENCE) {
func_802976D8(temp_s0->rot);
} else {
@@ -977,13 +977,13 @@ void spawn_all_item_boxes(struct ActorSpawnData* spawnData) {
// It's either the ItemBox or the SEGMENT/OFFSET variables.
// itemBox = (struct ItemBox *) GET_ACTOR(temp_s1);
- m_GetActor(temp_s1)->unk_08 = temp_f0;
+ CM_GetActor(temp_s1)->unk_08 = temp_f0;
// itemBox->resetDistance = temp_f0;
- m_GetActor(temp_s1)->velocity[0] = startingPos[1];
+ CM_GetActor(temp_s1)->velocity[0] = startingPos[1];
// itemBox->origY = startingPos[1];
- m_GetActor(temp_s1)->pos[1] = temp_f0 - 20.0f;
+ CM_GetActor(temp_s1)->pos[1] = temp_f0 - 20.0f;
// itemBox->pos[1] = temp_f0 - 20.0f;
temp_s0++;
@@ -1011,7 +1011,7 @@ void init_kiwano_fruit(void) {
}
phi_s0 = add_actor_to_empty_slot(sp64, sp50, sp58, ACTOR_KIWANO_FRUIT);
- actor = m_GetActor(phi_s0);
+ actor = CM_GetActor(phi_s0);
actor->unk_04 = i;
}
}
@@ -1025,7 +1025,7 @@ void destroy_all_actors(void) {
s32 i;
gNumActors = 0;
for (i = 0; i < ACTOR_LIST_SIZE; i++) {
- struct Actor* actor = m_GetActor(i);
+ struct Actor* actor = CM_GetActor(i);
actor->flags = 0;
actor->type = 0;
actor->unk_04 = 0;
@@ -1044,12 +1044,11 @@ void spawn_course_actors(void) {
struct RailroadCrossing* rrxing;
gNumPermanentActors = 0;
- CourseManager_SpawnActors();
if (gModeSelection != BATTLE) {
- if (!cm_DoesFinishlineExist()) {
+ if (!CM_DoesFinishlineExist()) {
printf("\n[actors.c] COURSE MISSING THE FINISHLINE\n");
- printf(" In the course class SpawnActors() function make sure to include:\n");
+ printf(" In the Course class BeginPlay() function make sure to include:\n");
printf(" gWorldInstance.AddActor(new AFinishline());\n\n");
printf("\n Otherwise, course textures may glitch out or other strange issues may occur.\n");
}
@@ -1211,16 +1210,14 @@ void init_actors_and_load_textures(void) {
dma_textures(gTexture671A88, 0x00000400U, 0x00000800U);
dma_textures(gTexture6774D8, 0x00000400U, 0x00000800U);
- CourseManager_LoadTextures();
+ CM_LoadTextures();
init_red_shell_texture();
destroy_all_actors();
CM_CleanWorld();
- spawn_course_actors();
-
- CourseManager_VehiclesSpawn();
- // spawn_course_vehicles();
+ CM_BeginPlay();
+ spawn_course_actors();
}
void play_sound_before_despawn(struct Actor* actor) {
@@ -1265,7 +1262,7 @@ s16 try_remove_destructable_item(Vec3f pos, Vec3s rot, Vec3f velocity, s16 actor
// try removing a red shell, green shell, banana, or a fake item box if the actor is expired
for (actorIndex = gNumPermanentActors; actorIndex < ACTOR_LIST_SIZE; actorIndex++) {
- compare = (struct ShellActor*) m_GetActor(actorIndex);
+ compare = (struct ShellActor*) CM_GetActor(actorIndex);
if (!(compare->flags & ACTOR_IS_NOT_EXPIRED)) {
switch (compare->type) {
case ACTOR_RED_SHELL:
@@ -1322,7 +1319,7 @@ s16 try_remove_destructable_item(Vec3f pos, Vec3s rot, Vec3f velocity, s16 actor
// will remove the oldest destructable actor in the list
for (actorIndex = gNumPermanentActors; actorIndex < ACTOR_LIST_SIZE; actorIndex++) {
- compare = (struct ShellActor*) m_GetActor(actorIndex);
+ compare = (struct ShellActor*) CM_GetActor(actorIndex);
switch (compare->type) {
case ACTOR_RED_SHELL:
switch (compare->state) {
@@ -1382,22 +1379,22 @@ s16 try_remove_destructable_item(Vec3f pos, Vec3s rot, Vec3f velocity, s16 actor
s16 add_actor_to_empty_slot(Vec3f pos, Vec3s rot, Vec3f velocity, s16 actorType) {
size_t index;
- // if (gNumActors >= m_GetActorSize()) {
+ // if (gNumActors >= CM_GetActorSize()) {
// return try_remove_destructable_item(pos, rot, velocity, actorType);
// }
// Cleanup unused actors
- for (index = 0; index < m_GetActorSize(); index++) {
- // if (m_GetActor(index)->flags == 0) {
+ for (index = 0; index < CM_GetActorSize(); index++) {
+ // if (CM_GetActor(index)->flags == 0) {
//! @todo Commented out because deletes too soon.
- // m_DeleteActor(index);
+ // CM_DeleteActor(index);
// gNumActors--;
//}
}
gNumActors++;
- struct Actor* actor = m_AddBaseActor();
+ struct Actor* actor = CM_AddBaseActor();
actor_init(actor, pos, rot, velocity, actorType);
- return (s16) m_GetActorSize() - 1; // Return current index;
+ return (s16) CM_GetActorSize() - 1; // Return current index;
}
UNUSED s16 spawn_actor_at_pos(Vec3f pos, s16 actorType) {
@@ -1818,7 +1815,7 @@ void destroy_destructable_actor(struct Actor* actor) {
if (shell->state != GREEN_SHELL_HIT_A_RACER) {
switch (shell->state) {
case MOVING_SHELL:
- delete_actor_in_unexpired_actor_list(m_FindActorIndex(actor));
+ delete_actor_in_unexpired_actor_list(CM_FindActorIndex(actor));
/* fallthrough */
case HELD_SHELL:
case RELEASED_SHELL:
@@ -1847,7 +1844,7 @@ void destroy_destructable_actor(struct Actor* actor) {
case BLUE_SHELL_LOCK_ON:
case BLUE_SHELL_TARGET_ELIMINATED:
func_800C9EF4(shell->pos, SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x08));
- delete_actor_in_unexpired_actor_list(m_FindActorIndex(actor));
+ delete_actor_in_unexpired_actor_list(CM_FindActorIndex(actor));
/* fallthrough */
case HELD_SHELL:
case RELEASED_SHELL:
@@ -1872,7 +1869,7 @@ void destroy_destructable_actor(struct Actor* actor) {
case GREEN_SHELL_HIT_A_RACER:
case BLUE_SHELL_LOCK_ON:
case BLUE_SHELL_TARGET_ELIMINATED:
- delete_actor_in_unexpired_actor_list(m_FindActorIndex(actor));
+ delete_actor_in_unexpired_actor_list(CM_FindActorIndex(actor));
/* fallthrough */
case HELD_SHELL:
case RELEASED_SHELL:
@@ -2006,7 +2003,7 @@ void evaluate_collision_between_player_actor(Player* player, struct Actor* actor
f32 temp_f0;
f32 temp_f2;
- m_ActorCollision(player, actor);
+ CM_ActorCollision(player, actor);
temp_lo = player - gPlayerOne;
switch (actor->type) {
@@ -2223,7 +2220,7 @@ void evaluate_collision_for_players_and_actors(void) {
if (((phi_s1->type & 0x8000) != 0) && ((phi_s1->effects & 0x4000000) == 0)) {
func_802977E4(phi_s1);
for (j = 0; j < ACTOR_LIST_SIZE; j++) {
- temp_a1 = m_GetActor(j);
+ temp_a1 = CM_GetActor(j);
if ((phi_s1->effects & 0x4000000) == 0) {
// temp_v0 = temp_a1->unk2;
@@ -2244,7 +2241,7 @@ void evaluate_collision_for_destructible_actors(void) {
UNUSED s32 pad;
for (i = gNumPermanentActors; i < (ACTOR_LIST_SIZE); i++) {
- actor1 = m_GetActor(i);
+ actor1 = CM_GetActor(i);
if ((actor1->flags & 0x8000) == 0) {
continue;
@@ -2261,7 +2258,7 @@ void evaluate_collision_for_destructible_actors(void) {
case ACTOR_FAKE_ITEM_BOX:
for (j = i + 1; j < ACTOR_LIST_SIZE; j++) {
- actor2 = m_GetActor(j);
+ actor2 = CM_GetActor(j);
if ((actor1->flags & 0x8000) == 0) {
continue;
@@ -2313,7 +2310,7 @@ void evaluate_collision_for_destructible_actors(void) {
}
void func_802A1064(struct FakeItemBox* fake_item_box) {
- if ((u32) (m_FindActorIndex(fake_item_box)) <= (u32) ACTOR_LIST_SIZE) {
+ if ((u32) (CM_FindActorIndex(fake_item_box)) <= (u32) ACTOR_LIST_SIZE) {
if (((fake_item_box->flags & 0x8000) != 0) && (fake_item_box->type == ACTOR_FAKE_ITEM_BOX)) {
fake_item_box->state = 1;
fake_item_box->targetY = func_802ABEAC(&fake_item_box->unk30, fake_item_box->pos) + 8.66f;
@@ -2340,7 +2337,7 @@ void init_actor_hot_air_balloon_item_box(f32 x, f32 y, f32 z) {
pos[1] = y;
pos[2] = z;
id = add_actor_to_empty_slot(pos, rot, velocity, ACTOR_HOT_AIR_BALLOON_ITEM_BOX);
- gActorHotAirBalloonItemBox = m_GetActor(id);
+ gActorHotAirBalloonItemBox = CM_GetActor(id);
}
#include "actors/item_box/update.inc.c"
@@ -2365,8 +2362,8 @@ void render_item_boxes(struct UnkStruct_800DC5EC* arg0) {
s32 i;
D_8015F8DC = 0;
- for (i = 0; i < m_GetActorSize(); i++) {
- actor = m_GetActor(i);
+ for (i = 0; i < CM_GetActorSize(); i++) {
+ actor = CM_GetActor(i);
if (actor->flags == 0) {
continue;
@@ -2420,15 +2417,15 @@ void render_course_actors(struct UnkStruct_800DC5EC* arg0) {
}
D_8015F8E0 = 0;
- for (i = 0; i < m_GetActorSize(); i++) {
- actor = m_GetActor(i);
+ for (i = 0; i < CM_GetActorSize(); i++) {
+ actor = CM_GetActor(i);
if (actor->flags == 0) {
continue;
}
switch (actor->type) {
default: // Draw custom actor
- CourseManager_DrawActors(D_800DC5EC->camera, actor);
+ CM_DrawActors(D_800DC5EC->camera, actor);
break;
case ACTOR_TREE_MARIO_RACEWAY:
render_actor_tree_mario_raceway(camera, sBillBoardMtx, actor);
@@ -2541,9 +2538,9 @@ void render_course_actors(struct UnkStruct_800DC5EC* arg0) {
void update_course_actors(void) {
struct Actor* actor;
s32 i;
- for (i = 0; i < m_GetActorSize(); i++) {
+ for (i = 0; i < CM_GetActorSize(); i++) {
- actor = m_GetActor(i);
+ actor = CM_GetActor(i);
if (actor->flags == 0) {
continue;
}
diff --git a/src/racing/actors_extended.c b/src/racing/actors_extended.c
index b25d5bf04..5493a4efa 100644
--- a/src/racing/actors_extended.c
+++ b/src/racing/actors_extended.c
@@ -592,9 +592,9 @@ s32 init_triple_shell(TripleShellParent* parent, Player* player, s16 shellType,
shell->rotVelocity = 0;
shell->rotAngle = -0x8000;
shell->playerId = player - gPlayerOne;
- shell->parentIndex = m_FindActorIndex(parent);
+ shell->parentIndex = CM_FindActorIndex(parent);
shell->shellId = shellId;
- parent->shellIndices[shellId] = (f32) m_FindActorIndex(shell);
+ parent->shellIndices[shellId] = (f32) CM_FindActorIndex(shell);
return 1;
}
@@ -721,7 +721,7 @@ void func_802B2914(struct BananaBunchParent* banana_bunch, Player* player, s16 b
func_802B4E30((struct Actor*) newBanana);
newBanana->flags = 0x9000;
newBanana->playerId = player - gPlayerOne;
- newBanana->parentIndex = (struct Actor*) m_FindActorIndex(banana_bunch);
+ newBanana->parentIndex = (struct Actor*) CM_FindActorIndex(banana_bunch);
newBanana->youngerIndex = -1;
newBanana->unk_04 = 0x0014;
newBanana->bananaId = bananaId;
diff --git a/src/racing/memory.c b/src/racing/memory.c
index d54915a3d..1b5f02510 100644
--- a/src/racing/memory.c
+++ b/src/racing/memory.c
@@ -823,7 +823,7 @@ void unpack_tile_sync(Gfx* gfx, u8* args, s8 opcode) {
}
uintptr_t get_texture(size_t offset) {
- course_texture* textures = CourseManager_GetProps()->textures;
+ course_texture* textures = CM_GetProps()->textures;
size_t totalOffset = 0;
while (textures->addr) {
diff --git a/src/racing/race_logic.c b/src/racing/race_logic.c
index a65ff4c85..4b9cf1af9 100644
--- a/src/racing/race_logic.c
+++ b/src/racing/race_logic.c
@@ -80,7 +80,7 @@ void func_8028E028(void) {
break;
}
func_800CA118((u8) gPlayerWinningIndex);
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
D_802BA038 = 10;
}
@@ -225,7 +225,7 @@ void func_8028E438(void) {
func_80019DF4();
} else {
func_80092564();
- D_800DC510 = 7;
+ gRaceState = RACE_EXIT;
}
}
break;
@@ -399,7 +399,7 @@ void func_8028E678(void) {
case 4:
gIsInQuitToMenuTransition = 1;
gQuitToMenuTransitionCounter = 5;
- D_800DC510 = 7;
+ gRaceState = RACE_EXIT;
set_next_course();
break;
}
@@ -407,7 +407,7 @@ void func_8028E678(void) {
void func_8028EC38(s32 arg0) {
gGotoMode = arg0;
- D_800DC510 = 6;
+ gRaceState = RACE_UNK;
func_800CA330(25);
func_800CA388(25);
D_800DC5B4 = 1;
@@ -418,13 +418,14 @@ void func_8028EC38(s32 arg0) {
void func_8028EC98(s32 arg0) {
- if (gScreenModeSelection == SCREEN_MODE_3P_4P_SPLITSCREEN) {
- return;
- }
+ // We want music in mutilplayer
+ //if (gScreenModeSelection == SCREEN_MODE_3P_4P_SPLITSCREEN) {
+ // return;
+ //}
func_800029B0();
- enum MusicSeq sequence = CourseManager_GetProps()->Sequence;
+ enum MusicSeq sequence = CM_GetProps()->Sequence;
if(sequence != MUSIC_SEQ_UNKNOWN){
play_sequence(sequence);
@@ -439,8 +440,8 @@ void start_race(void) {
func_8028EC98(gCurrentCourseId);
}
- if (D_800DC510 == 2) {
- D_800DC510 = 3;
+ if (gRaceState == RACE_STAGING) {
+ gRaceState = RACE_IN_PROGRESS;
}
for (i = 0; i < NUM_PLAYERS; i++) {
@@ -504,7 +505,7 @@ void func_8028EF28(void) {
D_802BA048 = 1;
}
if ((gPlayers[i].type & PLAYER_INVISIBLE_OR_BOMB) == 0) {
- D_800DC510 = 4;
+ gRaceState = RACE_CALCULATE_RANKS;
}
if (gModeSelection == TIME_TRIALS) {
func_80005AE8(player);
@@ -523,7 +524,7 @@ void func_8028EF28(void) {
if (*(gNmiUnknown1 + i) > 99) {
*(gNmiUnknown1 + i) = 99;
}
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
i = gPlayerPositionLUT[1];
gPlayers[i].soundEffects |= 0x200000;
gPlayers[i].type |= PLAYER_KART_AI;
@@ -537,7 +538,7 @@ void func_8028EF28(void) {
*(gNmiUnknown2 + i * 3 + currentPosition) = 99;
}
if (currentPosition == 1) {
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
i = gPlayerPositionLUT[2];
*(gNmiUnknown2 + i * 3 + 2) += 1;
if (*(gNmiUnknown2 + i * 3 + 2) > 99) {
@@ -556,7 +557,7 @@ void func_8028EF28(void) {
*(gNmiUnknown3 + i * 3 + currentPosition) = 99;
}
if (currentPosition == 2) {
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
i = gPlayerPositionLUT[3];
gPlayers[i].soundEffects |= 0x200000;
gPlayers[i].type |= PLAYER_KART_AI;
@@ -610,16 +611,16 @@ void update_race_position_data(void) {
void func_8028F474(void) {
s32 i;
- switch (D_800DC510) {
- case 3:
- case 4:
- case 5:
- case 7:
+ switch (gRaceState) {
+ case RACE_IN_PROGRESS:
+ case RACE_CALCULATE_RANKS:
+ case RACE_FINISHED:
+ case RACE_EXIT:
for (i = 0; i < NUM_PLAYERS; i++) {
func_80009B60(i);
}
- case 1:
- case 2:
+ case RACE_SETUP:
+ case RACE_STAGING:
update_vehicles();
break;
}
@@ -633,7 +634,7 @@ void func_8028F4E8(void) {
func_800CA330(0x19);
func_800CA388(0x19);
gGotoMode = START_MENU_FROM_QUIT;
- D_800DC510 = 6;
+ gRaceState = RACE_UNK;
D_800DC5B4 = 1;
D_800DC5B0 = 1;
D_800DC5B8 = 0;
@@ -816,7 +817,7 @@ void func_8028F970(void) {
void func_8028FBD4(void) {
gGotoMode = START_MENU_FROM_QUIT;
- D_800DC510 = 6;
+ gRaceState = RACE_UNK;
func_800CA330(25);
func_800CA388(25);
D_800DC5B4 = 1;
@@ -856,8 +857,8 @@ void func_8028FCBC(void) {
if (gDemoUseController) {
func_8028FC34();
}
- switch (D_800DC510) {
- case 0:
+ switch (gRaceState) {
+ case RACE_INIT:
if (!gDemoMode) {
if (gModeSelection == GRAND_PRIX) {
func_800C8EF8(11);
@@ -868,7 +869,7 @@ void func_8028FCBC(void) {
}
}
func_80002DAC();
- D_800DC510 = 1;
+ gRaceState = RACE_SETUP;
D_80150118 = 3.0f;
creditsRenderMode = 0;
D_802BA032 = 0;
@@ -890,8 +891,9 @@ void func_8028FCBC(void) {
ply++;
}
D_800DC5B8 = 1;
+
break;
- case 1:
+ case RACE_SETUP:
func_8028F914();
if (D_802BA034 == 1.0f) {
if (gActiveScreenMode != SCREEN_MODE_1P) {
@@ -901,7 +903,7 @@ void func_8028FCBC(void) {
func_802A7728();
}
}
- D_800DC510 = 2;
+ gRaceState = RACE_STAGING;
D_800DC5B0 = 0;
D_800DC5B8 = 1;
CM_SpawnStarterLakitu(); // func_80078F64();
@@ -921,7 +923,7 @@ void func_8028FCBC(void) {
}
func_8028F4E8();
break;
- case 2:
+ case RACE_STAGING:
if (gDemoMode) {
start_race();
}
@@ -930,7 +932,7 @@ void func_8028FCBC(void) {
}
func_8028F4E8();
break;
- case 3:
+ case RACE_IN_PROGRESS:
if (gModeSelection == BATTLE) {
update_player_battle_status();
} else {
@@ -940,8 +942,7 @@ void func_8028FCBC(void) {
func_8028F4E8();
func_8028F970();
break;
- case 4:
-
+ case RACE_CALCULATE_RANKS:
switch (gModeSelection) {
case GRAND_PRIX:
func_8028F4E8();
@@ -952,7 +953,7 @@ void func_8028FCBC(void) {
switch (gScreenModeSelection) {
case SCREEN_MODE_1P:
D_802BA038 = 690;
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
func_8028E298();
break;
case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL:
@@ -968,7 +969,7 @@ void func_8028FCBC(void) {
func_8028E298();
D_802BA038 = 600;
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
}
break;
}
@@ -982,14 +983,14 @@ void func_8028FCBC(void) {
case TIME_TRIALS:
D_802BA038 = 360;
if (D_8015F890 != 0) {
- D_800DC510 = 7;
+ gRaceState = RACE_EXIT;
} else {
- D_800DC510 = 5;
+ gRaceState = RACE_FINISHED;
}
break;
}
break;
- case 5:
+ case RACE_FINISHED:
if (D_802BA038 != 0) {
D_802BA038--;
} else {
@@ -999,7 +1000,7 @@ void func_8028FCBC(void) {
func_8028E678();
} else if (gScreenModeSelection == SCREEN_MODE_1P) {
func_80092564();
- D_800DC510 = 7;
+ gRaceState = RACE_EXIT;
} else {
func_8028E438();
}
@@ -1015,14 +1016,14 @@ void func_8028FCBC(void) {
}
func_8028F4E8();
break;
- case 6:
+ case RACE_UNK:
func_8028F8BC();
if (D_802BA034 <= 0) {
gIsInQuitToMenuTransition = 1;
gQuitToMenuTransitionCounter = 5;
}
break;
- case 7:
+ case RACE_EXIT:
break;
}
}
diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c
index 0671a0cd7..b2d654fb4 100644
--- a/src/racing/render_courses.c
+++ b/src/racing/render_courses.c
@@ -21,6 +21,7 @@
#include "courses/all_course_packed.h"
#include "courses/all_course_offsets.h"
#include "port/Game.h"
+#include "engine/courses/Course.h"
#include "enhancements/collision_viewer.h"
@@ -241,7 +242,7 @@ void func_8029122C(struct UnkStruct_800DC5EC* arg0, s32 playerId) {
}
mtxf_identity(matrix);
render_set_position(matrix, 0);
- CourseManager_DrawWater(arg0, pathCounter, cameraRot, playerDirection);
+ CM_DrawWater(arg0, pathCounter, cameraRot, playerDirection);
// switch (gCurrentCourseId) {
// case COURSE_BOWSER_CASTLE:
// if (gActiveScreenMode != SCREEN_MODE_1P) {
@@ -624,9 +625,7 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) {
gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x07003240)));
// d_course_mario_raceway_packed_dl_14A0
gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070014A0)));
- // printf("LOADING SURFACE MAP\n");
render_course_segments(mario_raceway_dls, arg0);
- // printf("SURFACE MAP LOADED\n");
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
@@ -639,7 +638,6 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) {
gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070000E0)));
// d_course_mario_raceway_packed_dl_160
gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x07000160)));
- // printf("RENDERED COURSE\n");
}
void render_choco_mountain(struct UnkStruct_800DC5EC* arg0) {
@@ -1324,7 +1322,7 @@ void render_big_donut(struct UnkStruct_800DC5EC* arg0) {
void func_8029569C(void) {
- CourseManager_RenderCredits();
+ CM_RenderCredits();
// switch (gCurrentCourseId) {
// case COURSE_MARIO_RACEWAY:
@@ -1404,7 +1402,7 @@ void render_course(struct UnkStruct_800DC5EC* arg0) {
return;
}
- CourseManager_RenderCourse(arg0);
+ CM_RenderCourse(arg0);
// switch (gCurrentCourseId) {
// case COURSE_MARIO_RACEWAY:
@@ -1716,7 +1714,7 @@ void course_init(void) {
void func_802966A0(void) {
- CourseManager_ScrollingTextures();
+ CM_ScrollingTextures();
// switch (gCurrentCourseId) {
// case COURSE_KOOPA_BEACH:
diff --git a/src/racing/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c
index 6c51fb266..916a97e23 100644
--- a/src/racing/skybox_and_splitscreen.c
+++ b/src/racing/skybox_and_splitscreen.c
@@ -19,7 +19,6 @@
#include "menus.h"
#include "port/Engine.h"
#include "engine/courses/Course.h"
-#include "engine/Engine.h"
#include "port/Game.h"
Vp D_802B8880[] = {
@@ -362,7 +361,7 @@ void func_802A450C(Vtx* skybox) {
return;
}
- SkyboxColours* prop = (SkyboxColours*) &CourseManager_GetProps()->Skybox;
+ SkyboxColours* prop = (SkyboxColours*) &CM_GetProps()->Skybox;
skybox[0].v.cn[0] = prop->TopRight.r;
skybox[0].v.cn[1] = prop->TopRight.g;
@@ -445,8 +444,8 @@ void func_802A4A0C(Vtx* vtx, struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, U
sp5C[0] = 0.0f;
sp5C[1] = 0.0f;
sp5C[2] = 30000.0f;
- func_802B5564(matrix1, &sp128, camera->unk_B4, gScreenAspect, CourseManager_GetProps()->NearPersp,
- CourseManager_GetProps()->FarPersp, 1.0f);
+ func_802B5564(matrix1, &sp128, camera->unk_B4, gScreenAspect, CM_GetProps()->NearPersp,
+ CM_GetProps()->FarPersp, 1.0f);
func_802B5794(matrix2, camera->pos, camera->lookAt);
mtxf_multiplication(matrix3, matrix1, matrix2);
@@ -829,7 +828,7 @@ void render_screens(s32 mode, s32 cameraId, s32 playerId) {
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
guPerspective(&gGfxPool->mtxPersp[cameraId], &perspNorm, gCameraZoom[cameraId], gScreenAspect,
- CourseManager_GetProps()->NearPersp, CourseManager_GetProps()->FarPersp, 1.0f);
+ CM_GetProps()->NearPersp, CM_GetProps()->FarPersp, 1.0f);
gSPPerspNormalize(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[cameraId]),