diff --git a/include/defines.h b/include/defines.h index 1b9cfcafc..bca0f9b5f 100644 --- a/include/defines.h +++ b/include/defines.h @@ -384,4 +384,12 @@ enum DIRECTION { #define FACING_X_AXIS 0x8000 #define FACING_Z_AXIS 0x2000 -#endif // DEFINES_H \ No newline at end of file +#endif // DEFINES_H + +/** + * + * Laps + * + */ +#define MIN_LAPS 0 +#define MAX_LAPS 3 \ No newline at end of file diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 011117424..639d45435 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -1166,33 +1166,33 @@ void func_80008424(s32 playerId, f32 arg1, Player* player) { #ifdef NON_MATCHING // generated by m2c commit 05102b12b75400ad2be8bd0872404237b36e1702 on Feb-20-2024 -// static ? D_800DCAF4; /* unable to generate initializer: unknown type */ -// static ? D_800DCB34; /* unable to generate initializer: unknown type */ +// static ? gAIDistances; /* unable to generate initializer: unknown type */ +// static ? gMarioRacewayAIDistances; /* unable to generate initializer: unknown type */ // static ? *D_800DCBB4[0x15] = { -// &D_800DCB34, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, -// &D_800DCAF4, +// &gMarioRacewayAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, +// &gAIDistances, // }; -s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) { +s32 func_800088D8(s32 playerId, s16 lapNum, s16 currRank) { Player* player; f32 interp; s16 rank; @@ -1212,10 +1212,10 @@ s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) { if (gModeSelection == 1) { return true; } - if (arg1 < 0) { + if (lapNum < MIN_LAPS) { return true; - } else if (arg1 >= 4) { - arg1 = 3; + } else if (lapNum > MAX_LAPS) { + lapNum = MAX_LAPS; } if (D_80163330[playerId] == 1) { return true; @@ -1224,9 +1224,9 @@ s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) { if (player->type & 0x4000) { return true; } - arg1_times_8 = arg1 * 8; - temp_a3 = &CM_GetProps()->SomePtr[arg1_times_8]; - if (arg2 == 0) { + arg1_times_8 = lapNum * 8; + temp_a3 = &CM_GetProps()->AIDistance[arg1_times_8]; + if (currRank == 0) { if (gDemoMode == 1) { temp_a2 = D_80164450[playerId] - D_80164450[D_80164378[7]]; if (temp_a2 < 0) { @@ -1269,17 +1269,17 @@ s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) { } var_v0 = 0; for (i = 0; i < 2; i++) { - if (gGPCurrentRaceRankByPlayerId[D_80163344[i]] < arg2) { + if (gGPCurrentRaceRankByPlayerId[D_80163344[i]] < currRank) { var_v0++; } } var_a0_4 = 0; for (i = 0; i < gPlayerCount; i++) { - if (gGPCurrentRaceRankByPlayerId[i] < arg2) { + if (gGPCurrentRaceRankByPlayerId[i] < currRank) { var_a0_4++; } } - var_t1 = (arg2 - var_v0) - var_a0_4; + var_t1 = (currRank - var_v0) - var_a0_4; if (var_v0 > 0 || var_a0_4 > 0) { var_t1++; } @@ -1287,6 +1287,7 @@ s32 func_800088D8(s32 playerId, s16 arg1, s16 arg2) { if (var_t1 < 0 || var_t1 >= 8) { return false; } + printf("T1 %d\n", var_t1); if (arg1_times_8 < 24) { temp_a3 = &temp_a3[var_t1]; interp = gLapCompletionPercentByPlayerId[playerId]; diff --git a/src/data/path_spawn_metadata.c b/src/data/path_spawn_metadata.c index 99450b12a..49a61aa58 100644 --- a/src/data/path_spawn_metadata.c +++ b/src/data/path_spawn_metadata.c @@ -14,23 +14,30 @@ TrackWaypoint nullPath = { 0x8000, 0x0000, 0x0000, 0x0000 }; -// I think the types for D_800DCAF4, D_800DCB34, and D_800DCBB4 are all +// I think the types for gAIDistances, gMarioRacewayAIDistances, and D_800DCBB4 are all // wrong in some way based on their usage in func_800088D8 // But I cannot be bothered to figure it out // Used as a ptr in D_800DCBB4 -s16 D_800DCAF4[] = { - 0x0014, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, 0x001e, 0x0019, 0x0032, - 0x004b, 0x0064, 0x007d, 0x0096, 0x00af, 0x0028, 0x001e, 0x003c, 0x005a, 0x0078, 0x0096, - 0x00b4, 0x00d2, 0x0032, 0x0028, 0x0050, 0x0078, 0x00a0, 0x00c8, 0x00f0, 0x0118, +s16 gAIDistances[] = { + 0x0014, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, + 0x001e, 0x0019, 0x0032, 0x004b, 0x0064, 0x007d, 0x0096, 0x00af, + 0x0028, 0x001e, 0x003c, 0x005a, 0x0078, 0x0096, 0x00b4, 0x00d2, + 0x0032, 0x0028, 0x0050, 0x0078, 0x00a0, 0x00c8, 0x00f0, 0x0118, }; // Used as a ptr in D_800DCBB4 -s16 D_800DCB34[] = { - 0x0014, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, 0x001e, 0x0019, 0x002d, 0x0041, 0x005a, - 0x0073, 0x008c, 0x00a5, 0x0028, 0x0003, 0x0006, 0x0010, 0x002e, 0x0031, 0x003b, 0x0059, 0x0032, 0x001e, - 0x003c, 0x003f, 0x0049, 0x004e, 0x006c, 0x008a, 0x000a, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, - 0x0023, 0x000a, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x000a, 0x0005, 0x0005, 0x0005, - 0x0005, 0x0005, 0x0005, 0x0005, 0x000a, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, +s16 gMarioRacewayAIDistances[] = { + 0x0014, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, + 0x001e, 0x0019, 0x002d, 0x0041, 0x005a, 0x0073, 0x008c, 0x00a5, + 0x0028, 0x0003, 0x0006, 0x0010, 0x002e, 0x0031, 0x003b, 0x0059, + 0x0032, 0x001e, 0x003c, 0x003f, 0x0049, 0x004e, 0x006c, 0x008a, +}; + +s16 some_data[] = { // Not sure what this is for + 0x000a, 0x0005, 0x000a, 0x000f, 0x0014, 0x0019, 0x001e, 0x0023, + 0x000a, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x000a, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x000a, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, }; s32 D_800DDB20 = 0x00000000; diff --git a/src/data/path_spawn_metadata.h b/src/data/path_spawn_metadata.h index df2d8c7b7..424f11ab8 100644 --- a/src/data/path_spawn_metadata.h +++ b/src/data/path_spawn_metadata.h @@ -16,8 +16,8 @@ typedef struct { } _struct_gCoursePathSizes_0x10; // size 0x10 extern TrackWaypoint nullPath; -extern s16 D_800DCAF4[]; -extern s16 D_800DCB34[]; +extern s16 gAIDistances[]; +extern s16 gMarioRacewayAIDistances[]; extern s32 D_800DDB20; extern s32 D_800DDB24; diff --git a/src/engine/courses/BansheeBoardwalk.cpp b/src/engine/courses/BansheeBoardwalk.cpp index 5ebaf2bc1..505069d1f 100644 --- a/src/engine/courses/BansheeBoardwalk.cpp +++ b/src/engine/courses/BansheeBoardwalk.cpp @@ -79,7 +79,6 @@ BansheeBoardwalk::BansheeBoardwalk() { Props.AIBehaviour = D_0D009058; Props.AIMaximumSeparation = 40.0f; Props.AIMinimumSeparation = 0.4f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 2.0f; diff --git a/src/engine/courses/BigDonut.cpp b/src/engine/courses/BigDonut.cpp index 6ea92018b..5cbb38c13 100644 --- a/src/engine/courses/BigDonut.cpp +++ b/src/engine/courses/BigDonut.cpp @@ -52,7 +52,6 @@ BigDonut::BigDonut() { Props.AIBehaviour = D_0D008F18; Props.AIMaximumSeparation = -1.0f; Props.AIMinimumSeparation = 0.5f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 40; Props.PathSizes = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}; diff --git a/src/engine/courses/BlockFort.cpp b/src/engine/courses/BlockFort.cpp index 2e001833e..67ef10d09 100644 --- a/src/engine/courses/BlockFort.cpp +++ b/src/engine/courses/BlockFort.cpp @@ -55,7 +55,6 @@ BlockFort::BlockFort() { Props.AIBehaviour = D_0D008F18; Props.AIMaximumSeparation = -1.0f; Props.AIMinimumSeparation = 0.1f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 2.0f; diff --git a/src/engine/courses/BowsersCastle.cpp b/src/engine/courses/BowsersCastle.cpp index cac1dde92..384a85b1a 100644 --- a/src/engine/courses/BowsersCastle.cpp +++ b/src/engine/courses/BowsersCastle.cpp @@ -81,7 +81,6 @@ BowsersCastle::BowsersCastle() { Props.AIBehaviour = D_0D008FB8; Props.AIMaximumSeparation = 35.0f; Props.AIMinimumSeparation = 0.2f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 2.0f; diff --git a/src/engine/courses/ChocoMountain.cpp b/src/engine/courses/ChocoMountain.cpp index 632f31981..3115c6fff 100644 --- a/src/engine/courses/ChocoMountain.cpp +++ b/src/engine/courses/ChocoMountain.cpp @@ -73,7 +73,6 @@ ChocoMountain::ChocoMountain() { Props.AIBehaviour = D_0D008F80; Props.AIMaximumSeparation = 35.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 2.0f; @@ -114,7 +113,7 @@ ChocoMountain::ChocoMountain() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; + Props.MinimapFinishlineY = -16.0; Props.Skybox.TopRight = {255, 255, 255}; Props.Skybox.BottomRight = {255, 255, 255}; diff --git a/src/engine/courses/Course.cpp b/src/engine/courses/Course.cpp index b830c7eb2..40cb4f1bd 100644 --- a/src/engine/courses/Course.cpp +++ b/src/engine/courses/Course.cpp @@ -32,7 +32,7 @@ Course::Course() { Props.AIBehaviour = D_0D008F28; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCB34; + Props.AIDistance = gMarioRacewayAIDistances; Props.AISteeringSensitivity = 48; Props.NearPersp = 3.0f; diff --git a/src/engine/courses/Course.h b/src/engine/courses/Course.h index 889012a12..306940f01 100644 --- a/src/engine/courses/Course.h +++ b/src/engine/courses/Course.h @@ -47,7 +47,7 @@ typedef struct Properties { float AIMinimumSeparation; float NearPersp; float FarPersp; - int16_t *SomePtr; + int16_t* AIDistance; uint32_t AISteeringSensitivity; _struct_gCoursePathSizes_0x10 PathSizes; Vec4f D_0D009418; @@ -58,8 +58,8 @@ typedef struct Properties { TrackWaypoint* PathTable2[4]; CloudData *Clouds; CloudData *CloudList; - int32_t MinimapFinishlineX; - int32_t MinimapFinishlineY; + float MinimapFinishlineX; + float MinimapFinishlineY; SkyboxColours Skybox; const course_texture *textures; enum MusicSeq Sequence; diff --git a/src/engine/courses/DKJungle.cpp b/src/engine/courses/DKJungle.cpp index d5f6935a0..20e0133e4 100644 --- a/src/engine/courses/DKJungle.cpp +++ b/src/engine/courses/DKJungle.cpp @@ -80,7 +80,6 @@ DKJungle::DKJungle() { Props.AIBehaviour = D_0D0093C0; Props.AIMaximumSeparation = 40.0f; Props.AIMinimumSeparation = 0.1f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/DoubleDeck.cpp b/src/engine/courses/DoubleDeck.cpp index 81e6733a6..014355544 100644 --- a/src/engine/courses/DoubleDeck.cpp +++ b/src/engine/courses/DoubleDeck.cpp @@ -52,7 +52,6 @@ DoubleDeck::DoubleDeck() { Props.AIBehaviour = D_0D008F18; Props.AIMaximumSeparation = -1.0f; Props.AIMinimumSeparation = 0.5f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 2.0f; diff --git a/src/engine/courses/FrappeSnowland.cpp b/src/engine/courses/FrappeSnowland.cpp index 05bcf95cb..fb108f392 100644 --- a/src/engine/courses/FrappeSnowland.cpp +++ b/src/engine/courses/FrappeSnowland.cpp @@ -60,7 +60,6 @@ FrappeSnowland::FrappeSnowland() { Props.AIBehaviour = D_0D0090F8; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/Harbour.cpp b/src/engine/courses/Harbour.cpp index 11aa47ed5..2020431ec 100644 --- a/src/engine/courses/Harbour.cpp +++ b/src/engine/courses/Harbour.cpp @@ -534,7 +534,6 @@ Harbour::Harbour() { Props.AIBehaviour = D_0D008F28; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCB34; Props.AISteeringSensitivity = 48; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index 317dd261b..5b9b62819 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -65,7 +65,6 @@ KalimariDesert::KalimariDesert() { Props.AIBehaviour = D_0D009260; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 10.0f; @@ -106,7 +105,7 @@ KalimariDesert::KalimariDesert() { Props.Clouds = gKalimariDesertClouds; Props.CloudList = gKalimariDesertClouds; Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; + Props.MinimapFinishlineY = 4.0; Props.Skybox.TopRight = {195, 231, 255}; Props.Skybox.BottomRight = {255, 192, 0}; diff --git a/src/engine/courses/KoopaTroopaBeach.cpp b/src/engine/courses/KoopaTroopaBeach.cpp index 3fd22598a..3b027f37c 100644 --- a/src/engine/courses/KoopaTroopaBeach.cpp +++ b/src/engine/courses/KoopaTroopaBeach.cpp @@ -71,7 +71,6 @@ KoopaTroopaBeach::KoopaTroopaBeach() { Props.AIBehaviour = D_0D009158; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.5f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 1.0f; diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index 555af3212..6da88f9d3 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -97,7 +97,6 @@ LuigiRaceway::LuigiRaceway() { Props.AIBehaviour = D_0D0091E8; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.7f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 48; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index e3b9bba21..7815c1211 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -84,7 +84,7 @@ MarioRaceway::MarioRaceway() { Props.AIBehaviour = D_0D008F28; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCB34; + Props.AIDistance = gMarioRacewayAIDistances; Props.AISteeringSensitivity = 48; Props.NearPersp = 9.0f; @@ -125,7 +125,7 @@ MarioRaceway::MarioRaceway() { Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; + Props.MinimapFinishlineY = -2.0; Props.Skybox.TopRight = {0, 184, 248}; Props.Skybox.BottomRight = {216, 232, 248}; diff --git a/src/engine/courses/MooMooFarm.cpp b/src/engine/courses/MooMooFarm.cpp index f8f7fb948..5416e8922 100644 --- a/src/engine/courses/MooMooFarm.cpp +++ b/src/engine/courses/MooMooFarm.cpp @@ -83,7 +83,6 @@ MooMooFarm::MooMooFarm() { Props.AIBehaviour = D_0D009210; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.5f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 48; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/PodiumCeremony.cpp b/src/engine/courses/PodiumCeremony.cpp index 637dbc5d3..cafac2424 100644 --- a/src/engine/courses/PodiumCeremony.cpp +++ b/src/engine/courses/PodiumCeremony.cpp @@ -98,7 +98,6 @@ PodiumCeremony::PodiumCeremony() { Props.AIBehaviour = D_0D009188; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.4f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.PathSizes = {500, 500, 500, 500, 1, 0, 0, 0, 0, 0, 0}; diff --git a/src/engine/courses/RainbowRoad.cpp b/src/engine/courses/RainbowRoad.cpp index 11ca643b8..3bac83cbe 100644 --- a/src/engine/courses/RainbowRoad.cpp +++ b/src/engine/courses/RainbowRoad.cpp @@ -57,7 +57,6 @@ RainbowRoad::RainbowRoad() { Props.AIBehaviour = D_0D0092C8; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.4f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 38; Props.NearPersp = 2.0f; diff --git a/src/engine/courses/RoyalRaceway.cpp b/src/engine/courses/RoyalRaceway.cpp index 7ff7579ff..ab074af85 100644 --- a/src/engine/courses/RoyalRaceway.cpp +++ b/src/engine/courses/RoyalRaceway.cpp @@ -94,7 +94,6 @@ RoyalRaceway::RoyalRaceway() { Props.AIBehaviour = D_0D009188; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.4f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/SherbetLand.cpp b/src/engine/courses/SherbetLand.cpp index a452d2c03..3f5868247 100644 --- a/src/engine/courses/SherbetLand.cpp +++ b/src/engine/courses/SherbetLand.cpp @@ -60,7 +60,6 @@ SherbetLand::SherbetLand() { Props.AIBehaviour = D_0D009280; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/Skyscraper.cpp b/src/engine/courses/Skyscraper.cpp index 86d345f24..ce9fbb3fc 100644 --- a/src/engine/courses/Skyscraper.cpp +++ b/src/engine/courses/Skyscraper.cpp @@ -73,7 +73,6 @@ Skyscraper::Skyscraper() { Props.AIBehaviour = D_0D008F18; Props.AIMaximumSeparation = -1.0f; Props.AIMinimumSeparation = 0.5f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 2.0f; diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index 1bcfa1e94..2ccb47329 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -76,7 +76,6 @@ TestCourse::TestCourse() { Props.AIBehaviour = D_0D008F28; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.3f; - Props.SomePtr = D_800DCB34; Props.AISteeringSensitivity = 48; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/ToadsTurnpike.cpp b/src/engine/courses/ToadsTurnpike.cpp index 34bddbb62..56b8a59f4 100644 --- a/src/engine/courses/ToadsTurnpike.cpp +++ b/src/engine/courses/ToadsTurnpike.cpp @@ -78,7 +78,6 @@ ToadsTurnpike::ToadsTurnpike() { Props.AIBehaviour = D_0D009238; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.5f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 40; Props.NearPersp = 9.0f; diff --git a/src/engine/courses/WarioStadium.cpp b/src/engine/courses/WarioStadium.cpp index d60d754c0..1e7beb672 100644 --- a/src/engine/courses/WarioStadium.cpp +++ b/src/engine/courses/WarioStadium.cpp @@ -74,7 +74,6 @@ WarioStadium::WarioStadium() { Props.AIBehaviour = D_0D009310; Props.AIMaximumSeparation = 50.0f; Props.AIMinimumSeparation = 0.6f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 10.0f; diff --git a/src/engine/courses/YoshiValley.cpp b/src/engine/courses/YoshiValley.cpp index e6727b644..f055d6915 100644 --- a/src/engine/courses/YoshiValley.cpp +++ b/src/engine/courses/YoshiValley.cpp @@ -69,7 +69,6 @@ YoshiValley::YoshiValley() { Props.AIBehaviour = D_0D0090B8; Props.AIMaximumSeparation = 35.0f; Props.AIMinimumSeparation = 0.0f; - Props.SomePtr = D_800DCAF4; Props.AISteeringSensitivity = 53; Props.NearPersp = 9.0f; diff --git a/src/engine/editor/EditorMath.cpp b/src/engine/editor/EditorMath.cpp index 06d51f8ce..baeaa535c 100644 --- a/src/engine/editor/EditorMath.cpp +++ b/src/engine/editor/EditorMath.cpp @@ -337,5 +337,5 @@ void SetDirectionFromRotator(s16 rotator[3], s8 direction[3]) { direction[1] = static_cast(y * 127.0f); direction[2] = static_cast(z * 127.0f); - printf("Light dir %d %d %d (from rot 0x%X 0x%X 0x%X)\n", direction[0], direction[1], direction[2], rotator[0], rotator[1], rotator[2]); + //printf("Light dir %d %d %d (from rot 0x%X 0x%X 0x%X)\n", direction[0], direction[1], direction[2], rotator[0], rotator[1], rotator[2]); } diff --git a/src/port/ui/Tools.cpp b/src/port/ui/Tools.cpp index 8bbc141a2..be1ce3269 100644 --- a/src/port/ui/Tools.cpp +++ b/src/port/ui/Tools.cpp @@ -48,10 +48,25 @@ namespace Editor { // Draw buttons ToolButton(ICON_FA_ARROWS, 0); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Translate"); + ImGui::EndTooltip(); + } ImGui::SameLine(); ToolButton(ICON_FA_REPEAT, 1); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Rotate"); + ImGui::EndTooltip(); + } ImGui::SameLine(); ToolButton(ICON_FA_EXPAND, 2); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Scale"); + ImGui::EndTooltip(); + } ImGui::SameLine(); @@ -64,6 +79,11 @@ namespace Editor { CVarSetInteger("gEditorSnapToGround", toggleGroundSnap); } ImGui::PopStyleColor(); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Snap object to surface"); + ImGui::EndTooltip(); + } ImGui::SameLine(); @@ -75,6 +95,12 @@ namespace Editor { CVarSetInteger("gEditorBoundary", toggleBoundary); } ImGui::PopStyleColor(); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Stops translated objects from leaving the track area."); + ImGui::Text("This helps prevent moving objects really far away off the level."); + ImGui::EndTooltip(); + } ImGui::SameLine(); @@ -90,6 +116,11 @@ namespace Editor { } ImGui::PopStyleColor(); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Toggle player 1's AI or human player state."); + ImGui::EndTooltip(); + } ImGui::SameLine(); diff --git a/src/port/ui/TrackProperties.cpp b/src/port/ui/TrackProperties.cpp index 3d4fc0845..b641d2af4 100644 --- a/src/port/ui/TrackProperties.cpp +++ b/src/port/ui/TrackProperties.cpp @@ -18,6 +18,7 @@ extern "C" { #include "sounds.h" #include "external.h" #include "render_courses.h" +#include "render_objects.h" } namespace Editor { @@ -36,38 +37,57 @@ namespace Editor { ImGui::InputText("Name", nameBuffer, IM_ARRAYSIZE(nameBuffer)); ImGui::InputText("Debug Name", debugNameBuffer, IM_ARRAYSIZE(debugNameBuffer)); ImGui::InputText("Course Length", lengthBuffer, IM_ARRAYSIZE(lengthBuffer)); - - ImGui::Separator(); - - static float aiMaxSeparation = 50.0f; - static float aiMinSeparation = 0.3f; - static int aiSteeringSensitivity = 48; - - ImGui::InputFloat("AI Max Separation", &gWorldInstance.CurrentCourse->Props.AIMaximumSeparation); - ImGui::InputFloat("AI Min Separation", &gWorldInstance.CurrentCourse->Props.AIMinimumSeparation); - ImGui::InputInt("AI Steering Sensitivity", (int*)&gWorldInstance.CurrentCourse->Props.AISteeringSensitivity); - - ImGui::Separator(); + ImGui::InputFloat("Minimap Finishline X Offset", &gWorldInstance.CurrentCourse->Props.MinimapFinishlineX); + ImGui::InputFloat("Minimap Finishline Y Offset", &gWorldInstance.CurrentCourse->Props.MinimapFinishlineY); - ImGui::InputInt("Minimap Finishline X Offset", (int*)&gWorldInstance.CurrentCourse->Props.MinimapFinishlineX); - ImGui::InputInt("Minimap Finishline Y Offset", (int*)&gWorldInstance.CurrentCourse->Props.MinimapFinishlineY); - - ImGui::Separator(); - - static float nearPersp = 9.0f; - static float farPersp = 4500.0f; - - ImGui::InputFloat("Near Perspective", &gWorldInstance.CurrentCourse->Props.NearPersp); - ImGui::InputFloat("Far Perspective", &gWorldInstance.CurrentCourse->Props.FarPersp); - - ImGui::Separator(); - - static float d_0D009418[4] = { 4.1666665f, 5.5833334f, 6.1666665f, 6.75f }; - for (int i = 0; i < 4; i++) { - ImGui::InputFloat(fmt::format("D_0D009418[{}]", i).c_str(), &d_0D009418[i]); + if (ImGui::CollapsingHeader("Camera")) { + ImGui::InputFloat("Near Perspective", &gWorldInstance.CurrentCourse->Props.NearPersp); + ImGui::InputFloat("Far Perspective", &gWorldInstance.CurrentCourse->Props.FarPersp); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Controls the far clipping distance for perspective rendering."); + ImGui::Text("Disable culling enhancement needs to be off to see a difference."); + ImGui::EndTooltip(); + } + } + + if (ImGui::CollapsingHeader("Environment")) { + TrackPropertiesWindow::DrawLight(); + } + + + if (ImGui::CollapsingHeader("AI")) { + + ImGui::InputFloat("AI Max Separation", &gWorldInstance.CurrentCourse->Props.AIMaximumSeparation); + ImGui::InputFloat("AI Min Separation", &gWorldInstance.CurrentCourse->Props.AIMinimumSeparation); + ImGui::InputInt("AI Steering Sensitivity", (int*)&gWorldInstance.CurrentCourse->Props.AISteeringSensitivity); + } + + if (ImGui::CollapsingHeader("Random Junk")) { + for (size_t i = 0; i < 4; i++) { + ImGui::InputFloat(fmt::format("D_0D009418[{}]", i).c_str(), &gWorldInstance.CurrentCourse->Props.D_0D009418[i]); + } + + ImGui::Separator(); + + + for (size_t i = 0; i < 4; i++) { + ImGui::InputFloat(fmt::format("D_0D009418[{}]", i).c_str(), &gWorldInstance.CurrentCourse->Props.D_0D009568[i]); + } + + ImGui::Separator(); + + + for (size_t i = 0; i < 4; i++) { + ImGui::InputFloat(fmt::format("D_0D009418[{}]", i).c_str(), &gWorldInstance.CurrentCourse->Props.D_0D0096B8[i]); + } + + ImGui::Separator(); + + for (size_t i = 0; i < 4; i++) { + ImGui::InputFloat(fmt::format("D_0D009418[{}]", i).c_str(), &gWorldInstance.CurrentCourse->Props.D_0D009808[i]); + } } - - ImGui::Separator(); // Convert and pass to ImGui ColorEdit3 float topRight[3], bottomRight[3], bottomLeft[3], topLeft[3]; @@ -83,15 +103,16 @@ namespace Editor { RGB8ToFloat((u8*)&gWorldInstance.CurrentCourse->Props.Skybox.FloorBottomLeft, floorBottomLeft); RGB8ToFloat((u8*)&gWorldInstance.CurrentCourse->Props.Skybox.FloorTopLeft, floorTopLeft); - // Use these float arrays with ImGui::ColorEdit3 - ImGui::ColorEdit3("Skybox Top Right", topRight); - ImGui::ColorEdit3("Skybox Bottom Right", bottomRight); - ImGui::ColorEdit3("Skybox Bottom Left", bottomLeft); - ImGui::ColorEdit3("Skybox Top Left", topLeft); - ImGui::ColorEdit3("Skybox Floor Top Right", floorTopRight); - ImGui::ColorEdit3("Skybox Floor Bottom Right", floorBottomRight); - ImGui::ColorEdit3("Skybox Floor Bottom Left", floorBottomLeft); - ImGui::ColorEdit3("Skybox Floor Top Left", floorTopLeft); + if (ImGui::CollapsingHeader("Skybox")) { + ImGui::ColorEdit3("Skybox Top Right", topRight); + ImGui::ColorEdit3("Skybox Bottom Right", bottomRight); + ImGui::ColorEdit3("Skybox Bottom Left", bottomLeft); + ImGui::ColorEdit3("Skybox Top Left", topLeft); + ImGui::ColorEdit3("Skybox Floor Top Right", floorTopRight); + ImGui::ColorEdit3("Skybox Floor Bottom Right", floorBottomRight); + ImGui::ColorEdit3("Skybox Floor Bottom Left", floorBottomLeft); + ImGui::ColorEdit3("Skybox Floor Top Left", floorTopLeft); + } // Convert the modified float values back to RGB8 (0-255) FloatToRGB8(topRight, (u8*)&gWorldInstance.CurrentCourse->Props.Skybox.TopRight); @@ -102,14 +123,8 @@ namespace Editor { FloatToRGB8(floorBottomRight, (u8*)&gWorldInstance.CurrentCourse->Props.Skybox.FloorBottomRight); FloatToRGB8(floorBottomLeft, (u8*)&gWorldInstance.CurrentCourse->Props.Skybox.FloorBottomLeft); FloatToRGB8(floorTopLeft, (u8*)&gWorldInstance.CurrentCourse->Props.Skybox.FloorTopLeft); - - ImGui::Separator(); - + TrackPropertiesWindow::DrawMusic(); - - ImGui::Separator(); - - TrackPropertiesWindow::DrawLight(); } void TrackPropertiesWindow::DrawMusic() { diff --git a/src/render_objects.c b/src/render_objects.c index d3fcaaa64..25e52a103 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -2740,13 +2740,9 @@ void set_minimap_finishline_position(s32 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()) { - var_f0 = var_f0 - 16.0; - } else if (GetCourse() == GetKalimariDesert()) { - var_f0 = var_f0 + 4.0; - } + + var_f2 += CM_GetProps()->MinimapFinishlineX; + var_f0 += CM_GetProps()->MinimapFinishlineY; //! @todo Get course minimap props from course. CM_MinimapFinishlinePosition();