GBA Video: Fix sprite boundary conditions with mosaic

This commit is contained in:
Jeffrey Pfau 2014-12-31 20:53:50 -08:00
parent bbfd7d8e2c
commit 85c3ed4178
2 changed files with 11 additions and 2 deletions

View File

@ -35,6 +35,7 @@ Bugfixes:
- Debugger: Fix watchpoints triggering too late
- GBA Video: Fix sprite mis-ordering behavior in some cases (fixes #168)
- GBA Video: Fix window interactions with 16-color mode 0 mosaic
- GBA Video: Fix sprite boundary conditions with mosaic
Misc:
- Qt: Disable sync to video by default
- GBA: Exit cleanly on FATAL if the port supports it

View File

@ -1578,14 +1578,22 @@ static void _drawBackgroundMode5(struct GBAVideoSoftwareRenderer* renderer, stru
SPRITE_YBASE_ ## DEPTH(inY); \
unsigned tileData; \
if (outX % mosaicH) { \
inX += (mosaicH - (outX % mosaicH)) * xOffset; \
if (!inX && xOffset > 0) { \
inX = mosaicH - (outX % mosaicH); \
outX += mosaicH - (outX % mosaicH); \
} else if (inX == width - xOffset) { \
inX = mosaicH + (outX % mosaicH); \
outX += mosaicH - (outX % mosaicH); \
} \
} \
for (; outX < condition; ++outX, inX += xOffset) { \
if (!(renderer->row[outX] & FLAG_UNWRITTEN)) { \
continue; \
} \
int localX = inX - xOffset * (outX % mosaicH); \
if (localX < 0 || localX > width - 1) { \
continue; \
} \
SPRITE_XBASE_ ## DEPTH(localX); \
SPRITE_DRAW_PIXEL_ ## DEPTH ## _ ## TYPE(localX); \
}