From a8c2a804380dcf94ee98b2985fc8837bba148914 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Fri, 23 May 2025 16:36:17 -0600 Subject: [PATCH] Fixes --- src/code_800029B0.c | 4 +++- src/code_80005FD0.c | 9 ++++----- src/code_8006E9C0.c | 4 ++-- src/code_8006E9C0.h | 2 +- src/racing/math_util.c | 6 ++---- src/racing/race_logic.c | 6 ++++-- src/staff_ghosts.c | 6 +++--- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/code_800029B0.c b/src/code_800029B0.c index f94bd5e3b..beba2e490 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -242,7 +242,9 @@ void setup_race(void) { // } // } if (!gDemoMode) { - func_800CA008(gPlayerCountSelection1 - 1, gCurrentCourseId + 4); + //! @warning this used to be gCurrentCourseId + 4 + // Hopefully this is equivallent. + func_800CA008(gPlayerCountSelection1 - 1, GetCourseIndex() + 4); func_800CB2C4(); } diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index b5166e468..3f8a0b1fc 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -3934,7 +3934,7 @@ s32 func_80011014(TrackWaypoint* pathDest, TrackWaypoint* path, s32 numPathPoint var_s0 = 0; temp_f20 = (f32) path[0].posX; temp_f22 = (f32) path[0].posZ; - var_f28 = func_80010F40(temp_f20, 2000.0f, temp_f22, gCurrentCourseId, 0); + var_f28 = func_80010F40(temp_f20, 2000.0f, temp_f22, 0, 0); for (i = 0; i < numPathPoints; i++) { point1 = &path[i % numPathPoints]; @@ -3969,10 +3969,10 @@ s32 func_80011014(TrackWaypoint* pathDest, TrackWaypoint* path, s32 numPathPoint if (gIsMirrorMode) { // temp_f12 = -temp_f24_2; pathDest->posX = (s16) -temp_f24_2; - var_f20_2 = func_80010FA0(-temp_f24_2, var_f28, x1_2, gCurrentCourseId, var_s0); + var_f20_2 = func_80010FA0(-temp_f24_2, var_f28, x1_2, 0, var_s0); } else { pathDest->posX = (s16) temp_f24_2; - var_f20_2 = func_80010FA0(temp_f24_2, var_f28, x1_2, gCurrentCourseId, var_s0); + var_f20_2 = func_80010FA0(temp_f24_2, var_f28, x1_2, 0, var_s0); } pathDest->posZ = (s16) temp_f22; @@ -5892,8 +5892,7 @@ void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32 D_80163238 = playerId; sp56 = gNearestWaypointByCameraId[cameraId]; gNearestWaypointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestWaypointByCameraId[cameraId], pathIndex); - // if (IsYoshiValley()) { - if (gCurrentCourseId == 4) { + if (IsYoshiValley()) { if ((sp56 != gNearestWaypointByCameraId[cameraId]) && (gNearestWaypointByCameraId[cameraId] == 1)) { pathIndex = (D_80163DD8[cameraId] = random_int(4U)); gNearestWaypointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestWaypointByCameraId[cameraId], pathIndex); diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 5d4475c80..55d08c423 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -162,7 +162,7 @@ void init_item_window(s32 objectIndex) { temp_v0->sizeScaling = 1.0f; } -void func_8006EEE8(s32 courseId) { +void get_minimap_properties() { D_8018D240 = (uintptr_t) CM_GetProps()->Minimap.Texture; // This is incredibly dumb. MinimapDimensions ought to be something more like // `u16 MinimapDimensions[][2]` but that doesn't match for some insane reason @@ -192,7 +192,7 @@ void func_8006F008(void) { } if (!IsPodiumCeremony()) { - func_8006EEE8((s32) gCurrentCourseId); + get_minimap_properties(); } // Flip the minimap player markers diff --git a/src/code_8006E9C0.h b/src/code_8006E9C0.h index e5e9bc8d3..e41f7da1e 100644 --- a/src/code_8006E9C0.h +++ b/src/code_8006E9C0.h @@ -11,7 +11,7 @@ void clear_object_list(void); u8* dma_misc_textures(u8*, u8*, u32, u32); void load_mario_kart_64_logo(void); void init_item_window(s32); -void func_8006EEE8(s32); +void get_minimap_properties(void); void func_8006EF60(void); void func_8006F008(void); void func_8006F824(s32); diff --git a/src/racing/math_util.c b/src/racing/math_util.c index 3682e07d5..127961703 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -14,8 +14,6 @@ #include #pragma intrinsic(sqrtf, fabs) -extern s16 gCurrentCourseId; - s32 D_802B91C0[2] = { 13, 13 }; Vec3f D_802B91C8 = { 0.0f, 0.0f, 0.0f }; @@ -1146,7 +1144,7 @@ f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY if (minDistance == 0.0f) { if (is_visible_between_angle((orientationY + extended_fov), (orientationY - extended_fov), angleObject) == 1) { - if (gCurrentCourseId == 0xB /* COURSE_KALAMARI_DESERT */) { + if (IsKalimariDesert()) { return distance / 6.5f; // set for better DD settings in Desert } else { return distance / 10.0f; // Items @@ -1156,7 +1154,7 @@ f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY } if (is_visible_between_angle((u16) plus_fov_angle, (u16) minus_fov_angle, angleObject) == 1) { - if (gCurrentCourseId == 0xB /* COURSE_KALAMARI_DESERT */) { + if (IsKalimariDesert()) { return distance / 2.0f; } else { return distance / 10.0f; // DD Vhicles diff --git a/src/racing/race_logic.c b/src/racing/race_logic.c index fc247a13c..4247cd88c 100644 --- a/src/racing/race_logic.c +++ b/src/racing/race_logic.c @@ -418,7 +418,7 @@ void func_8028EC38(s32 arg0) { void func_8028EC98(s32 arg0) { - // We want music in mutilplayer + // We want music in multiplayer, so this was removed //if (gScreenModeSelection == SCREEN_MODE_3P_4P_SPLITSCREEN) { // return; //} @@ -909,7 +909,9 @@ void func_8028FCBC(void) { CM_SpawnStarterLakitu(); // func_80078F64(); if ((gModeSelection == TIME_TRIALS) && (D_80162DD6 == 0)) { phi_v0_4 = 0x1; - for (i = 0; i < gCurrentCourseId; i++) { + //! @warning this used to be < gCurrentCourseId + // Hopefully this is equivallent. + for (i = 0; i < GetCourseIndex(); i++) { phi_v0_4 <<= 1; } if ((D_8015F890 == 0) && (!(D_800DC5AC & phi_v0_4))) { diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index 914809d38..c92892cdc 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -39,7 +39,7 @@ u32* D_80162DB4; s16 D_80162DB8; u32* D_80162DBC; -u16 D_80162DC0; +uintptr_t staff_ghost_track_ptr; StaffGhost* D_80162DC4; s32 D_80162DC8; s32 D_80162DCC; @@ -164,11 +164,11 @@ void func_80005310(void) { set_staff_ghost(); - if (D_80162DC0 != gCurrentCourseId) { + if (staff_ghost_track_ptr != (uintptr_t)GetCourse()) { D_80162DD4 = 1; } - D_80162DC0 = (u16) gCurrentCourseId; + staff_ghost_track_ptr = (uintptr_t)GetCourse(); D_80162DF0 = 0; D_80162DEC = 0; D_80162DF8 = 0;