all repos — mgba @ 63b72657c138142a76e482db09ddf0c8cc35facb

mGBA Game Boy Advance Emulator

Fix transformed sprites that are off the top of the screen
Jeffrey Pfau jeffrey@endrift.com
Sat, 11 May 2013 18:36:35 -0700
commit

63b72657c138142a76e482db09ddf0c8cc35facb

parent

f7ddc3a2b618d2889f16cba366f4bdfe02207c63

1 files changed, 4 insertions(+), 1 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -882,7 +882,6 @@ for (int outX = x >= start ? x : start; outX < x + totalWidth && outX < end; ++outX) { \

if (!(renderer->row[outX] & FLAG_UNWRITTEN)) { \ continue; \ } \ - int inY = y - sprite->y; \ int inX = outX - x; \ int localX = ((mat->a * (inX - (totalWidth >> 1)) + mat->b * (inY - (totalHeight >> 1))) >> 8) + (width >> 1); \ int localY = ((mat->c * (inX - (totalWidth >> 1)) + mat->d * (inY - (totalHeight >> 1))) >> 8) + (height >> 1); \

@@ -983,6 +982,10 @@ int x = sprite->x;

unsigned charBase = BASE_TILE + sprite->tile * 0x20; struct GBAOAMMatrix* mat = &renderer->d.oam->mat[sprite->matIndex]; int variant = renderer->target1Obj && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); + int inY = y - sprite->y; + if (inY < 0) { + inY += 256; + } if (!sprite->multipalette) { if (!variant) { SPRITE_TRANSFORMED_LOOP(16, NORMAL);