From 8901f82f5aeaedff75f7279cea3e32c2fe58d8b2 Mon Sep 17 00:00:00 2001 From: coco875 <59367621+coco875@users.noreply.github.com> Date: Mon, 21 Oct 2024 01:24:37 +0200 Subject: [PATCH 1/2] some rename and allow change the course engine (#691) * some rename and allow change the course engine * fix comment * add more comment * rename and change description --- .../code_80005FD0/kart_ai_use_item_strategy.s | 6 +- .../code_8006E9C0/func_8006FA94.s | 2 +- .../render_objects/func_8004F168.s | 20 +- ctx_includes.c | 122 ---------- enhancements/flycam.patch | 2 +- include/bomb_kart.h | 1 + include/config.h | 11 + include/course.h | 116 +++++++++ include/mk64.h | 27 +-- include/objects.h | 2 +- models/README.MD | 2 +- src/audio/external.c | 4 +- src/camera.c | 2 + src/code_800029B0.c | 15 +- src/code_800029B0.h | 1 - src/code_80005FD0.c | 139 +++++------ src/code_8003DC40.c | 6 + src/code_8003DC40.h | 2 - src/code_80057C60.c | 65 ++--- src/code_80057C60.h | 12 +- src/code_80057C60_var.c | 12 +- src/code_8006E9C0.c | 228 +++++++++--------- src/code_8006E9C0.h | 6 +- src/code_80086E70.c | 1 + src/code_80086E70.h | 2 - src/code_80091750.c | 210 ++++++++-------- src/code_80091750.h | 3 - src/data/path_spawn_metadata.c | 14 +- src/data/path_spawn_metadata.h | 17 -- src/effects.c | 10 +- src/effects.h | 2 +- src/ending/camera_junk.c | 5 +- src/ending/code_80280000.c | 12 +- src/ending/code_80281780.c | 3 +- src/ending/code_80281C40.c | 7 +- src/ending/code_80281C40.h | 2 +- src/ending/podium_ceremony_actors.c | 2 +- src/main.c | 21 +- src/main.h | 2 - src/menus.c | 63 ++--- src/player_controller.c | 14 +- src/racing/actors.c | 10 +- src/racing/actors.h | 1 - src/racing/collision.c | 47 ++-- src/racing/collision.h | 2 +- src/racing/math_util.c | 15 +- src/racing/math_util.h | 2 +- src/racing/race_logic.c | 44 ++-- src/racing/render_courses.c | 56 +++-- src/racing/render_courses.h | 6 +- src/racing/skybox_and_splitscreen.c | 170 +++++++------ src/racing/skybox_and_splitscreen.h | 4 +- src/render_objects.c | 38 +-- src/render_objects.h | 6 +- src/render_player.c | 4 +- src/spawn_players.c | 3 +- src/staff_ghosts.c | 9 +- src/update_objects.c | 30 ++- src/update_objects.h | 2 +- 59 files changed, 891 insertions(+), 751 deletions(-) delete mode 100644 ctx_includes.c create mode 100644 include/config.h diff --git a/asm/non_matchings/code_80005FD0/kart_ai_use_item_strategy.s b/asm/non_matchings/code_80005FD0/kart_ai_use_item_strategy.s index 7a18f71dbe..6e1f08c5ac 100644 --- a/asm/non_matchings/code_80005FD0/kart_ai_use_item_strategy.s +++ b/asm/non_matchings/code_80005FD0/kart_ai_use_item_strategy.s @@ -330,7 +330,7 @@ glabel L8001AFD8 /* 01BC94 8001B094 46283280 */ add.d $f10, $f6, $f8 /* 01BC98 8001B098 8D86001C */ lw $a2, 0x1c($t4) /* 01BC9C 8001B09C AFA70028 */ sw $a3, 0x28($sp) -/* 01BCA0 8001B0A0 0C0AB870 */ jal spawn_actor_on_surface +/* 01BCA0 8001B0A0 0C0AB870 */ jal get_surface_height /* 01BCA4 8001B0A4 462053A0 */ cvt.s.d $f14, $f10 /* 01BCA8 8001B0A8 8FA70028 */ lw $a3, 0x28($sp) /* 01BCAC 8001B0AC 3C013F80 */ li $at, 0x3F800000 # 1.000000 @@ -582,7 +582,7 @@ glabel L8001B3B4 /* 01C054 8001B454 E4E00028 */ swc1 $f0, 0x28($a3) /* 01C058 8001B458 E4E0002C */ swc1 $f0, 0x2c($a3) /* 01C05C 8001B45C AFA70028 */ sw $a3, 0x28($sp) -/* 01C060 8001B460 0C0AB870 */ jal spawn_actor_on_surface +/* 01C060 8001B460 0C0AB870 */ jal get_surface_height /* 01C064 8001B464 462033A0 */ cvt.s.d $f14, $f6 /* 01C068 8001B468 8FA70028 */ lw $a3, 0x28($sp) /* 01C06C 8001B46C 3C013F80 */ li $at, 0x3F800000 # 1.000000 @@ -1122,7 +1122,7 @@ glabel L8001BB30 /* 01C7F4 8001BBF4 46249180 */ add.d $f6, $f18, $f4 /* 01C7F8 8001BBF8 8CE60020 */ lw $a2, 0x20($a3) /* 01C7FC 8001BBFC AFA70028 */ sw $a3, 0x28($sp) -/* 01C800 8001BC00 0C0AB870 */ jal spawn_actor_on_surface +/* 01C800 8001BC00 0C0AB870 */ jal get_surface_height /* 01C804 8001BC04 462033A0 */ cvt.s.d $f14, $f6 /* 01C808 8001BC08 8FA70028 */ lw $a3, 0x28($sp) /* 01C80C 8001BC0C C4E8000C */ lwc1 $f8, 0xc($a3) diff --git a/asm/non_matchings/code_8006E9C0/func_8006FA94.s b/asm/non_matchings/code_8006E9C0/func_8006FA94.s index a4e9acbcf2..d74189457d 100644 --- a/asm/non_matchings/code_8006E9C0/func_8006FA94.s +++ b/asm/non_matchings/code_8006E9C0/func_8006FA94.s @@ -3,7 +3,7 @@ glabel func_8006FA94 /* 070698 8006FA98 AFBF0014 */ sw $ra, 0x14($sp) /* 07069C 8006FA9C 0C01BE33 */ jal func_8006F8CC /* 0706A0 8006FAA0 00000000 */ nop -/* 0706A4 8006FAA4 0C01BC02 */ jal func_8006F008 +/* 0706A4 8006FAA4 0C01BC02 */ jal course_mini_map_settings /* 0706A8 8006FAA8 00000000 */ nop /* 0706AC 8006FAAC 24040000 */ li $a0, 0 /* 0706B0 8006FAB0 0C0338C4 */ jal osSetTime diff --git a/asm/non_matchings/render_objects/func_8004F168.s b/asm/non_matchings/render_objects/func_8004F168.s index 9e763f1375..4a745ecdac 100644 --- a/asm/non_matchings/render_objects/func_8004F168.s +++ b/asm/non_matchings/render_objects/func_8004F168.s @@ -15,13 +15,13 @@ glabel func_8004F168 /* 04FD9C 8004F19C 01CF1821 */ addu $v1, $t6, $t7 /* 04FDA0 8004F1A0 94780000 */ lhu $t8, ($v1) /* 04FDA4 8004F1A4 00A03825 */ move $a3, $a1 -/* 04FDA8 8004F1A8 3C018019 */ lui $at, %hi(D_8018D2A0) # $at, 0x8019 +/* 04FDA8 8004F1A8 3C018019 */ lui $at, %hi(gMiniMapMarkerScale) # $at, 0x8019 /* 04FDAC 8004F1AC 33198000 */ andi $t9, $t8, 0x8000 /* 04FDB0 8004F1B0 13200088 */ beqz $t9, .L8004F3D4 /* 04FDB4 8004F1B4 00044040 */ sll $t0, $a0, 1 -/* 04FDB8 8004F1B8 C420D2A0 */ lwc1 $f0, %lo(D_8018D2A0)($at) +/* 04FDB8 8004F1B8 C420D2A0 */ lwc1 $f0, %lo(gMiniMapMarkerScale)($at) /* 04FDBC 8004F1BC C4640014 */ lwc1 $f4, 0x14($v1) -/* 04FDC0 8004F1C0 3C098019 */ lui $t1, %hi(D_8018D2C0) # 0x8019 +/* 04FDC0 8004F1C0 3C098019 */ lui $t1, %hi(gMiniMapFinishLineX) # 0x8019 /* 04FDC4 8004F1C4 C466001C */ lwc1 $f6, 0x1c($v1) /* 04FDC8 8004F1C8 46002082 */ mul.s $f2, $f4, $f0 /* 04FDCC 8004F1CC 01284821 */ addu $t1, $t1, $t0 @@ -29,11 +29,11 @@ glabel func_8004F168 /* 04FDD4 8004F1D4 3C0C8019 */ lui $t4, %hi(D_8018D2B0) # $t4, 0x8019 /* 04FDD8 8004F1D8 858CD2B0 */ lh $t4, %lo(D_8018D2B0)($t4) /* 04FDDC 8004F1DC 854AD2F0 */ lh $t2, %lo(D_8018D2F0)($t2) -/* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(D_8018D2C0)($t1) # -0x2d40($t1) +/* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(gMiniMapFinishLineX)($t1) # -0x2d40($t1) /* 04FDE4 8004F1E4 4600120D */ trunc.w.s $f8, $f2 /* 04FDE8 8004F1E8 46003302 */ mul.s $f12, $f6, $f0 -/* 04FDEC 8004F1EC 3C0F8019 */ lui $t7, %hi(D_8018D2E0) # $t7, 0x8019 -/* 04FDF0 8004F1F0 85EFD2E0 */ lh $t7, %lo(D_8018D2E0)($t7) +/* 04FDEC 8004F1EC 3C0F8019 */ lui $t7, %hi(gMiniMapX) # $t7, 0x8019 +/* 04FDF0 8004F1F0 85EFD2E0 */ lh $t7, %lo(gMiniMapX)($t7) /* 04FDF4 8004F1F4 01001025 */ move $v0, $t0 /* 04FDF8 8004F1F8 012A5821 */ addu $t3, $t1, $t2 /* 04FDFC 8004F1FC 05810003 */ bgez $t4, .L8004F20C @@ -43,21 +43,21 @@ glabel func_8004F168 .L8004F20C: /* 04FE0C 8004F20C 44084000 */ mfc1 $t0, $f8 /* 04FE10 8004F210 016D7023 */ subu $t6, $t3, $t5 -/* 04FE14 8004F214 3C0D8019 */ lui $t5, %hi(D_8018D2D8) # 0x8019 +/* 04FE14 8004F214 3C0D8019 */ lui $t5, %hi(gMiniMapFinishLineY) # 0x8019 /* 04FE18 8004F218 01CFC021 */ addu $t8, $t6, $t7 /* 04FE1C 8004F21C 3C0E8019 */ lui $t6, %hi(D_8018D2F8) # $t6, 0x8019 /* 04FE20 8004F220 01A26821 */ addu $t5, $t5, $v0 /* 04FE24 8004F224 00084C00 */ sll $t1, $t0, 0x10 -/* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(D_8018D2D8)($t5) # -0x2d28($t5) +/* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(gMiniMapFinishLineY)($t5) # -0x2d28($t5) /* 04FE2C 8004F22C 85CED2F8 */ lh $t6, %lo(D_8018D2F8)($t6) /* 04FE30 8004F230 3C198019 */ lui $t9, %hi(D_8018D2B8) # $t9, 0x8019 /* 04FE34 8004F234 4600628D */ trunc.w.s $f10, $f12 /* 04FE38 8004F238 8739D2B8 */ lh $t9, %lo(D_8018D2B8)($t9) /* 04FE3C 8004F23C 00095403 */ sra $t2, $t1, 0x10 /* 04FE40 8004F240 030A2021 */ addu $a0, $t8, $t2 -/* 04FE44 8004F244 3C188019 */ lui $t8, %hi(D_8018D2E8) # $t8, 0x8019 +/* 04FE44 8004F244 3C188019 */ lui $t8, %hi(gMiniMapY) # $t8, 0x8019 /* 04FE48 8004F248 01AE7821 */ addu $t7, $t5, $t6 -/* 04FE4C 8004F24C 8718D2E8 */ lh $t8, %lo(D_8018D2E8)($t8) +/* 04FE4C 8004F24C 8718D2E8 */ lh $t8, %lo(gMiniMapY)($t8) /* 04FE50 8004F250 440E5000 */ mfc1 $t6, $f10 /* 04FE54 8004F254 00046400 */ sll $t4, $a0, 0x10 /* 04FE58 8004F258 000C5C03 */ sra $t3, $t4, 0x10 diff --git a/ctx_includes.c b/ctx_includes.c deleted file mode 100644 index 22815c0f35..0000000000 --- a/ctx_includes.c +++ /dev/null @@ -1,122 +0,0 @@ -#include "courses/all_course_data.h" -#include "courses/all_course_packed.h" -#include "include/actor_types.h" -#include "include/bomb_kart.h" -#include "include/common_structs.h" -#include "include/config.h" -#include "include/course_offsets.h" -#include "include/decode.h" -#include "include/defines.h" -#include "include/kart_attributes.h" -#include "include/libc/math.h" -#include "include/libc/stdarg.h" -#include "include/libc/stddef.h" -#include "include/libc/stdio.h" -#include "include/libc/stdlib.h" -#include "include/libc/string.h" -#include "include/macros.h" -#include "include/objects.h" -#include "include/PR/abi.h" -#include "include/PR/gbi.h" -#include "include/PR/gs2dex.h" -#include "include/PR/gu.h" -#include "include/PR/libaudio.h" -#include "include/PR/libultra.h" -#include "include/PR/mbi.h" -#include "include/PR/os.h" -#include "include/PR/os_ai.h" -#include "include/PR/os_cache.h" -#include "include/PR/os_cont.h" -#include "include/PR/os_eeprom.h" -#include "include/PR/os_exception.h" -#include "include/PR/os_internal.h" -#include "include/PR/os_libc.h" -#include "include/PR/os_message.h" -#include "include/PR/os_misc.h" -#include "include/PR/os_pi.h" -#include "include/PR/os_rdp.h" -#include "include/PR/os_thread.h" -#include "include/PR/os_time.h" -#include "include/PR/os_tlb.h" -#include "include/PR/os_vi.h" -#include "include/PR/R4300.h" -#include "include/PR/rcp.h" -#include "include/PR/sptask.h" -#include "include/PR/ucode.h" -#include "include/PR/ultratypes.h" -#include "include/save_data.h" -#include "include/segments.h" -#include "include/sounds.h" -#include "include/types.h" -#include "include/ultra64.h" -#include "include/vehicles.h" -#include "include/waypoints.h" -#include "src/audio/data.h" -#include "src/audio/effects.h" -#include "src/audio/external.h" -#include "src/audio/heap.h" -#include "src/audio/internal.h" -#include "src/audio/load.h" -#include "src/audio/playback.h" -#include "src/audio/port_eu.h" -#include "src/audio/seqplayer.h" -#include "src/audio/synthesis.h" -#include "src/buffers.h" -#include "src/camera.h" -#include "src/camera_junk.h" -#include "src/code_800029B0.h" -#include "src/animation.h" -#include "src/code_80005FD0.h" -#include "src/code_8003DC40.h" -#include "src/code_80057C60.h" -#include "src/code_8006E9C0.h" -#include "src/update_objects.h" -#include "src/code_80086E70.h" -#include "src/code_80091440.h" -#include "src/code_80091750.h" -#include "src/code_800AF9B0.h" -#include -#include -#include -#include "src/data/some_data.h" -#include "src/data/path_spawn_metadata.h" -#include "src/buffers/trig_tables.h" -#include "src/data_segment2.h" -#include "src/effects.h" -#include "src/ending/ceremony_and_credits.h" -#include "src/ending/code_80280000.h" -#include "src/ending/code_80281780.h" -#include "src/ending/code_80281C40.h" -#include "src/ending/credits.h" -#include "src/ending/podium_ceremony_actors.h" -#include "src/render_objects.h" -#include "src/kart_dma.h" -#include "src/main.h" -#include "src/math_util_2.h" -#include "src/menus.h" -#include "src/os/bstring.h" -#include "src/os/controller.h" -#include "src/os/hardware.h" -#include "src/os/libaudio_internal.h" -#include "src/os/libultra_internal.h" -#include "src/os/new_func.h" -#include "src/os/osAi.h" -#include "src/os/osContInternal.h" -#include "src/os/osint.h" -#include "src/os/piint.h" -#include "src/os/printf.h" -#include "src/player_controller.h" -#include "src/profiler.h" -#include "src/racing/actors.h" -#include "src/racing/actors_extended.h" -#include "src/racing/collision.h" -#include "src/racing/math_util.h" -#include "src/racing/memory.h" -#include "src/racing/race_logic.h" -#include "src/racing/render_courses.h" -#include "src/racing/skybox_and_splitscreen.h" -#include "src/render_player.h" -#include "src/save.h" -#include "src/spawn_players.h" -#include "src/staff_ghosts.h" -#include "src/textures.h" diff --git a/enhancements/flycam.patch b/enhancements/flycam.patch index b1cbd91f87..851e1a121d 100644 --- a/enhancements/flycam.patch +++ b/enhancements/flycam.patch @@ -435,7 +435,7 @@ index c2a84aa..338e2bd 100644 temp_v1 = ((temp_v1 - 1) * 4) + var_a3; + if (isFlycam) { -+ func_8029569C(); ++ render_course_credits(); + return; + } + diff --git a/include/bomb_kart.h b/include/bomb_kart.h index 0ae47f3091..31550bbf64 100644 --- a/include/bomb_kart.h +++ b/include/bomb_kart.h @@ -3,6 +3,7 @@ #include #include +#include #define NUM_BOMB_KARTS_MAX 7 #define NUM_BOMB_KARTS_VERSUS 7 diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000000..85d1a89eb9 --- /dev/null +++ b/include/config.h @@ -0,0 +1,11 @@ +#ifndef CONFIG_H +#define CONFIG_H + +/** + * @brief Use a custom course engine + * Use a custom course engine instead of the default one who use switch. see course.h and everywhere + * ENABLE_CUSTOM_COURSE_ENGINE are use to define your + * + */ +#define ENABLE_CUSTOM_COURSE_ENGINE 0 +#endif diff --git a/include/course.h b/include/course.h index 2e78a3f3d4..ff99e59333 100644 --- a/include/course.h +++ b/include/course.h @@ -4,6 +4,7 @@ #include #include #include +#include "waypoints.h" /** * @file Include for course gfx.inc.c. @@ -16,4 +17,119 @@ typedef struct { u16 flags; } TrackSections; +struct _struct_gCoursePathSizes_0x10 { + /* 0x00 */ u16 unk0; + /* 0x02 */ u16 unk2; + /* 0x04 */ u16 unk4; + /* 0x06 */ u16 unk6; + /* 0x08 */ u16 unk8; + /* 0x0A */ char padA[6]; +}; // size 0x10 + +#if !ENABLE_CUSTOM_COURSE_ENGINE +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; + +#else + +#define COURSE_MARIO_RACEWAY +#define COURSE_CHOCO_MOUNTAIN +#define COURSE_BOWSER_CASTLE +#define COURSE_BANSHEE_BOARDWALK +#define COURSE_YOSHI_VALLEY +#define COURSE_FRAPPE_SNOWLAND +#define COURSE_KOOPA_BEACH +#define COURSE_ROYAL_RACEWAY +#define COURSE_LUIGI_RACEWAY +#define COURSE_MOO_MOO_FARM +#define COURSE_TOADS_TURNPIKE +#define COURSE_KALAMARI_DESERT +#define COURSE_SHERBET_LAND +#define COURSE_RAINBOW_ROAD +#define COURSE_WARIO_STADIUM +#define COURSE_BLOCK_FORT +#define COURSE_SKYSCRAPER +#define COURSE_DOUBLE_DECK +#define COURSE_DK_JUNGLE +#define COURSE_BIG_DONUT +#define COURSE_AWARD_CEREMONY +#define NUM_COURSES + +#endif + +#if !ENABLE_CUSTOM_COURSE_ENGINE +extern s16 gCurrentCourseId; +extern s16* D_800DCBB4[]; +#define GET_COURSE_800DCBB4(n) D_800DCBB4[gCurrentCourseId][n] +extern f32 gKartAICourseMaximumSeparation[]; +#define GET_COURSE_AIMaximumSeparation gKartAICourseMaximumSeparation[gCurrentCourseId] +extern struct _struct_gCoursePathSizes_0x10 gCoursePathSizes[]; +#define GET_COURSE_PathSizes gCoursePathSizes[gCurrentCourseId] +extern s16 gKartAISteeringSensitivity[]; +#define GET_COURSE_AISteeringSensitivity gKartAISteeringSensitivity[gCurrentCourseId] +extern f32 gKartAICourseMinimumSeparation[]; +#define GET_COURSE_AIMinimumSeparation gKartAICourseMinimumSeparation[gCurrentCourseId] +extern TrackWaypoint* gCoursePathTable[][4]; +#define GET_COURSE_PathTable(p) segmented_to_virtual_dupe_2(gCoursePathTable[gCurrentCourseId][p]) +extern TrackWaypoint* gCoursePathTable2[][4]; +#define GET_COURSE_PathTable2(p) segmented_to_virtual_dupe_2(gCoursePathTable2[gCurrentCourseId][p]) +extern KartAIBehaviour* gKartAIBehaviourLUT[]; +#define GET_COURSE_AIBehaviour segmented_to_virtual_dupe_2(gKartAIBehaviourLUT[i]) +extern char* gCourseNames[]; +#define GET_COURSE_Name gCourseNames[gCurrentCourseId] +extern char* gCourseNamesDup[]; +#define GET_COURSE_NameDup gCourseNamesDup[gCupCourseOrder[gCupSelection][gCourseIndexInCup]] +extern char* gDebugCourseNames[]; +#define GET_COURSE_debugName gDebugCourseNames[gCurrentCourseId] +extern f32 gCourseFarPersp; +#define gCourseFarPersp gCourseFarPersp +extern f32 gCourseNearPersp; +#define gCourseNearPersp gCourseNearPersp +#define GET_COURSE_D_0D0096B8(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D0096B8[gCurrentCourseId][cc]) +#define GET_COURSE_D_0D009808(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009808[gCurrentCourseId][cc]) +#define GET_COURSE_D_0D009418(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009418[gCurrentCourseId][cc]) +#define GET_COURSE_D_0D009568(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009568[gCurrentCourseId][cc]) +#else +#define gCurrentCourseId +#define GET_COURSE_800DCBB4(n) +#define GET_COURSE_AIMaximumSeparation +#define GET_COURSE_PathSizes +#define GET_COURSE_AISteeringSensitivity +#define GET_COURSE_AIMinimumSeparation +#define GET_COURSE_PathTable(p) +#define GET_COURSE_PathTable2(p) +#define GET_COURSE_AIBehaviour +#define GET_COURSE_Name +#define GET_COURSE_NameDup +#define GET_COURSE_debugName +#define gCourseFarPersp +#define gCourseNearPersp +#define GET_COURSE_D_0D0096B8(cc) +#define GET_COURSE_D_0D009808(cc) +#define GET_COURSE_D_0D009418(cc) +#define GET_COURSE_D_0D009568(cc) +#endif + #endif // COURSE_H diff --git a/include/mk64.h b/include/mk64.h index ab9bd7cb9a..a034e20559 100644 --- a/include/mk64.h +++ b/include/mk64.h @@ -6,6 +6,8 @@ * Global header for mk64 */ +#include + /*======================= Configuration =======================*/ @@ -23,31 +25,6 @@ // 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 { diff --git a/include/objects.h b/include/objects.h index 7e83202246..9768adc8dd 100644 --- a/include/objects.h +++ b/include/objects.h @@ -182,7 +182,7 @@ extern s16 D_80165750; /** * These seem to be limits on different object types in Moo Moo Farm - * See init_course_object in code_8006E9C0.c + * See init_course_objects in code_8006E9C0.c * Maybe max number of active moles in a given group of moles? */ extern s32 D_8018D1C8; diff --git a/models/README.MD b/models/README.MD index 6e36b13129..e35be73e14 100644 --- a/models/README.MD +++ b/models/README.MD @@ -9,4 +9,4 @@ run `make model_extract -j` to extract assets in multithreaded. And waits (for m you can run `make fast64_blender` to run blender with fast64 enable without downloading it. ## Organisation -In Tracks there is all track json and folder (once extracted). In each track folder you can find three folder objects, sections, preview, collision_sections. Objects are all assets who are use for object/actor. Sections are all sections reference in a Gfx list who are use with render_course_segments. And preview are the version of the track who are use in func_8029569C who the complete track or a big part (some are broken). Collision sections are just collision who are use in mk64. \ No newline at end of file +In Tracks there is all track json and folder (once extracted). In each track folder you can find three folder objects, sections, preview, collision_sections. Objects are all assets who are use for object/actor. Sections are all sections reference in a Gfx list who are use with render_course_segments. And preview are the version of the track who are use in render_course_credits who the complete track or a big part (some are broken). Collision sections are just collision who are use in mk64. \ No newline at end of file diff --git a/src/audio/external.c b/src/audio/external.c index 8dbe5caf00..788f214b47 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -1,7 +1,9 @@ #include #include -#include #include +#include +#include + #include "camera.h" #include "math_util_2.h" #include diff --git a/src/camera.c b/src/camera.c index 61ba320f58..8cc8b8e45d 100644 --- a/src/camera.c +++ b/src/camera.c @@ -17,6 +17,8 @@ #include "main.h" #include "spawn_players.h" +#include + f32 D_800DDB30[] = { 0.4f, 0.6f, 0.275f, 0.3f }; Camera cameras[4]; diff --git a/src/code_800029B0.c b/src/code_800029B0.c index 53072f0f1b..34ca227dfb 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -26,7 +26,9 @@ extern s32 D_802BA038; extern s16 D_802BA048; +#if !ENABLE_CUSTOM_COURSE_ENGINE s16 gCurrentCourseId = 0; +#endif s16 gCurrentlyLoadedCourseId = 0xFF; u16 D_800DC5A8 = 0; s32 D_800DC5AC = 0; @@ -193,7 +195,7 @@ void setup_race(void) { gCurrentlyLoadedCourseId = gCurrentCourseId; gNextFreeMemoryAddress = gFreeMemoryResetAnchor; load_course(gCurrentCourseId); - func_80295D88(); + course_generate_collision_mesh(); D_8015F730 = gNextFreeMemoryAddress; } else { gNextFreeMemoryAddress = D_8015F730; @@ -209,7 +211,7 @@ void setup_race(void) { D_802BA038 = -1; D_802BA048 = 0; func_802A74BC(); - func_802A4D18(); + set_perspective_and_aspect_ratio(); func_80091FA4(); init_actors_and_load_textures(); @@ -241,7 +243,9 @@ void setup_race(void) { } } +// sound related void func_80002DAC(void) { +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: vec3f_set(D_8015F748, -223.0f, 94.0f, -155.0f); @@ -276,6 +280,9 @@ void func_80002DAC(void) { default: break; } +#else + +#endif } /** @@ -302,6 +309,7 @@ void func_80003040(void) { gPlayerCountSelection1 = 1; set_segment_base_addr(0x3, (void*) (gNextFreeMemoryAddress + 0xFFFF7000)); destroy_all_actors(); +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: dma_textures(gTextureTrees1, 0x35B, 0x800); @@ -380,5 +388,8 @@ void func_80003040(void) { default: break; } +#else + +#endif gNumPermanentActors = gNumActors; } diff --git a/src/code_800029B0.h b/src/code_800029B0.h index e5614c9f3f..0b7335383a 100644 --- a/src/code_800029B0.h +++ b/src/code_800029B0.h @@ -34,7 +34,6 @@ void func_80002DAC(void); void clear_nmi_buffer(void); void func_80003040(void); -extern s16 gCurrentCourseId; // D_800DC5A0 extern s16 gCurrentlyLoadedCourseId; extern u16 D_800DC5A8; extern s32 D_800DC5AC; diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 5e22b168c6..648a079f6e 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -1126,7 +1126,7 @@ void func_80008424(s32 playerId, f32 arg1, Player* player) { } if (var_a1 != 1) { if (var_f2 < arg1) { - if ((gDemoMode == 1) && (gCurrentCourseId != 0x0014)) { + if ((gDemoMode == 1) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) { player_speed(player); } else if (D_80163330[playerId] == 1) { func_80007D04(playerId, player); @@ -1212,7 +1212,7 @@ s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) { return true; } arg1_times_8 = arg1 * 8; - temp_a3 = &D_800DCBB4[gCurrentCourseId][arg1_times_8]; + temp_a3 = &GET_COURSE_800DCBB4(arg1_times_8); if (arg2 == 0) { if (gDemoMode == 1) { temp_a2 = D_80164450[playerId] - D_80164450[D_80164378[7]]; @@ -1434,15 +1434,15 @@ void func_8000929C(s32 playerId, Player* player) { D_801630E2 = 1; func_80008F38(playerId); } - if (gCurrentCourseId == 0x0014) { + if (gCurrentCourseId == COURSE_AWARD_CEREMONY) { func_8000B95C(playerId, sSomeNearestWaypoint, D_80163448); return; } if ((sSomeNearestWaypoint < 0x14) || ((gWaypointCountByPathIndex[D_80163448] - 0x14) < sSomeNearestWaypoint) || - (gCurrentCourseId == 0x000B)) { + (gCurrentCourseId == COURSE_KALAMARI_DESERT)) { var_v1 = 0; var_t0 = 0; - if (gCurrentCourseId == 0x000B) { + if (gCurrentCourseId == COURSE_KALAMARI_DESERT) { D_801634EC = 0; if (player->effects & 0x200) { D_801634EC = 1; @@ -1538,7 +1538,7 @@ void update_vehicles(void) { func_8000DF8C(i); } } - +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_KALAMARI_DESERT: update_vehicle_trains(); @@ -1553,6 +1553,9 @@ void update_vehicles(void) { update_vehicle_cars(); break; } +#else + +#endif } } @@ -1646,7 +1649,7 @@ void func_80009B60(s32 playerId) { f32 athing = 1.5f; player = &gPlayers[playerId]; - if ((s32) gKartAICourseMaximumSeparation[gCurrentCourseId] >= 0) { + if ((s32) GET_COURSE_AIMaximumSeparation >= 0) { D_80163100[playerId] += 1; if (playerId == 0) { D_80163378++; @@ -1720,11 +1723,11 @@ void func_80009B60(s32 playerId) { break; } D_801631E0[playerId] = 0; - if ((player->effects & 0x1000) && (gCurrentCourseId != 0x0014)) { + if ((player->effects & 0x1000) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) { D_801631E0[playerId] = 1; } - if ((D_801646CC == 1) || (player->type & 0x800) || (gCurrentCourseId == 0x0014)) { - if (gCurrentCourseId != 0x000A) { + if ((D_801646CC == 1) || (player->type & 0x800) || (gCurrentCourseId == COURSE_AWARD_CEREMONY)) { + if (gCurrentCourseId != COURSE_TOADS_TURNPIKE) { D_801634F8[playerId].unk4 = 0.0f; } D_801634F8[playerId].unkC = 0.0f; @@ -1743,13 +1746,13 @@ void func_80009B60(s32 playerId) { } D_801631F8[playerId] = D_801631E0[playerId]; switch (gCurrentCourseId) { - case 4: - case 0x0014: + case COURSE_YOSHI_VALLEY: + case COURSE_AWARD_CEREMONY: D_801634F8[playerId].unk4 = 0.0f; break; default: break; - case 10: + case COURSE_SKYSCRAPER: func_8001490C(playerId); func_80014A60(playerId); func_80014BB4(playerId); @@ -1768,15 +1771,12 @@ void func_80009B60(s32 playerId) { (D_8016334C[playerId] < gGPCurrentRaceRankByPlayerId[playerId])) { D_80163210[playerId] = 8.333333f; } else if (D_80162FD0 == (s16) 1U) { - D_80163210[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D0096B8[gCurrentCourseId][gCCSelection]); + D_80163210[playerId] = GET_COURSE_D_0D0096B8(gCCSelection); D_801634F8[playerId].unk4 = -0.5f; } else if (D_801645E0[sSomeNearestWaypoint] > 0) { - D_80163210[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D009418[gCurrentCourseId][gCCSelection]); + D_80163210[playerId] = GET_COURSE_D_0D009418(gCCSelection); } else { - D_80163210[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D009568[gCurrentCourseId][gCCSelection]); + D_80163210[playerId] = GET_COURSE_D_0D009568(gCCSelection); } check_ai_crossing_distance(playerId); func_8000D3B8(playerId); @@ -1858,10 +1858,10 @@ void func_80009B60(s32 playerId) { } D_801630B8[playerId] = func_8000B7E4(playerId, sSomeNearestWaypoint); func_8000D438(playerId, sSomeNearestWaypoint); - if (gCurrentCourseId != 0x0014) { + if (gCurrentCourseId != COURSE_AWARD_CEREMONY) { if (D_80164450[playerId] < 0xB) { stackPadding1A = D_801630E0; - if ((D_80164450[playerId] > 0) && (gCurrentCourseId == 0x000A)) { + if ((D_80164450[playerId] > 0) && (gCurrentCourseId == COURSE_TOADS_TURNPIKE)) { stackPadding1A += 0x14; stackPadding1A %= D_80164430; func_8000BBD8(stackPadding1A, 0.0f, 0); @@ -1895,7 +1895,7 @@ void func_80009B60(s32 playerId) { } } } - if (gCurrentCourseId == 0x0014) { + if (gCurrentCourseId == COURSE_AWARD_CEREMONY) { switch (D_80163410[playerId]) { /* switch 3; irregular */ case 3: /* switch 3 */ D_80162FA0[0] = D_80163418[playerId]; @@ -1928,7 +1928,7 @@ void func_80009B60(s32 playerId) { if (var_a2 < (s16) temp_f6) { var_a2 = temp_f6; } - var_v1 = gKartAISteeringSensitivity[gCurrentCourseId]; + var_v1 = GET_COURSE_AISteeringSensitivity; switch (D_801631D8[playerId]) { /* switch 4; irregular */ case 2: /* switch 4 */ if (D_80163068[playerId] > (0.5f * 1.0f)) { @@ -1973,19 +1973,15 @@ void func_80009B60(s32 playerId) { D_80163050[playerId] = var_a1; if ((D_801630B8[playerId] == 1) || (D_801630E8[playerId] == 1) || (D_801630E8[playerId] == -1) || (player->effects & 0x1000000C)) { - D_80163028[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D009418[gCurrentCourseId][gCCSelection]); + D_80163028[playerId] = GET_COURSE_D_0D009418(gCCSelection); } else { - D_80163028[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D009568[gCurrentCourseId][gCCSelection]); + D_80163028[playerId] = GET_COURSE_D_0D009568(gCCSelection); } if ((D_80163068[playerId] > 0.9f) || (D_80163068[playerId] < -0.9f)) { - D_80163028[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D009808[gCurrentCourseId][gCCSelection]); + D_80163028[playerId] = GET_COURSE_D_0D009808(gCCSelection); } if (D_80162FD0 == 1) { - D_80163028[playerId] = - *(f32*) segmented_to_virtual_dupe_2(&D_0D0096B8[gCurrentCourseId][gCCSelection]); + D_80163028[playerId] = GET_COURSE_D_0D0096B8(gCCSelection); } if ((D_801630E8[playerId] == 2) || (D_801630E8[playerId] == -2) || (D_801630E8[playerId] == 3)) { D_80163028[playerId] = 3.3333333f; @@ -2169,7 +2165,7 @@ f32 func_8000B874(f32 posX, f32 posZ, u16 waypointIndex, s32 pathIndex) { void func_8000B95C(s32 playerId, u16 waypointIndex, s32 pathIndex) { UNUSED Vec3f pad; D_80163068[playerId] = 0.0f; - if ((s32) gKartAICourseMaximumSeparation[gCurrentCourseId] >= 0) { + if ((s32) GET_COURSE_AIMaximumSeparation >= 0) { if ((gPlayers[playerId].type & 0x8000) != 0) { D_80163068[playerId] = func_8000B874(gPlayers[playerId].pos[0], gPlayers[playerId].pos[2], waypointIndex, pathIndex); @@ -2936,7 +2932,7 @@ void set_bomb_kart_spawn_positions(void) { case COURSE_YOSHI_VALLEY: startingXPos = bombKartSpawn->startingXPos; startingZPos = bombKartSpawn->startingZPos; - startingYPos = spawn_actor_on_surface(startingXPos, 2000.0f, startingZPos); + startingYPos = get_surface_height(startingXPos, 2000.0f, startingZPos); break; case COURSE_AWARD_CEREMONY: temp_v0 = &D_80164550[3][bombKartSpawn->waypointIndex]; @@ -3420,7 +3416,7 @@ void func_8000F2BC(TrackWaypoint* arg0, size_t size) { // Appears to allocate memory for each course. void func_8000F2DC(void) { - struct _struct_gCoursePathSizes_0x10* ptr = &gCoursePathSizes[gCurrentCourseId]; + struct _struct_gCoursePathSizes_0x10* ptr = &GET_COURSE_PathSizes; s32 temp; s32 i; @@ -3471,6 +3467,7 @@ void func_8000F2DC(void) { } D_80164430 = *gWaypointCountByPathIndex; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_KALAMARI_DESERT: generate_train_waypoints(); @@ -3487,6 +3484,9 @@ void func_8000F2DC(void) { init_vehicles_cars(); break; } +#else + +#endif set_bomb_kart_spawn_positions(); func_8000EEDC(); } @@ -3509,7 +3509,7 @@ void func_8000F628(void) { if (gCurrentCourseId < (NUM_COURSES - 1)) { func_8000B95C(i, 0, 0); } - D_80163028[i] = *(f32*) segmented_to_virtual_dupe_2(&D_0D009418[gCurrentCourseId][gCCSelection]); + D_80163028[i] = GET_COURSE_D_0D009418(gCCSelection); D_801630E8[i] = 0; D_80163100[i] = 0; D_80163178[i] = 0.0f; @@ -3541,7 +3541,7 @@ void func_8000F628(void) { D_80163068[i] = 0.0f; D_80163090[i] = 0.0f; var_s5 = &D_801634F8[i]; - var_s5->unkC = gKartAICourseMinimumSeparation[gCurrentCourseId] * (f32) (((i + 1) % 3) - 1); + var_s5->unkC = GET_COURSE_AIMinimumSeparation * (f32) (((i + 1) % 3) - 1); var_s5->unk4 = var_s5->unkC; var_s5->unk0 = 0.0f; var_s5->unk8 = 0.015f; @@ -3672,17 +3672,16 @@ void func_800100F0(s32 pathIndex) { s32 i; // cast required - if ((s32) gKartAICourseMaximumSeparation[gCurrentCourseId] >= 0) { + if ((s32) GET_COURSE_AIMaximumSeparation >= 0) { pathDest = D_80164550[pathIndex]; bInvalidPath = 1; if (gCurrentCourseId != COURSE_AWARD_CEREMONY) { - var_v0 = process_path_data(pathDest, - segmented_to_virtual_dupe_2(gCoursePathTable2[gCurrentCourseId][pathIndex])); + var_v0 = process_path_data(pathDest, GET_COURSE_PathTable2(pathIndex)); gWaypointCountByPathIndex[pathIndex] = (u16) var_v0; } else { // Course path included in course_data which has already been loaded into memory. // This is how we get the addr to our path data. - path = segmented_to_virtual_dupe_2(gCoursePathTable[gCurrentCourseId][pathIndex]); + path = GET_COURSE_PathTable(pathIndex); ptr = path; for (i = 0; i < 3000; i++, ptr++) { @@ -3724,8 +3723,8 @@ void func_80010218(s32 pathIndex) { TrackWaypoint* var_s1; TrackWaypoint* var_s2; - if (((s32) gKartAICourseMaximumSeparation[gCurrentCourseId]) >= 0) { - waypointWidth = gKartAICourseMaximumSeparation[gCurrentCourseId]; + if (((s32) GET_COURSE_AIMaximumSeparation) >= 0) { + waypointWidth = GET_COURSE_AIMaximumSeparation; waypoint = &D_80164550[pathIndex][0]; var_s1 = &D_80164560[pathIndex][0]; var_s2 = &D_80164570[pathIndex][0]; @@ -3775,7 +3774,7 @@ f32 func_80010480(s32 pathIndex, u16 waypointIndex) { f32 root2; f32 root1; - if ((s32) gKartAICourseMaximumSeparation[gCurrentCourseId] < 0) { + if ((s32) GET_COURSE_AIMaximumSeparation < 0) { return 0.0f; } waypointCount = gWaypointCountByPathIndex[pathIndex]; @@ -3817,7 +3816,7 @@ void func_800107C4(s32 pathIndex) { s32 var_a3; s16* wut; - if ((s32) gKartAICourseMaximumSeparation[gCurrentCourseId] >= 0) { + if ((s32) GET_COURSE_AIMaximumSeparation >= 0) { var_a3 = gWaypointCountByPathIndex[pathIndex]; var_t4 = &D_80164580[pathIndex][0]; for (var_s0 = 0; var_s0 < var_a3; var_s0++, var_t4++) { @@ -3885,7 +3884,7 @@ void func_80010DBC(s32 pathIndex) { s32 waypointIndex; u16* angle; - if ((s32) gKartAICourseMaximumSeparation[gCurrentCourseId] >= 0) { + if ((s32) GET_COURSE_AIMaximumSeparation >= 0) { for (angle = (u16*) &D_80164590[pathIndex][0], waypointIndex = 0; waypointIndex < gWaypointCountByPathIndex[pathIndex]; waypointIndex++, angle++) { *angle = func_80010CB0(pathIndex, waypointIndex); @@ -3924,13 +3923,13 @@ void func_80010E6C(s32 pathIndex) { } f32 func_80010F40(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3, UNUSED s32 arg4) { - arg1 = spawn_actor_on_surface(arg0, 2000.0f, arg2); + arg1 = get_surface_height(arg0, 2000.0f, arg2); check_bounding_collision(&D_80162E70, 1.0f, arg0, arg1, arg2); return arg1; } f32 func_80010FA0(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3, UNUSED s32 arg4) { - arg1 = spawn_actor_on_surface(arg0, (f32) ((f64) arg1 + 30.0), arg2); + arg1 = get_surface_height(arg0, (f32) ((f64) arg1 + 30.0), arg2); check_bounding_collision(&D_80162E70, 10.0f, arg0, arg1, arg2); return arg1; } @@ -4018,12 +4017,12 @@ s32 func_80011014(TrackWaypoint* pathDest, TrackWaypoint* path, s32 numPathPoint } else { switch (gCurrentCourseId) { - case 13: + case COURSE_RAINBOW_ROAD: if (var_f20_2 < (var_f28 - 15.0)) { var_f20_2 = (f32) var_f28 - 15.0; } break; - case 14: + case COURSE_WARIO_STADIUM: if ((var_s0 >= 1140) && (var_s0 <= 1152)) { var_f20_2 = var_f28; } else { @@ -4032,7 +4031,7 @@ s32 func_80011014(TrackWaypoint* pathDest, TrackWaypoint* path, s32 numPathPoint } } break; - case 18: + case COURSE_DK_JUNGLE: if ((var_s0 > 204) && (var_s0 < 220)) { var_f20_2 = var_f28; } else { @@ -4169,7 +4168,7 @@ s32 generate_2d_path(Path2D* pathDest, TrackWaypoint* pathSrc, s32 numWaypoints) void copy_courses_kart_ai_behaviour(void) { s32 i; for (i = 0; i < NUM_COURSES - 1; i++) { - gCoursesKartAIBehaviour[i] = segmented_to_virtual_dupe_2(gKartAIBehaviourLUT[i]); + gCoursesKartAIBehaviour[i] = GET_COURSE_AIBehaviour; } } @@ -4354,7 +4353,7 @@ void generate_train_waypoints(void) { temp = gVehicle2DWaypoint; gVehicle2DWaypointLength = generate_2d_path(temp, waypoint, i - 1); - D_80162EB0 = spawn_actor_on_surface(temp[0].x, 2000.0f, temp[0].z); + D_80162EB0 = get_surface_height(temp[0].x, 2000.0f, temp[0].z); } void generate_ferry_waypoints(void) { @@ -4413,6 +4412,7 @@ void spawn_course_vehicles(void) { f32 origXPos; f32 origZPos; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_KALAMARI_DESERT: for (loopIndex = 0; loopIndex < NUM_TRAINS; loopIndex++) { @@ -4504,6 +4504,9 @@ void spawn_course_vehicles(void) { } break; } +#else + +#endif } void set_vehicle_pos_waypoint(TrainCarStuff* trainCar, Path2D* posXZ, u16 waypoint) { @@ -5645,7 +5648,7 @@ void func_80015544(s32 playerId, f32 arg1, s32 cameraId, s32 pathIndex) { temp_f2 = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; - temp_f12 = spawn_actor_on_surface(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); + temp_f12 = get_surface_height(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); if ((temp_f12 < (temp_f2 - 20.0)) || (temp_f12 >= 3000.0)) { D_80164618[cameraId] = (f32) (temp_f2 + 10.0); } else { @@ -5801,7 +5804,7 @@ void func_80015C94(Camera* camera, UNUSED Player* unusedPlayer, UNUSED s32 arg2, } camera->pos[0] = midX; camera->pos[2] = midZ; - temp_f2_2 = spawn_actor_on_surface(midX, (midY + 30.0), midZ); + temp_f2_2 = get_surface_height(midX, (midY + 30.0), midZ); if ((temp_f2_2 < (midY - 20.0)) || (temp_f2_2 >= 3000.0)) { camera->pos[1] = midY + 10.0; } else { @@ -5929,7 +5932,7 @@ void func_80016494(Camera* camera, UNUSED Player* unusedPlayer, UNUSED s32 arg2, } camera->pos[0] = midX; camera->pos[2] = midZ; - temp_f2_5 = spawn_actor_on_surface(midX, midY + 30.0, midZ); + temp_f2_5 = get_surface_height(midX, midY + 30.0, midZ); if ((temp_f2_5 < (midY - 20.0)) || (temp_f2_5 >= 3000.0)) { camera->pos[1] = midY + 10.0; } else { @@ -5969,7 +5972,7 @@ void func_80016C3C(UNUSED s32 playerId, UNUSED f32 arg1, s32 cameraId) { D_80164688[cameraId] = -0.1f; } D_80163DD8[cameraId] = 0; - if (gCurrentCourseId == 4) { + if (gCurrentCourseId == COURSE_YOSHI_VALLEY) { D_80163DD8[cameraId] = random_int(4U); D_80164688[cameraId] = 0.0f; } @@ -6046,7 +6049,7 @@ void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32 sp56 = gNearestWaypointByCameraId[cameraId]; gNearestWaypointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestWaypointByCameraId[cameraId], pathIndex); - if (gCurrentCourseId == 4) { + if (gCurrentCourseId == COURSE_YOSHI_VALLEY) { if ((sp56 != gNearestWaypointByCameraId[cameraId]) && (gNearestWaypointByCameraId[cameraId] == 1)) { pathIndex = (D_80163DD8[cameraId] = random_int(4U)); gNearestWaypointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], @@ -6459,7 +6462,7 @@ void func_800188F4(Camera* camera, UNUSED Player* unusePlayer, UNUSED s32 arg2, } camera->pos[0] = midX; camera->pos[2] = midZ; - temp_f2_4 = spawn_actor_on_surface(midX, midY + 30.0, midZ); + temp_f2_4 = get_surface_height(midX, midY + 30.0, midZ); if ((temp_f2_4 < (midY - 20.0)) || (temp_f2_4 >= 3000.0)) { camera->pos[1] = midY + 10.0; } else { @@ -6495,7 +6498,7 @@ void func_80019118(s32 playerId, f32 arg1, s32 cameraId, UNUSED s16 pathIndex) { D_80164638[cameraId] = D_80162FA0[2]; temp_f2 = (f32) D_80164550[0][gNearestWaypointByCameraId[cameraId]].posY; - temp_f12 = spawn_actor_on_surface(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); + temp_f12 = get_surface_height(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); if ((temp_f12 < (temp_f2 - 20.0)) || (temp_f12 >= 3000.0)) { D_80164618[cameraId] = (f32) (temp_f2 + 10.0); @@ -6722,7 +6725,7 @@ void func_80019D2C(Camera* camera, Player* player, s32 arg2) { s32 nearestWaypoint; playerId = camera->playerId; - if ((D_80163378 != 0) && (gCurrentCourseId == 8)) { + if ((D_80163378 != 0) && (gCurrentCourseId == COURSE_LUIGI_RACEWAY)) { calculate_camera_up_vector(camera, arg2); nearestWaypoint = gNearestWaypointByPlayerId[playerId]; if (((nearestWaypoint >= 0x65) && (nearestWaypoint < 0xFA)) || @@ -7217,9 +7220,9 @@ void kart_ai_use_item_strategy(s32 playerId) { banana->velocity[1] = 0.0f; banana->velocity[2] = 0.0f; if (D_801631E0[playerId] == ((u16) 1)) { - banana->pos[1] = spawn_actor_on_surface(player->pos[0], (f32) (((f64) player->pos[1]) + 30.0), - player->pos[2]) + - (banana->boundingBoxSize + 1.0f); + banana->pos[1] = + get_surface_height(player->pos[0], (f32) (((f64) player->pos[1]) + 30.0), player->pos[2]) + + (banana->boundingBoxSize + 1.0f); } } player->soundEffects &= ~0x00040000; @@ -7280,7 +7283,7 @@ void kart_ai_use_item_strategy(s32 playerId) { banana->velocity[1] = 0.0f; banana->velocity[2] = 0.0f; banana->pos[1] = - spawn_actor_on_surface(banana->pos[0], (f32) (((f64) banana->pos[1]) + 30.0), banana->pos[2]) + + get_surface_height(banana->pos[0], (f32) (((f64) banana->pos[1]) + 30.0), banana->pos[2]) + (banana->boundingBoxSize + 1.0f); } player->soundEffects &= ~0x00040000; @@ -7497,9 +7500,9 @@ void kart_ai_use_item_strategy(s32 playerId) { } else { func_802A1064(fakeItemBox); if (D_801631E0[playerId] == 1) { - fakeItemBox->pos[1] = spawn_actor_on_surface(fakeItemBox->pos[0], fakeItemBox->pos[1] + 30.0, - fakeItemBox->pos[2]) + - fakeItemBox->boundingBoxSize; + fakeItemBox->pos[1] = + get_surface_height(fakeItemBox->pos[0], fakeItemBox->pos[1] + 30.0, fakeItemBox->pos[2]) + + fakeItemBox->boundingBoxSize; } } temp_s0->unk_00 = 0; @@ -7636,7 +7639,7 @@ void func_8001BE78(void) { temp_s0 = &D_80164550[i][gNearestWaypointByPlayerId[i]]; temp_s1->pos[0] = (f32) temp_s0->posX; temp_s1->pos[1] = - spawn_actor_on_surface((f32) temp_s0->posX, 2000.0f, (f32) temp_s0->posZ) + temp_s1->boundingBoxSize; + get_surface_height((f32) temp_s0->posX, 2000.0f, (f32) temp_s0->posZ) + temp_s1->boundingBoxSize; temp_s1->pos[2] = (f32) temp_s0->posZ; temp_s1->rotation[1] = (s16) *D_80164590[i]; func_8003680C(temp_s1, 0); diff --git a/src/code_8003DC40.c b/src/code_8003DC40.c index a6e12ee58a..b97838b710 100644 --- a/src/code_8003DC40.c +++ b/src/code_8003DC40.c @@ -1,6 +1,8 @@ #include #include #include +#include + #include "math_util.h" #include #include "player_controller.h" @@ -231,6 +233,7 @@ void func_8003F46C(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4 player->kartHopVelocity = 0.0f; return; } else { +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: func_8003E048(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7); @@ -255,6 +258,9 @@ void func_8003F46C(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4 func_8003E048(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7); break; } +#else + +#endif if (player->effects & 0x10000) { player->unk_DAC = 0.5f; } diff --git a/src/code_8003DC40.h b/src/code_8003DC40.h index 1f402bda67..fdfda53023 100644 --- a/src/code_8003DC40.h +++ b/src/code_8003DC40.h @@ -18,6 +18,4 @@ void func_8003F46C(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); void func_8003F734(Player*, Vec3f, Vec3f, f32*, f32*, f32*, f32*); void func_8003FBAC(Player*, Vec3f, Vec3f, f32*, f32*, f32*, f32*); -extern s16 gCurrentCourseId; - #endif diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 0cf836484b..4a0134e081 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "camera.h" #include "code_80057C60.h" @@ -291,7 +292,7 @@ u8 D_80183FA8[4][0x2000]; */ s32 indexObjectList3[32]; //! Seemingly a pointer to Lakitu texture(s) -u8* D_8018C028; +u8* gLakituTexturePtr; /** * Unused list of object indices */ @@ -348,8 +349,7 @@ s16 D_8018CF18; Player* D_8018CF1C; s16 D_8018CF20; UNUSED s32 D_8018CF24; -Player* D_8018CF28[4]; -UNUSED s32 D_8018CF38[4]; +Player* D_8018CF28[8]; s16 D_8018CF48; s16 D_8018CF50[8]; s16 D_8018CF60; @@ -692,7 +692,7 @@ void render_player_snow_effect_four(void) { } void render_object_for_player(s32 cameraId) { - +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: break; @@ -777,6 +777,9 @@ void render_object_for_player(s32 cameraId) { } break; } +#else + +#endif render_object_smoke_particles(cameraId); render_object_leaf_particle(cameraId); @@ -1039,14 +1042,14 @@ void func_800591B4(void) { if (D_80165800[0] != 0) { func_8004EE54(0); if (gModeSelection != BATTLE) { - func_8004F020(0); + render_mini_map_finish_line(0); } func_8004F3E4(0); } if ((gScreenModeSelection == SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL) && (D_80165800[1] != 0)) { func_8004EE54(1); if (gModeSelection != BATTLE) { - func_8004F020(1); + render_mini_map_finish_line(1); } func_8004F3E4(1); } @@ -1316,16 +1319,16 @@ void func_80059D00(void) { if (!gDemoMode) { func_8007AA44(0); } - func_80078C70(0); + course_update_clouds(0); if (playerHUD[PLAYER_ONE].raceCompleteBool == 0) { func_8005C360((gPlayerOneCopy->unk_094 / 18.0f) * 216.0f); } func_8005D0FC(PLAYER_ONE); } else { func_80059820(PLAYER_ONE); - func_80078C70(1); + course_update_clouds(1); func_80059820(PLAYER_TWO); - func_80078C70(2); + course_update_clouds(2); } update_object(); break; @@ -1337,14 +1340,14 @@ void func_80059D00(void) { if (!gDemoMode) { func_8007AA44(0); } - func_80078C70(1); + course_update_clouds(1); func_8005D1F4(0); func_80059820(PLAYER_TWO); func_8005D0FC(PLAYER_TWO); if (!gDemoMode) { func_8007AA44(1); } - func_80078C70(2); + course_update_clouds(2); func_8005D1F4(1); update_object(); break; @@ -1356,14 +1359,14 @@ void func_80059D00(void) { if (!gDemoMode) { func_8007AA44(0); } - func_80078C70(3); + course_update_clouds(3); func_8005D1F4(0); func_80059820(PLAYER_TWO); func_8005D0FC(PLAYER_TWO); if (!gDemoMode) { func_8007AA44(1); } - func_80078C70(4); + course_update_clouds(4); func_8005D1F4(1); update_object(); break; @@ -1419,7 +1422,7 @@ void func_8005A070(void) { func_80077640(); } else if (gGamestate == CREDITS_SEQUENCE) { func_80059820(PLAYER_ONE); - func_80078C70(0); + course_update_clouds(0); update_object(); } else { func_80059D00(); @@ -1567,6 +1570,7 @@ void func_8005A71C(void) { } void update_object(void) { +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: case COURSE_CHOCO_MOUNTAIN: @@ -1635,6 +1639,10 @@ void update_object(void) { update_ferries_smoke_particle(); break; } +#else + +#endif + if (D_80165730 != 0) { func_80074EE8(); } @@ -2589,7 +2597,8 @@ void func_8005CB60(s32 playerId, s32 lapCount) { case 1: /* switch 1 */ func_80079084(playerId); func_800C9060(playerId, SOUND_ARG_LOAD(0x19, 0x00, 0xF0, 0x15)); - if ((gCurrentCourseId == 8) && (D_80165898 == 0) && (gModeSelection != (s32) 1)) { + if ((gCurrentCourseId == COURSE_LUIGI_RACEWAY) && (D_80165898 == 0) && + (gModeSelection != (s32) 1)) { D_80165898 = 1; } break; @@ -2610,7 +2619,7 @@ void func_8005CB60(s32 playerId, s32 lapCount) { if (D_8018D114 == 2) { D_80165800[playerId] = 0; } - if (gCurrentCourseId == 4) { + if (gCurrentCourseId == COURSE_YOSHI_VALLEY) { playerHUD[playerId].unk_81 = 1; } playerHUD[playerId].lap1CompletionTimeX = 0x0140; @@ -3390,44 +3399,44 @@ void func_8005F90C(Player* player, s16 arg1, s32 arg2, UNUSED s8 arg3, UNUSED s8 ((player->unk_258[10 + arg2].unk_01E > 0) || (player->unk_258[10 + arg2].unk_01C == 0))) { func_8005D794(player, &player->unk_258[10 + arg1], var_f0, var_f2, var_f12, surfaceType, var_t1); func_8005D7D8(&player->unk_258[10 + arg1], 4, 0.46f); - if ((gCurrentCourseId == 1) || (gCurrentCourseId == 7)) { + if ((gCurrentCourseId == COURSE_CHOCO_MOUNTAIN) || (gCurrentCourseId == COURSE_ROYAL_RACEWAY)) { func_8005DAD8(&player->unk_258[10 + arg1], 1, 0, 0x0080); } - if (gCurrentCourseId == 0x000B) { + if (gCurrentCourseId == COURSE_KALAMARI_DESERT) { func_8005DAD8(&player->unk_258[10 + arg1], 7, 0, 0x0080); } - if (gCurrentCourseId == 9) { + if (gCurrentCourseId == COURSE_MOO_MOO_FARM) { func_8005DAD8(&player->unk_258[10 + arg1], 8, 0, 0x0080); } - if (gCurrentCourseId == 0x000E) { + if (gCurrentCourseId == COURSE_WARIO_STADIUM) { func_8005DAD8(&player->unk_258[10 + arg1], 9, 0, 0x0080); } - if (gCurrentCourseId == 4) { + if (gCurrentCourseId == COURSE_YOSHI_VALLEY) { func_8005DAD8(&player->unk_258[10 + arg1], 0x000A, 0, 0x0080); } - if (gCurrentCourseId == 0x0012) { + if (gCurrentCourseId == COURSE_DK_JUNGLE) { func_8005DAD8(&player->unk_258[10 + arg1], 0x000B, 0, 0x0080); } player->unk_258[10 + arg1].unk_03A = random_int(0x0010U); } else if (player->unk_258[10 + arg2].unk_01E > 0) { func_8005D794(player, &player->unk_258[10 + arg1], var_f0, var_f2, var_f12, surfaceType, var_t1); func_8005D7D8(&player->unk_258[10 + arg1], 4, 0.46f); - if ((gCurrentCourseId == 1) || (gCurrentCourseId == 7)) { + if ((gCurrentCourseId == COURSE_CHOCO_MOUNTAIN) || (gCurrentCourseId == COURSE_ROYAL_RACEWAY)) { func_8005DAD8(&player->unk_258[10 + arg1], 1, 0, 0x0080); } - if (gCurrentCourseId == 0x000B) { + if (gCurrentCourseId == COURSE_KALAMARI_DESERT) { func_8005DAD8(&player->unk_258[10 + arg1], 7, 0, 0x0080); } - if (gCurrentCourseId == 9) { + if (gCurrentCourseId == COURSE_MOO_MOO_FARM) { func_8005DAD8(&player->unk_258[10 + arg1], 8, 0, 0x0080); } - if (gCurrentCourseId == 0x000E) { + if (gCurrentCourseId == COURSE_WARIO_STADIUM) { func_8005DAD8(&player->unk_258[10 + arg1], 9, 0, 0x0080); } - if (gCurrentCourseId == 4) { + if (gCurrentCourseId == COURSE_YOSHI_VALLEY) { func_8005DAD8(&player->unk_258[10 + arg1], 0x000A, 0, 0x0080); } - if (gCurrentCourseId == 0x0012) { + if (gCurrentCourseId == COURSE_DK_JUNGLE) { func_8005DAD8(&player->unk_258[10 + arg1], 0x000B, 0, 0x0080); } player->unk_258[10 + arg1].unk_03A = random_int(0x0010U); diff --git a/src/code_80057C60.h b/src/code_80057C60.h index 826c91d025..1b3ce707aa 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -413,7 +413,7 @@ extern Vec3su D_80183E98; extern u8 D_80183FA8[4][0x2000]; // extern s32 indexObjectList3[]; -> objects.h -extern u8* D_8018C028; +extern u8* gLakituTexturePtr; // extern s32 indexObjectList4[]; -> objects.h // extern Collision D_8018C0B0[]; -> objects.h // extern s32 gObjectParticle1[]; -> objects.h @@ -544,18 +544,18 @@ extern s32 D_8018D22C; extern s32 D_8018D240; extern u8* D_8018D248[]; -extern f32 D_8018D2A0; +extern f32 gMiniMapMarkerScale; extern s32 D_8018D2A4; extern s32 D_8018D2AC; extern s16 D_8018D2B0; extern s32 D_8018D2B4; extern s16 D_8018D2B8; extern s32 D_8018D2BC; -extern s16 D_8018D2C0[]; +extern s16 gMiniMapFinishLineX[]; extern s32 D_8018D2C8[]; -extern s16 D_8018D2D8[]; -extern s16 D_8018D2E0; -extern s16 D_8018D2E8; +extern s16 gMiniMapFinishLineY[]; +extern s16 gMiniMapX; +extern s16 gMiniMapY; extern s16 D_8018D2F0; extern s16 D_8018D2F8; extern u16 D_8018D300; diff --git a/src/code_80057C60_var.c b/src/code_80057C60_var.c index 494ce899fc..78f853d615 100644 --- a/src/code_80057C60_var.c +++ b/src/code_80057C60_var.c @@ -68,7 +68,7 @@ s8 D_8018D1B8[NUM_GROUP3_MOLES]; s32 D_8018D1C4; /** * These seem to be limits on different object types in Moo Moo Farm - * See init_course_object in code_8006E9C0.c + * See init_course_objects in code_8006E9C0.c * Maybe max number of active moles in a given group of moles? */ s32 D_8018D1C8; @@ -108,7 +108,7 @@ s8 D_8018D230; UNUSED s32 D_8018D238[2]; s32 D_8018D240; u8* D_8018D248[22]; -f32 D_8018D2A0; +f32 gMiniMapMarkerScale; s32 D_8018D2A4; UNUSED s32 D_8018D2A8; s32 D_8018D2AC; @@ -116,12 +116,12 @@ s16 D_8018D2B0; s32 D_8018D2B4; s16 D_8018D2B8; s32 D_8018D2BC; -s16 D_8018D2C0[4]; +s16 gMiniMapFinishLineX[4]; s32 D_8018D2C8[4]; -s16 D_8018D2D8[4]; -s16 D_8018D2E0; +s16 gMiniMapFinishLineY[4]; +s16 gMiniMapX; UNUSED s32 D_8018D2E4; -s16 D_8018D2E8; +s16 gMiniMapY; UNUSED s32 D_8018D2EC; s16 D_8018D2F0; UNUSED s32 D_8018D2F4; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 15bee53c69..3ee13e5d65 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -168,14 +168,14 @@ void func_8006EF60(void) { // clang-format on } -void func_8006F008(void) { +void course_mini_map_settings(void) { D_801655C8 = 0; xOrientation = 1.0f; if (gIsMirrorMode != 0) { xOrientation = -1.0f; } - D_8018D2C0[0] = 257; - D_8018D2D8[0] = 170; + gMiniMapFinishLineX[0] = 257; + gMiniMapFinishLineY[0] = 170; D_8018D300 = 255; D_8018D308 = 255; D_8018D310 = 255; @@ -183,172 +183,176 @@ void func_8006F008(void) { if (gCurrentCourseId < NUM_COURSES - 1) { func_8006EEE8((s32) gCurrentCourseId); } +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: D_8018D220 = (void*) dma_textures(gTextureExhaust5, 0x443, 0x1000); - D_8018D2A0 = 0.022f; - D_8018D2E0 = 6; - D_8018D2E8 = 28; - D_8018D2C0[0] = 260; - D_8018D2D8[0] = 170; + gMiniMapMarkerScale = 0.022f; + gMiniMapX = 6; + gMiniMapY = 28; + gMiniMapFinishLineX[0] = 260; + gMiniMapFinishLineY[0] = 170; D_80165718 = 0; D_80165720 = 5; D_80165728 = -240; break; case COURSE_CHOCO_MOUNTAIN: - D_8018D2A0 = 0.022f; - D_8018D2C0[0] = 265; - D_8018D2E0 = 19; - D_8018D2E8 = 37; + gMiniMapMarkerScale = 0.022f; + gMiniMapFinishLineX[0] = 265; + gMiniMapX = 19; + gMiniMapY = 37; break; case COURSE_BOWSER_CASTLE: - D_8018D2C0[0] = 265; - D_8018D2A0 = 0.0174f; - D_8018D2E0 = 12; - D_8018D2E8 = 48; + gMiniMapFinishLineX[0] = 265; + gMiniMapMarkerScale = 0.0174f; + gMiniMapX = 12; + gMiniMapY = 48; break; case COURSE_BANSHEE_BOARDWALK: D_80165880 = (void*) dma_textures(gTextureGhosts, 0x4CC2, 0xD980); - D_8018D2A0 = 0.016f; - D_8018D2C0[0] = 0x0106; - D_8018D2E0 = 55; - D_8018D2E8 = 39; + gMiniMapMarkerScale = 0.016f; + gMiniMapFinishLineX[0] = 0x0106; + gMiniMapX = 55; + gMiniMapY = 39; break; case COURSE_YOSHI_VALLEY: D_8018D220 = (void*) dma_textures(gTextureExhaust0, 0x479, 0xC00); - D_8018D2A0 = 0.018f; - D_8018D2E0 = 61; - D_8018D2E8 = 38; + gMiniMapMarkerScale = 0.018f; + gMiniMapX = 61; + gMiniMapY = 38; break; case COURSE_FRAPPE_SNOWLAND: - D_8018D2C0[0] = 262; - D_8018D2A0 = 0.016f; - D_8018D2E0 = 36; - D_8018D2E8 = 40; + gMiniMapFinishLineX[0] = 262; + gMiniMapMarkerScale = 0.016f; + gMiniMapX = 36; + gMiniMapY = 40; D_8018D300 = 72; D_8018D308 = 100; D_8018D310 = 255; break; case COURSE_KOOPA_BEACH: D_8018D220 = (void*) dma_textures(gTextureExhaust3, 0x3C8U, 0x1000); - D_8018D2A0 = 0.014f; - D_8018D2C0[0] = 268; - D_8018D2E0 = 40; - D_8018D2E8 = 21; + gMiniMapMarkerScale = 0.014f; + gMiniMapFinishLineX[0] = 268; + gMiniMapX = 40; + gMiniMapY = 21; break; case COURSE_ROYAL_RACEWAY: D_8018D220 = (void*) dma_textures(gTextureExhaust4, 0x3F8, 0x1000); - D_8018D2C0[0] = 262; - D_8018D2A0 = 0.014f; - D_8018D2E0 = 37; - D_8018D2E8 = 50; + gMiniMapFinishLineX[0] = 262; + gMiniMapMarkerScale = 0.014f; + gMiniMapX = 37; + gMiniMapY = 50; D_80165718 = -64; D_80165720 = 5; D_80165728 = -330; break; case COURSE_LUIGI_RACEWAY: D_8018D220 = (void*) dma_textures(gTextureExhaust2, 0x4F4U, 0xC00); - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 271; - D_8018D2E0 = 45; - D_8018D2E8 = 60; + gMiniMapMarkerScale = 0.0155f; + gMiniMapFinishLineX[0] = 271; + gMiniMapX = 45; + gMiniMapY = 60; D_80165718 = -140; D_80165720 = -44; D_80165728 = -215; break; case COURSE_MOO_MOO_FARM: D_8018D220 = (void*) dma_textures(gTextureExhaust0, 0x479, 0xC00); - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 271; - D_8018D2E0 = 18; - D_8018D2E8 = 36; + gMiniMapMarkerScale = 0.0155f; + gMiniMapFinishLineX[0] = 271; + gMiniMapX = 18; + gMiniMapY = 36; break; case COURSE_TOADS_TURNPIKE: - D_8018D2A0 = 0.013f; - D_8018D2C0[0] = 252; - D_8018D2E0 = 57; - D_8018D2E8 = 44; + gMiniMapMarkerScale = 0.013f; + gMiniMapFinishLineX[0] = 252; + gMiniMapX = 57; + gMiniMapY = 44; break; case COURSE_KALAMARI_DESERT: - D_8018D2C0[0] = 263; - D_8018D2D8[0] = 165; + gMiniMapFinishLineX[0] = 263; + gMiniMapFinishLineY[0] = 165; D_8018D220 = (void*) dma_textures(gTextureExhaust5, 0x443, 0x1000); - D_8018D2A0 = 0.015f; - D_8018D2E0 = 55; - D_8018D2E8 = 27; + gMiniMapMarkerScale = 0.015f; + gMiniMapX = 55; + gMiniMapY = 27; break; case COURSE_SHERBET_LAND: D_8018D220 = (void*) dma_textures(gTextureExhaust1, 0x485, 0xC00); - D_8018D2A0 = 0.015f; - D_8018D2C0[0] = 262; - D_8018D2E0 = 52; - D_8018D2E8 = 33; + gMiniMapMarkerScale = 0.015f; + gMiniMapFinishLineX[0] = 262; + gMiniMapX = 52; + gMiniMapY = 33; D_8018D300 = 72; D_8018D308 = 100; D_8018D310 = 255; break; case COURSE_RAINBOW_ROAD: - D_8018D2A0 = 0.0103f; - D_8018D2C0[0] = 261; - D_8018D2D8[0] = 166; - D_8018D2E0 = 39; - D_8018D2E8 = 55; + gMiniMapMarkerScale = 0.0103f; + gMiniMapFinishLineX[0] = 261; + gMiniMapFinishLineY[0] = 166; + gMiniMapX = 39; + gMiniMapY = 55; break; case COURSE_WARIO_STADIUM: - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 0x0106; - D_8018D2E0 = 53; - D_8018D2E8 = 35; + gMiniMapMarkerScale = 0.0155f; + gMiniMapFinishLineX[0] = 0x0106; + gMiniMapX = 53; + gMiniMapY = 35; break; case COURSE_BLOCK_FORT: - D_8018D2A0 = 0.0335f; - D_8018D2E0 = 32; - D_8018D2E8 = 32; + gMiniMapMarkerScale = 0.0335f; + gMiniMapX = 32; + gMiniMapY = 32; break; case COURSE_SKYSCRAPER: - D_8018D2A0 = 0.0445f; - D_8018D2E0 = 32; - D_8018D2E8 = 32; + gMiniMapMarkerScale = 0.0445f; + gMiniMapX = 32; + gMiniMapY = 32; break; case COURSE_DOUBLE_DECK: - D_8018D2A0 = 0.0285f; - D_8018D2E0 = 32; - D_8018D2E8 = 32; + gMiniMapMarkerScale = 0.0285f; + gMiniMapX = 32; + gMiniMapY = 32; break; case COURSE_DK_JUNGLE: - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 255; - D_8018D2E0 = 29; - D_8018D2E8 = 47; + gMiniMapMarkerScale = 0.0155f; + gMiniMapFinishLineX[0] = 255; + gMiniMapX = 29; + gMiniMapY = 47; break; case COURSE_BIG_DONUT: - D_8018D2A0 = 0.0257f; - D_8018D2E0 = 32; - D_8018D2E8 = 31; + gMiniMapMarkerScale = 0.0257f; + gMiniMapX = 32; + gMiniMapY = 31; } +#else + +#endif if (gIsMirrorMode != 0) { - D_8018D2E0 = D_8018D2B0 - D_8018D2E0; + gMiniMapX = D_8018D2B0 - gMiniMapX; } if (gPlayerCount == 4) { - D_8018D2C0[0] = 160; - D_8018D2D8[0] = 120; + gMiniMapFinishLineX[0] = 160; + gMiniMapFinishLineY[0] = 120; return; } if (gPlayerCount == 3) { - D_8018D2C0[0] = 235; - D_8018D2D8[0] = 175; + gMiniMapFinishLineX[0] = 235; + gMiniMapFinishLineY[0] = 175; return; } if (gPlayerCount == 2) { - if (gCurrentCourseId != 10) { - D_8018D2C0[1] = 265; - D_8018D2C0[0] = D_8018D2C0[1]; + if (gCurrentCourseId != COURSE_TOADS_TURNPIKE) { + gMiniMapFinishLineX[1] = 265; + gMiniMapFinishLineX[0] = gMiniMapFinishLineX[1]; } else { - D_8018D2C0[1] = 255; - D_8018D2C0[0] = D_8018D2C0[1]; + gMiniMapFinishLineX[1] = 255; + gMiniMapFinishLineX[0] = gMiniMapFinishLineX[1]; } - D_8018D2D8[0] = 65; - D_8018D2D8[1] = 180; + gMiniMapFinishLineY[0] = 65; + gMiniMapFinishLineY[1] = 180; } } @@ -392,8 +396,8 @@ void func_8006F8CC(void) { D_801657F0 = 1; D_80165800[0] = D_80165800[1] = 0; } - D_8018D2D8[0] = 0x0041; - D_8018D2D8[1] = 0x00B4; + gMiniMapFinishLineY[0] = 0x0041; + gMiniMapFinishLineY[1] = 0x00B4; } func_8006F824(0); } else { @@ -419,7 +423,7 @@ void func_8006FA94(void) { Player* player; func_8006F8CC(); - func_8006F008(); + course_mini_map_settings(); osSetTime(0); D_8018D170 = 0; D_8018D190 = 0; @@ -683,10 +687,11 @@ void init_stars(StarData* starList) { D_8018D230 = 1; } -void func_8007055C(void) { +void course_init_cloud(void) { s32 var_s0; s32 var_s4; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: // Uses Kalimari Desert's clouds for initialization? @@ -735,6 +740,9 @@ void func_8007055C(void) { init_stars(gWarioStadiumStars); break; } +#else + +#endif func_8008C23C(); } @@ -751,10 +759,11 @@ void func_80070714(void) { D_80165748 = 0xA; } -void init_course_object(void) { +void init_course_objects(void) { s32 objectId; s32 i; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: if (gGamestate != 9) { @@ -1007,6 +1016,9 @@ void init_course_object(void) { default: break; } +#else + +#endif } void init_hud_one_player(void) { @@ -1025,9 +1037,9 @@ void init_hud_one_player(void) { find_unused_obj_index(&gItemWindowObjectByPlayerId[0]); find_unused_obj_index(&gItemWindowObjectByPlayerId[1]); init_object_list_index(); - func_8007055C(); - func_8007055C(); - init_course_object(); + course_init_cloud(); + course_init_cloud(); + init_course_objects(); playerHUD[PLAYER_ONE].speedometerX = 0x0156; playerHUD[PLAYER_ONE].speedometerY = 0x0106; D_8018CFEC = playerHUD[PLAYER_ONE].speedometerX + 0x18; @@ -1106,9 +1118,9 @@ void init_hud_two_player_vertical(void) { find_unused_obj_index(&gItemWindowObjectByPlayerId[1]); init_object_list_index(); - func_8007055C(); - func_8007055C(); - init_course_object(); + course_init_cloud(); + course_init_cloud(); + init_course_objects(); playerHUD[PLAYER_ONE].itemBoxX = -0x52; playerHUD[PLAYER_ONE].itemBoxY = 0x32; @@ -1174,9 +1186,9 @@ void init_hud_two_player_horizontal() { find_unused_obj_index(&gItemWindowObjectByPlayerId[1]); init_object_list_index(); - func_8007055C(); - func_8007055C(); - init_course_object(); + course_init_cloud(); + course_init_cloud(); + init_course_objects(); playerHUD[PLAYER_ONE].itemBoxY = 0x22; playerHUD[PLAYER_ONE].itemBoxX = -0x53; @@ -1252,7 +1264,7 @@ void init_hud_three_four_player(void) { find_unused_obj_index(&gItemWindowObjectByPlayerId[3]); init_object_list_index(); - init_course_object(); + init_course_objects(); playerHUD[PLAYER_ONE].itemBoxX = -0x36; playerHUD[PLAYER_ONE].itemBoxY = 0x36; diff --git a/src/code_8006E9C0.h b/src/code_8006E9C0.h index 61f8ab4f91..281e958ab4 100644 --- a/src/code_8006E9C0.h +++ b/src/code_8006E9C0.h @@ -13,7 +13,7 @@ void func_8006EE44(void); void init_item_window(s32); void func_8006EEE8(s32); void func_8006EF60(void); -void func_8006F008(void); +void course_mini_map_settings(void); void func_8006F824(s32); void func_8006F8CC(void); void func_8006FA94(void); @@ -23,9 +23,9 @@ void init_cloud_object(s32, s32, CloudData*); void init_clouds(CloudData*); void init_star_object(s32, s32, StarData*); void init_stars(StarData*); -void func_8007055C(void); +void course_init_cloud(void); void func_80070714(void); -void init_course_object(void); +void init_course_objects(void); void init_hud_one_player(void); void init_hud_two_player_vertical(void); void init_hud_three_four_player(void); diff --git a/src/code_80086E70.c b/src/code_80086E70.c index 4d831df644..f19f1a8163 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "code_80086E70.h" #include "camera.h" diff --git a/src/code_80086E70.h b/src/code_80086E70.h index 8d9a6ffdcc..b53fbadc75 100644 --- a/src/code_80086E70.h +++ b/src/code_80086E70.h @@ -166,6 +166,4 @@ void func_8008BFFC(s32); void func_8008C1B8(s32); void func_8008C1C0(s32); -extern s16 gCurrentCourseId; - #endif diff --git a/src/code_80091750.c b/src/code_80091750.c index f50cbb0864..3da0957634 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -1,10 +1,12 @@ #include +#include #include -#include #include #include -#include #include +#include +#include + #include "code_800029B0.h" #include "code_80091750.h" #include "code_80005FD0.h" @@ -313,6 +315,7 @@ char* gCupNames[] = { "special cup", }; +#if !ENABLE_CUSTOM_COURSE_ENGINE // Displays at beginning of course char* gCourseNames[] = { #include "assets/course_metadata/gCourseNames.inc.c" @@ -321,15 +324,22 @@ char* gCourseNames[] = { char* gCourseNamesDup[] = { #include "assets/course_metadata/gCourseNames.inc.c" }; +#else + +#endif char* gCourseNamesDup2[] = { #include "assets/course_metadata/gCourseNames.inc.c" }; +#if !ENABLE_CUSTOM_COURSE_ENGINE // Used in debug menu at splash screen char* gDebugCourseNames[] = { #include "assets/course_metadata/gCourseDebugNames.inc.c" }; +#else + +#endif const s8 gPerCupIndexByCourseId[] = { #include "assets/course_metadata/gPerCupIndexByCourseId.inc.c" @@ -2446,7 +2456,7 @@ void func_80095574(void) { } else { var_v0 = 8; } - debug_print_str2(var_v0 + 0xB9, 0x0000006E, gDebugCourseNames[gCurrentCourseId]); + debug_print_str2(var_v0 + 0xB9, 0x0000006E, GET_COURSE_debugName); debug_print_str2(0x00000050, 0x00000078, "screen_mode"); debug_print_str2(0x000000AA, 0x00000078, gDebugScreenModeNames[gScreenModeListIndex]); debug_print_str2(0x00000050, 0x00000082, "player"); @@ -4761,7 +4771,7 @@ void func_8009CE64(s32 arg0) { } else { D_8018E7AC[arg0] = 0; if (gDebugMenuSelection != DEBUG_MENU_OPTION_SELECTED) { - switch (gMenuFadeType) { /* switch 3 */ + switch (gMenuFadeType) { /* switch 3 */ case MENU_FADE_TYPE_MAIN: /* switch 3 */ if (gMenuSelection == LOGO_INTRO_MENU) { gMenuSelection = START_MENU; @@ -4780,7 +4790,7 @@ void func_8009CE64(s32 arg0) { gCCSelection = (s32) 1; switch (gNextDemoId) { /* switch 4 */ case 0: /* switch 4 */ - gCurrentCourseId = 0; + gCurrentCourseId = COURSE_MARIO_RACEWAY; gScreenModeSelection = 0; gPlayerCountSelection1 = 1; gPlayerCount = 1; @@ -4788,7 +4798,7 @@ void func_8009CE64(s32 arg0) { gModeSelection = 0; break; case 1: /* switch 4 */ - gCurrentCourseId = (s16) 1; + gCurrentCourseId = COURSE_CHOCO_MOUNTAIN; gScreenModeSelection = (s32) 1; gPlayerCountSelection1 = 2; gPlayerCount = (s8) 2; @@ -4797,7 +4807,7 @@ void func_8009CE64(s32 arg0) { gModeSelection = 2; break; case 2: /* switch 4 */ - gCurrentCourseId = 0x000B; + gCurrentCourseId = COURSE_KALAMARI_DESERT; gScreenModeSelection = 0; gPlayerCountSelection1 = (s32) 1; gPlayerCount = 1; @@ -4805,7 +4815,7 @@ void func_8009CE64(s32 arg0) { gModeSelection = 0; break; case 3: /* switch 4 */ - gCurrentCourseId = 0x000E; + gCurrentCourseId = COURSE_WARIO_STADIUM; gScreenModeSelection = 3; gPlayerCountSelection1 = 3; gPlayerCount = (s8) 3; @@ -4815,7 +4825,7 @@ void func_8009CE64(s32 arg0) { gModeSelection = (s32) 2; break; case 4: /* switch 4 */ - gCurrentCourseId = 2; + gCurrentCourseId = COURSE_BOWSER_CASTLE; gScreenModeSelection = 0; gPlayerCountSelection1 = (s32) 1; gPlayerCount = 1; @@ -4823,7 +4833,7 @@ void func_8009CE64(s32 arg0) { gModeSelection = 0; break; case 5: /* switch 4 */ - gCurrentCourseId = 0x000C; + gCurrentCourseId = COURSE_SHERBET_LAND; gScreenModeSelection = 3; gPlayerCountSelection1 = 4; gPlayerCount = 4; @@ -4877,12 +4887,12 @@ void func_8009CE64(s32 arg0) { } unref_8018EE0C = 0; } else { - switch (gDebugGotoScene) { /* switch 5; irregular */ + switch (gDebugGotoScene) { /* switch 5; irregular */ case DEBUG_GOTO_ENDING: /* switch 5 */ gGamestateNext = (s32) 5; break; case DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT: /* switch 5 */ - case DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA: /* switch 5 */ + case DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA: /* switch 5 */ gGamestateNext = 9; gCreditsCourseId = 8; break; @@ -4925,7 +4935,7 @@ void func_8009CE64(s32 arg0) { gCupSelection = gCupSelectionByCourseId[gCurrentCourseId]; D_800DC540 = gCupSelection; gCourseIndexInCup = gPerCupIndexByCourseId[gCurrentCourseId]; - switch (gDebugGotoScene) { /* switch 6; irregular */ + switch (gDebugGotoScene) { /* switch 6; irregular */ case DEBUG_GOTO_ENDING: /* switch 6 */ break; case DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT: /* switch 6 */ @@ -6120,7 +6130,7 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) { break; case 0x97: /* switch 6 */ set_text_color(5); - func_80093324(arg0->column, arg0->row, gCourseNames[gCurrentCourseId], arg0->unk1C, arg0->unk24, 1.0f); + func_80093324(arg0->column, arg0->row, GET_COURSE_Name, arg0->unk1C, arg0->unk24, 1.0f); break; case 0x98: /* switch 6 */ func_800A2D1C(arg0); @@ -6328,7 +6338,8 @@ void func_800A09E0(struct_8018D9E0_entry* arg0) { s32 table_row, x = 0x20, y; gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH - 1, 194); for (table_row = 0; table_row < 9; table_row++) { - if ((gControllerPakScrollDirection != CONTROLLER_PAK_SCROLL_DIR_NONE) || ((table_row != 0) && (table_row != 8))) { + if ((gControllerPakScrollDirection != CONTROLLER_PAK_SCROLL_DIR_NONE) || + ((table_row != 0) && (table_row != 8))) { y = (table_row * 0xA) + arg0->row; gDisplayListHead = func_8009BA74(gDisplayListHead, D_0200157C, x, y); } @@ -6764,7 +6775,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { struct_8018EE10_entry* var_v1; gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, 0x00000064); - switch (gSubMenuSelection) { /* switch 1 */ + switch (gSubMenuSelection) { /* switch 1 */ case SUB_MENU_OPTION_RETURN_GAME_SELECT: /* switch 1 */ case SUB_MENU_OPTION_SOUND_MODE: /* switch 1 */ case SUB_MENU_OPTION_COPY_CONTROLLER_PAK: /* switch 1 */ @@ -6780,7 +6791,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { set_text_color(1); draw_text(0x000000E6, 0x55 + 0x23, gSoundModeNames[gSoundMode], 0, 1.0f, 1.0f); break; - case SUB_MENU_ERASE_QUIT: /* switch 1 */ + case SUB_MENU_ERASE_QUIT: /* switch 1 */ case SUB_MENU_ERASE_ERASE: /* switch 1 */ set_text_color(3); for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7878); stackPadding0++) { @@ -6802,9 +6813,9 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } break; case SUB_MENU_COPY_PAK_ERROR_NO_GHOST_DATA: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P: /* switch 1 */ set_text_color(2); var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_ERROR_2P_MIN; for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E78D0) / 4; stackPadding0++) { // 12 / 4 = 3 @@ -6812,10 +6823,10 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { 0.9f, 0.9f); } break; - case SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P: /* switch 1 */ case SUB_MENU_COPY_PAK_ERROR_CANT_CREATE_1P: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P: /* switch 1 */ set_text_color(2); var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_ERROR_1P_MIN; for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7890) / 4; stackPadding0++) { // 16 / 4 = 4 @@ -6841,8 +6852,8 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { break; case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: /* switch 1 */ case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: /* switch 1 */ - case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 1 */ - case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 1 */ switch (gSubMenuSelection) { case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: @@ -6941,8 +6952,8 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { func_80093324(0x6E + (0x32 * var_s2), 0x000000D2, D_800E7930[var_s2], 0, 0.75f, 0.75f); } break; - case SUB_MENU_COPY_PAK_START: /* switch 1 */ - case SUB_MENU_COPY_PAK_COPYING: /* switch 1 */ + case SUB_MENU_COPY_PAK_START: /* switch 1 */ + case SUB_MENU_COPY_PAK_COPYING: /* switch 1 */ case SUB_MENU_COPY_PAK_COMPLETED: /* switch 1 */ var_s5 = (gSubMenuSelection - SUB_MENU_COPY_PAK_ACTION_MIN) / 2; set_text_color(2); @@ -6985,13 +6996,13 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } break; } - switch (gSubMenuSelection) { /* switch 2 */ - case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: /* switch 2 */ - case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: /* switch 2 */ - case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 2 */ - case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 2 */ - case SUB_MENU_COPY_PAK_PROMPT_QUIT: /* switch 2 */ - case SUB_MENU_COPY_PAK_PROMPT_COPY: /* switch 2 */ + switch (gSubMenuSelection) { /* switch 2 */ + case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: /* switch 2 */ + case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: /* switch 2 */ + case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 2 */ + case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 2 */ + case SUB_MENU_COPY_PAK_PROMPT_QUIT: /* switch 2 */ + case SUB_MENU_COPY_PAK_PROMPT_COPY: /* switch 2 */ spE0.column -= 5; spE0.row -= 6; break; @@ -7078,7 +7089,8 @@ void func_800A2EB8(struct_8018D9E0_entry* arg0) { draw_text((-(s32) (((f32) (get_string_width(D_800E76CC[gCCSelection]) + 8) * 0.6f) / 2) - arg0->column) + 0xF5, arg0->row + 0xE1, gCupNames[D_800DC540], 0, 0.6f, 0.6f); draw_text((temp_s0 - arg0->column) + 0xF5, arg0->row + 0xE1, - D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, 0.6f); + D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, + 0.6f); } void func_800A32B4(s32 arg0, s32 arg1, s32 characterId, s32 rank) { @@ -7194,7 +7206,8 @@ void func_800A34A8(struct_8018D9E0_entry* arg0) { draw_text((-(s32) (((get_string_width(D_800E76CC[gCCSelection]) + 8) * 0.6f) / 2) - arg0->column) + 0xE6, arg0->row + 0xE1, gCupNames[D_800DC540], 0, 0.6f, 0.6f); draw_text((temp_s0_3 - arg0->column) + 0xE6, arg0->row + 0xE1, - D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, 0.6f); + D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, + 0.6f); } } @@ -7265,8 +7278,7 @@ void func_800A3C84(struct_8018D9E0_entry* arg0) { s32 rowOffset; set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); - draw_text(arg0->column + 0x43, arg0->row + 0x19, gCourseNamesDup[gCupCourseOrder[gCupSelection][gCourseIndexInCup]], - 0, 0.6f, 0.6f); + draw_text(arg0->column + 0x43, arg0->row + 0x19, GET_COURSE_NameDup, 0, 0.6f, 0.6f); set_text_color(TEXT_YELLOW); draw_text(arg0->column + 0x46, arg0->row + 0x28, D_800E7730, 0, 0.75f, 0.75f); for (recordType = 0, rowOffset = 0; recordType < TIME_TRIAL_3LAP_RECORD_5; recordType += 1, rowOffset += 0xF) { @@ -7942,7 +7954,7 @@ void func_800A6034(struct_8018D9E0_entry* arg0) { text = gCupNames[D_800DC540]; set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); func_80093754(arg0->column + 0x41, arg0->row + 0xA0, text, 0, 0.85f, 1.0f); - text = gCourseNames[gCurrentCourseId]; + text = GET_COURSE_Name; set_text_color((s32) gCurrentCourseId % 4); func_80093754(arg0->column + 0x41, arg0->row + 0xC3, text, 0, 0.65f, 0.85f); } @@ -8479,19 +8491,19 @@ void func_800A7A4C(s32 arg0) { case 0xA: /* switch 8 */ func_800AA280(var_s1); break; - case 0x10: /* switch 8 */ - case 0x11: /* switch 8 */ - switch (gMainMenuSelection) { /* switch 5 */ + case 0x10: /* switch 8 */ + case 0x11: /* switch 8 */ + switch (gMainMenuSelection) { /* switch 5 */ case MAIN_MENU_OPTION: /* switch 5 */ - case MAIN_MENU_DATA: /* switch 5 */ - case MAIN_MENU_PLAYER_SELECT: /* switch 5 */ + case MAIN_MENU_DATA: /* switch 5 */ + case MAIN_MENU_PLAYER_SELECT: /* switch 5 */ func_800A9B9C(var_s1); break; - case MAIN_MENU_MODE_SELECT: /* switch 5 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 5 */ - case MAIN_MENU_OK_SELECT: /* switch 5 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 5 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 5 */ + case MAIN_MENU_MODE_SELECT: /* switch 5 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 5 */ + case MAIN_MENU_OK_SELECT: /* switch 5 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 5 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 5 */ func_800A9C40(var_s1); break; } @@ -8500,21 +8512,21 @@ void func_800A7A4C(s32 arg0) { func_800AA280(var_s1); func_800A9A98(var_s1); break; - case 0xB: /* switch 8 */ - case 0xC: /* switch 8 */ - case 0xD: /* switch 8 */ - case 0xE: /* switch 8 */ - switch (gMainMenuSelection) { /* switch 6 */ + case 0xB: /* switch 8 */ + case 0xC: /* switch 8 */ + case 0xD: /* switch 8 */ + case 0xE: /* switch 8 */ + switch (gMainMenuSelection) { /* switch 6 */ case MAIN_MENU_OPTION: /* switch 6 */ - case MAIN_MENU_DATA: /* switch 6 */ - case MAIN_MENU_PLAYER_SELECT: /* switch 6 */ + case MAIN_MENU_DATA: /* switch 6 */ + case MAIN_MENU_PLAYER_SELECT: /* switch 6 */ func_800A9B9C(var_s1); break; - case MAIN_MENU_MODE_SELECT: /* switch 6 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 6 */ - case MAIN_MENU_OK_SELECT: /* switch 6 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 6 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 6 */ + case MAIN_MENU_MODE_SELECT: /* switch 6 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 6 */ + case MAIN_MENU_OK_SELECT: /* switch 6 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 6 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 6 */ func_800A9C40(var_s1); break; } @@ -8561,10 +8573,10 @@ void func_800A7A4C(s32 arg0) { break; } switch (gPlayerSelectMenuSelection) { /* switch 10; irregular */ - case PLAYER_SELECT_MENU_MAIN: /* switch 10 */ + case PLAYER_SELECT_MENU_MAIN: /* switch 10 */ func_800AAB90(var_s1); break; - case PLAYER_SELECT_MENU_OK: /* switch 10 */ + case PLAYER_SELECT_MENU_OK: /* switch 10 */ case PLAYER_SELECT_MENU_OK_GO_BACK: /* switch 10 */ func_800AAA9C(var_s1); break; @@ -8580,12 +8592,12 @@ void func_800A7A4C(s32 arg0) { case 0x55: /* switch 8 */ case 0x56: /* switch 8 */ func_800AB164(var_s1); - switch (gSubMenuSelection) { /* switch 11; irregular */ + switch (gSubMenuSelection) { /* switch 11; irregular */ case SUB_MENU_MAP_SELECT_CUP: /* switch 11 */ func_800AB020(var_s1); break; case SUB_MENU_MAP_SELECT_COURSE: /* switch 11 */ - case SUB_MENU_MAP_SELECT_OK: /* switch 11 */ + case SUB_MENU_MAP_SELECT_OK: /* switch 11 */ func_800AB098(var_s1); break; } @@ -8846,7 +8858,8 @@ void func_800A8270(s32 arg0, struct_8018D9E0_entry* arg1) { gDisplayListHead = func_80098FC8(gDisplayListHead, var_s3, var_s0, var_s4, var_s0 + 0x35); } for (var_s0 += 0x41, var_s2 = 0; var_s2 <= gPlayerModeSelection[arg0]; var_s2++, var_s0 += 0x12) { - if ((var_s2 == gGameModeMenuColumn[arg0]) && ((arg0 + 1) == gPlayerCount) && (gMainMenuSelection > MAIN_MENU_PLAYER_SELECT)) { + if ((var_s2 == gGameModeMenuColumn[arg0]) && ((arg0 + 1) == gPlayerCount) && + (gMainMenuSelection > MAIN_MENU_PLAYER_SELECT)) { if (gMainMenuSelection == MAIN_MENU_MODE_SELECT) { gDisplayListHead = draw_flash_select_case_slow(gDisplayListHead, var_s3, var_s0, var_s4, var_s0 + 0x11); @@ -8873,14 +8886,13 @@ void func_800A8564(struct_8018D9E0_entry* arg0) { switch (arg0->type) { /* irregular */ case 0xF: var_a0 = D_0200487C; - if ((gMainMenuSelection == MAIN_MENU_OK_SELECT) || - (gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT) || (gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK)) { var_a1 = 1; } break; case 0x33: var_a0 = D_02004B74; - if ((gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK) || + if ((gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK) || (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_GO_BACK)) { var_a1 = 1; } @@ -8977,8 +8989,10 @@ void func_800A8A98(struct_8018D9E0_entry* arg0) { gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); for (someIndex = 0; someIndex < NUM_COURSES_PER_CUP; someIndex++) { - if ((someIndex == gCourseIndexInCup) && (gSubMenuSelection > SUB_MENU_MAP_SELECT_CUP) && (gModeSelection != GRAND_PRIX)) { - if ((gSubMenuSelection == SUB_MENU_MAP_SELECT_COURSE) || (gSubMenuSelection == SUB_MENU_MAP_SELECT_BATTLE_COURSE)) { + if ((someIndex == gCourseIndexInCup) && (gSubMenuSelection > SUB_MENU_MAP_SELECT_CUP) && + (gModeSelection != GRAND_PRIX)) { + if ((gSubMenuSelection == SUB_MENU_MAP_SELECT_COURSE) || + (gSubMenuSelection == SUB_MENU_MAP_SELECT_BATTLE_COURSE)) { gDisplayListHead = draw_flash_select_case_slow( gDisplayListHead, D_800E7208[someIndex][0].column + temp_s2, D_800E7208[someIndex][0].row + temp_s3, D_800E7208[someIndex][1].column + temp_s2, D_800E7208[someIndex][1].row + temp_s3); @@ -9300,7 +9314,8 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { if (i < 7) { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i + 1]; } else { - if ((gControllerPakVisibleTableRows[i - 1] == 0x10) || (gControllerPakVisibleTableRows[i - 1] == 0)) { + if ((gControllerPakVisibleTableRows[i - 1] == 0x10) || + (gControllerPakVisibleTableRows[i - 1] == 0)) { gControllerPakVisibleTableRows[i] = 0; } else { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i - 1] + 1; @@ -9320,7 +9335,8 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { if (i > 1) { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i - 1]; } else { - if ((gControllerPakVisibleTableRows[i + 1] == 1) || (gControllerPakVisibleTableRows[i + 1] == 0)) { + if ((gControllerPakVisibleTableRows[i + 1] == 1) || + (gControllerPakVisibleTableRows[i + 1] == 0)) { gControllerPakVisibleTableRows[i] = 0; } else { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i + 1] - 1; @@ -9339,17 +9355,11 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { // Don't know if this belongs here or inside func_800A9A98 // as a `static const`. But this matches so we'll leave // it here for now. -const s8 D_800F0CA0[] = { - 0x03, 0x03, 0x03, 0x02, 0x00, 0x02, 0x02, 0x01 -}; +const s8 D_800F0CA0[] = { 0x03, 0x03, 0x03, 0x02, 0x00, 0x02, 0x02, 0x01 }; -const s8 D_800F0CA8[] = { - 0x03, 0x02, 0x00 -}; +const s8 D_800F0CA8[] = { 0x03, 0x02, 0x00 }; -const s8 D_800F0CAC[] = { - 0x03, 0x03, 0x02 -}; +const s8 D_800F0CAC[] = { 0x03, 0x03, 0x02 }; void func_800A9A98(struct_8018D9E0_entry* arg0) { s32 sp4; @@ -9538,10 +9548,10 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { arg0->visible = 0; } else { arg0->unk20 = gGameModeMenuColumn[gPlayerCount - 1]; - switch (gMainMenuSelection) { /* switch 2 */ - case MAIN_MENU_MODE_SELECT: /* switch 2 */ + switch (gMainMenuSelection) { /* switch 2 */ + case MAIN_MENU_MODE_SELECT: /* switch 2 */ case MAIN_MENU_MODE_SUB_SELECT: /* switch 2 */ - case MAIN_MENU_OK_SELECT: /* switch 2 */ + case MAIN_MENU_OK_SELECT: /* switch 2 */ arg0->visible = 1; temp_v0 = func_800AAE68(); arg0->column = temp_v0->column; @@ -9565,13 +9575,13 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { } } break; - case 1: /* switch 5 */ - switch (gMainMenuSelection) { /* switch 3 */ - case MAIN_MENU_MODE_SELECT: /* switch 3 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 3 */ - case MAIN_MENU_OK_SELECT: /* switch 3 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 3 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 3 */ + case 1: /* switch 5 */ + switch (gMainMenuSelection) { /* switch 3 */ + case MAIN_MENU_MODE_SELECT: /* switch 3 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 3 */ + case MAIN_MENU_OK_SELECT: /* switch 3 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 3 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 3 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; arg0->cursor = 0; @@ -9596,13 +9606,13 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { break; } break; - case 2: /* switch 5 */ - switch (gMainMenuSelection) { /* switch 4 */ - case MAIN_MENU_MODE_SELECT: /* switch 4 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 4 */ - case MAIN_MENU_OK_SELECT: /* switch 4 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 4 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 4 */ + case 2: /* switch 5 */ + switch (gMainMenuSelection) { /* switch 4 */ + case MAIN_MENU_MODE_SELECT: /* switch 4 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 4 */ + case MAIN_MENU_OK_SELECT: /* switch 4 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 4 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 4 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; arg0->cursor = 0; @@ -10527,7 +10537,7 @@ void func_800ABF68(struct_8018D9E0_entry* arg0) { case 0: arg0->column = 0x140; arg0->cursor = 1; - arg0->unk20 = 0xA0 - (get_string_width(gCourseNames[gCurrentCourseId]) / 2); + arg0->unk20 = 0xA0 - (get_string_width(GET_COURSE_Name) / 2); /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); diff --git a/src/code_80091750.h b/src/code_80091750.h index c35039dbf2..81f19ade63 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -486,10 +486,7 @@ extern RGBA16 D_800E74D0[]; extern RGBA16 D_800E74E8[]; extern const s16 gGlyphDisplayWidth[]; extern char* gCupNames[]; -extern char* gCourseNames[]; -extern char* gCourseNamesDup[]; extern char* gCourseNamesDup2[]; -extern char* gDebugCourseNames[]; // Maps course IDs (as defined in the COURSES enum) to an index in a given cup's track order extern const s8 gPerCupIndexByCourseId[]; // D_800EFD50 extern const s8 D_800EFD64[]; diff --git a/src/data/path_spawn_metadata.c b/src/data/path_spawn_metadata.c index bc397d0dc0..eccb145d77 100644 --- a/src/data/path_spawn_metadata.c +++ b/src/data/path_spawn_metadata.c @@ -2,14 +2,19 @@ #include "courses/all_course_data.h" #include +#if !ENABLE_CUSTOM_COURSE_ENGINE // @warning Array contains an extra zero element at the end. KartAIBehaviour* gKartAIBehaviourLUT[] = { #include "assets/course_metadata/gKartAIBehaviourLUT.inc.c" }; +#else + +#endif TrackWaypoint nullPath = { 0x8000, 0x0000, 0x0000, 0x0000 }; +#if !ENABLE_CUSTOM_COURSE_ENGINE TrackWaypoint* gCoursePathTable[][4] = { #include "assets/course_metadata/gCoursePathTableUnknown.inc.c" }; @@ -18,7 +23,7 @@ TrackWaypoint* gCoursePathTable2[][4] = { #include "assets/course_metadata/gCoursePathTable.inc.c" }; -// @warning Array contains an extra zero element at the end. +/// @warning Array contains an extra zero element at the end. s16 gKartAISteeringSensitivity[] = { #include "assets/course_metadata/gCPUSteeringSensitivity.inc.c" }; @@ -32,6 +37,9 @@ f32 gKartAICourseMaximumSeparation[] = { f32 gKartAICourseMinimumSeparation[] = { #include "assets/course_metadata/gKartAICourseMinimumSeparation.inc.c" }; +#else + +#endif // I think the types for D_800DCAF4, D_800DCB34, and D_800DCBB4 are all // wrong in some way based on their usage in func_800088D8 @@ -60,9 +68,13 @@ BombKartSpawn gBombKartSpawns[][NUM_BOMB_KARTS_MAX] = { #include "assets/course_metadata/gBombKartSpawns.inc.c" }; +#if !ENABLE_CUSTOM_COURSE_ENGINE struct _struct_gCoursePathSizes_0x10 gCoursePathSizes[] = { #include "assets/course_metadata/gCoursePathSizes.inc.c" }; +#else + +#endif s32 D_800DDB20 = 0x00000000; diff --git a/src/data/path_spawn_metadata.h b/src/data/path_spawn_metadata.h index cbddae31f6..2dd6834855 100644 --- a/src/data/path_spawn_metadata.h +++ b/src/data/path_spawn_metadata.h @@ -6,27 +6,10 @@ #include #include "include/bomb_kart.h" -struct _struct_gCoursePathSizes_0x10 { - /* 0x00 */ u16 unk0; - /* 0x02 */ u16 unk2; - /* 0x04 */ u16 unk4; - /* 0x06 */ u16 unk6; - /* 0x08 */ u16 unk8; - /* 0x0A */ char padA[6]; -}; // size 0x10 - -extern KartAIBehaviour* gKartAIBehaviourLUT[]; extern TrackWaypoint nullPath; -extern TrackWaypoint* gCoursePathTable[][4]; -extern TrackWaypoint* gCoursePathTable2[][4]; -extern s16 gKartAISteeringSensitivity[]; -extern f32 gKartAICourseMaximumSeparation[]; -extern f32 gKartAICourseMinimumSeparation[]; extern s16 D_800DCAF4[]; extern s16 D_800DCB34[]; -extern s16* D_800DCBB4[]; extern BombKartSpawn gBombKartSpawns[][NUM_BOMB_KARTS_MAX]; -extern struct _struct_gCoursePathSizes_0x10 gCoursePathSizes[]; extern s32 D_800DDB20; extern s32 D_800DDB24; diff --git a/src/effects.c b/src/effects.c index 1294a7cbab..d83eb21d42 100644 --- a/src/effects.c +++ b/src/effects.c @@ -17,6 +17,7 @@ #include "audio/external.h" #include "spawn_players.h" #include "code_80091750.h" +#include s32 D_8018D900[8]; s16 D_8018D920[8]; @@ -1587,8 +1588,10 @@ void func_8008FEDC(Player* player, UNUSED s8 arg1) { player->kartHopAcceleration = 0.0f; } -void func_8008FF08(Player* player, s8 playerId) { +void course_update_waypoint(Player* player, s8 playerId) { s16 waypoint; + +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_BOWSER_CASTLE: waypoint = gNearestWaypointByPlayerId[playerId]; @@ -1670,6 +1673,9 @@ void func_8008FF08(Player* player, s8 playerId) { } break; } +#else + +#endif } void func_80090178(Player* player, s8 playerId, Vec3f arg2, Vec3f arg3) { @@ -1795,7 +1801,7 @@ void func_80090868(Player* player) { player->unk_D98 = 1; player->unk_D9C = 0.0f; player->unk_DA0 = 0.5f; - func_8008FF08(player, playerIndex); + course_update_waypoint(player, playerIndex); player->unk_222 = 0; player->unk_0CA |= 2; player->unk_0C8 = 0; diff --git a/src/effects.h b/src/effects.h index cecf863f22..d4cadee2b4 100644 --- a/src/effects.h +++ b/src/effects.h @@ -106,7 +106,7 @@ void func_8008FDA8(Player*, s8); void func_8008FDF4(Player*, s8); void func_8008FE84(Player*, s8); void func_8008FEDC(Player*, s8); -void func_8008FF08(Player*, s8); +void course_update_waypoint(Player*, s8); void func_80090178(Player*, s8, Vec3f, Vec3f); void func_80090778(Player*); void func_80090868(Player*); diff --git a/src/ending/camera_junk.c b/src/ending/camera_junk.c index 2d1baa920b..5f360ea41b 100644 --- a/src/ending/camera_junk.c +++ b/src/ending/camera_junk.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "camera_junk.h" @@ -38,7 +39,7 @@ void init_camera_podium_ceremony(void) { cameras[0].up[2] = 0.0f; gCameraZoom[0] = 40.0f; gScreenAspect = 1.33333333f; - D_80150150 = 3.0f; - D_8015014C = 6800.0f; + gCourseNearPersp = 3.0f; + gCourseFarPersp = 6800.0f; init_cinematic_camera(); } diff --git a/src/ending/code_80280000.c b/src/ending/code_80280000.c index 0a414e9a61..9cba843a34 100644 --- a/src/ending/code_80280000.c +++ b/src/ending/code_80280000.c @@ -4,10 +4,11 @@ #include #include #include +#include -#include +#include "main.h" #include -#include +#include "code_800029B0.h" #include "camera.h" #include "memory.h" #include "math_util.h" @@ -30,7 +31,7 @@ s32 D_802874A0; // s32 D_802874A4[5]; void func_80280000(void) { - func_802966A0(); + course_update_water(); func_80059AC8(); func_80059AC8(); func_8005A070(); @@ -51,7 +52,8 @@ void func_80280038(void) { func_80057FC4(0); gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); @@ -128,7 +130,7 @@ void load_credits(void) { gCurrentCourseId = gCreditsCourseId; D_800DC5B4 = 1; creditsRenderMode = 1; - func_802A4D18(); + set_perspective_and_aspect_ratio(); func_802A74BC(); camera->unk_B4 = 60.0f; gCameraZoom[0] = 60.0f; diff --git a/src/ending/code_80281780.c b/src/ending/code_80281780.c index a7df4cde74..249269cdc0 100644 --- a/src/ending/code_80281780.c +++ b/src/ending/code_80281780.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "code_80281780.h" #include "memory.h" @@ -92,7 +93,7 @@ void load_ceremony_cutscene(void) { gIsMirrorMode = 0; gGotoMenu = 0xFFFF; D_80287554 = 0; - func_802A4D18(); + set_perspective_and_aspect_ratio(); func_802A74BC(); camera->unk_B4 = 60.0f; gCameraZoom[0] = 60.0f; diff --git a/src/ending/code_80281C40.c b/src/ending/code_80281C40.c index 43a568dc13..220a1362bf 100644 --- a/src/ending/code_80281C40.c +++ b/src/ending/code_80281C40.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "code_80281C40.h" #include "main.h" @@ -49,7 +50,7 @@ void func_80281CB4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { extern Gfx D_80284F70[]; extern Gfx D_80284EE0[]; -void func_80281D00(void) { +void render_podium_ceremony(void) { Camera* camera = &cameras[0]; UNUSED s32 pad[3]; u16 perspNorm; @@ -69,8 +70,8 @@ void func_80281D00(void) { } func_8028150C(); gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); - guPerspective((Mtx*) &gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, D_80150150, D_8015014C, - 1.0f); + guPerspective((Mtx*) &gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, gCourseNearPersp, + gCourseFarPersp, 1.0f); gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); diff --git a/src/ending/code_80281C40.h b/src/ending/code_80281C40.h index 23f356284f..cb2f2885fc 100644 --- a/src/ending/code_80281C40.h +++ b/src/ending/code_80281C40.h @@ -5,7 +5,7 @@ void func_80281C40(void); void func_80281CB4(s32, s32, s32, s32); -void func_80281D00(void); +void render_podium_ceremony(void); extern s32 gGotoMenu; extern u16 gIsInQuitToMenuTransition; diff --git a/src/ending/podium_ceremony_actors.c b/src/ending/podium_ceremony_actors.c index 46cfc9f38b..1e86047bf4 100644 --- a/src/ending/podium_ceremony_actors.c +++ b/src/ending/podium_ceremony_actors.c @@ -458,7 +458,7 @@ void podium_ceremony_loop(void) { func_8001C14C(); update_vehicles(); } - func_80281D00(); + render_podium_ceremony(); func_80281540(); #if DVDL display_dvdl(); diff --git a/src/main.c b/src/main.c index 3526b5d6b9..e6bcf30405 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "profiler.h" #include "main.h" @@ -123,8 +124,8 @@ f32 gCameraZoom[4]; // look like to be the fov of each character UNUSED s32 D_80150140; UNUSED s32 D_80150144; f32 gScreenAspect; -f32 D_8015014C; -f32 D_80150150; +f32 gCourseFarPersp; +f32 gCourseNearPersp; UNUSED f32 D_80150154; struct D_80150158 gD_80150158[16]; @@ -612,7 +613,7 @@ void race_logic_loop(void) { func_8028F474(); func_80059AC8(); update_course_actors(); - func_802966A0(); + course_update_water(); func_8028FCBC(); } func_80022744(); @@ -676,7 +677,7 @@ void race_logic_loop(void) { func_8028F474(); func_80059AC8(); update_course_actors(); - func_802966A0(); + course_update_water(); func_8028FCBC(); } func_80022744(); @@ -722,7 +723,7 @@ void race_logic_loop(void) { func_8028F474(); func_80059AC8(); update_course_actors(); - func_802966A0(); + course_update_water(); func_8028FCBC(); } func_80022744(); @@ -794,7 +795,7 @@ void race_logic_loop(void) { func_8028F474(); func_80059AC8(); update_course_actors(); - func_802966A0(); + course_update_water(); func_8028FCBC(); } func_80022744(); @@ -1105,25 +1106,25 @@ void thread3_video(UNUSED void* arg0) { void func_800025D4(void) { func_80091B78(); gActiveScreenMode = SCREEN_MODE_1P; - func_802A4D18(); + set_perspective_and_aspect_ratio(); } void func_80002600(void) { func_80091B78(); gActiveScreenMode = SCREEN_MODE_1P; - func_802A4D18(); + set_perspective_and_aspect_ratio(); } void func_8000262C(void) { func_80091B78(); gActiveScreenMode = SCREEN_MODE_1P; - func_802A4D18(); + set_perspective_and_aspect_ratio(); } void func_80002658(void) { func_80091B78(); gActiveScreenMode = SCREEN_MODE_1P; - func_802A4D18(); + set_perspective_and_aspect_ratio(); } /** diff --git a/src/main.h b/src/main.h index e57e334594..6d7ac7aac2 100644 --- a/src/main.h +++ b/src/main.h @@ -167,8 +167,6 @@ extern s32 gGotoMode; extern f32 gCameraZoom[]; extern f32 gScreenAspect; -extern f32 D_8015014C; -extern f32 D_80150150; extern struct D_80150158 gD_80150158[]; extern uintptr_t gSegmentTable[]; diff --git a/src/menus.c b/src/menus.c index 8faeeab7bb..ccd66d621e 100644 --- a/src/menus.c +++ b/src/menus.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "menus.h" #include "main.h" @@ -40,9 +41,9 @@ f32 gIntroModelPosY; f32 gIntroModelPosZ; s32 gMenuFadeType; -s8 gCharacterGridSelections[4]; // Map from each player to current grid position (1-4 top, 5-8 bottom) +s8 gCharacterGridSelections[4]; // Map from each player to current grid position (1-4 top, 5-8 bottom) bool8 gCharacterGridIsSelected[4]; // Sets true if a character is selected for each player -s8 gSubMenuSelection; // Map Select states, Options and Ghost Data text selection +s8 gSubMenuSelection; // Map Select states, Options and Ghost Data text selection s8 gMainMenuSelection; s8 gPlayerSelectMenuSelection; s8 gDebugMenuSelection; @@ -50,11 +51,12 @@ s8 gControllerPakMenuSelection; s8 gScreenModeListIndex; // 0-4 index, selects a screen mode in sScreenModePlayerTable u8 gSoundMode; s8 gPlayerCount; -s8 gVersusResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option -s8 gTimeTrialsResultCursorSelection; // 5 options indexed (5-9), gets set when selecting an option (excluding Save Ghost) -s8 gBattleResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option +s8 gVersusResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option +s8 gTimeTrialsResultCursorSelection; // 5 options indexed (5-9), gets set when selecting an option (excluding Save + // Ghost) +s8 gBattleResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option s8 gTimeTrialDataCourseIndex; -s8 gCourseRecordsMenuSelection; // Used for selecting an option in course record data +s8 gCourseRecordsMenuSelection; // Used for selecting an option in course record data s8 gCourseRecordsSubMenuSelection; // Used for erase records and ghosts (Quit - Erase) s8 gDebugGotoScene; bool8 gGhostPlayerInit; @@ -99,13 +101,9 @@ u32 sVIGammaOffDitherOn = (OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); /** RoData **/ // Sets the actual screen mode based on values set in sScreenModePlayerCount -const s8 sScreenModePlayerTable[] = { - SCREEN_MODE_1P, - SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL, - SCREEN_MODE_2P_SPLITSCREEN_VERTICAL, - SCREEN_MODE_3P_4P_SPLITSCREEN, - SCREEN_MODE_3P_4P_SPLITSCREEN -}; +const s8 sScreenModePlayerTable[] = { SCREEN_MODE_1P, SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL, + SCREEN_MODE_2P_SPLITSCREEN_VERTICAL, SCREEN_MODE_3P_4P_SPLITSCREEN, + SCREEN_MODE_3P_4P_SPLITSCREEN }; // Sets how many players can load on each screen mode set in sScreenModePlayerTable const s8 sScreenModePlayerCount[] = { 1, 2, 2, 3, 4 }; @@ -141,8 +139,7 @@ const s32 gGameModePlayerSelection[][3] = { // Map from character grid position id to character id // Note: changing order doesn't affect graphics, only the selection const s8 sCharacterGridOrder[] = { - MARIO, LUIGI, PEACH, TOAD, - YOSHI, DK, WARIO, BOWSER, + MARIO, LUIGI, PEACH, TOAD, YOSHI, DK, WARIO, BOWSER, }; const s16 gCupCourseOrder[5][4] = { @@ -450,7 +447,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { } case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: { - if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_COPY_PAK_FROM_GHOST_MAX) && (sp30[PLAYER_TWO].ghostDataSaved)) { + if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_COPY_PAK_FROM_GHOST_MAX) && + (sp30[PLAYER_TWO].ghostDataSaved)) { gSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { @@ -458,7 +456,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { } sp38->unk8 = 1; } - if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_COPY_PAK_FROM_GHOST_MIN) && sp30[PLAYER_ONE].ghostDataSaved) { + if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_COPY_PAK_FROM_GHOST_MIN) && + sp30[PLAYER_ONE].ghostDataSaved) { gSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { @@ -473,7 +472,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { } if (btnAndStick & A_BUTTON) { sp38->unk20 = gSubMenuSelection - SUB_MENU_COPY_PAK_FROM_GHOST_MIN; - if (sp30[sp38->unk20].courseIndex == D_8018EE10[PLAYER_TWO].courseIndex && D_8018EE10[PLAYER_TWO].ghostDataSaved) { + if (sp30[sp38->unk20].courseIndex == D_8018EE10[PLAYER_TWO].courseIndex && + D_8018EE10[PLAYER_TWO].ghostDataSaved) { gSubMenuSelection = SUB_MENU_COPY_PAK_TO_GHOST2_2P; } else { gSubMenuSelection = SUB_MENU_COPY_PAK_TO_GHOST1_2P; @@ -485,7 +485,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { case SUB_MENU_COPY_PAK_TO_GHOST1_2P: case SUB_MENU_COPY_PAK_TO_GHOST2_2P: { // bit of a fake match, but if it works it works? - if ((sp30[sp38->unk20].courseIndex != ((0, (D_8018EE10 + (gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN))->courseIndex))) || + if ((sp30[sp38->unk20].courseIndex != + ((0, (D_8018EE10 + (gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN))->courseIndex))) || ((D_8018EE10 + (gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN))->ghostDataSaved == 0)) { if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_COPY_PAK_TO_GHOST_MAX)) { gSubMenuSelection += 1; @@ -725,7 +726,8 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 controllerId sp28 = find_8018D9E0_entry_dupe(0xE8); sp24 = &gSaveData.allCourseTimeTrialRecords.cupRecords[gTimeTrialDataCourseIndex / 4] .courseRecords[gTimeTrialDataCourseIndex % 4]; - if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && func_800B639C(gTimeTrialDataCourseIndex) < 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && + func_800B639C(gTimeTrialDataCourseIndex) < 0) { gCourseRecordsMenuSelection -= 1; } @@ -747,11 +749,13 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 controllerId if ((btnAndStick & D_JPAD) && (gCourseRecordsMenuSelection < COURSE_RECORDS_MENU_MAX)) { gCourseRecordsMenuSelection += 1; - if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_RECORDS && sp24->unknownBytes[0] == 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_RECORDS && + sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection += 1; } - if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && func_800B639C(gTimeTrialDataCourseIndex) < 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && + func_800B639C(gTimeTrialDataCourseIndex) < 0) { if (sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection = COURSE_RECORDS_MENU_RETURN_MENU; } else { @@ -934,7 +938,8 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 controlle return; } } - } else if (((btnAndStick & D_JPAD) != 0) && (gControllerPakScrollDirection == CONTROLLER_PAK_SCROLL_DIR_NONE)) { + } else if (((btnAndStick & D_JPAD) != 0) && + (gControllerPakScrollDirection == CONTROLLER_PAK_SCROLL_DIR_NONE)) { ++gControllerPakSelectedTableRow; if (gControllerPakSelectedTableRow >= CONTROLLER_PAK_MENU_TABLE_GAME_DATA) { gControllerPakSelectedTableRow = CONTROLLER_PAK_MENU_QUIT; @@ -1414,12 +1419,14 @@ void main_menu_act(struct Controller* controller, u16 controllerIdx) { if (btnAndStick & D_JPAD) { cursorMoved = false; if (func_800B555C()) { - if (subMode < sGameModePlayerColumnExtra[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { + if (subMode < + sGameModePlayerColumnExtra[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { cursorMoved = true; } } else { // L800B30D4 - if (subMode < sGameModePlayerColumnDefault[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { + if (subMode < + sGameModePlayerColumnDefault[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { cursorMoved = true; } } @@ -1569,8 +1576,7 @@ void player_select_menu_act(struct Controller* controller, u16 controllerIdx) { // L800B36F4 selected = false; for (i = 0; i < ARRAY_COUNT(gCharacterGridSelections); i++) { - if ((gCharacterGridSelections[i] != 0) && - (gCharacterGridIsSelected[i] == 0)) { + if ((gCharacterGridSelections[i] != 0) && (gCharacterGridIsSelected[i] == 0)) { selected = true; break; } @@ -1793,7 +1799,8 @@ void course_select_menu_act(struct Controller* arg0, u16 controllerIdx) { } break; case SUB_MENU_MAP_SELECT_OK: - if ((controllerIdx == PLAYER_ONE) && ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { + if ((controllerIdx == PLAYER_ONE) && + ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { play_sound2(SOUND_MENU_OK); } diff --git a/src/player_controller.c b/src/player_controller.c index b9108087e7..0401988766 100644 --- a/src/player_controller.c +++ b/src/player_controller.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "player_controller.h" #include "code_800029B0.h" @@ -245,6 +246,8 @@ void func_80027EDC(Player* player, s8 playerId) { UNUSED s32 pad; if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) && ((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) { + +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: if (((s16) gNearestWaypointByPlayerId[playerId] >= 0x19B) && @@ -375,7 +378,11 @@ void func_80027EDC(Player* player, s8 playerId) { default: break; } +#else + +#endif } else { +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: if (((s16) gNearestWaypointByPlayerId[playerId] >= 0x19B) && @@ -491,6 +498,9 @@ void func_80027EDC(Player* player, s8 playerId) { default: break; } +#else + +#endif } } @@ -2359,8 +2369,8 @@ void func_8002E4C4(Player* player) { player->kartHopJerk = 0.0f; player->kartHopAcceleration = 0.0f; player->kartHopVelocity = 0.0f; - player->pos[1] = spawn_actor_on_surface(player->pos[0], D_80164510[player_index] + 10.0f, player->pos[2]) + - player->boundingBoxSize; + player->pos[1] = + get_surface_height(player->pos[0], D_80164510[player_index] + 10.0f, player->pos[2]) + player->boundingBoxSize; if (((player->pos[1] - D_80164510[player_index]) > 1200.0f) || ((player->pos[1] - D_80164510[player_index]) < -1200.0f)) { player->pos[1] = player->oldPos[1]; diff --git a/src/racing/actors.c b/src/racing/actors.c index 1e7ee087ad..e602490239 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -981,7 +981,7 @@ void spawn_all_item_boxes(struct ActorSpawnData* spawnData) { startingRot[1] = random_u16(); startingRot[2] = random_u16(); temp_s1 = add_actor_to_empty_slot(startingPos, startingRot, startingVelocity, ACTOR_ITEM_BOX); - temp_f0 = spawn_actor_on_surface(startingPos[0], startingPos[1] + 10.0f, startingPos[2]); + temp_f0 = get_surface_height(startingPos[0], startingPos[1] + 10.0f, startingPos[2]); // Should be struct ItemBox but not enough space in the stack. // It's either the ItemBox or the SEGMENT/OFFSET variables. @@ -1053,6 +1053,7 @@ void spawn_course_actors(void) { struct RailroadCrossing* rrxing; gNumPermanentActors = 0; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: spawn_foliage(d_course_mario_raceway_tree_spawns); @@ -1172,6 +1173,9 @@ void spawn_course_actors(void) { spawn_all_item_boxes(d_course_big_donut_item_box_spawns); break; } +#else + +#endif gNumPermanentActors = gNumActors; } @@ -1208,6 +1212,7 @@ void init_actors_and_load_textures(void) { dma_textures(gTextureFinishLineBanner8, 0x0000025BU, 0x00000800U); dma_textures(gTexture671A88, 0x00000400U, 0x00000800U); dma_textures(gTexture6774D8, 0x00000400U, 0x00000800U); +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U); @@ -1275,6 +1280,9 @@ void init_actors_and_load_textures(void) { dma_textures(gTextureDksJungleParkwayKiwanoFruit3, 0x00000364U, 0x00000400U); break; } +#else + +#endif init_red_shell_texture(); destroy_all_actors(); spawn_course_actors(); diff --git a/src/racing/actors.h b/src/racing/actors.h index 7b51048ac0..4a7862f75c 100644 --- a/src/racing/actors.h +++ b/src/racing/actors.h @@ -125,7 +125,6 @@ extern u16 D_802BA260; // Box Truck sub-type? // end of definition of actor.c variables -extern s16 gCurrentCourseId; extern u16 isCrossingTriggeredByIndex[]; extern Lights1 D_800DC610[]; diff --git a/src/racing/collision.c b/src/racing/collision.c index 889ff7e951..5aa7133ad6 100644 --- a/src/racing/collision.c +++ b/src/racing/collision.c @@ -1,9 +1,11 @@ #include #include #include -#include #include +#include #include +#include + #include "main.h" #include "memory.h" #include "collision.h" @@ -871,8 +873,8 @@ s32 is_colliding_with_drivable_surface(Collision* collision, f32 boundingBoxSize /** * Wall collision */ -s32 is_colliding_with_wall2(Collision* arg, f32 boundingBoxSize, f32 x1, f32 y1, f32 z1, u16 surfaceIndex, f32 posX, - f32 posY, f32 posZ) { +s32 is_colliding_with_wall_z(Collision* arg, f32 boundingBoxSize, f32 x1, f32 y1, f32 z1, u16 surfaceIndex, f32 posX, + f32 posY, f32 posZ) { CollisionTriangle* triangle = &gCollisionMesh[surfaceIndex]; UNUSED s32 pad[6]; f32 x4; @@ -1053,8 +1055,8 @@ s32 is_colliding_with_wall2(Collision* arg, f32 boundingBoxSize, f32 x1, f32 y1, /** * This is actually more like colliding with face X/Y/Z */ -s32 is_colliding_with_wall1(Collision* arg, f32 boundingBoxSize, f32 x1, f32 y1, f32 z1, u16 surfaceIndex, f32 posX, - f32 posY, f32 posZ) { +s32 is_colliding_with_wall_x(Collision* arg, f32 boundingBoxSize, f32 x1, f32 y1, f32 z1, u16 surfaceIndex, f32 posX, + f32 posY, f32 posZ) { CollisionTriangle* triangle = &gCollisionMesh[surfaceIndex]; s32 b = 1; UNUSED s32 pad[7]; @@ -1267,15 +1269,15 @@ u16 actor_terrain_collision(Collision* collision, f32 boundingBoxSize, f32 newX, } if ((s32) collision->meshIndexYX < (s32) gCollisionMeshCount) { - if (is_colliding_with_wall2(collision, boundingBoxSize, newX, newY, newZ, collision->meshIndexYX, oldX, oldY, - oldZ) == COLLISION) { + if (is_colliding_with_wall_z(collision, boundingBoxSize, newX, newY, newZ, collision->meshIndexYX, oldX, oldY, + oldZ) == COLLISION) { flags |= FACING_Z_AXIS; } } if ((s32) collision->meshIndexZY < (s32) gCollisionMeshCount) { - if (is_colliding_with_wall1(collision, boundingBoxSize, newX, newY, newZ, collision->meshIndexZY, oldX, oldY, - oldZ) == COLLISION) { + if (is_colliding_with_wall_x(collision, boundingBoxSize, newX, newY, newZ, collision->meshIndexZY, oldX, oldY, + oldZ) == COLLISION) { flags |= FACING_X_AXIS; } } @@ -1334,16 +1336,16 @@ u16 actor_terrain_collision(Collision* collision, f32 boundingBoxSize, f32 newX, } else if ((gCollisionMesh[collisionIndex].flags & FACING_X_AXIS) != 0) { if ((flags & FACING_X_AXIS) == 0) { if (collisionIndex != collision->meshIndexZY) { - if (is_colliding_with_wall1(collision, boundingBoxSize, newX, newY, newZ, collisionIndex, oldX, - oldY, oldZ) == COLLISION) { + if (is_colliding_with_wall_x(collision, boundingBoxSize, newX, newY, newZ, collisionIndex, oldX, + oldY, oldZ) == COLLISION) { flags |= FACING_X_AXIS; } } } } else if ((flags & FACING_Z_AXIS) == 0) { if (collisionIndex != collision->meshIndexYX) { - if (is_colliding_with_wall2(collision, boundingBoxSize, newX, newY, newZ, collisionIndex, oldX, oldY, - oldZ) == COLLISION) { + if (is_colliding_with_wall_z(collision, boundingBoxSize, newX, newY, newZ, collisionIndex, oldX, oldY, + oldZ) == COLLISION) { flags |= FACING_Z_AXIS; } } @@ -1461,10 +1463,11 @@ u16 check_bounding_collision(Collision* collision, f32 boundingBoxSize, f32 posX extern u8 D_8014F1110; /** + * @brief Returns the height of the surface below the provided position. Used to set actors onto the course mesh. * If unable to spawn actor on the surface set to -3000.0f or * if outside the collision grid, spawn in the air (3000.0f). */ -f32 spawn_actor_on_surface(f32 posX, f32 posY, f32 posZ) { +f32 get_surface_height(f32 posX, f32 posY, f32 posZ) { f32 height; s16 sectionIndexX; s16 sectionIndexZ; @@ -2178,8 +2181,8 @@ u16 player_terrain_collision(Player* player, KartTyre* tyre, f32 tyre2X, f32 tyr tyreZ = tyre->pos[2]; switch (tyre->surfaceFlags) { case 0x80: - if (is_colliding_with_wall1(collision, boundingBoxSize, tyreX, tyreY, tyreZ, tyre->collisionMeshIndex, - tyre2X, tyre2Y, tyre2Z) == 1) { + if (is_colliding_with_wall_x(collision, boundingBoxSize, tyreX, tyreY, tyreZ, tyre->collisionMeshIndex, + tyre2X, tyre2Y, tyre2Z) == 1) { height = calculate_surface_height(tyreX, tyreY, tyreZ, tyre->collisionMeshIndex); if ((!(height > player->pos[1])) && !((player->pos[1] - height) > (2 * boundingBoxSize))) { tyre->baseHeight = height; @@ -2200,8 +2203,8 @@ u16 player_terrain_collision(Player* player, KartTyre* tyre, f32 tyre2X, f32 tyr } break; case 0x20: - if (is_colliding_with_wall2(collision, boundingBoxSize, tyreX, tyreY, tyreZ, tyre->collisionMeshIndex, - tyre2X, tyre2Y, tyre2Z) == 1) { + if (is_colliding_with_wall_z(collision, boundingBoxSize, tyreX, tyreY, tyreZ, tyre->collisionMeshIndex, + tyre2X, tyre2Y, tyre2Z) == 1) { height = calculate_surface_height(tyreX, tyreY, tyreZ, tyre->collisionMeshIndex); if (!(player->pos[1] < height) && !((2 * boundingBoxSize) < (player->pos[1] - height))) { tyre->baseHeight = height; @@ -2273,8 +2276,8 @@ u16 player_terrain_collision(Player* player, KartTyre* tyre, f32 tyre2X, f32 tyr } else if (gCollisionMesh[meshIndex].flags & FACING_X_AXIS) { if (gCollisionMesh[meshIndex].normalY != 0.0f) { if (meshIndex != tyre->collisionMeshIndex) { - if (is_colliding_with_wall1(collision, boundingBoxSize, tyreX, tyreY, tyreZ, meshIndex, tyre2X, - tyre2Y, tyre2Z) == 1) { + if (is_colliding_with_wall_x(collision, boundingBoxSize, tyreX, tyreY, tyreZ, meshIndex, tyre2X, + tyre2Y, tyre2Z) == 1) { height = calculate_surface_height(tyreX, tyreY, tyreZ, meshIndex); if (!(player->pos[1] < height) && !((2 * boundingBoxSize) < (player->pos[1] - height))) { tyre->baseHeight = height; @@ -2291,8 +2294,8 @@ u16 player_terrain_collision(Player* player, KartTyre* tyre, f32 tyre2X, f32 tyr } else { if (gCollisionMesh[meshIndex].normalY != 0.0f) { if (meshIndex != tyre->collisionMeshIndex) { - if (is_colliding_with_wall2(collision, boundingBoxSize, tyreX, tyreY, tyreZ, meshIndex, tyre2X, - tyre2Y, tyre2Z) == 1) { + if (is_colliding_with_wall_z(collision, boundingBoxSize, tyreX, tyreY, tyreZ, meshIndex, tyre2X, + tyre2Y, tyre2Z) == 1) { height = calculate_surface_height(tyreX, tyreY, tyreZ, meshIndex); if (!(player->pos[1] < height) && !((2 * boundingBoxSize) < (player->pos[1] - height))) { tyre->baseHeight = height; diff --git a/src/racing/collision.h b/src/racing/collision.h index dd1b6dfda7..8fbd4c037c 100644 --- a/src/racing/collision.h +++ b/src/racing/collision.h @@ -26,7 +26,7 @@ void adjust_pos_orthogonally(Vec3f, f32, Vec3f, f32); s32 detect_tyre_collision(KartTyre*); u16 actor_terrain_collision(Collision*, f32, f32, f32, f32, f32, f32, f32); u16 check_bounding_collision(Collision*, f32, f32, f32, f32); -f32 spawn_actor_on_surface(f32, f32, f32); +f32 get_surface_height(f32, f32, f32); void set_vtx_buffer(uintptr_t, u32, u32); s32 is_line_intersecting_rectangle(s16, s16, s16, s16, s16, s16, s16, s16); s32 is_triangle_intersecting_bounding_box(s16, s16, s16, s16, u16); diff --git a/src/racing/math_util.c b/src/racing/math_util.c index 2f7bd510ef..fb2770e3f9 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -420,10 +420,19 @@ void func_802B5CAC(s16 arg0, s16 arg1, Vec3f arg2) { } void func_802B5D30(s16 arg0, s16 arg1, s32 arg2) { - func_802B5D64((Lights1*) 0x9000000, arg0, arg1, arg2); + set_course_lighting((Lights1*) 0x9000000, arg0, arg1, arg2); } -void func_802B5D64(Lights1* addr, s16 arg1, s16 arg2, s32 arg3) { +/** + * @brief Set the course lighting object + * Uses a directional light + * + * @param addr + * @param arg1 + * @param arg2 + * @param arg3 + */ +void set_course_lighting(Lights1* addr, s16 arg1, s16 arg2, s32 arg3) { u32 segment = SEGMENT_NUMBER2(addr); u32 offset = SEGMENT_OFFSET(addr); UNUSED s32 pad; @@ -1175,7 +1184,7 @@ 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 +// its impossible to know with certainty either way, very close of set_course_lighting 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); diff --git a/src/racing/math_util.h b/src/racing/math_util.h index ddf73471b8..7898dca7bd 100644 --- a/src/racing/math_util.h +++ b/src/racing/math_util.h @@ -40,7 +40,7 @@ void mtxf_s16_rotate_z(Mat4, s16); void func_802B5B14(Vec3f b, Vec3s rotate); // unused void func_802B5CAC(s16, s16, Vec3f); void func_802B5D30(s16, s16, s32); -void func_802B5D64(Lights1*, s16, s16, s32); +void set_course_lighting(Lights1*, s16, s16, s32); void mtxf_scale(Mat4, f32); void mtxf_pos_rotation_xyz(Mat4, Vec3f, Vec3s); void mtxf_translate_vec3f_mat3(Vec3f, Mat3); diff --git a/src/racing/race_logic.c b/src/racing/race_logic.c index 33d61cdc1d..66d47d08a8 100644 --- a/src/racing/race_logic.c +++ b/src/racing/race_logic.c @@ -1,9 +1,11 @@ #include #include -#include #include #include #include +#include +#include + #include "camera.h" #include "waypoints.h" #include "staff_ghosts.h" @@ -422,48 +424,48 @@ void func_8028EC98(s32 arg0) { func_800029B0(); switch (arg0) { - case 0: - case 7: - case 8: - case 14: + case COURSE_MARIO_RACEWAY: + case COURSE_ROYAL_RACEWAY: + case COURSE_LUIGI_RACEWAY: + case COURSE_WARIO_STADIUM: func_800C8EAC(3); break; - case 10: + case COURSE_TOADS_TURNPIKE: func_800C8EAC(21); break; - case 4: - case 9: + case COURSE_YOSHI_VALLEY: + case COURSE_MOO_MOO_FARM: func_800C8EAC(4); break; - case 1: - case 15: - case 17: + case COURSE_CHOCO_MOUNTAIN: + case COURSE_BLOCK_FORT: + case COURSE_DOUBLE_DECK: func_800C8EAC(5); break; - case 11: + case COURSE_KALAMARI_DESERT: func_800C8EAC(10); break; - case 6: + case COURSE_KOOPA_BEACH: func_800C8EAC(6); break; - case 2: + case COURSE_BOWSER_CASTLE: func_800C8EAC(9); break; - case 3: + case COURSE_BANSHEE_BOARDWALK: func_800C8EAC(7); break; - case 5: - case 12: + case COURSE_FRAPPE_SNOWLAND: + case COURSE_SHERBET_LAND: func_800C8EAC(8); break; - case 13: + case COURSE_RAINBOW_ROAD: func_800C8EAC(18); break; - case 18: + case COURSE_DK_JUNGLE: func_800C8EAC(19); break; - case 16: - case 19: + case COURSE_SKYSCRAPER: + case COURSE_BIG_DONUT: func_800C8EAC(25); break; } diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index 2a3e789aa5..4cb202acb8 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -947,7 +947,7 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC* arg0) { s16 temp_s0 = arg0->pathCounter; s16 playerDirection = arg0->playerDirection; - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -1012,7 +1012,7 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC* arg0) { void render_toads_turnpike(struct UnkStruct_800DC5EC* arg0) { UNUSED s32 pad[13]; - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -1039,7 +1039,7 @@ void render_toads_turnpike(struct UnkStruct_800DC5EC* arg0) { void render_kalimari_desert(struct UnkStruct_800DC5EC* arg0) { - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -1168,7 +1168,7 @@ void render_wario_stadium(struct UnkStruct_800DC5EC* arg0) { void render_block_fort(UNUSED struct UnkStruct_800DC5EC* arg0) { - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -1177,7 +1177,7 @@ void render_block_fort(UNUSED struct UnkStruct_800DC5EC* arg0) { } void render_skyscraper(UNUSED struct UnkStruct_800DC5EC* arg0) { - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -1201,7 +1201,7 @@ void render_skyscraper(UNUSED struct UnkStruct_800DC5EC* arg0) { void render_double_deck(UNUSED struct UnkStruct_800DC5EC* arg0) { - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -1213,8 +1213,8 @@ void render_double_deck(UNUSED struct UnkStruct_800DC5EC* arg0) { void render_dks_jungle_parkway(struct UnkStruct_800DC5EC* arg0) { - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); - func_802B5D64(&D_800DC610[1], D_802B87D4, D_802B87D0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(&D_800DC610[1], D_802B87D4, D_802B87D0, 1); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK | G_LIGHTING); @@ -1239,7 +1239,7 @@ void render_big_donut(struct UnkStruct_800DC5EC* arg0) { gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); @@ -1259,7 +1259,13 @@ void render_big_donut(struct UnkStruct_800DC5EC* arg0) { gSPDisplayList(gDisplayListHead++, ((uintptr_t) 0x07000230)); } -void func_8029569C(void) { +/** + * @brief The game has two versions of each course. One for normal gameplay and another for credits. + * The credits version is not split into segments so that the game camera can fly around the whole course. + * + */ +void render_course_credits(void) { +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_dl_9348); @@ -1322,16 +1328,20 @@ void func_8029569C(void) { gSPDisplayList(gDisplayListHead++, d_course_sherbet_land_dl_0); break; } +#else + +#endif } void render_course(struct UnkStruct_800DC5EC* arg0) { - func_802B5D64(D_800DC610, D_802B87D4, 0, 1); + set_course_lighting(D_800DC610, D_802B87D4, 0, 1); if (creditsRenderMode) { - func_8029569C(); + render_course_credits(); return; } +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: render_mario_raceway(arg0); @@ -1394,6 +1404,9 @@ void render_course(struct UnkStruct_800DC5EC* arg0) { render_big_donut(arg0); break; } +#else + +#endif } void func_80295BF8(s32 playerIndex) { @@ -1431,7 +1444,11 @@ void func_80295D6C(void) { D_8015F6F6 = -3000; } -void func_80295D88(void) { +/** + * @brief Also sets vertex colours for the course vtx data + * + */ +void course_generate_collision_mesh(void) { gNumActors = 0; gCourseMinX = 0; @@ -1450,6 +1467,7 @@ void func_80295D88(void) { gCollisionMesh = (CollisionTriangle*) gNextFreeMemoryAddress; D_800DC5BC = 0; D_800DC5C8 = 0; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: // d_course_mario_raceway_packed_dl_1140 @@ -1514,7 +1532,7 @@ void func_80295D88(void) { D_8015F8E4 = -80.0f; break; case COURSE_YOSHI_VALLEY: - func_802B5D64(&d_course_yoshi_valley_lights4, -0x38F0, 0x1C70, 1); + set_course_lighting(&d_course_yoshi_valley_lights4, -0x38F0, 0x1C70, 1); parse_course_displaylists((uintptr_t) d_course_yoshi_valley_addr); func_80295C6C(); D_8015F8E4 = gCourseMinY - 10.0f; @@ -1655,10 +1673,13 @@ void func_80295D88(void) { D_8015F8E4 = 100.0f; break; } -} +#else -void func_802966A0(void) { +#endif +} +void course_update_water(void) { +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_KOOPA_BEACH: // clang-format off @@ -1735,6 +1756,9 @@ void func_802966A0(void) { evaluate_collision_players_palm_trees(); break; } +#else + +#endif } void func_802969F8(void) { diff --git a/src/racing/render_courses.h b/src/racing/render_courses.h index 3d9b1df475..3932663648 100644 --- a/src/racing/render_courses.h +++ b/src/racing/render_courses.h @@ -28,14 +28,14 @@ void render_skyscraper(struct UnkStruct_800DC5EC*); void render_double_deck(struct UnkStruct_800DC5EC*); void render_dks_jungle_parkway(struct UnkStruct_800DC5EC*); void render_big_donut(struct UnkStruct_800DC5EC*); -void func_8029569C(void); +void render_course_credits(void); void render_course(struct UnkStruct_800DC5EC*); void func_80295BF8(s32); void func_80295C6C(void); void func_80295D50(s16, s16); void func_80295D6C(void); -void func_80295D88(void); -void func_802966A0(void); +void course_generate_collision_mesh(void); +void course_update_water(void); void func_802969F8(void); extern s32 D_8015F59C; diff --git a/src/racing/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c index 25a45c4416..281cedda36 100644 --- a/src/racing/skybox_and_splitscreen.c +++ b/src/racing/skybox_and_splitscreen.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "skybox_and_splitscreen.h" #include "code_800029B0.h" @@ -309,14 +310,18 @@ void func_802A4300(void) { gDPPipeSync(gDisplayListHead++); gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); } - +/** + * @note that the second half of the s16 value is truncated (unused). So if you want red, put 255. But the original + * programmers might have put something like `42,239`, in bytes: b1010010011111111 The extra bits are skipped and the + * game only reads `11111111` (255) + */ struct Skybox { - s16 unk0; - s16 unk2; - s16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; + s16 topRed; + s16 topGreen; + s16 topBlue; + s16 bottomRed; + s16 bottomGreen; + s16 bottomBlue; }; UNUSED Gfx D_802B8A90[] = { @@ -330,12 +335,12 @@ UNUSED Gfx D_802B8A90[] = { gsSPEndDisplayList(), }; -struct Skybox sSkyColors[] = { +struct Skybox sTopSkyBoxColors[] = { #include "assets/course_metadata/sSkyColors.inc.c" }; -// struct Skybox sSkyColors[] = { +// struct Skybox sTopSkyBoxColors[] = { // {128, 4280, 6136, 216, 7144, 32248}, // {255, 255, 255, 255, 255, 255}, // {48, 1544, 49528, 0, 0, 0}, @@ -359,11 +364,11 @@ struct Skybox sSkyColors[] = { // {238, 144, 255, 255, 224, 240}, // }; -struct Skybox sSkyColors2[] = { +struct Skybox sBottomSkyBoxColors[] = { #include "assets/course_metadata/sSkyColors2.inc.c" }; -void func_802A450C(Vtx* skybox) { +void course_set_skybox_colours(Vtx* skybox) { s32 i; if (D_800DC5BC != 0) { @@ -400,30 +405,42 @@ void func_802A450C(Vtx* skybox) { } return; } - skybox[0].v.cn[0] = sSkyColors[gCurrentCourseId].unk0; - skybox[0].v.cn[1] = sSkyColors[gCurrentCourseId].unk2; - skybox[0].v.cn[2] = sSkyColors[gCurrentCourseId].unk4; - skybox[1].v.cn[0] = sSkyColors[gCurrentCourseId].unk6; - skybox[1].v.cn[1] = sSkyColors[gCurrentCourseId].unk8; - skybox[1].v.cn[2] = sSkyColors[gCurrentCourseId].unkA; - skybox[2].v.cn[0] = sSkyColors[gCurrentCourseId].unk6; - skybox[2].v.cn[1] = sSkyColors[gCurrentCourseId].unk8; - skybox[2].v.cn[2] = sSkyColors[gCurrentCourseId].unkA; - skybox[3].v.cn[0] = sSkyColors[gCurrentCourseId].unk0; - skybox[3].v.cn[1] = sSkyColors[gCurrentCourseId].unk2; - skybox[3].v.cn[2] = sSkyColors[gCurrentCourseId].unk4; - skybox[4].v.cn[0] = sSkyColors2[gCurrentCourseId].unk0; - skybox[4].v.cn[1] = sSkyColors2[gCurrentCourseId].unk2; - skybox[4].v.cn[2] = sSkyColors2[gCurrentCourseId].unk4; - skybox[5].v.cn[0] = sSkyColors2[gCurrentCourseId].unk6; - skybox[5].v.cn[1] = sSkyColors2[gCurrentCourseId].unk8; - skybox[5].v.cn[2] = sSkyColors2[gCurrentCourseId].unkA; - skybox[6].v.cn[0] = sSkyColors2[gCurrentCourseId].unk6; - skybox[6].v.cn[1] = sSkyColors2[gCurrentCourseId].unk8; - skybox[6].v.cn[2] = sSkyColors2[gCurrentCourseId].unkA; - skybox[7].v.cn[0] = sSkyColors2[gCurrentCourseId].unk0; - skybox[7].v.cn[1] = sSkyColors2[gCurrentCourseId].unk2; - skybox[7].v.cn[2] = sSkyColors2[gCurrentCourseId].unk4; + +#if !ENABLE_CUSTOM_COURSE_ENGINE + skybox[0].v.cn[0] = sTopSkyBoxColors[gCurrentCourseId].topRed; + skybox[0].v.cn[1] = sTopSkyBoxColors[gCurrentCourseId].topGreen; + skybox[0].v.cn[2] = sTopSkyBoxColors[gCurrentCourseId].topBlue; + + skybox[1].v.cn[0] = sTopSkyBoxColors[gCurrentCourseId].bottomRed; + skybox[1].v.cn[1] = sTopSkyBoxColors[gCurrentCourseId].bottomGreen; + skybox[1].v.cn[2] = sTopSkyBoxColors[gCurrentCourseId].bottomBlue; + + skybox[2].v.cn[0] = sTopSkyBoxColors[gCurrentCourseId].bottomRed; + skybox[2].v.cn[1] = sTopSkyBoxColors[gCurrentCourseId].bottomGreen; + skybox[2].v.cn[2] = sTopSkyBoxColors[gCurrentCourseId].bottomBlue; + + skybox[3].v.cn[0] = sTopSkyBoxColors[gCurrentCourseId].topRed; + skybox[3].v.cn[1] = sTopSkyBoxColors[gCurrentCourseId].topGreen; + skybox[3].v.cn[2] = sTopSkyBoxColors[gCurrentCourseId].topBlue; + + skybox[4].v.cn[0] = sBottomSkyBoxColors[gCurrentCourseId].topRed; + skybox[4].v.cn[1] = sBottomSkyBoxColors[gCurrentCourseId].topGreen; + skybox[4].v.cn[2] = sBottomSkyBoxColors[gCurrentCourseId].topBlue; + + skybox[5].v.cn[0] = sBottomSkyBoxColors[gCurrentCourseId].bottomRed; + skybox[5].v.cn[1] = sBottomSkyBoxColors[gCurrentCourseId].bottomGreen; + skybox[5].v.cn[2] = sBottomSkyBoxColors[gCurrentCourseId].bottomBlue; + + skybox[6].v.cn[0] = sBottomSkyBoxColors[gCurrentCourseId].bottomRed; + skybox[6].v.cn[1] = sBottomSkyBoxColors[gCurrentCourseId].bottomGreen; + skybox[6].v.cn[2] = sBottomSkyBoxColors[gCurrentCourseId].bottomBlue; + + skybox[7].v.cn[0] = sBottomSkyBoxColors[gCurrentCourseId].topRed; + skybox[7].v.cn[1] = sBottomSkyBoxColors[gCurrentCourseId].topGreen; + skybox[7].v.cn[2] = sBottomSkyBoxColors[gCurrentCourseId].topBlue; +#else + +#endif } void func_802A487C(Vtx* arg0, UNUSED struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, UNUSED s32 arg3, @@ -457,11 +474,11 @@ void func_802A4A0C(Vtx* vtx, struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, U Vec3f sp5C; f32 sp58; - func_802A450C(vtx); + course_set_skybox_colours(vtx); sp5C[0] = 0.0f; sp5C[1] = 0.0f; sp5C[2] = 30000.0f; - func_802B5564(matrix1, &sp128, camera->unk_B4, gScreenAspect, D_80150150, D_8015014C, 1.0f); + func_802B5564(matrix1, &sp128, camera->unk_B4, gScreenAspect, gCourseNearPersp, gCourseFarPersp, 1.0f); func_802B5794(matrix2, camera->pos, camera->lookAt); mtxf_multiplication(matrix3, matrix1, matrix2); @@ -500,10 +517,10 @@ void func_802A4A0C(Vtx* vtx, struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, U } } -void func_802A4D18(void) { +void set_perspective_and_aspect_ratio(void) { if (gGamestate != 4) { - D_8015014C = 6800.0f; - D_80150150 = 3.0f; + gCourseFarPersp = 6800.0f; + gCourseNearPersp = 3.0f; } else { switch (gCurrentCourseId) { case COURSE_BOWSER_CASTLE: @@ -511,21 +528,21 @@ void func_802A4D18(void) { case COURSE_RAINBOW_ROAD: case COURSE_BLOCK_FORT: case COURSE_SKYSCRAPER: - D_8015014C = 2700.0f; - D_80150150 = 2.0f; + gCourseFarPersp = 2700.0f; + gCourseNearPersp = 2.0f; break; case COURSE_CHOCO_MOUNTAIN: case COURSE_DOUBLE_DECK: - D_8015014C = 1500.0f; - D_80150150 = 2.0f; + gCourseFarPersp = 1500.0f; + gCourseNearPersp = 2.0f; break; case COURSE_KOOPA_BEACH: - D_8015014C = 5000.0f; - D_80150150 = 1.0f; + gCourseFarPersp = 5000.0f; + gCourseNearPersp = 1.0f; break; case COURSE_WARIO_STADIUM: - D_8015014C = 4800.0f; - D_80150150 = 10.0f; + gCourseFarPersp = 4800.0f; + gCourseNearPersp = 10.0f; break; case COURSE_MARIO_RACEWAY: case COURSE_YOSHI_VALLEY: @@ -536,16 +553,16 @@ void func_802A4D18(void) { case COURSE_TOADS_TURNPIKE: case COURSE_SHERBET_LAND: case COURSE_DK_JUNGLE: - D_8015014C = 4500.0f; - D_80150150 = 9.0f; + gCourseFarPersp = 4500.0f; + gCourseNearPersp = 9.0f; break; case COURSE_KALAMARI_DESERT: - D_8015014C = 7000.0f; - D_80150150 = 10.0f; + gCourseFarPersp = 7000.0f; + gCourseNearPersp = 10.0f; break; default: - D_8015014C = 6800.0f; - D_80150150 = 3.0f; + gCourseFarPersp = 6800.0f; + gCourseNearPersp = 3.0f; break; } } @@ -785,9 +802,10 @@ void render_player_one_1p_screen(void) { gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH); gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]), @@ -847,9 +865,10 @@ void render_player_one_2p_screen_vertical(void) { func_802A3730(D_800DC5EC); gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]), @@ -913,9 +932,10 @@ void render_player_two_2p_screen_vertical(void) { #endif gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[1]), @@ -975,9 +995,10 @@ void render_player_one_2p_screen_horizontal(void) { #endif gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]), @@ -1038,9 +1059,10 @@ void render_player_two_2p_screen_horizontal(void) { #endif gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[1]), @@ -1097,9 +1119,10 @@ void render_player_one_3p_4p_screen(void) { func_802A3730(D_800DC5EC); gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[0], &perspNorm, gCameraZoom[0], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[0]), @@ -1156,9 +1179,10 @@ void render_player_two_3p_4p_screen(void) { func_802A3730(D_800DC5F0); gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[1], &perspNorm, gCameraZoom[1], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[1]), @@ -1216,9 +1240,10 @@ void render_player_three_3p_4p_screen(void) { gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[2], &perspNorm, gCameraZoom[2], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[2], &perspNorm, gCameraZoom[2], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[2], &perspNorm, gCameraZoom[2], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[2], &perspNorm, gCameraZoom[2], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[2]), @@ -1285,9 +1310,10 @@ void render_player_four_3p_4p_screen(void) { gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); #ifdef VERSION_EU - guPerspective(&gGfxPool->mtxPersp[3], &perspNorm, gCameraZoom[3], sp9C, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[3], &perspNorm, gCameraZoom[3], sp9C, gCourseNearPersp, gCourseFarPersp, 1.0f); #else - guPerspective(&gGfxPool->mtxPersp[3], &perspNorm, gCameraZoom[3], gScreenAspect, D_80150150, D_8015014C, 1.0f); + guPerspective(&gGfxPool->mtxPersp[3], &perspNorm, gCameraZoom[3], gScreenAspect, gCourseNearPersp, gCourseFarPersp, + 1.0f); #endif gSPPerspNormalize(gDisplayListHead++, perspNorm); gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPersp[3]), diff --git a/src/racing/skybox_and_splitscreen.h b/src/racing/skybox_and_splitscreen.h index f3067074e6..fee41aa4b3 100644 --- a/src/racing/skybox_and_splitscreen.h +++ b/src/racing/skybox_and_splitscreen.h @@ -28,9 +28,9 @@ s32 set_viewport2(void); void set_viewport(void); void select_framebuffer(void); void func_802A4300(void); -void func_802A450C(Vtx*); +void course_set_skybox_colours(Vtx*); void func_802A487C(Vtx*, struct UnkStruct_800DC5EC*, s32, s32, f32*); -void func_802A4D18(void); +void set_perspective_and_aspect_ratio(void); void func_802A4EF4(void); void func_802A5004(void); void func_802A50EC(void); diff --git a/src/render_objects.c b/src/render_objects.c index 4a8769fa17..260ab35fac 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -2425,13 +2425,13 @@ void func_8004ED40(s32 arg0) { void func_8004EE54(s32 arg0) { if (gIsMirrorMode != 0) { - func_8004D4E8(D_8018D2C0[arg0] + D_8018D2F0, D_8018D2D8[arg0] + D_8018D2F8, (u8*) D_8018D240, (s32) D_8018D300, - (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) D_8018D2B0, (s32) D_8018D2B8, - (s32) D_8018D2B0, (s32) D_8018D2B8); + func_8004D4E8(gMiniMapFinishLineX[arg0] + D_8018D2F0, gMiniMapFinishLineY[arg0] + D_8018D2F8, (u8*) D_8018D240, + (s32) D_8018D300, (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) D_8018D2B0, + (s32) D_8018D2B8, (s32) D_8018D2B0, (s32) D_8018D2B8); } else { - func_8004D37C(D_8018D2C0[arg0] + D_8018D2F0, D_8018D2D8[arg0] + D_8018D2F8, (u8*) D_8018D240, (s32) D_8018D300, - (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) D_8018D2B0, (s32) D_8018D2B8, - (s32) D_8018D2B0, (s32) D_8018D2B8); + func_8004D37C(gMiniMapFinishLineX[arg0] + D_8018D2F0, gMiniMapFinishLineY[arg0] + D_8018D2F8, (u8*) D_8018D240, + (s32) D_8018D300, (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) D_8018D2B0, + (s32) D_8018D2B8, (s32) D_8018D2B0, (s32) D_8018D2B8); } } @@ -2445,12 +2445,13 @@ void func_8004EF9C(s32 arg0) { temp_t0, temp_v0, temp_t0); } -void func_8004F020(s32 arg0) { +void render_mini_map_finish_line(s32 arg0) { f32 var_f0; f32 var_f2; - var_f2 = ((D_8018D2C0[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + D_8018D2E0; - var_f0 = ((D_8018D2D8[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + D_8018D2E8; + var_f2 = ((gMiniMapFinishLineX[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + gMiniMapX; + var_f0 = ((gMiniMapFinishLineY[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + gMiniMapY; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { /* irregular */ case COURSE_MARIO_RACEWAY: var_f0 = var_f0 - 2.0; @@ -2463,6 +2464,9 @@ void func_8004F020(s32 arg0) { break; } draw_hud_2d_texture_8x8(var_f2, var_f0, (u8*) common_texture_minimap_finish_line); +#else + +#endif } #ifdef NON_MATCHING @@ -2479,10 +2483,10 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) { Player* player = &gPlayerOne[playerId]; if (player->type & (1 << 15)) { - thing0 = player->pos[0] * D_8018D2A0; - thing1 = player->pos[2] * D_8018D2A0; - temp_a0 = ((D_8018D2C0[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + D_8018D2E0 + (s16) (thing0); - temp_a1 = ((D_8018D2D8[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + D_8018D2E8 + (s16) (thing1); + thing0 = player->pos[0] * gMiniMapMarkerScale; + thing1 = player->pos[2] * gMiniMapMarkerScale; + temp_a0 = ((gMiniMapFinishLineX[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + gMiniMapX + (s16) (thing0); + temp_a1 = ((gMiniMapFinishLineY[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + gMiniMapY + (s16) (thing1); if (characterId != 8) { if ((gGPCurrentRaceRankByPlayerId[playerId] == 0) && (gModeSelection != 3) && (gModeSelection != 1)) { #if EXPLICIT_AND == 1 @@ -3179,16 +3183,16 @@ void func_80051C60(s16 arg0, s32 arg1) { Object* object; if (D_801658FE == 0) { - if (gCurrentCourseId == 6) { + if (gCurrentCourseId == COURSE_KOOPA_BEACH) { var_s5 = arg0; - } else if (gCurrentCourseId == 9) { + } else if (gCurrentCourseId == COURSE_MOO_MOO_FARM) { var_s5 = arg0 - 0x10; - } else if (gCurrentCourseId == 4) { + } else if (gCurrentCourseId == COURSE_YOSHI_VALLEY) { var_s5 = arg0 - 0x10; } else { var_s5 = arg0 + 0x10; } - } else if (gCurrentCourseId == 6) { + } else if (gCurrentCourseId == COURSE_KOOPA_BEACH) { var_s5 = arg0 * 2; } else { var_s5 = arg0 + 0x20; diff --git a/src/render_objects.h b/src/render_objects.h index ed0419a952..0dd7974a8e 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -294,7 +294,7 @@ void func_8004ED40(s32); void func_8004EE54(s32); void func_8004EF9C(s32); -void func_8004F020(s32); +void render_mini_map_finish_line(s32); void func_8004F168(s32, s32, s32); void func_8004F3E4(s32); s32 func_8004F674(s32*, s32); @@ -441,8 +441,8 @@ extern Vec3su D_80183E80; extern f32 D_8018CFEC; extern f32 D_8018CFF4; -extern s16 D_8018D2E0; -extern s16 D_8018D2E8; +extern s16 gMiniMapX; +extern s16 gMiniMapY; extern u8* D_8018D4BC; extern u8* D_8018D4C0; diff --git a/src/render_player.c b/src/render_player.c index a4a7809ee9..5624ac9996 100644 --- a/src/render_player.c +++ b/src/render_player.c @@ -1,8 +1,10 @@ #include #include -#include #include #include +#include +#include + #include "code_800029B0.h" #include "camera.h" #include "math_util.h" diff --git a/src/spawn_players.c b/src/spawn_players.c index 24375c051b..a5cbe2b444 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -1,5 +1,6 @@ #include #include +#include #include "spawn_players.h" #include "code_800029B0.h" @@ -111,7 +112,7 @@ void spawn_player(Player* player, s8 playerIndex, f32 startingRow, f32 startingC } player->pos[0] = startingRow; - ret = spawn_actor_on_surface(startingRow, arg4 + 50.0f, startingColumn) + player->boundingBoxSize; + ret = get_surface_height(startingRow, arg4 + 50.0f, startingColumn) + player->boundingBoxSize; player->pos[2] = startingColumn; player->pos[1] = ret; player->oldPos[0] = startingRow; diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index 8a4b91bf37..080c49e3f9 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -1,9 +1,11 @@ #include #include -#include #include #include #include +#include +#include + #include "main.h" #include "code_800029B0.h" #include "buffers.h" @@ -106,7 +108,7 @@ void func_80004FF8(void) { void set_staff_ghost(void) { u32 temp_v0; // Appears to be player total lap time. - +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: temp_v0 = func_800B4E24(0) & 0xfffff; @@ -148,6 +150,9 @@ void set_staff_ghost(void) { D_80162DD6 = 1; D_80162DF4 = 1; } +#else + +#endif } s32 func_800051C4(void) { diff --git a/src/update_objects.c b/src/update_objects.c index 687d01e7d6..e3de096e8b 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -2831,7 +2831,7 @@ void update_stars(s32 arg0, Camera* camera, StarData* starList) { UNUSED void func_80078C68() { } -void func_80078C70(s32 arg0) { +void course_update_clouds(s32 arg0) { s32 sp1C; Camera* camera; @@ -2868,6 +2868,7 @@ void func_80078C70(s32 arg0) { D_8018D210 = (-(D_8018D200 / 2) * 0xB6) - 0x71C; D_8018D1E8 = 1.7578125 / D_8018D200; D_8018D218 = 0xA0; +#if !ENABLE_CUSTOM_COURSE_ENGINE switch (gCurrentCourseId) { /* switch 2 */ case COURSE_MARIO_RACEWAY: /* switch 2 */ // Uses Luigi Raceway's clouds for display purposes? @@ -2908,6 +2909,9 @@ void func_80078C70(s32 arg0) { break; } } +#else + +#endif } void func_80078F64(void) { @@ -2953,7 +2957,7 @@ void func_80079114(s32 objectIndex, s32 arg1, s32 arg2) { if (gObjectList[objectIndex].state >= 2) { if ((u8) gObjectList[objectIndex].unk_0D8 == 1) { if (arg1 == 0) { - func_80074894(objectIndex, D_8018C028); + func_80074894(objectIndex, gLakituTexturePtr); return; } a = gIndexLakituList[0]; @@ -2964,13 +2968,13 @@ void func_80079114(s32 objectIndex, s32 arg1, s32 arg2) { } switch (arg2) { case 0: - func_800748F4(objectIndex, D_8018C028); + func_800748F4(objectIndex, gLakituTexturePtr); break; case 1: - func_800748C4(objectIndex, D_8018C028); + func_800748C4(objectIndex, gLakituTexturePtr); break; case 2: - func_80074894(objectIndex, D_8018C028); + func_80074894(objectIndex, gLakituTexturePtr); break; } } @@ -3094,7 +3098,7 @@ void init_obj_lakitu_red_flag(s32 objectIndex, s32 playerIndex) { init_texture_object(objectIndex, (u8*) common_tlut_lakitu_checkered_flag, gTextureLakituCheckeredFlag01, 0x48U, (u16) 0x00000038); object = &gObjectList[objectIndex]; - object->activeTexture = D_8018C028; + object->activeTexture = gLakituTexturePtr; object->vertex = common_vtx_also_lakitu; object->pos[2] = 5000.0f; object->pos[1] = 5000.0f; @@ -3340,7 +3344,7 @@ void func_8007A060(s32 objectIndex, s32 playerIndex) { init_texture_object(objectIndex, (u8*) common_tlut_lakitu_second_lap, gTextureLakituSecondLap01, 0x48U, (u16) 0x00000038); object = &gObjectList[objectIndex]; - object->activeTexture = D_8018C028; + object->activeTexture = gLakituTexturePtr; object->vertex = common_vtx_also_lakitu; object->pos[2] = 5000.0f; object->pos[1] = 5000.0f; @@ -3389,7 +3393,7 @@ void func_8007A228(s32 objectIndex, s32 playerIndex) { init_texture_object(objectIndex, (u8*) common_tlut_lakitu_final_lap, gTextureLakituFinalLap01, 0x48U, (u16) 0x00000038); object = &gObjectList[objectIndex]; - object->activeTexture = D_8018C028; + object->activeTexture = gLakituTexturePtr; object->vertex = common_vtx_also_lakitu; object->pos[2] = 5000.0f; object->pos[1] = 5000.0f; @@ -3436,7 +3440,7 @@ void func_8007A3F0(s32 objectIndex, s32 arg1) { func_800791F0(objectIndex, arg1); init_texture_object(objectIndex, (u8*) common_tlut_lakitu_reverse, gTextureLakituReverse01, 0x48U, (u16) 0x00000038); - gObjectList[objectIndex].activeTexture = D_8018C028; + gObjectList[objectIndex].activeTexture = gLakituTexturePtr; gObjectList[objectIndex].vertex = common_vtx_also_lakitu; gObjectList[objectIndex].pos[2] = var; gObjectList[objectIndex].pos[1] = var; @@ -3584,7 +3588,7 @@ void func_8007AA44(s32 playerId) { func_8007A910(playerId); objectIndex = gIndexLakituList[playerId]; - D_8018C028 = D_80183FA8[playerId]; + gLakituTexturePtr = D_80183FA8[playerId]; switch (gObjectList[objectIndex].unk_0D8) { case 1: func_80079114(objectIndex, playerId, 2); @@ -6054,7 +6058,7 @@ void func_80080E8C(s32 objectIndex1, s32 objectIndex2, s32 arg2) { gObjectList[objectIndex1].velocity[2] = coss(anAngle) * 0.6; } #else -GLOBAL_ASM("asm/non_matchings/update_objects/func_80080E8C.s") + GLOBAL_ASM("asm/non_matchings/update_objects/func_80080E8C.s") #endif void func_80080FEC(s32 arg0) { @@ -6764,7 +6768,7 @@ void func_80082F1C(s32 objectIndex, s32 arg1) { set_obj_direction_angle(objectIndex, 0U, test->rot, 0U); } #else -GLOBAL_ASM("asm/non_matchings/update_objects/func_80082F1C.s") + GLOBAL_ASM("asm/non_matchings/update_objects/func_80082F1C.s") #endif void func_80083018(s32 objectIndex, s32 arg1) { @@ -7840,7 +7844,7 @@ void func_80086074(s32 objectIndex, s32 arg1) { func_80085BB4(objectIndex); } #else -GLOBAL_ASM("asm/non_matchings/update_objects/func_80086074.s") + GLOBAL_ASM("asm/non_matchings/update_objects/func_80086074.s") #endif void func_80086110(s32 objectIndex, s32 arg1) { diff --git a/src/update_objects.h b/src/update_objects.h index 2984b04348..94fc751265 100644 --- a/src/update_objects.h +++ b/src/update_objects.h @@ -181,7 +181,7 @@ void func_800788F8(s32, u16, Camera*); void update_clouds(s32, Camera*, CloudData*); void update_stars(s32, Camera*, StarData*); void func_80078C68(void); -void func_80078C70(s32); +void course_update_clouds(s32); void func_80078F64(void); void func_80079054(s32); void func_80079084(s32); From 1c957fb7b430b199fc5d168f111552e832a04142 Mon Sep 17 00:00:00 2001 From: coco875 <59367621+coco875@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:46:35 +0200 Subject: [PATCH 2/2] remove useless yaml file (#692) Co-authored-by: MegaMech --- tools/yaml/mk64.eu1.yaml | 250 ------------------------------- tools/yaml/mk64.us.yaml | 255 -------------------------------- tools/yaml/yamls are unused.txt | 0 3 files changed, 505 deletions(-) delete mode 100644 tools/yaml/mk64.eu1.yaml delete mode 100644 tools/yaml/mk64.us.yaml delete mode 100644 tools/yaml/yamls are unused.txt diff --git a/tools/yaml/mk64.eu1.yaml b/tools/yaml/mk64.eu1.yaml deleted file mode 100644 index cccee61b29..0000000000 --- a/tools/yaml/mk64.eu1.yaml +++ /dev/null @@ -1,250 +0,0 @@ -name: Mario Kart 64 EU 1.0 -sha1: a729039453210b84f17019dda3f248d5888f7690 -options: - basename: mk64.eu - target_path: baserom.eu.z64 - base_path: . - compiler: IDO - platform: n64 - target_path: baserom.eu.z64 - build_path: build/eu - find_file_boundaries: True - header_encoding: ASCII - ld_script_path: mk64.eu.ld - asset_path: assets/eu - # platform: n64 - # undefined_funcs_auto: True - # undefined_funcs_auto_path: undefined_funcs_auto.txt - # undefined_syms_auto: True - # undefined_syms_auto_path: undefined_syms_auto.txt - # symbol_addrs_path: symbol_addrs.txt - asm_path: asm/eu - # src_path: src - extensions_path: tools/splat_ext - mips_abi_float_regs: o32 - section_order: [".text", ".data", ".rodata", ".bss"] - # auto_all_sections: [".data", ".rodata", ".bss"] -segments: - - name: header - type: header - start: 0x0 - - name: boot - type: code - start: 0x40 - vram: 0xA4000040 - subsegments: - - [0x40, asm, boot] - - [0xB70, i1, rspboot_font1, 13, 14] - - [0xB87, i1, rspboot_font2, 13, 14] - - [0xB9E, bin, rspboot_font] - - name: main - type: code - bss_size: 0x18985C - start: 0x1000 - vram: 0x80000400 - subsegments: - - [0x1000, asm, entry] - - [0x1050, c, main] - - [0x3590, c, code_80002990] - - [0x4130, c, profiler] - - [0x4CA0, c, crash_screen] - - [0x5320, c, animation] - - [0x5AD0, c, staff_ghosts] - - [0x6B90, asm, unused_overflow_check] - - [0x6BB0, c, code_80005FD0] - - [0x1D0B0, c, camera] - - [0x20560, c, render_player] - - [0x27C20, c, kart_dma] - - [0x288E0, c, code_80027D00] - - [0x39FA0, c, spawn_players] - - [0x3E820, c, code_8003DC40] - - [0x40C10, asm, unused_mio0_decode] - - [0x40CB0, asm, mio0_decode] - - [0x411B0, asm, tkmk00_decode] - - [0x418E0, c, gbiMacro] - - [0x41A30, c, math_util_2] - - [0x43D90, c, code_800431B0] - - [0x58840, c, code_80057C60] - - [0x6F5A0, c, code_8006E9C0] - - [0x72AE0, c, update_objects] - - [0x87A50, c, code_80086E70] - - [0x8CDB0, c, effects] - - [0x920A0, c, code_800914A0] - - [0x92350, c, code_80091750] - - [0xB05B0, c, code_800AF9B0] - - [0xB0F50, c, menus] - - [0xB51E0, c, save] - - [0xB77F0, c, audio/synthesis] - - [0xB99E0, c, audio/heap] - - [0xBB680, c, audio/load] - - [0xBD170, c, audio/playback] - - [0xBEA30, c, audio/effects] - - [0xBF4D0, c, audio/seqplayer] - - [0xC2000, c, audio/external] - - [0xCBFC0, c, audio/port_eu] - - [0xCCC00, c, ../lib/src/osCreateThread] - - [0xCCD90, c, ../lib/src/osInitialize] - - [0xCD030, c, ../lib/src/osStartThread] - - [0xCD180, c, ../lib/src/osCreateViManager] - - [0xCD4E0, c, ../lib/src/osViSetMode] - - [0xCD550, c, ../lib/src/osViBlack] - - [0xCD5C0, c, ../lib/src/osViSetSpecialFeatures] - - [0xCD780, c, ../lib/src/osCreatePiManager] - - [0xCD910, c, ../lib/src/osSetThreadPri] - - [0xCD9F0, c, ../lib/src/osCreateMesgQueue] - - [0xCDA20, c, ../lib/src/osViSetEvent] - - [0xCDA90, c, ../lib/src/osSetEventMesg] - - [0xCDB00, c, ../lib/src/osSpTaskLoadGo] - - [0xCDDC0, c, ../lib/src/osContInit] - - [0xCE180, c, ../lib/src/osContStartReadData] - - [0xCE3E0, c, ../lib/src/osRecvMesg] - - [0xCE520, asm, ../lib/asm/osWritebackDCacheAll] - - [0xCE550, c, ../lib/src/osSendMesg] - - [0xCE6A0, c, ../lib/src/osViSwapBuffer] - - [0xCE6F0, asm, ../lib/asm/bzero] - - [0xCE790, asm, ../lib/asm/osInvalICache] - - [0xCE810, asm, ../lib/asm/osInvalDCache] - - [0xCE8C0, c, ../lib/src/osPiStartDma] - - [0xCE9D0, c, ../lib/src/osSpTaskYield] - - [0xCE9F0, c, ../lib/src/osSpTaskYielded] - - [0xCEA70, c, ../lib/src/osGetTime] - - [0xCEB00, c, ../lib/src/math/llmuldiv] - - [0xCEDC0, c, ../lib/src/__osGetCurrFaultedThread] - - [0xCEDD0, asm, ../lib/asm/sqrtf] - - [0xCEDE0, c, ../lib/src/guOrthoF] - - [0xCEFA0, c, ../lib/src/osSetTime] - - [0xCEFD0, c, ../lib/src/osEepromProbe] - - [0xCF040, c, ../lib/src/osPfsIsPlug] - - [0xCF3B0, c, ../lib/src/osPfsInit] - - [0xCF570, c, ../lib/src/osPfsNumFiles] - - [0xCF6C0, c, ../lib/src/osPfsFileState] - - [0xCF9B0, c, ../lib/src/osPfsFreeBlocks] - - [0xCFB00, c, ../lib/src/guRotateF] - - [0xCFCF0, c, ../lib/src/guScaleF] - - [0xCFD90, c, ../lib/src/guPerspectiveF] - - [0xD0020, c, ../lib/src/guLookAtF] - - [0xD0350, c, ../lib/src/guTranslateF] - - [0xD03F0, c, ../lib/src/osSyncPrintf] - - [0xD0450, c, ../lib/src/guMtxCatL] - - [0xD0510, c, ../lib/src/osPfsSearchFile] - - [0xD06D0, c, ../lib/src/osPfsDeleteFile] - - [0xD0CE0, c, ../lib/src/osEepromLongWrite] - - [0xD0E20, c, ../lib/src/osEepromLongRead] - - [0xD0F60, c, ../lib/src/osPfsReadWriteFile] - - [0xD1460, c, ../lib/src/osPfsAllocateFile] - - [0xD1B48, c, ../lib/src/osAiSetFrequency] - - [0xD1D70, c, ../lib/src/osAiGetLength] - - [0xD1D80, c, ../lib/src/osAiSetNextBuffer] - - [0xD1E30, c, ../lib/src/osGetCount] - - [0xD1E40, asm, ../lib/asm/__osException] - - [0xD2740, asm, ../lib/asm/__osDisableInt] - - [0xD2760, asm, ../lib/asm/__osRestoreInt] - - [0xD2780, c, ../lib/src/__osDequeueThread] - - [0xD27C0, asm, ../lib/asm/__osSetSR] - - [0xD27D0, asm, ../lib/asm/__osGetSR] - - [0xD27E0, asm, ../lib/asm/__osSetFpcCsr] - - [0xD27F0, c, ../lib/src/__osSiRawReadIo] - - [0xD2840, c, ../lib/src/__osSiRawWriteIo] - - [0xD2890, asm, ../lib/asm/osWritebackDCache] - - [0xD2910, asm, ../lib/asm/osMapTLBRdb] - - [0xD2970, c, ../lib/src/osPiRawReadIo] - - [0xD29D0, c, ../lib/src/__osSetHWIntrRoutine] - - [0xD2A20, c, ../lib/src/__osLeoInterrupt] - - [0xD32A0, c, ../lib/src/osTimer] - - [0xD36A0, c, ../lib/src/osGetThreadPri] - - [0xD36C0, c, ../lib/src/__osViInit] - - [0xD3810, c, ../lib/src/__osViGetCurrentContext] - - [0xD3820, c, ../lib/src/__osViSwapContext] - - [0xD3B80, c, ../lib/src/__osPiCreateAccessQueue] - - [0xD3C40, c, ../lib/src/osPiRawStartDma] - - [0xD3D20, c, ../lib/src/osEPiRawStartDma] - - [0xD3E00, c, ../lib/src/__osDevMgrMain] - - [0xD41B0, c, ../lib/src/bcopy] - - [0xD44C0, c, ../lib/src/osVirtualToPhysical] - - [0xD4540, c, ../lib/src/__osSpSetStatus] - - [0xD4550, c, ../lib/src/__osSpSetPc] - - [0xD4590, c, ../lib/src/__osSpRawStartDma] - - [0xD4620, c, ../lib/src/__osSpDeviceBusy] - - [0xD4650, c, ../lib/src/osSetTimer] - - [0xD4730, c, ../lib/src/__osSiRawStartDma] - - [0xD47E0, c, ../lib/src/__osSiCreateAccessQueue] - - [0xD48A0, c, ../lib/src/osJamMesg] - - [0xD49F0, c, ../lib/src/osPiGetCmdQueue] - - [0xD4A20, c, ../lib/src/__osSpGetStatus] - - [0xD4A30, c, ../lib/src/guMtxF2L] - - [0xD4CA0, c, ../lib/src/osEepromWrite] - - [0xD5180, c, ../lib/src/contpfs] - - [0xD5EE0, c, ../lib/src/osPfsChecker] - - [0xD6940, c, ../lib/src/contramread] - - [0xD6CF0, c, ../lib/src/guNormalize] - - [0xD6D80, c, ../lib/src/math/sinf] - - [0xD6F40, c, ../lib/src/math/cosf] - - [0xD70B0, c, ../lib/src/_Printf] - - [0xD7D70, c, ../lib/src/guMtxCatF] - - [0xD7F80, c, ../lib/src/contramwrite] - - [0xD8330, c, ../lib/src/osEepromRead] - - [0xD8630, c, ../lib/src/__osAiDeviceBusy] - - [0xD8660, asm, ../lib/asm/osSetIntMask] - - [0xD8700, c, ../lib/src/osDestroyThread] - - [0xD8800, c, ../lib/src/__osSiDeviceBusy] - - [0xD8830, c, ../lib/src/osLeoDiskInit] - - [0xD8920, asm, ../lib/asm/__osSetCompare] - - [0xD8930, c, ../lib/src/__osResetGlobalIntMask] - - [0xD8990, c, ../lib/src/__osEPiRawWriteIo] - - [0xD89E0, c, ../lib/src/osYieldThread] - - [0xD8A30, asm, ../lib/asm/__osProbeTLB] - - [0xD8AF0, c, ../lib/src/crc] - - [0xD8C70, c, ../lib/src/string] - - [0xD8D10, c, ../lib/src/_Litob] - - [0xD8FB0, c, ../lib/src/_Ldtob] - - [0xD9A70, c, ../lib/src/ldiv] - - [0xD9C00, bin, lib/PR/boot/F3D_boot] - - [0xD9CD0, bin, lib/PR/f3dex/F3DEX] - - [0xDB0B0, bin, lib/PR/f3dlx/F3DLX] - - [0xDD0D0, data, data_main] - - [0xDD304, i1, crash_screen_font, 8, 136] - - [0xDD38C, bin, unkDD38C] - - [0xEC358, rodata, rodata_main] - - [0xF7650, bss, bss_main] - - name: seg2 - type: code - bss_size: 0xFD180 # 0x3F460 - start: 0xF7650 - vram: 0x8028DF00 - subsegments: - - [0xF7650, c, race_logic] - - [0xFA370, c, render_courses] - - [0x100148, c, actors] - - [0x10CE80, c, skybox_and_splitscreen] - - [0x111360, c, memory] - - [0x119A00, c, actors_extended] - - [0x11E750, c, math_util] - - [0x121F80, data, data_seg2] - - [0x1229D0, rodata, rodata_seg2] - - [0x123840, bss, bss_seg2] - - name: credits - type: code - bss_size: 0x1A0 - start: 0x123840 # end: 0x12B360 - vram: 0x80280000 - subsegments: - - [0x123840, c, code_80280000] - - [0x123E90, c, code_80280650] - - [0x124E50, c, camera_junk] - - [0x124FC0, c, code_80281780] - - [0x125480, c, code_80281C40] - - [0x1257E0, c, code_80281FA0] - - [0x128680, data, data_credits] - - [0x12ACC4, rodata, rodata_credits] - - [0x12ACE0, bss, bss_credits] - #- name: unkData - # type: bin - # start: 0x1313E0 - # vram: 0xDD000000 - - #- name: models - # type: mio0 - # start: 0x821F10 - # vram: 0x0C000000 - - - [0xC00000] # end of rom diff --git a/tools/yaml/mk64.us.yaml b/tools/yaml/mk64.us.yaml deleted file mode 100644 index 2628225ca4..0000000000 --- a/tools/yaml/mk64.us.yaml +++ /dev/null @@ -1,255 +0,0 @@ -name: Mario Kart 64 US -sha1: 579c48e211ae952530ffc8738709f078d5dd215e -options: - basename: mk64 - target_path: baserom.us.z64 - base_path: . - compiler: IDO - platform: n64 - target_path: baserom.us.z64 - build_path: build/us - find_file_boundaries: True - header_encoding: ASCII - ld_script_path: mk64.us.ld - asset_path: assets/us - # platform: n64 - # undefined_funcs_auto: True - # undefined_funcs_auto_path: undefined_funcs_auto.txt - # undefined_syms_auto: True - # undefined_syms_auto_path: undefined_syms_auto.txt - # symbol_addrs_path: symbol_addrs.txt - asm_path: asm/us - # src_path: src - # extensions_path: tools/splat_ext - mips_abi_float_regs: o32 - section_order: [".text", ".data", ".rodata", ".bss"] - # auto_all_sections: [".data", ".rodata", ".bss"] -segments: - - name: header - type: header - start: 0x0 - - - name: boot - type: code - start: 0x40 - vram: 0xA4000040 - subsegments: - - [0x0040, asm, boot] - - [0x0B70, bin, rspboot_font] - - name: main - type: code - bss_size: 0x18985C - start: 0x1000 - vram: 0x80000400 - subsegments: - - [0x1000, asm, entry] - - [0x1050, c, main] - - [0x35B0, c, code_800029B0] - - [0x4150, c, profiler] - - [0x4CC0, c, crash_screen] - - [0x5340, c, animation] - - [0x5AF0, c, staff_ghosts] - - [0x6BB0, asm, unused_overflow_check] - - [0x6BD0, c, code_80005FD0] - - [0x1D0D0, c, camera] - - [0x20580, c, render_player] - - [0x27C40, c, kart_dma] - - [0x28900, c, code_80027D00] - - [0x39FC0, c, spawn_players] - - [0x3E840, c, code_8003DC40] - - [0x40C30, asm, unused_mio0_decode] - - [0x40CD0, asm, mio0_decode] - - [0x411D0, asm, tkmk00_decode] - - [0x41900, c, gbiMacro] - - [0x41A50, c, math_util_2] - - [0x43DB0, c, code_800431B0] - - [0x58860, c, code_80057C60] - - [0x6F5C0, c, code_8006E9C0] - - [0x72B00, c, update_objects] - - [0x87A70, c, code_80086E70] - - [0x8CDD0, c, effects] - - [0x920C0, c, code_800914A0] - - [0x92350, c, code_80091750] - - [0xB05B0, c, code_800AF9B0] - - [0xB0F50, c, menus] - - [0xB51E0, c, save] - - [0xB77F0, c, audio/synthesis] - - [0xB99E0, c, audio/heap] - - [0xBB680, c, audio/load] - - [0xBD170, c, audio/playback] - - [0xBEA50, c, audio/effects] - - [0xBF4F0, c, audio/seqplayer] - - [0xC1FF0, c, audio/external] - - [0xCBF30, c, audio/port_eu] - - [0xCCB70, c, ../lib/src/osCreateThread] - - [0xCCCC0, c, ../lib/src/osInitialize] - - [0xCCF60, c, ../lib/src/osStartThread] - - [0xCD0B0, c, ../lib/src/osCreateViManager] - - [0xCD450, c, ../lib/src/osViSetMode] - - [0xCD4C0, c, ../lib/src/osViBlack] - - [0xCD530, c, ../lib/src/osViSetSpecialFeatures] - - [0xCD6F0, c, ../lib/src/osCreatePiManager] - - [0xCD880, c, ../lib/src/osSetThreadPri] - - [0xCD960, c, ../lib/src/osCreateMesgQueue] - - [0xCD990, c, ../lib/src/osViSetEvent] - - [0xCDA00, c, ../lib/src/osSetEventMesg] - - [0xCDA70, c, ../lib/src/osSpTaskLoadGo] - - [0xCDD30, c, ../lib/src/osContInit] - - [0xCE0F0, c, ../lib/src/osContStartReadData] - - [0xCE350, c, ../lib/src/osRecvMesg] - - [0xCE490, asm, ../lib/asm/osWritebackDCacheAll] - - [0xCE4C0, c, ../lib/src/osSendMesg] - - [0xCE610, c, ../lib/src/osViSwapBuffer] - - [0xCE660, asm, ../lib/asm/bzero] - - [0xCE700, asm, ../lib/asm/osInvalICache] - - [0xCE780, asm, ../lib/asm/osInvalDCache] # did this one - - [0xCE830, c, ../lib/src/osPiStartDma] # didn't do this one - - [0xCE940, c, ../lib/src/osSpTaskYield] - - [0xCE960, c, ../lib/src/osSpTaskYielded] - - [0xCE9E0, c, ../lib/src/osGetTime] - - [0xCEA70, c, ../lib/src/math/llmuldiv] - - [0xCED30, c, ../lib/src/__osGetCurrFaultedThread] - - [0xCED40, asm, ../lib/asm/sqrtf] - - [0xCED50, c, ../lib/src/guOrthoF] - - [0xCEF10, c, ../lib/src/osSetTime] - - [0xCEF40, c, ../lib/src/osEepromProbe] - - [0xCEFB0, c, ../lib/src/osPfsIsPlug] - - [0xCF320, c, ../lib/src/osPfsInit] - - [0xCF4E0, c, ../lib/src/osPfsNumFiles] - - [0xCF630, c, ../lib/src/osPfsFileState] - - [0xCF920, c, ../lib/src/osPfsFreeBlocks] - - [0xCFA70, c, ../lib/src/guRotateF] - - [0xCFC60, c, ../lib/src/guScaleF] - - [0xCFD00, c, ../lib/src/guPerspectiveF] - - [0xCFF90, c, ../lib/src/guLookAtF] - - [0xD02C0, c, ../lib/src/guTranslateF] - - [0xD0360, c, ../lib/src/osSyncPrintf] - - [0xD03C0, c, ../lib/src/guMtxCatL] - - [0xD0480, c, ../lib/src/osPfsSearchFile] - - [0xD0640, c, ../lib/src/osPfsDeleteFile] - - [0xD0C50, c, ../lib/src/osEepromLongWrite] - - [0xD0D90, c, ../lib/src/osEepromLongRead] - - [0xD0ED0, c, ../lib/src/osPfsReadWriteFile] - - [0xD13D0, c, ../lib/src/osPfsAllocateFile] - - [0xD1B80, c, ../lib/src/osAiSetFrequency] - - [0xD1CE0, c, ../lib/src/osAiGetLength] - - [0xD1CF0, c, ../lib/src/osAiSetNextBuffer] - - [0xD1DA0, c, ../lib/src/osGetCount] - - [0xD1DB0, asm, ../lib/asm/__osException] - - [0xD26B0, asm, ../lib/asm/__osDisableInt] - - [0xD26D0, asm, ../lib/asm/__osRestoreInt] - - [0xD26F0, c, ../lib/src/__osDequeueThread] - - [0xD2730, asm, ../lib/asm/__osSetSR] - - [0xD2740, asm, ../lib/asm/__osGetSR] - - [0xD2750, asm, ../lib/asm/__osSetFpcCsr] - - [0xD2760, c, ../lib/src/__osSiRawReadIo] - - [0xD27B0, c, ../lib/src/__osSiRawWriteIo] - - [0xD2800, asm, ../lib/asm/osWritebackDCache] - - [0xD2880, asm, ../lib/asm/osMapTLBRdb] - - [0xD28E0, c, ../lib/src/osPiRawReadIo] - - [0xD2940, c, ../lib/src/__osSetHWIntrRoutine] - - [0xD2990, c, ../lib/src/__osLeoInterrupt] - - [0xD3210, c, ../lib/src/osTimer] - - [0xD3610, c, ../lib/src/osGetThreadPri] - - [0xD3630, c, ../lib/src/__osViInit] - - [0xD3780, c, ../lib/src/__osViGetCurrentContext] - - [0xD3790, c, ../lib/src/__osViSwapContext] - - [0xD3AF0, c, ../lib/src/__osPiCreateAccessQueue] - - [0xD3BB0, c, ../lib/src/osPiRawStartDma] - - [0xD3C90, c, ../lib/src/osEPiRawStartDma] - - [0xD3D70, c, ../lib/src/__osDevMgrMain] - - [0xD4120, c, ../lib/src/bcopy] - - [0xD4430, c, ../lib/src/osVirtualToPhysical] - - [0xD44B0, c, ../lib/src/__osSpSetStatus] - - [0xD44C0, c, ../lib/src/__osSpSetPc] - - [0xD4500, c, ../lib/src/__osSpRawStartDma] - - [0xD4590, c, ../lib/src/__osSpDeviceBusy] - - [0xD45C0, c, ../lib/src/osSetTimer] - - [0xD46A0, c, ../lib/src/__osSiRawStartDma] - - [0xD4750, c, ../lib/src/__osSiCreateAccessQueue] - - [0xD4810, c, ../lib/src/osJamMesg] - - [0xD4960, c, ../lib/src/osPiGetCmdQueue] - - [0xD4990, c, ../lib/src/__osSpGetStatus] - - [0xD49A0, c, ../lib/src/guMtxF2L] - - [0xD4C10, c, ../lib/src/osEepromWrite] - - [0xD50F0, c, ../lib/src/contpfs] - - [0xD5E50, c, ../lib/src/osPfsChecker] - - [0xD68B0, c, ../lib/src/contramread] - - [0xD6C60, c, ../lib/src/guNormalize] - - [0xD6CF0, c, ../lib/src/math/sinf] - - [0xD6EB0, c, ../lib/src/math/cosf] - - [0xD7020, c, ../lib/src/_Printf] - - [0xD7CE0, c, ../lib/src/guMtxCatF] - - [0xD7EF0, c, ../lib/src/contramwrite] - - [0xD82A0, c, ../lib/src/osEepromRead] - - [0xD85A0, c, ../lib/src/__osAiDeviceBusy] - - [0xD85D0, asm, ../lib/asm/osSetIntMask] - - [0xD8670, c, ../lib/src/osDestroyThread] - - [0xD8770, c, ../lib/src/__osSiDeviceBusy] - - [0xD87A0, c, ../lib/src/osLeoDiskInit] - - [0xD8890, asm, ../lib/asm/__osSetCompare] - - [0xD88A0, c, ../lib/src/__osResetGlobalIntMask] - - [0xD8900, c, ../lib/src/__osEPiRawWriteIo] - - [0xD8950, c, ../lib/src/osYieldThread] - - [0xD89A0, asm, ../lib/asm/__osProbeTLB] - - [0xD8A60, c, ../lib/src/crc] - - [0xD8BE0, c, ../lib/src/string] - - [0xD8C80, c, ../lib/src/_Litob] - - [0xD8F20, c, ../lib/src/_Ldtob] - - [0xD99E0, c, ../lib/src/ldiv] - - [0xD9B70, bin, lib/PR/boot/F3D_boot] - - [0xD9C40, bin, lib/PR/f3dex/F3DEX] - - [0xDB020, bin, lib/PR/f3dlx/F3DLX] - - [0xDC430, bin, lib/PR/audio/aspMain] - - [0xDD0D0, data, data_main] - - [0xDD274, bin, textures/crash_screen/crash_screen_font] - - [0xEC358, rodata, rodata_main] - - [0xF4900, bin, lib/PR/f3d/F3DEX_data] - - [0xF5100, bin, lib/PR/f3d/F3DLX_data] - - [0xF5900, bin, lib/PR/audio/aspMain_data] - - name: seg2 - type: code - bss_size: 0xFD180 # 0x3F460 - start: 0xF7510 - vram: 0x8028DF00 - subsegments: - - [0xF7510, c, race_logic] - - [0xFA230, c, render_courses] - - [0x100060, c, actors] - - [0x10CD40, c, skybox_and_splitscreen] - - [0x111180, c, memory] - - [0x114080, c, code_802AAA70] - - [0x119820, c, actors_extended] - - [0x11E570, c, math_util] - - [0x121DA0, data, data_seg2] - #- [0x1227D0, data, race_logic] # race_logic .data location messed up?!? - #- [0x1227F0, rodata, race_logic] - - [0x1227D0, rodata, race_logic] - - [0x1228D0, rodata, render_courses] - - [0x122B10, rodata, actors] - - [0x1231C0, rodata, skybox_and_splitscreen] - - [0x123240, rodata, memory] - - [0x123410, rodata, code_802AAA70] - - [0x123490, rodata, actors_extended] - - [0x1235C0, rodata, math_util] - - [0x123640, hasm, bss_seg2] - - name: credits - type: code - bss_size: 0x1A0 - start: 0x123640 # end: 0x12B360 - vram: 0x80280000 - subsegments: - - [0x123640, c, code_80280000] - - [0x123C90, c, code_80280650] - - [0x124C50, c, camera_junk] - - [0x124DC0, c, code_80281780] - - [0x125280, c, code_80281C40] - - [0x1255E0, c, ceremony_and_credits] - - [0x128480, data, data_credits] - - [0x12A1B0, rodata, code_80280650] - - [0x12A1D0, rodata, camera_junk] - - [0x12A1F0, rodata, credits] - - [0x12AAB0, rodata, ceremony_and_credits] - - [0x12AAE0, bss, bss_credits] - - - [0xC00000] # end of rom diff --git a/tools/yaml/yamls are unused.txt b/tools/yaml/yamls are unused.txt deleted file mode 100644 index e69de29bb2..0000000000