From 7a10ba89f6bf26fd4b659510fefb2ce1cd315f02 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 20 Apr 2024 19:10:53 -0600 Subject: [PATCH] Header cleanup and some renames (#616) * Place macros for addr conversions * dl renames * fixes * changes ok * Delete types.h * move enums --- .../banshee_boardwalk/course_vertices.inc.c | 4 +- courses/big_donut/course_displaylists.inc.c | 1 - courses/big_donut/course_vertices.inc.c | 4 +- courses/block_fort/course_vertices.inc.c | 4 +- courses/bowsers_castle/course_vertices.inc.c | 4 +- courses/choco_mountain/course_vertices.inc.c | 4 +- courses/courseTable.c | 1 - courses/courseTable.h | 1 - courses/course_macro.h | 1 - courses/dks_jungle_parkway/course_data.c | 6 +- courses/dks_jungle_parkway/course_data.h | 6 +- .../dks_jungle_parkway/course_vertices.inc.c | 4 +- courses/double_deck/course_vertices.inc.c | 4 +- courses/frappe_snowland/course_vertices.inc.c | 4 +- courses/kalimari_desert/course_vertices.inc.c | 4 +- .../koopa_troopa_beach/course_vertices.inc.c | 4 +- courses/luigi_raceway/course_vertices.inc.c | 4 +- courses/mario_raceway/course_vertices.inc.c | 4 +- courses/moo_moo_farm/course_vertices.inc.c | 4 +- courses/rainbow_road/course_vertices.inc.c | 4 +- courses/royal_raceway/course_vertices.inc.c | 4 +- courses/sherbet_land/course_vertices.inc.c | 4 +- courses/skyscraper/course_vertices.inc.c | 4 +- courses/staff_ghost_data.c | 1 - courses/toads_turnpike/course_vertices.inc.c | 4 +- courses/wario_stadium/course_vertices.inc.c | 4 +- courses/yoshi_valley/course_vertices.inc.c | 4 +- enhancements/flycam.patch | 3 +- include/bomb_kart.h | 1 + include/common_structs.h | 173 ++++++++++-------- include/config.h | 18 -- include/mk64.h | 96 +++++++++- include/types.h | 118 ------------ src/actors/green_shell/update.inc.c | 1 - src/actors/paddle_boat/render.inc.c | 6 +- src/audio/external.c | 1 + src/audio/internal.h | 1 - src/buffers.h | 2 +- src/buffers/buffers.c | 2 +- src/buffers/random.h | 5 + src/camera.c | 1 + src/code_800029B0.c | 2 +- src/code_800029B0.h | 23 ++- src/code_80004740.c | 1 - src/code_8003DC40.c | 1 + src/code_80057C60.c | 3 +- src/code_8006E9C0.c | 1 + src/code_80086E70.c | 2 +- src/code_80091440.h | 4 + src/code_80091750.c | 8 +- src/code_800AF9B0.h | 1 - src/crash_screen.c | 3 +- src/crash_screen.h | 5 + src/data/data_segment2.c | 1 - src/debug/all_variables.h | 2 - src/debug/crash_screen_enhancement.c | 3 +- src/debug/crash_screen_enhancement.h | 5 + src/effects.c | 2 +- src/ending/ceremony_and_credits.c | 1 - src/ending/code_80280000.c | 3 +- src/ending/code_80281780.c | 3 +- src/ending/dl_unk_80284EE0.c | 3 +- src/ending/podium_ceremony_actors.c | 1 - src/gbiMacro.c | 3 +- src/main.c | 4 +- src/main.h | 1 - src/math_util_2.c | 1 + src/math_util_2.h | 2 +- src/menus.c | 1 + src/menus.h | 1 - src/os/osContInternal.h | 1 - src/profiler.c | 3 +- src/profiler.h | 1 - src/racing/actors.c | 2 +- src/racing/actors.h | 3 +- src/racing/math_util.c | 16 +- src/racing/math_util.h | 1 - src/racing/memory.c | 1 - src/racing/memory.h | 1 - src/racing/race_logic.c | 3 +- src/racing/render_courses.c | 2 +- src/racing/render_courses.h | 2 + src/racing/skybox_and_splitscreen.c | 3 +- src/racing/skybox_and_splitscreen.h | 1 + src/render_objects.c | 3 +- src/render_player.c | 3 +- src/render_player.h | 4 +- src/save.h | 1 - src/spawn_players.c | 1 + src/staff_ghosts.c | 7 +- src/staff_ghosts.h | 1 - src/update_objects.c | 1 + yamls/us/ceremony_data.yml | 3 +- yamls/us/ceremony_rsp_init_80284EE0.yml | 3 +- yamls/us/common_data.yml | 3 +- yamls/us/data_segment2.yml | 3 +- yamls/us/startup_logo.yml | 3 +- 97 files changed, 349 insertions(+), 343 deletions(-) delete mode 100644 courses/course_macro.h delete mode 100644 include/config.h delete mode 100644 include/types.h diff --git a/courses/banshee_boardwalk/course_vertices.inc.c b/courses/banshee_boardwalk/course_vertices.inc.c index 60b5b2dfa..08077d547 100644 --- a/courses/banshee_boardwalk/course_vertices.inc.c +++ b/courses/banshee_boardwalk/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_banshee_boardwalk_vertex[] = { {{-1384, 12, -187}, { 2303, -256}, {MACRO_COLOR_FLAG(0x7c, 0x7c, 0x7c, 0), 0x00}}, diff --git a/courses/big_donut/course_displaylists.inc.c b/courses/big_donut/course_displaylists.inc.c index 2a1cbe3cd..e181fa080 100644 --- a/courses/big_donut/course_displaylists.inc.c +++ b/courses/big_donut/course_displaylists.inc.c @@ -3,7 +3,6 @@ #include #include #include -#include #include "course_displaylists.inc.h" #include "course_textures.linkonly.h" diff --git a/courses/big_donut/course_vertices.inc.c b/courses/big_donut/course_vertices.inc.c index c29f92f0b..71d711aa4 100644 --- a/courses/big_donut/course_vertices.inc.c +++ b/courses/big_donut/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_big_donut_vertex[] = { {{ 609, 270, 794}, { 1024, 1024}, {MACRO_COLOR_FLAG(0x48, 0x48, 0xfc, 0), 0x00}}, diff --git a/courses/block_fort/course_vertices.inc.c b/courses/block_fort/course_vertices.inc.c index 0d6f2262b..ea599254f 100644 --- a/courses/block_fort/course_vertices.inc.c +++ b/courses/block_fort/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_block_fort_vertex[] = { {{ 85, 0, 476}, { 0, 0}, {MACRO_COLOR_FLAG(0xb8, 0xb0, 0xcc, 0), 0x00}}, diff --git a/courses/bowsers_castle/course_vertices.inc.c b/courses/bowsers_castle/course_vertices.inc.c index d880293b8..4ad387aee 100644 --- a/courses/bowsers_castle/course_vertices.inc.c +++ b/courses/bowsers_castle/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_bowsers_castle_vertex[] = { diff --git a/courses/choco_mountain/course_vertices.inc.c b/courses/choco_mountain/course_vertices.inc.c index 2dfec14c3..560ca28f4 100644 --- a/courses/choco_mountain/course_vertices.inc.c +++ b/courses/choco_mountain/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_choco_mountain_vertex[] = { {{ 1364, 0, 796}, { 3158, 1024}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 0), 0x00}}, diff --git a/courses/courseTable.c b/courses/courseTable.c index b4b59a453..00ee6ff72 100644 --- a/courses/courseTable.c +++ b/courses/courseTable.c @@ -1,6 +1,5 @@ #include #include -#include "types.h" #include "courseTable.h" #include "all_course_model.h" #include "all_course_packed.h" diff --git a/courses/courseTable.h b/courses/courseTable.h index a1fded475..2ab5f3ae1 100644 --- a/courses/courseTable.h +++ b/courses/courseTable.h @@ -3,7 +3,6 @@ #include #include -#include "types.h" // dlRomStart, vertexRomStart, & vertexStart, are u8* because mio0 compressed. struct CourseTable { diff --git a/courses/course_macro.h b/courses/course_macro.h deleted file mode 100644 index b7eb420f4..000000000 --- a/courses/course_macro.h +++ /dev/null @@ -1 +0,0 @@ -#define MACRO_COLOR_FLAG(r, g, b, flag) (r&~0x3) | (flag & 0x3), (g&~0x3) | ((flag>>2) & 0x3), b diff --git a/courses/dks_jungle_parkway/course_data.c b/courses/dks_jungle_parkway/course_data.c index 9fb5b2807..c1398f59e 100644 --- a/courses/dks_jungle_parkway/course_data.c +++ b/courses/dks_jungle_parkway/course_data.c @@ -5403,7 +5403,7 @@ Gfx d_course_dks_jungle_parkway_dl_E048[] = gsSPEndDisplayList(), }; -Gfx d_course_dks_jungle_parkway_dl_E058[] = +Gfx d_course_dks_jungle_parkway_railings_dl[] = { gsSPDisplayList(d_course_dks_jungle_parkway_dl_E048), gsSPEndDisplayList(), @@ -5664,7 +5664,7 @@ Gfx d_course_dks_jungle_parkway_dl_E700[] = gsSPEndDisplayList(), }; -Gfx d_course_dks_jungle_parkway_dl_E730[] = +Gfx d_course_dks_jungle_parkway_boat_dl[] = { gsSPDisplayList(d_course_dks_jungle_parkway_dl_E700), gsSPEndDisplayList(), @@ -5802,7 +5802,7 @@ Gfx d_course_dks_jungle_parkway_dl_FC18[] = gsSPEndDisplayList(), }; -Gfx d_course_dks_jungle_parkway_dl_FC28[] = +Gfx d_course_dks_jungle_parkway_paddle_wheel_dl[] = { gsSPDisplayList(d_course_dks_jungle_parkway_dl_FC18), gsSPEndDisplayList(), diff --git a/courses/dks_jungle_parkway/course_data.h b/courses/dks_jungle_parkway/course_data.h index d8813d2bf..4513fcfb2 100644 --- a/courses/dks_jungle_parkway/course_data.h +++ b/courses/dks_jungle_parkway/course_data.h @@ -142,7 +142,7 @@ extern Gfx d_course_dks_jungle_parkway_dl_DE48[]; extern Gfx d_course_dks_jungle_parkway_dl_DF30[]; extern Gfx d_course_dks_jungle_parkway_dl_E030[]; extern Gfx d_course_dks_jungle_parkway_dl_E048[]; -extern Gfx d_course_dks_jungle_parkway_dl_E058[]; +extern Gfx d_course_dks_jungle_parkway_railings_dl[]; extern Gfx d_course_dks_jungle_parkway_dl_E068[]; extern Gfx d_course_dks_jungle_parkway_dl_E150[]; extern Gfx d_course_dks_jungle_parkway_dl_E238[]; @@ -156,7 +156,7 @@ extern Gfx d_course_dks_jungle_parkway_dl_E628[]; extern Gfx d_course_dks_jungle_parkway_dl_E688[]; extern Gfx d_course_dks_jungle_parkway_dl_E6E8[]; extern Gfx d_course_dks_jungle_parkway_dl_E700[]; -extern Gfx d_course_dks_jungle_parkway_dl_E730[]; +extern Gfx d_course_dks_jungle_parkway_boat_dl[]; extern Vtx d_course_dks_jungle_parkway_paddle_boat_paddle_model1[]; extern Vtx d_course_dks_jungle_parkway_paddle_boat_paddle_model2[]; extern Vtx d_course_dks_jungle_parkway_paddle_boat_paddle_model3[]; @@ -165,7 +165,7 @@ extern u8 d_course_dks_jungle_parkway_boat_paddle2[]; extern Gfx d_course_dks_jungle_parkway_dl_FAE0[]; extern Gfx d_course_dks_jungle_parkway_dl_FC08[]; extern Gfx d_course_dks_jungle_parkway_dl_FC18[]; -extern Gfx d_course_dks_jungle_parkway_dl_FC28[]; +extern Gfx d_course_dks_jungle_parkway_paddle_wheel_dl[]; extern Gfx d_course_dks_jungle_parkway_dl_FC38[]; extern Vtx d_course_dks_jungle_parkway_tree_model[]; extern u8 d_course_dks_jungle_parkway_tree2_top[]; diff --git a/courses/dks_jungle_parkway/course_vertices.inc.c b/courses/dks_jungle_parkway/course_vertices.inc.c index 94339d87e..26c84a952 100644 --- a/courses/dks_jungle_parkway/course_vertices.inc.c +++ b/courses/dks_jungle_parkway/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_dks_jungle_parkway_vertex[] = { {{-1842, 199, -812}, { 1024, 0}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 0), 0x00}}, diff --git a/courses/double_deck/course_vertices.inc.c b/courses/double_deck/course_vertices.inc.c index f544c6302..0d6d7aa47 100644 --- a/courses/double_deck/course_vertices.inc.c +++ b/courses/double_deck/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_double_deck_vertex[] = { {{ 577, 60, 100}, { -317, 1024}, {MACRO_COLOR_FLAG(0x7c, 0x7c, 0x7c, 0), 0x00}}, diff --git a/courses/frappe_snowland/course_vertices.inc.c b/courses/frappe_snowland/course_vertices.inc.c index 2ba368bdf..aafd75a74 100644 --- a/courses/frappe_snowland/course_vertices.inc.c +++ b/courses/frappe_snowland/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_frappe_snowland_vertex[] = { {{-1518, 50, 1102}, { 4095, 0}, {MACRO_COLOR_FLAG(0xb4, 0xc8, 0xfc, 0), 0x00}}, diff --git a/courses/kalimari_desert/course_vertices.inc.c b/courses/kalimari_desert/course_vertices.inc.c index a8dc84eeb..56f3f4103 100644 --- a/courses/kalimari_desert/course_vertices.inc.c +++ b/courses/kalimari_desert/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_kalimari_desert_vertex[] = { {{ -702, 48, -1930}, { 2048, 0}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 4), 0x00}}, diff --git a/courses/koopa_troopa_beach/course_vertices.inc.c b/courses/koopa_troopa_beach/course_vertices.inc.c index af93e0779..989fb368e 100644 --- a/courses/koopa_troopa_beach/course_vertices.inc.c +++ b/courses/koopa_troopa_beach/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_koopa_troopa_beach_vertex[] = { {{ -370, 11, -1114}, { -2686, 0}, {MACRO_COLOR_FLAG(0x98, 0x98, 0x98, 4), 0x00}}, diff --git a/courses/luigi_raceway/course_vertices.inc.c b/courses/luigi_raceway/course_vertices.inc.c index 95924f8a6..8b5f7a451 100644 --- a/courses/luigi_raceway/course_vertices.inc.c +++ b/courses/luigi_raceway/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_luigi_raceway_vertex[] = { {{ 175, 107, -448}, { 0, 74}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 4), 0x00}}, diff --git a/courses/mario_raceway/course_vertices.inc.c b/courses/mario_raceway/course_vertices.inc.c index eaf53c605..2aefb9cba 100644 --- a/courses/mario_raceway/course_vertices.inc.c +++ b/courses/mario_raceway/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_mario_raceway_vertex[] = { {{ 2583, 31, -586}, { 8985, 1023}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 0), 0x00}}, diff --git a/courses/moo_moo_farm/course_vertices.inc.c b/courses/moo_moo_farm/course_vertices.inc.c index a1142030f..7025ce400 100644 --- a/courses/moo_moo_farm/course_vertices.inc.c +++ b/courses/moo_moo_farm/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_moo_moo_farm_vertex[] = { {{ 114, 44, -2058}, { 819, -204}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 0), 0x00}}, diff --git a/courses/rainbow_road/course_vertices.inc.c b/courses/rainbow_road/course_vertices.inc.c index 296ea995d..8bdd381b1 100644 --- a/courses/rainbow_road/course_vertices.inc.c +++ b/courses/rainbow_road/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_rainbow_road_vertex[] = { {{-1418, 657, -847}, { -27, -34}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0x00, 0), 0x00}}, diff --git a/courses/royal_raceway/course_vertices.inc.c b/courses/royal_raceway/course_vertices.inc.c index 3a9e5c535..c88242f05 100644 --- a/courses/royal_raceway/course_vertices.inc.c +++ b/courses/royal_raceway/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_royal_raceway_vertex[] = { {{ -409, 105, -1495}, { 12288, 1024}, {MACRO_COLOR_FLAG(0xc0, 0xc0, 0xc0, 0), 0x00}}, diff --git a/courses/sherbet_land/course_vertices.inc.c b/courses/sherbet_land/course_vertices.inc.c index 0187e1829..ca28b8240 100644 --- a/courses/sherbet_land/course_vertices.inc.c +++ b/courses/sherbet_land/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_sherbet_land_vertex[] = { {{ -1834, -60, 1192}, { 4096, 0}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 4), 0x00}}, diff --git a/courses/skyscraper/course_vertices.inc.c b/courses/skyscraper/course_vertices.inc.c index 665a00ccc..440219ef7 100644 --- a/courses/skyscraper/course_vertices.inc.c +++ b/courses/skyscraper/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_skyscraper_vertex[] = { {{ -54, 485, 320}, { -4060, 0}, {MACRO_COLOR_FLAG(0xfc, 0xfc, 0xfc, 0), 0x00}}, diff --git a/courses/staff_ghost_data.c b/courses/staff_ghost_data.c index 47691c058..87d5967d6 100644 --- a/courses/staff_ghost_data.c +++ b/courses/staff_ghost_data.c @@ -1,6 +1,5 @@ #include #include -#include "types.h" #include "common_structs.h" /* diff --git a/courses/toads_turnpike/course_vertices.inc.c b/courses/toads_turnpike/course_vertices.inc.c index 20521d2d5..cf62c1f71 100644 --- a/courses/toads_turnpike/course_vertices.inc.c +++ b/courses/toads_turnpike/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_toads_turnpike_vertex[] = { {{-2064, 50, -3157}, { 2048, 479}, {MACRO_COLOR_FLAG(0x7c, 0x7c, 0xc0, 0), 0x00}}, diff --git a/courses/wario_stadium/course_vertices.inc.c b/courses/wario_stadium/course_vertices.inc.c index 62f34fecb..b2b816184 100644 --- a/courses/wario_stadium/course_vertices.inc.c +++ b/courses/wario_stadium/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_wario_stadium_vertex[] = { {{-3350, 362, -650}, { 3107, 1023}, {MACRO_COLOR_FLAG(0xcc, 0xcc, 0xcc, 4), 0x00}}, diff --git a/courses/yoshi_valley/course_vertices.inc.c b/courses/yoshi_valley/course_vertices.inc.c index 781b9aacc..9ff708f7a 100644 --- a/courses/yoshi_valley/course_vertices.inc.c +++ b/courses/yoshi_valley/course_vertices.inc.c @@ -1,5 +1,5 @@ -#include "types.h" -#include "courses/course_macro.h" +#include +#include CourseVtx d_course_yoshi_valley_vertex[] = { {{-1627, -100, -730}, { -1858, 2252}, {MACRO_COLOR_FLAG(0x88, 0x88, 0x88, 0), 0x00}}, diff --git a/enhancements/flycam.patch b/enhancements/flycam.patch index d233db4a6..8db6ca596 100644 --- a/enhancements/flycam.patch +++ b/enhancements/flycam.patch @@ -82,8 +82,7 @@ index 0000000..5569838 +#include +#include +#include -+#include -+#include +++#include +#include +#include "main.h" +#include diff --git a/include/bomb_kart.h b/include/bomb_kart.h index e95da284b..6f8bea8ca 100644 --- a/include/bomb_kart.h +++ b/include/bomb_kart.h @@ -2,6 +2,7 @@ #define BOMB_KART_H #include "common_structs.h" +#include #define NUM_BOMB_KARTS_MAX 7 #define NUM_BOMB_KARTS_VERSUS 7 diff --git a/include/common_structs.h b/include/common_structs.h index ef90adcce..c7384e036 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -21,82 +21,6 @@ typedef struct f32 x, y, z; } Vec3fs; -#define COURSE_NULL 0xFF - -typedef enum { - /* 0x00 */ COURSE_MARIO_RACEWAY = 0, - /* 0x01 */ COURSE_CHOCO_MOUNTAIN, - /* 0x02 */ COURSE_BOWSER_CASTLE, - /* 0x03 */ COURSE_BANSHEE_BOARDWALK, - /* 0x04 */ COURSE_YOSHI_VALLEY, - /* 0x05 */ COURSE_FRAPPE_SNOWLAND, - /* 0x06 */ COURSE_KOOPA_BEACH, - /* 0x07 */ COURSE_ROYAL_RACEWAY, - /* 0x08 */ COURSE_LUIGI_RACEWAY, - /* 0x09 */ COURSE_MOO_MOO_FARM, - /* 0x0A */ COURSE_TOADS_TURNPIKE, - /* 0x0B */ COURSE_KALAMARI_DESERT, - /* 0x0C */ COURSE_SHERBET_LAND, - /* 0x0D */ COURSE_RAINBOW_ROAD, - /* 0x0E */ COURSE_WARIO_STADIUM, - /* 0x0F */ COURSE_BLOCK_FORT, - /* 0x10 */ COURSE_SKYSCRAPER, - /* 0x11 */ COURSE_DOUBLE_DECK, - /* 0x12 */ COURSE_DK_JUNGLE, - /* 0x13 */ COURSE_BIG_DONUT, - /* 0x14 */ COURSE_AWARD_CEREMONY, - /* 0x15 */ NUM_COURSES -} COURSES; - -typedef enum { - /* 0x00 */ TIME_TRIAL_DATA_LUIGI_RACEWAY, - /* 0x01 */ TIME_TRIAL_DATA_MOO_MOO_FARM, - /* 0x02 */ TIME_TRIAL_DATA_KOOPA_BEACH, - /* 0x03 */ TIME_TRIAL_DATA_KALAMARI_DESERT, - /* 0x04 */ TIME_TRIAL_DATA_TOADS_TURNPIKE, - /* 0x05 */ TIME_TRIAL_DATA_FRAPPE_SNOWLAND, - /* 0x06 */ TIME_TRIAL_DATA_CHOCO_MOUNTAIN, - /* 0x07 */ TIME_TRIAL_DATA_MARIO_RACEWAY, - /* 0x08 */ TIME_TRIAL_DATA_WARIO_STADIUM, - /* 0x09 */ TIME_TRIAL_DATA_SHERBET_LAND, - /* 0x0A */ TIME_TRIAL_DATA_ROYAL_RACEWAY, - /* 0x0B */ TIME_TRIAL_DATA_BOWSER_CASTLE, - /* 0x0C */ TIME_TRIAL_DATA_DK_JUNGLE, - /* 0x0D */ TIME_TRIAL_DATA_YOSHI_VALLEY, - /* 0x0E */ TIME_TRIAL_DATA_BANSHEE_BOARDWALK, - /* 0x0F */ TIME_TRIAL_DATA_RAINBOW_ROAD, - /* 0x10 */ NUM_TIME_TRIAL_DATA -} TIME_TRIAL_DATA_INDEX; - -/** - * @brief The different types of surface in the game. -*/ -enum SURFACE_TYPE { - /* -0x1 */ SURFACE_DEFAULT = -1, - /* 0x00 */ AIRBORNE, - /* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper - /* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK Jungle on course, Yoshi Valley - /* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway - /* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle - /* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel - /* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut - /* 0x07 */ SAND_OFFROAD, // Mario Raceway - /* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley - /* 0x09 */ ICE, // Sherbert Land - /* 0x0A */ WET_SAND, // Koop Troopa Beach dark color - /* 0x0B */ SNOW_OFFROAD, // Frappe Snowland off course - /* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain - /* 0x0D */ DIRT_OFFROAD, // Kalimari Desert off course - /* 0x0E */ TRAIN_TRACK, // Kalimari Desert - /* 0x0F */ CAVE, // DK Jungle cave - /* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge - /* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2 - /* 0xFC */ BOOST_RAMP_WOOD = 0xFC, // DK Jungle - /* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island - /* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway - /* 0xFF */ RAMP // Koopa Troopa beach -}; - // This was added as a silly idea: // In the data to use "A, B, Z, R" instead of hex numbers. typedef enum { @@ -106,6 +30,103 @@ typedef enum { R = 0x10 } GhostController; + +/*** types.h ***/ + +typedef struct { + /* 0x0 */ s16 waypointStart; + /* 0x2 */ s16 waypointEnd; + /* 0x4 */ s32 type; +} KartAIBehaviour; // size = 0x8 + +enum SpTaskState { + SPTASK_STATE_NOT_STARTED, + SPTASK_STATE_RUNNING, + SPTASK_STATE_INTERRUPTED, + SPTASK_STATE_FINISHED, + SPTASK_STATE_FINISHED_DP +}; + +struct SPTask +{ + /*0x00*/ OSTask task; + /*0x40*/ OSMesgQueue *msgqueue; + /*0x44*/ OSMesg msg; + /*0x48*/ enum SpTaskState state; +}; // size = 0x4C, align = 0x8 + +struct VblankHandler +{ + OSMesgQueue *queue; + OSMesg msg; +}; + +struct D_80150158 { + s16 unk0; + s32 unk4; + s32 unk8; + s32 unkC; +}; + +struct Controller { + s16 rawStickX; + s16 rawStickY; + u16 button; // HeldButton + u16 buttonPressed; // OnTriggered + u16 buttonDepressed; // OffTriggered + u16 stickDirection; + u16 stickPressed; // OffTriggered + u16 stickDepressed; // OnTriggered +}; + +// Camera path struct? Or something like that. For GP race won scene? +struct UnkStruct_80287500 { + Vec3f unk0; // xyz coordinates? + f32 unkC; + f32 unk10; + f32 unk14; // rotation? + s32 unk18; + s32 unk1C; + f32 unk20; + f32 unk24; + f32 unk28; + f32 unk2C; + f32 unk30; + f32 unk34; + s32 unk38; +}; + +struct UnkStruct_800DDB40 { + u32 unk0; + u32 unk4; + u32 unk8; + u32 unkC; + u32 unk10; + u32 unk14; + u32 unk18; + u32 unk1C; + u32 unk20; + u16 unk24; + u16 unk26; +}; + +struct UnkStruct_802B53C8 { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; +}; +// end math util structs + +struct UnkStruct_800DDB68 { + s32 *D_800ED600; s32 *D_800ED608; s32 *D_800ED610; s32 *D_800ED618; + s32 *D_800ED620; s32 *D_800ED628; s32 *D_800ED630; s32 *D_800ED638; +}; +/*** Types.h end ***/ + + + + typedef struct { u8 button; s8 frameDuration; diff --git a/include/config.h b/include/config.h deleted file mode 100644 index 67fa60410..000000000 --- a/include/config.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/** - * @file config.h - * A catch-all file for configuring various bugfixes and other settings in MK64 - */ - -// Screen Size Defines -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 - -#define STACKSIZE 0x2000 - -// Border Height Define for NTSC Versions -#define BORDER_HEIGHT 1 - -#endif diff --git a/include/mk64.h b/include/mk64.h index 8053c9cf2..18604c9f0 100644 --- a/include/mk64.h +++ b/include/mk64.h @@ -1,10 +1,98 @@ #ifndef MK64_H #define MK64_H -// Global header for Mario Kart 64 +/** + * @file mk64.h + * Global header for mk64 + */ -#include -#include "config.h" +/*======================= + Configuration +=======================*/ + +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 + +#define STACKSIZE 0x2000 + +// Border Height Define for NTSC Versions +#define BORDER_HEIGHT 1 + +typedef enum { + /* 0x00 */ COURSE_MARIO_RACEWAY = 0, + /* 0x01 */ COURSE_CHOCO_MOUNTAIN, + /* 0x02 */ COURSE_BOWSER_CASTLE, + /* 0x03 */ COURSE_BANSHEE_BOARDWALK, + /* 0x04 */ COURSE_YOSHI_VALLEY, + /* 0x05 */ COURSE_FRAPPE_SNOWLAND, + /* 0x06 */ COURSE_KOOPA_BEACH, + /* 0x07 */ COURSE_ROYAL_RACEWAY, + /* 0x08 */ COURSE_LUIGI_RACEWAY, + /* 0x09 */ COURSE_MOO_MOO_FARM, + /* 0x0A */ COURSE_TOADS_TURNPIKE, + /* 0x0B */ COURSE_KALAMARI_DESERT, + /* 0x0C */ COURSE_SHERBET_LAND, + /* 0x0D */ COURSE_RAINBOW_ROAD, + /* 0x0E */ COURSE_WARIO_STADIUM, + /* 0x0F */ COURSE_BLOCK_FORT, + /* 0x10 */ COURSE_SKYSCRAPER, + /* 0x11 */ COURSE_DOUBLE_DECK, + /* 0x12 */ COURSE_DK_JUNGLE, + /* 0x13 */ COURSE_BIG_DONUT, + /* 0x14 */ COURSE_AWARD_CEREMONY, + /* 0x15 */ NUM_COURSES +} COURSES; + +#define COURSE_NULL 0xFF + +typedef enum { + /* 0x00 */ TIME_TRIAL_DATA_LUIGI_RACEWAY, + /* 0x01 */ TIME_TRIAL_DATA_MOO_MOO_FARM, + /* 0x02 */ TIME_TRIAL_DATA_KOOPA_BEACH, + /* 0x03 */ TIME_TRIAL_DATA_KALAMARI_DESERT, + /* 0x04 */ TIME_TRIAL_DATA_TOADS_TURNPIKE, + /* 0x05 */ TIME_TRIAL_DATA_FRAPPE_SNOWLAND, + /* 0x06 */ TIME_TRIAL_DATA_CHOCO_MOUNTAIN, + /* 0x07 */ TIME_TRIAL_DATA_MARIO_RACEWAY, + /* 0x08 */ TIME_TRIAL_DATA_WARIO_STADIUM, + /* 0x09 */ TIME_TRIAL_DATA_SHERBET_LAND, + /* 0x0A */ TIME_TRIAL_DATA_ROYAL_RACEWAY, + /* 0x0B */ TIME_TRIAL_DATA_BOWSER_CASTLE, + /* 0x0C */ TIME_TRIAL_DATA_DK_JUNGLE, + /* 0x0D */ TIME_TRIAL_DATA_YOSHI_VALLEY, + /* 0x0E */ TIME_TRIAL_DATA_BANSHEE_BOARDWALK, + /* 0x0F */ TIME_TRIAL_DATA_RAINBOW_ROAD, + /* 0x10 */ NUM_TIME_TRIAL_DATA +} TIME_TRIAL_DATA_INDEX; + +/** + * @brief The different types of surface in the game. +*/ +enum SURFACE_TYPE { + /* -0x1 */ SURFACE_DEFAULT = -1, + /* 0x00 */ AIRBORNE, + /* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper + /* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK Jungle on course, Yoshi Valley + /* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway + /* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle + /* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel + /* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut + /* 0x07 */ SAND_OFFROAD, // Mario Raceway + /* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley + /* 0x09 */ ICE, // Sherbert Land + /* 0x0A */ WET_SAND, // Koop Troopa Beach dark color + /* 0x0B */ SNOW_OFFROAD, // Frappe Snowland off course + /* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain + /* 0x0D */ DIRT_OFFROAD, // Kalimari Desert off course + /* 0x0E */ TRAIN_TRACK, // Kalimari Desert + /* 0x0F */ CAVE, // DK Jungle cave + /* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge + /* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2 + /* 0xFC */ BOOST_RAMP_WOOD = 0xFC, // DK Jungle + /* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island + /* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway + /* 0xFF */ RAMP // Koopa Troopa beach +}; #define GFX_GET_OPCODE(var) ((s32)((var) & 0xFF000000)) @@ -26,4 +114,6 @@ #define SET_HIGH_S16_OF_32(var, x) ((((s16 *)&(var))[0]) = (x)) #endif +#define MACRO_COLOR_FLAG(r, g, b, flag) (r&~0x3) | (flag & 0x3), (g&~0x3) | ((flag>>2) & 0x3), b + #endif // MK64_H diff --git a/include/types.h b/include/types.h deleted file mode 100644 index 2af75261f..000000000 --- a/include/types.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -#include -#include -#include "camera.h" - -typedef struct { - /* 0x0 */ s16 waypointStart; - /* 0x2 */ s16 waypointEnd; - /* 0x4 */ s32 type; -} KartAIBehaviour; // size = 0x8 - -enum SpTaskState { - SPTASK_STATE_NOT_STARTED, - SPTASK_STATE_RUNNING, - SPTASK_STATE_INTERRUPTED, - SPTASK_STATE_FINISHED, - SPTASK_STATE_FINISHED_DP -}; - -struct SPTask -{ - /*0x00*/ OSTask task; - /*0x40*/ OSMesgQueue *msgqueue; - /*0x44*/ OSMesg msg; - /*0x48*/ enum SpTaskState state; -}; // size = 0x4C, align = 0x8 - -struct VblankHandler -{ - OSMesgQueue *queue; - OSMesg msg; -}; - -struct D_80150158 { - s16 unk0; - s32 unk4; - s32 unk8; - s32 unkC; -}; - -struct Controller { - s16 rawStickX; - s16 rawStickY; - u16 button; // HeldButton - u16 buttonPressed; // OnTriggered - u16 buttonDepressed; // OffTriggered - u16 stickDirection; - u16 stickPressed; // OffTriggered - u16 stickDepressed; // OnTriggered -}; - -struct UnkStruct_800DC5EC { - /* 0x00 */ struct Controller *controllers; // gControllers ptr 800F6910 - /* 0x04 */ Camera *camera; // Player camera ptr - /* 0x08 */ Player *player; // Player ptr 800F6990 - /* 0x0C */ s32 *unkC; // unk struct? - /* 0x10 */ Vp viewport; - /* 0x20 */ s32 pad[2]; - /* 0x28 */ s16 cameraHeight; - /* 0x2A */ s16 unk; - /* 0x2C */ s16 screenWidth; - /* 0x2E */ s16 screenHeight; - /* 0x30 */ s16 screenStartX; - /* 0x32 */ s16 screenStartY; - /* 0x34 */ s16 unk3C; - /* 0x36 */ s16 playerDirection; - /* 0x38 */ s16 pathCounter; - /* 0x3A */ s16 unk42; - /* 0x3C */ s32 pad2; -}; // size = 0x40 - -// Camera path struct? Or something like that. For GP race won scene? -struct UnkStruct_80287500 { - Vec3f unk0; // xyz coordinates? - f32 unkC; - f32 unk10; - f32 unk14; // rotation? - s32 unk18; - s32 unk1C; - f32 unk20; - f32 unk24; - f32 unk28; - f32 unk2C; - f32 unk30; - f32 unk34; - s32 unk38; -}; - -struct UnkStruct_800DDB40 { - u32 unk0; - u32 unk4; - u32 unk8; - u32 unkC; - u32 unk10; - u32 unk14; - u32 unk18; - u32 unk1C; - u32 unk20; - u16 unk24; - u16 unk26; -}; - -struct UnkStruct_802B53C8 { - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; -}; -// end math util structs - -struct UnkStruct_800DDB68 { - s32 *D_800ED600; s32 *D_800ED608; s32 *D_800ED610; s32 *D_800ED618; - s32 *D_800ED620; s32 *D_800ED628; s32 *D_800ED630; s32 *D_800ED638; -}; - -#endif /* TYPES_H */ diff --git a/src/actors/green_shell/update.inc.c b/src/actors/green_shell/update.inc.c index 891292953..cae0c9470 100644 --- a/src/actors/green_shell/update.inc.c +++ b/src/actors/green_shell/update.inc.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include "collision.h" diff --git a/src/actors/paddle_boat/render.inc.c b/src/actors/paddle_boat/render.inc.c index 40c37b165..379b7455d 100644 --- a/src/actors/paddle_boat/render.inc.c +++ b/src/actors/paddle_boat/render.inc.c @@ -37,8 +37,8 @@ void render_actor_paddle_boat(Camera *arg0, struct PaddleWheelBoat *boat, UNUSED if (render_set_position(spE0, 1) != 0) { // Render the boat - gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_dl_E730); - gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_dl_E058); + gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_boat_dl); + gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_railings_dl); mtxf_rotate_x(spE0, boat->wheelRot); vec3f_set(sp120, 0, 16.0f, -255.0f); @@ -47,7 +47,7 @@ void render_actor_paddle_boat(Camera *arg0, struct PaddleWheelBoat *boat, UNUSED if (render_set_position(sp60, 3) != 0) { // Render the paddle wheel gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK); - gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_dl_FC28); + gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_paddle_wheel_dl); gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); } diff --git a/src/audio/external.c b/src/audio/external.c index ac6f94545..a46e63712 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "camera.h" #include "math_util_2.h" diff --git a/src/audio/internal.h b/src/audio/internal.h index 5a96d950b..85ea368c9 100644 --- a/src/audio/internal.h +++ b/src/audio/internal.h @@ -3,7 +3,6 @@ #include -#include "types.h" #define SEQUENCE_PLAYERS 4 #define SEQUENCE_CHANNELS 48 diff --git a/src/buffers.h b/src/buffers.h index 51c949536..13584036d 100644 --- a/src/buffers.h +++ b/src/buffers.h @@ -2,7 +2,7 @@ #define BUFFERS_H #include -#include "config.h" +#include #include "common_structs.h" /* diff --git a/src/buffers/buffers.c b/src/buffers/buffers.c index cbdaae317..cc08aa60a 100644 --- a/src/buffers/buffers.c +++ b/src/buffers/buffers.c @@ -1,6 +1,6 @@ #include #include -#include "config.h" +#include #include "buffers.h" ALIGNED8 union_D_802BFB80 D_802BFB80; diff --git a/src/buffers/random.h b/src/buffers/random.h index f144f7843..bb7aefa8b 100644 --- a/src/buffers/random.h +++ b/src/buffers/random.h @@ -1,4 +1,9 @@ +#ifndef RANDOM_H +#define RANDOM_H + #include extern u16 gRandomSeed16; extern u8 randomSeedPadding[]; + +#endif // RANDOM_H \ No newline at end of file diff --git a/src/camera.c b/src/camera.c index 43f9d26fe..0ff40d9be 100644 --- a/src/camera.c +++ b/src/camera.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "camera.h" #include "code_800029B0.h" diff --git a/src/code_800029B0.c b/src/code_800029B0.c index a665de1b8..c55bcc712 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -1,8 +1,8 @@ #include #include +#include #include "code_800029B0.h" -#include "types.h" #include "memory.h" #include "waypoints.h" #include "actors.h" diff --git a/src/code_800029B0.h b/src/code_800029B0.h index 30ee796d7..40376ff2e 100644 --- a/src/code_800029B0.h +++ b/src/code_800029B0.h @@ -3,8 +3,29 @@ #include #include -#include #include +#include "camera.h" + +struct UnkStruct_800DC5EC { + /* 0x00 */ struct Controller *controllers; // gControllers ptr 800F6910 + /* 0x04 */ Camera *camera; // Player camera ptr + /* 0x08 */ Player *player; // Player ptr 800F6990 + /* 0x0C */ s32 *unkC; // unk struct? + /* 0x10 */ Vp viewport; + /* 0x20 */ s32 pad[2]; + /* 0x28 */ s16 cameraHeight; + /* 0x2A */ s16 unk; + /* 0x2C */ s16 screenWidth; + /* 0x2E */ s16 screenHeight; + /* 0x30 */ s16 screenStartX; + /* 0x32 */ s16 screenStartY; + /* 0x34 */ s16 unk3C; + /* 0x36 */ s16 playerDirection; + /* 0x38 */ s16 pathCounter; + /* 0x3A */ s16 unk42; + /* 0x3C */ s32 pad2; +}; // size = 0x40 + /* Function Prototypes */ diff --git a/src/code_80004740.c b/src/code_80004740.c index 50ce5f1ed..a863eac74 100644 --- a/src/code_80004740.c +++ b/src/code_80004740.c @@ -1,6 +1,5 @@ #include #include -#include #include #include "math_util.h" #include "code_80004740.h" diff --git a/src/code_8003DC40.c b/src/code_8003DC40.c index 7d92688cc..3de5b0add 100644 --- a/src/code_8003DC40.c +++ b/src/code_8003DC40.c @@ -1,5 +1,6 @@ #include #include +#include #include "math_util.h" #include "common_structs.h" #include "player_controller.h" diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 6e4e06d60..ce3586ea3 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -6,13 +6,14 @@ #include #include #include +#include +#include "camera.h" #include "code_80057C60.h" #include "main.h" #include "actors.h" #include "code_800029B0.h" #include "racing/memory.h" -#include #include #include "math_util.h" #include "math_util_2.h" diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index fa38f6411..3eb226d95 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "code_800029B0.h" #include "code_80005FD0.h" diff --git a/src/code_80086E70.c b/src/code_80086E70.c index fa3169a0c..0489faa0a 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "code_80086E70.h" #include "camera.h" diff --git a/src/code_80091440.h b/src/code_80091440.h index ced30ef22..18aa89297 100644 --- a/src/code_80091440.h +++ b/src/code_80091440.h @@ -1,6 +1,10 @@ +#ifndef CODE_80091440_H +#define CODE_80091440_H + #include "ultra64.h" void func_80091440(s8); void func_800914A0(void); void func_800914E0(void); +#endif // CODE_80091440_H \ No newline at end of file diff --git a/src/code_80091750.c b/src/code_80091750.c index 39f92cacd..570c281ef 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -1,9 +1,9 @@ #include #include +#include #include #include #include -#include #include #include "code_800029B0.h" #include "code_80091750.h" @@ -7415,7 +7415,7 @@ void func_800A1FB0(struct_8018D9E0_entry *arg0) { s32 var_s1; char spA8[3]; s32 var_s2; - s32 temp_v0; + UNUSED s32 temp_v0; UNUSED s32 stackPadding9; char sp98[3]; struct_8018EE10_entry *var_v1; @@ -7427,7 +7427,7 @@ void func_800A1FB0(struct_8018D9E0_entry *arg0) { case 0x17: /* switch 1 */ case 0x18: /* switch 1 */ for (stackPadding0 = 0; stackPadding0 < 4; stackPadding0++) { - func_80092224(D_8018EDEC - 0x15, stackPadding0, 3); + set_text_color_rainbow_if_selected(D_8018EDEC - 0x15, stackPadding0, 3); func_80093324(0x00000032, 0x55 + (0x23 * stackPadding0), D_800E7868[stackPadding0], 0, 0.9f, 1.0f); if (stackPadding0 == (D_8018EDEC - 0x15)) { spE0.column = 0x0032; @@ -7444,7 +7444,7 @@ void func_800A1FB0(struct_8018D9E0_entry *arg0) { func_80093324(0x00000028, 0x55 + (0x14 * stackPadding0), D_800E7878[stackPadding0], 0, 1.0f, 1.0f); } for (stackPadding0 = 0; stackPadding0 < 2; stackPadding0++) { - func_80092224(D_8018EDEC - 0x1E, stackPadding0, 1); + set_text_color_rainbow_if_selected(D_8018EDEC - 0x1E, stackPadding0, 1); func_80093324(0x00000084, 0x96 + (0x19 * stackPadding0), D_800E7840[stackPadding0], 0, 1.0f, 1.0f); if (stackPadding0 == (D_8018EDEC - 0x1E)) { spE0.column = 0x0084; diff --git a/src/code_800AF9B0.h b/src/code_800AF9B0.h index f63066f51..0bd894550 100644 --- a/src/code_800AF9B0.h +++ b/src/code_800AF9B0.h @@ -2,7 +2,6 @@ #define CODE_800AF9B0_H #include "common_structs.h" -#include /* Function Prototypes */ void func_800AF9B0(void); diff --git a/src/crash_screen.c b/src/crash_screen.c index 2753cc3ad..0208862be 100644 --- a/src/crash_screen.c +++ b/src/crash_screen.c @@ -1,7 +1,6 @@ #include #include -#include -#include +#include #include #include diff --git a/src/crash_screen.h b/src/crash_screen.h index 7975825d1..44ea6619d 100644 --- a/src/crash_screen.h +++ b/src/crash_screen.h @@ -1,6 +1,11 @@ +#ifndef CRASH_SCREEN_H +#define CRASH_SCREEN_H + #include #include extern u16 *pFramebuffer; void crash_screen_set_framebuffer(u16*); + +#endif // CRASH_SCREEN_H \ No newline at end of file diff --git a/src/data/data_segment2.c b/src/data/data_segment2.c index 8598f825e..2d72f4398 100644 --- a/src/data/data_segment2.c +++ b/src/data/data_segment2.c @@ -1,5 +1,4 @@ #include -#include #include #include #include "data_segment2.h" diff --git a/src/debug/all_variables.h b/src/debug/all_variables.h index 2777ba625..561a23ea6 100644 --- a/src/debug/all_variables.h +++ b/src/debug/all_variables.h @@ -51,7 +51,6 @@ #include #include -#include #include #include #include @@ -64,7 +63,6 @@ #include #include #include "buffers/trig_tables.h" -#include #include #include #include diff --git a/src/debug/crash_screen_enhancement.c b/src/debug/crash_screen_enhancement.c index 54547908c..574b3f531 100644 --- a/src/debug/crash_screen_enhancement.c +++ b/src/debug/crash_screen_enhancement.c @@ -1,7 +1,6 @@ #include #include -#include -#include +#include #include #include #include "../crash_screen.h" diff --git a/src/debug/crash_screen_enhancement.h b/src/debug/crash_screen_enhancement.h index 43fe8e10a..9f9a321ca 100644 --- a/src/debug/crash_screen_enhancement.h +++ b/src/debug/crash_screen_enhancement.h @@ -1,3 +1,6 @@ +#ifndef CRASH_SCREEN_ENHANCEMENT_H +#define CRASH_SCREEN_ENHANCEMENT_H + #include #include @@ -35,3 +38,5 @@ void crash_screen_draw(OSThread* thread); // } // gGlobalTimer++; // } + +#endif // CRASH_SCREEN_ENHANCEMENT_H \ No newline at end of file diff --git a/src/effects.c b/src/effects.c index 779c003c5..52c5127e2 100644 --- a/src/effects.c +++ b/src/effects.c @@ -1,7 +1,7 @@ #include #include -#include #include +#include #include #include #include "code_800029B0.h" diff --git a/src/ending/ceremony_and_credits.c b/src/ending/ceremony_and_credits.c index 879b22262..d12c5d276 100644 --- a/src/ending/ceremony_and_credits.c +++ b/src/ending/ceremony_and_credits.c @@ -6,7 +6,6 @@ #include #include -#include #include #include #include "math_util.h" diff --git a/src/ending/code_80280000.c b/src/ending/code_80280000.c index d96fcb898..f9f1fe824 100644 --- a/src/ending/code_80280000.c +++ b/src/ending/code_80280000.c @@ -3,18 +3,17 @@ #include #include #include +#include #include #include #include -#include #include "camera.h" #include "memory.h" #include "math_util.h" #include "code_80280000.h" #include "code_80281780.h" #include "skybox_and_splitscreen.h" -#include #include "code_80091750.h" #include "code_8006E9C0.h" #include "code_800029B0.h" diff --git a/src/ending/code_80281780.c b/src/ending/code_80281780.c index 003d3e552..4b33160a1 100644 --- a/src/ending/code_80281780.c +++ b/src/ending/code_80281780.c @@ -1,11 +1,10 @@ #include #include #include -#include #include +#include #include "code_80281780.h" -#include "types.h" #include "memory.h" #include "camera.h" #include "camera_junk.h" diff --git a/src/ending/dl_unk_80284EE0.c b/src/ending/dl_unk_80284EE0.c index 4a729773b..64282cb08 100644 --- a/src/ending/dl_unk_80284EE0.c +++ b/src/ending/dl_unk_80284EE0.c @@ -1,6 +1,5 @@ -#include +#include #include - #include "courses/royal_raceway/course_displaylists.inc.h" // Init RDP - RSP (Ceremony) diff --git a/src/ending/podium_ceremony_actors.c b/src/ending/podium_ceremony_actors.c index 7d83d25af..dc6a224d6 100644 --- a/src/ending/podium_ceremony_actors.c +++ b/src/ending/podium_ceremony_actors.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include "main.h" diff --git a/src/gbiMacro.c b/src/gbiMacro.c index f079632e4..18f131dce 100644 --- a/src/gbiMacro.c +++ b/src/gbiMacro.c @@ -1,9 +1,8 @@ #include #include -#include "types.h" #include "PR/gu.h" #include "main.h" -#include "config.h" +#include extern s16 D_800E43A8; extern Mtx D_0D008E98; diff --git a/src/main.c b/src/main.c index 873d8efd6..19eb4f4c5 100644 --- a/src/main.c +++ b/src/main.c @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include + #include "profiler.h" #include "main.h" #include "racing/memory.h" diff --git a/src/main.h b/src/main.h index b4f759d85..b1e37ea95 100644 --- a/src/main.h +++ b/src/main.h @@ -1,7 +1,6 @@ #ifndef MAIN_H #define MAIN_H -#include "types.h" // Message IDs #define MESG_SP_COMPLETE 100 diff --git a/src/math_util_2.c b/src/math_util_2.c index 04d978a79..2afe7f201 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -11,6 +11,7 @@ #include "render_player.h" #include "code_80057C60.h" #include "defines.h" +#include "camera.h" #pragma intrinsic (sqrtf) diff --git a/src/math_util_2.h b/src/math_util_2.h index 725fa7627..e43a0df8d 100644 --- a/src/math_util_2.h +++ b/src/math_util_2.h @@ -1,8 +1,8 @@ #ifndef MATH_UTIL_2_H #define MATH_UTIL_2_H -#include "types.h" #include "common_structs.h" +#include "camera.h" /* Function Prototypes */ diff --git a/src/menus.c b/src/menus.c index 154667b6d..f5d371820 100644 --- a/src/menus.c +++ b/src/menus.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "menus.h" #include "main.h" diff --git a/src/menus.h b/src/menus.h index 2345496f6..487697564 100644 --- a/src/menus.h +++ b/src/menus.h @@ -3,7 +3,6 @@ #include "PR/os.h" #include "common_structs.h" -#include #include // D_8018EDEC is position on options screen? diff --git a/src/os/osContInternal.h b/src/os/osContInternal.h index 0f628205b..77b51ba93 100644 --- a/src/os/osContInternal.h +++ b/src/os/osContInternal.h @@ -1,7 +1,6 @@ #ifndef _ULTRA64_CONTROLLER_INTERNAL_H_ #define _ULTRA64_CONTROLLER_INTERNAL_H_ -#include typedef struct { diff --git a/src/profiler.c b/src/profiler.c index 8090e9dbb..2bb9f5b97 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -1,8 +1,7 @@ #include #include -#include "types.h" #include "profiler.h" -#include "config.h" +#include #include "main.h" struct ProfilerFrameData gProfilerFrameData[2]; diff --git a/src/profiler.h b/src/profiler.h index 2416f4d44..92267ebd2 100644 --- a/src/profiler.h +++ b/src/profiler.h @@ -1,7 +1,6 @@ #ifndef PROFILER_H #define PROFILER_H -#include "types.h" extern u64 osClockRate; diff --git a/src/racing/actors.c b/src/racing/actors.c index 4b1d4a597..4f919a22e 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -1,12 +1,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include "code_800029B0.h" #include "main.h" diff --git a/src/racing/actors.h b/src/racing/actors.h index 0bd0b1b7c..8c0b2e2b2 100644 --- a/src/racing/actors.h +++ b/src/racing/actors.h @@ -1,8 +1,9 @@ #ifndef ACTORS_H #define ACTORS_H -#include "types.h" #include "actor_types.h" +#include "code_800029B0.h" +#include "camera.h" #define END_OF_SPAWN_DATA -0x8000 diff --git a/src/racing/math_util.c b/src/racing/math_util.c index 9626e2a69..3305cb931 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -421,8 +421,10 @@ void func_802B5D30(s16 arg0, s16 arg1, s32 arg2) { func_802B5D64(0x9000000, arg0, arg1, arg2); } -void func_802B5D64(uintptr_t arg0, s16 arg1, s16 arg2, s32 arg3) { - UNUSED s32 pad[3]; +void func_802B5D64(uintptr_t addr, s16 arg1, s16 arg2, s32 arg3) { + u32 segment = SEGMENT_NUMBER2(addr); + u32 offset = SEGMENT_OFFSET(addr); + UNUSED s32 pad; f32 sp48; f32 sp44; f32 sp40; @@ -432,7 +434,7 @@ void func_802B5D64(uintptr_t arg0, s16 arg1, s16 arg2, s32 arg3) { s8 sp2C[3]; Lights1 *var_s0; - var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF)); + var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset); sp48 = sins(arg2); sp44 = coss(arg2); sp40 = sins(arg1); @@ -1151,15 +1153,17 @@ f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY // No idea if arg1 is actually a Mat4 or not, but since this function is unused // its impossible to know with certainty either way, very close of func_802B5D64 -UNUSED void func_802B8414(uintptr_t arg0, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4) { - UNUSED s32 pad[3]; +UNUSED void func_802B8414(uintptr_t addr, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4) { + u32 segment = SEGMENT_NUMBER2(addr); + u32 offset = SEGMENT_OFFSET(addr); + UNUSED s32 pad; Vec3f sp40; s8 sp3C[3]; s32 var_v0; UNUSED s32 pad2[3]; Lights1 *var_s0; - var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF)); + var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset); sins(arg3); coss(arg3); sins(arg2); diff --git a/src/racing/math_util.h b/src/racing/math_util.h index 2ed50d6b3..f3ec26b3f 100644 --- a/src/racing/math_util.h +++ b/src/racing/math_util.h @@ -3,7 +3,6 @@ #include -#include "types.h" //#define sins(x) gSineTable[(u16) (x) >> 4] //#define coss(x) gCosineTable[(u16) (x) >> 4] diff --git a/src/racing/memory.c b/src/racing/memory.c index c2f24012f..d2d352d62 100644 --- a/src/racing/memory.c +++ b/src/racing/memory.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include diff --git a/src/racing/memory.h b/src/racing/memory.h index 7a9111b0f..a1bde7e91 100644 --- a/src/racing/memory.h +++ b/src/racing/memory.h @@ -1,7 +1,6 @@ #ifndef MEMORY_H #define MEMORY_H -#include "types.h" struct MainPoolBlock { struct MainPoolBlock *prev; diff --git a/src/racing/race_logic.c b/src/racing/race_logic.c index 04f8ce945..1c690e512 100644 --- a/src/racing/race_logic.c +++ b/src/racing/race_logic.c @@ -1,8 +1,7 @@ #include #include -#include +#include #include -#include #include #include #include "camera.h" diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index b2b2a22de..8bb715a79 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -1,8 +1,8 @@ #include #include +#include #include #include -#include #include #include "render_courses.h" diff --git a/src/racing/render_courses.h b/src/racing/render_courses.h index 61a755f52..a41659f6c 100644 --- a/src/racing/render_courses.h +++ b/src/racing/render_courses.h @@ -1,6 +1,8 @@ #ifndef RENDER_COURSES_H #define RENDER_COURSES_H +#include "code_800029B0.h" + void func_8029122C(struct UnkStruct_800DC5EC*, s32); s32 func_80290C20(Camera*); void parse_course_displaylists(uintptr_t); diff --git a/src/racing/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c index edae4bf31..0245992b0 100644 --- a/src/racing/skybox_and_splitscreen.c +++ b/src/racing/skybox_and_splitscreen.c @@ -1,8 +1,7 @@ #include #include #include -#include -#include +#include #include "skybox_and_splitscreen.h" #include "code_800029B0.h" diff --git a/src/racing/skybox_and_splitscreen.h b/src/racing/skybox_and_splitscreen.h index ec2d7d8b3..820a593bc 100644 --- a/src/racing/skybox_and_splitscreen.h +++ b/src/racing/skybox_and_splitscreen.h @@ -2,6 +2,7 @@ #define SKYBOX_AND_SPLITSCREEN_H #include +#include "code_800029B0.h" #define G_CLEAR_ALL_MODES 0xFFFFFFFF diff --git a/src/render_objects.c b/src/render_objects.c index 1e0c8cdc4..085d6780d 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -4,12 +4,13 @@ **/ #include +#include #include #include #include #include #include -#include +#include "camera.h" #include "memory.h" #include "math_util.h" #include "math_util_2.h" diff --git a/src/render_player.c b/src/render_player.c index ae21e2fc5..aec58a16c 100644 --- a/src/render_player.c +++ b/src/render_player.c @@ -1,9 +1,10 @@ #include #include +#include #include #include -#include #include "code_800029B0.h" +#include "camera.h" #include "math_util.h" #include "math_util_2.h" #include "main.h" diff --git a/src/render_player.h b/src/render_player.h index f1663633d..201c44ca2 100644 --- a/src/render_player.h +++ b/src/render_player.h @@ -1,9 +1,9 @@ #ifndef CODE_8001F980_H #define CODE_8001F980_H -#include "types.h" -#include "common_structs.h" +#include #include "buffers.h" +#include "camera.h" #define SOME_TEXTURE_POINTER_MATH 0x800 diff --git a/src/save.h b/src/save.h index c68c2a806..81c93d340 100644 --- a/src/save.h +++ b/src/save.h @@ -3,7 +3,6 @@ #include "PR/os.h" #include "common_structs.h" -#include /* define symbols */ diff --git a/src/spawn_players.c b/src/spawn_players.c index e4298d0c6..427975e50 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -1,4 +1,5 @@ #include +#include #include "spawn_players.h" #include "code_800029B0.h" diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index ff52c60b3..97142e717 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -12,6 +12,7 @@ #include "code_8006E9C0.h" #include "code_80091750.h" #include "code_80057C60.h" +#include "kart_dma.h" extern s32 mio0encode(s32 input, s32, s32); extern s32 func_80040174(void *, s32, s32); @@ -61,8 +62,6 @@ s32 D_80162E00; u32 *D_800DC710 = (u32 *) &D_802BFB80.arraySize8[0][2][3]; u32 *D_800DC714 = (u32 *) &D_802BFB80.arraySize8[1][1][3]; -extern u8 _kart_texturesSegmentRomStart; - extern s32 gLapCountByPlayerId[]; extern StaffGhost *d_mario_raceway_staff_ghost; @@ -72,7 +71,7 @@ extern StaffGhost *d_luigi_raceway_staff_ghost; void func_80004EF0(void) { D_80162DA4 = (u32 *) &D_802BFB80.arraySize8[0][2][3]; osInvalDCache(&D_80162DA4[0], 0x4000); - osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) ((D_80162DC4 & 0xFFFFFF) + &_kart_texturesSegmentRomStart), D_80162DA4, 0x4000, &gDmaMesgQueue); + osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(D_80162DC4)], D_80162DA4, 0x4000, &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK); D_80162D9C = (*D_80162DA4 & 0xFF0000); D_80162DA0 = 0; diff --git a/src/staff_ghosts.h b/src/staff_ghosts.h index 3ff61cda6..5444caa8b 100644 --- a/src/staff_ghosts.h +++ b/src/staff_ghosts.h @@ -3,7 +3,6 @@ #include "PR/os.h" #include "common_structs.h" -#include void func_80005B18(void); void func_80004EF0(void); diff --git a/src/update_objects.c b/src/update_objects.c index aa5941c10..439fdb03f 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "update_objects.h" #include "main.h" diff --git a/yamls/us/ceremony_data.yml b/yamls/us/ceremony_data.yml index 1f5f1cf5b..bc68825e6 100644 --- a/yamls/us/ceremony_data.yml +++ b/yamls/us/ceremony_data.yml @@ -5,7 +5,8 @@ code: - '#include ' header: - - '#include ' + - '#include ' + - '#include ' - '#include ' silver_trophy_dl: diff --git a/yamls/us/ceremony_rsp_init_80284EE0.yml b/yamls/us/ceremony_rsp_init_80284EE0.yml index 6b6c53e06..c316b45ca 100644 --- a/yamls/us/ceremony_rsp_init_80284EE0.yml +++ b/yamls/us/ceremony_rsp_init_80284EE0.yml @@ -4,7 +4,8 @@ offset: 0x128520 header: code: - - '#include ' + - '#include ' + - '#include ' - '#include ' - '#include "courses/royal_raceway/course_displaylists.inc.h"' D_80284EE0: diff --git a/yamls/us/common_data.yml b/yamls/us/common_data.yml index 782a4dce5..0b0c8a56a 100644 --- a/yamls/us/common_data.yml +++ b/yamls/us/common_data.yml @@ -8,7 +8,8 @@ - '#include ' header: - '#include ' - - '#include ' + - '#include ' + - '#include ' tables: common_grand_prix_human_item_curve: range: [0x8150, 0x840C] diff --git a/yamls/us/data_segment2.yml b/yamls/us/data_segment2.yml index 1aedcd5af..b4f76de73 100644 --- a/yamls/us/data_segment2.yml +++ b/yamls/us/data_segment2.yml @@ -5,7 +5,8 @@ header: code: - '#include ' - - '#include ' + - '#include ' + - '#include ' - '#include ' - '#include ' - '#include "data_segment2.h"' diff --git a/yamls/us/startup_logo.yml b/yamls/us/startup_logo.yml index 6c5459ed5..52483c382 100644 --- a/yamls/us/startup_logo.yml +++ b/yamls/us/startup_logo.yml @@ -5,7 +5,8 @@ code: - '#include ' header: - - '#include "types.h"' + - '#include ' + - '#include ' dl1: symbol: startup_logo_dl