From 815c11ac4beca80b96c82f9bb1b4e0ff78bbd9a6 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Fri, 15 Nov 2024 23:27:18 -0700 Subject: [PATCH 01/30] Fix jumbotron --- CMakeLists.txt | 194 ---------------------------- src/engine/courses/LuigiRaceway.cpp | 66 +++------- src/engine/courses/WarioStadium.cpp | 53 ++------ 3 files changed, 25 insertions(+), 288 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 175cf6439..d83379ac0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -589,197 +589,3 @@ add_custom_target( COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/spaghetti.otr" "${CMAKE_BINARY_DIR}/spaghetti.otr" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/ship.otr" "${CMAKE_BINARY_DIR}/ship.otr" ) - -if(MSVC) -set (WAMR_BUILD_PLATFORM "windows") -else() -set (WAMR_BUILD_PLATFORM "linux") -endif() - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", -# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") - set (WAMR_BUILD_TARGET "AARCH64") - if (NOT DEFINED WAMR_BUILD_SIMD) - set (WAMR_BUILD_SIMD 1) - endif () - elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set (WAMR_BUILD_TARGET "RISCV64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - if (NOT DEFINED WAMR_BUILD_SIMD) - set (WAMR_BUILD_SIMD 1) - endif () - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_JIT) - # Disable Fast JIT by default - set (WAMR_BUILD_FAST_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Disable multiple modules by default - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_WASI_THREADS) - # Disable wasi threads library by default - set (WAMR_BUILD_LIB_WASI_THREADS 0) -endif() - -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_REF_TYPES) - # Disable reference types by default - set (WAMR_BUILD_REF_TYPES 0) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -# if enable wasi-nn, both wasi-nn-backends and iwasm -# need to use same WAMR (dynamic) libraries -if (WAMR_BUILD_WASI_NN EQUAL 1) - set (WAMR_BUILD_SHARED 1) -endif () - -if(MSVC) -if (WAMR_BUILD_LIBC_WASI EQUAL 1) - set (CMAKE_C_STANDARD 11) - if (MSVC) - add_compile_options(/experimental:c11atomics) - endif() -else() - set (CMAKE_C_STANDARD 99) -endif() -endif() - -set (WAMR_BUILD_DUMP_CALL_STACK 1) - -set (WAMR_ROOT_DIR lib/wasm-micro-runtime) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -if(MSVC) - -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") -if (NOT MINGW) - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") -endif () - -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") - -if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") - if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" OR MSVC)) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") - endif () -endif () - -# The following flags are to enhance security, but it may impact performance, -# we disable them by default. -#if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -D_FORTIFY_SOURCE=2") -#endif () -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong --param ssp-buffer-size=4") -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now") - -include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) - -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) - -install (TARGETS iwasm DESTINATION bin) - -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) - -if (MINGW) - target_link_libraries (iwasm ws2_32) -endif () - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) - -if (MINGW) - target_link_libraries (libiwasm ws2_32) -endif () - -if (WIN32) - target_link_libraries(libiwasm ntdll) - - target_link_libraries(iwasm ntdll) -endif() - -else() -target_link_libraries (${PROJECT_NAME} PRIVATE vmlib) - -include_directories( - ${WAMR_ROOT_DIR}/core -) -endif () diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index f9a9de13a..725aaad4f 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -33,6 +33,7 @@ extern "C" { #include "memory.h" #include "courses/staff_ghost_data.h" #include "framebuffer_effects.h" + #include "skybox_and_splitscreen.h" extern const char *luigi_raceway_dls[]; extern s16 currentScreenSection; } @@ -241,6 +242,16 @@ void LuigiRaceway::Render(struct UnkStruct_800DC5EC* arg0) { gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); + // Invalidate Jumbotron textures so they update each frame + // This could be more efficient if we exposed the non-opcode based invalidation to be called + // inside copy_framebuffers_port + gSPInvalidateTexCache(gDisplayListHead++, gSegmentTable[5] + 0xF800); + gSPInvalidateTexCache(gDisplayListHead++, gSegmentTable[5] + 0x10800); + gSPInvalidateTexCache(gDisplayListHead++, gSegmentTable[5] + 0x11800); + gSPInvalidateTexCache(gDisplayListHead++, gSegmentTable[5] + 0x12800); + gSPInvalidateTexCache(gDisplayListHead++, gSegmentTable[5] + 0x13800); + gSPInvalidateTexCache(gDisplayListHead++, gSegmentTable[5] + 0x14800); + if (func_80290C20(arg0->camera) == 1) { gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE); gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); @@ -278,58 +289,13 @@ void LuigiRaceway::Render(struct UnkStruct_800DC5EC* arg0) { currentScreenSection = 0; } - uintptr_t fb = (uintptr_t) gSegmentTable[5] + 0xF800; - FB_WriteFramebufferSliceToCPU(gDisplayListHead, (void*)fb, true); - // FB_DrawFromFramebuffer(gDisplayListHead, 0, fb, true); - // FB_CopyToFramebuffer(gDisplayListHead, 0, fb, false, NULL); /** - * The jumbo television screen is split into six sections each section is copied one at a time. - * This is done to fit within the n64's texture size requirements; 64x32 + * The jumbo television screen used to be split into six sections to fit into the n64's texture size restrictions + * It isn't split into six sections anymore */ - switch (currentScreenSection) { - case 0: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC, D_800DC5E0, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800)); -#endif - break; - case 1: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC + 64, D_800DC5E0, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x10800)); -#endif - break; - case 2: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC, D_800DC5E0 + 32, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x11800)); -#endif - break; - case 3: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x12800)); -#endif - break; - case 4: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC, D_800DC5E0 + 64, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x13800)); -#endif - break; - case 5: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x14800)); -#endif - break; - } + copy_jumbotron_fb_port(D_800DC5DC, D_800DC5E0, currentScreenSection, + (u16*) PHYSICAL_TO_VIRTUAL(gPortFramebuffers[prevFrame]), + (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800)); } } diff --git a/src/engine/courses/WarioStadium.cpp b/src/engine/courses/WarioStadium.cpp index 39447b590..24296a8d7 100644 --- a/src/engine/courses/WarioStadium.cpp +++ b/src/engine/courses/WarioStadium.cpp @@ -32,6 +32,7 @@ extern "C" { #include "collision.h" #include "code_8003DC40.h" #include "memory.h" + #include "skybox_and_splitscreen.h" extern const char *wario_stadium_dls[]; extern s16 currentScreenSection; } @@ -248,50 +249,14 @@ void WarioStadium::Render(struct UnkStruct_800DC5EC* arg0) { if (currentScreenSection > 5) { currentScreenSection = 0; } - switch (currentScreenSection) { - case 0: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC, D_800DC5E0, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x8800)); -#endif - break; - case 1: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC + 64, D_800DC5E0, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x9800)); -#endif - break; - case 2: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC, D_800DC5E0 + 32, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xA800)); -#endif - break; - case 3: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xB800)); -#endif - break; - case 4: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC, D_800DC5E0 + 64, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xC800)); -#endif - break; - case 5: -#ifdef TARGET_N64 - copy_framebuffer(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, - (u16*) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xD800)); -#endif - break; - } + + /** + * The jumbo television screen used to be split into six sections to fit into the n64's texture size restrictions + * It isn't split into six sections anymore + */ + copy_jumbotron_fb_port(D_800DC5DC, D_800DC5E0, currentScreenSection, + (u16*) PHYSICAL_TO_VIRTUAL(gPortFramebuffers[prevFrame]), + (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x8800)); } } From e6565f23f85ab037127a680de3c3bccf2d4942bd Mon Sep 17 00:00:00 2001 From: MegaMech Date: Fri, 15 Nov 2024 23:32:54 -0700 Subject: [PATCH 02/30] Cleanup --- src/engine/courses/LuigiRaceway.cpp | 4 ++-- src/engine/courses/WarioStadium.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index 725aaad4f..72b6617c2 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -294,8 +294,8 @@ void LuigiRaceway::Render(struct UnkStruct_800DC5EC* arg0) { * It isn't split into six sections anymore */ copy_jumbotron_fb_port(D_800DC5DC, D_800DC5E0, currentScreenSection, - (u16*) PHYSICAL_TO_VIRTUAL(gPortFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800)); + (u16*) gPortFramebuffers[prevFrame], + (u16*) (gSegmentTable[5] + 0xF800)); } } diff --git a/src/engine/courses/WarioStadium.cpp b/src/engine/courses/WarioStadium.cpp index 24296a8d7..f074fb31e 100644 --- a/src/engine/courses/WarioStadium.cpp +++ b/src/engine/courses/WarioStadium.cpp @@ -255,8 +255,8 @@ void WarioStadium::Render(struct UnkStruct_800DC5EC* arg0) { * It isn't split into six sections anymore */ copy_jumbotron_fb_port(D_800DC5DC, D_800DC5E0, currentScreenSection, - (u16*) PHYSICAL_TO_VIRTUAL(gPortFramebuffers[prevFrame]), - (u16*) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x8800)); + (u16*) gPortFramebuffers[prevFrame], + (u16*) (gSegmentTable[5] + 0x8800)); } } From 7cdf3daf71e9072bf7ba1d8c26dc50991a94e311 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 00:38:29 -0700 Subject: [PATCH 03/30] Add cvar multiplayer features no cut and equiv train in multiplayer --- src/engine/World.cpp | 4 +-- src/engine/World.h | 3 ++- src/engine/courses/KalimariDesert.cpp | 20 ++++++++++++++- src/engine/courses/TestCourse.cpp | 6 ++--- src/engine/vehicles/Train.cpp | 35 +++++++++------------------ src/engine/vehicles/Train.h | 7 +++++- src/port/ui/ImguiUI.cpp | 4 +-- 7 files changed, 46 insertions(+), 33 deletions(-) diff --git a/src/engine/World.cpp b/src/engine/World.cpp index a5bbd6cdf..5bdc9e05a 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -46,8 +46,8 @@ static size_t busses; static size_t tankerTrucks; static size_t cars; static size_t boats; -void World::AddTrain(size_t numCarriages, f32 speed, uint32_t waypoint) { - Vehicles.push_back(std::make_unique(trains, numCarriages, speed, waypoint)); +void World::AddTrain(ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint) { + Vehicles.push_back(std::make_unique(trains, tender, numCarriages, speed, waypoint)); trains++; } diff --git a/src/engine/World.h b/src/engine/World.h index ee562118b..e4e381e08 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -7,6 +7,7 @@ #include "vehicles/Train.h" #include "vehicles/Car.h" #include "vehicles/OBombKart.h" +#include "vehicles/Train.h" #include "TrainCrossing.h" #include #include "Actor.h" @@ -127,7 +128,7 @@ public: /** Actors */ void AddBoat(f32 speed, uint32_t waypoint); - void AddTrain(size_t numCarriages, f32 speed, uint32_t waypoint); + void AddTrain(ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint); void AddTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint); void AddBus(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint); void AddTankerTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint); diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index df6b4237d..b982dad68 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -12,6 +12,7 @@ #include "engine/vehicles/Utils.h" #include "engine/vehicles/Vehicle.h" +#include "engine/vehicles/Train.h" extern "C" { #include "main.h" @@ -202,13 +203,30 @@ void KalimariDesert::SpawnVehicles() { generate_train_waypoints(); s32 numTrains = 2; + s32 numCars = 5; + ATrain::TenderStatus tender = ATrain::TenderStatus::HAS_TENDER; s32 centerWaypoint = 160; // Spawn two trains for (size_t i = 0; i < numTrains; ++i) { uint32_t waypoint = CalculateWaypointDistribution(i, numTrains, gVehicle2DWaypointLength, centerWaypoint); - gWorldInstance.AddTrain(5, 2.5f, waypoint); + + if (CVarGetInteger("gMultiplayerNoFeatureCuts", 0) == false) { + // Multiplayer modes have no tender and no carriages + if (gActiveScreenMode != SCREEN_MODE_1P) { + tender = ATrain::TenderStatus::NO_TENDER; + numCars = 0; + } + + // 2 player versus mode has a tender and a carriage + if ((gModeSelection == VERSUS) && (gPlayerCountSelection1 == 2)) { + tender = ATrain::TenderStatus::HAS_TENDER; + numCars = 1; + } + } + + gWorldInstance.AddTrain(tender, numCars, 2.5f, waypoint); } if (gModeSelection == VERSUS) { diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index b3383a3b0..2a8787d23 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -12,8 +12,8 @@ #include "assets/bowsers_castle_data.h" #include "assets/bowsers_castle_displaylists.h" #include "engine/actors/ATree.h" - #include "engine/actors/ACloud.h" +#include "engine/vehicles/Train.h" extern "C" { #include "main.h" @@ -265,8 +265,8 @@ void TestCourse::SpawnVehicles() { gVehicle2DWaypointLength = 53; D_80162EB0 = spawn_actor_on_surface(test_course_path2D[0].x, 2000.0f, test_course_path2D[0].z); - gWorldInstance.AddTrain(5, 2.5f, 0); - gWorldInstance.AddTrain(5, 2.5f, 8); + gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 0); + gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 8); Vec3f pos = {0, 0, 0}; diff --git a/src/engine/vehicles/Train.cpp b/src/engine/vehicles/Train.cpp index a16b8b5f9..c34ac1cf3 100644 --- a/src/engine/vehicles/Train.cpp +++ b/src/engine/vehicles/Train.cpp @@ -22,7 +22,7 @@ extern "C" { // #include "common_structs.h" } -ATrain::ATrain(size_t idx, size_t numCarriages, f32 speed, uint32_t waypoint) { +ATrain::ATrain(size_t idx, ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint) { u16 waypointOffset; TrainCarStuff* ptr1; Path2D* pos; @@ -59,30 +59,19 @@ ATrain::ATrain(size_t idx, size_t numCarriages, f32 speed, uint32_t waypoint) { // Only use locomotive unless overwritten below. NumCars = LOCOMOTIVE_ONLY; - // Spawn all rolling stock in single player mode. - switch (gScreenModeSelection) { - case SCREEN_MODE_1P: // single player - Tender.isActive = 1; - - // clang-format off - // Same line required for matching... - for (size_t i = 0; i < numCarriages; i++) { PassengerCars[i].isActive = 1; } - // clang-format on - - NumCars = NUM_TENDERS + numCarriages; - break; - - // Spawn locomotive, tender, and one passenger car in versus 2/3 player mode. - case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: // multiplayer fall-through - case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: - if (gModeSelection != GRAND_PRIX) { - Tender.isActive = 1; - PassengerCars[4].isActive = 1; - NumCars = NUM_TENDERS + NUM_2P_PASSENGER_CARS; - } - break; + // Fall back in-case someone tries to spawn a train with carriages but no tender; not allowed. + if (numCarriages > 0) { + tender = HAS_TENDER; } + Tender.isActive = static_cast(tender); + + for (size_t i = 0; i < numCarriages; i++) { + PassengerCars[i].isActive = 1; + } + + NumCars = NUM_TENDERS + numCarriages; + AnotherSmokeTimer = 0; } diff --git a/src/engine/vehicles/Train.h b/src/engine/vehicles/Train.h index 9b733bad3..0964c8cf9 100644 --- a/src/engine/vehicles/Train.h +++ b/src/engine/vehicles/Train.h @@ -14,6 +14,11 @@ class AVehicle; // Forward declare class ATrain : public AVehicle { public: + enum TenderStatus { + NO_TENDER, + HAS_TENDER, + }; + TrainCarStuff Locomotive; TrainCarStuff Tender; std::vector PassengerCars; @@ -30,7 +35,7 @@ class ATrain : public AVehicle { int16_t AnotherSmokeTimer = 0; int16_t SmokeTimer = 0; - explicit ATrain(size_t idx, size_t numCarriages, f32 speed, uint32_t waypoint); + explicit ATrain(size_t idx, ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint); virtual void Spawn() override; virtual void BeginPlay() override; diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 3ce6ed934..3548325d5 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -475,8 +475,8 @@ void DrawEnhancementsMenu() { "No Level of Detail (LOD)", "gDisableLod", { .tooltip = "Disable Level of Detail (LOD) to avoid models using lower poly versions at a distance" }); - UIWidgets::CVarCheckbox("Select any star from menu", "gCompletedGame", - { .tooltip = "Unlocks extra mode and sets all gold cups." }); + UIWidgets::CVarCheckbox("No multiplayer feature cuts", "gMultiplayerNoFeatureCuts", + { .tooltip = "Allows full train and jumbotron in multiplayer, etc." }); UIWidgets::CVarCheckbox("Disable Culling", "gNoCulling", { .tooltip = "Disable original culling of mk64" }); UIWidgets::CVarSliderFloat( From be9f49a0be23fbe1343142c1e5b202d1f701b8f2 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 00:55:22 -0700 Subject: [PATCH 04/30] Implement reset button --- src/port/ui/ImguiUI.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 3548325d5..52a8ca0e3 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -15,7 +15,11 @@ #include #include "port/Engine.h" -extern "C" {} +extern "C" { + extern s32 gGamestateNext; + extern s32 gMenuSelection; + #include "defines.h" +} namespace GameUI { std::shared_ptr mGameMenuBar; @@ -446,7 +450,8 @@ void DrawGameMenu() { "Ctrl+R" #endif )) { - // gNextGameState = GSTATE_BOOT; + gGamestateNext = MAIN_MENU_FROM_QUIT; + gMenuSelection = START_MENU; } #if !defined(__SWITCH__) && !defined(__WIIU__) From d29f5c7a64c0563181726af6ee32dbf73247769b Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 16:40:39 -0700 Subject: [PATCH 05/30] General Cleanup of vehicles --- src/engine/World.cpp | 5 +++ src/engine/courses/KalimariDesert.cpp | 19 ++++----- src/engine/courses/KalimariDesert.h | 6 +++ src/engine/courses/ToadsTurnpike.cpp | 60 ++++++++++----------------- src/engine/courses/ToadsTurnpike.h | 5 +++ src/racing/skybox_and_splitscreen.c | 1 + 6 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/engine/World.cpp b/src/engine/World.cpp index 5bdc9e05a..c87bb332d 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -46,6 +46,11 @@ static size_t busses; static size_t tankerTrucks; static size_t cars; static size_t boats; + +/** + * Note that you can only remove the tender if there are no carriages + * @arg waypoint initial waypoint to spawn at. + */ void World::AddTrain(ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint) { Vehicles.push_back(std::make_unique(trains, tender, numCarriages, speed, waypoint)); trains++; diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index b982dad68..cfb7316e5 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -12,7 +12,6 @@ #include "engine/vehicles/Utils.h" #include "engine/vehicles/Vehicle.h" -#include "engine/vehicles/Train.h" extern "C" { #include "main.h" @@ -202,31 +201,27 @@ void KalimariDesert::MinimapFinishlinePosition() { void KalimariDesert::SpawnVehicles() { generate_train_waypoints(); - s32 numTrains = 2; - s32 numCars = 5; - ATrain::TenderStatus tender = ATrain::TenderStatus::HAS_TENDER; s32 centerWaypoint = 160; // Spawn two trains - for (size_t i = 0; i < numTrains; ++i) { - uint32_t waypoint = CalculateWaypointDistribution(i, numTrains, gVehicle2DWaypointLength, centerWaypoint); - + for (size_t i = 0; i < _numTrains; ++i) { + uint32_t waypoint = CalculateWaypointDistribution(i, _numTrains, gVehicle2DWaypointLength, centerWaypoint); if (CVarGetInteger("gMultiplayerNoFeatureCuts", 0) == false) { // Multiplayer modes have no tender and no carriages if (gActiveScreenMode != SCREEN_MODE_1P) { - tender = ATrain::TenderStatus::NO_TENDER; - numCars = 0; + _tender = ATrain::TenderStatus::NO_TENDER; + _numCarriages = 0; } // 2 player versus mode has a tender and a carriage if ((gModeSelection == VERSUS) && (gPlayerCountSelection1 == 2)) { - tender = ATrain::TenderStatus::HAS_TENDER; - numCars = 1; + _tender = ATrain::TenderStatus::HAS_TENDER; + _numCarriages = 1; } } - gWorldInstance.AddTrain(tender, numCars, 2.5f, waypoint); + gWorldInstance.AddTrain(_tender, _numCarriages, 2.5f, waypoint); } if (gModeSelection == VERSUS) { diff --git a/src/engine/courses/KalimariDesert.h b/src/engine/courses/KalimariDesert.h index 8c2d9a4d8..c25e9ba22 100644 --- a/src/engine/courses/KalimariDesert.h +++ b/src/engine/courses/KalimariDesert.h @@ -2,6 +2,7 @@ #include #include "Course.h" +#include "engine/vehicles/Train.h" extern "C" { #include "assets/kalimari_desert_vertices.h" @@ -38,4 +39,9 @@ public: virtual void SpawnVehicles() override; virtual void Collision() override; virtual void Destroy() override; + +private: + size_t _numTrains = 2; + size_t _numCarriages = 5; + ATrain::TenderStatus _tender = ATrain::TenderStatus::HAS_TENDER; }; diff --git a/src/engine/courses/ToadsTurnpike.cpp b/src/engine/courses/ToadsTurnpike.cpp index e629b76ef..257b6c990 100644 --- a/src/engine/courses/ToadsTurnpike.cpp +++ b/src/engine/courses/ToadsTurnpike.cpp @@ -218,52 +218,38 @@ void ToadsTurnpike::RenderCredits() { void ToadsTurnpike::Collision() {} void ToadsTurnpike::SpawnVehicles() { + uint32_t waypoint; f32 a = ((gCCSelection * 90.0) / 216.0f) + 4.583333333333333; f32 b = ((gCCSelection * 90.0) / 216.0f) + 2.9166666666666665; a /= 2; // Normally vehicle logic is only ran every 2 frames. This slows the vehicles down to match. b /= 2; - uint32_t waypoint; + // Other game modes spawn seven of each vehicle if (gModeSelection == TIME_TRIALS) { - for (size_t i = 0; i < NUM_TIME_TRIAL_BOX_TRUCKS; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_TIME_TRIAL_BOX_TRUCKS, gWaypointCountByPathIndex[0], 0); - gWorldInstance.AddTruck(a, b, &D_80164550[0][0], waypoint); - } + _numTrucks = 8; + _numBuses = 8; + _numTankerTrucks = 8; + _numCars = 8; + } + + for (size_t i = 0; i < _numTrucks; i++) { + waypoint = CalculateWaypointDistribution(i, _numTrucks, gWaypointCountByPathIndex[0], 0); + gWorldInstance.AddTruck(a, b, &D_80164550[0][0], waypoint); + } - for (size_t i = 0; i < NUM_TIME_TRIAL_SCHOOL_BUSES; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_TIME_TRIAL_SCHOOL_BUSES, gWaypointCountByPathIndex[0], 75); - gWorldInstance.AddBus(a, b, &D_80164550[0][0], waypoint); - } + for (size_t i = 0; i < _numBuses; i++) { + waypoint = CalculateWaypointDistribution(i, _numBuses, gWaypointCountByPathIndex[0], 75); + gWorldInstance.AddBus(a, b,&D_80164550[0][0], waypoint); + } - for (size_t i = 0; i < NUM_TIME_TRIAL_TANKER_TRUCKS; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_TIME_TRIAL_TANKER_TRUCKS, gWaypointCountByPathIndex[0], 50); - gWorldInstance.AddTankerTruck(a, b, &D_80164550[0][0], waypoint); - } + for (size_t i = 0; i < _numTankerTrucks; i++) { + waypoint = CalculateWaypointDistribution(i, _numTankerTrucks, gWaypointCountByPathIndex[0], 50); + gWorldInstance.AddTankerTruck(a, b, &D_80164550[0][0], waypoint); + } - for (size_t i = 0; i < NUM_TIME_TRIAL_CARS; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_TIME_TRIAL_CARS, gWaypointCountByPathIndex[0], 25); - gWorldInstance.AddCar(a, b, &D_80164550[0][0], waypoint); - } - } else { // All other modes - for (size_t i = 0; i < NUM_RACE_BOX_TRUCKS; i++) { - uint32_t waypoint = CalculateWaypointDistribution(i, NUM_RACE_BOX_TRUCKS, gWaypointCountByPathIndex[0], 0); - gWorldInstance.AddTruck(a, b, &D_80164550[0][0], waypoint); - } - - for (size_t i = 0; i < NUM_RACE_SCHOOL_BUSES; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_RACE_SCHOOL_BUSES, gWaypointCountByPathIndex[0], 75); - gWorldInstance.AddBus(a, b,&D_80164550[0][0], waypoint); - } - - for (size_t i = 0; i < NUM_RACE_TANKER_TRUCKS; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_RACE_TANKER_TRUCKS, gWaypointCountByPathIndex[0], 50); - gWorldInstance.AddTankerTruck(a, b, &D_80164550[0][0], waypoint); - } - - for (size_t i = 0; i < NUM_RACE_CARS; i++) { - waypoint = CalculateWaypointDistribution(i, NUM_RACE_CARS, gWaypointCountByPathIndex[0], 25); - gWorldInstance.AddCar(a, b, &D_80164550[0][0], waypoint); - } + for (size_t i = 0; i < _numCars; i++) { + waypoint = CalculateWaypointDistribution(i, _numCars, gWaypointCountByPathIndex[0], 25); + gWorldInstance.AddCar(a, b, &D_80164550[0][0], waypoint); } if (gModeSelection == VERSUS) { diff --git a/src/engine/courses/ToadsTurnpike.h b/src/engine/courses/ToadsTurnpike.h index 7a097cce3..bbb2df9c3 100644 --- a/src/engine/courses/ToadsTurnpike.h +++ b/src/engine/courses/ToadsTurnpike.h @@ -39,4 +39,9 @@ public: virtual void Collision() override; virtual void SpawnVehicles() override; virtual void Destroy() override; +private: + size_t _numTrucks = 7; + size_t _numBuses = 7; + size_t _numTankerTrucks = 7; + size_t _numCars = 7; }; diff --git a/src/racing/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c index a3755987f..a5ab4f3bf 100644 --- a/src/racing/skybox_and_splitscreen.c +++ b/src/racing/skybox_and_splitscreen.c @@ -416,6 +416,7 @@ void func_802A487C(Vtx* arg0, UNUSED struct UnkStruct_800DC5EC* arg1, UNUSED s32 } void func_802A4A0C(Vtx* vtx, struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, UNUSED s32 arg3, UNUSED f32* arg4) { + //! @todo Confirm if this crash still happens and fix if so s32 id = arg1 - D_8015F480; arg1->camera = &cameras[id]; // bad fix of bowser castle crash where camera get an invalid value Camera* camera = arg1->camera; From a4ba62e01a96010c30e5766389793454b9db022a Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 17:34:23 -0700 Subject: [PATCH 06/30] Make boat always active --- src/engine/vehicles/Boat.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/engine/vehicles/Boat.cpp b/src/engine/vehicles/Boat.cpp index 1e7109e1d..c1d7803bb 100644 --- a/src/engine/vehicles/Boat.cpp +++ b/src/engine/vehicles/Boat.cpp @@ -31,11 +31,8 @@ ABoat::ABoat(size_t idx, f32 speed, u32 waypoint) { WaypointIndex = Index * 0xB4; ActorIndex = -1; - if (gPlayerCount >= 3) { - IsActive = 0; - } else { - IsActive = 1; - } + IsActive = 1; + Velocity[0] = 0.0f; Velocity[1] = 0.0f; Velocity[2] = 0.0f; From e85b7ddbe956e4def366876d0e4ee8256dae952a Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 17:47:00 -0700 Subject: [PATCH 07/30] Add disable lod to mrw pipe --- src/engine/courses/MarioRaceway.cpp | 20 ++++++++++---------- src/racing/render_courses.c | 28 +++++++++++++++++----------- src/racing/render_courses.h | 2 +- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index f93b76762..e0cfd1f59 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -270,12 +270,12 @@ void MarioRaceway::Render(struct UnkStruct_800DC5EC* arg0) { case 2: case 17: if ((temp_t0 == 2) || (temp_t0 == 1)) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 3: if (temp_t0 != 0) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 4: @@ -285,13 +285,13 @@ void MarioRaceway::Render(struct UnkStruct_800DC5EC* arg0) { if (temp_t0 == 1) { func_80291198(); } - func_802911C4(); + render_mario_raceway_pipe(); } break; case 5: case 6: if ((temp_t0 == 2) || (temp_t0 == 3)) { - func_802911C4(); + render_mario_raceway_pipe(); } else { func_80291198(); } @@ -299,13 +299,13 @@ void MarioRaceway::Render(struct UnkStruct_800DC5EC* arg0) { case 7: func_80291198(); if ((temp_t0 == 2) || (temp_t0 == 3)) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 8: case 9: if (temp_t0 != 1) { - func_802911C4(); + render_mario_raceway_pipe(); } /* fallthrough */ case 10: @@ -315,15 +315,15 @@ void MarioRaceway::Render(struct UnkStruct_800DC5EC* arg0) { break; case 11: if (temp_t0 == 0) { - func_802911C4(); + render_mario_raceway_pipe(); func_80291198(); } else if (temp_t0 == 3) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 12: if ((temp_t0 == 0) || (temp_t0 == 3)) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 13: @@ -331,7 +331,7 @@ void MarioRaceway::Render(struct UnkStruct_800DC5EC* arg0) { if (temp_t0 != 1) { case 15: case 16: - func_802911C4(); + render_mario_raceway_pipe(); } break; } diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index 7af74516b..bf5d8dd09 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -187,11 +187,17 @@ void func_80291198(void) { gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x07001140))); // } -void func_802911C4(void) { +void render_mario_raceway_pipe(void) { + + if (gScreenModeSelection == SCREEN_MODE_1P) { // d_course_mario_raceway_packed_dl_8E8 gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070008E8))); } else { + if (CVarGetInteger("gDisableLod", 0) == true) { + gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070008E8))); + return; + } // d_course_mario_raceway_packed_dl_2D68 gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x07002D68))); } @@ -548,12 +554,12 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) { case 2: case 17: if ((playerDirection == 2) || (playerDirection == 1)) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 3: if (playerDirection != 0) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 4: @@ -563,13 +569,13 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) { if (playerDirection == 1) { func_80291198(); } - func_802911C4(); + render_mario_raceway_pipe(); } break; case 5: case 6: if ((playerDirection == 2) || (playerDirection == 3)) { - func_802911C4(); + render_mario_raceway_pipe(); } else { func_80291198(); } @@ -577,13 +583,13 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) { case 7: func_80291198(); if ((playerDirection == 2) || (playerDirection == 3)) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 8: case 9: if (playerDirection != 1) { - func_802911C4(); + render_mario_raceway_pipe(); } /* fallthrough */ case 10: @@ -593,15 +599,15 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) { break; case 11: if (playerDirection == 0) { - func_802911C4(); + render_mario_raceway_pipe(); func_80291198(); } else if (playerDirection == 3) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 12: if ((playerDirection == 0) || (playerDirection == 3)) { - func_802911C4(); + render_mario_raceway_pipe(); } break; case 13: @@ -609,7 +615,7 @@ void render_mario_raceway(struct UnkStruct_800DC5EC* arg0) { if (playerDirection != 1) { case 15: case 16: - func_802911C4(); + render_mario_raceway_pipe(); } break; } diff --git a/src/racing/render_courses.h b/src/racing/render_courses.h index dfb05c58b..e1e87fcc9 100644 --- a/src/racing/render_courses.h +++ b/src/racing/render_courses.h @@ -16,7 +16,7 @@ s32 func_80290C20(Camera*); void parse_course_displaylists(TrackSectionsI* asset); void render_course_segments(const char*[], struct UnkStruct_800DC5EC*); void func_80291198(void); -void func_802911C4(void); +void render_mario_raceway_pipe(void); void render_choco_mountain(struct UnkStruct_800DC5EC*); void render_bowsers_castle(struct UnkStruct_800DC5EC*); void render_banshee_boardwalk(struct UnkStruct_800DC5EC*); From 03f09a93f198f5f42ff76cd33d9b16fcc2212731 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 17:48:19 -0700 Subject: [PATCH 08/30] lod fix --- src/engine/courses/MarioRaceway.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index e0cfd1f59..1213eb0d4 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -112,6 +112,10 @@ void MarioRaceway::Load() { // d_course_mario_raceway_packed_dl_8E8 generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast(0x070008E8))); } else { + if (CVarGetInteger("gDisableLod", 0) == true) { + gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070008E8))); + return; + } // d_course_mario_raceway_packed_dl_2D68 generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast(0x07002D68))); } From 26dca2697b29afbd8945ccf1288ea8de934134bf Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 16 Nov 2024 17:52:10 -0700 Subject: [PATCH 09/30] Fix pipe compile --- src/engine/courses/MarioRaceway.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index 1213eb0d4..ea8593e17 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -107,17 +107,19 @@ MarioRaceway::MarioRaceway() { void MarioRaceway::Load() { Course::Load(); - generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast(0x07001140))); + generate_collision_mesh_with_defaults(segmented_gfx_to_virtual((void*)0x07001140)); + + // Generate pipe collision mesh if (gScreenModeSelection == SCREEN_MODE_1P) { // d_course_mario_raceway_packed_dl_8E8 - generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast(0x070008E8))); + generate_collision_mesh_with_defaults(segmented_gfx_to_virtual((void*)0x070008E8)); } else { if (CVarGetInteger("gDisableLod", 0) == true) { - gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070008E8))); - return; + generate_collision_mesh_with_defaults(segmented_gfx_to_virtual((void*)0x070008E8)); + } else { + // d_course_mario_raceway_packed_dl_2D68 + generate_collision_mesh_with_defaults(segmented_gfx_to_virtual((void*)0x07002D68)); } - // d_course_mario_raceway_packed_dl_2D68 - generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast(0x07002D68))); } parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_mario_raceway_addr)); From 8414e8847c07185eb54d3d6e2c99f129593a9638 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sun, 17 Nov 2024 00:48:49 -0700 Subject: [PATCH 10/30] Fix render bug --- src/render_player.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/render_player.c b/src/render_player.c index 64e2fe9be..6020eb546 100644 --- a/src/render_player.c +++ b/src/render_player.c @@ -739,7 +739,9 @@ void render_players_on_screen_two(void) { } // Call moved to sync kart and wheel tlut loading/rendering - load_kart_texture_and_render_kart_particle_on_screen_two(); + if (gPlayersToRenderCount != 0) { + load_kart_texture_and_render_kart_particle_on_screen_two(); + } try_rendering_player(gPlayerOne, PLAYER_ONE, PLAYER_TWO); try_rendering_player(gPlayerTwo, PLAYER_TWO, PLAYER_TWO); @@ -785,7 +787,9 @@ void render_players_on_screen_three(void) { init_render_player(gPlayerThree, camera3, PLAYER_THREE, PLAYER_THREE); init_render_player(gPlayerFour, camera3, PLAYER_FOUR, PLAYER_THREE); - load_kart_texture_and_render_kart_particle_on_screen_three(); + if (gPlayersToRenderCount != 0) { + load_kart_texture_and_render_kart_particle_on_screen_three(); + } try_rendering_player(gPlayerOne, PLAYER_ONE, PLAYER_THREE); try_rendering_player(gPlayerTwo, PLAYER_TWO, PLAYER_THREE); @@ -813,7 +817,9 @@ void render_players_on_screen_four(void) { init_render_player(gPlayerThree, camera4, PLAYER_THREE, PLAYER_FOUR); init_render_player(gPlayerFour, camera4, PLAYER_FOUR, PLAYER_FOUR); - load_kart_texture_and_render_kart_particle_on_screen_four(); + if (gPlayersToRenderCount != 0) { + load_kart_texture_and_render_kart_particle_on_screen_four(); + } try_rendering_player(gPlayerOne, PLAYER_ONE, PLAYER_FOUR); try_rendering_player(gPlayerTwo, PLAYER_TWO, PLAYER_FOUR); From a3cea25d3051816f686b7a54f7cd96b9bee77200 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sun, 17 Nov 2024 20:56:53 -0700 Subject: [PATCH 11/30] Implement kart chase --- src/engine/courses/TestCourse.cpp | 12 +- src/engine/vehicles/OBombKart.cpp | 194 +++++++++++++++++++++--------- src/engine/vehicles/OBombKart.h | 9 ++ src/racing/render_courses.c | 2 - 4 files changed, 155 insertions(+), 62 deletions(-) diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index 2a8787d23..4a132c410 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -185,8 +185,8 @@ void TestCourse::SpawnActors() { ACTOR_RAILROAD_CROSSING)); rrxing->crossingTrigger = crossing1; - Vec3f pos = {-80, 7, -20}; - gWorldInstance.AddActor(new ACloud(pos)); + //Vec3f pos = {-80, 7, -20}; + //gWorldInstance.AddActor(new ACloud(pos)); } // Likely sets minimap boundaries @@ -265,13 +265,13 @@ void TestCourse::SpawnVehicles() { gVehicle2DWaypointLength = 53; D_80162EB0 = spawn_actor_on_surface(test_course_path2D[0].x, 2000.0f, test_course_path2D[0].z); - gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 0); - gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 8); + //gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 0); + //gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 8); Vec3f pos = {0, 0, 0}; - gWorldInstance.AddBombKart(pos, &D_80164550[0][25], 25, 2, 0.8333333f); - gWorldInstance.AddBombKart(pos, &D_80164550[0][45], 45, 3, 0.8333333f); + gWorldInstance.AddBombKart(pos, &D_80164550[0][25], 25, 4, 0.8333333f); + gWorldInstance.AddBombKart(pos, &D_80164550[0][45], 45, 4, 0.8333333f); } diff --git a/src/engine/vehicles/OBombKart.cpp b/src/engine/vehicles/OBombKart.cpp index 907be2119..584eb840e 100644 --- a/src/engine/vehicles/OBombKart.cpp +++ b/src/engine/vehicles/OBombKart.cpp @@ -22,6 +22,7 @@ extern "C" { #include "defines.h" #include "code_80005FD0.h" #include "math_util_2.h" +#include "collision.h" extern s8 gPlayerCount; } @@ -50,6 +51,9 @@ OBombKart::OBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, Pos[0] = _pos[0]; Pos[1] = _pos[1]; Pos[2] = _pos[2]; + _spawnPos[0] = _pos[0]; + _spawnPos[1] = _pos[1]; + _spawnPos[2] = _pos[2]; CenterY = _pos[1]; WheelPos[0][0] = _pos[0]; WheelPos[0][1] = _pos[1]; @@ -97,10 +101,8 @@ void OBombKart::Tick() { f32 temp_f2; f32 temp_f2_4; f32 sp94; - f32 var_f20; f32 sp88; - f32 var_f22; - f32 var_f24; + Vec3f newPos; States state; u16 bounceTimer; UNUSED u16 sp4C; @@ -117,9 +119,9 @@ void OBombKart::Tick() { } if (((Unk_4A != 1) || (GetCourse() == GetPodiumCeremony()))) { - var_f22 = Pos[0]; - var_f20 = Pos[1]; - var_f24 = Pos[2]; + newPos[0] = Pos[0]; + newPos[1] = Pos[1]; + newPos[2] = Pos[2]; waypoint = WaypointIndex; unk_3C = Unk_3C; someRot = SomeRot; @@ -129,9 +131,9 @@ void OBombKart::Tick() { if (GetCourse() == GetPodiumCeremony()) { if (D_8016347E == 1) { player = gPlayerFour; - temp_f0 = var_f22 - player->pos[0]; - temp_f2 = var_f20 - player->pos[1]; - temp_f12 = var_f24 - player->pos[2]; + temp_f0 = newPos[0] - player->pos[0]; + temp_f2 = newPos[2] - player->pos[1]; + temp_f12 = newPos[2] - player->pos[2]; if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f12 * temp_f12)) < 25.0f) { circleTimer = 0; state = States::EXPLODE; @@ -144,9 +146,9 @@ void OBombKart::Tick() { for (size_t i = 0; i < gPlayerCount; i++) { player = &gPlayers[i]; if (!(player->effects & 0x80000000)) { - temp_f0 = var_f22 - player->pos[0]; - temp_f2 = var_f20 - player->pos[1]; - temp_f12 = var_f24 - player->pos[2]; + temp_f0 = newPos[0] - player->pos[0]; + temp_f2 = newPos[1] - player->pos[1]; + temp_f12 = newPos[2] - player->pos[2]; if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f12 * temp_f12)) < 25.0f) { state = States::EXPLODE; circleTimer = 0; @@ -167,12 +169,12 @@ void OBombKart::Tick() { sp118 = coss(temp_t6) * 25.0; temp_f0_3 = sins(temp_t6) * 25.0; temp_v0_2 = &D_80164550[0][waypoint]; - var_f22 = temp_v0_2->posX + sp118; - var_f20 = CenterY + 3.5f; - var_f24 = temp_v0_2->posZ + temp_f0_3; - D_80162FB0[0] = var_f22; - D_80162FB0[1] = var_f20; - D_80162FB0[2] = var_f24; + newPos[0] = temp_v0_2->posX + sp118; + newPos[1] = CenterY + 3.5f; + newPos[2] = temp_v0_2->posZ + temp_f0_3; + D_80162FB0[0] = newPos[0]; + D_80162FB0[1] = newPos[1]; + D_80162FB0[2] = newPos[2]; temp_t7 = (((circleTimer + 1) % 360) * 0xFFFF) / 360; sp118 = coss(temp_t7) * 25.0; temp_f0_3 = sins(temp_t7) * 25.0; @@ -187,12 +189,12 @@ void OBombKart::Tick() { sp118 = coss(temp_t6) * 25.0; temp_f0_3 = sins(temp_t6) * 25.0; temp_v0_2 = &D_80164550[0][waypoint]; - var_f22 = temp_v0_2->posX + sp118; - var_f20 = CenterY + 3.5f; - var_f24 = temp_v0_2->posZ + temp_f0_3; - D_80162FB0[0] = var_f22; - D_80162FB0[1] = var_f20; - D_80162FB0[2] = var_f24; + newPos[0] = temp_v0_2->posX + sp118; + newPos[1] = CenterY + 3.5f; + newPos[2] = temp_v0_2->posZ + temp_f0_3; + D_80162FB0[0] = newPos[0]; + D_80162FB0[1] = newPos[1]; + D_80162FB0[2] = newPos[2]; temp_t7 = (((circleTimer + 1) % 360) * 0xFFFF) / 360; sp118 = coss(temp_t7) * 25.0; temp_f0_3 = sins(temp_t7) * 25.0; @@ -202,7 +204,7 @@ void OBombKart::Tick() { someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520; break; case States::STATIONARY: - var_f20 = CenterY + 3.5f; + newPos[1] = CenterY + 3.5f; someRot = 0; break; @@ -210,7 +212,7 @@ void OBombKart::Tick() { if ((D_8016347C == 0) || (gNearestWaypointByPlayerId[3] < 5)) { break; } else { - waypoint = func_8000D2B4(var_f22, var_f20, var_f24, waypoint, 3); + waypoint = func_8000D2B4(newPos[0], newPos[1], newPos[2], waypoint, 3); if ((waypoint < 0) || (gWaypointCountByPathIndex[3] < waypoint)) { waypoint = 0; } @@ -225,29 +227,36 @@ void OBombKart::Tick() { D_80162FC0[2] = temp_v0_4->posZ; someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520; } else { - D_80162FB0[0] = var_f22; - D_80162FB0[1] = var_f20; - D_80162FB0[2] = var_f24; + D_80162FB0[0] = newPos[0]; + D_80162FB0[1] = newPos[1]; + D_80162FB0[2] = newPos[2]; D_80162FC0[0] = -2409.197f; D_80162FC0[1] = 0.0f; D_80162FC0[2] = -355.254f; someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520; } - temp_f14 = ((D_80162FB0[0] + D_80162FC0[0]) * 0.5f) - var_f22; - temp_f16 = ((D_80162FB0[2] + D_80162FC0[2]) * 0.5f) - var_f24; + temp_f14 = ((D_80162FB0[0] + D_80162FC0[0]) * 0.5f) - newPos[0]; + temp_f16 = ((D_80162FB0[2] + D_80162FC0[2]) * 0.5f) - newPos[2]; temp_f0_4 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16)); if (temp_f0_4 > 0.01f) { - var_f22 += (Unk_3C * temp_f14) / temp_f0_4; - var_f24 += (Unk_3C * temp_f16) / temp_f0_4; + newPos[0] += (Unk_3C * temp_f14) / temp_f0_4; + newPos[2] += (Unk_3C * temp_f16) / temp_f0_4; } else { - var_f22 += temp_f14 / 5.0f; - var_f24 += temp_f16 / 5.0f; + newPos[0] += temp_f14 / 5.0f; + newPos[2] += temp_f16 / 5.0f; } - var_f20 = calculate_surface_height(var_f22, 2000.0f, var_f24, _Collision.meshIndexZX) + 3.5f; - if (var_f20 < (-1000.0)) { - var_f20 = Pos[1]; + newPos[1] = calculate_surface_height(newPos[0], 2000.0f, newPos[2], _Collision.meshIndexZX) + 3.5f; + if (newPos[1] < (-1000.0)) { + newPos[1] = Pos[1]; } - check_bounding_collision(&_Collision, 10.0f, var_f22, var_f20, var_f24); + check_bounding_collision(&_Collision, 10.0f, newPos[0], newPos[1], newPos[2]); + } + break; + case States::CHASE: + if (!_target) { + _target = OBombKart::FindTarget(); + } else { + OBombKart::Chase(_target, newPos); } break; case States::EXPLODE: @@ -259,7 +268,7 @@ void OBombKart::Tick() { D_80162FC0[0] = temp_v0_4->posX; D_80162FC0[1] = temp_v0_4->posY; D_80162FC0[2] = temp_v0_4->posZ; - var_f20 += 3.0f - (circleTimer * 0.3f); + newPos[1] += 3.0f - (circleTimer * 0.3f); someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520; break; default: @@ -271,7 +280,7 @@ void OBombKart::Tick() { sp118 = coss(0xFFFF - someRot) * circleTimer; var_f18 = sins(0xFFFF - someRot) * circleTimer; circleTimer++; - temp_f2_4 = (var_f20 - 2.3f) + (sp108 / 3.0f); + temp_f2_4 = (newPos[1] - 2.3f) + (sp108 / 3.0f); spAC = temp_f2_4; spA0 = temp_f2_4; sp94 = temp_f2_4; @@ -282,7 +291,7 @@ void OBombKart::Tick() { } else { sp118 = coss(0xFFFF - someRot) * 1.5f; var_f18 = sins(0xFFFF - someRot) * 1.5f; - temp_f16_2 = var_f20 - 2.3f; + temp_f16_2 = newPos[1] - 2.3f; temp_f12_3 = (bounceTimer % 3) * 0.15f; temp_f14_2 = temp_f16_2 - temp_f12_3; temp_f12_4 = temp_f16_2 + temp_f12_3; @@ -290,25 +299,25 @@ void OBombKart::Tick() { sp94 = temp_f14_2; spA0 = temp_f12_4; sp88 = temp_f12_4; - var_f20 += sins((bounceTimer * 0x13FFEC) / 360); + newPos[1] += sins((bounceTimer * 0x13FFEC) / 360); bounceTimer = (bounceTimer + 1) % 18; } - WheelPos[0][0] = (sp118 - var_f18) + var_f22; + WheelPos[0][0] = (sp118 - var_f18) + newPos[0]; WheelPos[0][1] = spAC; - WheelPos[0][2] = (var_f18 + sp118) + var_f24; - WheelPos[1][0] = (var_f18 + sp118) + var_f22; + WheelPos[0][2] = (var_f18 + sp118) + newPos[2]; + WheelPos[1][0] = (var_f18 + sp118) + newPos[0]; WheelPos[1][1] = spA0; - WheelPos[1][2] = (var_f18 - sp118) + var_f24; - WheelPos[2][0] = ((-sp118) - var_f18) + var_f22; + WheelPos[1][2] = (var_f18 - sp118) + newPos[2]; + WheelPos[2][0] = ((-sp118) - var_f18) + newPos[0]; WheelPos[2][1] = sp94; - WheelPos[2][2] = ((-var_f18) + sp118) + var_f24; - WheelPos[3][0] = ((-sp118) + var_f18) + var_f22; + WheelPos[2][2] = ((-var_f18) + sp118) + newPos[2]; + WheelPos[3][0] = ((-sp118) + var_f18) + newPos[0]; WheelPos[3][1] = sp88; - WheelPos[3][2] = ((-var_f18) - sp118) + var_f24; - Pos[0] = var_f22; - Pos[1] = var_f20; - Pos[2] = var_f24; + WheelPos[3][2] = ((-var_f18) - sp118) + newPos[2]; + Pos[0] = newPos[0]; + Pos[1] = newPos[1]; + Pos[2] = newPos[2]; WaypointIndex = waypoint; Unk_3C = unk_3C; SomeRot = someRot; @@ -447,3 +456,80 @@ void OBombKart::Waypoint(s32 screenId) { void OBombKart::Collision(s32 playerId, Player* player) { } + +Player* OBombKart::FindTarget() { + for (size_t i = 0; i < gPlayerCount; i++) { + if (is_within_distance_2d(Pos[0], Pos[2], gPlayers[i].pos[0], gPlayers[i].pos[2], 500)) { + return &gPlayers[i]; + } + } + return NULL; +} + +void OBombKart::Chase(Player* player, Vec3f pos) { + f32 speed = 2.7f; // Speed the kart uses in a chase + + if (!player) return; // Ensure player is valid + + // Calculate the directional vector toward the player + Vec3f direction; + direction[0] = player->pos[0] - pos[0]; + direction[1] = player->pos[1] - pos[1]; + direction[2] = player->pos[2] - pos[2]; + + // Calculate the distance in the XZ plane + f32 xz_dist = sqrtf((direction[0] * direction[0]) + (direction[2] * direction[2])); + printf("dist: %f\n", xz_dist); + + // Reset distance + if (xz_dist > 700.0f) { + _target = NULL; + pos[0] = _spawnPos[0]; + pos[1] = _spawnPos[1]; + pos[2] = _spawnPos[2]; + return; + } + + // Break off the chase if player has boo item + if (player->effects & BOO_EFFECT) { + _target = NULL; + pos[0] = _spawnPos[0]; + pos[1] = _spawnPos[1]; + pos[2] = _spawnPos[2]; + return; + } + + if (xz_dist > 0.0f) { + + // Normalize the direction vector in the XZ plane + direction[0] /= xz_dist; + direction[2] /= xz_dist; + + // Scale the movement by a fixed step size + const f32 stepSize = speed; // Adjust step size for desired speed + pos[0] += direction[0] * stepSize; + pos[2] += direction[2] * stepSize; + } + + + + // Store the new position for collision checks + Vec3f newPosition; + newPosition[0] = pos[0]; + newPosition[1] = pos[1]; + newPosition[2] = pos[2]; + + newPosition[1] = calculate_surface_height(pos[0], 2000.0f, pos[2], _Collision.meshIndexZX) + 3.5f; + + // Perform collision detection and update position + // actor_terrain_collision(&_Collision, 4.0f, Pos[0], Pos[1], Pos[2], + // newPosition[0], newPosition[1], newPosition[2]); + + // Update position based on collision results + pos[0] = newPosition[0]; + pos[1] = newPosition[1]; + pos[2] = newPosition[2]; + + + check_bounding_collision(&_Collision, 10.0f, pos[0], pos[1], pos[2]); +} \ No newline at end of file diff --git a/src/engine/vehicles/OBombKart.h b/src/engine/vehicles/OBombKart.h index a857b207b..8a331776c 100644 --- a/src/engine/vehicles/OBombKart.h +++ b/src/engine/vehicles/OBombKart.h @@ -27,6 +27,7 @@ private: CCW, CW, STATIONARY, + CHASE, EXPLODE, PODIUM_CEREMONY, }; @@ -61,4 +62,12 @@ public: void SomeRender(Vec3f arg1); void LoadMtx(); void Waypoint(s32 screenId); +private: + Player* FindTarget(); + void Chase(Player*, Vec3f pos); + + Vec3f _spawnPos; + Player* _target = NULL; + + }; diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index bf5d8dd09..31f952276 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -188,8 +188,6 @@ void func_80291198(void) { } void render_mario_raceway_pipe(void) { - - if (gScreenModeSelection == SCREEN_MODE_1P) { // d_course_mario_raceway_packed_dl_8E8 gSPDisplayList(gDisplayListHead++, ((uintptr_t) segmented_gfx_to_virtual(0x070008E8))); From 66d66c9855057ff0c4eaf762dd562203b0895dad Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sun, 17 Nov 2024 21:06:22 -0700 Subject: [PATCH 12/30] Chase fix --- src/engine/vehicles/OBombKart.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/engine/vehicles/OBombKart.cpp b/src/engine/vehicles/OBombKart.cpp index 584eb840e..b7d4174bb 100644 --- a/src/engine/vehicles/OBombKart.cpp +++ b/src/engine/vehicles/OBombKart.cpp @@ -458,16 +458,18 @@ void OBombKart::Collision(s32 playerId, Player* player) { } Player* OBombKart::FindTarget() { - for (size_t i = 0; i < gPlayerCount; i++) { + for (size_t i = 0; i < NUM_PLAYERS; i++) { if (is_within_distance_2d(Pos[0], Pos[2], gPlayers[i].pos[0], gPlayers[i].pos[2], 500)) { - return &gPlayers[i]; + if (gPlayers[i].type & PLAYER_HUMAN) { + return &gPlayers[i]; + } } } return NULL; } void OBombKart::Chase(Player* player, Vec3f pos) { - f32 speed = 2.7f; // Speed the kart uses in a chase + const f32 speed = 2.7f; // Speed the kart uses in a chase if (!player) return; // Ensure player is valid @@ -479,7 +481,6 @@ void OBombKart::Chase(Player* player, Vec3f pos) { // Calculate the distance in the XZ plane f32 xz_dist = sqrtf((direction[0] * direction[0]) + (direction[2] * direction[2])); - printf("dist: %f\n", xz_dist); // Reset distance if (xz_dist > 700.0f) { @@ -506,14 +507,10 @@ void OBombKart::Chase(Player* player, Vec3f pos) { direction[2] /= xz_dist; // Scale the movement by a fixed step size - const f32 stepSize = speed; // Adjust step size for desired speed - pos[0] += direction[0] * stepSize; - pos[2] += direction[2] * stepSize; + pos[0] += direction[0] * speed; + pos[2] += direction[2] * speed; } - - - // Store the new position for collision checks Vec3f newPosition; newPosition[0] = pos[0]; newPosition[1] = pos[1]; @@ -521,15 +518,9 @@ void OBombKart::Chase(Player* player, Vec3f pos) { newPosition[1] = calculate_surface_height(pos[0], 2000.0f, pos[2], _Collision.meshIndexZX) + 3.5f; - // Perform collision detection and update position - // actor_terrain_collision(&_Collision, 4.0f, Pos[0], Pos[1], Pos[2], - // newPosition[0], newPosition[1], newPosition[2]); - - // Update position based on collision results pos[0] = newPosition[0]; pos[1] = newPosition[1]; pos[2] = newPosition[2]; - check_bounding_collision(&_Collision, 10.0f, pos[0], pos[1], pos[2]); } \ No newline at end of file From 8a830169ead6a05dff5347899191c4916041055f Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sun, 17 Nov 2024 21:06:56 -0700 Subject: [PATCH 13/30] Chase perf --- src/engine/vehicles/OBombKart.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/vehicles/OBombKart.cpp b/src/engine/vehicles/OBombKart.cpp index b7d4174bb..a73a89f84 100644 --- a/src/engine/vehicles/OBombKart.cpp +++ b/src/engine/vehicles/OBombKart.cpp @@ -459,8 +459,8 @@ void OBombKart::Collision(s32 playerId, Player* player) { Player* OBombKart::FindTarget() { for (size_t i = 0; i < NUM_PLAYERS; i++) { - if (is_within_distance_2d(Pos[0], Pos[2], gPlayers[i].pos[0], gPlayers[i].pos[2], 500)) { - if (gPlayers[i].type & PLAYER_HUMAN) { + if (gPlayers[i].type & PLAYER_HUMAN) { + if (is_within_distance_2d(Pos[0], Pos[2], gPlayers[i].pos[0], gPlayers[i].pos[2], 500)) { return &gPlayers[i]; } } From 7ca7f183668cad11ad12155fab3d418107a36b06 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:20:40 -0700 Subject: [PATCH 14/30] Fix credits transition widescreen --- src/ending/ceremony_and_credits.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ending/ceremony_and_credits.c b/src/ending/ceremony_and_credits.c index d91f3ace8..a55cf78d0 100644 --- a/src/ending/ceremony_and_credits.c +++ b/src/ending/ceremony_and_credits.c @@ -22,6 +22,8 @@ #include "code_80057C60.h" #include "defines.h" +#include "src/port/Engine.h" + f32 D_802856B0 = 98.0f; f32 D_802856B4 = 12.0f; f32 gOrderedSizeSlidingBorders = 52.0f; @@ -1558,25 +1560,29 @@ void play_cutscene(CinematicCamera* camera) { * Used at the beginning of award ceremony and throughout credits. */ void ceremony_transition_sliding_borders(void) { - f32 temp_f0; - f32 temp_f14; + f32 uly; + f32 lry; - temp_f14 = D_802856B0 - gSizeSlidingBorders; - if (temp_f14 < 0.0f) { - temp_f14 = 0.0f; + lry = D_802856B0 - gSizeSlidingBorders; + if (lry < 0.0f) { + lry = 0.0f; } - temp_f0 = D_802856B0 + gSizeSlidingBorders; + uly = D_802856B0 + gSizeSlidingBorders; // clang-format off // Note that this MUST be on one line. All hail significant whitespace in C! - do {if (temp_f0 > 240.0f) { temp_f0 = 239.0f; } } while (0); + do {if (uly > 240.0f) { uly = 239.0f; } } while (0); // clang-format on gDPPipeSync(gDisplayListHead++); gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCycleType(gDisplayListHead++, G_CYC_FILL); gDPSetFillColor(gDisplayListHead++, (GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1))); - gDPFillRectangle(gDisplayListHead++, 0, 0, 319, (s32) temp_f14); - gDPFillRectangle(gDisplayListHead++, 0, (s32) temp_f0, 319, 239); + + gDPFillWideRectangle(gDisplayListHead++, OTRGetRectDimensionFromLeftEdge(0), 0, OTRGetGameRenderWidth(), (s32)lry); + gDPFillWideRectangle(gDisplayListHead++, OTRGetRectDimensionFromLeftEdge(0), (s32)uly, OTRGetGameRenderWidth(), 239); + //gDPFillRectangle(gDisplayListHead++, 0, 0, 319, (s32) lry); + //gDPFillRectangle(gDisplayListHead++, 0, (s32) uly, 319, 239); + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); adjust_f32_value_transition(&gSizeSlidingBorders, gOrderedSizeSlidingBorders, D_802856BC / D_802856B4); } From 93973e08c36ab1213f6d33a39c42c29add6e07b7 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:30:04 -0700 Subject: [PATCH 15/30] First batch of widescreen fixes --- src/code_80057C60.c | 22 +++--- src/code_80057C60.h | 2 +- src/code_8006E9C0.c | 16 ++--- src/code_80091750.c | 97 ++++++++++++++++++-------- src/code_80091750.h | 1 + src/math_util_2.c | 49 +++++++++++++ src/math_util_2.h | 2 + src/render_objects.c | 162 +++++++++++++++++++++++++++++++++++-------- 8 files changed, 275 insertions(+), 76 deletions(-) diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 205e656d2..11a1d436e 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -151,7 +151,7 @@ UNUSED s8 D_801657E0; s8 D_801657E1; s8 D_801657E2; s8 D_801657E3; -s8 D_801657E4; +s8 gHUDModes; s8 D_801657E5; bool D_801657E6; u8 D_801657E7; @@ -963,7 +963,7 @@ void func_80058F78(void) { set_matrix_hud_screen(); if ((!gDemoMode) && (gIsHUDVisible != 0) && (D_801657D8 == 0)) { draw_item_window(PLAYER_ONE); - if (D_801657E4 != 2) { + if (gHUDModes != 2) { render_hud_timer(PLAYER_ONE); draw_simplified_lap_count(PLAYER_ONE); func_8004EB38(0); @@ -1059,7 +1059,7 @@ void func_800591B4(void) { } } } - if ((D_801657E4 != 2) && (gModeSelection == GRAND_PRIX) && (D_8018D2BC != 0)) { + if ((gHUDModes != 2) && (gModeSelection == GRAND_PRIX) && (D_8018D2BC != 0)) { func_80050320(); } func_800590D4(); @@ -1135,7 +1135,7 @@ void render_hud_lap_3p_4p(s32 playerId) { draw_lap_count(playerHUD[playerId].lapX - 12, playerHUD[playerId].lapY + 4, playerHUD[playerId].alsoLapCount); } - if (D_801657E4 == 2) { + if (gHUDModes == 2) { if (playerHUD[playerId].unk_74 && D_80165608) { func_80047910(playerHUD[playerId].unk_6C, playerHUD[playerId].unk_6E, 0, 1.0f, (u8*) common_tlut_portrait_bomb_kart_and_question_mark, common_texture_portrait_bomb_kart, @@ -1499,14 +1499,14 @@ void func_8005A3C0(void) { switch (gPlayerCountSelection1) { case 1: if (gControllerOne->buttonPressed & R_CBUTTONS) { - if (++D_801657E4 >= 3) { - D_801657E4 = 0; + if (++gHUDModes >= 3) { + gHUDModes = 0; } - if (D_801657E4 == 2) { + if (gHUDModes == 2) { D_801657E8 = false; D_801657E6 = false; D_801657F0 = true; - } else if (D_801657E4 == 1) { + } else if (gHUDModes == 1) { D_801657E8 = false; D_801657E6 = true; D_801657F0 = false; @@ -1544,14 +1544,14 @@ void func_8005A3C0(void) { if (gModeSelection != BATTLE) { D_801657F0 = (D_801657F0 + 1) & 1; } - D_801657E4 = (D_801657E4 + 1) & 1; + gHUDModes = (gHUDModes + 1) & 1; b = true; } break; case 4: if ((gControllerOne->buttonPressed & R_CBUTTONS) || (gControllerTwo->buttonPressed & R_CBUTTONS) || (gControllerThree->buttonPressed & R_CBUTTONS) || (gControllerFour->buttonPressed & R_CBUTTONS)) { - D_801657E4 = (D_801657E4 + 1) & 1; + gHUDModes = (gHUDModes + 1) & 1; D_801657F8 = (D_801657F8 + 1) & 1; D_80165800[0] = (D_80165800[0] + 1) & 1; if (gModeSelection != BATTLE) { @@ -2610,7 +2610,7 @@ void func_8005CB60(s32 playerId, s32 lapCount) { break; case 3: /* switch 1 */ if ((D_8018D114 == 0) || (D_8018D114 == 1)) { - D_801657E4 = 0; + gHUDModes = 0; D_801657E6 = 0; D_801657F0 = 0; D_801657E8 = 1; diff --git a/src/code_80057C60.h b/src/code_80057C60.h index 6fd7b67ab..ec0bc4696 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -331,7 +331,7 @@ extern s8 D_801657D8; extern s8 D_801657E1; extern s8 D_801657E2; extern s8 D_801657E3; -extern s8 D_801657E4; +extern s8 gHUDModes; extern s8 D_801657E5; extern bool D_801657E6; extern u8 D_801657E7; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index e939ff8e8..48d4ddda6 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -370,7 +370,7 @@ void func_8006F008(void) { } void func_8006F824(s32 arg0) { - D_80165808 = D_801657E4; + D_80165808 = gHUDModes; D_80165810 = D_801657E6; D_80165820 = D_801657F0; D_80165818 = D_801657E8; @@ -385,14 +385,14 @@ void func_8006F824(s32 arg0) { void func_8006F8CC(void) { if (D_8018EDFC == 0) { D_8018EDFC = 1; - D_801657E4 = 0; + gHUDModes = 0; D_801657E6 = 0; D_801657F0 = 0; D_801657E8 = 1; D_80165800[0] = D_80165800[1] = 1; if (gPlayerCount == 4) { if (gModeSelection != 3) { - D_801657E4 = 1; + gHUDModes = 1; D_801657F0 = 1; D_801657F8 = 1; D_80165800[0] = D_80165800[1] = 0; @@ -405,7 +405,7 @@ void func_8006F8CC(void) { D_801657F8 = 1; } else if (gPlayerCount == 2) { if (gModeSelection != (s32) 3) { - D_801657E4 = 1; + gHUDModes = 1; D_801657F0 = 1; D_80165800[0] = D_80165800[1] = 0; } @@ -414,7 +414,7 @@ void func_8006F8CC(void) { } func_8006F824(0); } else { - D_801657E4 = D_80165808; + gHUDModes = D_80165808; D_801657E6 = D_80165810; D_801657F0 = D_80165820; D_801657E8 = D_80165818; @@ -1067,9 +1067,9 @@ void init_hud_one_player(void) { playerHUD[PLAYER_ONE].lapCompletionTimeXs[0] = 0x012C; playerHUD[PLAYER_ONE].lapCompletionTimeXs[1] = 0x012C; playerHUD[PLAYER_ONE].timerY = 0x0011; - playerHUD[PLAYER_ONE].lapX = -0x0028; - playerHUD[PLAYER_ONE].lapAfterImage1X = -0x0028; - playerHUD[PLAYER_ONE].lapAfterImage2X = -0x0028; + playerHUD[PLAYER_ONE].lapX = -40; + playerHUD[PLAYER_ONE].lapAfterImage1X = -40; + playerHUD[PLAYER_ONE].lapAfterImage2X = -40; playerHUD[PLAYER_ONE].lapY = 0x0019; playerHUD[PLAYER_ONE].itemBoxX = 0x00A0; playerHUD[PLAYER_ONE].itemBoxY = -0x0020; diff --git a/src/code_80091750.c b/src/code_80091750.c index 200a94398..b632abe39 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -3284,6 +3284,42 @@ Gfx* draw_box_fill_wide(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry // draw a box with a solid outline Gfx* draw_box(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 red, u32 green, u32 blue, u32 alpha) { + red &= 0xFF; + green &= 0xFF; + blue &= 0xFF; + alpha &= 0xFF; + if (lrx < ulx) { + swap_values(&ulx, &lrx); + } + if (lry < uly) { + swap_values(&uly, &lry); + } + if ((ulx >= 0x140) || (uly >= 0xF0)) { + return displayListHead; + } + if (ulx < 0) { + ulx = 0; + } + if (uly < 0) { + uly = 0; + } + if ((lrx < 0) || (lry < 0)) { + return displayListHead; + } + if (lrx >= 0x141) { + lrx = 0x140; + } + if (lry >= 0xF1) { + lry = 0xF0; + } + gSPDisplayList(displayListHead++, D_02008008); + gDPSetPrimColor(displayListHead++, 0, 0, red, green, blue, alpha); + gDPFillRectangle(displayListHead++, ulx, uly, lrx, lry); + gDPPipeSync(displayListHead++); + return displayListHead; +} + +Gfx* draw_box_wide(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 red, u32 green, u32 blue, u32 alpha) { red &= 0xFF; green &= 0xFF; blue &= 0xFF; @@ -3316,7 +3352,6 @@ Gfx* draw_box(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 red, gDPSetPrimColor(displayListHead++, 0, 0, red, green, blue, alpha); gDPFillWideRectangle(displayListHead++, OTRGetRectDimensionFromLeftEdge(ulx), uly, OTRGetRectDimensionFromRightEdge(lrx), lry); - //gDPFillRectangle(displayListHead++, ulx, uly, lrx, lry); gDPPipeSync(displayListHead++); return displayListHead; } @@ -3325,6 +3360,10 @@ Gfx* func_80098FC8(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry) { return draw_box_fill(displayListHead, ulx, uly, lrx, lry, 0, 0, 0, 0xFF); } +Gfx* func_80098FC8_wide(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry) { + return draw_box_fill_wide(displayListHead, ulx, uly, lrx, lry, 0, 0, 0, 0xFF); +} + void dma_copy_base_729a30(u64* arg0, size_t nbytes, void* vaddr) { #ifdef TARGET_N64 OSIoMesg sp30; @@ -4729,7 +4768,7 @@ void func_8009CBE4(s32 arg0, s32 arg1, s32 arg2) { h = unk->screenHeight; } color = &D_800E7AE8[arg2]; - gDisplayListHead = draw_box(gDisplayListHead, x - (w / 2), y - (h / 2), (w / 2) + x, (h / 2) + y, color->red, + gDisplayListHead = draw_box_wide(gDisplayListHead, x - (w / 2), y - (h / 2), (w / 2) + x, (h / 2) + y, color->red, color->green, color->blue, 0xFF - (D_8018E7D0[arg0] * 0xFF / D_8018E7B8[arg0])); if ((arg1 == 0) && (D_8018E7D0[arg0] += 1, (D_8018E7D0[arg0] >= D_8018E7B8[arg0]))) { @@ -5146,7 +5185,7 @@ void func_8009D77C(s32 arg0, s32 arg1, s32 arg2) { someMath0 += var_t3; someMath1 = temp_t8; someMath1 += var_t4; - gDisplayListHead = draw_box(gDisplayListHead, var_t3 - temp_v1, var_t4 - temp_t8, someMath0, someMath1, + gDisplayListHead = draw_box_wide(gDisplayListHead, var_t3 - temp_v1, var_t4 - temp_t8, someMath0, someMath1, temp_v0_2->red, temp_v0_2->green, temp_v0_2->blue, var_t2); if (arg1 == 0) { D_8018E7D0[arg0]++; @@ -5198,7 +5237,7 @@ void func_8009D998(s32 arg0) { someMath1 = temp_v1; someMath1 += var_t1; gDisplayListHead = - draw_box(gDisplayListHead, var_t0 - temp_v0, var_t1 - temp_v1, someMath0, someMath1, 0, 0, 0, 0x000000FF); + draw_box_wide(gDisplayListHead, var_t0 - temp_v0, var_t1 - temp_v1, someMath0, someMath1, 0, 0, 0, 0x000000FF); } void func_8009DAA8(void) { @@ -5213,7 +5252,7 @@ void func_8009DAA8(void) { if ((s32) var_t0 >= 0x100) { var_t0 = 0x000000FF; } - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, (s32) var_t0); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, (s32) var_t0); } void func_8009DB8C(void) { @@ -5264,7 +5303,7 @@ void func_8009DB8C(void) { if (var_v1 >= 0x100) { var_v1 = 0x000000FF; } - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, var_v1); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, var_v1); } void func_8009DEF8(u32 arg0, u32 arg1) { @@ -6676,13 +6715,13 @@ void func_800A1350(struct_8018D9E0_entry* arg0) { case 0: case 2: case 4: - gDisplayListHead = draw_box(gDisplayListHead, arg0->column, arg0->row, arg0->column + 0x40, + gDisplayListHead = draw_box_wide(gDisplayListHead, arg0->column, arg0->row, arg0->column + 0x40, arg0->row + 0x4C, 0, 0, 0, 0x00000064); break; case 1: case 3: thing = arg0->unk1C; - gDisplayListHead = draw_box(gDisplayListHead, arg0->column + thing, arg0->row, + gDisplayListHead = draw_box_wide(gDisplayListHead, arg0->column + thing, arg0->row, (arg0->column - thing) + 0x40, arg0->row + 0x4C, 0, 0, 0, 0x00000064); break; } @@ -6740,7 +6779,7 @@ void func_800A15EC(struct_8018D9E0_entry* arg0) { s16 courseId = gCupCourseOrder[(arg0->type - 0x7C) / 4][(arg0->type - 0x7C) % 4]; gDisplayListHead = func_8009C204(gDisplayListHead, segmented_to_virtual_dupe(D_800E7D74[courseId]), arg0->column, arg0->row, 2); - gDisplayListHead = draw_box(gDisplayListHead, arg0->column, arg0->row + 0x27, arg0->column + 0x40, arg0->row + 0x30, + gDisplayListHead = draw_box_wide(gDisplayListHead, arg0->column, arg0->row + 0x27, arg0->column + 0x40, arg0->row + 0x30, 0, 0, 0, 0xFF); gDisplayListHead = func_8009C204(gDisplayListHead, segmented_to_virtual_dupe(D_800E7DC4[courseId]), arg0->column, arg0->row + 0x27, 3); @@ -6928,7 +6967,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { char sp98[3]; struct_8018EE10_entry* var_v1; - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, 0x00000064); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, 0x00000064); switch (D_8018EDEC) { /* switch 1 */ case 0x15: /* switch 1 */ case 0x16: /* switch 1 */ @@ -7174,15 +7213,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1FB0.s") void func_800A2D1C(struct_8018D9E0_entry* arg0) { switch (D_80164A28) { case 1: - gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, 0x28); - gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0xC7, 0x13F, 0xEF); + gDisplayListHead = func_80098FC8_wide(gDisplayListHead, 0, 0, 0x13F, 0x28); + gDisplayListHead = func_80098FC8_wide(gDisplayListHead, 0, 0xC7, 0x13F, 0xEF); arg0->unk1C = 0x28; break; case 2: arg0->unk1C -= 2; if (arg0->unk1C > 0) { - gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, arg0->unk1C); - gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); + gDisplayListHead = func_80098FC8_wide(gDisplayListHead, 0, 0, 0x13F, arg0->unk1C); + gDisplayListHead = func_80098FC8_wide(gDisplayListHead, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); } else { arg0->type = 0; } @@ -7193,8 +7232,8 @@ void func_800A2D1C(struct_8018D9E0_entry* arg0) { } else { arg0->unk1C -= 2; if (arg0->unk1C > 0) { - gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, arg0->unk1C); - gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); + gDisplayListHead = func_80098FC8_wide(gDisplayListHead, 0, 0, 0x13F, arg0->unk1C); + gDisplayListHead = func_80098FC8_wide(gDisplayListHead, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); } else { arg0->type = 0; } @@ -7765,7 +7804,7 @@ void render_pause_menu_time_trials(struct_8018D9E0_entry* arg0) { s32 var_s0; s32 zero = 0; // ? - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x0000008C); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x0000008C); set_text_color(TEXT_YELLOW); draw_text(0x000000A0, 0x00000050, CourseManager_GetProps()->Name, 0, 1.0f, 1.0f); @@ -7814,7 +7853,7 @@ void render_pause_menu_versus(struct_8018D9E0_entry* arg0) { temp_t0 = temp_v0->screenStartY; temp_t3 = temp_v0->screenWidth / 2; temp_t4 = temp_v0->screenHeight / 2; - gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + gDisplayListHead = draw_box_wide(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, temp_t0 + temp_t4, 0, 0, 0, 0x0000008C); temp_s3 = &D_800E8540[(gScreenModeSelection * 4) + (gIsGamePaused - 1)]; for (var_s0 = 0; var_s0 < 4; var_s0++) { @@ -7845,7 +7884,7 @@ void render_pause_grand_prix(struct_8018D9E0_entry* arg0) { temp_t0 = temp_v0->screenStartY; temp_t3 = temp_v0->screenWidth / 2; temp_t4 = temp_v0->screenHeight / 2; - gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + gDisplayListHead = draw_box_wide(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, temp_t0 + temp_t4, 0, 0, 0, 140); temp_s3 = &D_800E85C0[(gScreenModeSelection * 4) + (gIsGamePaused - 1)]; temp_s0 = ((get_string_width(gCupNames[GetCupIndex()]) * one) + 10.0f) / 2; @@ -7878,7 +7917,7 @@ void render_pause_battle(struct_8018D9E0_entry* arg0) { temp_t0 = temp_v0->screenStartY; temp_t3 = temp_v0->screenWidth / 2; temp_t4 = temp_v0->screenHeight / 2; - gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + gDisplayListHead = draw_box_wide(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, temp_t0 + temp_t4, 0, 0, 0, 0x0000008C); temp_s3 = &D_800E8600[(gScreenModeSelection * 4) + (gIsGamePaused - 1)]; for (var_a1 = 0; var_a1 < 4; var_a1++) { @@ -7956,7 +7995,7 @@ void func_800A5738(struct_8018D9E0_entry* arg0) { if ((arg0->unk1C >= 0x1E) && ((gGlobalTimer / 16) % 2)) { why = get_string_width(gTextPauseButton[5]) * 0.8f; gDisplayListHead = - draw_box(gDisplayListHead, 0x000000C0, 0x00000021, (s32) (why) + 0xC6, 0x00000032, 0, 0, 0, 0x00000096); + draw_box_wide(gDisplayListHead, 0x000000C0, 0x00000021, (s32) (why) + 0xC6, 0x00000032, 0, 0, 0, 0x00000096); set_text_color(1); func_80093324(0x000000BF, 0x00000030, gTextPauseButton[5], 0, 0.8f, 0.8f); } @@ -7968,7 +8007,7 @@ void func_800A5738(struct_8018D9E0_entry* arg0) { var_s1 = 0x0000008C; var_s2 = 0x000000FF; } - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, var_s1); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, var_s1); gDPSetPrimColor(gDisplayListHead++, 0, 0, 0x00, 0x00, 0x00, var_s2); set_text_color(3); func_80093754(0x000000A0, 0x00000050, CourseManager_GetProps()->Name, @@ -8122,14 +8161,14 @@ void func_800A6154(struct_8018D9E0_entry* arg0) { s32 var_s1; if (arg0->cursor == 0) { - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, arg0->unk1C); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, arg0->unk1C); set_text_color(3); gDPSetPrimColor(gDisplayListHead++, 0, 0, 0x00, 0x00, 0x00, (arg0->unk1C * 0xFF) / 100); for (var_s1 = 0, var_s0 = 0x96; var_s0 < 0xBE; var_s1++, var_s0 += 0x14) { func_80093358(0x0000008C, var_s0, gTextPauseButton[(var_s1 * 3) + 1], 0, 1.0f, 1.0f); } } else { - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x00000064); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x00000064); for (var_s1 = 0, var_s0 = 0x96; var_s1 < 2; var_s1++, var_s0 += 0x14) { text_rainbow_effect(arg0->cursor - 0xB, var_s1, TEXT_YELLOW); func_80093324(0x0000008C, var_s0, gTextPauseButton[(var_s1 * 3) + 1], 0, 1.0f, 1.0f); @@ -8154,12 +8193,12 @@ void func_800A638C(struct_8018D9E0_entry* arg0) { UNUSED s8** var_s2; if (arg0->cursor == 0) { - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, arg0->unk1C); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, arg0->unk1C); set_text_color(5); gDPSetPrimColor(gDisplayListHead++, 0, 0, 0x00, 0x00, 0x00, (arg0->unk1C * 0xFF) / 100); func_80093754(0x000000A0, arg0->row + 0x1E, D_800E7778[gModeSelection / 3], 0, 1.0f, 1.0f); } else { - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x00000064); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x00000064); set_text_color(5); draw_text(0x000000A0, arg0->row + 0x1E, D_800E7778[gModeSelection / 3], 0, 1.0f, 1.0f); } @@ -8411,10 +8450,10 @@ void func_800A70E8(struct_8018D9E0_entry* arg0) { void func_800A7258(struct_8018D9E0_entry* arg0) { if (arg0->cursor == 0) { // If shading layer is fading in - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, arg0->unk1C); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, arg0->unk1C); } else { // All other stages of the podium scene - gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, 0x64); + gDisplayListHead = draw_box_wide(gDisplayListHead, 0, 0, 0x13F, 0xEF, 0, 0, 0, 0x64); } } @@ -9180,7 +9219,7 @@ void func_800A8CA4(struct_8018D9E0_entry* arg0) { // Wut? if ((var_s0 != (temp_v0->unk1C % 4)) != 0) { gDisplayListHead = - draw_box(gDisplayListHead, D_800E7208[var_s0][0].column + temp_s2, + draw_box_wide(gDisplayListHead, D_800E7208[var_s0][0].column + temp_s2, D_800E7208[var_s0][0].row + temp_s3, D_800E7208[var_s0][1].column + temp_s2, D_800E7208[var_s0][1].row + temp_s3, 0, 0, 0, 0x00000064); } diff --git a/src/code_80091750.h b/src/code_80091750.h index 8d9c74935..8e482c464 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -174,6 +174,7 @@ Gfx* func_80098558(Gfx*, u32, u32, u32, u32, u32, u32, s32, s32); Gfx* func_800987D0(Gfx*, u32, u32, u32, u32, s32, s32, u8*, u32, s32); Gfx* draw_box_fill(Gfx*, s32, s32, s32, s32, s32, s32, s32, s32); Gfx* draw_box(Gfx*, s32, s32, s32, s32, u32, u32, u32, u32); +Gfx* draw_box_wide(Gfx*, s32, s32, s32, s32, u32, u32, u32, u32); Gfx* func_80098FC8(Gfx*, s32, s32, s32, s32); void dma_copy_base_729a30(u64*, size_t, void*); void dma_copy_base_7fa3c0(u64*, size_t, void*); diff --git a/src/math_util_2.c b/src/math_util_2.c index 7ea23aded..5f63833d8 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -13,6 +13,8 @@ #include "defines.h" #include "camera.h" +#include "port/Engine.h" + #pragma intrinsic(sqrtf) UNUSED void operator_or(s32* arg0, s32 arg1) { @@ -697,6 +699,53 @@ UNUSED void func_800421FC(s32 x, s32 y, f32 scale) { void func_80042330(s32 x, s32 y, u16 angle, f32 scale) { Mat4 matrix; + //printf("panel %d %d %d\n", x, (s32)OTRGetDimensionFromLeftEdge(x), (s32)OTRGetDimensionFromLeftEdge(0)); + + if (gHUDModes != 2) { + if (x < (SCREEN_WIDTH / 2)) { + x = (s32)OTRGetDimensionFromLeftEdge(x); + } else { + x = (s32)OTRGetDimensionFromRightEdge(x); + } + } + + mtxf_translation_x_y_rotate_z_scale_x_y(matrix, x, y, angle, scale); + // convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix); + // gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), + // G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + AddHudMatrix(matrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +} + +void func_80042330_portrait(s32 x, s32 y, u16 angle, f32 scale, s16 lapCount) { + Mat4 matrix; + //printf("panel %d %d %d\n", x, (s32)OTRGetDimensionFromLeftEdge(x), (s32)OTRGetDimensionFromLeftEdge(0)); + + if (gHUDModes != 2 && lapCount < 3) { + if (x < (SCREEN_WIDTH / 2)) { + x = (s32)OTRGetDimensionFromLeftEdge(x); + } else { + x = (s32)OTRGetDimensionFromRightEdge(x); + } + } + + mtxf_translation_x_y_rotate_z_scale_x_y(matrix, x, y, angle, scale); + // convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix); + // gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), + // G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + AddHudMatrix(matrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +} + +void func_80042330_wide(s32 x, s32 y, u16 angle, f32 scale) { + Mat4 matrix; + + if (x < (SCREEN_WIDTH / 2)) { + x = (s32)OTRGetDimensionFromLeftEdge(x); + } else { + x = (s32)OTRGetDimensionFromRightEdge(x); + } + mtxf_translation_x_y_rotate_z_scale_x_y(matrix, x, y, angle, scale); // convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix); // gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), diff --git a/src/math_util_2.h b/src/math_util_2.h index 204b42481..2944fddc1 100644 --- a/src/math_util_2.h +++ b/src/math_util_2.h @@ -70,6 +70,8 @@ void func_80041D24(void); void func_80041D34(void); void set_matrix_hud_screen(void); void func_80042330(s32, s32, u16, f32); +void func_80042330_portrait(s32, s32, u16, f32, s16); +void func_80042330_wide(s32, s32, u16, f32); void mtxf_set_matrix_transformation(Mat4, Vec3f, Vec3su, f32); void mtxf_set_matrix_scale_transl(Mat4, Vec3f, Vec3f, f32); void mtxf_set_matrix_gObjectList(s32, Mat4); diff --git a/src/render_objects.c b/src/render_objects.c index 97d62f84e..bc7728fe2 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -41,6 +41,7 @@ #include #include #include "port/Game.h" +#include "port/Engine.h" #include "engine/Engine.h" #include "engine/courses/Course.h" @@ -1293,7 +1294,7 @@ void func_8004A2F4(s32 arg0, s32 arg1, u16 arg2, f32 arg3, s32 red, s32 green, s void func_8004A384(s32 arg0, s32 arg1, u16 arg2, f32 arg3, s32 red, s32 green, s32 blue, s32 alpha, u8* texture, Vtx* arg9, s32 argA, s32 argB, s32 argC, s32 argD) { - func_80042330(arg0, arg1, arg2, arg3); + func_80042330_wide(arg0, arg1, arg2, arg3); gSPDisplayList(gDisplayListHead++, D_0D007A60); func_8004B414(red, green, blue, alpha); func_80049970(texture, arg9, argA, argB, argC, argD); @@ -1577,17 +1578,68 @@ void func_8004B7DC(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, s32 if (arg6 == 0) { //! @todo Update to F3DEX. Uses OLD definition for gspTextureRectangle. gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, - 1 << 10); + 1 << 10); return; } gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - 1 << 10); + 1 << 10); +} + +void func_8004B7DC_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, s32 arg6) { + + s32 xh = (((x + width) - 1)); + s32 yh = (((y + height) - 1) << 2); + s32 xl = ((x)); + s32 yl = y * 4; + + s32 xh2 = (((x + width))); + s32 yh2 = ((y + height) << 2); + + // if center of image is to the left side of the screen then align left, + // otherwise align right + + s32 coordX = 0; + s32 coordX2 = 0; + + if (arg6 == 0) { + if ((xl - (width / 2)) < (SCREEN_WIDTH / 2)) { + coordX = (s32)OTRGetDimensionFromLeftEdge(xl) << 2; + coordX2 = (s32)(xh) << 2; + } else { + coordX = (s32)OTRGetDimensionFromRightEdge(xl) << 2; + coordX2 = (s32)OTRGetDimensionFromRightEdge(xh) << 2; + } + //! @todo Update to F3DEX. Uses OLD definition for gspTextureRectangle. + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, + 1 << 10); +//OTRGetDimensionFromLeftEdge + //gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, + // 1 << 10); + } else { + + if ((xl - (width / 2)) < (SCREEN_WIDTH / 2)) { + coordX = (s32)OTRGetDimensionFromLeftEdge(xl) << 2; + coordX2 = (s32)(xh2) << 2; + } else { + coordX = (s32)OTRGetDimensionFromRightEdge(xl) << 2; + coordX2 = (s32)OTRGetDimensionFromRightEdge(xh2) << 2; + } + + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, + coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + 1 << 10); + + + } + //gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + // 1 << 10); } void func_8004B950(s32 x, s32 y, s32 width, s32 height, s32 arg4) { func_8004B7DC(x, y, width, height, 0, 0, arg4); } +// Positions item window, the Lap 1/2/3, TIME texture, and minimap on the screen. void func_8004B97C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { UNUSED s32 pad[2]; s32 sp2C; @@ -1612,6 +1664,30 @@ void func_8004B97C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } } +void func_8004B97C_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + UNUSED s32 pad[2]; + s32 sp2C; + s32 var_a1; + s32 var_v0; + s32 var_v1; + + if ((-arg2 < arg0) && (-arg3 < arg1)) { + var_v0 = 0; + var_v1 = 0; + sp2C = arg0; + var_a1 = arg1; + if (arg0 < 0) { + var_v1 = -arg0; + sp2C = 0; + } + if (arg1 < 0) { + var_v0 = -arg1; + var_a1 = 0; + } + func_8004B7DC_wide(sp2C, var_a1, arg2 - var_v1, arg3 - var_v0, var_v1, var_v0, arg4); + } +} + void func_8004BA08(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { UNUSED s32 pad[2]; s32 sp2C; @@ -1636,6 +1712,7 @@ void func_8004BA08(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } } +// Places the timer on the screen void func_8004BA98(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { UNUSED s32 pad[2]; s32 sp34; @@ -1662,7 +1739,37 @@ void func_8004BA98(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s sp30 = 0; phi_a3 = arg3 + arg1; } - func_8004B7DC(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); + func_8004B7DC_wide(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); + } +} + +void func_8004BA98_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { + UNUSED s32 pad[2]; + s32 sp34; + s32 sp30; + s32 sp2C; + s32 phi_a3; + s32 phi_v0; + s32 phi_v1; + + if ((-arg2 < arg0) && (-arg3 < arg1)) { + sp34 = arg0; + sp30 = arg1; + phi_v0 = arg4; + sp2C = arg2; + phi_a3 = arg3; + phi_v1 = arg5; + if (arg0 < 0) { + phi_v0 = arg4 - arg0; + sp34 = 0; + sp2C = arg2 + arg0; + } + if (arg1 < 0) { + phi_v1 = arg5 - arg1; + sp30 = 0; + phi_a3 = arg3 + arg1; + } + func_8004B7DC_wide(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); } } @@ -1749,7 +1856,7 @@ void func_8004C268(u32 arg0, u32 arg1, u8* texture, u32 width, u32 arg4, u32 hei for (i = 0; (u32) i < (arg4 / height); i++) { load_texture_block_rgba16_mirror(img2, width, height); - func_8004B97C(arg0, arg1, width, height, arg6); + func_8004B97C_wide(arg0, arg1, width, height, arg6); //! @todo fakematch? #ifdef AVOID_UB img2 += (width * height) * 2; @@ -1771,7 +1878,7 @@ void draw_hud_2d_texture(s32 x, s32 y, u32 width, u32 height, u8* texture) { gSPDisplayList(gDisplayListHead++, D_0D007EF8); gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); load_texture_block_rgba16_mirror(texture, width, height); - func_8004B97C(x - (width >> 1), y - (height >> 1), width, height, 0); + func_8004B97C_wide(x - (width >> 1), y - (height >> 1), width, height, 0); gSPDisplayList(gDisplayListHead++, D_0D007EB8); } @@ -1780,7 +1887,7 @@ void func_8004C450(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8* texture) { gSPDisplayList(gDisplayListHead++, D_0D007F38); func_8004B614(D_801656C0, D_801656D0, D_801656E0, 0x80, 0x80, 0x80, 0xFF); load_texture_block_rgba16_mirror(texture, arg2, arg3); - func_8004B97C(arg0 - (arg2 >> 1), arg1 - (arg3 >> 1), arg2, arg3, 1); + func_8004B97C_wide(arg0 - (arg2 >> 1), arg1 - (arg3 >> 1), arg2, arg3, 1); gSPDisplayList(gDisplayListHead++, D_0D007EB8); } @@ -1790,7 +1897,7 @@ UNUSED void func_8004C53C(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8* texture) { gSPDisplayList(gDisplayListHead++, D_0D007EF8); gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); load_texture_tile_rgba16_nomirror(texture, arg2, arg3); - func_8004B97C(arg0 - (arg2 >> 1), arg1 - (arg3 >> 1), arg2, arg3, 0); + func_8004B97C_wide(arg0 - (arg2 >> 1), arg1 - (arg3 >> 1), arg2, arg3, 0); gSPDisplayList(gDisplayListHead++, D_0D007EB8); } @@ -1799,7 +1906,7 @@ void func_8004C628(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8* texture) { gSPDisplayList(gDisplayListHead++, D_0D007EF8); gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); load_texture_block_rgba32_nomirror(texture, arg2, arg3); - func_8004B97C(arg0 - (arg2 >> 1), arg1 - (arg3 >> 1), arg2, arg3, 1); + func_8004B97C_wide(arg0 - (arg2 >> 1), arg1 - (arg3 >> 1), arg2, arg3, 1); gSPDisplayList(gDisplayListHead++, D_0D007EB8); } @@ -1938,7 +2045,7 @@ UNUSED void func_8004CD48(s32 arg0, s32 arg1, UNUSED u8* texture, s32 width, s32 for (i = 0; i < arg4 / height; i++) { load_texture_block_ia16_nomirror(img, width, height); - func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); + func_8004B97C_wide(arg0 - (width / 2), var_s0, width, height, 1); img += width * height * 2; var_s0 += height; } @@ -1951,7 +2058,7 @@ UNUSED void func_8004CE8C(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, for (i = 0; i < arg4 / height; i++) { load_texture_block_ia8_nomirror(img, width, height); - func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); + func_8004B97C_wide(arg0 - (width / 2), var_s0, width, height, 1); img += width * height; var_s0 += height; } @@ -1988,7 +2095,7 @@ UNUSED void func_8004D0D4(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, for (i = 0; i < arg4 / height; i++) { func_80044924(img, width, height); - func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); + func_8004B97C_wide(arg0 - (width / 2), var_s0, width, height, 1); img += width * height; var_s0 += height; } @@ -2007,7 +2114,7 @@ void func_8004D210(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4, s32 arg5 for (i = 0; i < arg8 / height; i++) { func_80044924(img, width, height); - func_8004B97C(arg0 - (width / 2), var_s3, width, height, 1); + func_8004B97C_wide(arg0 - (width / 2), var_s3, width, height, 1); img += (width * height) / 2; var_s3 += height; } @@ -2026,7 +2133,7 @@ void func_8004D37C(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4, s32 arg5 for (i = 0; i < arg8 / height; i++) { func_80044F34(img, width, height); - func_8004B97C(arg0 - (width / 2), var_s3, width, height, 1); + func_8004B97C_wide(arg0 - (width / 2), var_s3, width, height, 1); img += (width * height) / 2; var_s3 += height; } @@ -2095,7 +2202,7 @@ void func_8004D7B4(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4) { temp_s5 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (arg3 / 2))); sins(temp_s0); load_texture_block_ia16_nomirror(img, arg3, 1); - func_8004B97C(temp_s5, var_s3, arg3, 1, 1); + func_8004B97C_wide(temp_s5, var_s3, arg3, 1, 1); var_s1 += temp_s7; var_s3 += 1; @@ -2129,7 +2236,7 @@ void func_8004D93C(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4) { temp_s6 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (var))); sins(temp_s0); load_texture_block_ia8_nomirror(img, arg3, 1); - func_8004B97C(temp_s6, var_s4, arg3, 1, 1); + func_8004B97C_wide(temp_s6, var_s4, arg3, 1, 1); var_s1 += temp_s7; img = &img[arg3]; var_s4 += 1; @@ -2161,7 +2268,7 @@ UNUSED void func_8004DAB8(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4) { temp_s6 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (var))); sins(temp_s0); func_80044924(img, arg3, 1); - func_8004B97C(temp_s6, var_s4, arg3, 1, 1); + func_8004B97C_wide(temp_s6, var_s4, arg3, 1, 1); var_s1 += temp_s7; img += arg3; var_s4 += 1; @@ -2232,6 +2339,7 @@ UNUSED void func_8004DF24(s32 arg0, s32 arg1, u8* arg2) { func_8004CF9C(arg0, arg1, arg2, 128, 32, 128, 32); } +// Positions the item box on screen void func_8004DF5C(s32 arg0, s32 arg1, u8* texture, s32 width, s32 arg4, s32 height) { s32 var_s0 = var_s0 = arg1 - (arg4 / 2); u8* img = texture; @@ -2269,7 +2377,7 @@ void func_8004E06C(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4) { temp_s6 = (u32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - var)); sins(temp_s0); rsp_load_texture(img, arg3, 1); - func_8004B97C(temp_s6, var_s4, arg3, 1, 1); + func_8004B97C_wide(temp_s6, var_s4, arg3, 1, 1); var_s1 += temp_s7; img += arg3; var_s4 += 1; @@ -2736,9 +2844,9 @@ void draw_lap_count(s16 lapX, s16 lapY, s8 lap) { load_texture_block_rgba16_mirror((u8*) common_texture_hud_123, 32, 8); // Display current lap. Ex. 1/3 - func_8004BA98(lapX, lapY, 8, 8, lap * 8, 0, 0); // display the digit - func_8004BA98(lapX + 8, lapY, 8, 8, 24, 0, 0); // display the / - func_8004BA98(lapX + 16, lapY, 8, 8, 16, 0, 0); // display the 3 + func_8004BA98_wide(lapX, lapY, 8, 8, lap * 8, 0, 0); // display the digit + func_8004BA98_wide(lapX + 8, lapY, 8, 8, 24, 0, 0); // display the / + func_8004BA98_wide(lapX + 16, lapY, 8, 8, 16, 0, 0); // display the 3 gSPDisplayList(gDisplayListHead++, D_0D007EB8); } @@ -2751,7 +2859,7 @@ void func_8004FDB4(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 characterId, s32 rsp_load_texture(common_texture_portrait_question_mark, 0x00000020, 0x00000020); gSPDisplayList(gDisplayListHead++, D_0D0069E0); } else { - func_80042330(arg0, arg1, 0U, 1.0f); + func_80042330_portrait(arg0, arg1, 0U, 1.0f, arg3); gSPDisplayList(gDisplayListHead++, D_0D007DB8); func_8004B35C(0x000000FF, 0x000000FF, 0x000000FF, arg5); gDPLoadTLUT_pal256(gDisplayListHead++, gPortraitTLUTs[characterId]); @@ -2762,7 +2870,7 @@ void func_8004FDB4(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 characterId, s32 gSPDisplayList(gDisplayListHead++, D_0D0069E0); } if (arg6 != 0) { - func_80042330(arg0, arg1, 0U, 1.0f); + func_80042330_portrait(arg0, arg1, 0U, 1.0f, arg3); gSPDisplayList(gDisplayListHead++, D_0D007A60); func_8004B35C(D_8018D3E4, D_8018D3E8, D_8018D3EC, 0x000000FF); func_80044924(common_texture_character_portrait_border, 0x20, 0x20); @@ -2774,9 +2882,9 @@ void func_8004FDB4(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 characterId, s32 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_hud_type_C_rank_font); rsp_load_texture(common_texture_hud_type_C_rank_font[arg2], 0x00000010, 0x00000010); if (arg7 != 0) { - func_80042330((s32) (arg0 + 9.0f), (s32) (arg1 + 7.0f), 0U, 1.0f); + func_80042330_portrait((s32) (arg0 + 9.0f), (s32) (arg1 + 7.0f), 0U, 1.0f, arg3); } else { - func_80042330((s32) (arg0 - 9.0f), (s32) (arg1 + 7.0f), 0U, 1.0f); + func_80042330_portrait((s32) (arg0 - 9.0f), (s32) (arg1 + 7.0f), 0U, 1.0f, arg3); } gSPDisplayList(gDisplayListHead++, D_0D006980); } @@ -3073,9 +3181,9 @@ void func_80050E34(s32 playerId, s32 arg1) { gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_hud_type_C_rank_tiny_font); rsp_load_texture(common_texture_hud_type_C_rank_tiny_font[arg1 + 1], 8, 8); if (spB8 != 0) { - func_80042330(spD0 + 0x26, (spC4 + spCC) + 4, 0U, 1.0f); + func_80042330_portrait(spD0 + 0x26, (spC4 + spCC) + 4, 0U, 1.0f, lapCount); } else { - func_80042330(spD0 + 0x1B, (spC4 + spCC) + 4, 0U, 1.0f); + func_80042330_portrait(spD0 + 0x1B, (spC4 + spCC) + 4, 0U, 1.0f, lapCount); } gSPDisplayList(gDisplayListHead++, D_0D006950); if ((player == gPlayerOne) && (gScreenModeSelection == SCREEN_MODE_1P)) { From 6358a28ddc797fa97262b94d49d92d71eea6a149 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:57:14 -0700 Subject: [PATCH 16/30] Fix widescreen 2 --- src/math_util_2.c | 2 +- src/port/ui/ImguiUI.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/math_util_2.c b/src/math_util_2.c index 5f63833d8..1eeaecaef 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -721,7 +721,7 @@ void func_80042330_portrait(s32 x, s32 y, u16 angle, f32 scale, s16 lapCount) { Mat4 matrix; //printf("panel %d %d %d\n", x, (s32)OTRGetDimensionFromLeftEdge(x), (s32)OTRGetDimensionFromLeftEdge(0)); - if (gHUDModes != 2 && lapCount < 3) { + if ((gHUDModes != 2) && (D_801657E2 == 0) || (CVarGetInteger("gImprovements", 0) == true)) { if (x < (SCREEN_WIDTH / 2)) { x = (s32)OTRGetDimensionFromLeftEdge(x); } else { diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 52a8ca0e3..2284346bb 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -476,12 +476,13 @@ void DrawEnhancementsMenu() { if (UIWidgets::BeginMenu("Gameplay")) { UIWidgets::WindowButton("Freecam", "gFreecam", GameUI::mFreecamWindow, { .tooltip = "Allows you to fly around the course" }); + UIWidgets::CVarCheckbox("No multiplayer feature cuts", "gMultiplayerNoFeatureCuts", + { .tooltip = "Allows full train and jumbotron in multiplayer, etc." }); + UIWidgets::CVarCheckbox("General Improvements", "gImprovements", { .tooltip = "General improvements to the game experience." }); UIWidgets::CVarCheckbox( "No Level of Detail (LOD)", "gDisableLod", { .tooltip = "Disable Level of Detail (LOD) to avoid models using lower poly versions at a distance" }); - UIWidgets::CVarCheckbox("No multiplayer feature cuts", "gMultiplayerNoFeatureCuts", - { .tooltip = "Allows full train and jumbotron in multiplayer, etc." }); UIWidgets::CVarCheckbox("Disable Culling", "gNoCulling", { .tooltip = "Disable original culling of mk64" }); UIWidgets::CVarSliderFloat( From 9d8a316c8d97a193511a9d0655dd315317c3b966 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:04:54 -0700 Subject: [PATCH 17/30] Extract Audio --- yamls/us/audio_banks.yml | 16 ++++++++++++++++ yamls/us/audio_instrument_sets.yml | 16 ++++++++++++++++ yamls/us/audio_sequences.yml | 16 ++++++++++++++++ yamls/us/audio_tables.yml | 16 ++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 yamls/us/audio_banks.yml create mode 100644 yamls/us/audio_instrument_sets.yml create mode 100644 yamls/us/audio_sequences.yml create mode 100644 yamls/us/audio_tables.yml diff --git a/yamls/us/audio_banks.yml b/yamls/us/audio_banks.yml new file mode 100644 index 000000000..760ed5c59 --- /dev/null +++ b/yamls/us/audio_banks.yml @@ -0,0 +1,16 @@ +:config: + vram: + addr: 0x800E8700 + offset: 0xE9300 + header: + code: + - '#include ' + - '#include ' + header: + - '#include ' + - '#include ' +audiobanks: + symbol: gAudioBanks + type: bob + offset: 0x966260 # or is it 0x13840? + size: 0x13840 diff --git a/yamls/us/audio_instrument_sets.yml b/yamls/us/audio_instrument_sets.yml new file mode 100644 index 000000000..0ba09bc81 --- /dev/null +++ b/yamls/us/audio_instrument_sets.yml @@ -0,0 +1,16 @@ +:config: + vram: + addr: 0x800E8700 + offset: 0xE9300 + header: + code: + - '#include ' + - '#include ' + header: + - '#include ' + - '#include ' +instrument_sets: + symbol: gInstrumentSets + type: bob + offset: 0xBE90E0 + size: 0x80 diff --git a/yamls/us/audio_sequences.yml b/yamls/us/audio_sequences.yml new file mode 100644 index 000000000..e9e4e8df9 --- /dev/null +++ b/yamls/us/audio_sequences.yml @@ -0,0 +1,16 @@ +:config: + vram: + addr: 0x800E8700 + offset: 0xE9300 + header: + code: + - '#include ' + - '#include ' + header: + - '#include ' + - '#include ' +audio_sequences: + symbol: gAudioSequences + type: bob + offset: 0xBC5F60 + size: 0x23180 diff --git a/yamls/us/audio_tables.yml b/yamls/us/audio_tables.yml new file mode 100644 index 000000000..331a35507 --- /dev/null +++ b/yamls/us/audio_tables.yml @@ -0,0 +1,16 @@ +:config: + vram: + addr: 0x800E8700 + offset: 0xE9300 + header: + code: + - '#include ' + - '#include ' + header: + - '#include ' + - '#include ' +audio_tables: + symbol: gAudioTables + type: bob + offset: 0x979AA0 + size: 0x24C4C0 \ No newline at end of file From e5d512b3e8340899cf9ef897e8b30904a468f0dd Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:08:45 -0700 Subject: [PATCH 18/30] Audio Extract 2 --- yamls/us/audio_banks.yml | 4 ++-- yamls/us/audio_instrument_sets.yml | 4 ++-- yamls/us/audio_sequences.yml | 4 ++-- yamls/us/audio_tables.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/yamls/us/audio_banks.yml b/yamls/us/audio_banks.yml index 760ed5c59..ea38d8593 100644 --- a/yamls/us/audio_banks.yml +++ b/yamls/us/audio_banks.yml @@ -1,7 +1,7 @@ :config: vram: addr: 0x800E8700 - offset: 0xE9300 + offset: 0x966260 header: code: - '#include ' @@ -12,5 +12,5 @@ audiobanks: symbol: gAudioBanks type: bob - offset: 0x966260 # or is it 0x13840? + offset: 0x0 # or is it 0x13840? size: 0x13840 diff --git a/yamls/us/audio_instrument_sets.yml b/yamls/us/audio_instrument_sets.yml index 0ba09bc81..43ee0a996 100644 --- a/yamls/us/audio_instrument_sets.yml +++ b/yamls/us/audio_instrument_sets.yml @@ -1,7 +1,7 @@ :config: vram: addr: 0x800E8700 - offset: 0xE9300 + offset: 0xBE90E0 header: code: - '#include ' @@ -12,5 +12,5 @@ instrument_sets: symbol: gInstrumentSets type: bob - offset: 0xBE90E0 + offset: 0x0 size: 0x80 diff --git a/yamls/us/audio_sequences.yml b/yamls/us/audio_sequences.yml index e9e4e8df9..8d107188c 100644 --- a/yamls/us/audio_sequences.yml +++ b/yamls/us/audio_sequences.yml @@ -1,7 +1,7 @@ :config: vram: addr: 0x800E8700 - offset: 0xE9300 + offset: 0xBC5F60 header: code: - '#include ' @@ -12,5 +12,5 @@ audio_sequences: symbol: gAudioSequences type: bob - offset: 0xBC5F60 + offset: 0x0 size: 0x23180 diff --git a/yamls/us/audio_tables.yml b/yamls/us/audio_tables.yml index 331a35507..5848018ed 100644 --- a/yamls/us/audio_tables.yml +++ b/yamls/us/audio_tables.yml @@ -1,7 +1,7 @@ :config: vram: addr: 0x800E8700 - offset: 0xE9300 + offset: 0x979AA0 header: code: - '#include ' @@ -12,5 +12,5 @@ audio_tables: symbol: gAudioTables type: bob - offset: 0x979AA0 + offset: 0x0 size: 0x24C4C0 \ No newline at end of file From 097a3ff550f24a8d56e0332438889724a99cc691 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:50:36 -0700 Subject: [PATCH 19/30] Remove asserts --- src/engine/courses/Course.cpp | 5 ++++- src/racing/collision.c | 5 ----- src/racing/memory.c | 4 ---- src/racing/render_courses.c | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/engine/courses/Course.cpp b/src/engine/courses/Course.cpp index bdec26404..a3c107f1a 100644 --- a/src/engine/courses/Course.cpp +++ b/src/engine/courses/Course.cpp @@ -117,7 +117,10 @@ void Course::Load() { // Extract packed DLs u8* packed = reinterpret_cast(LOAD_ASSET_RAW(this->gfx)); Gfx* gfx = (Gfx*) allocate_memory(sizeof(Gfx) * this->gfxSize); // Size of unpacked DLs - assert(gfx != NULL); + if (gfx == NULL) { + printf("Failed to allocate course displaylist memory\n"); + } + gSegmentTable[7] = reinterpret_cast(&gfx[0]); displaylist_unpack(reinterpret_cast(gfx), reinterpret_cast(packed), 0); diff --git a/src/racing/collision.c b/src/racing/collision.c index de308584a..c3e210c9a 100644 --- a/src/racing/collision.c +++ b/src/racing/collision.c @@ -9,7 +9,6 @@ #include "collision.h" #include "math_util.h" #include "code_800029B0.h" -#include #include #include "port/Game.h" @@ -1818,10 +1817,6 @@ void set_vtx_buffer(uintptr_t addr, u32 numVertices, u32 bufferIndex) { u32 i; Vtx* vtx = (Vtx*) addr; for (i = 0; i < numVertices; i++) { - // printf("VTX: 0x%llX",vtx); - if (vtx == 0) { - assert(false); - } vtxBuffer[bufferIndex] = vtx; vtx++; bufferIndex++; diff --git a/src/racing/memory.c b/src/racing/memory.c index c51686e38..2bf09b7f5 100644 --- a/src/racing/memory.c +++ b/src/racing/memory.c @@ -19,7 +19,6 @@ #include "courses/all_course_offsets.h" #include "defines.h" -#include #include #include "engine/courses/Course.h" @@ -63,7 +62,6 @@ void* get_next_available_memory_addr(uintptr_t size) { if (gNextFreeMemoryAddress > sPoolEnd) { printf("[memory.c] get_next_available_memory_addr(): Memory Pool Out of Bounds! Out of memory!\n"); PRINT_MEMPOOL; - assert(true); } return (void*) freeSpace; @@ -199,7 +197,6 @@ void* allocate_memory(size_t size) { printf("[memory.c] allocate_memory(): gFreeMemorySize below zero!\n"); printf("gFreeMemorySize: 0x%X", gFreeMemorySize); PRINT_MEMPOOL; - assert(false); } freeSpace = (uintptr_t) gNextFreeMemoryAddress; @@ -208,7 +205,6 @@ void* allocate_memory(size_t size) { if (gNextFreeMemoryAddress > sPoolEnd) { printf("[memory.c] allocate_memory(): Memory Pool Out of Bounds! Out of memory!\n"); PRINT_MEMPOOL; - assert(false); } return (void*) freeSpace; diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index 31f952276..5976041d7 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -20,7 +20,6 @@ #include "courses/all_course_data.h" #include "courses/all_course_packed.h" #include "courses/all_course_offsets.h" -#include #include "port/Game.h" #include "enhancements/collision_viewer.h" From c7d18cee755c0ea014614acef77460d64a7b82cb Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:55:45 -0700 Subject: [PATCH 20/30] Remove unused metadata files --- yamls/courses/banshee_boardwalk_metadata.yml | 38 ------------------- yamls/courses/big_donut_metadata.yml | 38 ------------------- yamls/courses/block_fort_metadata.yml | 38 ------------------- yamls/courses/bowsers_castle_metadata.yml | 38 ------------------- yamls/courses/choco_mountain_metadata.yml | 38 ------------------- yamls/courses/dks_jungle_parkway_metadata.yml | 38 ------------------- yamls/courses/double_deck_metadata.yml | 38 ------------------- yamls/courses/frappe_snowland_metadata.yml | 38 ------------------- yamls/courses/kalimari_desert_metadata.yml | 38 ------------------- yamls/courses/koopa_beach_metadata.yml | 38 ------------------- yamls/courses/luigi_raceway_metadata.yml | 38 ------------------- yamls/courses/mario_raceway_metadata.yml | 38 ------------------- yamls/courses/moo_moo_farm_metadata.yml | 38 ------------------- yamls/courses/podium_ceremony_metadata.yml | 38 ------------------- yamls/courses/rainbow_road_metadata.yml | 38 ------------------- yamls/courses/royal_raceway_metadata.yml | 38 ------------------- yamls/courses/sherbet_land_metadata.yml | 38 ------------------- yamls/courses/skyscraper_metadata.yml | 38 ------------------- yamls/courses/toads_turnpike_metadata.yml | 38 ------------------- yamls/courses/wario_stadium_metadata.yml | 38 ------------------- yamls/courses/yoshi_valley_metadata.yml | 38 ------------------- yamls/us/credits_text.yml | 14 ------- 22 files changed, 812 deletions(-) delete mode 100644 yamls/courses/banshee_boardwalk_metadata.yml delete mode 100644 yamls/courses/big_donut_metadata.yml delete mode 100644 yamls/courses/block_fort_metadata.yml delete mode 100644 yamls/courses/bowsers_castle_metadata.yml delete mode 100644 yamls/courses/choco_mountain_metadata.yml delete mode 100644 yamls/courses/dks_jungle_parkway_metadata.yml delete mode 100644 yamls/courses/double_deck_metadata.yml delete mode 100644 yamls/courses/frappe_snowland_metadata.yml delete mode 100644 yamls/courses/kalimari_desert_metadata.yml delete mode 100644 yamls/courses/koopa_beach_metadata.yml delete mode 100644 yamls/courses/luigi_raceway_metadata.yml delete mode 100644 yamls/courses/mario_raceway_metadata.yml delete mode 100644 yamls/courses/moo_moo_farm_metadata.yml delete mode 100644 yamls/courses/podium_ceremony_metadata.yml delete mode 100644 yamls/courses/rainbow_road_metadata.yml delete mode 100644 yamls/courses/royal_raceway_metadata.yml delete mode 100644 yamls/courses/sherbet_land_metadata.yml delete mode 100644 yamls/courses/skyscraper_metadata.yml delete mode 100644 yamls/courses/toads_turnpike_metadata.yml delete mode 100644 yamls/courses/wario_stadium_metadata.yml delete mode 100644 yamls/courses/yoshi_valley_metadata.yml delete mode 100644 yamls/us/credits_text.yml diff --git a/yamls/courses/banshee_boardwalk_metadata.yml b/yamls/courses/banshee_boardwalk_metadata.yml deleted file mode 100644 index bbcfd560a..000000000 --- a/yamls/courses/banshee_boardwalk_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 3 - name: banshee boardwalk - debug_name: ghost - cup: SPECIAL_CUP - cup_index: 2 - course_length: 747m - kart_ai_behaviour_ptr: D_0D009058 - kart_ai_maximum_separation: 40.0f - kart_ai_minimum_separation: 0.4f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x006e, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00be, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00fa, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01db, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0262, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02EE, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_banshee_boardwalk_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_banshee_boardwalk_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [0, 0, 0, 0, 0, 0] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/big_donut_metadata.yml b/yamls/courses/big_donut_metadata.yml deleted file mode 100644 index b95921554..000000000 --- a/yamls/courses/big_donut_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 19 - name: big donut - debug_name: doughnut - cup: BATTLE_CUP - cup_index: 0 - course_length: "" - kart_ai_behaviour_ptr: D_0D008F18 - kart_ai_maximum_separation: -1.0f - kart_ai_minimum_separation: 0.5f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 40 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0014, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [0, 0, 0, 0, 0, 0] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/block_fort_metadata.yml b/yamls/courses/block_fort_metadata.yml deleted file mode 100644 index 251e2ab2e..000000000 --- a/yamls/courses/block_fort_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 15 - name: block fort - debug_name: block - cup: BATTLE_CUP - cup_index: 1 - course_length: "" - kart_ai_behaviour_ptr: D_0D008F18 - kart_ai_maximum_separation: -1.0f - kart_ai_minimum_separation: 0.1f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0014, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [128, 4280, 6136, 216, 7144, 32248] - sky_colors2: [216, 7144, 32248, 0, 0, 0] diff --git a/yamls/courses/bowsers_castle_metadata.yml b/yamls/courses/bowsers_castle_metadata.yml deleted file mode 100644 index efa7b730c..000000000 --- a/yamls/courses/bowsers_castle_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 2 - name: bowser's castle - debug_name: castle - cup: STAR_CUP - cup_index: 3 - course_length: 777m - kart_ai_behaviour_ptr: D_0D008FB8 - kart_ai_maximum_separation: 35.0f - kart_ai_minimum_separation: 0.2f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0104, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01b3, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x030C, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_bowsers_castle_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_bowsers_castle_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [48, 1544, 49528, 0, 0, 0] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/choco_mountain_metadata.yml b/yamls/courses/choco_mountain_metadata.yml deleted file mode 100644 index c47733a1f..000000000 --- a/yamls/courses/choco_mountain_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 1 - name: choco mountain - debug_name: mountain - cup: FLOWER_CUP - cup_index: 2 - course_length: 687m - kart_ai_behaviour_ptr: D_0D008F80 - kart_ai_maximum_separation: 35.0f - kart_ai_minimum_separation: 0.3f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x008c, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00a5, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x014a, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0226, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0253, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02BC, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_choco_mountain_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_choco_mountain_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [255, 255, 255, 255, 255, 255] - sky_colors2: [255, 255, 255, 255, 255, 255] diff --git a/yamls/courses/dks_jungle_parkway_metadata.yml b/yamls/courses/dks_jungle_parkway_metadata.yml deleted file mode 100644 index dafe03234..000000000 --- a/yamls/courses/dks_jungle_parkway_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 18 - name: d.k.'s jungle parkway - debug_name: jungle - cup: SPECIAL_CUP - cup_index: 0 - course_length: 893m - kart_ai_behaviour_ptr: D_0D0093C0 - kart_ai_maximum_separation: 40.0f - kart_ai_minimum_separation: 0.1f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00be, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00fa, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0370, 0x0001, 0x0001, 0x0001, 0x01F4, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_dks_jungle_parkway_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_dks_jungle_parkway_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [255, 174, 0, 255, 229, 124] - sky_colors2: [22, 145, 22, 0, 0, 0] diff --git a/yamls/courses/double_deck_metadata.yml b/yamls/courses/double_deck_metadata.yml deleted file mode 100644 index 2ea7090b7..000000000 --- a/yamls/courses/double_deck_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 17 - name: double deck - debug_name: deck - cup: BATTLE_CUP - cup_index: 2 - course_length: "" - kart_ai_behaviour_ptr: D_0D008F18 - kart_ai_maximum_separation: -1.0f - kart_ai_minimum_separation: 0.5f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0014, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [113, 70, 255, 255, 184, 99] - sky_colors2: [255, 224, 240, 0, 0, 0] diff --git a/yamls/courses/frappe_snowland_metadata.yml b/yamls/courses/frappe_snowland_metadata.yml deleted file mode 100644 index 9a63755e1..000000000 --- a/yamls/courses/frappe_snowland_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 5 - name: frappe snowland - debug_name: snow - cup: FLOWER_CUP - cup_index: 1 - course_length: 734m - kart_ai_behaviour_ptr: D_0D0090F8 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.3f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0122, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x015e, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02EE, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_frappe_snowland_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_frappe_snowland_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [28, 11, 90, 0, 99, 164] - sky_colors2: [0, 99, 164, 0, 0, 0] diff --git a/yamls/courses/kalimari_desert_metadata.yml b/yamls/courses/kalimari_desert_metadata.yml deleted file mode 100644 index e428cee11..000000000 --- a/yamls/courses/kalimari_desert_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 11 - name: kalimari desert - debug_name: desert - cup: MUSHROOM_CUP - cup_index: 3 - course_length: 753m - kart_ai_behaviour_ptr: D_0D009260 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.3f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x008a, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0118, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0194, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01fe, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02BC, 0x0001, 0x0001, 0x0001, 0x0226, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_kalimari_desert_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_kalimari_desert_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [195, 231, 255, 255, 192, 0] - sky_colors2: [255, 192, 0, 0, 0, 0] diff --git a/yamls/courses/koopa_beach_metadata.yml b/yamls/courses/koopa_beach_metadata.yml deleted file mode 100644 index 27576fb13..000000000 --- a/yamls/courses/koopa_beach_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 6 - name: koopa troopa beach - debug_name: beach - cup: MUSHROOM_CUP - cup_index: 2 - course_length: 691m - kart_ai_behaviour_ptr: D_0D009158 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.5f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x003c, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0078, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0118, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01b3, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02BC, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_koopa_troopa_beach_track_waypoints, "d_course_koopa_troopa_beach_track_waypoints_2", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_koopa_troopa_beach_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [48, 1688, 54136, 216, 7144, 32248] - sky_colors2: [48, 1688, 54136, 0, 0, 0] diff --git a/yamls/courses/luigi_raceway_metadata.yml b/yamls/courses/luigi_raceway_metadata.yml deleted file mode 100644 index 98b8b010a..000000000 --- a/yamls/courses/luigi_raceway_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 8 - name: luigi raceway - debug_name: l circuit - cup: MUSHROOM_CUP - cup_index: 0 - course_length: 717m - kart_ai_behaviour_ptr: D_0D0091E8 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.7f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 48 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0131, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01b8, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0203, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02DA, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_luigi_raceway_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_luigi_raceway_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [128, 4280, 6136, 216, 7144, 32248] - sky_colors2: [216, 7144, 32248, 0, 0, 0] diff --git a/yamls/courses/mario_raceway_metadata.yml b/yamls/courses/mario_raceway_metadata.yml deleted file mode 100644 index eab36113f..000000000 --- a/yamls/courses/mario_raceway_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 0 - name: mario raceway - debug_name: m circuit - cup: FLOWER_CUP - cup_index: 3 - course_length: 567m - kart_ai_behaviour_ptr: D_0D008F28 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.3f - D_800DCBB4: D_800DCB34 - cpu_steering_sensitivity: 48 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0028, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0109, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x011d, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01a4, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0258, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_mario_raceway_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_mario_raceway_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [128, 4280, 6136, 216, 7144, 32248] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/moo_moo_farm_metadata.yml b/yamls/courses/moo_moo_farm_metadata.yml deleted file mode 100644 index d156fd862..000000000 --- a/yamls/courses/moo_moo_farm_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 9 - name: moo moo farm - debug_name: farm - cup: MUSHROOM_CUP - cup_index: 1 - course_length: 527m - kart_ai_behaviour_ptr: D_0D009210 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.5f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 48 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x008c, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00e1, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x013c, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x01b2, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0230, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_moo_moo_farm_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_moo_moo_farm_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [0, 18, 255, 197, 211, 255] - sky_colors2: [255, 184, 99, 0, 0, 0] diff --git a/yamls/courses/podium_ceremony_metadata.yml b/yamls/courses/podium_ceremony_metadata.yml deleted file mode 100644 index 5df6a435a..000000000 --- a/yamls/courses/podium_ceremony_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 20 - name: # unknown (does not exist) - debug_name: # unk (does not exist) - cup: null - cup_index: -1 - course_length: null - kart_ai_behaviour_ptr: D_0D008F18 - kart_ai_maximum_separation: 40.0f # entry - kart_ai_minimum_separation: 0.5f # entry - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 # entry - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0003, 0x0005, 1.25, 0.0, 0.0, 0.0, 0.0] - - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x01F4, 0x01F4, 0x01F4, 0x01F4, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [0.0f, 0.0f, 0.0f, 0.0f] - D_0D009568: [0.0f, 0.0f, 0.0f, 0.0f] - D_0D0096B8: [0.0f, 0.0f, 0.0f, 0.0f] - D_0D009808: [0.0f, 0.0f, 0.0f, 0.0f] - - # Course waypoints - path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [podium_ceremony_path, podium_ceremony_path_2, podium_ceremony_path_3, podium_ceremony_path_4] - - sky_colors: [238, 144, 255, 255, 224, 240] - sky_colors2: [255, 224, 240, 0, 0, 0] diff --git a/yamls/courses/rainbow_road_metadata.yml b/yamls/courses/rainbow_road_metadata.yml deleted file mode 100644 index 66a9224ac..000000000 --- a/yamls/courses/rainbow_road_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 13 - name: rainbow road - debug_name: rainbow - cup: SPECIAL_CUP - cup_index: 3 - course_length: 2000m - kart_ai_behaviour_ptr: D_0D0092C8 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.4f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 38 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00fa, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x076C, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_rainbow_road_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_rainbow_road_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [0, 0, 0, 0, 0, 0] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/royal_raceway_metadata.yml b/yamls/courses/royal_raceway_metadata.yml deleted file mode 100644 index 1b4fecf3a..000000000 --- a/yamls/courses/royal_raceway_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 7 - name: royal raceway - debug_name: p circuit - cup: STAR_CUP - cup_index: 2 - course_length: 1025m - kart_ai_behaviour_ptr: D_0D009188 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.4f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0128, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0190, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x02ea, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x03E8, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_royal_raceway_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_royal_raceway_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [238, 144, 255, 255, 224, 240] - sky_colors2: [255, 224, 240, 0, 0, 0] diff --git a/yamls/courses/sherbet_land_metadata.yml b/yamls/courses/sherbet_land_metadata.yml deleted file mode 100644 index 2db2a434f..000000000 --- a/yamls/courses/sherbet_land_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 12 - name: sherbet land - debug_name: sherbet - cup: STAR_CUP - cup_index: 1 - course_length: 756m - kart_ai_behaviour_ptr: D_0D009280 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.3f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00fa, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x02BC, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_sherbet_land_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_sherbet_land_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [128, 4280, 6136, 216, 7144, 32248] - sky_colors2: [216, 7144, 32248, 128, 4280, 6136] diff --git a/yamls/courses/skyscraper_metadata.yml b/yamls/courses/skyscraper_metadata.yml deleted file mode 100644 index 451405a91..000000000 --- a/yamls/courses/skyscraper_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 16 - name: skyscraper - debug_name: skyscraper - cup: BATTLE_CUP - cup_index: 3 - course_length: "" - kart_ai_behaviour_ptr: D_0D008F18 - kart_ai_maximum_separation: -1.0f - kart_ai_minimum_separation: 0.5f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0014, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [0, 0, 0, 0, 0, 0] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/toads_turnpike_metadata.yml b/yamls/courses/toads_turnpike_metadata.yml deleted file mode 100644 index a72049b22..000000000 --- a/yamls/courses/toads_turnpike_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 10 - name: toad's turnpike - debug_name: highway - cup: FLOWER_CUP - cup_index: 0 - course_length: 1036m - kart_ai_behaviour_ptr: D_0D009238 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.5f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 40 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00fa, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x03E8, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_toads_turnpike_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_toads_turnpike_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [0, 2, 94, 209, 65, 23] - sky_colors2: [209, 65, 23, 0, 0, 0] diff --git a/yamls/courses/wario_stadium_metadata.yml b/yamls/courses/wario_stadium_metadata.yml deleted file mode 100644 index 0d994227d..000000000 --- a/yamls/courses/wario_stadium_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 14 - name: wario stadium - debug_name: stadium - cup: STAR_CUP - cup_index: 0 - course_length: 1591m - kart_ai_behaviour_ptr: D_0D009310 - kart_ai_maximum_separation: 50.0f - kart_ai_minimum_separation: 0.6f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0032, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0064, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0096, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00c8, 0x0001, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x00fa, 0x0003, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - - [0x0000, 0x0000, 0.8333333, 0.0, 0.0, 0.0, 0.0] - path_sizes: [0x0640, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] - D_0D009808: [3.75f, 5.1666665f, 5.75f, 6.3333334f] - - # Course waypoints - path_table: [d_course_wario_stadium_track_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_wario_stadium_unknown_waypoints, "&nullPath", "&nullPath", "&nullPath"] - - sky_colors: [20, 30, 56, 40, 60, 110] - sky_colors2: [0, 0, 0, 0, 0, 0] diff --git a/yamls/courses/yoshi_valley_metadata.yml b/yamls/courses/yoshi_valley_metadata.yml deleted file mode 100644 index 07448f07d..000000000 --- a/yamls/courses/yoshi_valley_metadata.yml +++ /dev/null @@ -1,38 +0,0 @@ -course: - type: MK64:METADATA - offset: 0x0 - id: 4 - name: yoshi valley - debug_name: maze - cup: SPECIAL_CUP - cup_index: 1 - course_length: 772m - kart_ai_behaviour_ptr: D_0D0090B8 - kart_ai_maximum_separation: 35.0f - kart_ai_minimum_separation: 0.0f - D_800DCBB4: D_800DCAF4 - cpu_steering_sensitivity: 53 - bomb_kart_spawns: # 7 bomb kart spawn locations - - [0x0000, 0x0000, 0.8333333, -1533.0, -682.0, -103.0, 0.0] - - [0x000a, 0x0000, 0.8333333, -1565.0, -619.0, -109.0, 0.0] - - [0x0014, 0x0000, 0.8333333, -1529.0, -579.0, -109.0, 0.0] - - [0x001e, 0x0000, 0.8333333, -1588.0, -534.0, -106.0, 0.0] - - [0x0028, 0x0000, 0.8333333, -1598.0, -207.0, -105.0, 0.0] - - [0x0032, 0x0000, 0.8333333, -1646.0, -147.0, -93.0, 0.0] - - [0x003c, 0x0000, 0.8333333, -2532.0, -445.0, -90.0, 0.0] - path_sizes: [0x02B2, 0x02A8, 0x02B2, 0x0320, 0x0001, 0x0000, 0x0000, 0x0000] - - # unk common_textures data - D_0D009418: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] - D_0D009568: [3.75f, 4.5833334f, 4.5833334f, 4.5833334f] - D_0D0096B8: [3.3333332f, 3.3333332f, 3.3333332f, 3.3333332f] - D_0D009808: [2.9166667f, 3.75f, 3.75f, 3.75f] - - # Course waypoints - path_table: [d_course_yoshi_valley_track_waypoints, "d_course_yoshi_valley_track_waypoints_2", "d_course_yoshi_valley_track_waypoints_3", "d_course_yoshi_valley_track_waypoints_4"] - - # Unused except in podium ceremony - path_table_unknown: [d_course_yoshi_valley_unknown_waypoints, d_course_yoshi_valley_unknown_waypoints_2, d_course_yoshi_valley_unknown_waypoints_3, d_course_yoshi_valley_unknown_waypoints_4] - - sky_colors: [113, 70, 255, 255, 184, 99] - sky_colors2: [95, 40, 15, 0, 0, 0] diff --git a/yamls/us/credits_text.yml b/yamls/us/credits_text.yml deleted file mode 100644 index 4395d8224..000000000 --- a/yamls/us/credits_text.yml +++ /dev/null @@ -1,14 +0,0 @@ -:config: - vram: - addr: 0x802854B0 - offset: 0x3F0 - header: - code: - - '#include ' - header: - - '#include ' - - '#include ' -gCreditsText: - symbol: gCreditsText - type: text - offset: 0x802854B0 From 318a6d713fa3011523cfc813f64251e86301deed Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:29:14 -0700 Subject: [PATCH 21/30] Define default keyboard layout --- lus-cvars.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lus-cvars.cmake diff --git a/lus-cvars.cmake b/lus-cvars.cmake new file mode 100644 index 000000000..d6d056224 --- /dev/null +++ b/lus-cvars.cmake @@ -0,0 +1,19 @@ +set(LUS_BTN_A KbScancode::LUS_KB_SHIFT) +set(LUS_BTN_B KbScancode::LUS_KB_CONTROL) +set(LUS_BTN_L KbScancode::LUS_KB_Q) +set(LUS_BTN_R KbScancode::LUS_KB_SPACE) +set(LUS_BTN_Z KbScancode::LUS_KB_Z) +set(LUS_BTN_START KbScancode::LUS_KB_ENTER) +set(LUS_BTN_STICKUP KbScancode::LUS_KB_ARROWKEY_UP) +set(LUS_BTN_STICKDOWN KbScancode::LUS_KB_ARROWKEY_DOWN) +set(LUS_BTN_STICKLEFT KbScancode::LUS_KB_ARROWKEY_LEFT) +set(LUS_BTN_STICKRIGHT KbScancode::LUS_KB_ARROWKEY_RIGHT) +set(LUS_BTN_CUP KbScancode::LUS_KB_T) +set(LUS_BTN_CDOWN KbScancode::LUS_KB_G) +set(LUS_BTN_CLEFT KbScancode::LUS_KB_F) +set(LUS_BTN_CRIGHT KbScancode::LUS_KB_H) +set(LUS_BTN_DUP KbScancode::LUS_KB_NUMPAD8) +set(LUS_BTN_DDOWN KbScancode::LUS_KB_NUMPAD2) +set(LUS_BTN_DLEFT KbScancode::LUS_KB_NUMPAD4) +set(LUS_BTN_DRIGHT KbScancode::LUS_KB_NUMPAD6) +include("libultraship/cmake/cvars.cmake") \ No newline at end of file From 6b71793b4f0b430c9624af04eab59e490c8b7993 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 21 Nov 2024 20:20:37 -0600 Subject: [PATCH 22/30] Fix clang compiler issues --- include/objects.h | 8 +++++ src/actors/blue_and_red_shells/update.inc.c | 1 + src/actors/green_shell/update.inc.c | 1 + src/animation.c | 1 + src/code_800029B0.c | 2 +- src/code_80057C60.c | 1 + src/data/some_data.h | 8 +++++ src/ending/code_80280000.c | 1 + src/engine/Matrix.h | 2 ++ src/main.c | 1 + src/math_util_2.c | 1 + src/player_controller.c | 1 + src/port/Game.h | 37 +++++++++++++++++++++ src/racing/actors.c | 2 +- src/racing/actors_extended.c | 1 + src/racing/math_util.c | 1 + src/racing/render_courses.h | 1 + src/render_player.c | 1 + 18 files changed, 69 insertions(+), 2 deletions(-) diff --git a/include/objects.h b/include/objects.h index c3ee37a1b..d4da8cd95 100644 --- a/include/objects.h +++ b/include/objects.h @@ -4,6 +4,10 @@ #include "spline.h" #include +#ifdef __cplusplus +extern "C" { +#endif + #define OBJECT_LIST_SIZE 0x226 #define SOME_OBJECT_INDEX_LIST_SIZE 32 @@ -451,4 +455,8 @@ extern s8 D_8018D230; //! Some sort of limiter on how many of some object type can spawn extern s32 D_8018D3C4; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/actors/blue_and_red_shells/update.inc.c b/src/actors/blue_and_red_shells/update.inc.c index 861433446..c09d30d64 100644 --- a/src/actors/blue_and_red_shells/update.inc.c +++ b/src/actors/blue_and_red_shells/update.inc.c @@ -4,6 +4,7 @@ #include #include #include +#include "port/Game.h" void func_802B3B44(struct ShellActor* shell) { u16 currentWaypoint; diff --git a/src/actors/green_shell/update.inc.c b/src/actors/green_shell/update.inc.c index 546baee89..4e4c8f9e8 100644 --- a/src/actors/green_shell/update.inc.c +++ b/src/actors/green_shell/update.inc.c @@ -3,6 +3,7 @@ #include #include #include "collision.h" +#include "port/Game.h" /** * @brief Updates the green shell actor. diff --git a/src/animation.c b/src/animation.c index 6ccab044a..ee758a8ae 100644 --- a/src/animation.c +++ b/src/animation.c @@ -7,6 +7,7 @@ #include #include #include "code_80057C60.h" +#include "engine/Matrix.h" Vec3s sOriginalPosAnimation; s16 isNotTheFirst; diff --git a/src/code_800029B0.c b/src/code_800029B0.c index b6f5b1820..d6a806430 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -179,7 +179,7 @@ void setup_race(void) { struct Controller* controller; int i; - printf("Setup Race!\n"); + LUSLOG_DEBUG("Setup Race!", 0); gPlayerCountSelection1 = gPlayerCount; if (gGamestate != RACING) { diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 11a1d436e..5450f9d93 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -38,6 +38,7 @@ #include "data/some_data.h" #include #include "port/Game.h" +#include "engine/Matrix.h" //! @warning this macro is undef'd at the end of this file #define MAKE_RGB(r, g, b) (((r) << 0x10) | ((g) << 0x08) | (b << 0x00)) diff --git a/src/data/some_data.h b/src/data/some_data.h index 35f044113..7c9667e7f 100644 --- a/src/data/some_data.h +++ b/src/data/some_data.h @@ -7,6 +7,10 @@ #include #include "objects.h" +#ifdef __cplusplus +extern "C" { +#endif + extern Vtx D_800E49C0[]; extern Vtx D_800E4AC0[]; extern Vtx D_800E4BC0[]; @@ -87,4 +91,8 @@ extern StarData gWarioStadiumStars[]; extern u8 D_800E6F30[][3]; extern u8 D_800E6F48[][3]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/ending/code_80280000.c b/src/ending/code_80280000.c index 9c2f654c9..848cd3e1a 100644 --- a/src/ending/code_80280000.c +++ b/src/ending/code_80280000.c @@ -28,6 +28,7 @@ #include "engine/Engine.h" #include "engine/courses/Course.h" #include "engine/Matrix.h" +#include "port/Game.h" s32 D_802874A0; // s32 D_802874A4[5]; diff --git a/src/engine/Matrix.h b/src/engine/Matrix.h index b0be2bf87..cff3f22ac 100644 --- a/src/engine/Matrix.h +++ b/src/engine/Matrix.h @@ -19,6 +19,8 @@ Mtx* GetEffectMatrix(void); void ClearHudMatrixPool(void); void ClearEffectsMatrixPool(void); void ClearObjectsMatrixPool(void); +void AddKartMatrix(Mat4 mtx, s32 flags); +void AddShadowMatrix(Mat4 mtx, s32 flags); #ifdef __cplusplus } diff --git a/src/main.c b/src/main.c index 01857b6f5..cdbc4115d 100644 --- a/src/main.c +++ b/src/main.c @@ -46,6 +46,7 @@ #include "enhancements/freecam/freecam.h" #include "engine/wasm.h" #include "port/Game.h" +#include "engine/Matrix.h" // Declarations (not in this file) void func_80091B78(void); diff --git a/src/math_util_2.c b/src/math_util_2.c index 1eeaecaef..f2b85daeb 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -14,6 +14,7 @@ #include "camera.h" #include "port/Engine.h" +#include "engine/Matrix.h" #pragma intrinsic(sqrtf) diff --git a/src/player_controller.c b/src/player_controller.c index 180a62290..6c72935d1 100644 --- a/src/player_controller.c +++ b/src/player_controller.c @@ -22,6 +22,7 @@ #include "sounds.h" #include "port/Game.h" #include "src/enhancements/moon_jump.h" +#include "engine/Matrix.h" extern s32 D_8018D168; diff --git a/src/port/Game.h b/src/port/Game.h index 1dbaaa519..3faf2bc82 100644 --- a/src/port/Game.h +++ b/src/port/Game.h @@ -82,6 +82,36 @@ void CourseManager_BombKartsWaypoint(s32 cameraId); void CourseManager_ScrollingTextures(); +s32 CourseManager_GetCrossingOnTriggered(uintptr_t* crossing); + +void CourseManager_VehiclesSpawn(); + +void CourseManager_DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection); + +void CourseManager_AICrossingBehaviour(s32 playerId); + +void CourseManager_ClearVehicles(void); + +void CourseManager_DrawVehicles(s32 playerId); + +void CourseManager_CrossingTrigger(); + +void CourseManager_VehiclesCollision(s32 playerId, Player* player); + +void CourseManager_VehiclesTick(); + +void CourseManager_TickBombKarts(); + +void CourseManager_TickActors(); + +void CourseManager_TrainSmokeTick(void); + +void CourseManager_DrawBattleBombKarts(s32 cameraId); + +void CourseManager_DrawBombKarts(s32 cameraId); + +void CourseManager_TrainSmokeDraw(s32 cameraId); + size_t GetCupCursorPosition(); void SetCupCursorPosition(size_t position); @@ -92,12 +122,17 @@ void SetCourseFromCup(); void* GetCourse(void); +void SetCourseById(s32 course); + void SetCourseByClass(void* course); struct Actor* m_GetActor(size_t index); void m_DeleteActor(size_t index); struct Actor* m_AddBaseActor(void); size_t m_GetActorSize(); +size_t m_FindActorIndex(struct Actor* actor); +void m_ActorCollision(Player* player, struct Actor* actor); +void m_ClearActors(void); void* GetMarioRaceway(void); @@ -151,6 +186,8 @@ void* GetSpecialCup(void); void* GetBattleCup(void); +void* GetCup(); + #ifdef __cplusplus } #endif diff --git a/src/racing/actors.c b/src/racing/actors.c index 7ebdfd5f1..d7b1168a0 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -850,7 +850,7 @@ void spawn_piranha_plants(struct ActorSpawnData* spawnData) { } } -void spawn_palm_trees(const char* spawnData) { +void spawn_palm_trees(struct ActorSpawnData* spawnData) { struct ActorSpawnData* temp_s0 = spawnData; struct PalmTree* temp_v1; Vec3f startingPos; diff --git a/src/racing/actors_extended.c b/src/racing/actors_extended.c index b13609ef1..0e11b2961 100644 --- a/src/racing/actors_extended.c +++ b/src/racing/actors_extended.c @@ -15,6 +15,7 @@ #include "update_objects.h" #include "effects.h" #include "sounds.h" +#include "port/Game.h" void copy_collision(Collision* src, Collision* dest) { dest->unk30 = src->unk30; diff --git a/src/racing/math_util.c b/src/racing/math_util.c index a892066bc..4204e8670 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -7,6 +7,7 @@ #include "buffers/trig_tables.h" #include "math.h" #include "memory.h" +#include "engine/Matrix.h" #pragma intrinsic(sqrtf, fabs) diff --git a/src/racing/render_courses.h b/src/racing/render_courses.h index e1e87fcc9..dc9a26f63 100644 --- a/src/racing/render_courses.h +++ b/src/racing/render_courses.h @@ -36,6 +36,7 @@ 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 course_init(void); void render_course(struct UnkStruct_800DC5EC*); void func_80295BF8(s32); void func_80295C6C(void); diff --git a/src/render_player.c b/src/render_player.c index 6020eb546..501ffebcc 100644 --- a/src/render_player.c +++ b/src/render_player.c @@ -31,6 +31,7 @@ #include #include #include "port/Game.h" +#include "engine/Matrix.h" s8 gRenderingFramebufferByPlayer[] = { 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02 }; From fd59569ef59fce535427e18f42d47274ce4ac93a Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sat, 23 Nov 2024 22:18:17 -0700 Subject: [PATCH 23/30] Implement Thwomps --- src/code_80057C60.c | 8 +- src/engine/World.cpp | 8 +- src/engine/World.h | 9 +- src/engine/courses/BowsersCastle.cpp | 58 ++- src/engine/vehicles/OThwomp.cpp | 639 +++++++++++++++++++++++++++ src/engine/vehicles/OThwomp.h | 66 +++ src/port/Game.cpp | 23 + src/port/Game.h | 4 + src/update_objects.c | 8 +- src/update_objects.h | 4 +- 10 files changed, 795 insertions(+), 32 deletions(-) create mode 100644 src/engine/vehicles/OThwomp.cpp create mode 100644 src/engine/vehicles/OThwomp.h diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 5450f9d93..bc0000bd6 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -702,6 +702,7 @@ void render_object_for_player(s32 cameraId) { CourseManager_RenderCourseObjects(cameraId); CourseManager_TrainSmokeDraw(cameraId); + CourseManager_DrawThwomps(cameraId); // switch (gCurrentCourseId) { // case COURSE_MARIO_RACEWAY: @@ -1289,7 +1290,8 @@ void func_80059AC8(void) { func_80059A88(PLAYER_FOUR); break; } - func_8005A71C(); + CourseManager_TickThwomps(); // func_8005A71C(); + } } @@ -1569,9 +1571,9 @@ void func_8005A3C0(void) { } void func_8005A71C(void) { - if (GetCourse() == GetBowsersCastle()) { + //if (GetCourse() == GetBowsersCastle()) { func_80081210(); - } + //} } void update_object(void) { diff --git a/src/engine/World.cpp b/src/engine/World.cpp index c87bb332d..ed122af56 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -46,6 +46,7 @@ static size_t busses; static size_t tankerTrucks; static size_t cars; static size_t boats; +static size_t thwomps; /** * Note that you can only remove the tender if there are no carriages @@ -82,7 +83,7 @@ void World::AddCar(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoin } void World::ClearVehicles(void) { - trains = trucks = busses = tankerTrucks = cars = boats = 0; + trains = trucks = busses = tankerTrucks = cars = boats = thwomps = 0; Vehicles.clear(); } @@ -96,6 +97,11 @@ void World::AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointInd BombKarts.push_back(std::make_unique(pos, waypoint, waypointIndex, state, unk_3C)); } +void World::AddThwomp(f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { + Thwomps.push_back(std::make_unique(thwomps, x, z, direction, scale, behaviour, primAlpha)); + thwomps++; +} + u32 World::GetCupIndex() { return this->CupIndex; } diff --git a/src/engine/World.h b/src/engine/World.h index e4e381e08..d396d4854 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -9,6 +9,7 @@ #include "vehicles/OBombKart.h" #include "vehicles/Train.h" #include "TrainCrossing.h" +#include "vehicles/OThwomp.h" #include #include "Actor.h" @@ -24,6 +25,7 @@ class AVehicle; class ATrain; class ACar; class TrainCrossing; +class OThwomp; class World { @@ -123,8 +125,8 @@ public: std::vector Cups; size_t CupIndex = 1; - std::vector> GameObjects; std::vector Actors; + std::vector> GameObjects; /** Actors */ void AddBoat(f32 speed, uint32_t waypoint); @@ -137,8 +139,11 @@ public: void ClearVehicles(void); /** Objects **/ - void AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C); std::vector> BombKarts; + void AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C); + + std::vector> Thwomps; + void AddThwomp(f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius); std::vector> Crossings; diff --git a/src/engine/courses/BowsersCastle.cpp b/src/engine/courses/BowsersCastle.cpp index 5c1e97236..483442c2d 100644 --- a/src/engine/courses/BowsersCastle.cpp +++ b/src/engine/courses/BowsersCastle.cpp @@ -149,29 +149,47 @@ void BowsersCastle::InitCourseObjects() { size_t objectId; size_t i; - gNumActiveThwomps = NUM_THWOMPS_100CC_EXTRA; - gThowmpSpawnList = gThwompSpawns100CCExtra; - switch (gCCSelection) { /* switch 1; irregular */ - case CC_100: /* switch 1 */ - case CC_EXTRA: /* switch 1 */ + switch (gCCSelection) { + case CC_100: + case CC_EXTRA: + gWorldInstance.AddThwomp(0x0320, 0xf92a, 0x8000, 1.0f, 1, 0); + gWorldInstance.AddThwomp(0x044c, 0xf92a, 0x8000, 1.0f, 1, 1); + gWorldInstance.AddThwomp(0x02bc, 0xf95c, 0x8000, 1.0f, 2, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf8f8, 0x8000, 1.0f, 2, 1); + gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0x8000, 1.0f, 3, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf592, 0x8000, 1.0f, 3, 1); + gWorldInstance.AddThwomp(0x091a, 0xf5bf, 0x8000, 1.0f, 4, 0); + gWorldInstance.AddThwomp(0x091a, 0xf597, 0x8000, 1.0f, 4, 1); + gWorldInstance.AddThwomp(0x0596, 0xf92f, 0x8000, 1.5f, 6, 0); + gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x8000, 1.0f, 5, 0); + gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x8000, 1.0f, 5, 1); break; - case CC_50: /* switch 1 */ - gNumActiveThwomps = NUM_THWOMPS_50CC; - gThowmpSpawnList = gThomwpSpawns50CC; + case CC_50: + gWorldInstance.AddThwomp(0x3B6, 0xF92A, 0x8000, 1.0f, 1, 0); + gWorldInstance.AddThwomp(0x0352, 0xf95c, 0x8000, 1.0f, 2, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0x8000, 1.0f, 3, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf592, 0x8000, 1.0f, 3, 1); + gWorldInstance.AddThwomp(0x091a, 0xf5b0, 0x8000, 1.0f, 4, 0); + gWorldInstance.AddThwomp(0x0596, 0xf92f, 0x8000, 1.5f, 6, 0); + gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x8000, 1.0f, 5, 0); + gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x8000, 1.0f, 5, 1); break; - case CC_150: /* switch 1 */ - gNumActiveThwomps = NUM_THWOMPS_150CC; - gThowmpSpawnList = gThomwpSpawns150CC; + case CC_150: + gWorldInstance.AddThwomp(0x0320, 0xf92a, 0x8000, 1.0f, 1, 0); + gWorldInstance.AddThwomp(0x044c, 0xf92a, 0x8000, 1.0f, 1, 1); + gWorldInstance.AddThwomp(0x02bc, 0xf95c, 0x8000, 1.0f, 2, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf8f8, 0x8000, 1.0f, 2, 1); + gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0x8000, 1.0f, 3, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf592, 0x8000, 1.0f, 3, 1); + gWorldInstance.AddThwomp(0x091a, 0xf5c9, 0x8000, 1.0f, 4, 0); + gWorldInstance.AddThwomp(0x091a, 0xf5ab, 0x8000, 1.0f, 4, 1); + gWorldInstance.AddThwomp(0x091a, 0xf58d, 0x8000, 1.0f, 4, 2); + gWorldInstance.AddThwomp(0x0596, 0xf92f, 0x8000, 1.5f, 6, 0); + gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x8000, 1.0f, 5, 0); + gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x8000, 1.0f, 5, 1); break; } - for (i = 0; i < gNumActiveThwomps; i++) { - objectId = indexObjectList1[i]; - init_object(objectId, 0); - gObjectList[objectId].origin_pos[0] = gThowmpSpawnList[i].startX * xOrientation; - gObjectList[objectId].origin_pos[2] = gThowmpSpawnList[i].startZ; - gObjectList[objectId].unk_0D5 = gThowmpSpawnList[i].unk_4; - gObjectList[objectId].primAlpha = gThowmpSpawnList[i].unk_6; - } + // Handle the big statue's fire breath objectId = indexObjectList2[0]; init_object(objectId, 0); @@ -201,7 +219,7 @@ void BowsersCastle::UpdateCourseObjects() { } void BowsersCastle::RenderCourseObjects(s32 cameraId) { - render_object_thwomps(cameraId); + //render_object_thwomps(cameraId); render_object_bowser_flame(cameraId); } diff --git a/src/engine/vehicles/OThwomp.cpp b/src/engine/vehicles/OThwomp.cpp new file mode 100644 index 000000000..7835c150d --- /dev/null +++ b/src/engine/vehicles/OThwomp.cpp @@ -0,0 +1,639 @@ +#include +#include +#include "engine/vehicles/OThwomp.h" +#include + +#include "port/Game.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "actors.h" +#include "math_util.h" +#include "sounds.h" +#include "update_objects.h" +#include "render_player.h" +#include "external.h" +#include "bomb_kart.h" +#include "collision.h" +#include "code_80086E70.h" +#include "render_objects.h" +#include "code_80057C60.h" +#include "defines.h" +#include "code_80005FD0.h" +#include "math_util_2.h" +#include "collision.h" +#include "assets/bowsers_castle_data.h" +#include "ceremony_and_credits.h" +#include "objects.h" +#include "update_objects.h" +#include "render_objects.h" +extern s8 gPlayerCount; +} + +OThwomp::OThwomp(s32 i, f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { + if (i >= 32) { + printf("MAX THWOMPS REACHED (32), skipping\n"); + return; + } + _idx = i; + _faceDirection = direction; + State = (States)behaviour; + s32 objectId = indexObjectList1[i]; + init_object(objectId, 0); + gObjectList[objectId].origin_pos[0] = x * xOrientation; + gObjectList[objectId].origin_pos[2] = z; + gObjectList[objectId].unk_0D5 = behaviour; + gObjectList[objectId].primAlpha = primAlpha; + + if (scale == 0) { + scale = 1; + } + + gObjectList[objectId].sizeScaling = scale; +} + +void OThwomp::Tick() { // func_80081210 + Player* player; + s32 objectIndex; + s32 var_s2_3; + s32 var_s4; + + D_80165834[0] += 0x100; + D_80165834[1] += 0x200; + objectIndex = indexObjectList1[_idx]; + func_800722CC(objectIndex, 0x00000010); + func_8008A4CC(objectIndex); + + OThwomp::func_8007F8D8(); + + objectIndex = indexObjectList1[_idx]; + if (gObjectList[objectIndex].state != 0) { + switch (State) { + case STATIONARY: + OThwomp::StationaryBehaviour(objectIndex); + break; + case MOVE_AND_ROTATE: + OThwomp::MoveAndRotateBehaviour(objectIndex); + break; + case MOVE_FAR: + OThwomp::MoveFarBehaviour(objectIndex); + break; + case STATIONARY_FAST: + OThwomp::StationaryFastBehaviour(objectIndex); + break; + case JAILED: + OThwomp::JailedBehaviour(objectIndex); + break; + case SLIDE: + OThwomp::SlidingBehaviour(objectIndex); + break; + } + } + + player = gPlayerOne; + for (var_s4 = 0; var_s4 < NUM_PLAYERS; var_s4++, player++) { + player->tyres[FRONT_LEFT].unk_14 &= ~3; + player->unk_046 &= ~0x0006; + + objectIndex = indexObjectList1[_idx]; + if (!(player->effects & BOO_EFFECT)) { + func_80080B28(objectIndex, var_s4); + } + if (is_obj_flag_status_active(objectIndex, 0x00020000) != 0) { + func_80080A14(objectIndex, player); + } + if (is_obj_flag_status_active(objectIndex, 0x00010000) != 0) { + func_80080A4C(objectIndex, var_s4); + } + + } + func_8007542C(3); + + objectIndex = indexObjectList1[_idx]; + if (func_80072320(objectIndex, 0x00000020) == 0) { + return; + } + + func_800722CC(objectIndex, 0x00000020); + func_80080FEC(objectIndex); + + for (var_s4 = 0; var_s4 < gObjectParticle2_SIZE; var_s4++) { + objectIndex = gObjectParticle2[var_s4]; + if (objectIndex == DELETED_OBJECT_ID) { + return; + } + if (gObjectList[objectIndex].state == 0) { + return; + } + func_800810F4(objectIndex); + if (gObjectList[objectIndex].state != 0) { + return; + } + delete_object_wrapper(&gObjectParticle2[var_s4]); + } +} + +void OThwomp::func_8007F8D8() { + Player* player; + s32 objectIndex; + s32 var_s0; + s32 someIndex; + s32 var_s4; + Object* object; + + player = gPlayerOne; + var_s4 = 1; + + objectIndex = indexObjectList1[_idx]; + object = &gObjectList[objectIndex]; + if (object->unk_0D5 == 3) { + var_s0 = 0; + if ((object->state >= 2) && (func_80072354(objectIndex, 8) != 0)) { + var_s0 = 1; + } + var_s4 *= var_s0; + } + + if (var_s4 != 0) { + for (var_s0 = 0; var_s0 < 4; var_s0++, player++) { + if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_KART_AI)) { + if (OThwomp::func_8007F75C(var_s0) != 0) { + break; + } + } + } + } +} + +s32 OThwomp::func_8007F75C(s32 playerId) { + s32 someIndex; + s32 objectIndex; + s32 temp_s7; + s32 var_s6; + s32 waypoint; + + waypoint = gNearestWaypointByPlayerId[playerId]; + var_s6 = 0; + if ((waypoint >= 0xAA) && (waypoint < 0xB5)) { + temp_s7 = random_int(0x0032U) + 0x32; + objectIndex = indexObjectList1[_idx]; + if (gObjectList[objectIndex].unk_0D5 == 3) { + var_s6 = 1; + func_8007F660(objectIndex, playerId, temp_s7); + } + + } else if ((waypoint >= 0xD7) && (waypoint < 0xE2)) { + objectIndex = indexObjectList1[_idx]; + if (gObjectList[objectIndex].unk_0D5 == 3) { + var_s6 = 1; + func_8007F6C4(objectIndex, playerId); + } + } + return var_s6; +} + +Lights1 thwompLight = gdSPDefLights1(85, 85, 85, 255, 255, 255, -66, 82, -55); + +void OThwomp::Draw(s32 cameraId) { + s32 objectIndex = 0; + s32 i; + UNUSED s32 stackPadding0; + s16 minusone, plusone; + Camera* camera; + Object* object; + // Lights1 *thwompLightl = (Lights1 *) LOAD_ASSET(thwompLight); + + camera = &camera1[cameraId]; + if (cameraId == PLAYER_ONE) { + objectIndex = indexObjectList1[_idx]; + set_object_flag_status_false(objectIndex, 0x00070000); + func_800722CC(objectIndex, 0x00000110); + } + + func_800534A4(objectIndex); + + objectIndex = indexObjectList1[_idx]; + minusone = gObjectList[objectIndex].unk_0DF - 1; + plusone = gObjectList[objectIndex].unk_0DF + 1; + + //! @todo Fix this quick hack fix to allow thwomps to render in custom courses + OThwomp::DrawModel(objectIndex); + if (GetCourse() != GetBowsersCastle()) { + } else { + if (gGamestate != CREDITS_SEQUENCE) { + if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && + (is_object_visible_on_camera(objectIndex, camera, 0x8000) != 0)) { + OThwomp::DrawModel(objectIndex); + } + } else { // CREDITS_SEQUENCE + OThwomp::DrawModel(objectIndex); + } + } + + gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079C8); + gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA); + gSPNumLights(gDisplayListHead++, 1); + gSPLight(gDisplayListHead++, &thwompLight.l[0], LIGHT_1); + gSPLight(gDisplayListHead++, &thwompLight.a, LIGHT_2); + gSPClearGeometryMode(gDisplayListHead++, G_CULL_BOTH); + gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_LIGHTING | G_SHADING_SMOOTH); + load_texture_block_rgba16_mirror((u8*)d_course_bowsers_castle_thwomp_side, 0x00000020, 0x00000020); + for (i = 0; i < gObjectParticle3_SIZE; i++) { + objectIndex = gObjectParticle3[i]; + if (objectIndex != NULL_OBJECT_ID) { + object = &gObjectList[objectIndex]; + if ((object->state > 0) && (State == MOVE_FAR) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { + rsp_set_matrix_transformation(object->pos, object->orientation, object->sizeScaling); + gSPVertex(gDisplayListHead++, (uintptr_t)D_0D005C00, 3, 0); + gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D006930); + } + } + } + gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); + gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); + gSPTexture(gDisplayListHead++, 0x0001, 0x0001, 0, G_TX_RENDERTILE, G_OFF); + gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007AE0); + load_texture_block_ia8_nomirror(D_8018D490, 0x00000020, 0x00000020); + func_8004B3C8(0); + D_80183E80[0] = 0; + D_80183E80[2] = 0x8000; + for (i = 0; i < gObjectParticle2_SIZE; i++) { + objectIndex = gObjectParticle2[i]; + if (objectIndex != NULL_OBJECT_ID) { + object = &gObjectList[objectIndex]; + if ((object->state >= 2) && (State == MOVE_AND_ROTATE) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { + func_8004B138(0x000000FF, 0x000000FF, 0x000000FF, (s32) object->primAlpha); + D_80183E80[1] = func_800418AC(object->pos[0], object->pos[2], camera->pos); + func_800431B0(object->pos, D_80183E80, object->sizeScaling, (Vtx*)D_0D005AE0); + } + } + } +} + +void OThwomp::DrawModel(s32 objectIndex) { + if ((gObjectList[objectIndex].state >= 2) && (func_80072354(objectIndex, 0x00000040) != 0)) { + func_8004A7AC(objectIndex, 1.75f); + rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, + gObjectList[objectIndex].sizeScaling); + func_800534E8(objectIndex); + gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007828); + gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16); + gDPLoadTLUT_pal256(gDisplayListHead++, d_course_bowsers_castle_thwomp_tlut); + rsp_load_texture_mask((u8*)gObjectList[objectIndex].activeTexture, 0x00000010, 0x00000040, 4); + gSPDisplayList(gDisplayListHead++, gObjectList[objectIndex].model); + } +} + +void OThwomp::StationaryBehaviour(s32 objectIndex) { // func_8007ED6C + UNUSED s32 stackPadding[4]; + switch (gObjectList[objectIndex].state) { + case 0: + break; + case 1: + OThwomp::func_8007EC30(objectIndex); + break; + case 2: + set_and_run_timer_object(objectIndex, 0x0000003C); + break; + case 3: + func_80072568(objectIndex, 0x00000032); + break; + case 4: + if (func_8007E59C(objectIndex) != 0) { + func_800725E8(objectIndex, 0x0000012C, 2); + } else { + func_800726CC(objectIndex, 2); + } + break; + } + func_8007E63C(objectIndex); + object_calculate_new_pos_offset(objectIndex); + gObjectList[objectIndex].direction_angle[1] = gObjectList[objectIndex].orientation[1]; + func_80073514(objectIndex); +} + +// Stationary +void OThwomp::func_8007EC30(s32 objectIndex) { + Object* object; + + object = &gObjectList[objectIndex]; + object->surfaceHeight = 0.0f; + object->origin_pos[1] = 0.0f; + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + if (gIsMirrorMode != 0) { + set_obj_direction_angle(objectIndex, 0U, -_faceDirection, 0U); + set_obj_orientation(objectIndex, 0U, -_faceDirection, 0U); + } else { + set_obj_direction_angle(objectIndex, 0U, _faceDirection, 0U); + set_obj_orientation(objectIndex, 0U, _faceDirection, 0U); + } + init_texture_object(objectIndex, (uint8_t*) d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, + 0x10U, (u16) 0x00000040); + object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; + object->boundingBoxSize = 0x000C; + object->unk_01C[1] = 30.0f; + set_object_flag_status_true(objectIndex, 0x05000220); + object->type = 0; + object->unk_0DF = 6; + func_800724DC(objectIndex); + object_next_state(objectIndex); +} + +void OThwomp::MoveAndRotateBehaviour(s32 objectIndex) { // func_8007F5A8 + + switch (gObjectList[objectIndex].state) { /* irregular */ + case 0: + break; + case 1: + OThwomp::func_8007EE5C(objectIndex); + break; + case 3: + func_80072568(objectIndex, 0x00000032); + break; + case 4: + func_80086FD4(objectIndex); + object_next_state(objectIndex); + break; + } + func_8007E63C(objectIndex); + func_8007F544(objectIndex); + object_calculate_new_pos_offset(objectIndex); + func_80073514(objectIndex); +} + +// MoveAndRotateBehaviour +void OThwomp::func_8007EE5C(s32 objectIndex) { + Object* object; + + init_texture_object(objectIndex, (u8*)d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, + 0x10U, (u16) 0x00000040); + object = &gObjectList[objectIndex]; + object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; + object->boundingBoxSize = 0x000C; + set_object_flag_status_true(objectIndex, 0x04000220); + object->type = 0; + object->unk_0DF = 6; + func_80086E70(objectIndex); + object->surfaceHeight = 0.0f; + object->origin_pos[1] = 0.0f; + set_obj_origin_offset(objectIndex, 0.0f, 20.0f, 0.0f); + object->unk_01C[1] = 20.0f; + if (gIsMirrorMode != 0) { + set_obj_direction_angle(objectIndex, 0U, -_faceDirection, 0U); + set_obj_orientation(objectIndex, 0U, -_faceDirection, 0U); + } else { + set_obj_direction_angle(objectIndex, 0U, _faceDirection, 0U); + set_obj_orientation(objectIndex, 0U, _faceDirection, 0U); + } + object->unk_0AE = 1; + if (object->primAlpha == 0) { + object->unk_0DD = 1; + } else { + object->unk_0DD = 2; + } + object_next_state(objectIndex); +} + +void OThwomp::MoveFarBehaviour(s32 objectIndex) { // func_8007FFC0 + switch (gObjectList[objectIndex].state) { + case 0: + break; + case 1: + OThwomp::func_8007FA08(objectIndex); + break; + case 3: + func_80072568(objectIndex, 0x00000032); + break; + case 4: + object_next_state(objectIndex); + func_80086FD4(objectIndex); + break; + } + func_8007E63C(objectIndex); + func_8007FF5C(objectIndex); + object_calculate_new_pos_offset(objectIndex); + func_80073514(objectIndex); +} + +// MoveFarBehaviour +void OThwomp::func_8007FA08(s32 objectIndex) { + Object* object; + + init_texture_object(objectIndex, (u8*)d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, + 0x10U, (u16) 0x00000040); + object = &gObjectList[objectIndex]; + object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; + object->boundingBoxSize = 0x000C; + set_object_flag_status_true(objectIndex, 0x04000220); + object->type = 0; + object->surfaceHeight = 0.0f; + object->origin_pos[1] = 0.0f; + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + set_obj_direction_angle(objectIndex, 0U, 0U, 0U); + if (gIsMirrorMode != 0) { + set_obj_orientation(objectIndex, 0U, 0xC000U, 0U); + } else { + set_obj_orientation(objectIndex, 0U, 0x4000U, 0U); + } + object->velocity[0] = 0.0f; + object->direction_angle[1] = object->orientation[1]; + object->unk_0DD = 1; + object->unk_0DF = 8; + object->offset[1] = 15.0f; + object->unk_01C[1] = 15.0f; + object_next_state(objectIndex); +} + +void OThwomp::StationaryFastBehaviour(s32 objectIndex) { // func_800801FC + Object* object; + + object = &gObjectList[objectIndex]; + switch (object->state) { + case 0: + break; + case 1: + OThwomp::func_80080078(objectIndex); + break; + case 2: + set_and_run_timer_object(objectIndex, object->timer); + break; + case 3: + func_80072568(objectIndex, 0x00000032); + break; + case 4: + object->timer = 0x0000003C; + func_800726CC(objectIndex, 2); + break; + } + func_8007E63C(objectIndex); + object_calculate_new_pos_offset(objectIndex); + func_80073514(objectIndex); +} + +// StationaryFastBehaviour +void OThwomp::func_80080078(s32 objectIndex) { // func_80080078 + Object* object; + + init_texture_object(objectIndex, (u8*)d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, + 0x10U, (u16) 0x00000040); + object = &gObjectList[objectIndex]; + object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; + object->boundingBoxSize = 0x000C; + set_object_flag_status_true(objectIndex, 0x04000220); + object->type = 2; + object->unk_0DF = 8; + set_obj_direction_angle(objectIndex, 0U, 0U, 0U); + object->surfaceHeight = 0.0f; + object->origin_pos[1] = 0.0f; + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + object->unk_01C[1] = 30.0f; + if (gIsMirrorMode != 0) { + set_obj_orientation(objectIndex, 0U, -_faceDirection, 0U); + } else { + set_obj_orientation(objectIndex, 0U, _faceDirection, 0U); + } + switch (object->primAlpha) { /* irregular */ + case 0: + object->timer = 2; + break; + case 1: + object->timer = 0x0000003C; + break; + case 2: + object->timer = 0x00000078; + break; + case 3: + object->timer = 0x000000B4; + break; + } + func_800724DC(objectIndex); + object_next_state(objectIndex); +} + +void OThwomp::JailedBehaviour(s32 objectIndex) { // func_80080408 + switch (gObjectList[objectIndex].state) { + case 0: + break; + case 1: + OThwomp::func_800802C0(objectIndex); + break; + case 2: + func_8008A6DC(objectIndex, 100.0f); + if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { + func_800C98B8(gObjectList[objectIndex].pos, gObjectList[objectIndex].velocity, + SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x45)); + object_next_state(objectIndex); + } + break; + case 3: + if (func_800730BC(objectIndex, 3, 5, 1, 6, 6) != 0) { + gObjectList[objectIndex].textureListIndex = 0; + } + break; + case 4: + if (set_and_run_timer_object(objectIndex, 0x0000012C) != 0) { + func_800726CC(objectIndex, 2); + } + break; + } + object_calculate_new_pos_offset(objectIndex); + func_80073514(objectIndex); +} + +// JailedBehaviour +void OThwomp::func_800802C0(s32 objectIndex) { + Object* object; + + object = &gObjectList[objectIndex]; + object->unk_0D8 = 0; + init_texture_object(objectIndex, (u8*)d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, + 0x10U, (u16) 0x00000040); + object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; + object->textureListIndex = 0; + object->boundingBoxSize = 0x000C; + //object->sizeScaling = 1.5f; + set_object_flag_status_true(objectIndex, 0x05000220); + object->type = 1; + object->unk_0DF = 6; + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + set_obj_direction_angle(objectIndex, 0U, 0U, 0U); + object->surfaceHeight = 0.0f; + object->origin_pos[1] = 0.0f; + object->offset[1] = 10.0f; + object->unk_01C[1] = 10.0f; + if (gIsMirrorMode != 0) { + set_obj_orientation(objectIndex, 0U, 0x4000U, 0U); + } else { + set_obj_orientation(objectIndex, 0U, 0xC000U, 0U); + } + object->offset[0] = 0.0f; + object->offset[2] = 0.0f; + func_800724DC(objectIndex); + object_next_state(objectIndex); +} + +void OThwomp::SlidingBehaviour(s32 objectIndex) { // func_800808CC + switch (gObjectList[objectIndex].state) { /* irregular */ + case 0: + break; + case 1: + OThwomp::func_80080524(objectIndex); + break; + case 2: + func_800730BC(objectIndex, 3, 5, 1, 6, -1); + break; + } + if (gObjectList[objectIndex].state >= 2) { + func_8007E63C(objectIndex); + func_8008085C(objectIndex); + func_80073514(objectIndex); + if (gGamestate != 9) { + if ((D_8018D40C == 0) && (gObjectList[objectIndex].state == 2)) { + func_800C98B8(gObjectList[objectIndex].pos, gObjectList[objectIndex].velocity, + SOUND_ARG_LOAD(0x19, 0x03, 0x60, 0x45)); + } + } else if ((gCutsceneShotTimer < 0xBF) && (((s16) gCutsceneShotTimer % 88) == 0x0000001E)) { + func_800C98B8(gObjectList[objectIndex].pos, gObjectList[objectIndex].velocity, + SOUND_ARG_LOAD(0x19, 0x03, 0x60, 0x45)); + } + } +} + +// SlidingBehaviour +void OThwomp::func_80080524(s32 objectIndex) { + Object* object; + + init_texture_object(objectIndex, (u8*)d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, + 0x10U, (u16) 0x00000040); + object = &gObjectList[objectIndex]; + object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; + object->boundingBoxSize = 0x000C; + object->textureListIndex = 0; + set_object_flag_status_true(objectIndex, 0x04000220); + object->type = 0; + object->unk_0DF = 0x0A; + func_80086E70(objectIndex); + set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); + object->surfaceHeight = 70.0f; + object->origin_pos[1] = 70.0f; + object->unk_01C[1] = 0.0f; + set_obj_direction_angle(objectIndex, 0U, 0U, 0U); + if ((gIsMirrorMode != 0) || (gGamestate == CREDITS_SEQUENCE)) { + set_obj_orientation(objectIndex, 0U, -_faceDirection, 0U); + } else { + set_obj_orientation(objectIndex, 0U, _faceDirection, 0U); + } + switch (object->primAlpha) { /* irregular */ + case 0: + object->unk_0DD = 2; + object->velocity[2] = -1.0f; + break; + case 1: + object->unk_0DD = 2; + object->velocity[2] = -1.5f; + break; + } + func_800722A4(objectIndex, 0x00000080); + object_next_state(objectIndex); +} diff --git a/src/engine/vehicles/OThwomp.h b/src/engine/vehicles/OThwomp.h new file mode 100644 index 000000000..dee64044d --- /dev/null +++ b/src/engine/vehicles/OThwomp.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include + +extern "C" { +#include "macros.h" +#include "main.h" +#include "vehicles.h" +#include "waypoints.h" +#include "common_structs.h" +#include "objects.h" +} + +/** + * Used in VS mode + * + * This differs from the other vehicle classes in that it does not get added to the standard actor list + * So this is sort of its own thing. Draw call in different place too. + */ +class OThwomp { +private: + enum States : uint16_t { + DISABLED, + STATIONARY, + MOVE_AND_ROTATE, + MOVE_FAR, // Requires enough space to work + STATIONARY_FAST, + SLIDE, // Moves sideways left / right + JAILED // Has no collision + }; + +public: + States State = States::DISABLED; + + explicit OThwomp(s32 i, f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); + + void Tick(); + void Draw(s32 playerId); + void DrawModel(s32); + s32 func_8007F75C(s32 playerId); + void func_8007F8D8(); + + void StationaryBehaviour(s32 objectIndex); + void func_8007EC30(s32 objectIndex); + + void MoveAndRotateBehaviour(s32 objectIndex); + void func_8007EE5C(s32 objectIndex); + + void MoveFarBehaviour(s32 objectIndex); + void func_8007FA08(s32 objectIndex); + + void StationaryFastBehaviour(s32 objectIndex); + void func_80080078(s32 objectIndex); + + void JailedBehaviour(s32 objectIndex); + void func_800802C0(s32 objectIndex); + + void SlidingBehaviour(s32 objectIndex); + void func_80080524(s32 objectIndex); +private: + s32 _idx; + s16 _faceDirection; + + +}; diff --git a/src/port/Game.cpp b/src/port/Game.cpp index d9f9ee8d9..5b79f29c9 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -26,11 +26,13 @@ #include "engine/courses/DoubleDeck.h" #include "engine/courses/DKJungle.h" #include "engine/courses/BigDonut.h" +#include "engine/courses/Prison.h" #include "engine/courses/TestCourse.h" #include "engine/courses/PodiumCeremony.h" #include "engine/TrainCrossing.h" +#include "engine/vehicles/OBombKart.h" #include "Smoke.h" @@ -72,6 +74,7 @@ DoubleDeck* gDoubleDeck; DKJungle* gDkJungle; BigDonut* gBigDonut; PodiumCeremony* gPodiumCeremony; +PrisonCourse* gPrisonCourse; TestCourse* gTestCourse; Cup* gMushroomCup; @@ -103,6 +106,7 @@ void CustomEngineInit() { gDkJungle = new DKJungle(); gBigDonut = new BigDonut(); gPodiumCeremony = new PodiumCeremony(); + gPrisonCourse = new PrisonCourse(); gTestCourse = new TestCourse(); /* Add all courses to the global course list */ @@ -126,6 +130,7 @@ void CustomEngineInit() { gWorldInstance.AddCourse(gDoubleDeck); gWorldInstance.AddCourse(gDkJungle); gWorldInstance.AddCourse(gBigDonut); + gWorldInstance.AddCourse(gPrisonCourse); gWorldInstance.AddCourse(gTestCourse); gMushroomCup = new Cup("mk:mushroom_cup", "mushroom cup", std::vector{ gLuigiRaceway, gMooMooFarm, gKoopaTroopaBeach, gKalimariDesert }); @@ -293,6 +298,8 @@ extern "C" { void CourseManager_ClearVehicles(void) { gWorldInstance.ClearVehicles(); + gWorldInstance.BombKarts.clear(); + gWorldInstance.Thwomps.clear(); } void CourseManager_CrossingTrigger() { @@ -466,6 +473,22 @@ extern "C" { } } + void CourseManager_TickThwomps() { + for (auto& thwomp : gWorldInstance.Thwomps) { + if (thwomp) { + thwomp->Tick(); + } + } + } + + void CourseManager_DrawThwomps(s32 cameraId) { + for (auto& thwomp : gWorldInstance.Thwomps) { + if (thwomp) { + thwomp->Draw(cameraId); + } + } + } + size_t GetCupCursorPosition() { return gWorldInstance.CurrentCup->CursorPosition; } diff --git a/src/port/Game.h b/src/port/Game.h index 3faf2bc82..d2762c08f 100644 --- a/src/port/Game.h +++ b/src/port/Game.h @@ -94,6 +94,10 @@ void CourseManager_ClearVehicles(void); void CourseManager_DrawVehicles(s32 playerId); +void CourseManager_DrawThwomps(s32 cameraId); + +void CourseManager_TickThwomps(); + void CourseManager_CrossingTrigger(); void CourseManager_VehiclesCollision(s32 playerId, Player* player); diff --git a/src/update_objects.c b/src/update_objects.c index 308149b36..c2e4b530f 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -2175,7 +2175,7 @@ void update_flame_particle(void) { } } -void init_object_smoke_paticle(s32 objectIndex, Vec3f arg1, s16 arg2) { +void init_object_smoke_particle(s32 objectIndex, Vec3f arg1, s16 arg2) { Object* object; init_object(objectIndex, (s32) arg2); @@ -2196,7 +2196,7 @@ void init_smoke_particle(Vec3f arg0, UNUSED f32 arg1, s16 arg2) { objectIndex = add_unused_obj_index(gObjectParticle4, &gNextFreeObjectParticle4, gObjectParticle4_SIZE); if (objectIndex != NULL_OBJECT_ID) { - init_object_smoke_paticle(objectIndex, arg0, arg2); + init_object_smoke_particle(objectIndex, arg0, arg2); } } @@ -2255,7 +2255,7 @@ void func_80076F2C(void) { } } -void init_object_smoke_particle(s32 objectIndex, s32 flameIndex) { +void init_object_smoke_particle2(s32 objectIndex, s32 flameIndex) { init_object(objectIndex, 3); gObjectList[objectIndex].unk_0D5 = 0xB; @@ -2279,7 +2279,7 @@ void init_smoke_particles(s32 arg0) { objectIndex = add_unused_obj_index(gObjectParticle4, &gNextFreeObjectParticle4, gObjectParticle4_SIZE); if (objectIndex != NULL_OBJECT_ID) { - init_object_smoke_particle(objectIndex, arg0); + init_object_smoke_particle2(objectIndex, arg0); } } diff --git a/src/update_objects.h b/src/update_objects.h index 6bb8c09b5..8e9da1cc5 100644 --- a/src/update_objects.h +++ b/src/update_objects.h @@ -152,13 +152,13 @@ void func_800769D8(s32); void func_80076AEC(s32); void func_80076B7C(void); void update_flame_particle(void); -void init_object_smoke_paticle(s32, Vec3f, s16); +void init_object_smoke_particle(s32, Vec3f, s16); void init_smoke_particle(Vec3f, f32, s16); void func_80076DC4(s32); void func_80076E14(s32); void func_80076ED8(s32); void func_80076F2C(void); -void init_object_smoke_particle(s32, s32); +void init_object_smoke_particle2(s32, s32); void init_smoke_particles(s32); void func_800773D8(f32*, s32); void func_80077428(s32); From cae7cc7f6f5c66bca929427efaaf1f7847ca8105 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sun, 24 Nov 2024 11:29:46 -0700 Subject: [PATCH 24/30] Finish implementing Thwomp --- src/engine/World.cpp | 3 +- src/engine/World.h | 2 +- src/engine/courses/BowsersCastle.cpp | 63 ++++++++++++++-------------- src/engine/vehicles/OThwomp.cpp | 47 +++++++++++---------- src/engine/vehicles/OThwomp.h | 2 +- src/port/Game.cpp | 7 ++++ src/render_objects.c | 13 +++--- src/render_objects.h | 6 ++- 8 files changed, 76 insertions(+), 67 deletions(-) diff --git a/src/engine/World.cpp b/src/engine/World.cpp index ed122af56..800cafb58 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -97,9 +97,10 @@ void World::AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointInd BombKarts.push_back(std::make_unique(pos, waypoint, waypointIndex, state, unk_3C)); } -void World::AddThwomp(f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { +void World::AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { Thwomps.push_back(std::make_unique(thwomps, x, z, direction, scale, behaviour, primAlpha)); thwomps++; + gNumActiveThwomps = thwomps; } u32 World::GetCupIndex() { diff --git a/src/engine/World.h b/src/engine/World.h index d396d4854..1bb78923e 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -143,7 +143,7 @@ public: void AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C); std::vector> Thwomps; - void AddThwomp(f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); + void AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius); std::vector> Crossings; diff --git a/src/engine/courses/BowsersCastle.cpp b/src/engine/courses/BowsersCastle.cpp index 483442c2d..a12b233a8 100644 --- a/src/engine/courses/BowsersCastle.cpp +++ b/src/engine/courses/BowsersCastle.cpp @@ -152,41 +152,41 @@ void BowsersCastle::InitCourseObjects() { switch (gCCSelection) { case CC_100: case CC_EXTRA: - gWorldInstance.AddThwomp(0x0320, 0xf92a, 0x8000, 1.0f, 1, 0); - gWorldInstance.AddThwomp(0x044c, 0xf92a, 0x8000, 1.0f, 1, 1); - gWorldInstance.AddThwomp(0x02bc, 0xf95c, 0x8000, 1.0f, 2, 0); - gWorldInstance.AddThwomp(0x04b0, 0xf8f8, 0x8000, 1.0f, 2, 1); - gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0x8000, 1.0f, 3, 0); - gWorldInstance.AddThwomp(0x04b0, 0xf592, 0x8000, 1.0f, 3, 1); - gWorldInstance.AddThwomp(0x091a, 0xf5bf, 0x8000, 1.0f, 4, 0); - gWorldInstance.AddThwomp(0x091a, 0xf597, 0x8000, 1.0f, 4, 1); - gWorldInstance.AddThwomp(0x0596, 0xf92f, 0x8000, 1.5f, 6, 0); - gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x8000, 1.0f, 5, 0); - gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x8000, 1.0f, 5, 1); + gWorldInstance.AddThwomp(0x0320, 0xf92a, 0xC000, 1.0f, 1, 0); + gWorldInstance.AddThwomp(0x044c, 0xf92a, 0xC000, 1.0f, 1, 1); + gWorldInstance.AddThwomp(0x02bc, 0xf95c, 0xC000, 1.0f, 2, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf8f8, 0xC000, 1.0f, 2, 1); + gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0xC000, 1.0f, 3, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf592, 0xC000, 1.0f, 3, 1); + gWorldInstance.AddThwomp(0x091a, 0xf5bf, 0xC000, 1.0f, 4, 0); + gWorldInstance.AddThwomp(0x091a, 0xf597, 0xC000, 1.0f, 4, 1); + gWorldInstance.AddThwomp(0x0596, 0xf92f, 0xC000, 1.5f, 6, 0); + gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x4000, 1.0f, 5, 0); + gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x4000, 1.0f, 5, 1); break; case CC_50: - gWorldInstance.AddThwomp(0x3B6, 0xF92A, 0x8000, 1.0f, 1, 0); - gWorldInstance.AddThwomp(0x0352, 0xf95c, 0x8000, 1.0f, 2, 0); - gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0x8000, 1.0f, 3, 0); - gWorldInstance.AddThwomp(0x04b0, 0xf592, 0x8000, 1.0f, 3, 1); - gWorldInstance.AddThwomp(0x091a, 0xf5b0, 0x8000, 1.0f, 4, 0); - gWorldInstance.AddThwomp(0x0596, 0xf92f, 0x8000, 1.5f, 6, 0); - gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x8000, 1.0f, 5, 0); - gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x8000, 1.0f, 5, 1); + gWorldInstance.AddThwomp(0x3B6, 0xF92A, 0xC000, 1.0f, 1, 0); + gWorldInstance.AddThwomp(0x0352, 0xf95c, 0xC000, 1.0f, 2, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0xC000, 1.0f, 3, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf592, 0xC000, 1.0f, 3, 1); + gWorldInstance.AddThwomp(0x091a, 0xf5b0, 0xC000, 1.0f, 4, 0); + gWorldInstance.AddThwomp(0x0596, 0xf92f, 0xC000, 1.5f, 6, 0); + gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x4000, 1.0f, 5, 0); + gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x4000, 1.0f, 5, 1); break; case CC_150: - gWorldInstance.AddThwomp(0x0320, 0xf92a, 0x8000, 1.0f, 1, 0); - gWorldInstance.AddThwomp(0x044c, 0xf92a, 0x8000, 1.0f, 1, 1); - gWorldInstance.AddThwomp(0x02bc, 0xf95c, 0x8000, 1.0f, 2, 0); - gWorldInstance.AddThwomp(0x04b0, 0xf8f8, 0x8000, 1.0f, 2, 1); - gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0x8000, 1.0f, 3, 0); - gWorldInstance.AddThwomp(0x04b0, 0xf592, 0x8000, 1.0f, 3, 1); - gWorldInstance.AddThwomp(0x091a, 0xf5c9, 0x8000, 1.0f, 4, 0); - gWorldInstance.AddThwomp(0x091a, 0xf5ab, 0x8000, 1.0f, 4, 1); - gWorldInstance.AddThwomp(0x091a, 0xf58d, 0x8000, 1.0f, 4, 2); - gWorldInstance.AddThwomp(0x0596, 0xf92f, 0x8000, 1.5f, 6, 0); - gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x8000, 1.0f, 5, 0); - gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x8000, 1.0f, 5, 1); + gWorldInstance.AddThwomp(0x0320, 0xf92a, 0xC000, 1.0f, 1, 0); + gWorldInstance.AddThwomp(0x044c, 0xf92a, 0xC000, 1.0f, 1, 1); + gWorldInstance.AddThwomp(0x02bc, 0xf95c, 0xC000, 1.0f, 2, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf8f8, 0xC000, 1.0f, 2, 1); + gWorldInstance.AddThwomp(0x04b0, 0xf5ba, 0xC000, 1.0f, 3, 0); + gWorldInstance.AddThwomp(0x04b0, 0xf592, 0xC000, 1.0f, 3, 1); + gWorldInstance.AddThwomp(0x091a, 0xf5c9, 0xC000, 1.0f, 4, 0); + gWorldInstance.AddThwomp(0x091a, 0xf5ab, 0xC000, 1.0f, 4, 1); + gWorldInstance.AddThwomp(0x091a, 0xf58d, 0xC000, 1.0f, 4, 2); + gWorldInstance.AddThwomp(0x0596, 0xf92f, 0xC000, 1.5f, 6, 0); + gWorldInstance.AddThwomp(0x082a, 0xf9f2, 0x4000, 1.0f, 5, 0); + gWorldInstance.AddThwomp(0x073a, 0xf9f2, 0x4000, 1.0f, 5, 1); break; } @@ -214,7 +214,6 @@ void BowsersCastle::InitCourseObjects() { } void BowsersCastle::UpdateCourseObjects() { - func_80081208(); update_flame_particle(); } diff --git a/src/engine/vehicles/OThwomp.cpp b/src/engine/vehicles/OThwomp.cpp index 7835c150d..a0bb42ab6 100644 --- a/src/engine/vehicles/OThwomp.cpp +++ b/src/engine/vehicles/OThwomp.cpp @@ -31,7 +31,7 @@ extern "C" { extern s8 gPlayerCount; } -OThwomp::OThwomp(s32 i, f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { +OThwomp::OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { if (i >= 32) { printf("MAX THWOMPS REACHED (32), skipping\n"); return; @@ -46,8 +46,8 @@ OThwomp::OThwomp(s32 i, f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s gObjectList[objectId].unk_0D5 = behaviour; gObjectList[objectId].primAlpha = primAlpha; - if (scale == 0) { - scale = 1; + if (scale == 0.0f) { + scale = 1.0f; } gObjectList[objectId].sizeScaling = scale; @@ -59,8 +59,6 @@ void OThwomp::Tick() { // func_80081210 s32 var_s2_3; s32 var_s4; - D_80165834[0] += 0x100; - D_80165834[1] += 0x200; objectIndex = indexObjectList1[_idx]; func_800722CC(objectIndex, 0x00000010); func_8008A4CC(objectIndex); @@ -193,8 +191,6 @@ s32 OThwomp::func_8007F75C(s32 playerId) { return var_s6; } -Lights1 thwompLight = gdSPDefLights1(85, 85, 85, 255, 255, 255, -66, 82, -55); - void OThwomp::Draw(s32 cameraId) { s32 objectIndex = 0; s32 i; @@ -202,7 +198,6 @@ void OThwomp::Draw(s32 cameraId) { s16 minusone, plusone; Camera* camera; Object* object; - // Lights1 *thwompLightl = (Lights1 *) LOAD_ASSET(thwompLight); camera = &camera1[cameraId]; if (cameraId == PLAYER_ONE) { @@ -211,31 +206,35 @@ void OThwomp::Draw(s32 cameraId) { func_800722CC(objectIndex, 0x00000110); } - func_800534A4(objectIndex); + translate_thwomp_lights(objectIndex); objectIndex = indexObjectList1[_idx]; minusone = gObjectList[objectIndex].unk_0DF - 1; plusone = gObjectList[objectIndex].unk_0DF + 1; //! @todo Fix this quick hack fix to allow thwomps to render in custom courses - OThwomp::DrawModel(objectIndex); - if (GetCourse() != GetBowsersCastle()) { - } else { - if (gGamestate != CREDITS_SEQUENCE) { - if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && - (is_object_visible_on_camera(objectIndex, camera, 0x8000) != 0)) { - OThwomp::DrawModel(objectIndex); - } - } else { // CREDITS_SEQUENCE - OThwomp::DrawModel(objectIndex); - } + OThwomp::DrawModel(objectIndex); + if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && + (is_object_visible_on_camera(objectIndex, camera, 0x8000) != 0)) { } + // if (GetCourse() != GetBowsersCastle()) { + // OThwomp::DrawModel(objectIndex); + // } else { + // if (gGamestate != CREDITS_SEQUENCE) { + // if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && + // (is_object_visible_on_camera(objectIndex, camera, 0x8000) != 0)) { + // OThwomp::DrawModel(objectIndex); + // } + // } else { // CREDITS_SEQUENCE + // OThwomp::DrawModel(objectIndex); + // } + // } gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079C8); gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA); gSPNumLights(gDisplayListHead++, 1); - gSPLight(gDisplayListHead++, &thwompLight.l[0], LIGHT_1); - gSPLight(gDisplayListHead++, &thwompLight.a, LIGHT_2); + gSPLight(gDisplayListHead++, &D_800E4668.l[0], LIGHT_1); + gSPLight(gDisplayListHead++, &D_800E4668.a, LIGHT_2); gSPClearGeometryMode(gDisplayListHead++, G_CULL_BOTH); gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_LIGHTING | G_SHADING_SMOOTH); load_texture_block_rgba16_mirror((u8*)d_course_bowsers_castle_thwomp_side, 0x00000020, 0x00000020); @@ -276,7 +275,7 @@ void OThwomp::DrawModel(s32 objectIndex) { func_8004A7AC(objectIndex, 1.75f); rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, gObjectList[objectIndex].sizeScaling); - func_800534E8(objectIndex); + thwomp_lights(objectIndex); gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007828); gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16); gDPLoadTLUT_pal256(gDisplayListHead++, d_course_bowsers_castle_thwomp_tlut); @@ -285,6 +284,8 @@ void OThwomp::DrawModel(s32 objectIndex) { } } +/** Behaviours **/ + void OThwomp::StationaryBehaviour(s32 objectIndex) { // func_8007ED6C UNUSED s32 stackPadding[4]; switch (gObjectList[objectIndex].state) { diff --git a/src/engine/vehicles/OThwomp.h b/src/engine/vehicles/OThwomp.h index dee64044d..f1da5c97c 100644 --- a/src/engine/vehicles/OThwomp.h +++ b/src/engine/vehicles/OThwomp.h @@ -33,7 +33,7 @@ private: public: States State = States::DISABLED; - explicit OThwomp(s32 i, f32 x, f32 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); + explicit OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); void Tick(); void Draw(s32 playerId); diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 5b79f29c9..ba3a68390 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -473,7 +473,14 @@ extern "C" { } } + extern Vec3su D_80165834; void CourseManager_TickThwomps() { + // TickLights + if (gWorldInstance.Thwomps.size()) { + D_80165834[0] += 0x100; + D_80165834[1] += 0x200; + } + for (auto& thwomp : gWorldInstance.Thwomps) { if (thwomp) { thwomp->Tick(); diff --git a/src/render_objects.c b/src/render_objects.c index bc7728fe2..7a34c47b5 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -1624,7 +1624,6 @@ void func_8004B7DC_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, coordX = (s32)OTRGetDimensionFromRightEdge(xl) << 2; coordX2 = (s32)OTRGetDimensionFromRightEdge(xh2) << 2; } - gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, 1 << 10); @@ -3759,7 +3758,7 @@ void render_lakitu(s32 cameraId) { } } -void func_800534A4(UNUSED s32 arg0) { +void translate_thwomp_lights(UNUSED s32 arg0) { func_800419F8(); // Lights1 *D_800E4638l = (Lights1 *) LOAD_ASSET(D_800E4638); D_800E4638.l[0].l.dir[0] = D_80165840[0]; @@ -3767,7 +3766,7 @@ void func_800534A4(UNUSED s32 arg0) { D_800E4638.l[0].l.dir[2] = D_80165840[2]; } -void func_800534E8(s32 objectIndex) { +void thwomp_lights(s32 objectIndex) { // Lights1 *D_800E4638l = (Lights1 *) LOAD_ASSET(D_800E4638); // Lights1 *D_800E4650l = (Lights1 *) LOAD_ASSET(D_800E4650); @@ -3807,7 +3806,7 @@ void render_object_thwomps_model(s32 objectIndex) { func_8004A7AC(objectIndex, 1.75f); rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, gObjectList[objectIndex].sizeScaling); - func_800534E8(objectIndex); + thwomp_lights(objectIndex); gSPDisplayList(gDisplayListHead++, D_0D007828); gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16); gDPLoadTLUT_pal256(gDisplayListHead++, d_course_bowsers_castle_thwomp_tlut); @@ -3834,17 +3833,17 @@ void render_object_thwomps(s32 cameraId) { } } - func_800534A4(objectIndex); + translate_thwomp_lights(objectIndex); for (i = 0; i < gNumActiveThwomps; i++) { objectIndex = indexObjectList1[i]; minusone = gObjectList[objectIndex].unk_0DF - 1; plusone = gObjectList[objectIndex].unk_0DF + 1; - if (gGamestate != 9) { + if (gGamestate != CREDITS_SEQUENCE) { if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && (is_object_visible_on_camera(objectIndex, camera, 0x8000U) != 0)) { render_object_thwomps_model(objectIndex); } - } else { + } else { // CREDITS_SEQUENCE render_object_thwomps_model(objectIndex); } } diff --git a/src/render_objects.h b/src/render_objects.h index 8dfcb12e3..9a6ffd1e9 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -345,8 +345,8 @@ void render_object_snowmans_list_2(s32); void render_object_snowmans_list_1(s32); void render_object_snowmans(s32); void render_lakitu(s32); -void func_800534A4(s32); -void func_800534E8(s32); +void translate_thwomp_lights(s32); +void thwomp_lights(s32); void render_object_thwomps_model(s32); void render_object_thwomps(s32); void func_80053D74(s32, s32, s32); @@ -431,6 +431,8 @@ void func_80057B14(s32, s32, char*, u32); void func_80057B80(s32, s32, char*, u32); void func_80057BEC(s32, s32, char*, u32); +extern Lights1 D_800E4668; + extern f32 D_801637C4; extern s32 D_801637E8; extern f32 D_801637F0; From 17d3fb49f250ba5975180de2bac4d0d50bcf1cda Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:03:50 -0700 Subject: [PATCH 25/30] Thwomp Collisionbox and squish size --- src/engine/World.cpp | 5 ++- src/engine/World.h | 2 +- src/engine/vehicles/OThwomp.cpp | 75 +++++++++++++++++++++++---------- src/engine/vehicles/OThwomp.h | 16 +++++-- 4 files changed, 68 insertions(+), 30 deletions(-) diff --git a/src/engine/World.cpp b/src/engine/World.cpp index 800cafb58..aae7f3568 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -97,8 +97,9 @@ void World::AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointInd BombKarts.push_back(std::make_unique(pos, waypoint, waypointIndex, state, unk_3C)); } -void World::AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { - Thwomps.push_back(std::make_unique(thwomps, x, z, direction, scale, behaviour, primAlpha)); +void World::AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize) { + Thwomps.push_back( + std::make_unique(thwomps, x, z, direction, scale, behaviour, primAlpha, boundingBoxSize)); thwomps++; gNumActiveThwomps = thwomps; } diff --git a/src/engine/World.h b/src/engine/World.h index 1bb78923e..a5d9770a5 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -143,7 +143,7 @@ public: void AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C); std::vector> Thwomps; - void AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); + void AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize = 7); TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius); std::vector> Crossings; diff --git a/src/engine/vehicles/OThwomp.cpp b/src/engine/vehicles/OThwomp.cpp index a0bb42ab6..5cca30623 100644 --- a/src/engine/vehicles/OThwomp.cpp +++ b/src/engine/vehicles/OThwomp.cpp @@ -31,13 +31,14 @@ extern "C" { extern s8 gPlayerCount; } -OThwomp::OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha) { +OThwomp::OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize) { if (i >= 32) { printf("MAX THWOMPS REACHED (32), skipping\n"); return; } _idx = i; _faceDirection = direction; + _boundingBoxSize = boundingBoxSize; State = (States)behaviour; s32 objectId = indexObjectList1[i]; init_object(objectId, 0); @@ -45,6 +46,7 @@ OThwomp::OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s gObjectList[objectId].origin_pos[2] = z; gObjectList[objectId].unk_0D5 = behaviour; gObjectList[objectId].primAlpha = primAlpha; + gObjectList[objectId].boundingBoxSize = boundingBoxSize + 5; if (scale == 0.0f) { scale = 1.0f; @@ -96,7 +98,7 @@ void OThwomp::Tick() { // func_80081210 objectIndex = indexObjectList1[_idx]; if (!(player->effects & BOO_EFFECT)) { - func_80080B28(objectIndex, var_s4); + OThwomp::func_80080B28(objectIndex, var_s4); } if (is_obj_flag_status_active(objectIndex, 0x00020000) != 0) { func_80080A14(objectIndex, player); @@ -191,6 +193,53 @@ s32 OThwomp::func_8007F75C(s32 playerId) { return var_s6; } +void OThwomp::func_80080B28(s32 objectIndex, s32 playerId) { + f32 temp_f0; + Player* temp_s0; + + temp_s0 = &gPlayerOne[playerId]; + if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) { + if (!(temp_s0->soundEffects & 0x100)) { + temp_f0 = func_80088F54(objectIndex, temp_s0); + if ((temp_f0 <= 9.0) && !(temp_s0->effects & 0x04000000) && + (has_collided_horizontally_with_player(objectIndex, temp_s0) != 0)) { + if ((temp_s0->type & 0x8000) && !(temp_s0->type & 0x100)) { + if (!(temp_s0->effects & 0x200)) { + func_80089474(objectIndex, playerId, 1.4f, 1.1f, SOUND_ARG_LOAD(0x19, 0x00, 0xA0, 0x4C)); + } else if (func_80072354(objectIndex, 0x00000040) != 0) { + if (temp_s0->type & 0x1000) { + func_800C98B8(temp_s0->pos, temp_s0->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0xA2, 0x4A)); + } else { + func_800C9060((u8) playerId, SOUND_ARG_LOAD(0x19, 0x01, 0xA2, 0x4A)); + } + func_80080DE4(objectIndex); + func_80075304(gObjectList[objectIndex].pos, 3, 3, D_8018D3C4); + set_object_flag_status_false(objectIndex, 0x00000200); + func_800722A4(objectIndex, 0x00000040); + func_80086F60(objectIndex); + func_800726CC(objectIndex, 0x000000C8); + } + } + } else if ((temp_f0 <= 17.5) && (func_80072320(objectIndex, 1) != 0) && + (is_within_horizontal_distance_of_player(objectIndex, temp_s0, (temp_s0->unk_094 * 0.5) + _boundingBoxSize) != + 0)) { + if ((temp_s0->type & 0x8000) && !(temp_s0->type & 0x100)) { + if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) { + func_80072180(); + } + func_800722A4(objectIndex, 2); + temp_s0->unk_040 = (s16) objectIndex; + temp_s0->unk_046 |= 2; + temp_s0->soundEffects |= 0x100; + func_80088FF0(temp_s0); + } + } + } else { + func_80088FF0(temp_s0); + } + } +} + void OThwomp::Draw(s32 cameraId) { s32 objectIndex = 0; s32 i; @@ -212,23 +261,9 @@ void OThwomp::Draw(s32 cameraId) { minusone = gObjectList[objectIndex].unk_0DF - 1; plusone = gObjectList[objectIndex].unk_0DF + 1; - //! @todo Fix this quick hack fix to allow thwomps to render in custom courses + if (gGamestate != CREDITS_SEQUENCE) { OThwomp::DrawModel(objectIndex); - if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && - (is_object_visible_on_camera(objectIndex, camera, 0x8000) != 0)) { } - // if (GetCourse() != GetBowsersCastle()) { - // OThwomp::DrawModel(objectIndex); - // } else { - // if (gGamestate != CREDITS_SEQUENCE) { - // if ((D_8018CF68[cameraId] >= minusone) && (plusone >= D_8018CF68[cameraId]) && - // (is_object_visible_on_camera(objectIndex, camera, 0x8000) != 0)) { - // OThwomp::DrawModel(objectIndex); - // } - // } else { // CREDITS_SEQUENCE - // OThwomp::DrawModel(objectIndex); - // } - // } gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079C8); gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA); @@ -332,7 +367,6 @@ void OThwomp::func_8007EC30(s32 objectIndex) { init_texture_object(objectIndex, (uint8_t*) d_course_bowsers_castle_thwomp_tlut, (const char**) d_course_bowsers_castle_thwomp_faces, 0x10U, (u16) 0x00000040); object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - object->boundingBoxSize = 0x000C; object->unk_01C[1] = 30.0f; set_object_flag_status_true(objectIndex, 0x05000220); object->type = 0; @@ -371,7 +405,6 @@ void OThwomp::func_8007EE5C(s32 objectIndex) { 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - object->boundingBoxSize = 0x000C; set_object_flag_status_true(objectIndex, 0x04000220); object->type = 0; object->unk_0DF = 6; @@ -425,7 +458,6 @@ void OThwomp::func_8007FA08(s32 objectIndex) { 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - object->boundingBoxSize = 0x000C; set_object_flag_status_true(objectIndex, 0x04000220); object->type = 0; object->surfaceHeight = 0.0f; @@ -480,7 +512,6 @@ void OThwomp::func_80080078(s32 objectIndex) { // func_80080078 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - object->boundingBoxSize = 0x000C; set_object_flag_status_true(objectIndex, 0x04000220); object->type = 2; object->unk_0DF = 8; @@ -552,7 +583,6 @@ void OThwomp::func_800802C0(s32 objectIndex) { 0x10U, (u16) 0x00000040); object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; object->textureListIndex = 0; - object->boundingBoxSize = 0x000C; //object->sizeScaling = 1.5f; set_object_flag_status_true(objectIndex, 0x05000220); object->type = 1; @@ -609,7 +639,6 @@ void OThwomp::func_80080524(s32 objectIndex) { 0x10U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->model = (Gfx*)d_course_bowsers_castle_dl_thwomp; - object->boundingBoxSize = 0x000C; object->textureListIndex = 0; set_object_flag_status_true(objectIndex, 0x04000220); object->type = 0; diff --git a/src/engine/vehicles/OThwomp.h b/src/engine/vehicles/OThwomp.h index f1da5c97c..17c46553b 100644 --- a/src/engine/vehicles/OThwomp.h +++ b/src/engine/vehicles/OThwomp.h @@ -13,10 +13,14 @@ extern "C" { } /** - * Used in VS mode + * Thwomp GameObject * - * This differs from the other vehicle classes in that it does not get added to the standard actor list - * So this is sort of its own thing. Draw call in different place too. + * The game automatically places the actor on the ground so you do not need to provide a Y coordinate value. + * + * @arg direction the rotational direction the thwomp is facing. + * @arg behaviour the behaviour of the thwomp, uses values 1-6. + * @arg primAlpha unknown + * @arg boundingBoxSize optional. The size of the bounding box for the thwomp. Default value is 12 */ class OThwomp { private: @@ -33,9 +37,10 @@ private: public: States State = States::DISABLED; - explicit OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha); + explicit OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize); void Tick(); + void func_80080B28(s32 objectIndex, s32 playerId); void Draw(s32 playerId); void DrawModel(s32); s32 func_8007F75C(s32 playerId); @@ -61,6 +66,9 @@ public: private: s32 _idx; s16 _faceDirection; + //! @todo Write this better. This effects the squish size and the bounding box size. + // We should probably return to the programmer the pointer to the actor so they can do thwomp->squishSize = value. + u16 _boundingBoxSize; }; From 55fe8eb13d010699abaedd289c0377678c36072e Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:06:06 -0700 Subject: [PATCH 26/30] Thwomp Comments --- src/engine/vehicles/OThwomp.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/engine/vehicles/OThwomp.h b/src/engine/vehicles/OThwomp.h index 17c46553b..2d8a2a075 100644 --- a/src/engine/vehicles/OThwomp.h +++ b/src/engine/vehicles/OThwomp.h @@ -12,6 +12,9 @@ extern "C" { #include "objects.h" } +//! @todo Make shadow size bigger if thwomp is scaled up +//! @todo make adjustable properties for squishSize and boundingBoxSize + /** * Thwomp GameObject * From b7a637abacee267bd5f121439919f997a03113d8 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sun, 24 Nov 2024 15:38:57 -0700 Subject: [PATCH 27/30] Fix freecam for custom courses --- src/engine/courses/Course.cpp | 6 +++++- src/engine/courses/Course.h | 1 + src/engine/courses/TestCourse.cpp | 4 ++++ src/engine/courses/TestCourse.h | 1 + src/port/Game.cpp | 9 +++++++++ src/racing/render_courses.c | 6 ------ 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/engine/courses/Course.cpp b/src/engine/courses/Course.cpp index a3c107f1a..6cef03d6b 100644 --- a/src/engine/courses/Course.cpp +++ b/src/engine/courses/Course.cpp @@ -239,6 +239,10 @@ void Course::Collision() {} void Course::ScrollingTextures() {} void Course::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {} -void Course::Destroy() { } +void Course::Destroy() {} + +bool Course::IsMod() { + return false; +} Course* currentCourse = nullptr; diff --git a/src/engine/courses/Course.h b/src/engine/courses/Course.h index 20fd553c0..3d3335854 100644 --- a/src/engine/courses/Course.h +++ b/src/engine/courses/Course.h @@ -114,6 +114,7 @@ public: virtual void ScrollingTextures(); virtual void DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection); virtual void Destroy(); + virtual bool IsMod(); private: void Init(); }; diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index 4a132c410..05f6c9ed2 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -340,3 +340,7 @@ void TestCourse::RenderCredits() { void TestCourse::Collision() {} void TestCourse::Destroy() { } + +bool TestCourse::IsMod() { + return true; +} \ No newline at end of file diff --git a/src/engine/courses/TestCourse.h b/src/engine/courses/TestCourse.h index 4f0e83b9c..8bcffb131 100644 --- a/src/engine/courses/TestCourse.h +++ b/src/engine/courses/TestCourse.h @@ -39,4 +39,5 @@ public: virtual void SpawnVehicles() override; virtual void UpdateVehicles() override; virtual void Destroy() override; + virtual bool IsMod() override; }; diff --git a/src/port/Game.cpp b/src/port/Game.cpp index ba3a68390..38595cb74 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -41,6 +41,7 @@ extern "C" { #include "audio/load.h" #include "audio/external.h" #include "networking/networking.h" +#include "render_courses.h" //#include "engine/wasm.h" } @@ -340,6 +341,14 @@ extern "C" { } void CourseManager_RenderCourse(struct UnkStruct_800DC5EC* arg0) { + if (gWorldInstance.CurrentCourse->IsMod() == false) { + if ((CVarGetInteger("gFreecam", 0) == true)) { + // Render credits courses + func_8029569C(); + return; + } + } + if (gWorldInstance.CurrentCourse) { gWorldInstance.CurrentCourse->Render(arg0); } diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index 5976041d7..589853167 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -1399,12 +1399,6 @@ void render_course(struct UnkStruct_800DC5EC* arg0) { return; } - if ((CVarGetInteger("gFreecam", 0) == true)) { - // Render credits courses - func_8029569C(); - return; - } - if (creditsRenderMode) { func_8029569C(); return; From 84dd3214542db1ec8636082eead8da5295457676 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Mon, 25 Nov 2024 18:21:16 -0700 Subject: [PATCH 28/30] Fix extract, add audio yml --- config.yml | 1 - yamls/us/audio.yml | 30 ++++++++++++++++++++++++++++++ yamls/us/audio_banks.yml | 16 ---------------- yamls/us/audio_instrument_sets.yml | 16 ---------------- yamls/us/audio_sequences.yml | 16 ---------------- yamls/us/audio_tables.yml | 16 ---------------- yamls/us/course_metadata.yml | 4 ---- 7 files changed, 30 insertions(+), 69 deletions(-) create mode 100644 yamls/us/audio.yml delete mode 100644 yamls/us/audio_banks.yml delete mode 100644 yamls/us/audio_instrument_sets.yml delete mode 100644 yamls/us/audio_sequences.yml delete mode 100644 yamls/us/audio_tables.yml delete mode 100644 yamls/us/course_metadata.yml diff --git a/config.yml b/config.yml index 3acb82f53..d69e23ea9 100644 --- a/config.yml +++ b/config.yml @@ -10,7 +10,6 @@ binary: spaghetti.otr headers: include/assets code: assets/code - metadata: [yamls/courses] segments: - 0x000000 - 0x000000 diff --git a/yamls/us/audio.yml b/yamls/us/audio.yml new file mode 100644 index 000000000..30f1d5762 --- /dev/null +++ b/yamls/us/audio.yml @@ -0,0 +1,30 @@ +:config: + force: true + header: + code: + - '#include ' + header: + - '#include ' +audio_setup: + type: NAUDIO:V1:AUDIO_SETUP + audio_seq: + size: 0x23180 + offset: 0xBC5F60 + audio_bank: + size: 0x13840 + offset: 0x966260 + audio_table: + size: 0x24C4C0 + offset: 0x979AA0 + +audio_sample_bank_table: + { type: NAUDIO:V1:AUDIO_TABLE, format: SAMPLE, offset: 0x966260, symbol: gSampleBankTableInit } + +audio_seq_table: + { type: NAUDIO:V1:AUDIO_TABLE, format: SEQUENCE, offset: 0xBC5F60, symbol: gSeqTableInit } + +audio_soundfont_table: + { type: NAUDIO:V1:AUDIO_TABLE, format: SOUNDFONT, offset: 0x979AA4, symbol: gSoundFontTableInit } + +audio_seq_font_table: + { type: ARRAY, count: 283, array_type: u8, offset: 0xBE90E0, symbol: gSeqFontTableInit } \ No newline at end of file diff --git a/yamls/us/audio_banks.yml b/yamls/us/audio_banks.yml deleted file mode 100644 index ea38d8593..000000000 --- a/yamls/us/audio_banks.yml +++ /dev/null @@ -1,16 +0,0 @@ -:config: - vram: - addr: 0x800E8700 - offset: 0x966260 - header: - code: - - '#include ' - - '#include ' - header: - - '#include ' - - '#include ' -audiobanks: - symbol: gAudioBanks - type: bob - offset: 0x0 # or is it 0x13840? - size: 0x13840 diff --git a/yamls/us/audio_instrument_sets.yml b/yamls/us/audio_instrument_sets.yml deleted file mode 100644 index 43ee0a996..000000000 --- a/yamls/us/audio_instrument_sets.yml +++ /dev/null @@ -1,16 +0,0 @@ -:config: - vram: - addr: 0x800E8700 - offset: 0xBE90E0 - header: - code: - - '#include ' - - '#include ' - header: - - '#include ' - - '#include ' -instrument_sets: - symbol: gInstrumentSets - type: bob - offset: 0x0 - size: 0x80 diff --git a/yamls/us/audio_sequences.yml b/yamls/us/audio_sequences.yml deleted file mode 100644 index 8d107188c..000000000 --- a/yamls/us/audio_sequences.yml +++ /dev/null @@ -1,16 +0,0 @@ -:config: - vram: - addr: 0x800E8700 - offset: 0xBC5F60 - header: - code: - - '#include ' - - '#include ' - header: - - '#include ' - - '#include ' -audio_sequences: - symbol: gAudioSequences - type: bob - offset: 0x0 - size: 0x23180 diff --git a/yamls/us/audio_tables.yml b/yamls/us/audio_tables.yml deleted file mode 100644 index 5848018ed..000000000 --- a/yamls/us/audio_tables.yml +++ /dev/null @@ -1,16 +0,0 @@ -:config: - vram: - addr: 0x800E8700 - offset: 0x979AA0 - header: - code: - - '#include ' - - '#include ' - header: - - '#include ' - - '#include ' -audio_tables: - symbol: gAudioTables - type: bob - offset: 0x0 - size: 0x24C4C0 \ No newline at end of file diff --git a/yamls/us/course_metadata.yml b/yamls/us/course_metadata.yml deleted file mode 100644 index 67d780d64..000000000 --- a/yamls/us/course_metadata.yml +++ /dev/null @@ -1,4 +0,0 @@ -course_metadata: - type: mk64:metadata - input_directory: yamls/courses - out_directory: "assets/course_metadata" From f3e0a0628ef3e5fef3db70d6d5fed0ed13caf4fa Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:04:09 -0700 Subject: [PATCH 29/30] Update Torch --- torch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch b/torch index 6edf65bec..3bea96b12 160000 --- a/torch +++ b/torch @@ -1 +1 @@ -Subproject commit 6edf65beca37954d6d2243c92875a1dc84b6b3f6 +Subproject commit 3bea96b12b13c64f9f2dfc76e4475ea434b996ef From 8450174ea27b937ccbdd737fcddd8d07b6292678 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:11:57 -0700 Subject: [PATCH 30/30] Update libultraship --- libultraship | 2 +- src/port/Game.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libultraship b/libultraship index 736ad6825..80c2c5e9c 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 736ad68251e49c24a8f11bb3499d3467a7ab6705 +Subproject commit 80c2c5e9c6a5681428f759100c2428c5e41f333c diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 38595cb74..8a8c0b7cb 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -26,7 +26,6 @@ #include "engine/courses/DoubleDeck.h" #include "engine/courses/DKJungle.h" #include "engine/courses/BigDonut.h" -#include "engine/courses/Prison.h" #include "engine/courses/TestCourse.h" #include "engine/courses/PodiumCeremony.h" @@ -75,7 +74,6 @@ DoubleDeck* gDoubleDeck; DKJungle* gDkJungle; BigDonut* gBigDonut; PodiumCeremony* gPodiumCeremony; -PrisonCourse* gPrisonCourse; TestCourse* gTestCourse; Cup* gMushroomCup; @@ -107,7 +105,6 @@ void CustomEngineInit() { gDkJungle = new DKJungle(); gBigDonut = new BigDonut(); gPodiumCeremony = new PodiumCeremony(); - gPrisonCourse = new PrisonCourse(); gTestCourse = new TestCourse(); /* Add all courses to the global course list */ @@ -131,7 +128,6 @@ void CustomEngineInit() { gWorldInstance.AddCourse(gDoubleDeck); gWorldInstance.AddCourse(gDkJungle); gWorldInstance.AddCourse(gBigDonut); - gWorldInstance.AddCourse(gPrisonCourse); gWorldInstance.AddCourse(gTestCourse); gMushroomCup = new Cup("mk:mushroom_cup", "mushroom cup", std::vector{ gLuigiRaceway, gMooMooFarm, gKoopaTroopaBeach, gKalimariDesert });