From fb18da239fbce7bc923eb737a0070986c32542d1 Mon Sep 17 00:00:00 2001 From: Matthew Coppola Date: Fri, 15 Nov 2024 02:59:58 -0500 Subject: [PATCH] Move subpixel offset code & fix radar UV map The subpixel offset code has been moved into the draw_rectangle function, so it can be applied to more than just the fill_rectangle function. The radar texture was displaced along its V component and has been corrected. It has also been subpixel-adjusted to align with the player's radar dot. --- port/fast3d/gfx_pc.cpp | 10 +++++----- src/game/radar.c | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/port/fast3d/gfx_pc.cpp b/port/fast3d/gfx_pc.cpp index 8e701c9fd..0acaff3fc 100644 --- a/port/fast3d/gfx_pc.cpp +++ b/port/fast3d/gfx_pc.cpp @@ -1985,6 +1985,11 @@ static void gfx_draw_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lr rdp.other_mode_h = (rdp.other_mode_h & ~(3U << G_MDSFT_TEXTFILT)) | G_TF_POINT; } + ulx += rdp.subpixel_ofs_x; + lrx += rdp.subpixel_ofs_x; + uly += rdp.subpixel_ofs_y; + lry += rdp.subpixel_ofs_y; + // U10.2 coordinates float ulxf = ulx; float ulyf = uly; @@ -2188,11 +2193,6 @@ static void gfx_dp_fill_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t gfx_dp_set_combine_mode(color_comb(0, 0, 0, G_CCMUX_SHADE), alpha_comb(0, 0, 0, G_ACMUX_SHADE), 0, 0); } - ulx += rdp.subpixel_ofs_x; - lrx += rdp.subpixel_ofs_x; - uly += rdp.subpixel_ofs_y; - lry += rdp.subpixel_ofs_y; - gfx_draw_rectangle(ulx, uly, lrx, lry); rdp.combine_mode = saved_combine_mode; } diff --git a/src/game/radar.c b/src/game/radar.c index 2a449e034..d289a9a04 100644 --- a/src/game/radar.c +++ b/src/game/radar.c @@ -80,7 +80,7 @@ Gfx *radarRenderBackground(Gfx *gdl, struct textureconfig *tconfig, s32 arg2, s3 texSelect(&gdl, tconfig, 2, 0, 0, 1, NULL); func0f0b278c(&gdl, spb0, spa8, tconfig->width, tconfig->height, - 0, 0, 1, 0, 0xff, 0, 40, tconfig->level > 0, 0); + 0, 0, 0, 0, 0xff, 0, 40, tconfig->level > 0, 0); gDPPipeSync(gdl++); gDPSetColorDither(gdl++, G_CD_BAYER); @@ -329,6 +329,7 @@ Gfx *radarRender(Gfx *gdl) } #ifndef PLATFORM_N64 gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR); + gDPSetSubpixelOffsetEXT(gdl++, -2, 2); #endif } @@ -337,6 +338,7 @@ Gfx *radarRender(Gfx *gdl) // Draw dots for human players #ifndef PLATFORM_N64 + gDPSetSubpixelOffsetEXT(gdl++, 0, 0); if (!(g_MpSetup.options & MPOPTION_NOPLAYERONRADAR)) { #endif for (i = 0; i < playercount; i++) {