From e993944089e1aa8d967568a84107aa4b9c727228 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sun, 5 Jan 2025 12:26:27 -0700 Subject: [PATCH] Finishwide screen. Impl IVector2D MinimapDimensions --- .../render_objects/func_8004F168.s | 8 +- src/code_80057C60.c | 4 +- src/code_80057C60.h | 6 +- src/code_80057C60_var.c | 6 +- src/code_8006E9C0.c | 12 +- src/code_8006E9C0.h | 1 - src/data/some_data.c | 2 +- src/data/some_data.h | 2 +- src/engine/CoreMath.h | 99 +++++++++++++++ src/engine/Engine.h | 7 +- src/engine/World.h | 75 +---------- src/engine/courses/BansheeBoardwalk.cpp | 3 +- src/engine/courses/BigDonut.cpp | 3 +- src/engine/courses/BlockFort.cpp | 4 +- src/engine/courses/BowsersCastle.cpp | 3 +- src/engine/courses/ChocoMountain.cpp | 3 +- src/engine/courses/Course.h | 4 +- src/engine/courses/DKJungle.cpp | 3 +- src/engine/courses/DoubleDeck.cpp | 3 +- src/engine/courses/FrappeSnowland.cpp | 4 +- src/engine/courses/KalimariDesert.cpp | 3 +- src/engine/courses/KalimariDesert.h | 1 + src/engine/courses/KoopaTroopaBeach.cpp | 4 +- src/engine/courses/KoopaTroopaBeach.h | 1 + src/engine/courses/LuigiRaceway.cpp | 3 +- src/engine/courses/MarioRaceway.cpp | 3 +- src/engine/courses/MooMooFarm.cpp | 3 +- src/engine/courses/PodiumCeremony.cpp | 3 +- src/engine/courses/PodiumCeremony.h | 1 + src/engine/courses/RainbowRoad.cpp | 3 +- src/engine/courses/RoyalRaceway.cpp | 3 +- src/engine/courses/SherbetLand.cpp | 3 +- src/engine/courses/Skyscraper.cpp | 3 +- src/engine/courses/TestCourse.cpp | 4 +- src/engine/courses/ToadsTurnpike.cpp | 3 +- src/engine/courses/WarioStadium.cpp | 3 +- src/engine/courses/YoshiValley.cpp | 4 +- src/engine/objects/Crab.cpp | 2 + src/engine/objects/Crab.h | 1 + src/math_util_2.c | 16 --- src/math_util_2.h | 1 - src/menu_items.c | 3 +- src/render_objects.c | 116 +++++------------- src/render_objects.h | 6 +- src/save.c | 2 +- src/stubs.c | 2 +- 46 files changed, 196 insertions(+), 253 deletions(-) create mode 100644 src/engine/CoreMath.h diff --git a/asm/non_matchings/render_objects/func_8004F168.s b/asm/non_matchings/render_objects/func_8004F168.s index 9e763f137..8f51fc84e 100644 --- a/asm/non_matchings/render_objects/func_8004F168.s +++ b/asm/non_matchings/render_objects/func_8004F168.s @@ -26,8 +26,8 @@ glabel func_8004F168 /* 04FDC8 8004F1C8 46002082 */ mul.s $f2, $f4, $f0 /* 04FDCC 8004F1CC 01284821 */ addu $t1, $t1, $t0 /* 04FDD0 8004F1D0 3C0A8019 */ lui $t2, %hi(D_8018D2F0) # $t2, 0x8019 -/* 04FDD4 8004F1D4 3C0C8019 */ lui $t4, %hi(D_8018D2B0) # $t4, 0x8019 -/* 04FDD8 8004F1D8 858CD2B0 */ lh $t4, %lo(D_8018D2B0)($t4) +/* 04FDD4 8004F1D4 3C0C8019 */ lui $t4, %hi(gMinimapWidth) # $t4, 0x8019 +/* 04FDD8 8004F1D8 858CD2B0 */ lh $t4, %lo(gMinimapWidth)($t4) /* 04FDDC 8004F1DC 854AD2F0 */ lh $t2, %lo(D_8018D2F0)($t2) /* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(D_8018D2C0)($t1) # -0x2d40($t1) /* 04FDE4 8004F1E4 4600120D */ trunc.w.s $f8, $f2 @@ -50,9 +50,9 @@ glabel func_8004F168 /* 04FE24 8004F224 00084C00 */ sll $t1, $t0, 0x10 /* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(D_8018D2D8)($t5) # -0x2d28($t5) /* 04FE2C 8004F22C 85CED2F8 */ lh $t6, %lo(D_8018D2F8)($t6) -/* 04FE30 8004F230 3C198019 */ lui $t9, %hi(D_8018D2B8) # $t9, 0x8019 +/* 04FE30 8004F230 3C198019 */ lui $t9, %hi(gMinimapHeight) # $t9, 0x8019 /* 04FE34 8004F234 4600628D */ trunc.w.s $f10, $f12 -/* 04FE38 8004F238 8739D2B8 */ lh $t9, %lo(D_8018D2B8)($t9) +/* 04FE38 8004F238 8739D2B8 */ lh $t9, %lo(gMinimapHeight)($t9) /* 04FE3C 8004F23C 00095403 */ sra $t2, $t1, 0x10 /* 04FE40 8004F240 030A2021 */ addu $a0, $t8, $t2 /* 04FE44 8004F244 3C188019 */ lui $t8, %hi(D_8018D2E8) # $t8, 0x8019 diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 1db6761de..a17b52bf5 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -1037,14 +1037,14 @@ void func_800591B4(void) { if (D_80165800[0] != 0) { func_8004EE54(0); if (gModeSelection != BATTLE) { - func_8004F020(0); + set_minimap_finishline_position(0); } func_8004F3E4(0); } if ((gScreenModeSelection == SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL) && (D_80165800[1] != 0)) { func_8004EE54(1); if (gModeSelection != BATTLE) { - func_8004F020(1); + set_minimap_finishline_position(1); } func_8004F3E4(1); } diff --git a/src/code_80057C60.h b/src/code_80057C60.h index 4b6ed7613..483d7cbb2 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -546,17 +546,15 @@ extern u8* D_8018D248[]; extern f32 D_8018D2A0; extern s32 D_8018D2A4; extern s32 D_8018D2AC; -extern s16 D_8018D2B0; +extern s16 gMinimapWidth; extern s32 D_8018D2B4; -extern s16 D_8018D2B8; +extern s16 gMinimapHeight; extern s32 D_8018D2BC; extern s16 D_8018D2C0[]; extern s32 D_8018D2C8[]; extern s16 D_8018D2D8[]; extern s16 D_8018D2E0; extern s16 D_8018D2E8; -extern s16 D_8018D2F0; -extern s16 D_8018D2F8; extern u16 D_8018D300; extern u16 D_8018D308; extern u16 D_8018D310; diff --git a/src/code_80057C60_var.c b/src/code_80057C60_var.c index d0e929ee6..43340892c 100644 --- a/src/code_80057C60_var.c +++ b/src/code_80057C60_var.c @@ -111,9 +111,9 @@ f32 D_8018D2A0; s32 D_8018D2A4; UNUSED s32 D_8018D2A8; s32 D_8018D2AC; -s16 D_8018D2B0; +s16 gMinimapWidth; s32 D_8018D2B4; -s16 D_8018D2B8; +s16 gMinimapHeight; s32 D_8018D2BC; s16 D_8018D2C0[4]; s32 D_8018D2C8[4]; @@ -122,9 +122,7 @@ s16 D_8018D2E0; UNUSED s32 D_8018D2E4; s16 D_8018D2E8; UNUSED s32 D_8018D2EC; -s16 D_8018D2F0; UNUSED s32 D_8018D2F4; -s16 D_8018D2F8; UNUSED s32 D_8018D2FC; u16 D_8018D300; UNUSED s32 D_8018D304; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 797b6085a..3048201c6 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -165,10 +165,10 @@ void init_item_window(s32 objectIndex) { void func_8006EEE8(s32 courseId) { D_8018D240 = (uintptr_t) CourseManager_GetProps()->MinimapTexture; - // This is incredibly dumb. D_800E5548 ought to be something more like - // `u16 D_800E5548[][2]` but that doesn't match for some insane reason - D_8018D2B0 = CourseManager_GetProps()->D_800E5548[0]; // D_800E5548[courseId * 2]; - D_8018D2B8 = CourseManager_GetProps()->D_800E5548[1]; // D_800E5548[courseId * 2 + 1]; + // This is incredibly dumb. MinimapDimensions ought to be something more like + // `u16 MinimapDimensions[][2]` but that doesn't match for some insane reason + gMinimapWidth = CourseManager_GetProps()->MinimapDimensions.X; // MinimapDimensions[courseId * 2]; + gMinimapHeight = CourseManager_GetProps()->MinimapDimensions.Z; // MinimapDimensions[courseId * 2 + 1]; } void func_8006EF60(void) { @@ -345,7 +345,7 @@ void func_8006F008(void) { // D_8018D2E8 = 31; } if (gIsMirrorMode != 0) { - D_8018D2E0 = D_8018D2B0 - D_8018D2E0; + D_8018D2E0 = gMinimapWidth - D_8018D2E0; } if (gPlayerCount == 4) { D_8018D2C0[0] = 160; @@ -572,8 +572,6 @@ void func_8006FA94(void) { gHUDDisable = D_8018D214; D_801657AE = gHUDDisable; D_8018D20C = 0; - D_8018D2F8 = 0; - D_8018D2F0 = D_8018D2F8; D_8018D320 = 3; D_8018D2AC = 0; D_8018D2BC = 0; diff --git a/src/code_8006E9C0.h b/src/code_8006E9C0.h index ad8c2f977..e5e9bc8d3 100644 --- a/src/code_8006E9C0.h +++ b/src/code_8006E9C0.h @@ -32,7 +32,6 @@ void init_hud_three_four_player(void); void init_hud_two_player_horizontal(void); extern s16 D_800E5520[]; -extern s16 D_800E5548[]; extern u8* gCourseOutlineTextures[0x14]; // 800e54d0 #endif diff --git a/src/data/some_data.c b/src/data/some_data.c index 1a2acd086..cb8d1f3d3 100644 --- a/src/data/some_data.c +++ b/src/data/some_data.c @@ -206,7 +206,7 @@ s16 D_800E5520[] = { 0x1000, 0x0c00, 0x0800, 0x0c00, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, }; -s16 D_800E5548[] = { +s16 minimapDimensions[] = { 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, 0x0060, 0x0040, 0x0040, 0x0080, 0x0040, 0x0040, 0x0060, 0x0040, 0x0040, 0x0040, 0x0060, 0x0040, 0x0040, 0x0040, 0x0040, 0x0040, diff --git a/src/data/some_data.h b/src/data/some_data.h index 6ee5272b0..c0651aa2b 100644 --- a/src/data/some_data.h +++ b/src/data/some_data.h @@ -25,7 +25,7 @@ extern Vtx gBalloonVertexPlane1[]; extern Vtx gBalloonVertexPlane2[]; extern u8* gCourseOutlineTextures[]; extern s16 D_800E5520[]; -extern s16 D_800E5548[]; +extern s16 minimapDimensions[]; extern u16 D_800E55A0[]; extern u16 D_800E55B0[]; extern u8 D_800E55D0[][3]; diff --git a/src/engine/CoreMath.h b/src/engine/CoreMath.h new file mode 100644 index 000000000..551d8083b --- /dev/null +++ b/src/engine/CoreMath.h @@ -0,0 +1,99 @@ +#pragma once + +#include + +/** + * @file CoreMath.h + * + * Basic vector structs for manipulating 2D and 3D coordinates + * + */ + + +struct FVector { + float x, y, z; + + FVector& operator=(const FVector& other) { + x = other.x; + y = other.y; + z = other.z; + return *this; + } +}; + +/** + * For providing X and Z when you do not need Y + * Some actors set themselves on the surface automatically + * which means it does not use a Y coordinate + * The train follows a set Y value. The hedgehog's patrolPoint only uses X and Z. + */ +struct FVector2D { + float x, z; + + FVector2D& operator=(const FVector2D& other) { + x = other.x; + z = other.z; + return *this; + } +}; + +// Sets integer X Z coordinates +struct IVector2D { + int32_t X, Z; + + IVector2D() : X(0), Z(0) {} // Default constructor + + IVector2D(int32_t x, int32_t z) : X(x), Z(z) {} // Constructor to initialize with values + + + IVector2D& operator=(const IVector2D& other) { + X = other.X; + Z = other.Z; + return *this; + } +}; + +struct FRotation { + float pitch, yaw, roll; + + FRotation& operator=(const FRotation& other) { + pitch = other.pitch; + yaw = other.yaw; + roll = other.roll; + return *this; + } +}; + +/** + * For selecting a section of a course path + * Usage: IPathSpan(point1, point2) --> IPathSpan(40, 65) + */ +struct IPathSpan { + int Start, End; + + // Default Constructor + IPathSpan() : Start(0), End(0) {} + + // Parameterized Constructor + IPathSpan(int InStart, int InEnd) + : Start(InStart), End(InEnd) {} + + // Copy Assignment Operator + IPathSpan& operator=(const IPathSpan& Other) { + if (this != &Other) { // Avoid self-assignment + Start = Other.Start; + End = Other.End; + } + return *this; + } + + // Equality Operator + bool operator==(const IPathSpan& Other) const { + return Start == Other.Start && End == Other.End; + } + + // Inequality Operator + bool operator!=(const IPathSpan& Other) const { + return !(*this == Other); + } +}; diff --git a/src/engine/Engine.h b/src/engine/Engine.h index 45fa3a61d..98e9a99fc 100644 --- a/src/engine/Engine.h +++ b/src/engine/Engine.h @@ -20,6 +20,11 @@ typedef struct { RGB8 FloorTopLeft; } SkyboxColours; +typedef struct { + int32_t X; + int32_t Z; +} IVector2D_C; + typedef struct { const char* Id; const char* Name; @@ -28,7 +33,7 @@ typedef struct { const char* AIBehaviour; const char* MinimapTexture; s32 LakituTowType; - s16 D_800E5548[2]; + IVector2D_C MinimapDimensions; float AIMaximumSeparation; float AIMinimumSeparation; float NearPersp; diff --git a/src/engine/World.h b/src/engine/World.h index 4fdf55bc8..a8e9932f5 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -1,6 +1,7 @@ #pragma once #include +#include "CoreMath.h" #include "objects/Object.h" #include "Cup.h" #include "vehicles/Vehicle.h" @@ -24,80 +25,6 @@ extern "C" { #include "engine/Engine.h" }; -struct FVector { - float x, y, z; - - FVector& operator=(const FVector& other) { - x = other.x; - y = other.y; - z = other.z; - return *this; - } -}; - -/** - * For providing X and Z when you do not need Y - * Some actors set themselves on the surface automatically - * which means it does not use a Y coordinate - * The train follows a set Y value. The hedgehog's patrolPoint only uses X and Z. - */ -struct FVector2D { - float x, z; - - FVector2D& operator=(const FVector2D& other) { - x = other.x; - z = other.z; - return *this; - } -}; - -struct FRotation { - float pitch, yaw, roll; - - FRotation& operator=(const FRotation& other) { - pitch = other.pitch; - yaw = other.yaw; - roll = other.roll; - return *this; - } -}; - -/** - * For selecting a section of a course path - * Usage: IPathSpan(point1, point2) --> IPathSpan(40, 65) - */ -struct IPathSpan { - int Start, End; - - // Default Constructor - IPathSpan() : Start(0), End(0) {} - - // Parameterized Constructor - IPathSpan(int InStart, int InEnd) - : Start(InStart), End(InEnd) {} - - // Copy Assignment Operator - IPathSpan& operator=(const IPathSpan& Other) { - if (this != &Other) { // Avoid self-assignment - Start = Other.Start; - End = Other.End; - } - return *this; - } - - // Equality Operator - bool operator==(const IPathSpan& Other) const { - return Start == Other.Start && End == Other.End; - } - - // Inequality Operator - bool operator!=(const IPathSpan& Other) const { - return !(*this == Other); - } -}; - - - class OObject; class Cup; // <-- Forward declaration class Course; diff --git a/src/engine/courses/BansheeBoardwalk.cpp b/src/engine/courses/BansheeBoardwalk.cpp index 7f1847900..944d2a25c 100644 --- a/src/engine/courses/BansheeBoardwalk.cpp +++ b/src/engine/courses/BansheeBoardwalk.cpp @@ -68,8 +68,7 @@ BansheeBoardwalk::BansheeBoardwalk() { this->gfxSize = 3689; Props.textures = banshee_boardwalk_textures; Props.MinimapTexture = gTextureCourseOutlineBansheeBoardwalk; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:banshee_boardwalk"; Props.Name = "banshee boardwalk"; diff --git a/src/engine/courses/BigDonut.cpp b/src/engine/courses/BigDonut.cpp index c3abe1add..c0d4b1f7f 100644 --- a/src/engine/courses/BigDonut.cpp +++ b/src/engine/courses/BigDonut.cpp @@ -44,8 +44,7 @@ BigDonut::BigDonut() { this->gfxSize = 528; Props.textures = big_donut_textures; Props.MinimapTexture = gTextureCourseOutlineBigDonut; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "big donut"; Props.DebugName = "doughnut"; diff --git a/src/engine/courses/BlockFort.cpp b/src/engine/courses/BlockFort.cpp index 948eaf5e0..61eb3c0b1 100644 --- a/src/engine/courses/BlockFort.cpp +++ b/src/engine/courses/BlockFort.cpp @@ -46,8 +46,8 @@ BlockFort::BlockFort() { this->gfxSize = 699; Props.textures = block_fort_textures; Props.MinimapTexture = gTextureCourseOutlineBlockFort; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Name = "block fort"; Props.DebugName = "block"; diff --git a/src/engine/courses/BowsersCastle.cpp b/src/engine/courses/BowsersCastle.cpp index 49ae93385..5174c5ea1 100644 --- a/src/engine/courses/BowsersCastle.cpp +++ b/src/engine/courses/BowsersCastle.cpp @@ -72,8 +72,7 @@ BowsersCastle::BowsersCastle() { this->gfxSize = 4900; Props.textures = bowsers_castle_textures; Props.MinimapTexture = gTextureCourseOutlineBowsersCastle; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:bowsers_castle"; Props.Name = "bowser's castle"; diff --git a/src/engine/courses/ChocoMountain.cpp b/src/engine/courses/ChocoMountain.cpp index 292d12076..04065dff5 100644 --- a/src/engine/courses/ChocoMountain.cpp +++ b/src/engine/courses/ChocoMountain.cpp @@ -64,8 +64,7 @@ ChocoMountain::ChocoMountain() { this->gfxSize = 2910; Props.textures = choco_mountain_textures; Props.MinimapTexture = gTextureCourseOutlineChocoMountain; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:choco_mountain"; Props.Name = "choco mountain"; diff --git a/src/engine/courses/Course.h b/src/engine/courses/Course.h index 381ba0340..f7bca6809 100644 --- a/src/engine/courses/Course.h +++ b/src/engine/courses/Course.h @@ -3,9 +3,9 @@ #include - // C-compatible function declaration #ifdef __cplusplus +#include "CoreMath.h" #include "engine/objects/Lakitu.h" extern "C" { #endif @@ -57,7 +57,7 @@ public: const char* AIBehaviour; const char* MinimapTexture; s32 LakituTowType; - s16 D_800E5548[2]; + IVector2D MinimapDimensions; float AIMaximumSeparation; float AIMinimumSeparation; float NearPersp; diff --git a/src/engine/courses/DKJungle.cpp b/src/engine/courses/DKJungle.cpp index 9daf7ad3f..e3e7bf3f5 100644 --- a/src/engine/courses/DKJungle.cpp +++ b/src/engine/courses/DKJungle.cpp @@ -72,8 +72,7 @@ DKJungle::DKJungle() { this->gfxSize = 4997; Props.textures = dks_jungle_parkway_textures; Props.MinimapTexture = gTextureCourseOutlineDksJungleParkway; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "d.k.'s jungle parkway"; Props.DebugName = "jungle"; diff --git a/src/engine/courses/DoubleDeck.cpp b/src/engine/courses/DoubleDeck.cpp index d5fe16763..1d5e16c60 100644 --- a/src/engine/courses/DoubleDeck.cpp +++ b/src/engine/courses/DoubleDeck.cpp @@ -44,8 +44,7 @@ DoubleDeck::DoubleDeck() { this->gfxSize = 699; Props.textures = double_deck_textures; Props.MinimapTexture = gTextureCourseOutlineDoubleDeck; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "double deck"; Props.DebugName = "deck"; diff --git a/src/engine/courses/FrappeSnowland.cpp b/src/engine/courses/FrappeSnowland.cpp index 3481e1e2b..5c0b4df43 100644 --- a/src/engine/courses/FrappeSnowland.cpp +++ b/src/engine/courses/FrappeSnowland.cpp @@ -5,6 +5,7 @@ #include "FrappeSnowland.h" #include "World.h" +#include "CoreMath.h" #include "engine/actors/AFinishline.h" #include "engine/objects/BombKart.h" #include "engine/objects/Snowman.h" @@ -51,8 +52,7 @@ FrappeSnowland::FrappeSnowland() { this->gfxSize = 4140; Props.textures = frappe_snowland_textures; Props.MinimapTexture = gTextureCourseOutlineFrappeSnowland; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "frappe snowland"; Props.DebugName = "snow"; diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index 8f00441ec..ffd19a86e 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -58,8 +58,7 @@ KalimariDesert::KalimariDesert() { this->gfxSize = 5328; Props.textures = kalimari_desert_textures; Props.MinimapTexture = gTextureCourseOutlineKalimariDesert; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 96; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "kalimari desert"; Props.DebugName = "desert"; diff --git a/src/engine/courses/KalimariDesert.h b/src/engine/courses/KalimariDesert.h index c25e9ba22..c4fed1d8f 100644 --- a/src/engine/courses/KalimariDesert.h +++ b/src/engine/courses/KalimariDesert.h @@ -1,6 +1,7 @@ #pragma once #include +#include "CoreMath.h" #include "Course.h" #include "engine/vehicles/Train.h" diff --git a/src/engine/courses/KoopaTroopaBeach.cpp b/src/engine/courses/KoopaTroopaBeach.cpp index 499a62bf7..6beca16b6 100644 --- a/src/engine/courses/KoopaTroopaBeach.cpp +++ b/src/engine/courses/KoopaTroopaBeach.cpp @@ -1,5 +1,6 @@ #include #include +#include "../CoreMath.h" #include #include @@ -61,8 +62,7 @@ KoopaTroopaBeach::KoopaTroopaBeach() { this->gfxSize = 5720; Props.textures = koopa_troopa_beach_textures; Props.MinimapTexture = gTextureCourseOutlineKoopaTroopaBeach; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:koopa_beach"; Props.Name = "koopa troopa beach"; diff --git a/src/engine/courses/KoopaTroopaBeach.h b/src/engine/courses/KoopaTroopaBeach.h index 8237b7628..c10b5cede 100644 --- a/src/engine/courses/KoopaTroopaBeach.h +++ b/src/engine/courses/KoopaTroopaBeach.h @@ -1,6 +1,7 @@ #pragma once #include +#include "../CoreMath.h" #include "Course.h" #include "World.h" diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index 6020b72d1..29aeb8e67 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -88,8 +88,7 @@ LuigiRaceway::LuigiRaceway() { this->gfxSize = 6377; Props.textures = luigi_raceway_textures; Props.MinimapTexture = gTextureCourseOutlineLuigiRaceway; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 96; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:luigi_raceway"; Props.Name = "luigi raceway"; diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index 05a4cc438..6690a5d89 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -73,8 +73,7 @@ MarioRaceway::MarioRaceway() { this->gfxSize = 3367; Props.textures = mario_raceway_textures; Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:mario_raceway"; Props.Name = "Mario Raceway"; diff --git a/src/engine/courses/MooMooFarm.cpp b/src/engine/courses/MooMooFarm.cpp index f46f263ee..109857353 100644 --- a/src/engine/courses/MooMooFarm.cpp +++ b/src/engine/courses/MooMooFarm.cpp @@ -74,8 +74,7 @@ MooMooFarm::MooMooFarm() { this->gfxSize = 3304; Props.textures = moo_moo_farm_textures; Props.MinimapTexture = gTextureCourseOutlineMooMooFarm; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "moo moo farm"; Props.DebugName = "farm"; diff --git a/src/engine/courses/PodiumCeremony.cpp b/src/engine/courses/PodiumCeremony.cpp index 5c4bbe7fb..a6d170960 100644 --- a/src/engine/courses/PodiumCeremony.cpp +++ b/src/engine/courses/PodiumCeremony.cpp @@ -89,8 +89,7 @@ PodiumCeremony::PodiumCeremony() { this->gfx = d_course_royal_raceway_packed_dls; this->gfxSize = 5670; Props.textures = podium_ceremony_textures; - Props.D_800E5548[0] = 0; - Props.D_800E5548[1] = 0; + Props.MinimapDimensions = IVector2D(0, 0); Props.Name = "royal raceway"; Props.DebugName = "p circuit"; diff --git a/src/engine/courses/PodiumCeremony.h b/src/engine/courses/PodiumCeremony.h index 7f9de6b1d..bb17e8f8d 100644 --- a/src/engine/courses/PodiumCeremony.h +++ b/src/engine/courses/PodiumCeremony.h @@ -1,6 +1,7 @@ #pragma once #include +#include "CoreMath.h" #include "Course.h" extern "C" { diff --git a/src/engine/courses/RainbowRoad.cpp b/src/engine/courses/RainbowRoad.cpp index 4cc7e2a51..4c0c32bb3 100644 --- a/src/engine/courses/RainbowRoad.cpp +++ b/src/engine/courses/RainbowRoad.cpp @@ -48,8 +48,7 @@ RainbowRoad::RainbowRoad() { this->gfxSize = 5670; Props.textures = rainbow_road_textures; Props.MinimapTexture = gTextureCourseOutlineRainbowRoad; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 96; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "rainbow road"; Props.DebugName = "rainbow"; diff --git a/src/engine/courses/RoyalRaceway.cpp b/src/engine/courses/RoyalRaceway.cpp index 733d42a92..2ea0022ca 100644 --- a/src/engine/courses/RoyalRaceway.cpp +++ b/src/engine/courses/RoyalRaceway.cpp @@ -86,8 +86,7 @@ RoyalRaceway::RoyalRaceway() { this->gfxSize = 5670; Props.textures = royal_raceway_textures; Props.MinimapTexture = gTextureCourseOutlineRoyalRaceway; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "royal raceway"; Props.DebugName = "p circuit"; diff --git a/src/engine/courses/SherbetLand.cpp b/src/engine/courses/SherbetLand.cpp index 0153bf0a8..bfcacca4a 100644 --- a/src/engine/courses/SherbetLand.cpp +++ b/src/engine/courses/SherbetLand.cpp @@ -49,8 +49,7 @@ SherbetLand::SherbetLand() { this->gfxSize = 1803; Props.textures = sherbet_land_textures; Props.MinimapTexture = gTextureCourseOutlineSherbetLand; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "sherbet land"; Props.DebugName = "sherbet"; diff --git a/src/engine/courses/Skyscraper.cpp b/src/engine/courses/Skyscraper.cpp index da3cca777..f7c092bee 100644 --- a/src/engine/courses/Skyscraper.cpp +++ b/src/engine/courses/Skyscraper.cpp @@ -65,8 +65,7 @@ Skyscraper::Skyscraper() { this->gfxSize = 548; Props.textures = skyscraper_textures; Props.MinimapTexture = gTextureCourseOutlineSkyscraper; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "skyscraper"; Props.DebugName = "skyscraper"; diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index 682db53c5..2a094c6a1 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -1,5 +1,6 @@ #include #include +#include "CoreMath.h" #include #include @@ -61,8 +62,7 @@ TestCourse::TestCourse() { this->gfxSize = 100; this->textures = NULL; Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Id = "mk:test_course"; Props.Name = "Test Course"; diff --git a/src/engine/courses/ToadsTurnpike.cpp b/src/engine/courses/ToadsTurnpike.cpp index 47ed10111..88371411f 100644 --- a/src/engine/courses/ToadsTurnpike.cpp +++ b/src/engine/courses/ToadsTurnpike.cpp @@ -70,8 +70,7 @@ ToadsTurnpike::ToadsTurnpike() { this->gfxSize = 3427; Props.textures = toads_turnpike_textures; Props.MinimapTexture = gTextureCourseOutlineToadsTurnpike; - Props.D_800E5548[0] = 128; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "toad's turnpike"; Props.DebugName = "highway"; diff --git a/src/engine/courses/WarioStadium.cpp b/src/engine/courses/WarioStadium.cpp index a71b670f1..384f83882 100644 --- a/src/engine/courses/WarioStadium.cpp +++ b/src/engine/courses/WarioStadium.cpp @@ -66,8 +66,7 @@ WarioStadium::WarioStadium() { this->gfxSize = 5272; Props.textures = wario_stadium_textures; Props.MinimapTexture = gTextureCourseOutlineWarioStadium; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "wario stadium"; Props.DebugName = "stadium"; diff --git a/src/engine/courses/YoshiValley.cpp b/src/engine/courses/YoshiValley.cpp index 25c11daf8..f7f3d1871 100644 --- a/src/engine/courses/YoshiValley.cpp +++ b/src/engine/courses/YoshiValley.cpp @@ -1,5 +1,6 @@ #include #include +#include "CoreMath.h" #include #include @@ -60,8 +61,7 @@ YoshiValley::YoshiValley() { Props.textures = yoshi_valley_textures; Props.MinimapTexture = gTextureCourseOutlineYoshiValley; - Props.D_800E5548[0] = 64; - Props.D_800E5548[1] = 64; + Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); Props.Name = "yoshi valley"; Props.DebugName = "maze"; diff --git a/src/engine/objects/Crab.cpp b/src/engine/objects/Crab.cpp index b05bc85e3..3a71e075d 100644 --- a/src/engine/objects/Crab.cpp +++ b/src/engine/objects/Crab.cpp @@ -2,6 +2,8 @@ #include #include "Crab.h" #include +#include "CoreMath.h" + #include "port/Game.h" diff --git a/src/engine/objects/Crab.h b/src/engine/objects/Crab.h index 281b080ca..4cadd3b87 100644 --- a/src/engine/objects/Crab.h +++ b/src/engine/objects/Crab.h @@ -3,6 +3,7 @@ #include #include #include "engine/objects/Object.h" +#include "CoreMath.h" #include "World.h" extern "C" { diff --git a/src/math_util_2.c b/src/math_util_2.c index d378d9e42..59f3a1170 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -730,22 +730,6 @@ void func_80042330_default(s32 x, s32 y, u16 angle, f32 scale) { AddHudMatrix(matrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } -// Centers in an area of the screen for 3P mode -void func_80042330_3P(s32 x, s32 y, u16 angle, f32 scale) { - Mat4 matrix; - - s32 offset = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2); - // + 5 is just an alignment guess. - x += offset + 5; - - 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)); diff --git a/src/math_util_2.h b/src/math_util_2.h index c51b25066..842e417bd 100644 --- a/src/math_util_2.h +++ b/src/math_util_2.h @@ -71,7 +71,6 @@ void func_80041D34(void); void set_matrix_hud_screen(void); void func_80042330(s32, s32, u16, f32); void func_80042330_default(s32 x, s32 y, u16 angle, f32 scale); -void func_80042330_3P(s32 x, s32 y, u16 angle, f32 scale); 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); diff --git a/src/menu_items.c b/src/menu_items.c index 45ed20ea2..018fd7031 100644 --- a/src/menu_items.c +++ b/src/menu_items.c @@ -3480,7 +3480,7 @@ void load_texture(const char* texture) { } /** - * If you need to reset a texture cache after a modification, + * If you need to reset a texture after a modification, * this will reload the texture. */ void load_texture_reset_cache(const char* texture) { @@ -3500,6 +3500,7 @@ void load_texture_reset_cache(const char* texture) { sMenuTextureEntries += 1; } +// Provide an index for sMenuTextureMap void replace_texture(s32 index, const char* newTexture) { sMenuTextureList[sMenuTextureMap[index].offset] = newTexture; sMenuTextureMap[index].textureData = newTexture; diff --git a/src/render_objects.c b/src/render_objects.c index 6aed93029..a44aeb9ec 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -518,11 +518,7 @@ void func_800463B0(s32 arg0, s32 arg1, u16 arg2, f32 arg3, u8* texture, Vtx* arg func_80042330(arg0, arg1, arg2, arg3); break; case SCREEN_MODE_3P_4P_SPLITSCREEN: - if (gPlayerCount == 3) { - func_80042330_3P(arg0, arg1, arg2, arg3); - } else { - func_80042330_default(arg0, arg1, arg2, arg3); - } + func_80042330_default(arg0, arg1, arg2, arg3); break; } @@ -539,11 +535,7 @@ void func_80046424(s32 arg0, s32 arg1, u16 arg2, f32 arg3, u8* texture, Vtx* arg func_80042330(arg0, arg1, arg2, arg3); break; case SCREEN_MODE_3P_4P_SPLITSCREEN: - if (gPlayerCount == 3) { - func_80042330_3P(arg0, arg1, arg2, arg3); - } else { - func_80042330_default(arg0, arg1, arg2, arg3); - } + func_80042330_default(arg0, arg1, arg2, arg3); break; } @@ -1683,27 +1675,6 @@ void render_texture_rectangle_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4 // 1 << 10); } -// Renders the finishline in 3P mode. -void render_texture_rectangle_3P(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 << 2; - - s32 xh2 = (((x + width))); - s32 yh2 = ((y + height) << 2); - - // Center item in area of screen - s32 center = (s32)((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); - s32 coordX = (s32)(center - (width / 2)) << 2; - s32 coordX2 = (s32)(center + (width / 2)) << 2; - printf("center %d, width %d, coordX %d\n", center, width, coordX >> 2); - gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, - coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - 1 << 10); -} - void render_texture_rectangle_wrap(s32 x, s32 y, s32 width, s32 height, s32 mode) { // (0, 0) means texture coordinates will be rendered from the top left corner render_texture_rectangle(x, y, width, height, 0, 0, mode); @@ -1759,30 +1730,6 @@ void func_8004B97C_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } } -void func_8004B97C_3P(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; - } - render_texture_rectangle_3P(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; @@ -1996,15 +1943,6 @@ void draw_hud_2d_texture_wide(s32 x, s32 y, u32 width, u32 height, u8* texture) gSPDisplayList(gDisplayListHead++, D_0D007EB8); } -void draw_hud_2d_texture_3P(s32 x, s32 y, u32 width, u32 height, u8* texture) { - gSPDisplayList(gDisplayListHead++, D_0D008108); - gSPDisplayList(gDisplayListHead++, D_0D007EF8); - gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); - load_texture_block_rgba16_mirror(texture, width, height); - func_8004B97C_3P(x - (width >> 1), y - (height >> 1), width, height, 0); - gSPDisplayList(gDisplayListHead++, D_0D007EB8); -} - void func_8004C450(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8* texture) { gSPDisplayList(gDisplayListHead++, D_0D007F38); @@ -2109,11 +2047,7 @@ void draw_hud_2d_texture_8x8(s32 x, s32 y, u8* texture) { draw_hud_2d_texture_wide(x, y, 8, 8, texture); break; case SCREEN_MODE_3P_4P_SPLITSCREEN: - if (gPlayerCount == 3) { - draw_hud_2d_texture_3P(x, y, 8, 8, texture); - } else { - draw_hud_2d_texture(x, y, 8, 8, texture); - } + draw_hud_2d_texture(x, y, 8, 8, texture); break; } } @@ -2705,13 +2639,13 @@ void func_8004ED40(s32 arg0) { void func_8004EE54(s32 arg0) { if (gIsMirrorMode != 0) { - func_8004D4E8(D_8018D2C0[arg0] + D_8018D2F0, D_8018D2D8[arg0] + D_8018D2F8, (u8*) D_8018D240, (s32) D_8018D300, - (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) D_8018D2B0, (s32) D_8018D2B8, - (s32) D_8018D2B0, (s32) D_8018D2B8); + func_8004D4E8(D_8018D2C0[arg0], D_8018D2D8[arg0], (u8*) D_8018D240, (s32) D_8018D300, + (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) gMinimapWidth, (s32) gMinimapHeight, + (s32) gMinimapWidth, (s32) gMinimapHeight); } else { - func_8004D37C(D_8018D2C0[arg0] + D_8018D2F0, D_8018D2D8[arg0] + D_8018D2F8, (u8*) D_8018D240, (s32) D_8018D300, - (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) D_8018D2B0, (s32) D_8018D2B8, - (s32) D_8018D2B0, (s32) D_8018D2B8); + func_8004D37C(D_8018D2C0[arg0], D_8018D2D8[arg0], (u8*) D_8018D240, (s32) D_8018D300, + (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) gMinimapWidth, (s32) gMinimapHeight, + (s32) gMinimapWidth, (s32) gMinimapHeight); } } @@ -2719,20 +2653,28 @@ void func_8004EF9C(s32 arg0) { s16 temp_t0; s16 temp_v0; - temp_v0 = CourseManager_GetProps()->D_800E5548[0]; // D_800E5548[arg0 * 2]; - temp_t0 = CourseManager_GetProps()->D_800E5548[1]; // D_800E5548[arg0 * 2 + 1]; + temp_v0 = CourseManager_GetProps()->MinimapDimensions.X; + temp_t0 = CourseManager_GetProps()->MinimapDimensions.Z; func_8004D37C(0x00000104, 0x0000003C, CourseManager_GetProps()->MinimapTexture, 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF, temp_v0, temp_t0, temp_v0, temp_t0); } -void func_8004F020(s32 arg0) { +void set_minimap_finishline_position(s32 arg0) { f32 var_f0; f32 var_f2; + s32 center = 0; - //! @todo: Hardcode these x and y values. Because why not? +//! @todo: Hardcode these x and y values. Because why not? - var_f2 = ((D_8018D2C0[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + D_8018D2E0; - var_f0 = ((D_8018D2D8[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + D_8018D2E8; + if (gPlayerCount == 3) { + center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); + } else { + center = D_8018D2C0[arg0]; + } + +//minimap center pos - minimap left edge + offset + var_f2 = (center - (gMinimapWidth / 2)) + D_8018D2E0; + var_f0 = (D_8018D2D8[arg0] - (gMinimapHeight / 2)) + D_8018D2E8; if (GetCourse() == GetMarioRaceway()) { var_f0 = var_f0 - 2.0; } else if (GetCourse() == GetChocoMountain()) { @@ -2757,13 +2699,21 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) { f32 thing1; s16 temp_a0; s16 temp_a1; + s32 center = 0; Player* player = &gPlayerOne[playerId]; if (player->type & (1 << 15)) { thing0 = player->pos[0] * D_8018D2A0; thing1 = player->pos[2] * D_8018D2A0; - temp_a0 = ((D_8018D2C0[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + D_8018D2E0 + (s16) (thing0); - temp_a1 = ((D_8018D2D8[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + D_8018D2E8 + (s16) (thing1); + + if (gPlayerCount == 3) { + center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); + } else { + center = D_8018D2C0[arg0]; + } + + temp_a0 = (center - (gMinimapWidth / 2)) + D_8018D2E0 + (s16) (thing0); + temp_a1 = (D_8018D2D8[arg0] - (gMinimapHeight / 2)) + D_8018D2E8 + (s16) (thing1); if (characterId != 8) { if ((gGPCurrentRaceRankByPlayerId[playerId] == 0) && (gModeSelection != 3) && (gModeSelection != 1)) { #if EXPLICIT_AND == 1 diff --git a/src/render_objects.h b/src/render_objects.h index e3caf217d..f27730b6e 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -207,9 +207,6 @@ void func_8004B614(s32, s32, s32, s32, s32, s32, s32); void func_8004B6C4(s32, s32, s32); void func_8004B72C(s32, s32, s32, s32, s32, s32, s32); void render_texture_rectangle_wrap(s32, s32, s32, s32, s32); -void render_texture_rectangle_3P(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, s32 arg6); -void func_8004B97C_3P(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4); -void draw_hud_2d_texture_3P(s32 x, s32 y, u32 width, u32 height, u8* texture); void func_8004BB34(void); void func_8004BB3C(s32, s32, s32, s32, f32); void func_8004BD14(s32, s32, u32, u32, s32, u8*, u8*); @@ -221,7 +218,6 @@ void func_8004C148(s16, s16, s16, u16, u16, u16, u16); void func_8004C354(void); void func_8004C35C(void); void draw_hud_2d_texture_wide(s32, s32, u32, u32, u8*); -void draw_hud_2d_texture_3P(s32 x, s32 y, u32 width, u32 height, u8* texture); void func_8004C450(s32, s32, u32, u32, u8*); void func_8004C53C(s32, s32, u32, u32, u8*); void func_8004C628(s32, s32, u32, u32, u8*); @@ -300,7 +296,7 @@ void func_8004ED40(s32); void func_8004EE54(s32); void func_8004EF9C(s32); -void func_8004F020(s32); +void set_minimap_finishline_position(s32); void func_8004F168(s32, s32, s32); void func_8004F3E4(s32); s32 func_8004F674(s32*, s32); diff --git a/src/save.c b/src/save.c index 9c5a7e698..607e4b1a3 100644 --- a/src/save.c +++ b/src/save.c @@ -567,7 +567,7 @@ s32 validate_save_data_checksum_backup(void) { // Check if controller has a Controller Pak connected. // Return PAK if it does, otherwise return NO_PAK. s32 check_for_controller_pak(s32 controller) { - u8 controllerBitpattern; + u8 controllerBitpattern = 0; UNUSED s32 phi_v0; if ((controller >= MAXCONTROLLERS) || (controller < 0)) { diff --git a/src/stubs.c b/src/stubs.c index 7624c6209..3b3f8af0a 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -30,7 +30,7 @@ s32 mio0encode(s32 input, s32 arg1, s32 arg2) { } void tkmk00decode(u8* src, u8* arg1, u8* dest, s32 n) { - memcpy(dest, src, 0x1000); + //memcpy(dest, src, 0x1000); } void osStartThread(OSThread* thread) {