GBA Video: I can't believe I broke so this so much

This commit is contained in:
Vicki Pfau 2020-07-17 13:21:31 -07:00
parent dd67bf9797
commit d9ecac8cca
1 changed files with 41 additions and 30 deletions

View File

@ -42,6 +42,9 @@
#define DRAW_BACKGROUND_MODE_0_TILE_PREFIX_16(BLEND, OBJWIN) \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
return; \
} \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
palette = &mainPalette[paletteData]; \
@ -389,25 +392,29 @@
tileData = carryData; \
for (x = 0; x < 8; ++x) { \
if (!mosaicWait) { \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
if (UNLIKELY(!vram)) { \
carryData = 0; \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
} \
} \
tileData &= 0xFF; \
carryData = tileData; \
} \
tileData &= 0xFF; \
carryData = tileData; \
mosaicWait = mosaicH; \
} \
tileData |= tileData << 8; \
@ -622,25 +629,29 @@
if (!mosaicWait) { \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 8; \
palette = &mainPalette[paletteData]; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
if (UNLIKELY(!vram)) { \
carryData = 0; \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
} \
} \
tileData &= 0xFF; \
carryData = tileData; \
} \
tileData &= 0xFF; \
carryData = tileData; \
mosaicWait = mosaicH; \
} \
tileData |= tileData << 8; \