diff --git a/tile.cpp b/tile.cpp index 92f4825c..9a6f9d84 100644 --- a/tile.cpp +++ b/tile.cpp @@ -196,9 +196,6 @@ // Top-level compilation. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" - #ifndef _NEWTILE_CPP #define _NEWTILE_CPP @@ -492,7 +489,6 @@ static uint8 ConvertTile4h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile) #undef DOBIT // First-level include: Get all the renderers. - #include "tile.cpp" // Functions to select which converter and renderer to use. @@ -765,7 +761,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) if (!(Tile & (V_FLIP | H_FLIP))) \ { \ bp = pCache + BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ { \ DRAW_PIXEL(0, Pix = bp[0]); \ @@ -782,7 +778,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) if (!(Tile & V_FLIP)) \ { \ bp = pCache + BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ { \ DRAW_PIXEL(0, Pix = bp[7]); \ @@ -799,7 +795,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) if (!(Tile & H_FLIP)) \ { \ bp = pCache + 56 - BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ { \ DRAW_PIXEL(0, Pix = bp[0]); \ @@ -815,7 +811,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) else \ { \ bp = pCache + 56 - BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ { \ DRAW_PIXEL(0, Pix = bp[7]); \ @@ -860,7 +856,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) if (!(Tile & (V_FLIP | H_FLIP))) \ { \ bp = pCache + BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ { \ w = Width; \ @@ -881,7 +877,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) if (!(Tile & V_FLIP)) \ { \ bp = pCache + BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ { \ w = Width; \ @@ -902,7 +898,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) if (!(Tile & H_FLIP)) \ { \ bp = pCache + 56 - BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ { \ w = Width; \ @@ -922,7 +918,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) else \ { \ bp = pCache + 56 - BPSTART; \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ { \ w = Width; \ @@ -979,7 +975,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) \ if (Pix) \ { \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = LineCount; l > 0; l--, Offset += GFX.PPL) \ { \ for (w = Width - 1; w >= 0; w--) \ @@ -1016,7 +1012,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) GFX.RealScreenColors = IPPU.ScreenColors; \ GFX.ScreenColors = GFX.ClipColors ? BlackColourMap : GFX.RealScreenColors; \ \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (l = GFX.StartY; l <= GFX.EndY; l++, Offset += GFX.PPL) \ { \ for (x = Left; x < Right; x++) \ @@ -1075,7 +1071,7 @@ extern struct SLineMatrixData LineMatrixData[240]; uint32 Offset = GFX.StartY * GFX.PPL; \ struct SLineMatrixData *l = &LineMatrixData[GFX.StartY]; \ \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (uint32 Line = GFX.StartY; Line <= GFX.EndY; Line++, Offset += GFX.PPL, l++) \ { \ int yy, starty; \ @@ -1189,7 +1185,7 @@ extern struct SLineMatrixData LineMatrixData[240]; uint32 Offset = StartY * GFX.PPL; \ struct SLineMatrixData *l = &LineMatrixData[StartY]; \ \ - uint32 OffsetInLine = Offset % GFX.RealPPL; \ + OFFSET_IN_LINE; \ for (uint32 Line = StartY; Line <= GFX.EndY; Line += VMosaic, Offset += VMosaic * GFX.PPL, l += VMosaic) \ { \ if (Line + VMosaic > GFX.EndY) \ @@ -1365,6 +1361,7 @@ extern struct SLineMatrixData LineMatrixData[240]; // The 1x1 pixel plotter, for speedhacking modes. +#define OFFSET_IN_LINE #define DRAW_PIXEL(N, M) \ if (Z1 > GFX.DB[Offset + N] && (M)) \ { \ @@ -1399,6 +1396,7 @@ extern struct SLineMatrixData LineMatrixData[240]; #undef NAME2 #undef DRAW_PIXEL +#undef OFFSET_IN_LINE // Hires pixel plotter, this combines the main and subscreen pixels as appropriate to render hires or pseudo-hires images. // Use it only on the main screen, subscreen should use Normal2x1 instead. @@ -1420,6 +1418,8 @@ extern struct SLineMatrixData LineMatrixData[240]; GFX.DB[Offset + 2 * N] = GFX.DB[Offset + 2 * N + 1] = Z2; \ } +#define OFFSET_IN_LINE \ + uint32 OffsetInLine = Offset % GFX.RealPPL; #define DRAW_PIXEL(N, M) DRAW_PIXEL_H2x1(N, M) #define NAME2 Hires @@ -1429,6 +1429,7 @@ extern struct SLineMatrixData LineMatrixData[240]; #undef NAME2 #undef DRAW_PIXEL +#undef OFFSET_IN_LINE // Interlace: Only draw every other line, so we'll redefine BPSTART and PITCH to do so. // Otherwise, it's the same as Normal2x1/Hires2x1. @@ -1441,6 +1442,7 @@ extern struct SLineMatrixData LineMatrixData[240]; #ifndef NO_INTERLACE +#define OFFSET_IN_LINE #define DRAW_PIXEL(N, M) DRAW_PIXEL_N2x1(N, M) #define NAME2 Interlace @@ -1450,7 +1452,10 @@ extern struct SLineMatrixData LineMatrixData[240]; #undef NAME2 #undef DRAW_PIXEL +#undef OFFSET_IN_LINE +#define OFFSET_IN_LINE \ + uint32 OffsetInLine = Offset % GFX.RealPPL; #define DRAW_PIXEL(N, M) DRAW_PIXEL_H2x1(N, M) #define NAME2 HiresInterlace @@ -1460,6 +1465,7 @@ extern struct SLineMatrixData LineMatrixData[240]; #undef NAME2 #undef DRAW_PIXEL +#undef OFFSET_IN_LINE #endif @@ -1539,4 +1545,3 @@ static void (*MAKENAME(Renderers_, NAME1, NAME2)[7]) (ARGS) = #endif #endif #endif -#pragma GCC diagnostic pop