From f1b20c7b91f4f05dd0354ef32245f2204a82295a Mon Sep 17 00:00:00 2001 From: coco875 <59367621+coco875@users.noreply.github.com> Date: Sat, 12 Jul 2025 23:32:52 +0000 Subject: [PATCH] Fix minor render issue in menu (#447) * fix menu texture * fix other text * junky fix * fix cloud to be png * fix cloud * Update menu_items.c --------- Co-authored-by: MegaMech --- src/code_8006E9C0.c | 46 ++++++++-- src/engine/courses/Harbour.cpp | 2 +- src/engine/courses/KalimariDesert.cpp | 2 +- src/engine/courses/KoopaTroopaBeach.cpp | 2 +- src/engine/courses/LuigiRaceway.cpp | 2 +- src/engine/courses/MarioRaceway.cpp | 2 +- src/engine/courses/MooMooFarm.cpp | 2 +- src/engine/courses/PodiumCeremony.cpp | 2 +- src/engine/courses/RoyalRaceway.cpp | 2 +- src/engine/courses/SherbetLand.cpp | 2 +- src/engine/courses/TestCourse.cpp | 2 +- src/engine/courses/YoshiValley.cpp | 2 +- src/menu_items.c | 110 +++++++++++++++++++++++- src/menu_items.h | 1 + 14 files changed, 158 insertions(+), 21 deletions(-) diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 95c4e8da0..12e00edcd 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -28,6 +28,7 @@ #include "effects.h" #include #include "port/Game.h" +#include "port/Engine.h" #include "engine/courses/Course.h" @@ -167,7 +168,7 @@ void get_minimap_properties() { // This is incredibly dumb. MinimapDimensions ought to be something more like // `u16 MinimapDimensions[][2]` but that doesn't match for some insane reason - gMinimapWidth = CM_GetProps()->Minimap.Width; // MinimapDimensions[courseId * 2]; + gMinimapWidth = CM_GetProps()->Minimap.Width; // MinimapDimensions[courseId * 2]; gMinimapHeight = CM_GetProps()->Minimap.Height; // MinimapDimensions[courseId * 2 + 1]; } @@ -198,10 +199,12 @@ void func_8006F008(void) { // Flip the minimap player markers if (gIsMirrorMode != 0) { - CM_GetProps()->Minimap.PlayerX = CM_GetProps()->Minimap.Width - CM_GetProps()->Minimap.PlayerX; // gMinimapPlayerX = gMinimapWidth - gMinimapPlayerX + CM_GetProps()->Minimap.PlayerX = + CM_GetProps()->Minimap.Width - + CM_GetProps()->Minimap.PlayerX; // gMinimapPlayerX = gMinimapWidth - gMinimapPlayerX } - switch(gPlayerCount) { + switch (gPlayerCount) { case 2: // Set X coord if (!IsToadsTurnpike()) { @@ -266,7 +269,7 @@ void func_8006F8CC(void) { D_801657F0 = 1; D_80165800[0] = D_80165800[1] = 0; } - + CM_GetProps()->Minimap.Pos[0].Y = 65; CM_GetProps()->Minimap.Pos[1].Y = 180; } @@ -485,6 +488,31 @@ void init_object_list_index(void) { // } } +Vtx cloudvtx[4][4] = { { + { { { -32, -16, 0 }, 0, { 0, 0 }, { 255, 255, 255, 255 } } }, + { { { 31, -16, 0 }, 0, { 4032, 0 }, { 255, 255, 255, 255 } } }, + { { { 31, 15, 0 }, 0, { 4032, 496 }, { 255, 255, 255, 255 } } }, + { { { -32, 15, 0 }, 0, { 0, 496 }, { 255, 255, 255, 255 } } }, + }, + { + { { { -32, -16, 0 }, 0, { 0, 512 }, { 255, 255, 255, 255 } } }, + { { { 31, -16, 0 }, 0, { 4032, 512 }, { 255, 255, 255, 255 } } }, + { { { 31, 15, 0 }, 0, { 4032, 1008 }, { 255, 255, 255, 255 } } }, + { { { -32, 15, 0 }, 0, { 0, 1008 }, { 255, 255, 255, 255 } } }, + }, + { + { { { -32, -16, 0 }, 0, { 0, 1024 }, { 255, 255, 255, 255 } } }, + { { { 31, -16, 0 }, 0, { 4032, 1024 }, { 255, 255, 255, 255 } } }, + { { { 31, 15, 0 }, 0, { 4032, 1520 }, { 255, 255, 255, 255 } } }, + { { { -32, 15, 0 }, 0, { 0, 1520 }, { 255, 255, 255, 255 } } }, + }, + { + { { { -32, -16, 0 }, 0, { 0, 1536 }, { 255, 255, 255, 255 } } }, + { { { 31, -16, 0 }, 0, { 4032, 1536 }, { 255, 255, 255, 255 } } }, + { { { 31, 15, 0 }, 0, { 4032, 2032 }, { 255, 255, 255, 255 } } }, + { { { -32, 15, 0 }, 0, { 0, 2032 }, { 255, 255, 255, 255 } } }, + } }; + void init_cloud_object(s32 objectIndex, s32 arg1, CloudData* arg2) { ItemWindowObjects* temp_v0; @@ -495,8 +523,14 @@ void init_cloud_object(s32 objectIndex, s32 arg1, CloudData* arg2) { temp_v0->direction_angle[1] = arg2->rotY; temp_v0->unk_09E = arg2->posY; temp_v0->sizeScaling = (f32) arg2->scalePercent / 100.0; - temp_v0->activeTexture = ((u8(*)[1024])CM_GetProps()->CloudTexture)[arg2->subType]; - func_80073404(objectIndex, 0x40U, 0x20U, D_0D005FB0); + if (GameEngine_ResourceGetTexTypeByName(CM_GetProps()->CloudTexture) != 1) { + int width = ResourceGetTexWidthByName(CM_GetProps()->CloudTexture); + temp_v0->activeTexture = LOAD_ASSET_RAW(CM_GetProps()->CloudTexture) + (arg2->subType * width * width * 1); + func_80073404(objectIndex, 0x40U, 0x20U, D_0D005FB0); + } else { + temp_v0->activeTexture = CM_GetProps()->CloudTexture; + func_80073404(objectIndex, 0x40U, 0x20U, cloudvtx[arg2->subType]); + } temp_v0->primAlpha = 0x00FF; } diff --git a/src/engine/courses/Harbour.cpp b/src/engine/courses/Harbour.cpp index 04f28dcf8..2a96f6d44 100644 --- a/src/engine/courses/Harbour.cpp +++ b/src/engine/courses/Harbour.cpp @@ -574,7 +574,7 @@ Harbour::Harbour() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust5); + Props.CloudTexture = (u8*) gTextureExhaust5; Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; Props.Minimap.FinishlineX = 0; diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index a0cdf469d..369828581 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -113,7 +113,7 @@ KalimariDesert::KalimariDesert() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust5); + Props.CloudTexture = (u8*) gTextureExhaust5; Props.Clouds = gKalimariDesertClouds; Props.CloudList = gKalimariDesertClouds; diff --git a/src/engine/courses/KoopaTroopaBeach.cpp b/src/engine/courses/KoopaTroopaBeach.cpp index 0625073c7..90f6f6531 100644 --- a/src/engine/courses/KoopaTroopaBeach.cpp +++ b/src/engine/courses/KoopaTroopaBeach.cpp @@ -119,7 +119,7 @@ KoopaTroopaBeach::KoopaTroopaBeach() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust3); + Props.CloudTexture = (u8*) gTextureExhaust3; Props.Clouds = gKoopaTroopaBeachClouds; Props.CloudList = gKoopaTroopaBeachClouds; diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index 4bc59bc7f..c765656d9 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -146,7 +146,7 @@ LuigiRaceway::LuigiRaceway() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*)LOAD_ASSET_RAW(gTextureExhaust2); + Props.CloudTexture = (u8*)gTextureExhaust2; Props.Clouds = gLuigiRacewayClouds; Props.CloudList = gLuigiRacewayClouds; diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index 6e6afd534..7a7edb214 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -134,7 +134,7 @@ MarioRaceway::MarioRaceway() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (uint8_t*) LOAD_ASSET_RAW(gTextureExhaust5); + Props.CloudTexture = (uint8_t*) gTextureExhaust5; Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; diff --git a/src/engine/courses/MooMooFarm.cpp b/src/engine/courses/MooMooFarm.cpp index f864caf2a..d4632663f 100644 --- a/src/engine/courses/MooMooFarm.cpp +++ b/src/engine/courses/MooMooFarm.cpp @@ -131,7 +131,7 @@ MooMooFarm::MooMooFarm() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust0); + Props.CloudTexture = (u8*) gTextureExhaust0; Props.Clouds = gYoshiValleyMooMooFarmClouds; Props.CloudList = gYoshiValleyMooMooFarmClouds; diff --git a/src/engine/courses/PodiumCeremony.cpp b/src/engine/courses/PodiumCeremony.cpp index eecce4997..4cca2c854 100644 --- a/src/engine/courses/PodiumCeremony.cpp +++ b/src/engine/courses/PodiumCeremony.cpp @@ -143,7 +143,7 @@ PodiumCeremony::PodiumCeremony() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust4); + Props.CloudTexture = (u8*) gTextureExhaust4; Props.Clouds = NULL; // no clouds Props.CloudList = NULL; diff --git a/src/engine/courses/RoyalRaceway.cpp b/src/engine/courses/RoyalRaceway.cpp index 681af2f78..88f85273b 100644 --- a/src/engine/courses/RoyalRaceway.cpp +++ b/src/engine/courses/RoyalRaceway.cpp @@ -143,7 +143,7 @@ RoyalRaceway::RoyalRaceway() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust4); + Props.CloudTexture = (u8*) gTextureExhaust4; Props.Clouds = gRoyalRacewayClouds; Props.CloudList = gRoyalRacewayClouds; diff --git a/src/engine/courses/SherbetLand.cpp b/src/engine/courses/SherbetLand.cpp index f48b5341c..931b8449b 100644 --- a/src/engine/courses/SherbetLand.cpp +++ b/src/engine/courses/SherbetLand.cpp @@ -108,7 +108,7 @@ SherbetLand::SherbetLand() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust1); + Props.CloudTexture = (u8*) gTextureExhaust1; Props.Clouds = gSherbetLandClouds; Props.CloudList = gSherbetLandClouds; diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index f9af1f776..33f003b3b 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -120,7 +120,7 @@ TestCourse::TestCourse() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust5); + Props.CloudTexture = (u8*) gTextureExhaust5; Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; diff --git a/src/engine/courses/YoshiValley.cpp b/src/engine/courses/YoshiValley.cpp index f3769cb7a..9a64ccc86 100644 --- a/src/engine/courses/YoshiValley.cpp +++ b/src/engine/courses/YoshiValley.cpp @@ -115,7 +115,7 @@ YoshiValley::YoshiValley() { Props.PathTable2[2] = (TrackPathPoint*)LOAD_ASSET_RAW(d_course_yoshi_valley_track_waypoints_3); Props.PathTable2[3] = (TrackPathPoint*)LOAD_ASSET_RAW(d_course_yoshi_valley_track_waypoints_4); - Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust0); + Props.CloudTexture = (u8*) gTextureExhaust0; Props.Clouds = gYoshiValleyMooMooFarmClouds; Props.CloudList = gYoshiValleyMooMooFarmClouds; diff --git a/src/menu_items.c b/src/menu_items.c index f2510ad19..a1213c9d0 100644 --- a/src/menu_items.c +++ b/src/menu_items.c @@ -3069,7 +3069,7 @@ Gfx* func_80095BD0_wide_right(Gfx* displayListHead, u8* arg1, f32 arg2, f32 arg3 displayListHead = AddTextMatrix(displayListHead, mf); // gSPMatrix(displayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]), // G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPLoadTextureTile_4b(displayListHead++, arg1, G_IM_FMT_I, arg4, 0, 0, 0, arg4 - 1, arg5 - 1, 0, + gDPLoadTextureTile_4b(displayListHead++, arg1, G_IM_FMT_I, arg4, 0, 0, 0, arg4, arg5 + 2, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); switch (arg4) { @@ -3104,6 +3104,27 @@ Gfx* func_80095E10(Gfx* displayListHead, s8 textureFormat, s32 texScaleS, s32 te return displayListHead; } +// Cup select menu, an alt version to fix cup and trophy +Gfx* func_80095E10_alt(Gfx* displayListHead, s8 textureFormat, s32 texScaleS, s32 texScaleT, s32 srcX, s32 srcY, + s32 srcWidth, s32 srcHeight, s32 screenX, s32 screenY, u8* textureData, u32 texWidth, + u32 texHeight) { + if (GameEngine_ResourceGetTexTypeByName(textureData) != 1) { + gDPLoadTextureTile(displayListHead++, textureData, textureFormat, G_IM_SIZ_16b, texWidth, texHeight, srcX, srcY, + srcX + srcWidth - 1, srcY + srcHeight + 2, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 0, 0, G_TX_NOLOD, G_TX_NOLOD); + gSPWideTextureRectangle(displayListHead++, screenX << 2, screenY << 2, (screenX + srcWidth) << 2, + (screenY + srcHeight) << 2, G_TX_RENDERTILE, 0, 0, texScaleS, texScaleT); + } else { + gDPLoadTextureTile(displayListHead++, textureData, textureFormat, G_IM_SIZ_16b, texWidth, texHeight, srcX, srcY, + srcX + srcWidth - 2, srcY + srcHeight - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 0, 0, G_TX_NOLOD, G_TX_NOLOD); + gSPWideTextureRectangle(displayListHead++, screenX << 2, screenY << 2, (screenX + srcWidth) << 2, + (screenY + srcHeight) << 2, G_TX_RENDERTILE, 0, 0, texScaleS, texScaleT); + } + + return displayListHead; +} + Gfx* func_800963F0(Gfx* displayListHead, s8 textureFormat, s32 texScaleS, s32 texScaleT, f32 scaleX, f32 scaleY, s32 srcX, s32 srcY, s32 srcHeight, s32 srcWidth, s32 screenX, s32 screenY, u8* textureData, u32 texWidth, u32 texHeight) { @@ -4244,6 +4265,14 @@ void func_8009A76C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { } } +void func_8009A76C_alt(s32 arg0, s32 arg1, s32 arg2) { + struct_8018DEE0_entry* temp = &D_8018DEE0[arg0]; + if (temp->visible & 0x80000000) { + func_8009A878(temp); + gDisplayListHead = func_8009C434_alt(gDisplayListHead, temp, arg1, arg2); + } +} + void func_8009A7EC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { struct_8018DEE0_entry* temp = &D_8018DEE0[arg0]; if (temp->visible & 0x80000000) { @@ -4589,6 +4618,45 @@ Gfx* render_menu_textures(Gfx* arg0, MenuTexture* arg1, s32 column, s32 row) { return arg0; } +Gfx* render_menu_textures_alt(Gfx* arg0, MenuTexture* arg1, s32 column, s32 row) { + u8* temp_v0_3; + s8 var_s4; + + while (arg1->textureData != NULL) { + var_s4 = 0; + switch (arg1->type) { + case 0: + gSPDisplayList(arg0++, D_02007708); + break; + case 1: + gSPDisplayList(arg0++, D_02007728); + break; + case 2: + gSPDisplayList(arg0++, D_02007748); + break; + case 3: + gSPDisplayList(arg0++, D_02007768); + var_s4 = 3; + break; + case 4: + gSPDisplayList(arg0++, D_02007788); + break; + default: + gSPDisplayList(arg0++, D_02007728); + break; + } + if (gTransitionType[4] != 4) { + arg0 = func_80095E10_alt(arg0, var_s4, 0x00000400, 0x00000400, 0, 0, arg1->width, arg1->height, + arg1->dX + column, arg1->dY + row, arg1->textureData, arg1->width, arg1->height); + } else { + arg0 = func_800987D0(arg0, 0U, 0U, arg1->width, arg1->height, arg1->dX + column, arg1->dY + row, + arg1->textureData, arg1->width, arg1->height); + } + arg1++; + } + return arg0; +} + Gfx* func_8009BC9C(Gfx* arg0, MenuTexture* texProps, s32 arg2, s32 arg3, s32 arg4, s32 width) { MenuTexture* textureProps = segmented_to_virtual_dupe(texProps); u8* texture; @@ -4838,6 +4906,40 @@ Gfx* func_8009C434(Gfx* arg0, struct_8018DEE0_entry* arg1, s32 arg2, s32 arg3, s return arg0; } +Gfx* func_8009C434_alt(Gfx* arg0, struct_8018DEE0_entry* arg1, s32 arg2, s32 arg3) { + s32 var_t0; + s32 var_t1; + Gfx* temp; + MenuTexture* var_s0; + + var_s0 = arg1->textureSequence[arg1->sequenceIndex].mk64Texture; + temp = D_02007728; + while (var_s0->textureData != NULL) { + var_t1 = 0; + switch (var_s0->type) { + default: + gSPDisplayList(arg0++, temp); + break; + case 0: + gSPDisplayList(arg0++, D_02007708); + break; + case 1: + gSPDisplayList(arg0++, temp); + break; + case 3: + gSPDisplayList(arg0++, D_02007768); + var_t1 = 3; + break; + } + + arg0 = func_80095E10_alt(arg0, var_t1, 0x00000400, 0x00000400, 0, 0, var_s0->width, var_s0->height, + var_s0->dX + arg2, var_s0->dY + arg3, (u8*) var_s0->textureData, var_s0->width, + var_s0->height); + var_s0++; + } + return arg0; +} + Gfx* func_8009C708(Gfx* arg0, struct_8018DEE0_entry* arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { s32 var_t0; UNUSED s32 thing; @@ -7076,8 +7178,8 @@ void func_800A143C(MenuItem* arg0, s32 arg1) { case 0: case 2: case 3: - gDisplayListHead = - render_menu_textures(gDisplayListHead, gMenuTexturesTrackSelection[arg1 + 1], arg0->column, arg0->row); + gDisplayListHead = render_menu_textures_alt(gDisplayListHead, gMenuTexturesTrackSelection[arg1 + 1], + arg0->column, arg0->row); break; case 1: case 4: @@ -9675,7 +9777,7 @@ void render_battle_introduction(UNUSED MenuItem* arg0) { void func_800A8EC0(MenuItem* arg0) { if (arg0->param2 != 0) { - func_8009A76C(arg0->D_8018DEE0_index, arg0->column, arg0->row, -1); + func_8009A76C_alt(arg0->D_8018DEE0_index, arg0->column, arg0->row); set_text_color(TEXT_YELLOW); print_text_mode_1(arg0->column + 0x20, arg0->row + 0x28, gCupText[arg0->param2], 0, 0.7f, 0.7f); } diff --git a/src/menu_items.h b/src/menu_items.h index 7ba35d1e6..ae65961e4 100644 --- a/src/menu_items.h +++ b/src/menu_items.h @@ -459,6 +459,7 @@ Gfx* print_letter_wide_right(Gfx* arg0, MenuTexture* glyphTexture, f32 arg2, f32 f32 scaleY); Gfx* func_8009C204(Gfx*, MenuTexture*, s32, s32, s32); Gfx* func_8009C434(Gfx*, struct_8018DEE0_entry*, s32, s32, s32); +Gfx* func_8009C434_alt(Gfx*, struct_8018DEE0_entry*, s32, s32); Gfx* func_8009C708(Gfx*, struct_8018DEE0_entry*, s32, s32, s32, s32); void func_8009C918(void); void func_8009CA2C(void);