From 7f14bf80df88f3d04727f217012ddbafaeb4b09a Mon Sep 17 00:00:00 2001 From: MegaMech Date: Mon, 9 Oct 2023 20:46:56 -0600 Subject: [PATCH] Rename wayPoint to waypoint (#448) * Rename wayPoint to waypoint * other --- asm/bss_8001C4D0.s | 2 +- .../code_8006E9C0/func_8006FA94.s | 4 +- courses/banshee_boardwalk/course_data.inc.c | 4 +- courses/banshee_boardwalk/course_data.inc.h | 4 +- courses/bowsers_castle/course_data.inc.c | 4 +- courses/bowsers_castle/course_data.inc.h | 4 +- courses/choco_mountain/course_data.inc.c | 4 +- courses/choco_mountain/course_data.inc.h | 4 +- courses/dks_jungle_parkway/course_data.inc.c | 4 +- courses/dks_jungle_parkway/course_data.inc.h | 4 +- courses/frappe_snowland/course_data.inc.c | 4 +- courses/frappe_snowland/course_data.inc.h | 4 +- courses/kalimari_desert/course_data.inc.c | 6 +- courses/kalimari_desert/course_data.inc.h | 6 +- courses/koopa_troopa_beach/course_data.inc.c | 8 +- courses/koopa_troopa_beach/course_data.inc.h | 4 +- courses/luigi_raceway/course_data.inc.c | 4 +- courses/luigi_raceway/course_data.inc.h | 4 +- courses/mario_raceway/course_data.inc.c | 4 +- courses/mario_raceway/course_data.inc.h | 4 +- courses/moo_moo_farm/course_data.inc.c | 4 +- courses/moo_moo_farm/course_data.inc.h | 4 +- courses/rainbow_road/course_data.inc.c | 4 +- courses/rainbow_road/course_data.inc.h | 4 +- courses/royal_raceway/course_data.inc.c | 4 +- courses/royal_raceway/course_data.inc.h | 4 +- courses/sherbet_land/course_data.inc.c | 4 +- courses/sherbet_land/course_data.inc.h | 4 +- courses/toads_turnpike/course_data.inc.c | 4 +- courses/toads_turnpike/course_data.inc.h | 4 +- courses/wario_stadium/course_data.inc.c | 4 +- courses/wario_stadium/course_data.inc.h | 4 +- courses/yoshi_valley/course_data.inc.c | 16 +- courses/yoshi_valley/course_data.inc.h | 4 +- include/bomb_kart.h | 4 +- include/defines.h | 12 +- include/vehicles.h | 6 +- include/waypoints.h | 24 +- src/camera.c | 27 +- src/camera.h | 2 +- src/code_800029B0.c | 14 +- src/code_80005FD0.c | 856 +++++++++--------- src/code_80005FD0.h | 2 +- src/code_8001F980.c | 4 +- src/code_80057C60.c | 14 +- src/code_80057C60.h | 2 +- src/code_8006E9C0.c | 4 +- src/code_80071F00.c | 4 +- src/code_8008C1D0.c | 36 +- src/code_80091750.c | 4 +- src/ending/code_80280000.c | 2 +- src/hud_renderer.c | 2 +- src/main.c | 2 +- src/main.h | 4 +- src/menus.c | 4 +- src/player_controller.c | 74 +- src/racing/actors.c | 12 +- src/racing/actors_extended.c | 38 +- src/racing/collision.c | 2 +- src/racing/math_util.c | 19 +- src/racing/race_logic.c | 2 +- src/racing/render_courses.c | 49 +- src/spawn_players.c | 6 +- 63 files changed, 704 insertions(+), 681 deletions(-) diff --git a/asm/bss_8001C4D0.s b/asm/bss_8001C4D0.s index a8279e459..f62db9cff 100644 --- a/asm/bss_8001C4D0.s +++ b/asm/bss_8001C4D0.s @@ -1209,7 +1209,7 @@ glabel D_8018D180 glabel D_8018D184 .skip 4 -glabel D_8018D188 +glabel gIsHUDVisible .skip 4 glabel D_8018D18C diff --git a/asm/non_matchings/code_8006E9C0/func_8006FA94.s b/asm/non_matchings/code_8006E9C0/func_8006FA94.s index f43144c9f..64b860318 100644 --- a/asm/non_matchings/code_8006E9C0/func_8006FA94.s +++ b/asm/non_matchings/code_8006E9C0/func_8006FA94.s @@ -12,9 +12,9 @@ glabel func_8006FA94 /* 0706BC 8006FABC AC20D170 */ sw $zero, %lo(D_8018D170)($at) /* 0706C0 8006FAC0 3C018019 */ lui $at, %hi(D_8018D190) # $at, 0x8019 /* 0706C4 8006FAC4 AC20D190 */ sw $zero, %lo(D_8018D190)($at) -/* 0706C8 8006FAC8 3C018019 */ lui $at, %hi(D_8018D188) # $at, 0x8019 +/* 0706C8 8006FAC8 3C018019 */ lui $at, %hi(gIsHUDVisible) # $at, 0x8019 /* 0706CC 8006FACC 3C048019 */ lui $a0, %hi(D_8018D178) # $a0, 0x8019 -/* 0706D0 8006FAD0 AC20D188 */ sw $zero, %lo(D_8018D188)($at) +/* 0706D0 8006FAD0 AC20D188 */ sw $zero, %lo(gIsHUDVisible)($at) /* 0706D4 8006FAD4 2484D178 */ addiu $a0, %lo(D_8018D178) # addiu $a0, $a0, -0x2e88 /* 0706D8 8006FAD8 AC800000 */ sw $zero, ($a0) /* 0706DC 8006FADC 3C018019 */ lui $at, %hi(D_8018D1CC) # $at, 0x8019 diff --git a/courses/banshee_boardwalk/course_data.inc.c b/courses/banshee_boardwalk/course_data.inc.c index d66875701..e1f2f3471 100644 --- a/courses/banshee_boardwalk/course_data.inc.c +++ b/courses/banshee_boardwalk/course_data.inc.c @@ -2652,7 +2652,7 @@ Gfx d_course_banshee_boardwalk_dl_4480[] = }; // 0x4578 Spawn location -struct TrackWayPoint d_course_banshee_boardwalk_unknown_waypoints[] = { +TrackWaypoint d_course_banshee_boardwalk_unknown_waypoints[] = { {5, 0, -65, 0}, {5, 0, -90, 0}, {4, 0, -203, 0}, @@ -2734,7 +2734,7 @@ struct TrackWayPoint d_course_banshee_boardwalk_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_banshee_boardwalk_track_waypoints[] = { +TrackWaypoint d_course_banshee_boardwalk_track_waypoints[] = { {5, 12, -77, 1}, {4, 12, -97, 1}, {4, 12, -117, 1}, diff --git a/courses/banshee_boardwalk/course_data.inc.h b/courses/banshee_boardwalk/course_data.inc.h index fa6ecad6b..40b4c42c6 100644 --- a/courses/banshee_boardwalk/course_data.inc.h +++ b/courses/banshee_boardwalk/course_data.inc.h @@ -112,8 +112,8 @@ extern Gfx d_course_banshee_boardwalk_dl_42D0[]; extern Gfx d_course_banshee_boardwalk_dl_43A8[]; extern Gfx d_course_banshee_boardwalk_dl_4428[]; extern Gfx d_course_banshee_boardwalk_dl_4480[]; -extern struct TrackWayPoint d_course_banshee_boardwalk_unknown_waypoints[]; -extern struct TrackWayPoint d_course_banshee_boardwalk_track_waypoints[]; +extern TrackWaypoint d_course_banshee_boardwalk_unknown_waypoints[]; +extern TrackWaypoint d_course_banshee_boardwalk_track_waypoints[]; extern u8 d_course_banshee_boardwalk_boo_tlut[]; extern Vtx d_course_banshee_boardwalk_cheep_cheep1[]; extern Vtx d_course_banshee_boardwalk_cheep_cheep2[]; diff --git a/courses/bowsers_castle/course_data.inc.c b/courses/bowsers_castle/course_data.inc.c index 2099010c1..4c366e747 100644 --- a/courses/bowsers_castle/course_data.inc.c +++ b/courses/bowsers_castle/course_data.inc.c @@ -2987,7 +2987,7 @@ Gfx d_course_bowsers_castle_dl_4EA8[] = }; // 0x4F90 -struct TrackWayPoint d_course_bowsers_castle_unknown_waypoints[] = { +TrackWaypoint d_course_bowsers_castle_unknown_waypoints[] = { {2, 0, -172, 0}, {2, 0, -197, 0}, {-2, 0, -691, 0}, @@ -3062,7 +3062,7 @@ struct TrackWayPoint d_course_bowsers_castle_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_bowsers_castle_track_waypoints[] = { +TrackWaypoint d_course_bowsers_castle_track_waypoints[] = { {2, 0, -184, 1}, {1, 0, -204, 2}, {1, 0, -224, 2}, diff --git a/courses/bowsers_castle/course_data.inc.h b/courses/bowsers_castle/course_data.inc.h index 275ed695d..aadfe865f 100644 --- a/courses/bowsers_castle/course_data.inc.h +++ b/courses/bowsers_castle/course_data.inc.h @@ -115,8 +115,8 @@ extern Gfx d_course_bowsers_castle_dl_4A98[]; extern Gfx d_course_bowsers_castle_dl_4C00[]; extern Gfx d_course_bowsers_castle_dl_4CE8[]; extern Gfx d_course_bowsers_castle_dl_4EA8[]; -extern struct TrackWayPoint d_course_bowsers_castle_unknown_waypoints[]; -extern struct TrackWayPoint d_course_bowsers_castle_track_waypoints[]; +extern TrackWaypoint d_course_bowsers_castle_unknown_waypoints[]; +extern TrackWaypoint d_course_bowsers_castle_track_waypoints[]; extern u8 d_course_bowsers_castle_thwomp_side[]; extern u8 d_course_bowsers_castle_thwomp_tlut[]; extern u8 d_course_bowsers_castle_thwomp_faces[][1024]; diff --git a/courses/choco_mountain/course_data.inc.c b/courses/choco_mountain/course_data.inc.c index ab513654a..091674118 100644 --- a/courses/choco_mountain/course_data.inc.c +++ b/courses/choco_mountain/course_data.inc.c @@ -2583,7 +2583,7 @@ Gfx d_course_choco_mountain_dl_43C8[] = gsSPEndDisplayList(), }; -struct TrackWayPoint d_course_choco_mountain_unknown_waypoints[] = { +TrackWaypoint d_course_choco_mountain_unknown_waypoints[] = { { -7, 0, -699, 0 }, { -6, 0, -712, 0 }, { 8, 0, -903, 0 }, @@ -2696,7 +2696,7 @@ struct TrackWayPoint d_course_choco_mountain_unknown_waypoints[] = { { -32768, 0, 0, 0 }, }; -struct TrackWayPoint d_course_choco_mountain_track_waypoints[] = { +TrackWaypoint d_course_choco_mountain_track_waypoints[] = { { -6, 40, -705, 1 }, { -5, 39, -725, 1 }, { -3, 37, -745, 1 }, diff --git a/courses/choco_mountain/course_data.inc.h b/courses/choco_mountain/course_data.inc.h index 471658265..7584ada96 100644 --- a/courses/choco_mountain/course_data.inc.h +++ b/courses/choco_mountain/course_data.inc.h @@ -103,8 +103,8 @@ extern Gfx d_course_choco_mountain_dl_4138[]; extern Gfx d_course_choco_mountain_dl_41F8[]; extern Gfx d_course_choco_mountain_dl_42C8[]; extern Gfx d_course_choco_mountain_dl_43C8[]; -extern struct TrackWayPoint d_course_choco_mountain_unknown_waypoints[]; -extern struct TrackWayPoint d_course_choco_mountain_track_waypoints[]; +extern TrackWaypoint d_course_choco_mountain_unknown_waypoints[]; +extern TrackWaypoint d_course_choco_mountain_track_waypoints[]; extern Lights1 d_course_choco_mountain_light; extern Vtx d_course_choco_mountain_6005AF8[]; extern u8 d_course_choco_mountain_wall_texture[]; diff --git a/courses/dks_jungle_parkway/course_data.inc.c b/courses/dks_jungle_parkway/course_data.inc.c index 9cac31391..1a3504032 100644 --- a/courses/dks_jungle_parkway/course_data.inc.c +++ b/courses/dks_jungle_parkway/course_data.inc.c @@ -4075,7 +4075,7 @@ Gfx d_course_dks_jungle_parkway_dl_7108[] = }; // 0x71F0 -struct TrackWayPoint d_course_dks_jungle_parkway_unknown_waypoints[] = { +TrackWaypoint d_course_dks_jungle_parkway_unknown_waypoints[] = { {2, 0, 12, 0}, {5, 0, -5, 0}, {0, 0, -211, 0}, @@ -4212,7 +4212,7 @@ struct TrackWayPoint d_course_dks_jungle_parkway_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_dks_jungle_parkway_track_waypoints[] = { +TrackWaypoint d_course_dks_jungle_parkway_track_waypoints[] = { {3, 0, 3, 1}, {4, 0, -16, 1}, {3, 0, -36, 1}, diff --git a/courses/dks_jungle_parkway/course_data.inc.h b/courses/dks_jungle_parkway/course_data.inc.h index 7a0487e99..d8813d2bf 100644 --- a/courses/dks_jungle_parkway/course_data.inc.h +++ b/courses/dks_jungle_parkway/course_data.inc.h @@ -112,8 +112,8 @@ extern Gfx d_course_dks_jungle_parkway_dl_6F10[]; extern Gfx d_course_dks_jungle_parkway_dl_7008[]; extern Gfx d_course_dks_jungle_parkway_dl_7080[]; extern Gfx d_course_dks_jungle_parkway_dl_7108[]; -extern struct TrackWayPoint d_course_dks_jungle_parkway_unknown_waypoints[]; -extern struct TrackWayPoint d_course_dks_jungle_parkway_track_waypoints[]; +extern TrackWaypoint d_course_dks_jungle_parkway_unknown_waypoints[]; +extern TrackWaypoint d_course_dks_jungle_parkway_track_waypoints[]; extern Vtx d_course_dks_jungle_parkway_paddle_boat_model1[]; extern Vtx d_course_dks_jungle_parkway_paddle_boat_model2[]; extern Vtx d_course_dks_jungle_parkway_paddle_boat_model3[]; diff --git a/courses/frappe_snowland/course_data.inc.c b/courses/frappe_snowland/course_data.inc.c index 77f4582d0..28ac6f9b4 100644 --- a/courses/frappe_snowland/course_data.inc.c +++ b/courses/frappe_snowland/course_data.inc.c @@ -1964,7 +1964,7 @@ Gfx d_course_frappe_snowland_dl_33E0[] = gsSPEndDisplayList(), }; -struct TrackWayPoint d_course_frappe_unknown_waypoints[] = { +TrackWaypoint d_course_frappe_unknown_waypoints[] = { {-4, 0, -259, 0}, {-4, 0, -282, 0}, {-10, 0, -526, 0}, @@ -2040,7 +2040,7 @@ struct TrackWayPoint d_course_frappe_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_frappe_track_waypoints[] = { +TrackWaypoint d_course_frappe_track_waypoints[] = { {-4, 0, -270, 1}, {-4, 0, -290, 1}, {-4, 0, -310, 2}, diff --git a/courses/frappe_snowland/course_data.inc.h b/courses/frappe_snowland/course_data.inc.h index a6af2a27e..57a138013 100644 --- a/courses/frappe_snowland/course_data.inc.h +++ b/courses/frappe_snowland/course_data.inc.h @@ -75,8 +75,8 @@ extern Gfx d_course_frappe_snowland_dl_3198[]; extern Gfx d_course_frappe_snowland_dl_3270[]; extern Gfx d_course_frappe_snowland_dl_3328[]; extern Gfx d_course_frappe_snowland_dl_33E0[]; -extern struct TrackWayPoint d_course_frappe_unknown_waypoints[]; -extern struct TrackWayPoint d_course_frappe_track_waypoints[]; +extern TrackWaypoint d_course_frappe_unknown_waypoints[]; +extern TrackWaypoint d_course_frappe_track_waypoints[]; extern u8 d_course_frappe_snowland_snowman_tlut[]; extern u8 d_course_frappe_snowland_snowman_head[]; extern u8 d_course_frappe_snowland_snowman_body[]; diff --git a/courses/kalimari_desert/course_data.inc.c b/courses/kalimari_desert/course_data.inc.c index cff340d0a..a37760cec 100644 --- a/courses/kalimari_desert/course_data.inc.c +++ b/courses/kalimari_desert/course_data.inc.c @@ -3746,7 +3746,7 @@ Gfx d_course_kalimari_desert_dl_6940[] = }; // 0x6AC8 -struct TrackWayPoint d_course_kalimari_desert_unknown_waypoints[] = { +TrackWaypoint d_course_kalimari_desert_unknown_waypoints[] = { {1, 0, 503, 0}, {1, 0, 485, 0}, {1, 0, 325, 0}, @@ -3800,7 +3800,7 @@ struct TrackWayPoint d_course_kalimari_desert_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_kalimari_desert_track_unknown_waypoints[] = { +TrackWaypoint d_course_kalimari_desert_track_unknown_waypoints[] = { {-741, 0, 2114, 0}, {-741, 0, 2130, 0}, {-741, 0, 2364, 0}, @@ -3879,7 +3879,7 @@ struct TrackWayPoint d_course_kalimari_desert_track_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_kalimari_desert_track_waypoints[] = { +TrackWaypoint d_course_kalimari_desert_track_waypoints[] = { {1, 0, 494, 1}, {1, 0, 473, 2}, {1, 0, 453, 2}, diff --git a/courses/kalimari_desert/course_data.inc.h b/courses/kalimari_desert/course_data.inc.h index face3f026..adf7e6936 100644 --- a/courses/kalimari_desert/course_data.inc.h +++ b/courses/kalimari_desert/course_data.inc.h @@ -87,9 +87,9 @@ extern Gfx d_course_kalimari_desert_dl_65B0[]; extern Gfx d_course_kalimari_desert_dl_66F0[]; extern Gfx d_course_kalimari_desert_dl_6838[]; extern Gfx d_course_kalimari_desert_dl_6940[]; -extern struct TrackWayPoint d_course_kalimari_desert_unknown_waypoints[]; -extern struct TrackWayPoint d_course_kalimari_desert_track_unknown_waypoints[]; -extern struct TrackWayPoint d_course_kalimari_desert_track_waypoints[]; +extern TrackWaypoint d_course_kalimari_desert_unknown_waypoints[]; +extern TrackWaypoint d_course_kalimari_desert_track_unknown_waypoints[]; +extern TrackWaypoint d_course_kalimari_desert_track_waypoints[]; extern u8 d_course_kalimari_desert_tree_tlut[]; extern Vtx d_course_kalimari_desert_cactus_model1[]; extern Vtx d_course_kalimari_desert_cactus_model2[]; diff --git a/courses/koopa_troopa_beach/course_data.inc.c b/courses/koopa_troopa_beach/course_data.inc.c index 19a0e65d3..d5c41cf66 100644 --- a/courses/koopa_troopa_beach/course_data.inc.c +++ b/courses/koopa_troopa_beach/course_data.inc.c @@ -6766,7 +6766,7 @@ Gfx d_course_koopa_troopa_beach_dl_AD40[] = }; // 0xADE0 path -struct TrackWayPoint d_course_koopa_troopa_beach_unknown_waypoints0[] = { +TrackWaypoint d_course_koopa_troopa_beach_unknown_waypoints0[] = { {-34, 0, 103, 0}, {-34, 0, 60, 0}, {-38, 0, -184, 0}, @@ -6831,7 +6831,7 @@ struct TrackWayPoint d_course_koopa_troopa_beach_unknown_waypoints0[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_koopa_troopa_beach_unknown_waypoints1[] = { +TrackWaypoint d_course_koopa_troopa_beach_unknown_waypoints1[] = { {-27, 0, 101, 7}, {-31, 0, 76, 7}, {-27, 0, -187, 7}, @@ -6893,7 +6893,7 @@ struct TrackWayPoint d_course_koopa_troopa_beach_unknown_waypoints1[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_koopa_troopa_beach_track_waypoints0[] = { +TrackWaypoint d_course_koopa_troopa_beach_track_waypoints0[] = { {-34, 1, 81, 1}, {-34, 1, 61, 1}, {-34, 1, 41, 1}, @@ -7505,7 +7505,7 @@ struct TrackWayPoint d_course_koopa_troopa_beach_track_waypoints0[] = { {-32768, -32768, -32768, 0}, }; -struct TrackWayPoint d_course_koopa_troopa_beach_track_waypoints1[] = { +TrackWaypoint d_course_koopa_troopa_beach_track_waypoints1[] = { {-29, 1, 88, 1}, {-29, 1, 68, 1}, {-29, 1, 48, 1}, diff --git a/courses/koopa_troopa_beach/course_data.inc.h b/courses/koopa_troopa_beach/course_data.inc.h index 7b55fd64b..845a50436 100644 --- a/courses/koopa_troopa_beach/course_data.inc.h +++ b/courses/koopa_troopa_beach/course_data.inc.h @@ -306,8 +306,8 @@ extern Gfx d_course_koopa_troopa_beach_dl_AB88[]; extern Gfx d_course_koopa_troopa_beach_dl_AC10[]; extern Gfx d_course_koopa_troopa_beach_dl_AC68[]; extern Gfx d_course_koopa_troopa_beach_dl_AD40[]; -extern struct TrackWayPoint d_course_koopa_troopa_beach_unknown_waypoints[]; -extern struct TrackWayPoint d_course_koopa_troopa_beach_track_waypoints[]; +extern TrackWaypoint d_course_koopa_troopa_beach_unknown_waypoints[]; +extern TrackWaypoint d_course_koopa_troopa_beach_track_waypoints[]; extern u8 d_course_koopa_troopa_beach_crab_tlut[]; extern u8 d_course_koopa_troopa_beach_crab_frames[][4096]; extern u32 d_course_koopa_troopa_beach_unk_data1[]; diff --git a/courses/luigi_raceway/course_data.inc.c b/courses/luigi_raceway/course_data.inc.c index a7b33000f..d296ecfbc 100644 --- a/courses/luigi_raceway/course_data.inc.c +++ b/courses/luigi_raceway/course_data.inc.c @@ -5777,7 +5777,7 @@ Gfx d_course_luigi_raceway_dl_A320[] = }; // 0xA540 -struct TrackWayPoint d_course_luigi_raceway_unknown_waypoints[] = { +TrackWaypoint d_course_luigi_raceway_unknown_waypoints[] = { {-139, 0, -202, 0}, {-139, 0, -218, 0}, {-139, 0, -297, 0}, @@ -5831,7 +5831,7 @@ struct TrackWayPoint d_course_luigi_raceway_unknown_waypoints[] = { }; // 0xA6D0 -struct TrackWayPoint d_course_luigi_raceway_track_waypoints[] = { +TrackWaypoint d_course_luigi_raceway_track_waypoints[] = { {-139, -50, -210, 1}, {-139, -50, -230, 2}, {-139, -50, -250, 2}, diff --git a/courses/luigi_raceway/course_data.inc.h b/courses/luigi_raceway/course_data.inc.h index fcb80f32c..1b0694238 100644 --- a/courses/luigi_raceway/course_data.inc.h +++ b/courses/luigi_raceway/course_data.inc.h @@ -127,8 +127,8 @@ extern Gfx d_course_luigi_raceway_dl_9E58[]; extern Gfx d_course_luigi_raceway_dl_A028[]; extern Gfx d_course_luigi_raceway_dl_A178[]; extern Gfx d_course_luigi_raceway_dl_A320[]; -extern struct TrackWayPoint d_course_luigi_raceway_unknown_waypoints[]; -extern struct TrackWayPoint d_course_luigi_raceway_track_waypoints[]; +extern TrackWaypoint d_course_luigi_raceway_unknown_waypoints[]; +extern TrackWaypoint d_course_luigi_raceway_track_waypoints[]; extern Vtx d_course_luigi_raceway_basket_model_lod2[]; extern Vtx d_course_luigi_raceway_unknown_model1[]; extern Vtx d_course_luigi_raceway_unknown_model2[]; diff --git a/courses/mario_raceway/course_data.inc.c b/courses/mario_raceway/course_data.inc.c index be5ba1267..b8d5515e1 100644 --- a/courses/mario_raceway/course_data.inc.c +++ b/courses/mario_raceway/course_data.inc.c @@ -3017,7 +3017,7 @@ Gfx d_course_mario_raceway_dl_5228[] = gsSPEndDisplayList(), }; -struct TrackWayPoint d_course_mario_raceway_unknown_waypoints[] = { +TrackWaypoint d_course_mario_raceway_unknown_waypoints[] = { { 0, 0, -224, 0 }, { 0, 0, -241, 0 }, { 0, 0, -612, 0 }, @@ -3093,7 +3093,7 @@ struct TrackWayPoint d_course_mario_raceway_unknown_waypoints[] = { { -32768, 0, 0, 0 }, }; -struct TrackWayPoint d_course_mario_raceway_track_waypoints[] = { +TrackWaypoint d_course_mario_raceway_track_waypoints[] = { { 0, 0, -232, 1 }, { 0, 0, -252, 1 }, { 0, 0, -272, 1 }, diff --git a/courses/mario_raceway/course_data.inc.h b/courses/mario_raceway/course_data.inc.h index 7aa07f018..c7fc5866c 100644 --- a/courses/mario_raceway/course_data.inc.h +++ b/courses/mario_raceway/course_data.inc.h @@ -76,8 +76,8 @@ extern Gfx d_course_mario_raceway_dl_4ED0[]; extern Gfx d_course_mario_raceway_dl_4FF0[]; extern Gfx d_course_mario_raceway_dl_5150[]; extern Gfx d_course_mario_raceway_dl_5228[]; -extern struct TrackWayPoint d_course_mario_raceway_unknown_waypoints[]; -extern struct TrackWayPoint d_course_mario_raceway_track_waypoints[]; +extern TrackWaypoint d_course_mario_raceway_unknown_waypoints[]; +extern TrackWaypoint d_course_mario_raceway_track_waypoints[]; extern u8 d_course_mario_raceway_piranha_plant_tlut[]; extern Vtx d_course_mario_raceway_piranha_plant_model[]; extern Gfx d_course_mario_raceway_dl_piranha_plant[]; diff --git a/courses/moo_moo_farm/course_data.inc.c b/courses/moo_moo_farm/course_data.inc.c index b0281eb6d..6757ce6a3 100644 --- a/courses/moo_moo_farm/course_data.inc.c +++ b/courses/moo_moo_farm/course_data.inc.c @@ -7965,7 +7965,7 @@ Gfx d_course_moo_moo_farm_dl_EA18[] = }; // 0xEC80 -struct TrackWayPoint d_course_moo_moo_farm_unknown_waypoints[] = { +TrackWaypoint d_course_moo_moo_farm_unknown_waypoints[] = { {11, 0, 46, 0}, {9, 0, 21, 0}, {5, 0, -307, 0}, @@ -8013,7 +8013,7 @@ struct TrackWayPoint d_course_moo_moo_farm_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_moo_moo_farm_track_waypoints[] = { +TrackWaypoint d_course_moo_moo_farm_track_waypoints[] = { {10, 18, 33, 1}, {9, 17, 13, 2}, {8, 17, -6, 2}, diff --git a/courses/moo_moo_farm/course_data.inc.h b/courses/moo_moo_farm/course_data.inc.h index 67387ea88..8ff50ec2d 100644 --- a/courses/moo_moo_farm/course_data.inc.h +++ b/courses/moo_moo_farm/course_data.inc.h @@ -104,8 +104,8 @@ extern Gfx d_course_moo_moo_farm_dl_E1D8[]; extern Gfx d_course_moo_moo_farm_dl_E4B0[]; extern Gfx d_course_moo_moo_farm_dl_E708[]; extern Gfx d_course_moo_moo_farm_dl_EA18[]; -extern struct TrackWayPoint d_course_moo_moo_farm_unknown_waypoints[]; -extern struct TrackWayPoint d_course_moo_moo_farm_track_waypoints[]; +extern TrackWaypoint d_course_moo_moo_farm_unknown_waypoints[]; +extern TrackWaypoint d_course_moo_moo_farm_track_waypoints[]; extern u8 d_course_moo_moo_farm_mole_tlut[]; extern u8 d_course_moo_moo_farm_mole_frames[][2048]; extern u8 d_course_moo_moo_farm_mole_dirt[]; diff --git a/courses/rainbow_road/course_data.inc.c b/courses/rainbow_road/course_data.inc.c index cdd674ed2..ad723d1c6 100644 --- a/courses/rainbow_road/course_data.inc.c +++ b/courses/rainbow_road/course_data.inc.c @@ -1035,7 +1035,7 @@ Gfx d_course_rainbow_road_dl_1948[] = gsSPEndDisplayList(), }; -struct TrackWayPoint d_course_rainbow_road_unknown_waypoints[] = { +TrackWaypoint d_course_rainbow_road_unknown_waypoints[] = { {6, 0, 3, 0}, {6, 0, -25, 0}, {0, 0, -514, 0}, @@ -1139,7 +1139,7 @@ struct TrackWayPoint d_course_rainbow_road_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_rainbow_road_track_waypoints[] = { +TrackWaypoint d_course_rainbow_road_track_waypoints[] = { {6, 1510, -11, 1}, {5, 1509, -31, 2}, {5, 1509, -51, 2}, diff --git a/courses/rainbow_road/course_data.inc.h b/courses/rainbow_road/course_data.inc.h index 970334bdb..4dc0a8ba5 100644 --- a/courses/rainbow_road/course_data.inc.h +++ b/courses/rainbow_road/course_data.inc.h @@ -58,8 +58,8 @@ extern Gfx d_course_rainbow_road_dl_17D0[]; extern Gfx d_course_rainbow_road_dl_1878[]; extern Gfx d_course_rainbow_road_dl_18D0[]; extern Gfx d_course_rainbow_road_dl_1948[]; -extern struct TrackWayPoint d_course_rainbow_road_unknown_waypoints[]; -extern struct TrackWayPoint d_course_rainbow_road_track_waypoints[]; +extern TrackWaypoint d_course_rainbow_road_unknown_waypoints[]; +extern TrackWaypoint d_course_rainbow_road_track_waypoints[]; extern u8 d_course_rainbow_road_neon_mushroom_tlut_list[][512]; extern u8 d_course_rainbow_road_neon_mario_tlut_list[][512]; extern u8 d_course_rainbow_road_neon_boo_tlut_list[][512]; diff --git a/courses/royal_raceway/course_data.inc.c b/courses/royal_raceway/course_data.inc.c index 3c198abe7..20f15dc23 100644 --- a/courses/royal_raceway/course_data.inc.c +++ b/courses/royal_raceway/course_data.inc.c @@ -6352,7 +6352,7 @@ Gfx d_course_royal_raceway_dl_B508[] = }; // 0xB5B8 -struct TrackWayPoint d_course_royal_raceway_unknown_waypoints[] = { +TrackWaypoint d_course_royal_raceway_unknown_waypoints[] = { {-63, 0, -321, 0}, {-61, 0, -341, 0}, {-60, 0, -591, 0}, @@ -6433,7 +6433,7 @@ struct TrackWayPoint d_course_royal_raceway_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_royal_raceway_track_waypoints[] = { +TrackWaypoint d_course_royal_raceway_track_waypoints[] = { {-62, 0, -331, 1}, {-61, 0, -350, 2}, {-61, 0, -371, 2}, diff --git a/courses/royal_raceway/course_data.inc.h b/courses/royal_raceway/course_data.inc.h index beac81fee..3f7325424 100644 --- a/courses/royal_raceway/course_data.inc.h +++ b/courses/royal_raceway/course_data.inc.h @@ -139,8 +139,8 @@ extern Gfx d_course_royal_raceway_dl_B230[]; extern Gfx d_course_royal_raceway_dl_B2E0[]; extern Gfx d_course_royal_raceway_dl_B3E8[]; extern Gfx d_course_royal_raceway_dl_B508[]; -extern struct TrackWayPoint d_course_royal_raceway_unknown_waypoints[]; -extern struct TrackWayPoint d_course_royal_raceway_track_waypoints[]; +extern TrackWaypoint d_course_royal_raceway_unknown_waypoints[]; +extern TrackWaypoint d_course_royal_raceway_track_waypoints[]; extern Vtx d_course_royal_raceway_tree_model[]; extern Gfx d_course_royal_raceway_dl_tree[]; extern Vtx d_royal_raceway_peaches_castle_tree_model[]; diff --git a/courses/sherbet_land/course_data.inc.c b/courses/sherbet_land/course_data.inc.c index 70f35dd66..afef32559 100644 --- a/courses/sherbet_land/course_data.inc.c +++ b/courses/sherbet_land/course_data.inc.c @@ -3017,7 +3017,7 @@ Gfx d_course_sherbet_land_dl_4B20[] = }; // unk 0x4BF8 -struct TrackWayPoint d_course_sherbet_land_uknown_waypoints[] = { +TrackWaypoint d_course_sherbet_land_uknown_waypoints[] = { {-10, 0, 10, 0}, {-10, 0, -8, 0}, {-18, 0, -213, 0}, @@ -3082,7 +3082,7 @@ struct TrackWayPoint d_course_sherbet_land_uknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_sherbet_land_track_waypoints[] = { +TrackWaypoint d_course_sherbet_land_track_waypoints[] = { {-10, 0, 1, 1}, {-10, 0, -19, 1}, {-11, 0, -38, 1}, diff --git a/courses/sherbet_land/course_data.inc.h b/courses/sherbet_land/course_data.inc.h index b5c933224..010d86360 100644 --- a/courses/sherbet_land/course_data.inc.h +++ b/courses/sherbet_land/course_data.inc.h @@ -152,8 +152,8 @@ extern Gfx d_course_sherbet_land_dl_4930[]; extern Gfx d_course_sherbet_land_dl_4A20[]; extern Gfx d_course_sherbet_land_dl_4A98[]; extern Gfx d_course_sherbet_land_dl_4B20[]; -extern struct TrackWayPoint d_course_sherbet_land_uknown_waypoints[]; -extern struct TrackWayPoint d_course_sherbet_land_track_waypoints[]; +extern TrackWaypoint d_course_sherbet_land_uknown_waypoints[]; +extern TrackWaypoint d_course_sherbet_land_track_waypoints[]; extern Vtx d_course_sherbet_land_model1[]; extern Vtx d_course_sherbet_land_model2[]; extern Vtx d_course_sherbet_land_model3[]; diff --git a/courses/toads_turnpike/course_data.inc.c b/courses/toads_turnpike/course_data.inc.c index c6df5d268..1c7f7343a 100644 --- a/courses/toads_turnpike/course_data.inc.c +++ b/courses/toads_turnpike/course_data.inc.c @@ -2241,7 +2241,7 @@ Gfx d_course_toads_turnpike_dl_3AD8[] = }; // 0x3B80 -struct TrackWayPoint d_course_toads_turnpike_unknown_waypoints[] = { +TrackWaypoint d_course_toads_turnpike_unknown_waypoints[] = { {100, 0, 26, 0}, {100, 0, 7, 0}, {102, 0, -299, 0}, @@ -2298,7 +2298,7 @@ struct TrackWayPoint d_course_toads_turnpike_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_toads_turnpike_track_waypoints[] = { +TrackWaypoint d_course_toads_turnpike_track_waypoints[] = { {100, 0, 16, 1}, {100, 0, -3, 1}, {100, 0, -23, 1}, diff --git a/courses/toads_turnpike/course_data.inc.h b/courses/toads_turnpike/course_data.inc.h index 6193cf48a..3abb384ed 100644 --- a/courses/toads_turnpike/course_data.inc.h +++ b/courses/toads_turnpike/course_data.inc.h @@ -89,8 +89,8 @@ extern Gfx d_course_toads_turnpike_dl_37F0[]; extern Gfx d_course_toads_turnpike_dl_3910[]; extern Gfx d_course_toads_turnpike_dl_39C8[]; extern Gfx d_course_toads_turnpike_dl_3AD8[]; -extern struct TrackWayPoint d_course_toads_turnpike_unknown_waypoints[]; -extern struct TrackWayPoint d_course_toads_turnpike_track_waypoints[]; +extern TrackWaypoint d_course_toads_turnpike_unknown_waypoints[]; +extern TrackWaypoint d_course_toads_turnpike_track_waypoints[]; extern u8 d_course_toads_turnpike_unk_windshield1[]; extern u8 d_course_toads_turnpike_unk_windshield2[]; extern u8 d_course_toads_turnpike_truck_box1[]; diff --git a/courses/wario_stadium/course_data.inc.c b/courses/wario_stadium/course_data.inc.c index d56163097..4a9eccf51 100644 --- a/courses/wario_stadium/course_data.inc.c +++ b/courses/wario_stadium/course_data.inc.c @@ -3214,7 +3214,7 @@ Gfx d_course_wario_stadium_dl_5588[] = // 0x56A0 -struct TrackWayPoint d_course_wario_stadium_unknown_waypoints[] = { +TrackWaypoint d_course_wario_stadium_unknown_waypoints[] = { {16, 0, 7, 0}, {11, 0, -25, 0}, {8, 0, -227, 0}, @@ -3294,7 +3294,7 @@ struct TrackWayPoint d_course_wario_stadium_unknown_waypoints[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_wario_staduim_track_waypoints[] = { +TrackWaypoint d_course_wario_staduim_track_waypoints[] = { {13, 0, -9, 1}, {11, 0, -28, 1}, {11, 0, -48, 1}, diff --git a/courses/wario_stadium/course_data.inc.h b/courses/wario_stadium/course_data.inc.h index ad2426b80..2db0889d9 100644 --- a/courses/wario_stadium/course_data.inc.h +++ b/courses/wario_stadium/course_data.inc.h @@ -115,8 +115,8 @@ extern Gfx d_course_wario_stadium_dl_5338[]; extern Gfx d_course_wario_stadium_dl_5460[]; extern Gfx d_course_wario_stadium_dl_54E8[]; extern Gfx d_course_wario_stadium_dl_5588[]; -extern struct TrackWayPoint d_course_wario_stadium_unknown_waypoints[]; -extern struct TrackWayPoint d_course_wario_staduim_track_waypoints[]; +extern TrackWaypoint d_course_wario_stadium_unknown_waypoints[]; +extern TrackWaypoint d_course_wario_staduim_track_waypoints[]; extern Vtx d_course_wario_stadium_sign_head_model1[]; extern Vtx d_course_wario_stadium_sign_head_model2[]; extern Vtx d_course_wario_stadium_sign_head_model3[]; diff --git a/courses/yoshi_valley/course_data.inc.c b/courses/yoshi_valley/course_data.inc.c index fc8b89371..f647a06d7 100644 --- a/courses/yoshi_valley/course_data.inc.c +++ b/courses/yoshi_valley/course_data.inc.c @@ -7407,7 +7407,7 @@ Gfx d_course_yoshi_valley_dl_D540[] = // 0xD780 -struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints0[] = { +TrackWaypoint d_course_yoshi_valley_unknown_waypoints0[] = { {-3, 0, -4, 0}, {-3, 0, -20, 0}, {-3, 0, -261, 0}, @@ -7483,7 +7483,7 @@ struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints0[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints1[] = { +TrackWaypoint d_course_yoshi_valley_unknown_waypoints1[] = { {-6, 0, -5, 1}, {-6, 0, -21, 1}, {-5, 0, -434, 1}, @@ -7560,7 +7560,7 @@ struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints1[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints2[] = { +TrackWaypoint d_course_yoshi_valley_unknown_waypoints2[] = { {-3, 0, -3, 4}, {-3, 0, -19, 4}, {0, 0, -268, 4}, @@ -7645,7 +7645,7 @@ struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints2[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints3[] = { +TrackWaypoint d_course_yoshi_valley_unknown_waypoints3[] = { {-2, 0, -1, 7}, {0, 0, -18, 7}, {-2, 0, -268, 7}, @@ -7733,7 +7733,7 @@ struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints3[] = { {-32768, 0, 0, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_track_waypoints0[] = { +TrackWaypoint d_course_yoshi_valley_track_waypoints0[] = { {-3, 180, -12, 1}, {-3, 180, -32, 2}, {-3, 180, -52, 2}, @@ -8414,7 +8414,7 @@ struct TrackWayPoint d_course_yoshi_valley_track_waypoints0[] = { {-32768, -32768, -32768, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_track_waypoints1[] = { +TrackWaypoint d_course_yoshi_valley_track_waypoints1[] = { {-6, 180, -13, 1}, {-5, 180, -33, 2}, {-5, 180, -53, 2}, @@ -9084,7 +9084,7 @@ struct TrackWayPoint d_course_yoshi_valley_track_waypoints1[] = { {-32768, -32768, -32768, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_track_waypoints2[] = { +TrackWaypoint d_course_yoshi_valley_track_waypoints2[] = { {-3, 180, -11, 1}, {-2, 180, -31, 2}, {-2, 180, -51, 2}, @@ -9766,7 +9766,7 @@ struct TrackWayPoint d_course_yoshi_valley_track_waypoints2[] = { {-32768, -32768, -32768, 0}, }; -struct TrackWayPoint d_course_yoshi_valley_track_waypoints3[] = { +TrackWaypoint d_course_yoshi_valley_track_waypoints3[] = { {-1, 180, -9, 1}, {0, 180, -29, 2}, {0, 180, -49, 2}, diff --git a/courses/yoshi_valley/course_data.inc.h b/courses/yoshi_valley/course_data.inc.h index d15ff0932..90a0ef427 100644 --- a/courses/yoshi_valley/course_data.inc.h +++ b/courses/yoshi_valley/course_data.inc.h @@ -133,8 +133,8 @@ extern Gfx d_course_yoshi_valley_dl_D018[]; extern Gfx d_course_yoshi_valley_dl_D1E8[]; extern Gfx d_course_yoshi_valley_dl_D3D0[]; extern Gfx d_course_yoshi_valley_dl_D540[]; -extern struct TrackWayPoint d_course_yoshi_valley_unknown_waypoints0[]; -extern struct TrackWayPoint d_course_yoshi_valley_track_waypoints0[]; +extern TrackWaypoint d_course_yoshi_valley_unknown_waypoints0[]; +extern TrackWaypoint d_course_yoshi_valley_track_waypoints0[]; extern Lights1 d_course_yoshi_valley_unknown_light1; extern Lights1 d_course_yoshi_valley_unknown_light2; extern Lights1 d_course_yoshi_valley_unknown_light3; diff --git a/include/bomb_kart.h b/include/bomb_kart.h index f02910866..3f23694c4 100644 --- a/include/bomb_kart.h +++ b/include/bomb_kart.h @@ -15,7 +15,7 @@ #define BOMB_STATE_UNKNOWN 5 typedef struct { - /* 0x00 */ u16 wayPointIndex; + /* 0x00 */ u16 waypointIndex; /* 0x02 */ u16 startingState; /* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in struct_D_80163DE8_entry /* 0x08 */ f32 startingXPos; @@ -41,7 +41,7 @@ typedef struct { /* 0x30 */ Vec3f wheel4Pos; /* 0x3C */ f32 unk_3C; /* 0x40 */ s16 someRot; // seems like an angle of some variety, can't figure out its purpose - /* 0x42 */ u16 wayPointIndex; // probably the waypoint that the bomb circles + /* 0x42 */ u16 waypointIndex; // probably the waypoint that the bomb circles /* 0x44 */ u16 state; /* 0x46 */ s16 bounceTimer; // timer? state? height? /* 0x48 */ s16 circleTimer; // timer? state? Somehow controls how it circles around diff --git a/include/defines.h b/include/defines.h index d25917029..e1c237e28 100644 --- a/include/defines.h +++ b/include/defines.h @@ -103,6 +103,16 @@ #define PLAYER_THREE 2 #define PLAYER_FOUR 3 + +#define MARIO_SIZE 0.75f +#define LUIGI_SIZE 0.75f +#define YOSHI_SIZE 0.75f +#define TOAD_SIZE 0.75f +#define DK_SIZE 0.75f +#define WARIO_SIZE 0.75f +#define PEACH_SIZE 0.75f +#define BOWSER_SIZE 0.75f + // 2P Game has Grand Prix, VS, and Battle as available game types #define MAX_NUM_MAIN_MENU_GAME_TYPES 3 @@ -171,7 +181,7 @@ #define RACING_DUPLICATE 14 /** - * Options for gMenuSelectionFromQuit and gMenuSelectionFromEndingSequence + * Options for gGameState gMenuSelectionFromQuit and gMenuSelectionFromEndingSequence **/ #define START_MENU_FROM_QUIT 0 #define MAIN_MENU_FROM_QUIT 1 diff --git a/include/vehicles.h b/include/vehicles.h index a45a8cef4..398624bc9 100644 --- a/include/vehicles.h +++ b/include/vehicles.h @@ -27,7 +27,7 @@ typedef struct { /* 0x02 */ s16 compilerPadding; /* 0x04 */ Vec3f position; /* 0x10 */ Vec3f velocity; - /* 0x1C */ u16 wayPointIndex; + /* 0x1C */ u16 waypointIndex; /* 0x1E */ s16 actorIndex; /* 0x20 */ s32 unused; // Not read or written. Could be padding? } TrainCarStuff; // size = 0x24; @@ -47,7 +47,7 @@ typedef struct { /* 0x02 */ // s16 compilerPadding; /* 0x04 */ Vec3f position; // /* 0x10 */ Vec3f velocity; // - /* 0x1C */ s16 wayPointIndex; // + /* 0x1C */ s16 waypointIndex; // /* 0x1E */ s16 actorIndex; // /* 0x20 */ f32 someMultiplier; // /* 0x24 */ s16 yRotation; // Only Y rotation is tracked in this struct @@ -64,7 +64,7 @@ typedef struct { /* 0x02 */ // s16 compilerPadding; /* 0x04 */ Vec3f position; /* 0x10 */ Vec3f velocity; - /* 0x1C */ u16 wayPointIndex; + /* 0x1C */ u16 waypointIndex; /* 0x1E */ s16 actorIndex; /* 0x20 */ f32 someMultiplier; // /* 0x24 */ f32 someMultiplierTheSequel; // diff --git a/include/waypoints.h b/include/waypoints.h index bdd23eaf1..f5340ccf4 100644 --- a/include/waypoints.h +++ b/include/waypoints.h @@ -1,12 +1,12 @@ #ifndef WAYPOINTS_H #define WAYPOINTS_H -struct TrackWayPoint { - /* 0x00 */ s16 wayPointX; - /* 0x02 */ s16 wayPointY; - /* 0x04 */ s16 wayPointZ; - /* 0x06 */ u16 wayPointTrackSegment; -}; // size = 0x08 +typedef struct { + /* 0x00 */ s16 posX; + /* 0x02 */ s16 posY; + /* 0x04 */ s16 posZ; + /* 0x06 */ u16 trackSegment; +} TrackWaypoint; // size = 0x08 /** * These are per-path arrays that contain some information relating to waypoints @@ -14,9 +14,9 @@ struct TrackWayPoint { * The arrays in D_80164560 and D_80164570 track some other X/Y/Z, but the track segment is always 0 (so, untracked/unused) * Its unclear how these arrays relate to each other **/ -extern struct TrackWayPoint *D_80164550[]; -extern struct TrackWayPoint *D_80164560[]; -extern struct TrackWayPoint *D_80164570[]; +extern TrackWaypoint *D_80164550[]; +extern TrackWaypoint *D_80164560[]; +extern TrackWaypoint *D_80164570[]; /** * Don't know what exactly these are, but like D_80164550, D_80164560, and D_80164570 @@ -46,9 +46,9 @@ extern s16 D_80165320[]; // Don't think this really belongs with waypoint stuff, but don't know where else to put it extern s16 D_80165330[]; // Shadows values from D_80164560 -extern struct TrackWayPoint *D_801631D0; +extern TrackWaypoint *D_801631D0; // Shadows values from D_80164570 -extern struct TrackWayPoint *D_801631D4; +extern TrackWaypoint *D_801631D4; // Shadows values from D_80164580 extern s16 *D_801631D8; // Shadows values from D_80164590 @@ -56,7 +56,7 @@ extern u16 *D_801631DC; // Shadowd values from gWaypointCountByPathIndex extern u16 D_80164430; // Shadows values from D_80164550 -extern struct TrackWayPoint *D_80164490; +extern TrackWaypoint *D_80164490; // Shadows values from D_801645A0 extern s16 *D_801645E0; diff --git a/src/camera.c b/src/camera.c index 551f5b2e7..02275b1ae 100644 --- a/src/camera.c +++ b/src/camera.c @@ -214,7 +214,7 @@ void func_8001CA78(UNUSED Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 temp_f18; f32 temp_f16; UNUSED s32 pad; - struct TrackWayPoint *temp_s2; + TrackWaypoint *temp_s2; temp_s2 = &D_80164550[0][gWaypointCountByPathIndex[0] - 10]; sp68[0] = camera->unk_30[0]; @@ -231,10 +231,10 @@ void func_8001CA78(UNUSED Player *player, Camera *camera, Vec3f arg2, f32 *arg3, if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { var_f14 = sp5C[0]; } else { - var_f14 = sp5C[0] + temp_s2->wayPointX; + var_f14 = sp5C[0] + temp_s2->posX; } temp_f16 = sp5C[2] + D_8016524C; - temp_f18 = sp5C[1] + (temp_s2->wayPointY + D_80164A30); + temp_f18 = sp5C[1] + (temp_s2->posY + D_80164A30); arg2[0] += (var_f14 - camera->lookAt[0]) * 1; arg2[1] += (temp_f18 - camera->lookAt[1]) * 1; arg2[2] += (temp_f16 - camera->lookAt[2]) * 1; @@ -242,10 +242,10 @@ void func_8001CA78(UNUSED Player *player, Camera *camera, Vec3f arg2, f32 *arg3, if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { var_f14 = sp68[0]; } else { - var_f14 = sp68[0] + temp_s2->wayPointX; + var_f14 = sp68[0] + temp_s2->posX; } temp_f16 = sp68[2] + D_8016524C; - temp_f18 = sp68[1] + (temp_s2->wayPointY + D_80164A30 + 6.0f); + temp_f18 = sp68[1] + (temp_s2->posY + D_80164A30 + 6.0f); move_f32_towards(&D_80164A30, 0, 0.02f); posX = camera->pos[0]; *arg3 = ((var_f14 - posX) * 1) + posX; @@ -819,28 +819,23 @@ void func_8001EA0C(Camera *camera, Player *player, s8 arg2) { } else { if (player->unk_078 < 0) { var_a3 = 0xA5 - (player->unk_078 / 2); + if ((player->effects & 0x20000000) == 0x20000000) { - //sp4E = temp_a3; move_s16_towards(&camera->unk_B0, -0x0B60, 0.1f); } else { - //sp4E = temp_a3; move_s16_towards(&camera->unk_B0, -0x0888, 0.1f); } } else { var_a3 = (player->unk_078 / 2) + 0xA5; if ((player->effects & 0x20000000) == 0x20000000) { - //sp4E = temp_a3_2; move_s16_towards(&camera->unk_B0, 0x0B60, 0.1f); } else { - //sp4E = temp_a3_2; move_s16_towards(&camera->unk_B0, 0x0888, 0.1f); } } - //var_a3 = sp4E; } } else { move_s16_towards(&camera->unk_B0, 0, 0.05f); - //temp_v1_2 = player->unk_078; var_a3 = ((s16) camera->unk_2C / 182) - ((s16) player->unk_02C[1] / 182); if (player->unk_078 == 0) { if ((player->effects & 0x20) == 0x20) { @@ -968,22 +963,22 @@ void func_8001EE98(Player *player, Camera *camera, s8 index) { switch (D_80152300[cameraIndex]) { case 3: func_8001A588(&D_80152300[cameraIndex], camera, player, index, cameraIndex); - return; + break; case 1: if (((player->unk_0CA & 1) == 1) || ((player->unk_0CA & 2) == 2)) { func_8001E8E8(camera, player, index); - return; + break; } func_8001E45C(camera, player, index); - return; + break; case 8: func_8001E0C4(camera, player, index); func_8001F87C(cameraIndex); - return; + break; case 9: if (((player->unk_0CA & 1) == 1) || ((player->unk_0CA & 2) == 2)) { func_8001E8E8(camera, player, index); - return; + break; } func_8001EA0C(camera, player, index); break; diff --git a/src/camera.h b/src/camera.h index 651148825..c9ae4fcbc 100644 --- a/src/camera.h +++ b/src/camera.h @@ -27,7 +27,7 @@ typedef struct { // This is expected to be a normalized vector, indicates what direction is "up" for the camera /* 0x18 */ Vec3f up; // I think these are the "nautical angles" between pos and lookAt - // rot[0] = pitch, rot[1] = yaw, rot[2] = roll? + // rot[0] = roll? Does nothing?, rot[1] = yaw, rot[2] = pitch /* 0x24 */ Vec3s rot; /* 0x2A */ u16 someBitFlags; /* 0x2C */ s16 unk_2C; diff --git a/src/code_800029B0.c b/src/code_800029B0.c index 36878fc7b..52a4f2eb4 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -202,18 +202,18 @@ void setup_race(void) { func_8029E158(); if (gModeSelection != BATTLE) { - D_8015F8D0[1] = (f32) (D_80164490->wayPointY - 15);; - D_8015F8D0[2] = D_80164490->wayPointZ; + D_8015F8D0[1] = (f32) (D_80164490->posY - 15);; + D_8015F8D0[2] = D_80164490->posZ; if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { D_8015F8D0[0] = (gIsMirrorMode != 0) ? - D_80164490->wayPointX + 138.0f : - D_80164490->wayPointX - 138.0f; + D_80164490->posX + 138.0f : + D_80164490->posX - 138.0f; } else if (gCurrentCourseId == COURSE_WARIO_STADIUM) { D_8015F8D0[0] = (gIsMirrorMode != 0) ? - D_80164490->wayPointX + 12.0f : - D_80164490->wayPointX - 12.0f; + D_80164490->posX + 12.0f : + D_80164490->posX - 12.0f; } else { - D_8015F8D0[0] = D_80164490->wayPointX; + D_8015F8D0[0] = D_80164490->posX; } } if (!gDemoMode) { diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 1785958ec..3b2777ae9 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -2014,7 +2014,7 @@ void func_80009B60(s32 playerId) { sp24 = temp_t6_2; temp_a2_2 = sp38 + D_80164510; temp_a3_2 = sp34 + &D_801631F8; - *temp_a2_2 = (f32) D_80164550[temp_v0_7][*temp_t6_2].wayPointY + 4.3f; + *temp_a2_2 = (f32) D_80164550[temp_v0_7][*temp_t6_2].posY + 4.3f; if ((*temp_a3_2 == 1) && (*temp_a1 == 0)) { sp2C = temp_a1; sp28 = temp_a2_2; @@ -2530,8 +2530,8 @@ block_40: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000B140.s") #endif -s32 func_8000B7E4(UNUSED s32 arg0, u16 wayPointIndex) { - s16 thing = D_801645E0[wayPointIndex]; +s32 func_8000B7E4(UNUSED s32 arg0, u16 waypointIndex) { + s16 thing = D_801645E0[waypointIndex]; if (thing > 0) { return 1; } @@ -2546,23 +2546,23 @@ s32 func_8000B820(s32 playerIndex) { return 0; } -f32 func_8000B874(f32 posX, f32 posZ, u16 wayPointIndex, s32 pathIndex) { +f32 func_8000B874(f32 posX, f32 posZ, u16 waypointIndex, s32 pathIndex) { f32 x1; f32 z1; f32 x2; f32 z2; f32 squaredDistance; f32 math; - struct TrackWayPoint *thing1; - struct TrackWayPoint *thing2; + TrackWaypoint *thing1; + TrackWaypoint *thing2; - thing1 = &D_80164560[pathIndex][wayPointIndex]; - thing2 = &D_80164570[pathIndex][wayPointIndex]; + thing1 = &D_80164560[pathIndex][waypointIndex]; + thing2 = &D_80164570[pathIndex][waypointIndex]; - x1 = thing1->wayPointX; - z1 = thing1->wayPointZ; - x2 = thing2->wayPointX; - z2 = thing2->wayPointZ; + x1 = thing1->posX; + z1 = thing1->posZ; + x2 = thing2->posX; + z2 = thing2->posZ; squaredDistance = ((x2 - x1) * (x2 - x1)) + ((z2 - z1) * (z2 - z1)); if (squaredDistance < 0.01f) { @@ -2572,12 +2572,12 @@ f32 func_8000B874(f32 posX, f32 posZ, u16 wayPointIndex, s32 pathIndex) { return math; } -void func_8000B95C(s32 playerId, u16 wayPointIndex, s32 pathIndex) { +void func_8000B95C(s32 playerId, u16 waypointIndex, s32 pathIndex) { UNUSED Vec3f pad; D_80163068[playerId] = 0.0f; if ((s32) D_800DCA4C[gCurrentCourseId] >= 0) { if ((gPlayers[playerId].type & 0x8000) != 0) { - D_80163068[playerId] = func_8000B874(gPlayers[playerId].pos[0], gPlayers[playerId].pos[2], wayPointIndex, pathIndex); + D_80163068[playerId] = func_8000B874(gPlayers[playerId].pos[0], gPlayers[playerId].pos[2], waypointIndex, pathIndex); } } } @@ -2643,7 +2643,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000BA14.s") //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de extern f32 D_80162FA8; -void func_8000BBD8(s32 wayPointIndex, f32 arg1, s16 pathIndex) { +void func_8000BBD8(s32 waypointIndex, f32 arg1, s16 pathIndex) { f32 sp14; f32 sp10; f32 sp8; @@ -2657,34 +2657,34 @@ void func_8000BBD8(s32 wayPointIndex, f32 arg1, s16 pathIndex) { f32 temp_f8_2; s32 temp_t6; s32 temp_t8; - struct TrackWayPoint *temp_a1; - struct TrackWayPoint *temp_t0; - struct TrackWayPoint *temp_t0_2; - struct TrackWayPoint *temp_t1; - struct TrackWayPoint *temp_v0; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_a1; + TrackWaypoint *temp_t0; + TrackWaypoint *temp_t0_2; + TrackWaypoint *temp_t1; + TrackWaypoint *temp_v0; + TrackWaypoint *temp_v0_2; - temp_t6 = wayPointIndex & 0xFFFF; + temp_t6 = waypointIndex & 0xFFFF; temp_a1 = D_80164560[pathIndex]; temp_t1 = D_80164570[pathIndex]; temp_v0 = &temp_a1[temp_t6]; temp_t0 = &temp_t1[temp_t6]; - sp8 = (f32) temp_t0->wayPointZ; + sp8 = (f32) temp_t0->posZ; temp_t8 = ((s32) ((temp_t6 + 1) & 0xFFFF) % (s32) gWaypointCountByPathIndex[pathIndex]) & 0xFFFF; temp_v0_2 = &temp_a1[temp_t8]; temp_t0_2 = &temp_t1[temp_t8]; - temp_f8 = (f32) temp_v0_2->wayPointX; + temp_f8 = (f32) temp_v0_2->posX; sp14 = temp_f8; - temp_f4 = (f32) temp_v0_2->wayPointZ; + temp_f4 = (f32) temp_v0_2->posZ; sp10 = temp_f4; - temp_f8_2 = (f32) temp_t0_2->wayPointX; + temp_f8_2 = (f32) temp_t0_2->posX; sp4 = temp_f8_2; - temp_f4_2 = (f32) temp_t0_2->wayPointZ; + temp_f4_2 = (f32) temp_t0_2->posZ; sp0 = temp_f4_2; temp_f0 = 0.5f - (arg1 * 0.5f); temp_f12 = 1.0f - temp_f0; - *D_80162FA0 = (((f32) temp_v0->wayPointX + temp_f8) * temp_f0 * 0.5f) + (temp_f12 * ((f32) temp_t0->wayPointX + temp_f8_2) * 0.5f); - D_80162FA8 = (((f32) temp_v0->wayPointZ + temp_f4) * temp_f0 * 0.5f) + (temp_f12 * (sp8 + temp_f4_2) * 0.5f); + *D_80162FA0 = (((f32) temp_v0->posX + temp_f8) * temp_f0 * 0.5f) + (temp_f12 * ((f32) temp_t0->posX + temp_f8_2) * 0.5f); + D_80162FA8 = (((f32) temp_v0->posZ + temp_f4) * temp_f0 * 0.5f) + (temp_f12 * (sp8 + temp_f4_2) * 0.5f); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000BBD8.s") @@ -2696,67 +2696,67 @@ s16 func_8000BD94(f32 posX, f32 posY, f32 posZ, s32 pathIndex) { f32 z_dist; f32 considerSquaredDistance; f32 minimumSquaredDistance; - s32 considerWayPointIndex; - s32 pathWayPointCount; - s16 nearestWayPointIndex; - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + s32 considerWaypointIndex; + s32 pathWaypointCount; + s16 nearestWaypointIndex; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; - pathWayPoints = D_80164550[pathIndex]; - pathWayPointCount = gWaypointCountByPathIndex[pathIndex]; - considerWayPoint = &pathWayPoints[0]; - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + pathWaypoints = D_80164550[pathIndex]; + pathWaypointCount = gWaypointCountByPathIndex[pathIndex]; + considerWaypoint = &pathWaypoints[0]; + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; minimumSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); - nearestWayPointIndex = 0; - for (considerWayPointIndex = 1; considerWayPointIndex < pathWayPointCount; considerWayPoint++, considerWayPointIndex++) { - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + nearestWaypointIndex = 0; + for (considerWaypointIndex = 1; considerWaypointIndex < pathWaypointCount; considerWaypoint++, considerWaypointIndex++) { + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; minimumSquaredDistance = considerSquaredDistance; } } - return nearestWayPointIndex; + return nearestWaypointIndex; } s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex) { - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; f32 x_dist; f32 y_dist; f32 z_dist; f32 considerSquaredDistance; f32 minimumSquaredDistance; - s32 considerWayPointIndex; - s32 pathWayPointCount; + s32 considerWaypointIndex; + s32 pathWaypointCount; s32 temp_t0; s32 var_a1; s32 var_t1; s32 considerPathIndex; s32 var_t4; - s16 nearestWayPointIndex; + s16 nearestWaypointIndex; minimumSquaredDistance = 1000000.0f; temp_t0 = *pathIndex; - nearestWayPointIndex = 0; + nearestWaypointIndex = 0; var_t1 = 0; var_a1 = 0; - pathWayPoints = D_80164550[temp_t0]; - pathWayPointCount = gWaypointCountByPathIndex[temp_t0]; - considerWayPoint = &pathWayPoints[0]; - for (considerWayPointIndex = 0; considerWayPointIndex < pathWayPointCount; considerWayPointIndex++, considerWayPoint++) { - if ((considerWayPoint->wayPointTrackSegment == trackSegment) || (gCurrentCourseId == COURSE_AWARD_CEREMONY)) { + pathWaypoints = D_80164550[temp_t0]; + pathWaypointCount = gWaypointCountByPathIndex[temp_t0]; + considerWaypoint = &pathWaypoints[0]; + for (considerWaypointIndex = 0; considerWaypointIndex < pathWaypointCount; considerWaypointIndex++, considerWaypoint++) { + if ((considerWaypoint->trackSegment == trackSegment) || (gCurrentCourseId == COURSE_AWARD_CEREMONY)) { var_t1 = 1; - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; var_a1 = 1; minimumSquaredDistance = considerSquaredDistance; } @@ -2765,17 +2765,17 @@ s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex if (var_t1 == 0) { for (considerPathIndex = 0; considerPathIndex < 4; considerPathIndex++) { if ((considerPathIndex != temp_t0) && (D_80163368[considerPathIndex] >= 2)) { - pathWayPoints = D_80164550[considerPathIndex]; - considerWayPoint = &pathWayPoints[0]; - pathWayPointCount = gWaypointCountByPathIndex[considerPathIndex]; - for (considerWayPointIndex = 0; considerWayPointIndex < pathWayPointCount; considerWayPointIndex++, considerWayPoint++) { - if (considerWayPoint->wayPointTrackSegment == trackSegment) { - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + pathWaypoints = D_80164550[considerPathIndex]; + considerWaypoint = &pathWaypoints[0]; + pathWaypointCount = gWaypointCountByPathIndex[considerPathIndex]; + for (considerWaypointIndex = 0; considerWaypointIndex < pathWaypointCount; considerWaypointIndex++, considerWaypoint++) { + if (considerWaypoint->trackSegment == trackSegment) { + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; var_t4 = considerPathIndex; var_a1 = 2; minimumSquaredDistance = considerSquaredDistance; @@ -2786,21 +2786,21 @@ s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex } } if (var_a1 == 0) { - pathWayPoints = D_80164550[0]; - pathWayPointCount = gWaypointCountByPathIndex[0]; - considerWayPoint = &pathWayPoints[0]; - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + pathWaypoints = D_80164550[0]; + pathWaypointCount = gWaypointCountByPathIndex[0]; + considerWaypoint = &pathWaypoints[0]; + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; minimumSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); - nearestWayPointIndex = 0; - for (considerWayPointIndex = 1; considerWayPointIndex < pathWayPointCount; considerWayPoint++, considerWayPointIndex++) { - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + nearestWaypointIndex = 0; + for (considerWaypointIndex = 1; considerWaypointIndex < pathWaypointCount; considerWaypoint++, considerWaypointIndex++) { + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; var_t4 = 0; var_a1 = 2; minimumSquaredDistance = considerSquaredDistance; @@ -2810,118 +2810,118 @@ s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex if (var_a1 == 2) { *pathIndex = var_t4; } - return nearestWayPointIndex; + return nearestWaypointIndex; } /** * Tries to find the waypoint nearest to (posX, posY, posZ) * Only consider waypoints in the same segment as trackSegment * Only considers waypoints within 500 units of (posX, posY, posZ) - * Looks 3 waypoints behind and 6 waypoints ahead of wayPointIndex + * Looks 3 waypoints behind and 6 waypoints ahead of waypointIndex **/ -s16 func_8000C884(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex, u16 trackSegment) { - s16 nearestWayPointIndex; +s16 func_8000C884(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex, u16 trackSegment) { + s16 nearestWaypointIndex; s16 searchIndex; s16 considerIndex; - s32 pathWayPointCount; + s32 pathWaypointCount; f32 x_dist; f32 y_dist; f32 z_dist; f32 minimumDistance; f32 squaredDistance; - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; - nearestWayPointIndex = -1; + nearestWaypointIndex = -1; minimumDistance = 250000.0f; - pathWayPointCount = gWaypointCountByPathIndex[pathIndex]; - pathWayPoints = D_80164550[pathIndex]; - for(searchIndex = wayPointIndex - 3; searchIndex < wayPointIndex + 7; searchIndex++) { + pathWaypointCount = gWaypointCountByPathIndex[pathIndex]; + pathWaypoints = D_80164550[pathIndex]; + for(searchIndex = waypointIndex - 3; searchIndex < waypointIndex + 7; searchIndex++) { // Its possible for searchIndex to be less than 0 or greater than the number of waypoints in a given path // This is done to ensure we access D_80164550 at a valid index - considerIndex = (searchIndex + pathWayPointCount) % pathWayPointCount; - considerWayPoint = &pathWayPoints[considerIndex]; - if (considerWayPoint->wayPointTrackSegment == trackSegment) { - x_dist = considerWayPoint->wayPointX - posX; - y_dist = considerWayPoint->wayPointY - posY; - z_dist = considerWayPoint->wayPointZ - posZ; + considerIndex = (searchIndex + pathWaypointCount) % pathWaypointCount; + considerWaypoint = &pathWaypoints[considerIndex]; + if (considerWaypoint->trackSegment == trackSegment) { + x_dist = considerWaypoint->posX - posX; + y_dist = considerWaypoint->posY - posY; + z_dist = considerWaypoint->posZ - posZ; squaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (squaredDistance < minimumDistance) { minimumDistance = squaredDistance; - nearestWayPointIndex = considerIndex; + nearestWaypointIndex = considerIndex; } } } - return nearestWayPointIndex; + return nearestWaypointIndex; } /** * Tries to find the waypoint nearest to (posX, posY, posZ) * Only considers waypoints within 400 units of (posX, posY, posZ) - * Looks 3 waypoints behind and 6 waypoints ahead of wayPointIndex + * Looks 3 waypoints behind and 6 waypoints ahead of waypointIndex **/ -s16 func_8000C9DC(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex) { - s16 nearestWayPointIndex; +s16 func_8000C9DC(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) { + s16 nearestWaypointIndex; s16 searchIndex; s16 considerIndex; - s32 wayPointFound; - s32 pathWayPointCount; + s32 waypointFound; + s32 pathWaypointCount; f32 x_dist; f32 y_dist; f32 z_dist; f32 minimumDistance; f32 squaredDistance; - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; - wayPointFound = 0; - nearestWayPointIndex = -1; + waypointFound = 0; + nearestWaypointIndex = -1; minimumDistance = 160000.0f; - pathWayPointCount = gWaypointCountByPathIndex[pathIndex]; - pathWayPoints = D_80164550[pathIndex]; - for(searchIndex = wayPointIndex - 3; searchIndex < wayPointIndex + 7; searchIndex++) { + pathWaypointCount = gWaypointCountByPathIndex[pathIndex]; + pathWaypoints = D_80164550[pathIndex]; + for(searchIndex = waypointIndex - 3; searchIndex < waypointIndex + 7; searchIndex++) { // Its possible for searchIndex to be less than 0 or greater than the number of waypoints in a given path // This is done to ensure we access D_80164550 at a valid index - considerIndex = (searchIndex + pathWayPointCount) % pathWayPointCount; - considerWayPoint = &pathWayPoints[considerIndex]; - x_dist = considerWayPoint->wayPointX - posX; - y_dist = considerWayPoint->wayPointY - posY; - z_dist = considerWayPoint->wayPointZ - posZ; + considerIndex = (searchIndex + pathWaypointCount) % pathWaypointCount; + considerWaypoint = &pathWaypoints[considerIndex]; + x_dist = considerWaypoint->posX - posX; + y_dist = considerWaypoint->posY - posY; + z_dist = considerWaypoint->posZ - posZ; squaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (squaredDistance < minimumDistance) { minimumDistance = squaredDistance; - nearestWayPointIndex = considerIndex; - wayPointFound = 1; + nearestWaypointIndex = considerIndex; + waypointFound = 1; } } - if (wayPointFound == 0) { - for(searchIndex = wayPointIndex - 3; searchIndex < wayPointIndex + 7; searchIndex++) { - considerIndex = ((searchIndex + pathWayPointCount) % pathWayPointCount); - considerWayPoint = &pathWayPoints[considerIndex]; + if (waypointFound == 0) { + for(searchIndex = waypointIndex - 3; searchIndex < waypointIndex + 7; searchIndex++) { + considerIndex = ((searchIndex + pathWaypointCount) % pathWaypointCount); + considerWaypoint = &pathWaypoints[considerIndex]; /** - * This fake match is done to stop the compiler from optimzing out considerWayPoint. + * This fake match is done to stop the compiler from optimzing out considerWaypoint. * Maybe if no waypoint was found some debugging info was printed out, but come * production time they removed the debug printing but not the loop? **/ - if (considerWayPoint && considerWayPoint) {}; + if (considerWaypoint && considerWaypoint) {}; } } - return nearestWayPointIndex; + return nearestWaypointIndex; } -void func_8000CBA4(UNUSED f32 posX, f32 posY, UNUSED f32 posZ, s16 *wayPointIndex) { +void func_8000CBA4(UNUSED f32 posX, f32 posY, UNUSED f32 posZ, s16 *waypointIndex) { s16 var_v0; - var_v0 = *wayPointIndex; + var_v0 = *waypointIndex; if ((gCurrentCourseId == COURSE_WARIO_STADIUM) && (var_v0 >= 0x475) && (var_v0 < 0x480) && (posY < 0.0f)) { var_v0 = 0x0398; } - *wayPointIndex = var_v0; + *waypointIndex = var_v0; } -void func_8000CBF8(UNUSED f32 posX, UNUSED f32 posY, f32 posZ, s16 *wayPointIndex, s32 pathIndex) { +void func_8000CBF8(UNUSED f32 posX, UNUSED f32 posY, f32 posZ, s16 *waypointIndex, s32 pathIndex) { s16 temp; - temp = *wayPointIndex; + temp = *waypointIndex; if (temp == 0) { if (D_8016344C < posZ) { temp = gWaypointCountByPathIndex[pathIndex] - 1; @@ -2929,7 +2929,7 @@ void func_8000CBF8(UNUSED f32 posX, UNUSED f32 posY, f32 posZ, s16 *wayPointInde } else if (((temp + 1) == gWaypointCountByPathIndex[pathIndex]) && (posZ <= D_8016344C)) { temp = 0; } - *wayPointIndex = temp; + *waypointIndex = temp; } s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s32 *pathIndex) { @@ -2948,7 +2948,7 @@ s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s3 #ifdef MIPS_TO_C //generated by m2c commit b52d92c2340f6f4ba1aafb464188bb698752fbb0 on Jul-08-2023 -s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *player, s32 playerId, s32 pathIndex) { +s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *player, s32 playerId, s32 pathIndex) { s16 sp5E; s32 sp48; s16 *sp44; @@ -2964,9 +2964,9 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe s16 temp_v0_6; s16 temp_v0_7; s16 var_v0; - struct TrackWayPoint *temp_v1; - struct TrackWayPoint *temp_v1_3; - struct TrackWayPoint *temp_v1_4; + TrackWaypoint *temp_v1; + TrackWaypoint *temp_v1_3; + TrackWaypoint *temp_v1_4; u16 temp_v0; temp_v0 = player->type; @@ -2974,7 +2974,7 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe var_f20 = posX; var_f22 = posY; if ((temp_v0 & 0x4000) && !(temp_v0 & 0x1000)) { - temp_v0_2 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A)); + temp_v0_2 = func_8000C884(var_f20, var_f22, var_f24, waypointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A)); sp5E = temp_v0_2; if (temp_v0_2 == -1) { sp5E = func_8000CC88(var_f20, var_f22, var_f24, player, playerId, &pathIndex); @@ -2985,12 +2985,12 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe if (D_801631E0[playerId] == 1) { temp_a0 = player->unk_0CA; if (temp_a0 & 1) { - temp_v1 = &D_80164550[pathIndex][wayPointIndex]; - player->pos[0] = (f32) temp_v1->wayPointX; - player->pos[1] = (f32) temp_v1->wayPointY; + temp_v1 = &D_80164550[pathIndex][waypointIndex]; + player->pos[0] = (f32) temp_v1->posX; + player->pos[1] = (f32) temp_v1->posY; player->unk_0CA = temp_a0 & 0xFFFE; - player->pos[2] = (f32) temp_v1->wayPointZ; - return wayPointIndex; + player->pos[2] = (f32) temp_v1->posZ; + return waypointIndex; } if (playerId == ((s32) D_80163488 % 8)) { func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24); @@ -2998,32 +2998,32 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe temp_v1_2 = sp48 + D_80163318; *temp_v1_2 = temp_v0_3; sp44 = temp_v1_2; - var_v0 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) (temp_v0_3 & 0xFFFF)); + var_v0 = func_8000C884(var_f20, var_f22, var_f24, waypointIndex, pathIndex, (u16) (temp_v0_3 & 0xFFFF)); sp5E = var_v0; if (var_v0 == -1) { sp44 = temp_v1_2; - var_v0 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); + var_v0 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex); sp5E = var_v0; } if (var_v0 == -1) { temp_v0_4 = func_8000C0BC(var_f20, var_f22, var_f24, (u16) *temp_v1_2, &pathIndex); sp5E = temp_v0_4; temp_v1_3 = &D_80164550[pathIndex][temp_v0_4]; - player->pos[0] = (f32) temp_v1_3->wayPointX; - player->pos[1] = (f32) temp_v1_3->wayPointY; - player->pos[2] = (f32) temp_v1_3->wayPointZ; + player->pos[0] = (f32) temp_v1_3->posX; + player->pos[1] = (f32) temp_v1_3->posY; + player->pos[2] = (f32) temp_v1_3->posZ; } } else { - temp_v0_5 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); + temp_v0_5 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex); sp5E = temp_v0_5; if (temp_v0_5 == -1) { temp_v0_6 = func_8000BD94(var_f20, var_f22, var_f24, pathIndex); sp5E = temp_v0_6; temp_v1_4 = &D_80164550[pathIndex][temp_v0_6]; - var_f20 = (f32) temp_v1_4->wayPointX; - var_f22 = (f32) temp_v1_4->wayPointY; + var_f20 = (f32) temp_v1_4->posX; + var_f22 = (f32) temp_v1_4->posY; player->pos[0] = var_f20; - var_f24 = (f32) temp_v1_4->wayPointZ; + var_f24 = (f32) temp_v1_4->posZ; player->pos[1] = var_f22; player->pos[2] = var_f24; func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24); @@ -3032,7 +3032,7 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe } goto block_16; } - temp_v0_7 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); + temp_v0_7 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex); sp5E = temp_v0_7; if (temp_v0_7 == -1) { sp5E = func_8000CC88(var_f20, var_f22, var_f24, player, playerId, &pathIndex); @@ -3115,10 +3115,10 @@ s16 func_8000D24C(f32 posX, f32 posY, f32 posZ, s32 *pathIndex) { return func_8000C0BC(posX, posY, posZ, func_802ABD40(sp24.unk3A), pathIndex); } -s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex) { +s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) { s16 temp_v0; - temp_v0 = func_8000C9DC(posX, posY, posZ, wayPointIndex, pathIndex); + temp_v0 = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex); if (temp_v0 == -1) { temp_v0 = func_8000D24C(posX, posY, posZ, &pathIndex); } @@ -3126,10 +3126,10 @@ s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex return temp_v0; } -s16 func_8000D33C(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex) { +s16 func_8000D33C(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) { s16 var_v1; - var_v1 = func_8000C9DC(posX, posY, posZ, wayPointIndex, pathIndex); + var_v1 = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex); if (var_v1 == -1) { var_v1 = func_8000D24C(posX, posY, posZ, &pathIndex); } @@ -3266,7 +3266,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D438.s") void func_8000BBD8(u16, s32, s16, u16); /* extern */ extern f32 D_80162FA0; -void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathIndex, s16 arg5) { +void func_8000D6D0(Vec3f arg0, s16 *waypointIndex, f32 arg2, s32 arg3, s16 pathIndex, s16 arg5) { s16 spA0; u16 sp9E; f32 sp98; @@ -3274,7 +3274,7 @@ void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathI f32 sp58; f32 sp54; f32 sp50; - struct TrackWayPoint *sp4C; + TrackWaypoint *sp4C; f32 sp48; f32 sp44; f32 sp40; @@ -3301,8 +3301,8 @@ void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathI temp_f24 = arg0->unk8; temp_f20 = arg0->unk0; temp_f22 = arg0->unk4; - temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *wayPointIndex, (s32) pathIndex); - *wayPointIndex = temp_v0; + temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *waypointIndex, (s32) pathIndex); + *waypointIndex = temp_v0; temp_a3 = gWaypointCountByPathIndex[pathIndex]; temp_v1 = temp_v0 + arg5; temp_hi = temp_v1 % (s32) temp_a3; @@ -3313,7 +3313,7 @@ void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathI sp98 = D_80162FA0.unk0; sp90 = temp_f4; func_8000BBD8(sp9E, arg3, pathIndex); - temp_f18 = ((f32) (sp4C[(s16) sp9E].wayPointY + sp4C[spA0].wayPointY) * 0.5f) - temp_f22; + temp_f18 = ((f32) (sp4C[(s16) sp9E].posY + sp4C[spA0].posY) * 0.5f) - temp_f22; temp_f16 = ((sp98 + D_80162FA0.unk0) * 0.5f) - temp_f20; sp44 = temp_f18; sp48 = temp_f16; @@ -3370,7 +3370,7 @@ void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) { s32 temp_a3; s32 temp_t2; s32 temp_v1; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; u16 temp_t0; sp54 = arg0->unk0; @@ -3394,7 +3394,7 @@ void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) { sp98 = temp_f4; func_8000BBD8(spA6, arg3, pathIndex); temp_v0_2 = D_80164550[pathIndex]; - temp_f18 = ((f32) (temp_v0_2[(s16) spA6].wayPointY + temp_v0_2[spA8].wayPointY) * 0.5f) - temp_f22; + temp_f18 = ((f32) (temp_v0_2[(s16) spA6].posY + temp_v0_2[spA8].posY) * 0.5f) - temp_f22; temp_f16 = ((spA0 + D_80162FA0.unk0) * 0.5f) - temp_f20; sp4C = temp_f18; sp50 = temp_f16; @@ -3419,18 +3419,19 @@ void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D940.s") #endif +extern s32 D_8016359C; #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de s16 func_8000D100(f32, f32, f32, s16); /* extern */ -extern s32 D_80163598; -extern s32 D_8016359C; +extern TrackWaypoint *D_80163598; -void func_8000DBAC(Vec3f arg0, s16 *arg1, f32 arg2) { + +s16 func_8000DBAC(Vec3f pos, s16 *waypointIndex, f32 speed) { f32 sp98; f32 sp94; - f32 sp40; - f32 sp3C; - f32 sp38; + //f32 sp40; + //f32 sp3C; + Vec3f sp38; f32 sp34; f32 sp30; f32 temp_f0; @@ -3447,36 +3448,44 @@ void func_8000DBAC(Vec3f arg0, s16 *arg1, f32 arg2) { void *temp_a0; void *temp_a2; - temp_f12 = arg0->unk0; - temp_f14 = arg0->unk4; - temp_f2 = arg0->unk8; - sp38 = temp_f12; - sp3C = arg0->unk4; - sp40 = arg0->unk8; + temp_f12 = pos[0]; + temp_f14 = pos[1]; + temp_f2 = pos[2]; + + sp38[0] = pos[0]; + sp38[1] = pos[1]; + sp38[2] = pos[2]; + sp98 = temp_f14; sp94 = temp_f2; - temp_v0 = func_8000D100(temp_f12, temp_f14, temp_f2, *arg1); - *arg1 = temp_v0; - temp_v1 = D_8016359C; - temp_a1 = D_80163598; - temp_a0 = ((s16) ((s32) (temp_v0 + 3) % temp_v1) * 4) + temp_a1; - temp_a2 = ((s16) ((s32) (temp_v0 + 4) % temp_v1) * 4) + temp_a1; - temp_f16 = ((f32) (temp_a0->unk0 + temp_a2->unk0) * 0.5f) - temp_f12; - temp_f18 = ((f32) (temp_a0->unk2 + temp_a2->unk2) * 0.5f) - temp_f2; + temp_v0 = func_8000D100(temp_f12, temp_f14, temp_f2, *waypointIndex); + *waypointIndex = temp_v0; + + temp_a0 = ((s16) ((s32) (temp_v0 + 3) % temp_v1)); + temp_a2 = ((s16) ((s32) (temp_v0 + 4) % temp_v1)); + + temp_v1 = D_8016359C[temp_a0]; + temp_a1 = D_80163598[temp_a2]; + + temp_f16 = ((f32) (temp_v1->waypointX + temp_a1->waypointX) * 0.5f) - temp_f12; + temp_f18 = ((f32) (temp_v1->waypointY + temp_a1->waypointY) * 0.5f) - temp_f2; + sp34 = temp_f16; sp30 = temp_f18; + temp_f0 = sqrtf((temp_f16 * temp_f16) + (temp_f18 * temp_f18)); + if (temp_f0 > 0.01f) { - var_f12 = ((temp_f16 * arg2) / temp_f0) + temp_f12; - var_f14 = ((temp_f18 * arg2) / temp_f0) + temp_f2; + var_f12 = ((temp_f16 * speed) / temp_f0) + temp_f12; + var_f14 = ((temp_f18 * speed) / temp_f0) + temp_f2; } else { var_f12 = temp_f12; var_f14 = temp_f2; } - arg0->unk0 = var_f12; - arg0->unk8 = var_f14; - arg0->unk4 = sp98; - func_80005FD0(&sp38, arg0); + pos[0] = var_f12; + pos[1] = sp98; + pos[2] = var_f14; + return func_80005FD0(&sp38, pos); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000DBAC.s") @@ -3488,7 +3497,7 @@ void func_8000DD78(void) { f32 startingZPos; f32 startingYPos; s32 var_s3; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; struct_D_80163DE8_entry *var_s0; BombKartSpawn *temp_s1; @@ -3501,16 +3510,16 @@ void func_8000DD78(void) { startingYPos = func_802AE1C0(startingXPos, 2000.0f, startingZPos); break; case COURSE_AWARD_CEREMONY: - temp_v0 = &D_80164550[3][temp_s1->wayPointIndex]; - startingXPos = temp_v0->wayPointX; - startingYPos = temp_v0->wayPointY; - startingZPos = temp_v0->wayPointZ; + temp_v0 = &D_80164550[3][temp_s1->waypointIndex]; + startingXPos = temp_v0->posX; + startingYPos = temp_v0->posY; + startingZPos = temp_v0->posZ; break; default: - temp_v0 = &D_80164550[0][temp_s1->wayPointIndex]; - startingXPos = temp_v0->wayPointX; - startingYPos = temp_v0->wayPointY; - startingZPos = temp_v0->wayPointZ; + temp_v0 = &D_80164550[0][temp_s1->waypointIndex]; + startingXPos = temp_v0->posX; + startingYPos = temp_v0->posY; + startingZPos = temp_v0->posZ; break; } D_80163DE8[var_s3].bombPos[0] = startingXPos; @@ -3528,7 +3537,7 @@ void func_8000DD78(void) { D_80163DE8[var_s3].wheel4Pos[0] = startingXPos; D_80163DE8[var_s3].wheel4Pos[1] = startingYPos; D_80163DE8[var_s3].wheel4Pos[2] = startingZPos; - D_80163DE8[var_s3].wayPointIndex = temp_s1->wayPointIndex; + D_80163DE8[var_s3].waypointIndex = temp_s1->waypointIndex; D_80163DE8[var_s3].unk_3C = temp_s1->unk_04; D_80163DE8[var_s3].bounceTimer = 0; D_80163DE8[var_s3].circleTimer = 0; @@ -3555,7 +3564,7 @@ s16 gCurrentCourseId; /* unable to generate initia void func_8000DF8C(s32 arg0) { f32 sp118; f32 sp114; - struct TrackWayPoint *sp110; + TrackWaypoint *sp110; f32 sp108; f32 spF8; f32 spF0; @@ -3615,10 +3624,10 @@ void func_8000DF8C(s32 arg0) { s32 temp_t9_2; s32 var_a0; s8 var_v1; - struct TrackWayPoint *temp_v0_2; - struct TrackWayPoint *temp_v0_4; - struct TrackWayPoint *temp_v0_7; - struct TrackWayPoint *temp_v1_2; + TrackWaypoint *temp_v0_2; + TrackWaypoint *temp_v0_4; + TrackWaypoint *temp_v0_7; + TrackWaypoint *temp_v1_2; struct_D_80163DE8_entry *temp_s0; u16 temp_t4; u16 temp_t9; @@ -3637,7 +3646,7 @@ void func_8000DF8C(s32 arg0) { var_f22 = temp_s0->bombPos[0]; var_f20 = temp_s0->bombPos[1]; var_f24 = temp_s0->bombPos[2]; - spCA = (u16) temp_s0->wayPointIndex; + spCA = (u16) temp_s0->waypointIndex; spC4 = temp_s0->unk_3C; spC2 = (u16) temp_s0->someRot; sp7C = (u16) temp_s0->bounceTimer; @@ -3697,18 +3706,18 @@ void func_8000DF8C(s32 arg0) { temp_v0_2 = &(*D_80164550)[spCA]; var_f20 = temp_s0->yPos + 3.5f; temp_t7 = ((s32) (((s32) (sp48 + 1) % 360) * 0xFFFF) / 360) & 0xFFFF; - var_f22 = (f32) temp_v0_2->wayPointX + sp118; + var_f22 = (f32) temp_v0_2->posX + sp118; D_80162FB0.unk4 = var_f20; D_80162FB0.unk0 = var_f22; sp44 = temp_t7; sp110 = temp_v0_2; - var_f24 = (f32) temp_v0_2->wayPointZ + (f32) ((f64) temp_f0_3 * 25.0); + var_f24 = (f32) temp_v0_2->posZ + (f32) ((f64) temp_f0_3 * 25.0); D_80162FB0.unk8 = var_f24; sp118 = (f32) ((f64) coss((u16) temp_t7) * 25.0); temp_f10 = (f64) sins((u16) sp44); - D_80162FC0.unk0 = (f32) temp_v0_2->wayPointX + sp118; - D_80162FC0.unk4 = (f32) temp_v0_2->wayPointY; - D_80162FC0.unk8 = (f32) ((f32) temp_v0_2->wayPointZ + (f32) (temp_f10 * 25.0)); + D_80162FC0.unk0 = (f32) temp_v0_2->posX + sp118; + D_80162FC0.unk4 = (f32) temp_v0_2->posY; + D_80162FC0.unk8 = (f32) ((f32) temp_v0_2->posZ + (f32) (temp_f10 * 25.0)); spC2 = (u16) ((s32) (get_angle_between_points(&D_80162FB0, &D_80162FC0) * 0xFFFF) / 65520); break; case 2: @@ -3719,7 +3728,7 @@ void func_8000DF8C(s32 arg0) { sp48 = (s32) temp_v0_3; sp118 = (f32) ((f64) coss((u16) temp_a0) * 25.0); temp_v0_4 = &(*D_80164550)[spCA]; - var_f22 = (f32) temp_v0_4->wayPointX + sp118; + var_f22 = (f32) temp_v0_4->posX + sp118; var_f20 = temp_s0->yPos + 3.5f; temp_f4 = (f64) sins((u16) temp_a0) * 25.0; temp_a0_2 = ((s32) (((s32) (sp48 + 1) % 360) * 0xFFFF) / 360) & 0xFFFF; @@ -3727,13 +3736,13 @@ void func_8000DF8C(s32 arg0) { D_80162FB0.unk4 = var_f20; sp44 = temp_a0_2; sp110 = temp_v0_4; - var_f24 = (f32) temp_v0_4->wayPointZ + (f32) temp_f4; + var_f24 = (f32) temp_v0_4->posZ + (f32) temp_f4; D_80162FB0.unk8 = var_f24; sp118 = (f32) ((f64) coss((u16) temp_a0_2) * 25.0); temp_f8 = (f64) sins((u16) temp_a0_2); - D_80162FC0.unk0 = (f32) temp_v0_4->wayPointX + sp118; - D_80162FC0.unk4 = (f32) temp_v0_4->wayPointY; - D_80162FC0.unk8 = (f32) ((f32) temp_v0_4->wayPointZ + (f32) (temp_f8 * 25.0)); + D_80162FC0.unk0 = (f32) temp_v0_4->posX + sp118; + D_80162FC0.unk4 = (f32) temp_v0_4->posY; + D_80162FC0.unk8 = (f32) ((f32) temp_v0_4->posZ + (f32) (temp_f8 * 25.0)); spC2 = (u16) ((s32) (get_angle_between_points(&D_80162FB0, &D_80162FC0) * 0xFFFF) / 65520); default: break; @@ -3794,14 +3803,14 @@ void func_8000DF8C(s32 arg0) { break; case 4: temp_v0_7 = &(*D_80164550)[spCA]; - D_80162FB0.unk0 = (f32) temp_v0_7->wayPointX; - D_80162FB0.unk4 = (f32) temp_v0_7->wayPointY; - D_80162FB0.unk8 = (f32) temp_v0_7->wayPointZ; + D_80162FB0.unk0 = (f32) temp_v0_7->posX; + D_80162FB0.unk4 = (f32) temp_v0_7->posY; + D_80162FB0.unk8 = (f32) temp_v0_7->posZ; temp_v1_2 = &(*D_80164550)[(s32) (spCA + 1) % (s32) *gWaypointCountByPathIndex]; - D_80162FC0.unk0 = (f32) temp_v1_2->wayPointX; - D_80162FC0.unk4 = (f32) temp_v1_2->wayPointY; + D_80162FC0.unk0 = (f32) temp_v1_2->posX; + D_80162FC0.unk4 = (f32) temp_v1_2->posY; var_f6 = (f32) var_s1; - D_80162FC0.unk8 = (f32) temp_v1_2->wayPointZ; + D_80162FC0.unk8 = (f32) temp_v1_2->posZ; if ((s32) var_s1 < 0) { var_f6 += 4294967296.0f; } @@ -3868,7 +3877,7 @@ void func_8000DF8C(s32 arg0) { temp_s0->bombPos[1] = var_f20; temp_s0->bombPos[2] = var_f24; temp_s0->wheel4Pos[1] = sp88; - temp_s0->wayPointIndex = (s16) spCA; + temp_s0->waypointIndex = (s16) spCA; temp_s0->unk_3C = spC4; temp_s0->someRot = (s16) spC2; temp_s0->state = (s16) sp7E; @@ -4124,7 +4133,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F124.s") #endif // Delete track waypoints -void func_8000F2BC(struct TrackWayPoint *arg0, size_t size) { +void func_8000F2BC(TrackWaypoint *arg0, size_t size) { bzero((void *) arg0, size << 3); } @@ -4666,7 +4675,7 @@ void func_8000F628(void) { D_80163478 = 0; D_80163378 = 0; D_8016337C = 0; - D_8016344C = (f32) (*D_80164550)->wayPointZ; + D_8016344C = (f32) (*D_80164550)->posZ; D_801634F0 = 0; D_801634F4 = 0; D_80163488 = 0; @@ -4706,7 +4715,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F628.s") #endif // dest src size pathIndex -u16 func_80011014(struct TrackWayPoint *, struct TrackWayPoint *, s32, s32); /* extern */ +u16 func_80011014(TrackWaypoint *, TrackWaypoint *, s32, s32); /* extern */ extern uintptr_t gCoursePathTable[20][4]; extern uintptr_t D_800DC8D0[20][4]; @@ -4718,9 +4727,9 @@ extern uintptr_t D_800DC8D0[20][4]; // Each course can have 1-4 course paths. void func_800100F0(s32 pathIndex) { - struct TrackWayPoint *ptr; - struct TrackWayPoint *pathDest; - struct TrackWayPoint *path; + TrackWaypoint *ptr; + TrackWaypoint *pathDest; + TrackWaypoint *path; s32 var_v0; s32 sp24; s32 pad[2]; @@ -4741,7 +4750,7 @@ void func_800100F0(s32 pathIndex) { ptr = path; for (i = 0; i < 3000; i++, ptr++) { - if ((u16)ptr->wayPointX == 0x8000 ) { + if ((u16)ptr->posX == 0x8000 ) { sp24 = i - 1; bInvalidPath = 0; break; @@ -4760,7 +4769,7 @@ void func_800100F0(s32 pathIndex) { } void func_80010218(s32 pathIndex) { - f32 wayPointWidth; + f32 waypointWidth; f32 x1; f32 y1; f32 z1; @@ -4773,47 +4782,47 @@ void func_80010218(s32 pathIndex) { f32 neg_z_dist; f32 xz_dist; s32 temp_f16; - s32 wayPointIndex; - struct TrackWayPoint *wayPoint; - struct TrackWayPoint *nextWayPoint; - struct TrackWayPoint *var_s1; - struct TrackWayPoint *var_s2; + s32 waypointIndex; + TrackWaypoint *waypoint; + TrackWaypoint *nextWaypoint; + TrackWaypoint *var_s1; + TrackWaypoint *var_s2; if (((s32) D_800DCA4C[gCurrentCourseId]) >= 0) { - wayPointWidth = D_800DCA4C[gCurrentCourseId]; - wayPoint = &D_80164550[pathIndex][0]; + waypointWidth = D_800DCA4C[gCurrentCourseId]; + waypoint = &D_80164550[pathIndex][0]; var_s1 = &D_80164560[pathIndex][0]; var_s2 = &D_80164570[pathIndex][0]; - for (wayPointIndex = 0; wayPointIndex < gWaypointCountByPathIndex[pathIndex]; wayPointIndex++, var_s1++, var_s2++) { - x1 = wayPoint->wayPointX; - y1 = wayPoint->wayPointY; - z1 = wayPoint->wayPointZ; - wayPoint++; - nextWayPoint = &D_80164550[pathIndex][(wayPointIndex + 1) % ((s32) gWaypointCountByPathIndex[pathIndex])]; - x2 = nextWayPoint->wayPointX; - y2 = nextWayPoint->wayPointY; - z2 = nextWayPoint->wayPointZ; + for (waypointIndex = 0; waypointIndex < gWaypointCountByPathIndex[pathIndex]; waypointIndex++, var_s1++, var_s2++) { + x1 = waypoint->posX; + y1 = waypoint->posY; + z1 = waypoint->posZ; + waypoint++; + nextWaypoint = &D_80164550[pathIndex][(waypointIndex + 1) % ((s32) gWaypointCountByPathIndex[pathIndex])]; + x2 = nextWaypoint->posX; + y2 = nextWaypoint->posY; + z2 = nextWaypoint->posZ; x_dist = x2 - x1; z_dist = z2 - z1; neg_x_dist = x1 - x2; neg_z_dist = z1 - z2; xz_dist = sqrtf((x_dist * x_dist) + (z_dist * z_dist)); temp_f16 = (f32) ((y1 + y2) * 0.5); - var_s1->wayPointX = ((wayPointWidth * z_dist) / xz_dist) + x1; - var_s1->wayPointY = temp_f16; - var_s1->wayPointZ = ((wayPointWidth * neg_x_dist) / xz_dist) + z1; - var_s2->wayPointX = ((wayPointWidth * neg_z_dist) / xz_dist) + x1; - var_s2->wayPointY = temp_f16; - var_s2->wayPointZ = ((wayPointWidth * x_dist) / xz_dist) + z1; + var_s1->posX = ((waypointWidth * z_dist) / xz_dist) + x1; + var_s1->posY = temp_f16; + var_s1->posZ = ((waypointWidth * neg_x_dist) / xz_dist) + z1; + var_s2->posX = ((waypointWidth * neg_z_dist) / xz_dist) + x1; + var_s2->posY = temp_f16; + var_s2->posZ = ((waypointWidth * x_dist) / xz_dist) + z1; } } } -f32 func_80010480(s32 pathIndex, u16 wayPointIndex) { +f32 func_80010480(s32 pathIndex, u16 waypointIndex) { f32 temp_f10_2; f32 temp_f8; UNUSED f32 stackPadding; - struct TrackWayPoint *pathWaypoints; + TrackWaypoint *pathWaypoints; f32 x1; f32 z1; f32 x2; @@ -4822,38 +4831,38 @@ f32 func_80010480(s32 pathIndex, u16 wayPointIndex) { f32 z3; f32 temp_f8_2; f32 temp_f10; - s32 wayPointCount; - struct TrackWayPoint *wayPoint3; - struct TrackWayPoint *wayPoint2; - struct TrackWayPoint *wayPoint1; + s32 waypointCount; + TrackWaypoint *waypoint3; + TrackWaypoint *waypoint2; + TrackWaypoint *waypoint1; f32 root2; f32 root1; if ((s32) D_800DCA4C[gCurrentCourseId] < 0) { return 0.0f; } - wayPointCount = gWaypointCountByPathIndex[pathIndex]; + waypointCount = gWaypointCountByPathIndex[pathIndex]; pathWaypoints = D_80164550[pathIndex]; - wayPoint1 = &pathWaypoints[wayPointIndex]; - wayPoint2 = &pathWaypoints[(wayPointIndex + 1) % wayPointCount]; - wayPoint3 = &pathWaypoints[(wayPointIndex + 2) % wayPointCount]; - x1 = wayPoint1->wayPointX; - z1 = wayPoint1->wayPointZ; - x2 = wayPoint2->wayPointX; - z2 = wayPoint2->wayPointZ; - x3 = wayPoint3->wayPointX; - z3 = wayPoint3->wayPointZ; + waypoint1 = &pathWaypoints[waypointIndex]; + waypoint2 = &pathWaypoints[(waypointIndex + 1) % waypointCount]; + waypoint3 = &pathWaypoints[(waypointIndex + 2) % waypointCount]; + x1 = waypoint1->posX; + z1 = waypoint1->posZ; + x2 = waypoint2->posX; + z2 = waypoint2->posZ; + x3 = waypoint3->posX; + z3 = waypoint3->posZ; temp_f8_2 = (((x2 + x3) * 0.5) - x1); temp_f10 = (((z2 + z3) * 0.5) - z1); - wayPoint1 = &pathWaypoints[(wayPointIndex + 3) % wayPointCount]; - wayPoint2 = &pathWaypoints[(wayPointIndex + 4) % wayPointCount]; - wayPoint3 = &pathWaypoints[(wayPointIndex + 5) % wayPointCount]; - x1 = wayPoint1->wayPointX; - z1 = wayPoint1->wayPointZ; - x2 = wayPoint2->wayPointX; - z2 = wayPoint2->wayPointZ; - x3 = wayPoint3->wayPointX; - z3 = wayPoint3->wayPointZ; + waypoint1 = &pathWaypoints[(waypointIndex + 3) % waypointCount]; + waypoint2 = &pathWaypoints[(waypointIndex + 4) % waypointCount]; + waypoint3 = &pathWaypoints[(waypointIndex + 5) % waypointCount]; + x1 = waypoint1->posX; + z1 = waypoint1->posZ; + x2 = waypoint2->posX; + z2 = waypoint2->posZ; + x3 = waypoint3->posX; + z3 = waypoint3->posZ; temp_f10_2 = (((x2 + x3) * 0.5) - x1); temp_f8 = (((z2 + z3) * 0.5) - z1); root1 = sqrtf((temp_f10 * temp_f10) + (temp_f8_2 * temp_f8_2)); @@ -4915,33 +4924,33 @@ void func_800107C4(s32 pathIndex) { } } -// Seemingly calculates the atan2 angle between a wayPoint and its forward neighbor -s16 func_80010CB0(s32 pathIndex, s32 wayPointIndex) { +// Seemingly calculates the atan2 angle between a waypoint and its forward neighbor +s16 func_80010CB0(s32 pathIndex, s32 waypointIndex) { s16 ret; Vec3f sp30; Vec3f sp24; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; - temp_v0 = &D_80164550[pathIndex][wayPointIndex]; - sp30[0] = temp_v0->wayPointX; - sp30[1] = temp_v0->wayPointY; - sp30[2] = temp_v0->wayPointZ; - temp_v0 = &D_80164550[pathIndex][(wayPointIndex + 1) % gWaypointCountByPathIndex[pathIndex]]; - sp24[0] = temp_v0->wayPointX; - sp24[1] = temp_v0->wayPointY; - sp24[2] = temp_v0->wayPointZ; + temp_v0 = &D_80164550[pathIndex][waypointIndex]; + sp30[0] = temp_v0->posX; + sp30[1] = temp_v0->posY; + sp30[2] = temp_v0->posZ; + temp_v0 = &D_80164550[pathIndex][(waypointIndex + 1) % gWaypointCountByPathIndex[pathIndex]]; + sp24[0] = temp_v0->posX; + sp24[1] = temp_v0->posY; + sp24[2] = temp_v0->posZ; ret = get_angle_between_points(sp30, sp24); return -ret; } // Populates D_80164590 void func_80010DBC(s32 pathIndex) { - s32 wayPointIndex; + s32 waypointIndex; u16 *angle; if ((s32) D_800DCA4C[gCurrentCourseId] >= 0) { - for (angle = &D_80164590[pathIndex][0], wayPointIndex = 0; wayPointIndex < gWaypointCountByPathIndex[pathIndex]; wayPointIndex++, angle++) { - *angle = func_80010CB0(pathIndex, wayPointIndex); + for (angle = &D_80164590[pathIndex][0], waypointIndex = 0; waypointIndex < gWaypointCountByPathIndex[pathIndex]; waypointIndex++, angle++) { + *angle = func_80010CB0(pathIndex, waypointIndex); } } } @@ -5007,7 +5016,7 @@ f32 func_80010FA0(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3) { //generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 s16 gCurrentCourseId; /* unable to generate initializer */ -s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 arg2, s32 arg3) { +s32 func_80011014(TrackWaypoint *arg0, TrackWaypoint *arg1, s32 arg2, s32 arg3) { f32 spE0; f32 spDC; f32 spD8; @@ -5054,15 +5063,15 @@ s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 ar s32 temp_a2; s32 var_s0; s32 var_s3; - struct TrackWayPoint *temp_a0; - struct TrackWayPoint *temp_v0; - struct TrackWayPoint *temp_v1; - struct TrackWayPoint *var_s1; + TrackWaypoint *temp_a0; + TrackWaypoint *temp_v0; + TrackWaypoint *temp_v1; + TrackWaypoint *var_s1; - temp_f22 = (f32) arg1->wayPointZ; + temp_f22 = (f32) arg1->posZ; var_f30 = 0.0f; var_s1 = arg0; - temp_f20 = (f32) arg1->wayPointX; + temp_f20 = (f32) arg1->posX; var_s0 = 0; var_f28 = func_80010F40(temp_f20, 2000.0f, temp_f22, (s32) gCurrentCourseId, /* extra? */ 0); var_s3 = 0; @@ -5075,17 +5084,17 @@ s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 ar temp_v0 = &arg1[var_s3 % arg2]; temp_v1 = &arg1[temp_a2 % arg2]; temp_a0 = &arg1[(s32) (var_s3 + 2) % arg2]; - temp_f26 = (f32) temp_v0->wayPointX; - temp_f14 = (f32) temp_v0->wayPointZ; - temp_f20_2 = (f32) temp_v1->wayPointX; - temp_f22_2 = (f32) temp_v1->wayPointZ; - spD0 = (f32) temp_a0->wayPointX; + temp_f26 = (f32) temp_v0->posX; + temp_f14 = (f32) temp_v0->posZ; + temp_f20_2 = (f32) temp_v1->posX; + temp_f22_2 = (f32) temp_v1->posZ; + spD0 = (f32) temp_a0->posX; temp_f0 = temp_f20_2 - temp_f26; spDC = temp_f14; temp_f2 = temp_f22_2 - temp_f14; sp84 = temp_a2; spAC = 0.0f; - spCC = (f32) temp_a0->wayPointZ; + spCC = (f32) temp_a0->posZ; temp_f24 = sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2)); temp_f2_2 = spD0 - temp_f20_2; spD8 = temp_f20_2; @@ -5110,15 +5119,15 @@ s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 ar if ((var_f30 > 20.0f) || ((var_s3 == 0) && (var_f20 == 0.0))) { if (gIsMirrorMode != 0) { temp_f12 = -temp_f24_2; - var_s1->wayPointX = (s16) (s32) temp_f12; + var_s1->posX = (s16) (s32) temp_f12; var_f0 = func_80010FA0(temp_f12, var_f28, temp_f26_2, (s32) gCurrentCourseId, /* extra? */ var_s0); } else { - var_s1->wayPointX = (s16) (s32) temp_f24_2; + var_s1->posX = (s16) (s32) temp_f24_2; var_f0 = func_80010FA0(temp_f24_2, var_f28, temp_f26_2, (s32) gCurrentCourseId, /* extra? */ var_s0); } var_f20_2 = var_f0; - var_s1->wayPointZ = (s16) (s32) temp_f26_2; - var_s1->wayPointTrackSegment = func_802ABD40(D_80162E70.unk3A); + var_s1->posZ = (s16) (s32) temp_f26_2; + var_s1->trackSegment = func_802ABD40(D_80162E70.unk3A); temp_f2_4 = (f64) var_f20_2; if (temp_f2_4 < -500.0) { var_f20_2 = var_f28; @@ -5181,7 +5190,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011014.s") #endif // Returns number of waypoints processed. -s32 process_path_data(struct TrackWayPoint *dest, struct TrackWayPoint *src) { +s32 process_path_data(TrackWaypoint *dest, TrackWaypoint *src) { s16 temp_a0; s16 temp_a2; s16 temp_a3; @@ -5191,21 +5200,21 @@ s32 process_path_data(struct TrackWayPoint *dest, struct TrackWayPoint *src) { var_v1 = 0; for (var_v0 = 0; var_v0 < 0x7D0; var_v0++) { - temp_a0 = src->wayPointX; - temp_a2 = src->wayPointY; - temp_a3 = src->wayPointZ; - temp_t0 = src->wayPointTrackSegment; + temp_a0 = src->posX; + temp_a2 = src->posY; + temp_a3 = src->posZ; + temp_t0 = src->trackSegment; src++; if (((temp_a0 & 0xFFFF) == 0x8000) && ((temp_a2 & 0xFFFF) == 0x8000) && ((temp_a3 & 0xFFFF) == 0x8000)) { break; } if (gIsMirrorMode != 0) { - dest->wayPointX = -temp_a0; + dest->posX = -temp_a0; } else { - dest->wayPointX = temp_a0; + dest->posX = temp_a0; } var_v1++; - dest->wayPointY = temp_a2; - dest->wayPointZ = temp_a3; - dest->wayPointTrackSegment = temp_t0; + dest->posY = temp_a2; + dest->posZ = temp_a3; + dest->trackSegment = temp_t0; dest++; } return var_v1; @@ -5464,27 +5473,31 @@ void func_80011B14(s32 playerId, Player *player) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011B14.s") #endif -#ifdef MIPS_TO_C +// Need to know more about D_801632B0 and D_80162EB8 and D_801632D0 +#ifdef NON_MATCHING //generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 //extern ? D_80162EB8; extern s16 D_801630E8[]; -extern s32 D_801632B0; +extern s32 *D_801632B0; void func_80011D48(s32 playerIndex, Player *player) { //s32 temp_a2; //s32 temp_v0; //s32 temp_t3; //void *temp_v1; + u16 test; + s16 temp; // temp_v0 = playerIndex * 2; // * 8) ? //temp_t3 = D_801632D0[playerIndex] + D_80162EB8[gCurrentCourseId]; D_801632B0 = D_801632D0[playerIndex] + D_80162EB8[gCurrentCourseId]; + test = gNearestWaypointByPlayerId[playerIndex]; // temp_a2 = temp_t3; - if (gNearestWaypointByPlayerId[playerIndex] >= D_801632B0) { - switch (D_801632B0) { + if (test >= (u16)*D_801632B0) { + switch (*D_801632B0) { case 1: - player->unk_0BC &= ~0x10; + player->effects &= ~0x10; D_801630E8[playerIndex] = 0; D_801632E8[playerIndex] = 1; break; @@ -5584,7 +5597,6 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011EC0.s") #endif extern s16 D_80162EB0; -extern s32 D_8016359C; f32 func_802AE1C0(f32, f32, f32); s32 func_8001168C(void *, void *, s32); @@ -5593,12 +5605,12 @@ s32 func_8001168C(void *, void *, s32); void func_800120C8(void) { s32 i; s16 *temp; - struct TrackWayPoint *waypoint = (struct TrackWayPoint *) VIRTUAL_TO_PHYSICAL2( + TrackWaypoint *waypoint = (TrackWaypoint *) VIRTUAL_TO_PHYSICAL2( gSegmentTable[SEGMENT_NUMBER2(d_course_kalimari_desert_track_unknown_waypoints)] + SEGMENT_OFFSET(d_course_kalimari_desert_track_unknown_waypoints)); for (i = 0; ; i++) { - if ((u16)waypoint[i].wayPointX == 0x8000) { + if ((u16)waypoint[i].posX == 0x8000) { break; } } @@ -5609,13 +5621,13 @@ void func_800120C8(void) { } void func_80012190(void) { - struct TrackWayPoint *tree; + TrackWaypoint *tree; s32 i = 0; - tree = (struct TrackWayPoint *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[SEGMENT_NUMBER2(d_frappe_snowland_tree)] + (SEGMENT_OFFSET(d_frappe_snowland_tree))); + tree = (TrackWaypoint *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[SEGMENT_NUMBER2(d_frappe_snowland_tree)] + (SEGMENT_OFFSET(d_frappe_snowland_tree))); for (i = 0; ; i++) { - if ((u16)tree[i].wayPointX == 0x8000) { + if ((u16)tree[i].posX == 0x8000) { break; } } @@ -5631,12 +5643,12 @@ void func_80012220(VehicleStuff *vehicle) { origXPos = vehicle->position[0]; origZPos = vehicle->position[2]; if (D_8016347A == 0) { - func_8000D6D0(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); + func_8000D6D0(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); vehicle->rotation[0] = 0; vehicle->rotation[1] = -0x8000; vehicle->rotation[2] = 0; } else { - func_8000D940(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); + func_8000D940(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); vehicle->rotation[0] = 0; vehicle->rotation[1] = 0; vehicle->rotation[2] = 0; @@ -5669,7 +5681,7 @@ void init_course_vehicles(void) { tempLocomotive = &sTrains[loopIndex].locomotive; origXPos = tempLocomotive->position[0]; origZPos = tempLocomotive->position[2]; - trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->wayPointIndex, sTrains[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->waypointIndex, sTrains[loopIndex].someMultiplier); tempLocomotive->velocity[0] = tempLocomotive->position[0] - origXPos; tempLocomotive->velocity[2] = tempLocomotive->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5679,7 +5691,7 @@ void init_course_vehicles(void) { if (tempTender->isActive == 1) { origXPos = tempTender->position[0]; origZPos = tempTender->position[2]; - trainCarYRot = func_8000DBAC(tempTender->position, &tempTender->wayPointIndex, sTrains[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempTender->position, &tempTender->waypointIndex, sTrains[loopIndex].someMultiplier); tempTender->velocity[0] = tempTender->position[0] - origXPos; tempTender->velocity[2] = tempTender->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5691,7 +5703,7 @@ void init_course_vehicles(void) { if (tempPassengerCar->isActive == 1) { origXPos = tempPassengerCar->position[0]; origZPos = tempPassengerCar->position[2]; - trainCarYRot = func_8000DBAC(tempPassengerCar->position, &tempPassengerCar->wayPointIndex, sTrains[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempPassengerCar->position, &tempPassengerCar->waypointIndex, sTrains[loopIndex].someMultiplier); tempPassengerCar->velocity[0] = tempPassengerCar->position[0] - origXPos; tempPassengerCar->velocity[2] = tempPassengerCar->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5706,7 +5718,7 @@ void init_course_vehicles(void) { if(tempPaddleWheelBoat->isActive == 1) { origXPos = tempPaddleWheelBoat->position[0]; origZPos = tempPaddleWheelBoat->position[2]; - tempPaddleWheelBoat->yRotation = func_8000DBAC(tempPaddleWheelBoat->position, &tempPaddleWheelBoat->wayPointIndex, tempPaddleWheelBoat->someMultiplier); + tempPaddleWheelBoat->yRotation = func_8000DBAC(tempPaddleWheelBoat->position, &tempPaddleWheelBoat->waypointIndex, tempPaddleWheelBoat->someMultiplier); tempPaddleWheelBoat->velocity[0] = tempPaddleWheelBoat->position[0] - origXPos; tempPaddleWheelBoat->velocity[2] = tempPaddleWheelBoat->position[2] - origZPos; vec3s_set(paddleWheelBoatRot, 0, tempPaddleWheelBoat->yRotation, 0); @@ -5746,7 +5758,7 @@ void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) { trainCar->position[1] = (f32) D_80162EB0; trainCar->position[2] = (f32) arg1[1]; trainCar->actorIndex = -1; - trainCar->wayPointIndex = arg2; + trainCar->waypointIndex = arg2; trainCar->isActive = 0; trainCar->velocity[0] = 0.0f; trainCar->velocity[1] = 0.0f; @@ -5758,11 +5770,10 @@ void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) { //void func_80012780(TrainStuff *, s32, s32); /* extern */ extern s16 D_80162FCC; //extern s32 D_80163598 -extern s32 D_8016359C; // This is really Vec2s D_80163598[465] but that does not match. // Likely because this is a shared pointer between courses. -extern uintptr_t *D_80163598; +//extern uintptr_t *D_80163598; /** * Set waypoint spawn locations for each rolling stock @@ -5868,21 +5879,21 @@ void func_80012AC0(void) { D_80162FCC += 1; for (i = 0; i < NUM_TRAINS; i++) { - temp_s0 = (u16) sTrains[i].locomotive.wayPointIndex; + temp_s0 = (u16) sTrains[i].locomotive.waypointIndex; temp_f20 = sTrains[i].locomotive.position[0]; temp_f22 = sTrains[i].locomotive.position[2]; - temp_v0 = func_8000DBAC(sTrains[i].locomotive.position, &sTrains[i].locomotive.wayPointIndex, sTrains[i].someMultiplier); + temp_v0 = func_8000DBAC(sTrains[i].locomotive.position, &sTrains[i].locomotive.waypointIndex, sTrains[i].someMultiplier); sTrains[i].locomotive.velocity[0] = sTrains[i].locomotive.position[0] - temp_f20; sTrains[i].locomotive.velocity[2] = sTrains[i].locomotive.position[2] - temp_f22; func_80012A48(&sTrains[i].locomotive, temp_v0); - if ((temp_s0 != sTrains[i].locomotive.wayPointIndex) - && ((sTrains[i].locomotive.wayPointIndex == 0x00BE) - || (sTrains[i].locomotive.wayPointIndex == 0x0140))) { + if ((temp_s0 != sTrains[i].locomotive.waypointIndex) + && ((sTrains[i].locomotive.waypointIndex == 0x00BE) + || (sTrains[i].locomotive.waypointIndex == 0x0140))) { func_800C98B8(sTrains[i].locomotive.position, sTrains[i].locomotive.velocity, 0x1901800E); } else if (random_int(100) == 0) { func_800C98B8(sTrains[i].locomotive.position, sTrains[i].locomotive.velocity, 0x1901800D); @@ -5902,7 +5913,7 @@ void func_80012AC0(void) { if (car->isActive == 1) { temp_f20 = car->position[0]; temp_f22 = car->position[2]; - temp_v0 = func_8000DBAC(car->position, &car->wayPointIndex, sTrains[i].someMultiplier); + temp_v0 = func_8000DBAC(car->position, &car->waypointIndex, sTrains[i].someMultiplier); car->velocity[0] = car->position[0] - temp_f20; car->velocity[2] = car->position[2] - temp_f22; func_80012A48(car, temp_v0); @@ -5914,7 +5925,7 @@ void func_80012AC0(void) { temp_f20 = car->position[0]; temp_f22 = car->position[2]; - temp_v0 = func_8000DBAC(car->position, &car->wayPointIndex, sTrains[i].someMultiplier); + temp_v0 = func_8000DBAC(car->position, &car->waypointIndex, sTrains[i].someMultiplier); car->velocity[0] = car->position[0] - temp_f20; car->velocity[2] = car->position[2] - temp_f22; func_80012A48(car, temp_v0); @@ -5973,7 +5984,6 @@ void func_80012DC0(s32 playerId, Player *player) { } } -extern s32 D_8016359C; extern u16 D_801637BC[2]; /** @@ -5989,7 +5999,7 @@ void func_80013054(void) { isCrossingTriggeredByIndex[1] = 0; for (i = 0; i < NUM_TRAINS; i++) { - temp_f16 = sTrains[i].locomotive.wayPointIndex / ((f32) D_8016359C); + temp_f16 = sTrains[i].locomotive.waypointIndex / ((f32) D_8016359C); temp_f18 = 0.72017354f; temp_f12 = 0.42299348f; @@ -6044,19 +6054,19 @@ extern s8 gPlayerCount; void func_800132F4(void) { PaddleWheelBoatStuff *var_a1; s32 i; - struct TrackWayPoint *temp_a2; + TrackWaypoint *temp_a2; u16 temp; for (i = 0; i < 1; i++) { temp = i * 0xB4; var_a1 = &D_801637C0[i]; temp_a2 = &D_80163598[temp]; - var_a1->position[0] = (f32) temp_a2->wayPointX; + var_a1->position[0] = (f32) temp_a2->posX; var_a1->position[1] = (f32) D_80162EB2; - // Shouldn't this be wayPointZ? Something doesn't seem right here. + // Shouldn't this be posZ? Something doesn't seem right here. // Unless temp_a2 has been converted to X,Z with no Y. In-that case our // struct is wrong or the member name is wrong. - var_a1->position[2] = (f32) temp_a2->wayPointY; - var_a1->wayPointIndex = i * 0xB4; + var_a1->position[2] = (f32) temp_a2->posY; + var_a1->waypointIndex = i * 0xB4; var_a1->actorIndex = -1; if (gPlayerCount >= 3) { @@ -6117,7 +6127,7 @@ void func_800133C4(void) { temp_f26 = var_s0->position[0]; temp_f28 = var_s0->position[1]; temp_f30 = var_s0->position[2]; - func_8000DBAC(temp_s2, &var_s0->wayPointIndex, var_s0->someMultiplier); + func_8000DBAC(temp_s2, &var_s0->waypointIndex, var_s0->someMultiplier); temp_v0 = func_800061DC(temp_s2, 2000.0f, var_s0->someFlags); var_s0->someFlags = temp_v0; if ((((s16) D_801630FC % 10) == 0) && (temp_v0 != 0)) { @@ -6143,7 +6153,7 @@ void func_800133C4(void) { sp94 = temp_f26; sp98 = temp_f28; sp9C = temp_f30; - temp_v0_2 = (((s32) ((u16) var_s0->wayPointIndex + 5) % (s32) D_8016359C) * 4) + D_80163598; + temp_v0_2 = (((s32) ((u16) var_s0->waypointIndex + 5) % (s32) D_8016359C) * 4) + D_80163598; sp88 = (f32) temp_v0_2->unk0; sp8C = (f32) D_80162EB0; sp90 = (f32) temp_v0_2->unk2; @@ -6238,21 +6248,21 @@ void func_80013854(Player *player) { extern s16 D_801631C8; extern s16 D_8016347A; -void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle, struct TrackWayPoint *wayPointList) { +void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle, TrackWaypoint *waypointList) { VehicleStuff *veh; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; s32 i; u16 waypointOffset; s32 numWaypoints = gWaypointCountByPathIndex[0]; for (i = 0; i < arg2; i++) { waypointOffset = (((i * numWaypoints) / arg2) + arg3) % numWaypoints; veh = &vehicle[i]; - temp_v0 = &wayPointList[waypointOffset]; - veh->position[0] = (f32) temp_v0->wayPointX; - veh->position[1] = (f32) temp_v0->wayPointY; - veh->position[2] = (f32) temp_v0->wayPointZ; + temp_v0 = &waypointList[waypointOffset]; + veh->position[0] = (f32) temp_v0->posX; + veh->position[1] = (f32) temp_v0->posY; + veh->position[2] = (f32) temp_v0->posZ; veh->actorIndex = -1; - veh->wayPointIndex = waypointOffset; + veh->waypointIndex = waypointOffset; veh->unused = 0; veh->velocity[0] = 0.0f; veh->velocity[1] = 0.0f; @@ -6273,9 +6283,9 @@ void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle veh->rotation[0] = 0; veh->rotation[2] = 0; if (D_8016347A == 0) { - veh->rotation[1] = func_8000D6D0(veh->position, &veh->wayPointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0, 3); + veh->rotation[1] = func_8000D6D0(veh->position, &veh->waypointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0, 3); } else { - veh->rotation[1] = func_8000D940(veh->position, &veh->wayPointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0); + veh->rotation[1] = func_8000D940(veh->position, &veh->waypointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0); } } D_801631C8 = 10; @@ -6333,7 +6343,7 @@ void func_80013D20(VehicleStuff *vehicle) { sp40[0] = sp58; sp40[1] = 0.0f; sp40[2] = 0.0f; - temp_f0_2 = func_80013C74(vehicle->someType, vehicle->wayPointIndex); + temp_f0_2 = func_80013C74(vehicle->someType, vehicle->waypointIndex); if (vehicle->someMultiplierTheSequel < temp_f0_2) { vehicle->someMultiplierTheSequel = vehicle->someMultiplierTheSequel + 0.06; if (temp_f0_2 < vehicle->someMultiplierTheSequel) { @@ -6347,9 +6357,9 @@ void func_80013D20(VehicleStuff *vehicle) { } } if (D_8016347A == 0) { - var_a1 = func_8000D6D0(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); + var_a1 = func_8000D6D0(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); } else { - var_a1 = func_8000D940(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); + var_a1 = func_8000D940(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); } func_800224F0(&vehicle->rotation[1], var_a1, 100); temp_f0_3 = vehicle->position[0] - sp5C; @@ -6472,7 +6482,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 switch (temp_v1) { /* irregular */ case 0: sp9C = temp_s7 + &D_80163270; - temp_v0_6 = func_80007BF8((u16) var_s0->wayPointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5); + temp_v0_6 = func_80007BF8((u16) var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5); temp_v1_2 = *sp9C; if ((temp_v1_2 == 0) && (temp_v0_6 > 0) && (player->unk_094 < var_s0->someMultiplier)) { var_s1 = 1; @@ -6482,7 +6492,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 } break; case 1: - if (func_80007BF8((u16) var_s0->wayPointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) { + if (func_80007BF8((u16) var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) { if (random_int(2U) == 0) { temp_v1_3 = *(&D_80163270 + temp_s7); if (temp_v1_3 == 0) { @@ -6604,7 +6614,7 @@ void func_800146B8(s32 playerId, s32 arg1, VehicleStuff *vehicle) { var_s0 = vehicle; if (!((f64) *(&gPlayers->unk_094 + (playerId * 0xDD8)) < 1.6666666666666667) && (var_a2 = 0, (arg1 > 0))) { loop_3: - temp_a1 = (u16) var_s0->wayPointIndex; + temp_a1 = (u16) var_s0->waypointIndex; var_v0 = 0; var_v1 = D_80162FCE; loop_4: @@ -6738,12 +6748,12 @@ void func_80014D08(s32 playerId) { } void func_80014D30(s32 cameraId, s32 pathIndex) { - s16 cameraWayPoint; - struct TrackWayPoint *temp_v0; + s16 cameraWaypoint; + TrackWaypoint *temp_v0; - cameraWayPoint = gNearestWaypointByCameraId[cameraId]; - temp_v0 = &D_80164550[pathIndex][cameraWayPoint]; - func_802ADDC8(&cameras[cameraId].unk_54, 10.0f, (f32) temp_v0->wayPointX, (f32) temp_v0->wayPointY + 30.0f, (f32) temp_v0->wayPointZ); + cameraWaypoint = gNearestWaypointByCameraId[cameraId]; + temp_v0 = &D_80164550[pathIndex][cameraWaypoint]; + func_802ADDC8(&cameras[cameraId].unk_54, 10.0f, (f32) temp_v0->posX, (f32) temp_v0->posY + 30.0f, (f32) temp_v0->posZ); } #ifdef MIPS_TO_C @@ -7043,7 +7053,7 @@ void func_80015544(s32 playerId, f32 arg1, s32 cameraId, s32 pathIndex) { D_801645F8[cameraId] = D_80162FA0[0]; D_80164638[cameraId] = D_80162FA0[2]; - temp_f2 = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + temp_f2 = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; temp_f12 = func_802AE1C0(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); if ((temp_f12 < (temp_f2 - 20.0)) || (temp_f12 >= 3000.0)) { @@ -7165,7 +7175,7 @@ void func_80015A9C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], arg1, pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164648[cameraId] = gPlayers[playerId].unk_094 / 5.0f; @@ -7237,7 +7247,7 @@ void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi; s32 var_f12; s32 var_s1; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; u16 *temp_t1_2; u16 *temp_t2; u16 temp_t1; @@ -7300,7 +7310,7 @@ block_8: temp_t0 = var_s1 + &D_80164618; temp_f14 = (f32) ((f64) temp_f20 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a3_3; temp_t1_2 = var_s1 + &D_80164638; - temp_f6 = (f32) ((f64) (temp_v0_2[(s16) sp78].wayPointY + temp_v0_2[sp7A].wayPointY) * 0.5); + temp_f6 = (f32) ((f64) (temp_v0_2[(s16) sp78].posY + temp_v0_2[sp7A].posY) * 0.5); sp54 = temp_t1_2; sp94 = temp_f6; sp8C = temp_f14; @@ -7366,7 +7376,7 @@ void func_800162CC(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], arg1, pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -7456,7 +7466,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_a1; s32 temp_hi; s32 temp_ra; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; u16 *temp_t7; u16 temp_t3; u16 temp_v1_2; @@ -7552,7 +7562,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp50 = temp_t0; sp54 = temp_a3; temp_f14 = temp_f4 - *temp_a3; - temp_f6_2 = (f32) ((f64) (temp_v0_2[(s16) sp78].wayPointY + temp_v0_2[sp7A].wayPointY) * 0.5); + temp_f6_2 = (f32) ((f64) (temp_v0_2[(s16) sp78].posY + temp_v0_2[sp7A].posY) * 0.5); temp_f2_4 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_3; sp94 = temp_f6_2; sp8C = temp_f14; @@ -7642,7 +7652,7 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) { s32 temp_t6_2; s32 temp_t8; s32 var_a3; - struct TrackWayPoint *temp_t7; + TrackWaypoint *temp_t7; u16 temp_s0; if (random_int(0x0064U) < 0x32) { @@ -7676,7 +7686,7 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) { *temp_v0 = D_80162FA0.unk0; temp_t3 = var_a3 + &D_80164638; *temp_t3 = D_80162FA0.unk8; - *temp_t2 = (f32) (*D_80164550)[temp_v1_2].wayPointY; + *temp_t2 = (f32) (*D_80164550)[temp_v1_2].posY; *(&D_80164658 + var_a3) = 16.666666f; *(&D_80164648 + var_a3) = 0.0f; sp44 = (u16) ((s32) (temp_v1_2 + 0xB) % (s32) temp_s0); @@ -7694,7 +7704,7 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) { temp_v0_2 = &cameras[cameraId]; temp_v0_2->lookAt[0] = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)); temp_v0_2->lookAt[2] = (f32) ((f64) temp_f12 + ((f64) D_80162FA0.unk8 * 0.5)); - temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) (temp_t7[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].wayPointY + temp_t7[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].wayPointY) * 0.5f) + 8.0); + temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) (temp_t7[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].posY + temp_t7[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].posY) * 0.5f) + 8.0); temp_v0_2->pos[0] = (bitwise f32) *sp34; temp_v0_2->pos[1] = *sp2C; temp_v0_2->pos[2] = *sp28; @@ -7741,7 +7751,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 *sp44; s16 *sp40; f32 *sp3C; - struct TrackWayPoint **sp2C; + TrackWaypoint **sp2C; f32 *temp_a2; f32 *temp_t1; f32 temp_f0; @@ -7771,9 +7781,9 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_t2; s32 temp_t6; s32 temp_v0; - struct TrackWayPoint **temp_t2_2; - struct TrackWayPoint *temp_t0_2; - struct TrackWayPoint *temp_t0_3; + TrackWaypoint **temp_t2_2; + TrackWaypoint *temp_t0_2; + TrackWaypoint *temp_t0_3; temp_t6 = cameraId * 4; temp_t1 = temp_t6 + &D_80164648; @@ -7816,7 +7826,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { temp_t2_2 = &D_80164550[sp5C]; temp_t0_2 = *temp_t2_2; temp_hi = (s32) (temp_a3_4 + 1) % sp58; - sp88 = (f32) (temp_t0_2[(s16) ((s32) (temp_a3_4 + 6) % sp58)].wayPointY + temp_t0_2[(s16) ((s32) (temp_a3_4 + 5) % sp58)].wayPointY) * 0.5f; + sp88 = (f32) (temp_t0_2[(s16) ((s32) (temp_a3_4 + 6) % sp58)].posY + temp_t0_2[(s16) ((s32) (temp_a3_4 + 5) % sp58)].posY) * 0.5f; sp2C = temp_t2_2; sp6C = (u16) ((s32) (temp_a3_4 + 2) % sp58); sp6E = (s16) temp_hi; @@ -7828,7 +7838,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { func_8000BBD8(sp6C, *sp44, unksp3E); temp_t0_3 = *sp2C; temp_a0 = sp4C + &D_801645F8; - temp_f10 = (f32) (temp_t0_3[(s16) sp6C].wayPointY + temp_t0_3[(s16) temp_hi].wayPointY) * 0.5f; + temp_f10 = (f32) (temp_t0_3[(s16) sp6C].posY + temp_t0_3[(s16) temp_hi].posY) * 0.5f; temp_a1_2 = sp4C + &D_80164618; temp_f18 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a0; sp94 = temp_f10; @@ -7890,7 +7900,7 @@ void func_80017720(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], D_80163068[playerId], pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -7966,7 +7976,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi_2; s32 temp_t3; s32 temp_t4; - struct TrackWayPoint *temp_v0_3; + TrackWaypoint *temp_v0_3; u16 temp_ra; temp_v0 = camera->playerId; @@ -8037,7 +8047,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp40 = temp_v1_2; sp74 = temp_f16_2; sp38 = temp_a2; - sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].wayPointY + temp_v0_3[sp62].wayPointY) * 0.5) - *temp_a2; + sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].posY + temp_v0_3[sp62].posY) * 0.5) - *temp_a2; sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3; temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C)); if ((f64) temp_f0 != 0.0) { @@ -8084,7 +8094,7 @@ void func_80017F10(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], D_80163068[playerId], pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -8160,7 +8170,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi_2; s32 temp_t3; s32 temp_t5; - struct TrackWayPoint *temp_v0_3; + TrackWaypoint *temp_v0_3; u16 temp_ra; u16 temp_t4; @@ -8234,7 +8244,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp40 = temp_v1_2; sp74 = temp_f16_2; sp38 = temp_a2; - sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].wayPointY + temp_v0_3[sp62].wayPointY) * 0.5) - *temp_a2; + sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].posY + temp_v0_3[sp62].posY) * 0.5) - *temp_a2; sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3; temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C)); if ((f64) temp_f0 != 0.0) { @@ -8282,7 +8292,7 @@ void func_80018718(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BA14(gNearestWaypointByCameraId[cameraId], D_80163068[playerId], 60.0f, pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -8364,7 +8374,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi; s32 temp_t4; s32 var_ra; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; u16 *temp_t8; u16 *temp_t8_2; u16 temp_t2; @@ -8471,7 +8481,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp8C = temp_f14; sp50 = temp_a3_2; sp5C = temp_v1; - temp_f16 = (f32) ((f64) (temp_v0[(s16) sp78].wayPointY + temp_v0[sp7A].wayPointY) * 0.5) - *temp_a3_2; + temp_f16 = (f32) ((f64) (temp_v0[(s16) sp78].posY + temp_v0[sp7A].posY) * 0.5) - *temp_a3_2; temp_f0 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1; sp88 = temp_f16; sp84 = temp_f0; @@ -8534,7 +8544,7 @@ void func_80019118(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], arg1, 0); D_801645F8[cameraId] = D_80162FA0[0]; D_80164638[cameraId] = D_80162FA0[2]; - temp_f2 = (f32) D_80164550[0][gNearestWaypointByCameraId[cameraId]].wayPointY; + temp_f2 = (f32) D_80164550[0][gNearestWaypointByCameraId[cameraId]].posY; temp_f12 = func_802AE1C0(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); @@ -8580,7 +8590,7 @@ void func_8001933C(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_v1_2; s32 temp_v1_3; s32 var_v1; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; u16 temp_a1; temp_v1 = camera->playerId; @@ -8620,9 +8630,9 @@ block_8: camera->pos[1] = *(&D_80164618 + var_v1); camera->pos[2] = *(&D_80164638 + var_v1); temp_v0 = &D_80164550[sp48][sp96]; - camera->lookAt[0] = (f32) (((f64) temp_s2->pos[0] * 0.8) + (0.2 * (f64) temp_v0->wayPointX)); - camera->lookAt[1] = (f32) (((f64) temp_s2->pos[1] * 0.8) + (0.2 * (f64) temp_v0->wayPointY)); - camera->lookAt[2] = (f32) (((f64) temp_s2->pos[2] * 0.8) + (0.2 * (f64) temp_v0->wayPointZ)); + camera->lookAt[0] = (f32) (((f64) temp_s2->pos[0] * 0.8) + (0.2 * (f64) temp_v0->posX)); + camera->lookAt[1] = (f32) (((f64) temp_s2->pos[1] * 0.8) + (0.2 * (f64) temp_v0->posY)); + camera->lookAt[2] = (f32) (((f64) temp_s2->pos[2] * 0.8) + (0.2 * (f64) temp_v0->posZ)); func_80014D30(cameraId, sp48); temp_f12 = camera->lookAt[0] - camera->pos[0]; sp88 = camera->lookAt[1] - camera->pos[1]; @@ -8642,16 +8652,16 @@ void func_8001968C(void) { } void func_8001969C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { - struct TrackWayPoint *waypoint; + TrackWaypoint *waypoint; gNearestWaypointByCameraId[cameraId] = gWaypointCountByPathIndex[0] - 18; waypoint = &D_80164550[0][gNearestWaypointByCameraId[cameraId]]; - D_801645F8[cameraId] = waypoint->wayPointX; + D_801645F8[cameraId] = waypoint->posX; // @bug Adding an (f32) cast changes asm, why? - D_80164618[cameraId] = waypoint->wayPointY + 10.0; - D_80164638[cameraId] = waypoint->wayPointZ; + D_80164618[cameraId] = waypoint->posY + 10.0; + D_80164638[cameraId] = waypoint->posZ; D_80164648[cameraId] = 0.0f; D_80164678[cameraId] = 0; } @@ -8670,16 +8680,16 @@ void func_80019760(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { f32 temp_f12; f32 temp_f14; s32 temp_v0; - struct TrackWayPoint *temp_v1; + TrackWaypoint *temp_v1; temp_v0 = cameraId * 4; camera->pos[0] = *(&D_801645F8 + temp_v0); camera->pos[1] = *(&D_80164618 + temp_v0); camera->pos[2] = *(&D_80164638 + temp_v0); temp_v1 = &(*D_80164550)[gNearestWaypointByCameraId[cameraId]]; - camera->lookAt[0] = (f32) temp_v1->wayPointX; - camera->lookAt[1] = (f32) temp_v1->wayPointY; - camera->lookAt[2] = (f32) temp_v1->wayPointZ; + camera->lookAt[0] = (f32) temp_v1->posX; + camera->lookAt[1] = (f32) temp_v1->posY; + camera->lookAt[2] = (f32) temp_v1->posZ; func_80014D30(cameraId, 0); temp_f12 = camera->lookAt[0] - camera->pos[0]; sp28 = camera->lookAt[1] - camera->pos[1]; @@ -9504,7 +9514,7 @@ void func_8001AC10(s32 playerId) { struct Actor *temp_a3_7; struct Actor *temp_a3_8; struct Actor *temp_a3_9; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; struct struct_801642D8 *temp_s0; u16 temp_v0; @@ -9600,9 +9610,9 @@ void func_8001AC10(s32 playerId) { temp_s0->laps += 1; temp_a2 = D_80163478; temp_v0_2 = &D_80164550[*gPathIndexByPlayerId][(s32) (gNearestWaypointByPlayerId[temp_a2] + 0x1E) % (s32) gWaypointCountByPathIndex[gPathIndexByPlayerId[temp_a2]]]; - temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->wayPointX - sp2C->pos[0]) / 20.0); - temp_a3_3->velocity[1] = (f32) (((f64) ((f32) temp_v0_2->wayPointY - sp2C->pos[1]) / 20.0) + 4.0); - temp_a3_3->velocity[2] = (f32) ((f64) ((f32) temp_v0_2->wayPointZ - sp2C->pos[2]) / 20.0); + temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->posX - sp2C->pos[0]) / 20.0); + temp_a3_3->velocity[1] = (f32) (((f64) ((f32) temp_v0_2->posY - sp2C->pos[1]) / 20.0) + 4.0); + temp_a3_3->velocity[2] = (f32) ((f64) ((f32) temp_v0_2->posZ - sp2C->pos[2]) / 20.0); temp_a3_3->pos[1] = sp2C->pos[1]; func_800C92CC(playerId & 0xFF, 0x29008009, temp_a2 * 2, temp_a3_3); func_800C98B8(sp2C->pos, sp2C->velocity, 0x19018014U); @@ -9941,7 +9951,7 @@ extern u16 D_80163410[]; // One per player? void func_8001BE78(void) { Player* temp_s1; - struct TrackWayPoint* temp_s0; + TrackWaypoint* temp_s0; s32 i; func_8000F628(); @@ -9967,9 +9977,9 @@ void func_8001BE78(void) { break; } temp_s0 = &D_80164550[i][gNearestWaypointByPlayerId[i]]; - temp_s1->pos[0] = (f32) temp_s0->wayPointX; - temp_s1->pos[1] = func_802AE1C0((f32) temp_s0->wayPointX, 2000.0f, (f32) temp_s0->wayPointZ) + temp_s1->boundingBoxSize; - temp_s1->pos[2] = (f32) temp_s0->wayPointZ; + temp_s1->pos[0] = (f32) temp_s0->posX; + temp_s1->pos[1] = func_802AE1C0((f32) temp_s0->posX, 2000.0f, (f32) temp_s0->posZ) + temp_s1->boundingBoxSize; + temp_s1->pos[2] = (f32) temp_s0->posZ; temp_s1->unk_02C[1] = (s16) *D_80164590[i]; func_8003680C(temp_s1, 0); temp_s1++; @@ -10091,7 +10101,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001C14C.s") void func_8001C3C4(s32 arg0) { if (gCurrentCourseId == COURSE_AWARD_CEREMONY) { - if (D_80163DE8[0].wayPointIndex >= 16) { + if (D_80163DE8[0].waypointIndex >= 16) { func_80057114(3); } } else { diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 91d8f4010..a8bad64d3 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -168,7 +168,7 @@ void func_8001C42C(void); // 0 or 1, only 1 when when in extra (mirror) mode extern s16 D_8016347A; -// Suspected to be the "width" of each wayPoint. See data_0DD0A0_1.s +// Suspected to be the "width" of each waypoint. See data_0DD0A0_1.s extern f32 D_800DCA4C[]; // See bss_80005FD0.s diff --git a/src/code_8001F980.c b/src/code_8001F980.c index 323e55aeb..6b14e2709 100644 --- a/src/code_8001F980.c +++ b/src/code_8001F980.c @@ -376,8 +376,8 @@ Vtx *D_800DDBB4[] = { }; f32 gCharacterSize[] = { - 0.75f, 0.75f, 0.75f, 0.75f, - 0.75f, 0.75f, 0.75f, 0.75f + MARIO_SIZE, LUIGI_SIZE, YOSHI_SIZE, TOAD_SIZE, + DK_SIZE, WARIO_SIZE, PEACH_SIZE, BOWSER_SIZE }; u8 **gKartMarioWheels0[] = { diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 0b01cfde8..28cef0b0d 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -623,7 +623,7 @@ void func_80058F48(void) { void func_80058F78(void) { if (D_801657B0 == 0) { func_80041EF4(); - if ((!gDemoMode) && (D_8018D188 != 0) && (D_801657D8 == 0)) { + if ((!gDemoMode) && (gIsHUDVisible != 0) && (D_801657D8 == 0)) { func_8004E638(0); if (D_801657E4 != 2) { func_8004FA78(0); @@ -700,7 +700,7 @@ void func_800591B4(void) { func_80057C60(); gSPDisplayList(gDisplayListHead++, &D_0D0076F8); - if (D_8018D188 != 0) { + if (gIsHUDVisible != 0) { if (D_801657D8 == 0) { if (D_801657F0 != FALSE) { func_800514BC(); @@ -764,7 +764,7 @@ void func_800593F8(void) { } void func_80059488(s32 arg0) { - if ((gModeSelection != BATTLE) && (D_80165800[arg0] == 0) && (D_8018D188 != 0)) { + if ((gModeSelection != BATTLE) && (D_80165800[arg0] == 0) && (gIsHUDVisible != 0)) { func_8004FA78(arg0); func_8004E78C(arg0); } @@ -796,7 +796,7 @@ extern s8 D_801657F8; void func_80059560(s32 arg0) { if (gModeSelection != BATTLE) { - if (D_801657F8 && D_8018D188) { + if (D_801657F8 && gIsHUDVisible) { func_8004CB60(D_8018CA70[arg0].lapX, D_8018CA70[arg0].lapY, D_0D00A958); func_8004FC78(D_8018CA70[arg0].lapX - 12, D_8018CA70[arg0].lapY + 4, D_8018CA70[arg0].alsoLapCount); } @@ -1168,7 +1168,7 @@ void func_8006F824(s32); void func_8005A3C0(void) { bool b = FALSE; - if ((gGamestate != 5) && (gGamestate != 9) && !D_8018D204) { + if ((gGamestate != ENDING_SEQUENCE) && (gGamestate != CREDITS_SEQUENCE) && !D_8018D204) { switch (gPlayerCountSelection1) { case 1: if (gControllerOne->buttonPressed & R_CBUTTONS) { @@ -1336,7 +1336,7 @@ void func_8005A99C(void) { if (gPlayerCountSelection1 == 3) { D_801657E8 = TRUE; } - D_8018D188 = (s32) 1; + gIsHUDVisible = (s32) 1; D_8018D170 = (s32) 1; D_8018D190 = (s32) 1; D_8018D204 = 0; @@ -2519,7 +2519,7 @@ void func_8005D1F4(s32 arg0) D_8018CA70[arg0].unk_74 = 0; for (var_a2 = 0; var_a2 < NUM_BOMB_KARTS_VERSUS; var_a2++) { if ((D_80163DE8[var_a2].state == BOMB_STATE_EXPLODED) || (D_80163DE8[var_a2].state == BOMB_STATE_INACTIVE)) continue; - bombWaypoint = D_80163DE8[var_a2].wayPointIndex; + bombWaypoint = D_80163DE8[var_a2].waypointIndex; waypointDiff = bombWaypoint - playerWaypoint; if ((waypointDiff < -5) || (waypointDiff > 0x1E)) continue; D_8018CA70[arg0].unk_74 = 1; diff --git a/src/code_80057C60.h b/src/code_80057C60.h index f49778cbc..afc0af65b 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -332,7 +332,7 @@ extern s32 D_8018D410; extern s32 gMatrixHudCount; extern s32 D_8018D170; extern s32 D_8018D178; -extern s32 D_8018D188; +extern s32 gIsHUDVisible; extern s32 D_8018D190; extern s32 D_8018D1A0; extern s32 D_8018D1B4; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 379ba86f2..82b67dda9 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -758,7 +758,7 @@ extern s32 D_8018D178; extern s16 D_8018D17C; extern s32 D_8018D180; extern s16 D_8018D184; -extern s32 D_8018D188; +extern s32 gIsHUDVisible; extern s16 D_8018D18C; extern s32 D_8018D190; extern s32 D_8018D1A0; @@ -809,7 +809,7 @@ void func_8006FA94(void) { osSetTime(/* u64+0x0 */ 0, /* u64+0x4 */ 0); D_8018D170 = 0; D_8018D190 = 0; - D_8018D188 = 0; + gIsHUDVisible = 0; D_8018D178 = 0; D_8018D1CC = 0; D_801657E2 = 0; diff --git a/src/code_80071F00.c b/src/code_80071F00.c index f57b6078c..1ab724a7d 100644 --- a/src/code_80071F00.c +++ b/src/code_80071F00.c @@ -8066,7 +8066,7 @@ void func_800857C0(void) { } void func_80085878(s32 objectIndex, s32 arg1) { - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; Objects *temp_s0; temp_s0 = &gObjectList[objectIndex]; @@ -8079,7 +8079,7 @@ void func_80085878(s32 objectIndex, s32 arg1) { temp_s0->unk_084[8] = (arg1 * 0x12C) + 0x1F4; func_8008B7D4(objectIndex, 0.0f, -15.0f, 0.0f); temp_v0 = &D_80164490[(u16)temp_s0->unk_084[8]]; - func_8008B80C(objectIndex, temp_v0->wayPointX, temp_v0->wayPointY, temp_v0->wayPointZ); + func_8008B80C(objectIndex, temp_v0->posX, temp_v0->posY, temp_v0->posZ); func_8008B888(objectIndex, 0U, 0U, 0U); temp_s0->unk_034 = 4.0f; temp_s0->type = func_80004EAC(d_rainbow_road_unk3, 0); diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 183a92966..21fef37d6 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -1683,7 +1683,7 @@ void func_8008FF08(Player *player, s8 playerId) { void func_80090178(Player *player, s8 playerId, Vec3f arg2, Vec3f arg3) { u16 test; - struct TrackWayPoint *temp_v1; + TrackWaypoint *temp_v1; f32 spF8[4] = { 0.0f, 0.0f, -700.0f, 700.0f }; f32 spE8[4] = { 700.0f, -700.0f, 0.0f, 0.0f }; f32 spD8[4] = { 0.0f, 0.0f, -650.0f, 650.0f }; @@ -1705,13 +1705,13 @@ void func_80090178(Player *player, s8 playerId, Vec3f arg2, Vec3f arg3) { case COURSE_YOSHI_VALLEY: test = player->nearestWaypointId; temp_v1 = &D_80164550[D_80165310[playerId]][test]; - arg2[0] = temp_v1->wayPointX; - arg2[1] = temp_v1->wayPointY; - arg2[2] = temp_v1->wayPointZ; + arg2[0] = temp_v1->posX; + arg2[1] = temp_v1->posY; + arg2[2] = temp_v1->posZ; temp_v1 = &D_80164550[D_80165310[playerId]][(player->nearestWaypointId + 5) % (gWaypointCountByPathIndex[D_80165310[playerId]] + 1)]; - arg3[0] = temp_v1->wayPointX; - arg3[1] = temp_v1->wayPointY; - arg3[2] = temp_v1->wayPointZ; + arg3[0] = temp_v1->posX; + arg3[1] = temp_v1->posY; + arg3[2] = temp_v1->posZ; break; case COURSE_BLOCK_FORT: arg2[0] = spF8[playerId]; @@ -1748,13 +1748,13 @@ void func_80090178(Player *player, s8 playerId, Vec3f arg2, Vec3f arg3) { default: test = player->nearestWaypointId; temp_v1 = &D_80164550[0][test]; - arg2[0] = temp_v1->wayPointX; - arg2[1] = temp_v1->wayPointY; - arg2[2] = temp_v1->wayPointZ; + arg2[0] = temp_v1->posX; + arg2[1] = temp_v1->posY; + arg2[2] = temp_v1->posZ; temp_v1 = &D_80164550[0][(player->nearestWaypointId + 5) % (gWaypointCountByPathIndex[0] + 1)]; - arg3[0] = temp_v1->wayPointX; - arg3[1] = temp_v1->wayPointY; - arg3[2] = temp_v1->wayPointZ; + arg3[0] = temp_v1->posX; + arg3[1] = temp_v1->posY; + arg3[2] = temp_v1->posZ; break; } } @@ -1825,7 +1825,7 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) { s32 stackPadding1; Vec3f sp44; Vec3f sp38; - struct TrackWayPoint *wayPoint; + TrackWaypoint *waypoint; s32 stackPadding2; s32 stackPadding3; @@ -1921,10 +1921,10 @@ void func_80090970(Player *player, s8 arg1, s8 arg2) { player->pos[0] = player->pos[0] + sins(-player->unk_02C[1]) * -10.0f; } if (player->unk_0C8 == 0x00FC) { - wayPoint = D_80164550[0]; - player->pos[0] = wayPoint->wayPointX; - player->pos[1] = wayPoint->wayPointY; - player->pos[2] = wayPoint->wayPointZ; + waypoint = D_80164550[0]; + player->pos[0] = waypoint->posX; + player->pos[1] = waypoint->posY; + player->pos[2] = waypoint->posZ; } move_f32_towards(&player->pos[1], (player->unk_074 + player->boundingBoxSize) - 2.0f, 0.04f); player->unk_0C8++; diff --git a/src/code_80091750.c b/src/code_80091750.c index 296b05b42..5828e2c11 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -10679,7 +10679,7 @@ void func_800A7A4C(s32 arg0) { case 0x5: /* switch 8 */ switch (var_s1->unk4) { /* switch 9; irregular */ case 0: /* switch 9 */ - if (gControllerFive->button & 0x10) { + if (gControllerFive->button & R_TRIG) { var_s1->unk4 = (s32) 1U; play_sound2(0x4900801C); } else { @@ -13714,7 +13714,7 @@ void func_800ADF48(struct_8018D9E0_entry *arg0) { return; } } - if (controller->buttonPressed & 0x9000) { + if (controller->buttonPressed & (START_BUTTON | A_BUTTON)) { if (arg0->unk4 == D_800F0B50[gModeSelection]) { arg0->unk4 = 0; gIsGamePaused = 0; diff --git a/src/ending/code_80280000.c b/src/ending/code_80280000.c index 199ffd645..a7b452590 100644 --- a/src/ending/code_80280000.c +++ b/src/ending/code_80280000.c @@ -125,7 +125,7 @@ void load_credits(void) { gCurrentCourseId = gCreditsCourseId; D_800DC5B4 = 1; - D_800DC518 = 1; + creditsRenderMode = 1; func_802A4D18(); func_802A74BC(); camera->unk_B4 = 60.0f; diff --git a/src/hud_renderer.c b/src/hud_renderer.c index 34b7a2706..c6ff2bedb 100644 --- a/src/hud_renderer.c +++ b/src/hud_renderer.c @@ -3234,7 +3234,7 @@ s32 func_80050644(u16 arg0, s32 *arg1, s32 *arg2) { } void func_800507D8(u16 bombIndex, s32 *arg1, s32 *arg2) { - s32 temp_v0 = D_80163DE8[bombIndex].wayPointIndex; + s32 temp_v0 = D_80163DE8[bombIndex].waypointIndex; s32 var_v1 = 0; if (temp_v0 != 0) { diff --git a/src/main.c b/src/main.c index 1a12a4852..7c9095104 100644 --- a/src/main.c +++ b/src/main.c @@ -168,7 +168,7 @@ s32 gGamestate = 0xFFFF; // D_800DC510 is externed as an s32 in other files. D_800DC514 is only used in main.c, likely a developer mistake. u16 D_800DC510 = 0; u16 D_800DC514 = 0; -u16 D_800DC518 = 0; +u16 creditsRenderMode = 0; // Renders the whole track. Displays red if used in normal race mode. u16 gDemoMode = DEMO_MODE_INACTIVE; u16 gEnableDebugMode = DEBUG_MODE; s32 gGamestateNext = 7; // = COURSE_DATA_MENU?; diff --git a/src/main.h b/src/main.h index df0c65202..e0c7b0f43 100644 --- a/src/main.h +++ b/src/main.h @@ -39,7 +39,7 @@ #define MTX_EFFECT_POOL_SIZE_MAX MTX_EFFECT_POOL_SIZE + 100 #endif -#define GFX_POOL_SIZE 0x1D4C +#define GFX_POOL_SIZE 7500 struct GfxPool { /* 0x00000 */ Mtx mtxScreen; // Matrix for skybox and startup logo @@ -208,7 +208,7 @@ extern s32 gGamestate; #ifndef STRANGE_MAIN_HEADER_H extern s32 D_800DC510; #endif -extern u16 D_800DC518; +extern u16 creditsRenderMode; extern u16 gDemoMode; extern u16 gEnableDebugMode; extern s32 gGamestateNext; diff --git a/src/menus.c b/src/menus.c index 8db43d386..117555190 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1194,7 +1194,7 @@ void splash_menu_act(struct Controller *controller, u16 arg1) { func_800CA330(0x19); gDebugMenuSelection = DEBUG_MENU_EXITED; - if (controller->button & CONT_L) { + if (controller->button & L_TRIG) { gDemoMode = DEMO_MODE_ACTIVE; } else { gDemoMode = DEMO_MODE_INACTIVE; @@ -1214,7 +1214,7 @@ void splash_menu_act(struct Controller *controller, u16 arg1) { gDebugMenuSelection = DEBUG_MENU_EXITED; gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_CC_50; play_sound2(SOUND_MENU_OK_CLICKED); - } else if (btnAndStick & CONT_R) { + } else if (btnAndStick & R_TRIG) { gDebugMenuSelection = DEBUG_MENU_DISABLED; play_sound2(SOUND_MENU_SELECT); } diff --git a/src/player_controller.c b/src/player_controller.c index 13db3665b..d4b66887f 100644 --- a/src/player_controller.c +++ b/src/player_controller.c @@ -3261,61 +3261,61 @@ void func_80030C34(Player *player) { } void func_80030E00(Player *player) { - s32 var_v0; + s32 playerIndex; if (player == gPlayerOne) { - var_v0 = 0; + playerIndex = 0; } if (player == gPlayerTwo) { - var_v0 = 1; + playerIndex = 1; } if (player == gPlayerThree) { - var_v0 = 2; + playerIndex = 2; } if (player == gPlayerFour) { - var_v0 = 3; + playerIndex = 3; } if (player == gPlayerFive) { - var_v0 = 4; + playerIndex = 4; } if (player == gPlayerSix) { - var_v0 = 5; + playerIndex = 5; } if (player == gPlayerSeven) { - var_v0 = 6; + playerIndex = 6; } if (player == gPlayerEight) { - var_v0 = 7; + playerIndex = 7; } - if (gIsPlayerTripleAButtonCombo[var_v0] == FALSE) { - if (gPlayerIsThrottleActive[var_v0] == 0) { - if ((D_80165420[var_v0] < 2) || (D_80165420[var_v0] >= 9)) { - D_80165440[var_v0] = 0; + if (gIsPlayerTripleAButtonCombo[playerIndex] == FALSE) { + if (gPlayerIsThrottleActive[playerIndex] == 0) { + if ((D_80165420[playerIndex] < 2) || (D_80165420[playerIndex] >= 9)) { + D_80165440[playerIndex] = 0; } - D_80165420[var_v0] = 0; - D_80165400[var_v0] = 0; + D_80165420[playerIndex] = 0; + D_80165400[playerIndex] = 0; } - gPlayerIsThrottleActive[var_v0] = 1; - D_80165420[var_v0]++; - if (D_80165420[var_v0] >= 9) { - D_80165420[var_v0] = 9; + gPlayerIsThrottleActive[playerIndex] = 1; + D_80165420[playerIndex]++; + if (D_80165420[playerIndex] >= 9) { + D_80165420[playerIndex] = 9; } - if ((D_80165420[var_v0] >= 2) && (D_80165420[var_v0] < 9)) { - if (D_80165400[var_v0] == 0) { - D_80165440[var_v0] += 1; + if ((D_80165420[playerIndex] >= 2) && (D_80165420[playerIndex] < 9)) { + if (D_80165400[playerIndex] == 0) { + D_80165440[playerIndex] += 1; } - D_80165400[var_v0] = 1; + D_80165400[playerIndex] = 1; } - if (D_80165440[var_v0] == 5) { - gIsPlayerTripleAButtonCombo[var_v0] = TRUE; - D_80165480[var_v0] = 0x00000078; - D_80165440[var_v0] = 0; - D_80165420[var_v0] = 0; + if (D_80165440[playerIndex] == 5) { + gIsPlayerTripleAButtonCombo[playerIndex] = TRUE; + D_80165480[playerIndex] = 0x00000078; + D_80165440[playerIndex] = 0; + D_80165420[playerIndex] = 0; } } else { - D_80165480[var_v0]--; - if (D_80165480[var_v0] <= 0) { - gIsPlayerTripleAButtonCombo[var_v0] = FALSE; + D_80165480[playerIndex]--; + if (D_80165480[playerIndex] <= 0) { + gIsPlayerTripleAButtonCombo[playerIndex] = FALSE; } } } @@ -3893,9 +3893,8 @@ void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { UNUSED s32 pad3; s32 var_a0; f32 sp44[156] = {0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8}; - //f32 sp44[156] = {0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.6, 0.6, 0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8}; - if (((((player->effects & 2) != 2) && ((((player->unk_0C0 / 182) <= 6) && ((player->unk_0C0 / 182) >= (-6))) || ((controller->button & 0x0010) != 0x0010))) || (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f)) || ((player->effects & 0x8000) == 0x8000)) + if (((((player->effects & 2) != 2) && ((((player->unk_0C0 / 182) <= 6) && ((player->unk_0C0 / 182) >= (-6))) || ((controller->button & R_TRIG) != R_TRIG))) || (((player->unk_094 / 18.0f) * 216.0f) <= 20.0f)) || ((player->effects & 0x8000) == 0x8000)) { func_80036CB4(player); } @@ -4251,9 +4250,6 @@ void func_80033AE0(Player *player, struct Controller *controller, s8 arg2) { player->unk_078 *= 1.7; } } -//#else -//GLOBAL_ASM("asm/non_matchings/player_controller/func_80033AE0.s") -//#endif void func_8003680C(Player *player, s16 arg1) { s32 sp304 = 0; @@ -4644,7 +4640,7 @@ void func_80037CFC(Player *player, struct Controller *controller, s8 arg2) { ((player->effects & 8) != 8) && ((player->effects & 2) != 2) && ((player->effects & 0x10) != 0x10) && - (controller->buttonPressed & 0x10)) { + (controller->buttonPressed & R_TRIG)) { func_8002AA50(player); if (((player->type & 0x4000) == 0x4000) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { func_800C9060(arg2, 0x19008000); @@ -4950,15 +4946,11 @@ void func_80038C6C(Player *player, UNUSED Camera *camera, s8 arg2, s8 arg3) { f32 spEC; f32 spE8; f32 spE4; - //f32 spE0; - //f32 spD8; f32 posX; f32 posY; f32 posZ; f32 sqrt; - //f32 sp90; - //f32 sp8C; f32 divOptimize; UNUSED s32 pad2[10]; f32 spA4; diff --git a/src/racing/actors.c b/src/racing/actors.c index c56930751..ee5482e56 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -513,9 +513,9 @@ void update_actor_kiwano_fruit(struct KiwanoFruit *fruit) { fruit->velocity[0] = 80.0f; case 1: nearestWaypoint = gNearestWaypointByPlayerId[(u16)(player - gPlayerOne)]; - temp_f2 = player->pos[0] - D_80164490[nearestWaypoint].wayPointX; - temp_f16 = player->pos[1] - D_80164490[nearestWaypoint].wayPointY; - temp_f14 = player->pos[2] - D_80164490[nearestWaypoint].wayPointZ; + temp_f2 = player->pos[0] - D_80164490[nearestWaypoint].posX; + temp_f16 = player->pos[1] - D_80164490[nearestWaypoint].posY; + temp_f14 = player->pos[2] - D_80164490[nearestWaypoint].posZ; temp_f12 = fruit->velocity[0] / sqrtf((temp_f2 * temp_f2) + (temp_f16 * temp_f16) + (temp_f14 * temp_f14)); temp_f2 *= temp_f12; temp_f16 *= temp_f12; @@ -1605,10 +1605,10 @@ void func_8029B8E8(Camera *camera, struct TrainCar *actor) { } else if (distance < 640000.0f) { gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1D670); - gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1D160); + gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1D160); } else { - gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1E910); - gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1E480); + gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1E910); + gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_1E480); } if (1440000.0f < distance) { return; } diff --git a/src/racing/actors_extended.c b/src/racing/actors_extended.c index 45720b9c7..c32cc30ac 100644 --- a/src/racing/actors_extended.c +++ b/src/racing/actors_extended.c @@ -1175,8 +1175,8 @@ void update_actor_green_shell(struct ShellActor *shell) { } if ((player->type & 0x4000) != 0) { controller = &gControllers[shell->playerId]; - if ((controller->buttonDepressed & 0x2000) != 0) { - controller->buttonDepressed &= ~0x2000; + if ((controller->buttonDepressed & Z_TRIG) != 0) { + controller->buttonDepressed &= ~Z_TRIG; if (controller->rawStickY < -0x2D) { var_f2 = 8.0f; if (player->unk_094 > 8.0f) { @@ -1314,7 +1314,7 @@ void update_actor_green_shell(struct ShellActor *shell) { void func_802B3B44(struct ShellActor *shell) { u16 currentWaypoint; - u16 nextWayPoint; + u16 nextWaypoint; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -1336,13 +1336,13 @@ void func_802B3B44(struct ShellActor *shell) { Vec3f origPos; currentWaypoint = shell->pathIndex; - temp_f2 = D_80164490[currentWaypoint].wayPointX; - temp_f12 = D_80164490[currentWaypoint].wayPointY; - temp_f28 = D_80164490[currentWaypoint].wayPointZ; - nextWayPoint = currentWaypoint + 1; + temp_f2 = D_80164490[currentWaypoint].posX; + temp_f12 = D_80164490[currentWaypoint].posY; + temp_f28 = D_80164490[currentWaypoint].posZ; + nextWaypoint = currentWaypoint + 1; - if (nextWayPoint >= D_80164430) { - nextWayPoint -= D_80164430; + if (nextWaypoint >= D_80164430) { + nextWaypoint -= D_80164430; } temp_f20 = temp_f2 - shell->pos[0]; @@ -1350,9 +1350,9 @@ void func_802B3B44(struct ShellActor *shell) { temp_f24 = temp_f28 - shell->pos[2]; temp_f0 = (temp_f20 * temp_f20) + (temp_f22 * temp_f22) + (temp_f24 * temp_f24); if (temp_f0 > 400.0f) { - temp_f18_3 = D_80164490[nextWayPoint].wayPointX; - temp_f16_3 = D_80164490[nextWayPoint].wayPointY; - temp_f26 = D_80164490[nextWayPoint].wayPointZ; + temp_f18_3 = D_80164490[nextWaypoint].posX; + temp_f16_3 = D_80164490[nextWaypoint].posY; + temp_f26 = D_80164490[nextWaypoint].posZ; temp_f12_0 = temp_f18_3 - shell->pos[0]; temp_f12_1 = temp_f16_3 - shell->pos[1]; @@ -1360,7 +1360,7 @@ void func_802B3B44(struct ShellActor *shell) { temp_f0_3 = (temp_f12_0 * temp_f12_0) + (temp_f12_1 * temp_f12_1) + (temp_f12_2 * temp_f12_2); if (temp_f0_3 < temp_f0) { - shell->pathIndex = nextWayPoint; + shell->pathIndex = nextWaypoint; } else { temp_f0_2 = sqrtf(temp_f0) * 4.0f; temp_f20 /= temp_f0_2; @@ -1400,11 +1400,11 @@ void func_802B3B44(struct ShellActor *shell) { shell->pos[0] = temp_f2; shell->pos[1] = shell->boundingBoxSize + temp_f12; shell->pos[2] = temp_f28; - shell->pathIndex = nextWayPoint; + shell->pathIndex = nextWaypoint; } else { - temp_f18_3 = D_80164490[nextWayPoint].wayPointX; - temp_f16_3 = D_80164490[nextWayPoint].wayPointY; - temp_f26 = D_80164490[nextWayPoint].wayPointZ; + temp_f18_3 = D_80164490[nextWaypoint].posX; + temp_f16_3 = D_80164490[nextWaypoint].posY; + temp_f26 = D_80164490[nextWaypoint].posZ; shell->pos[0] = (temp_f2 + temp_f18_3) * 0.5f; shell->pos[1] = ((temp_f12 + temp_f16_3) * 0.5f) + shell->boundingBoxSize; @@ -1564,8 +1564,8 @@ void update_actor_red_blue_shell(struct ShellActor *shell) { controller = gControllerOne; } - if ((controller->buttonDepressed & 0x2000) != 0) { - controller->buttonDepressed &= ~0x2000; + if ((controller->buttonDepressed & Z_TRIG) != 0) { + controller->buttonDepressed &= ~Z_TRIG; shell->state = RELEASED_SHELL; if (player->unk_0C0 > 0) { shell->rotAngle = 0x78E3; diff --git a/src/racing/collision.c b/src/racing/collision.c index 48debefc1..f190e5be8 100644 --- a/src/racing/collision.c +++ b/src/racing/collision.c @@ -1988,7 +1988,7 @@ void set_vertex_colours(uintptr_t addr, u32 vertexCount, UNUSED s32 vert3, s8 al } /** - * Recursive search for Veretices and set their colour values. + * Recursive search for vertices and set their colour values. */ void find_vtx_and_set_colours(uintptr_t displayList, s8 alpha, u8 red, u8 green, u8 blue) { s32 segment = SEGMENT_NUMBER2(displayList); diff --git a/src/racing/math_util.c b/src/racing/math_util.c index 33b7c315c..c77239f21 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -40,7 +40,10 @@ UNUSED void func_802B4FF0() { } -// set the position, rotation and mode of where to render the next object and check number of object already render +/** + * Inserts matrix into the rsp. Position, rotation and mode of where to render the next object and check number of object already render + * Note that gMatrixObjectCount gets reset at the beginning of the game loop. So no cleanup needs to be performed. +*/ s32 render_set_position(Mat4 arg0, s32 arg1) { if (gMatrixObjectCount >= MTX_OBJECT_POOL_SIZE) { return 0; @@ -1092,8 +1095,18 @@ s32 is_visible_between_angle(u16 arg0, u16 arg1, u16 arg2) { } /** - * Returns distance or -1.0f if exceeds render distance. -*/ + * Determines whether an object is within the render distance of a camera. + * + * @param cameraPos The position of the camera in 3D space. + * @param objectPos The position of the object in 3D space. + * @param orientationY The orientation angle of the object around the Y-axis. + * @param minDistance The minimum distance at which the object is considered within render distance. + * @param fov The field of view (FOV) of the camera. + * @param maxDistance The maximum render distance. + * @return The distance between the camera and the object if it's within render distance, + * or -1.0f if it exceeds the render distance. + */ + f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance) { u16 angleObject; UNUSED u16 pad; diff --git a/src/racing/race_logic.c b/src/racing/race_logic.c index 7a058164d..6c745053c 100644 --- a/src/racing/race_logic.c +++ b/src/racing/race_logic.c @@ -926,7 +926,7 @@ void func_8028FCBC(void) { func_80002DAC(); D_800DC510 = 1; D_80150118 = 3.0f; - D_800DC518 = 0; + creditsRenderMode = 0; D_802BA032 = 0; D_8015011E = 0; gCourseTimer = 0.0f; diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index c89facc4e..c2a84aa67 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -68,9 +68,11 @@ void parse_course_displaylists(uintptr_t addr) { } } +extern u32 isFlycam; + void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) { - Player *temp_t1 = arg1->player; - Camera *temp_a2 = arg1->camera; + Player *player = arg1->player; + Camera *camera = arg1->camera; u32 segment = SEGMENT_NUMBER2(addr); u32 offset = SEGMENT_OFFSET(addr); // todo: Should be Gfx* @@ -79,32 +81,31 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) { s16 temp_v1; s16 sp1E; s16 temp_v0_3; - u16 temp_v0; - + u16 rot; if (gIsMirrorMode) { - temp_v0 = (u16) temp_a2->rot[1]; - if (temp_v0 < 0x2000) { + rot = (u16) camera->rot[1]; + if (rot < 0x2000) { var_a3 = 2; - } else if (temp_v0 < 0x6000) { + } else if (rot < 0x6000) { var_a3 = 3; - } else if (temp_v0 < 0xA000) { + } else if (rot < 0xA000) { var_a3 = 0; - } else if (temp_v0 < 0xE000) { + } else if (rot < 0xE000) { var_a3 = 1; } else { var_a3 = 2; } } else { - temp_v0 = (u16) temp_a2->rot[1]; - if (temp_v0 < 0x2000) { + rot = (u16) camera->rot[1]; + if (rot < 0x2000) { var_a3 = 2; - } else if (temp_v0 < 0x6000) { + } else if (rot < 0x6000) { var_a3 = 1; } - else if (temp_v0 < 0xA000) { + else if (rot < 0xA000) { var_a3 = 0; } - else if (temp_v0 < 0xE000) { + else if (rot < 0xE000) { var_a3 = 3; } else { @@ -113,20 +114,20 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) { } arg1->playerDirection = var_a3; - 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); + if (D_80152300[camera - camera1] == 1) { + sp1E = func_802ABD40(camera->unk_54.unk3A); + temp_v0_3 = func_802ABD40(player->unk_110.unk3A); temp_v1 = sp1E - temp_v0_3; if ((temp_v1 < 2) && (temp_v1 >= -1)) { if (sp1E == 255) { if (temp_v0_3 == 255) { temp_v1 = arg1->pathCounter; - } else if (temp_t1->unk_110.unk3C[2] > 30.0f) { + } else if (player->unk_110.unk3C[2] > 30.0f) { temp_v1 = arg1->pathCounter; } else { temp_v1 = temp_v0_3; } - } else if (temp_a2->unk_54.unk3C[2] > 30.0f) { + } else if (camera->unk_54.unk3C[2] > 30.0f) { temp_v1 = arg1->pathCounter; } else { temp_v1 = sp1E; @@ -159,7 +160,7 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) { default: if (temp_v0_3 == 255) { temp_v1 = arg1->pathCounter; - } else if (temp_t1->unk_110.unk3C[2] > 30.0f) { + } else if (player->unk_110.unk3C[2] > 30.0f) { temp_v1 = arg1->pathCounter; } else { temp_v1 = temp_v0_3; @@ -168,15 +169,17 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) { } } } else { - temp_v1 = func_802ABD40(temp_a2->unk_54.unk3A); - if (temp_a2->unk_54.unk3C[2] > 30.0f) { + temp_v1 = func_802ABD40(camera->unk_54.unk3A); + if (camera->unk_54.unk3C[2] > 30.0f) { temp_v1 = arg1->pathCounter; } else if (temp_v1 == 255) { temp_v1 = arg1->pathCounter; } } + arg1->pathCounter = temp_v1; temp_v1 = ((temp_v1 - 1) * 4) + var_a3; + gSPDisplayList(gDisplayListHead++, gfx[temp_v1]); } @@ -1257,7 +1260,7 @@ void func_8029569C(void) { void func_80295A38(struct UnkStruct_800DC5EC *arg0) { func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1); - if (D_800DC518 != 0) { + if (creditsRenderMode) { func_8029569C(); return; } diff --git a/src/spawn_players.c b/src/spawn_players.c index b41f7fdb0..3e70ddcb7 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -728,9 +728,9 @@ void func_8003C0F0(void) { case COURSE_WARIO_STADIUM: case COURSE_DK_JUNGLE: func_8000F2DC(); - sp5E = (f32) D_80164550[0][0].wayPointX; - sp5C = (f32) D_80164550[0][0].wayPointZ; - sp5A = (f32) D_80164550[0][0].wayPointY; + sp5E = (f32) D_80164550[0][0].posX; + sp5C = (f32) D_80164550[0][0].posZ; + sp5A = (f32) D_80164550[0][0].posY; if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { sp5E = 0; }