diff --git a/src/code_80057C60.c b/src/code_80057C60.c index d9be361fa..1db6761de 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -1122,7 +1122,8 @@ void render_hud_2p_vertical_player_two(void) { void render_hud_lap_3p_4p(s32 playerId) { if (gModeSelection != BATTLE) { if (D_801657F8 && gIsHUDVisible) { - draw_hud_2d_texture_32x8(playerHUD[playerId].lapX, playerHUD[playerId].lapY, (u8*) common_texture_hud_lap); + //draw_hud_2d_texture_32x8(playerHUD[playerId].lapX, playerHUD[playerId].lapY, (u8*) common_texture_hud_lap); + draw_hud_2d_texture(playerHUD[playerId].lapX, playerHUD[playerId].lapY, 32, 8, common_texture_hud_lap); draw_lap_count(playerHUD[playerId].lapX - 12, playerHUD[playerId].lapY + 4, playerHUD[playerId].alsoLapCount); } diff --git a/src/menu_items.c b/src/menu_items.c index a59a996b9..0918e8729 100644 --- a/src/menu_items.c +++ b/src/menu_items.c @@ -3230,7 +3230,15 @@ Gfx* func_800987D0(Gfx* displayListHead, u32 arg1, u32 arg2, u32 width, u32 heig return displayListHead; } -// draw a box filled with a solid color +/** + * Draw a box filled with a solid color + * + * Renders + * + * Menus: Black box behind textures such as: "1P Game, 2P Game, Mario GP, 50CC, OK, etc." + * + * + */ Gfx* draw_box_fill(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 red, s32 green, s32 blue, s32 alpha) { red &= 0xFF; green &= 0xFF; @@ -3269,6 +3277,17 @@ Gfx* draw_box_fill(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 } // draw a box filled with a solid color + +/** + * Draw a box filled with a solid color + * + * Renders + * + * All game modes: + * Cinematic borders + * + * + */ Gfx* draw_box_fill_wide(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 red, s32 green, s32 blue, s32 alpha) { red &= 0xFF; @@ -3309,7 +3328,12 @@ Gfx* draw_box_fill_wide(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry return displayListHead; } -// draw a box with a solid outline +/** + * Draw a box with a solid outline + * + * Menus best lap time at start menu + * + */ 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; @@ -3346,6 +3370,15 @@ Gfx* draw_box(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 red, return displayListHead; } +/** + * Renders + * + * Menus: Menu transition swipes, course label highlight + * + * All game modes: Background cover at pause screen + * + * + */ 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; @@ -3383,6 +3416,46 @@ Gfx* draw_box_wide(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 return displayListHead; } +// Renders pause background +Gfx* draw_box_wide_pause_background(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 >= SCREEN_WIDTH) || (uly >= SCREEN_HEIGHT)) { + // return displayListHead; + // } + + // if (ulx < 0) { + // ulx = 0; + // } + // if (uly < 0) { + // uly = 0; + // } + + // if ((lrx < 0) || (lry < 0)) { + // return displayListHead; + // } + // if (lrx > SCREEN_WIDTH) { + // lrx = SCREEN_WIDTH; + // } + // if (lry > SCREEN_HEIGHT) { + // lry = SCREEN_HEIGHT; + // } + gSPDisplayList(displayListHead++, D_02008008); + gDPSetPrimColor(displayListHead++, 0, 0, red, green, blue, alpha); + gDPFillWideRectangle(displayListHead++, ulx, uly, + lrx, lry); + gDPPipeSync(displayListHead++); + return displayListHead; +} + 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); } @@ -7838,6 +7911,8 @@ void render_pause_menu_versus(MenuItem* arg0) { s32 temp_t4; s32 var_s0; s32 var_s1; + s32 leftEdge; + s32 rightEdge; Unk_D_800E70A0* temp_s3; struct UnkStruct_800DC5EC* temp_v0; @@ -7846,8 +7921,41 @@ void render_pause_menu_versus(MenuItem* arg0) { temp_t0 = temp_v0->screenStartY; temp_t3 = temp_v0->screenWidth / 2; temp_t4 = temp_v0->screenHeight / 2; - 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); + + switch(gScreenModeSelection) { + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + leftEdge = OTRGetDimensionFromLeftEdge(0); + rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, leftEdge - rightEdge, temp_t0 - temp_t4, rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: + leftEdge = OTRGetDimensionFromLeftEdge(0); + rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, leftEdge - rightEdge, temp_t0 - temp_t4, leftEdge + rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + case SCREEN_MODE_3P_4P_SPLITSCREEN: + // Left side players + if ((temp_v0->player == gPlayerOne) || (temp_v0->player == gPlayerThree)) { + leftEdge = OTRGetDimensionFromLeftEdge(0); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, leftEdge - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + temp_t0 + temp_t4, 0, 0, 0, 140); + + // Right side players + } else if ((temp_v0->player == gPlayerTwo) || (temp_v0->player == gPlayerFour)) { + rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + + } + break; + default: + gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + } + temp_s3 = &D_800E8540[(gScreenModeSelection * 4) + (gIsGamePaused - 1)]; for (var_s0 = 0; var_s0 < 4; var_s0++) { if (var_s0 > 0) { @@ -7877,8 +7985,25 @@ void render_pause_grand_prix(MenuItem* arg0) { temp_t0 = temp_v0->screenStartY; temp_t3 = temp_v0->screenWidth / 2; temp_t4 = temp_v0->screenHeight / 2; - 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); + + switch(gScreenModeSelection) { + case SCREEN_MODE_1P: + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + 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); + break; + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: + s32 leftEdge = OTRGetDimensionFromLeftEdge(0); + s32 rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide(gDisplayListHead, leftEdge - rightEdge, temp_t0 - temp_t4, leftEdge + rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + default: + gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + } + temp_s3 = &D_800E85C0[(gScreenModeSelection * 4) + (gIsGamePaused - 1)]; temp_s0 = ((get_string_width(gCupNames[GetCupIndex()]) * one) + 10.0f) / 2; temp_s1 = ((get_string_width(D_800E76CC[gCCSelection]) * one) + 10.0f) / 2; @@ -7903,6 +8028,8 @@ void render_pause_battle(MenuItem* arg0) { s32 temp_t4; s32 var_a1; s32 var_s1; + s32 leftEdge; + s32 rightEdge; Unk_D_800E70A0* temp_s3; temp_v0 = &D_8015F480[gIsGamePaused - 1]; @@ -7910,8 +8037,41 @@ void render_pause_battle(MenuItem* arg0) { temp_t0 = temp_v0->screenStartY; temp_t3 = temp_v0->screenWidth / 2; temp_t4 = temp_v0->screenHeight / 2; - 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); + + switch(gScreenModeSelection) { + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + leftEdge = OTRGetDimensionFromLeftEdge(0); + rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, leftEdge - rightEdge, temp_t0 - temp_t4, rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: + leftEdge = OTRGetDimensionFromLeftEdge(0); + rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, leftEdge - rightEdge, temp_t0 - temp_t4, rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + case SCREEN_MODE_3P_4P_SPLITSCREEN: + // Left side players + if ((temp_v0->player == gPlayerOne) || (temp_v0->player == gPlayerThree)) { + leftEdge = OTRGetDimensionFromLeftEdge(0); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, leftEdge - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + temp_t0 + temp_t4, 0, 0, 0, 140); + + // Right side players + } else if ((temp_v0->player == gPlayerTwo) || (temp_v0->player == gPlayerFour)) { + rightEdge = OTRGetDimensionFromRightEdge(SCREEN_WIDTH); + gDisplayListHead = draw_box_wide_pause_background(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + rightEdge, + temp_t0 + temp_t4, 0, 0, 0, 140); + + } + break; + default: + gDisplayListHead = draw_box(gDisplayListHead, temp_v1 - temp_t3, temp_t0 - temp_t4, temp_v1 + temp_t3, + temp_t0 + temp_t4, 0, 0, 0, 140); + break; + } + temp_s3 = &D_800E8600[(gScreenModeSelection * 4) + (gIsGamePaused - 1)]; for (var_a1 = 0; var_a1 < 4; var_a1++) { if (var_a1 > 0) { @@ -7919,7 +8079,7 @@ void render_pause_battle(MenuItem* arg0) { } else { var_s1 = var_a1; } - text_rainbow_effect(arg0->state - 0x29, var_a1, TEXT_YELLOW); + text_rainbow_effect(arg0->state - 41, var_a1, TEXT_YELLOW); print_text_mode_1(temp_s3->column - 2, temp_s3->row + 13 * var_a1, gTextPauseButton[var_s1], 0, 0.75f, 0.75f); } } diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 59d76cfb9..4b6b9b2c9 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -449,6 +449,28 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) { return ((int) ceilf(OTRGetDimensionFromRightEdge(v))); } +/** + * Centers an item in a given area. + * + * Adds the number of extended screen pixels to the location to center. + * This allows stretching the game window really wide, and the item will stay in-place. + * + * This is not for centering in the direct center of the screen. + * + * How to use: + * + * s32 center = OTRCalculateCenterOfAreaFromRightEdge((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); + * x = center - (texWidth / 2) + * x2 = center + (texWidth / 2) + */ +extern "C" uint32_t OTRCalculateCenterOfAreaFromRightEdge(int32_t center) { + return ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + center; +} + +extern "C" uint32_t OTRCalculateCenterOfAreaFromLeftEdge(int32_t center) { + return ((OTRGetDimensionFromLeftEdge(0) - SCREEN_WIDTH) / 2) + center; +} + // Gets the width of the current render target area extern "C" uint32_t OTRGetGameRenderWidth() { return gfx_current_dimensions.width; diff --git a/src/port/Engine.h b/src/port/Engine.h index 36d78d1fe..ffc3af112 100644 --- a/src/port/Engine.h +++ b/src/port/Engine.h @@ -52,6 +52,8 @@ class GameEngine { int16_t OTRGetRectDimensionFromRightEdge(float v); uint32_t OTRGetGameRenderWidth(); uint32_t OTRGetGameRenderHeight(); + uint32_t OTRCalculateCenterOfAreaFromRightEdge(int32_t center); + uint32_t OTRCalculateCenterOfAreaFromLeftEdge(int32_t center); }; #else void GameEngine_ProcessGfxCommands(Gfx* commands); @@ -73,4 +75,6 @@ int16_t OTRGetRectDimensionFromLeftEdge(float v); int16_t OTRGetRectDimensionFromRightEdge(float v); uint32_t OTRGetGameRenderWidth(void); uint32_t OTRGetGameRenderHeight(void); +uint32_t OTRCalculateCenterOfAreaFromRightEdge(int32_t center); +uint32_t OTRCalculateCenterOfAreaFromLeftEdge(int32_t center); #endif diff --git a/src/racing/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c index e81ef92b0..8ceac1314 100644 --- a/src/racing/skybox_and_splitscreen.c +++ b/src/racing/skybox_and_splitscreen.c @@ -303,11 +303,11 @@ void func_802A4300(void) { gDPFillRectangle(gDisplayListHead++, 157, 0, 159, 239); break; case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: - gDPFillRectangle(gDisplayListHead++, 0, 119, 319, 121); + gDPFillWideRectangle(gDisplayListHead++, OTRGetDimensionFromLeftEdge(0), 119, OTRGetGameRenderWidth(), 121); break; case SCREEN_MODE_3P_4P_SPLITSCREEN: gDPFillRectangle(gDisplayListHead++, 157, 0, 159, 239); - gDPFillRectangle(gDisplayListHead++, 0, 119, 319, 121); + gDPFillWideRectangle(gDisplayListHead++, OTRGetDimensionFromLeftEdge(0), 119, OTRGetGameRenderWidth(), 121); break; } gDPPipeSync(gDisplayListHead++); diff --git a/src/render_objects.c b/src/render_objects.c index 749e88fc2..188a44e3f 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -1535,6 +1535,15 @@ void func_8004B72C(s32 primRed, s32 primGreen, s32 primBlue, s32 envRed, s32 env PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); } +/** + * Renders + * + * Menus: Mario Kart 64 Logo, Debug text + * + * 1P: Coloured square in third hud mode that players go around. + * + * + */ void render_texture_rectangle(s32 x, s32 y, s32 width, s32 height, s32 s, s32 w, s32 mode) { s32 xh = (((x + width) - 1) << 2); @@ -1557,12 +1566,21 @@ void render_texture_rectangle(s32 x, s32 y, s32 width, s32 height, s32 s, s32 w, 1 << 10); } +/** + * Renders + * + * For all game modes + * + * Minimap, CurrLap, Lap time + * + * + */ void render_texture_rectangle_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 yl = y << 2; s32 xh2 = (((x + width))); s32 yh2 = ((y + height) << 2); @@ -1574,33 +1592,68 @@ void render_texture_rectangle_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4 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; + switch(gScreenModeSelection) { + case SCREEN_MODE_1P: + case SCREEN_MODE_3P_4P_SPLITSCREEN: + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + 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); + break; + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: + gSPTextureRectangle(gDisplayListHead++, xl << 2, yl, xh << 2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + 1 << 10); + break; + case 999: + gSPTextureRectangle(gDisplayListHead++, xl << 2, yl, xh << 2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + 1 << 10); + break; } - //! @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; + } else { // minimap + switch(gScreenModeSelection) { + case SCREEN_MODE_3P_4P_SPLITSCREEN: + if (gPlayerCount == 3) { + s32 renderWidth = SCREEN_WIDTH; + // 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; + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, + coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + 1 << 10); + } else { // 4 players + s32 renderWidth = SCREEN_WIDTH; + s32 center = (renderWidth / 2); + coordX = (s32)(center - (width / 2)) << 2; + coordX2 = (s32)(center + (width / 2)) << 2; + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, + coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + 1 << 10); + } + break; + default: + 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); + break; } - 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); @@ -1636,6 +1689,7 @@ void func_8004B97C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } } +// Positions item window, the Lap 1/2/3, TIME texture, and minimap on the screen. void func_8004B97C_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { UNUSED s32 pad[2]; s32 sp2C; @@ -1715,6 +1769,7 @@ void func_8004BA98(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s } } +// Display lap count (but not the texture that says lap) void func_8004BA98_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { UNUSED s32 pad[2]; s32 sp34; @@ -1741,7 +1796,16 @@ void func_8004BA98_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 ar sp30 = 0; phi_a3 = arg3 + arg1; } - render_texture_rectangle_wide(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); + + switch(gScreenModeSelection) { + case SCREEN_MODE_1P: + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + render_texture_rectangle_wide(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); + break; + default: + render_texture_rectangle(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); + break; + } } } @@ -1846,6 +1910,15 @@ UNUSED void func_8004C35C() { } void draw_hud_2d_texture(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(x - (width >> 1), y - (height >> 1), width, height, 0); + gSPDisplayList(gDisplayListHead++, D_0D007EB8); +} + +void draw_hud_2d_texture_wide(s32 x, s32 y, u32 width, u32 height, u8* texture) { gSPDisplayList(gDisplayListHead++, D_0D008108); gSPDisplayList(gDisplayListHead++, D_0D007EF8); gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); @@ -1951,23 +2024,23 @@ void func_8004CA58(s32 arg0, s32 arg1, f32 arg2, u8* texture, s32 arg4, s32 arg5 } void draw_hud_2d_texture_8x8(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 8, 8, texture); + draw_hud_2d_texture_wide(x, y, 8, 8, texture); } UNUSED void draw_hud_2d_texture_8x16(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 8, 16, texture); + draw_hud_2d_texture_wide(x, y, 8, 16, texture); } UNUSED void draw_hud_2d_texture_16x16(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 16, 16, texture); + draw_hud_2d_texture_wide(x, y, 16, 16, texture); } void draw_hud_2d_texture_32x8(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 32, 8, texture); + draw_hud_2d_texture_wide(x, y, 32, 8, texture); } void draw_hud_2d_texture_32x16(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 32, 16, texture); + draw_hud_2d_texture_wide(x, y, 32, 16, texture); } UNUSED void func_8004CBC0(s32 arg0, s32 arg1, f32 arg2, u8* texture) { @@ -1975,7 +2048,7 @@ UNUSED void func_8004CBC0(s32 arg0, s32 arg1, f32 arg2, u8* texture) { } UNUSED void draw_hud_2d_texture_32x32(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 32, 32, texture); + draw_hud_2d_texture_wide(x, y, 32, 32, texture); } UNUSED void func_8004CC24(s32 arg0, s32 arg1, u8* texture) { @@ -1983,7 +2056,7 @@ UNUSED void func_8004CC24(s32 arg0, s32 arg1, u8* texture) { } UNUSED void draw_hud_2d_texture_40x32(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 40, 32, texture); + draw_hud_2d_texture_wide(x, y, 40, 32, texture); } UNUSED void func_8004CC84(s32 x, s32 y, u8* texture) { @@ -1991,7 +2064,7 @@ UNUSED void func_8004CC84(s32 x, s32 y, u8* texture) { } UNUSED void func_8004CCB4(s32 x, s32 y, u8* texture) { - draw_hud_2d_texture(x, y, 64, 32, texture); + draw_hud_2d_texture_wide(x, y, 64, 32, texture); } UNUSED void func_8004CCE4(s32 arg0, s32 arg1, f32 arg2, u8* texture) { @@ -2460,7 +2533,8 @@ void draw_simplified_lap_count(s32 playerId) { draw_hud_2d_texture_32x8((s32) playerHUD[playerId].lapX, playerHUD[playerId].lapY + 3, (u8*) common_texture_hud_lap); draw_hud_2d_texture_32x16(playerHUD[playerId].lapX + 0x1C, (s32) playerHUD[playerId].lapY, - (u8*) gHudLapTextures[playerHUD[playerId].alsoLapCount]); + (u8*) gHudLapTextures[playerHUD[playerId].alsoLapCount]); + } void func_8004E800(s32 playerId) { @@ -2565,7 +2639,6 @@ void func_8004F020(s32 arg0) { f32 var_f2; //! @todo: Hardcode these x and y values. Because why not? - CourseManager_MinimapFinishlinePosition(); var_f2 = ((D_8018D2C0[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + D_8018D2E0; var_f0 = ((D_8018D2D8[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + D_8018D2E8; @@ -2577,6 +2650,8 @@ void func_8004F020(s32 arg0) { var_f0 = var_f0 + 4.0; } + //! @todo Get course minimap props from course. + CourseManager_MinimapFinishlinePosition(); draw_hud_2d_texture_8x8(var_f2, var_f0, (u8*) common_texture_minimap_finish_line); } @@ -2624,7 +2699,7 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) { if (gGPCurrentRaceRankByPlayerId[playerId] == 0) { func_8004C450(temp_a0, temp_a1, 8, 8, (u8*) common_texture_minimap_progress_dot); } else { - draw_hud_2d_texture(temp_a0, temp_a1, 8, 8, (u8*) common_texture_minimap_progress_dot); + draw_hud_2d_texture_wide(temp_a0, temp_a1, 8, 8, (u8*) common_texture_minimap_progress_dot); } } } diff --git a/src/render_objects.h b/src/render_objects.h index 61ec7d80b..007944706 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -217,7 +217,7 @@ void func_8004C024(s16, s16, s16, u16, u16, u16, u16); void func_8004C148(s16, s16, s16, u16, u16, u16, u16); void func_8004C354(void); void func_8004C35C(void); -void draw_hud_2d_texture(s32, s32, u32, u32, u8*); +void draw_hud_2d_texture_wide(s32, s32, u32, u32, u8*); void func_8004C450(s32, s32, u32, u32, u8*); void func_8004C53C(s32, s32, u32, u32, u8*); void func_8004C628(s32, s32, u32, u32, u8*);