diff options
Diffstat (limited to 'source/tile.h')
-rw-r--r-- | source/tile.h | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/source/tile.h b/source/tile.h index 2a273f6..12b294d 100644 --- a/source/tile.h +++ b/source/tile.h @@ -3,24 +3,18 @@ #ifndef _TILE_H_ #define _TILE_H_ -#define TILE_PREAMBLE \ +#define TILE_PREAMBLE() \ uint8_t *pCache; \ -\ uint32_t TileAddr = BG.TileAddress + ((Tile & 0x3ff) << BG.TileShift); \ if ((Tile & 0x1ff) >= 256) \ TileAddr += BG.NameSelect; \ -\ TileAddr &= 0xffff; \ -\ uint32_t TileNumber; \ pCache = &BG.Buffer[(TileNumber = (TileAddr >> BG.TileShift)) << 6]; \ -\ if (!BG.Buffered [TileNumber]) \ BG.Buffered[TileNumber] = ConvertTile (pCache, TileAddr); \ -\ if (BG.Buffered [TileNumber] == BLANK_TILE) \ return; \ -\ uint32_t l; \ uint16_t *ScreenColors; \ if (BG.DirectColourMode) \ @@ -30,7 +24,7 @@ ScreenColors = DirectColourMaps [(Tile >> 10) & BG.PaletteMask]; \ } \ else \ - ScreenColors = &IPPU.ScreenColors [(((Tile >> 10) & BG.PaletteMask) << BG.PaletteShift) + BG.StartPalette]; + ScreenColors = &IPPU.ScreenColors [(((Tile >> 10) & BG.PaletteMask) << BG.PaletteShift) + BG.StartPalette] #define RENDER_TILE(NORMAL, FLIPPED, N) \ switch (Tile & (V_FLIP | H_FLIP)) \ @@ -79,10 +73,9 @@ break; \ } -#define TILE_CLIP_PREAMBLE \ +#define TILE_CLIP_PREAMBLE() \ uint32_t d1; \ uint32_t d2; \ -\ if (StartPixel < 4) \ { \ d1 = HeadMask [StartPixel]; \ @@ -91,18 +84,16 @@ } \ else \ d1 = 0; \ -\ if (StartPixel + Width > 4) \ { \ if (StartPixel > 4) \ d2 = HeadMask [StartPixel - 4]; \ else \ d2 = 0xffffffff; \ -\ d2 &= TailMask [(StartPixel + Width - 4)]; \ } \ else \ - d2 = 0; + d2 = 0 #define RENDER_CLIPPED_TILE(NORMAL, FLIPPED, N) \ uint32_t dd; \ @@ -114,8 +105,7 @@ { \ /* This is perfectly OK, regardless of endianness. The tiles are \ * cached in leftmost-endian order (when not horiz flipped) by \ - * the ConvertTile function. \ - */ \ + * the ConvertTile function. */ \ if ((dd = (*(uint32_t *) bp) & d1)) \ NORMAL (Offset, (uint8_t *) &dd, ScreenColors); \ if ((dd = (*(uint32_t *) (bp + 4)) & d2)) \ @@ -167,7 +157,7 @@ StartPixel = 7 - StartPixel; \ /* fallthrough for no-flip case - above was a horizontal flip */ \ case 0: \ - if ((pixel = *(pCache + StartLine + StartPixel))) \ + if((pixel = pCache[StartLine + StartPixel])) \ { \ pixel = PIXEL; \ for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \ @@ -188,7 +178,7 @@ StartPixel = 7 - StartPixel; \ /* fallthrough for V_FLIP-only case - above was a horizontal flip */ \ case V_FLIP: \ - if ((pixel = *(pCache + 56 - StartLine + StartPixel))) \ + if((pixel = pCache[56 - StartLine + StartPixel])) \ { \ pixel = PIXEL; \ for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \ @@ -216,7 +206,7 @@ StartPixel = 7 - StartPixel; \ /* fallthrough for no-flip case - above was a horizontal flip */ \ case 0: \ - if ((pixel = *(pCache + StartLine + StartPixel))) \ + if((pixel = pCache[StartLine + StartPixel])) \ { \ pixel = PIXEL; \ for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \ @@ -237,7 +227,7 @@ StartPixel = 7 - StartPixel; \ /* fallthrough for V_FLIP-only case - above was a horizontal flip */ \ case V_FLIP: \ - if ((pixel = *(pCache + 56 - StartLine + StartPixel))) \ + if((pixel = pCache[56 - StartLine + StartPixel])) \ { \ pixel = PIXEL; \ for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \ |