From 942c966bf25af2f6256bd6cc65636d6987ca0d14 Mon Sep 17 00:00:00 2001 From: Matthew Coppola Date: Tue, 29 Oct 2024 04:21:10 -0400 Subject: [PATCH] Replace centered rects with subpixel offsets --- port/fast3d/gfx_pc.cpp | 60 ++++++++--------------- src/game/bondview.c | 24 ++++++---- src/game/sight.c | 106 ++++++++++++++++++++++------------------- src/include/gbiex.h | 23 ++++----- 4 files changed, 103 insertions(+), 110 deletions(-) diff --git a/port/fast3d/gfx_pc.cpp b/port/fast3d/gfx_pc.cpp index 43713c67d..8e701c9fd 100644 --- a/port/fast3d/gfx_pc.cpp +++ b/port/fast3d/gfx_pc.cpp @@ -192,6 +192,9 @@ static struct RDP { bool viewport_or_scissor_changed; void* z_buf_address; void* color_image_address; + + int16_t subpixel_ofs_x; + int16_t subpixel_ofs_y; } rdp; static struct RenderingState { @@ -1969,6 +1972,11 @@ static void gfx_dp_set_fill_color(uint32_t packed_color) { rdp.fill_color.a = a * 255; } +static void gfx_dp_set_subpixel_offset(int16_t x, int16_t y) { + rdp.subpixel_ofs_x = x; + rdp.subpixel_ofs_y = y; +} + static void gfx_draw_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry) { uint32_t saved_other_mode_h = rdp.other_mode_h; uint32_t cycle_type = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)); @@ -2148,10 +2156,10 @@ static void gfx_dp_image_rectangle(int32_t tile, int32_t w, int32_t h, rdp.combine_mode = saved_combine_mode; } -static int gfx_dp_fill_rectangle_common(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry, uint64_t *saved_combine_mode) { +static void gfx_dp_fill_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry) { if (rdp.color_image_address == rdp.z_buf_address) { // Don't clear Z buffer here since we already did it with glClear - return 1; + return; } uint32_t mode = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)); @@ -2174,39 +2182,19 @@ static int gfx_dp_fill_rectangle_common(int32_t ulx, int32_t uly, int32_t lrx, i v->color = rdp.fill_color; } - *saved_combine_mode = rdp.combine_mode; + uint64_t saved_combine_mode = rdp.combine_mode; if (mode == G_CYC_FILL) { gfx_dp_set_combine_mode(color_comb(0, 0, 0, G_CCMUX_SHADE), alpha_comb(0, 0, 0, G_ACMUX_SHADE), 0, 0); } - return 0; -} + ulx += rdp.subpixel_ofs_x; + lrx += rdp.subpixel_ofs_x; + uly += rdp.subpixel_ofs_y; + lry += rdp.subpixel_ofs_y; -static void gfx_dp_fill_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry) { - uint64_t saved_combine_mode; - if (gfx_dp_fill_rectangle_common(ulx, uly, lrx, lry, &saved_combine_mode) == 0) { - gfx_draw_rectangle(ulx, uly, lrx, lry); - rdp.combine_mode = saved_combine_mode; - } -} - -static void gfx_dp_fill_rectangle_centered(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry) { - uint64_t saved_combine_mode; - if (gfx_dp_fill_rectangle_common(ulx, uly, lrx, lry, &saved_combine_mode) == 0) { - // The coordinates of the rect are usually quantized to the default N64 - // resolution (320x220), but adding the rect to the graphics display - // list scales it by four. So, a single pixel at 320x220 becomes four - // pixels at 1280x880. Since the crosshair was misaligned by half a - // native pixel, we need to shift the crosshair by two scaled pixels. - ulx -= 2; - lrx -= 2; - uly -= 2; - lry -= 2; - - gfx_draw_rectangle(ulx, uly, lrx, lry); - rdp.combine_mode = saved_combine_mode; - } + gfx_draw_rectangle(ulx, uly, lrx, lry); + rdp.combine_mode = saved_combine_mode; } static void gfx_dp_set_z_image(void* z_buf_address) { @@ -2386,6 +2374,10 @@ static void gfx_run_dl(Gfx* cmd) { break; // G_SETPRIMCOLOR, G_CCMUX_PRIMITIVE, G_ACMUX_PRIMITIVE, is used by Goddard // G_CCMUX_TEXEL1, LOD_FRACTION is used in Bowser room 1 + case G_SETSUBPIXELOFFSET_EXT: { + gfx_dp_set_subpixel_offset(C0(0, 16), C1(0, 16)); + break; + } case G_TEXRECT: case G_TEXRECTFLIP: { int32_t lrx, lry, tile, ulx, uly; @@ -2417,16 +2409,6 @@ static void gfx_run_dl(Gfx* cmd) { gfx_dp_fill_rectangle(ulx, uly, lrx, lry); break; } - case G_FILLRECT_CENTERED_WIDE_EXT: { - int32_t lrx, lry, ulx, uly; - lrx = (int32_t)(C0(0, 24) << 8) >> 8; - lry = (int32_t)(C1(0, 24) << 8) >> 8; - ++cmd; - ulx = (int32_t)(C0(0, 24) << 8) >> 8; - uly = (int32_t)(C1(0, 24) << 8) >> 8; - gfx_dp_fill_rectangle_centered(ulx, uly, lrx, lry); - break; - } case G_TEXRECT_WIDE_EXT: { int32_t lrx, lry, tile, ulx, uly; uint32_t uls, ult, dsdx, dtdy; diff --git a/src/game/bondview.c b/src/game/bondview.c index 935476d6c..f6554a991 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -1109,14 +1109,22 @@ Gfx *bviewDrawEyespyMetrics(Gfx *gdl) s32 x = viewleft + (viewwidth >> 1); s32 y = viewtop + (viewheight >> 1); - gDPFillRectangleCenteredEXT(gdl++, x + 2, y + 0, x + 7, y + 1); - gDPFillRectangleCenteredEXT(gdl++, x + 2, y + 0, x + 5, y + 1); - gDPFillRectangleCenteredEXT(gdl++, x - 6, y + 0, x - 1, y + 1); - gDPFillRectangleCenteredEXT(gdl++, x - 4, y + 0, x - 1, y + 1); - gDPFillRectangleCenteredEXT(gdl++, x + 0, y + 2, x + 1, y + 7); - gDPFillRectangleCenteredEXT(gdl++, x + 0, y + 2, x + 1, y + 5); - gDPFillRectangleCenteredEXT(gdl++, x + 0, y - 6, x + 1, y - 1); - gDPFillRectangleCenteredEXT(gdl++, x + 0, y - 4, x + 1, y - 1); +#ifndef PLATFORM_N64 + gDPSetSubpixelOffsetEXT(gdl++, -2, -2); +#endif + + gDPFillRectangle(gdl++, x + 2, y + 0, x + 7, y + 1); + gDPFillRectangle(gdl++, x + 2, y + 0, x + 5, y + 1); + gDPFillRectangle(gdl++, x - 6, y + 0, x - 1, y + 1); + gDPFillRectangle(gdl++, x - 4, y + 0, x - 1, y + 1); + gDPFillRectangle(gdl++, x + 0, y + 2, x + 1, y + 7); + gDPFillRectangle(gdl++, x + 0, y + 2, x + 1, y + 5); + gDPFillRectangle(gdl++, x + 0, y - 6, x + 1, y - 1); + gDPFillRectangle(gdl++, x + 0, y - 4, x + 1, y - 1); + +#ifndef PLATFORM_N64 + gDPSetSubpixelOffsetEXT(gdl++, 0, 0); +#endif } if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { diff --git a/src/game/sight.c b/src/game/sight.c index a3bdd642f..2fe7cc047 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -515,42 +515,44 @@ Gfx *sightDrawAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colou #ifndef PLATFORM_N64 x = sightGetAdjustedX(x); gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, -2, -2); #endif // Draw the lines that span most of the viewport if (PLAYERCOUNT() == 1) { - gDPHudRectangleCentered(gdl++, viewleft + 48, y, x - radius + 2, y); - gDPHudRectangleCentered(gdl++, x + radius - 2, y, viewright - 49, y); - gDPHudRectangleCentered(gdl++, x, viewtop + 10, x, y - radius + 2); - gDPHudRectangleCentered(gdl++, x, y + radius - 2, x, viewbottom - 10); + gDPHudRectangle(gdl++, viewleft + 48, y, x - radius + 2, y); + gDPHudRectangle(gdl++, x + radius - 2, y, viewright - 49, y); + gDPHudRectangle(gdl++, x, viewtop + 10, x, y - radius + 2); + gDPHudRectangle(gdl++, x, y + radius - 2, x, viewbottom - 10); } else { - gDPHudRectangleCentered(gdl++, viewleft, y, x - radius + 2, y); - gDPHudRectangleCentered(gdl++, x + radius - 2, y, viewright, y); - gDPHudRectangleCentered(gdl++, x, viewtop, x, y - radius + 2); - gDPHudRectangleCentered(gdl++, x, y + radius - 2, x, viewbottom); + gDPHudRectangle(gdl++, viewleft, y, x - radius + 2, y); + gDPHudRectangle(gdl++, x + radius - 2, y, viewright, y); + gDPHudRectangle(gdl++, x, viewtop, x, y - radius + 2); + gDPHudRectangle(gdl++, x, y + radius - 2, x, viewbottom); } gdl = text0f153838(gdl); gdl = textSetPrimColour(gdl, colour); // Draw the box - gDPHudRectangleCentered(gdl++, x - radius, y - radius, x - radius, y + radius); - gDPHudRectangleCentered(gdl++, x + radius, y - radius, x + radius, y + radius); - gDPHudRectangleCentered(gdl++, x - radius, y - radius, x + radius, y - radius); - gDPHudRectangleCentered(gdl++, x - radius, y + radius, x + radius, y + radius); + gDPHudRectangle(gdl++, x - radius, y - radius, x - radius, y + radius); + gDPHudRectangle(gdl++, x + radius, y - radius, x + radius, y + radius); + gDPHudRectangle(gdl++, x - radius, y - radius, x + radius, y - radius); + gDPHudRectangle(gdl++, x - radius, y + radius, x + radius, y + radius); // Go over the corners a second time - gDPHudRectangleCentered(gdl++, x - radius, y - radius, x - radius, y - cornergap); - gDPHudRectangleCentered(gdl++, x - radius, y + cornergap, x - radius, y + radius); - gDPHudRectangleCentered(gdl++, x + radius, y - radius, x + radius, y - cornergap); - gDPHudRectangleCentered(gdl++, x + radius, y + cornergap, x + radius, y + radius); - gDPHudRectangleCentered(gdl++, x - radius, y - radius, x - cornergap, y - radius); - gDPHudRectangleCentered(gdl++, x + cornergap, y - radius, x + radius, y - radius); - gDPHudRectangleCentered(gdl++, x - radius, y + radius, x - cornergap, y + radius); - gDPHudRectangleCentered(gdl++, x + cornergap, y + radius, x + radius, y + radius); + gDPHudRectangle(gdl++, x - radius, y - radius, x - radius, y - cornergap); + gDPHudRectangle(gdl++, x - radius, y + cornergap, x - radius, y + radius); + gDPHudRectangle(gdl++, x + radius, y - radius, x + radius, y - cornergap); + gDPHudRectangle(gdl++, x + radius, y + cornergap, x + radius, y + radius); + gDPHudRectangle(gdl++, x - radius, y - radius, x - cornergap, y - radius); + gDPHudRectangle(gdl++, x + cornergap, y - radius, x + radius, y - radius); + gDPHudRectangle(gdl++, x - radius, y + radius, x - cornergap, y + radius); + gDPHudRectangle(gdl++, x + cornergap, y + radius, x + radius, y + radius); #ifndef PLATFORM_N64 gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, 0, 0); #endif gdl = text0f153838(gdl); @@ -1354,47 +1356,49 @@ Gfx *sightDrawZoom(Gfx *gdl, bool sighton) #ifndef PLATFORM_N64 gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, -2, -2); #endif // Top left - gDPHudRectangleCentered(gdl++, BOXLEFT + 1, BOXTOP, BOXLEFT + cornerwidth - 1, BOXTOP); - gDPHudRectangleCentered(gdl++, BOXLEFT, BOXTOP, BOXLEFT, BOXTOP + cornerheight - 1); + gDPHudRectangle(gdl++, BOXLEFT + 1, BOXTOP, BOXLEFT + cornerwidth - 1, BOXTOP); + gDPHudRectangle(gdl++, BOXLEFT, BOXTOP, BOXLEFT, BOXTOP + cornerheight - 1); // Top right - gDPHudRectangleCentered(gdl++, BOXRIGHT - cornerwidth + 2, BOXTOP, BOXRIGHT - 1, BOXTOP); - gDPHudRectangleCentered(gdl++, BOXRIGHT, BOXTOP, BOXRIGHT, BOXTOP + cornerheight - 1); + gDPHudRectangle(gdl++, BOXRIGHT - cornerwidth + 2, BOXTOP, BOXRIGHT - 1, BOXTOP); + gDPHudRectangle(gdl++, BOXRIGHT, BOXTOP, BOXRIGHT, BOXTOP + cornerheight - 1); // Bottom left - gDPHudRectangleCentered(gdl++, BOXLEFT + 1, BOXBOTTOM, BOXLEFT + cornerwidth - 1, BOXBOTTOM); - gDPHudRectangleCentered(gdl++, BOXLEFT, BOXBOTTOM - cornerheight + 1, BOXLEFT, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXLEFT + 1, BOXBOTTOM, BOXLEFT + cornerwidth - 1, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXLEFT, BOXBOTTOM - cornerheight + 1, BOXLEFT, BOXBOTTOM); // Bottom right - gDPHudRectangleCentered(gdl++, BOXRIGHT - cornerwidth + 2, BOXBOTTOM, BOXRIGHT - 1, BOXBOTTOM); - gDPHudRectangleCentered(gdl++, BOXRIGHT, BOXBOTTOM - cornerheight + 1, BOXRIGHT, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXRIGHT - cornerwidth + 2, BOXBOTTOM, BOXRIGHT - 1, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXRIGHT, BOXBOTTOM - cornerheight + 1, BOXRIGHT, BOXBOTTOM); // Draw over the corners again, but only half as wide/high cornerwidth >>= 1; cornerheight >>= 1; // Top left - gDPHudRectangleCentered(gdl++, BOXLEFT, BOXTOP, BOXLEFT + cornerwidth, BOXTOP); - gDPHudRectangleCentered(gdl++, BOXLEFT, BOXTOP, BOXLEFT, BOXTOP + cornerheight); + gDPHudRectangle(gdl++, BOXLEFT, BOXTOP, BOXLEFT + cornerwidth, BOXTOP); + gDPHudRectangle(gdl++, BOXLEFT, BOXTOP, BOXLEFT, BOXTOP + cornerheight); // Top right - gDPHudRectangleCentered(gdl++, BOXRIGHT - cornerwidth, BOXTOP, BOXRIGHT, BOXTOP); - gDPHudRectangleCentered(gdl++, BOXRIGHT, BOXTOP, BOXRIGHT, BOXTOP + cornerheight); + gDPHudRectangle(gdl++, BOXRIGHT - cornerwidth, BOXTOP, BOXRIGHT, BOXTOP); + gDPHudRectangle(gdl++, BOXRIGHT, BOXTOP, BOXRIGHT, BOXTOP + cornerheight); // Bottom left - gDPHudRectangleCentered(gdl++, BOXLEFT, BOXBOTTOM, BOXLEFT + cornerwidth, BOXBOTTOM); - gDPHudRectangleCentered(gdl++, BOXLEFT, BOXBOTTOM - cornerheight, BOXLEFT, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXLEFT, BOXBOTTOM, BOXLEFT + cornerwidth, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXLEFT, BOXBOTTOM - cornerheight, BOXLEFT, BOXBOTTOM); // Bottom right - gDPHudRectangleCentered(gdl++, BOXRIGHT - cornerwidth, BOXBOTTOM, BOXRIGHT, BOXBOTTOM); - gDPHudRectangleCentered(gdl++, BOXRIGHT, BOXBOTTOM - cornerheight, BOXRIGHT, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXRIGHT - cornerwidth, BOXBOTTOM, BOXRIGHT, BOXBOTTOM); + gDPHudRectangle(gdl++, BOXRIGHT, BOXBOTTOM - cornerheight, BOXRIGHT, BOXBOTTOM); #ifndef PLATFORM_N64 gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, 0, 0); #endif gdl = text0f153838(gdl); @@ -1433,6 +1437,7 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton) #ifndef PLATFORM_N64 x = sightGetAdjustedX(x); gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, -2, -2); #endif vertices = gfxAllocateVertices(8); @@ -1498,15 +1503,16 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton) gdl = textSetPrimColour(gdl, SIGHT_COLOUR); // Draw border over inner points - gDPHudRectangleCentered(gdl++, x - 4, y - 4, x - 4, y + 4); // left - gDPHudRectangleCentered(gdl++, x + 4, y - 4, x + 4, y + 4); // right - gDPHudRectangleCentered(gdl++, x - 4, y - 4, x + 4, y - 4); // top - gDPHudRectangleCentered(gdl++, x - 4, y + 4, x + 4, y + 4); // bottom + gDPHudRectangle(gdl++, x - 4, y - 4, x - 4, y + 4); // left + gDPHudRectangle(gdl++, x + 4, y - 4, x + 4, y + 4); // right + gDPHudRectangle(gdl++, x - 4, y - 4, x + 4, y - 4); // top + gDPHudRectangle(gdl++, x - 4, y + 4, x + 4, y + 4); // bottom gdl = text0f153838(gdl); #ifndef PLATFORM_N64 gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, 0, 0); #endif return gdl; @@ -1527,24 +1533,26 @@ Gfx *sightDrawTarget(Gfx *gdl) #ifndef PLATFORM_N64 gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, -2, -2); if (SIGHT_SCALE == 0) { // Draw single rectangle to preserve intended opacity - gDPHudRectangleCentered(gdl++, x, y, x, y); + gDPHudRectangle(gdl++, x, y, x, y); } else #endif { - gDPHudRectangleCentered(gdl++, x + 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x + 3 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x + 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x + 2 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x - 3 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x - 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x - 2 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x - 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x + 0 * SIGHT_SCALE, y + 1 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y + 3 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x + 0 * SIGHT_SCALE, y + 1 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y + 2 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x + 0 * SIGHT_SCALE, y - 3 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y - 1 * SIGHT_SCALE); - gDPHudRectangleCentered(gdl++, x + 0 * SIGHT_SCALE, y - 2 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y - 1 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x + 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x + 3 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x + 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x + 2 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x - 3 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x - 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x - 2 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x - 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y + 1 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y + 3 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y + 1 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y + 2 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y - 3 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y - 1 * SIGHT_SCALE); + gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y - 2 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y - 1 * SIGHT_SCALE); } #ifndef PLATFORM_N64 gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); + gDPSetSubpixelOffsetEXT(gdl++, 0, 0); #endif gdl = text0f153838(gdl); diff --git a/src/include/gbiex.h b/src/include/gbiex.h index c16107b87..687d08d90 100644 --- a/src/include/gbiex.h +++ b/src/include/gbiex.h @@ -196,7 +196,7 @@ #define G_IMAGERECT_EXT 0x42 #define G_RDPFLUSH_EXT 0x43 #define G_CLEAR_DEPTH_EXT 0x44 -#define G_FILLRECT_CENTERED_WIDE_EXT 0x45 +#define G_SETSUBPIXELOFFSET_EXT 0x45 /* G_EXTRAGEOMETRYMODE flags */ @@ -261,16 +261,6 @@ _g1->words.w1 = _SHIFTL((uly), 2, 22); \ } -#define gDPFillRectangleCenteredWideEXT(pkt, ulx, uly, lrx, lry) \ -{ \ - Gfx *_g0 = (Gfx*)(pkt), *_g1 = (Gfx*)(pkt); \ - \ - _g0->words.w0 = _SHIFTL(G_FILLRECT_CENTERED_WIDE_EXT, 24, 8) | _SHIFTL((lrx), 2, 22); \ - _g0->words.w1 = _SHIFTL((lry), 2, 22); \ - _g1->words.w0 = _SHIFTL((ulx), 2, 22); \ - _g1->words.w1 = _SHIFTL((uly), 2, 22); \ -} - #define gSPTextureRectangleWideEXT(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy, flip) \ { \ Gfx *_g0 = (Gfx*)(pkt), *_g1 = (Gfx*)(pkt), *_g2 = (Gfx*)(pkt); \ @@ -303,11 +293,18 @@ _g->words.w1 = (u32)(s); \ } +#define gDPSetSubpixelOffsetEXT(pkt, x, y) \ +{ \ + Gfx *_g = (Gfx*)(pkt); \ + \ + _g->words.w0 = _SHIFTL(G_SETSUBPIXELOFFSET_EXT, 24, 8) | _SHIFTL((s16)(x), 0, 16); \ + _g->words.w1 = _SHIFTL((s16)(y), 0, 16); \ +} + #define gSPSetExtraGeometryModeEXT(pkt, word) gSPExtraGeometryModeEXT((pkt), 0, word) #define gSPClearExtraGeometryModeEXT(pkt, word) gSPExtraGeometryModeEXT((pkt), word, 0) #define gDPFillRectangleEXT gDPFillRectangleWideEXT -#define gDPFillRectangleCenteredEXT gDPFillRectangleCenteredWideEXT #define gSPTextureRectangleEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt) gSPTextureRectangleWideEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt, G_OFF) #define gSPTextureRectangleFlipEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt) gSPTextureRectangleWideEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt, G_ON) @@ -320,12 +317,10 @@ #undef gDPHudRectangle #define gDPHudRectangle(pkt, x1, y1, x2, y2) gDPFillRectangleEXT(pkt, (x1) * g_ScaleX, y1, ((x2 + 1)) * g_ScaleX, (y2) + 1) -#define gDPHudRectangleCentered(pkt, x1, y1, x2, y2) gDPFillRectangleCenteredEXT(pkt, (x1) * g_ScaleX, y1, ((x2 + 1)) * g_ScaleX, (y2) + 1) #else // PLATFORM_N64 #define gDPFillRectangleEXT gDPFillRectangle -#define gDPFillRectangleCenteredEXT gDPFillRectangle #define gSPTextureRectangleEXT gSPTextureRectangle #endif // PLATFORM_N64