all repos — mgba @ 6ad2b673b1110329517fc540952579ab8f8cc5e2

mGBA Game Boy Advance Emulator

Omit sprites that are off-screen vertically from OAM calculations
Jeffrey Pfau jeffrey@endrift.com
Fri, 31 Jan 2014 22:40:21 -0800
commit

6ad2b673b1110329517fc540952579ab8f8cc5e2

parent

bab92ba659898cf6644a59684c9b14f010533d38

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

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

@@ -378,10 +378,12 @@ int height = _objSizes[obj->shape * 8 + obj->size * 2 + 1];

if (obj->transformed) { height <<= ((struct GBATransformedObj*) obj)->doublesize; } - renderer->sprites[oamMax].y = obj->y; - renderer->sprites[oamMax].endY = obj->y + height; - renderer->sprites[oamMax].obj = *obj; - ++oamMax; + if (obj->y < VIDEO_VERTICAL_PIXELS || obj->y + height >= VIDEO_VERTICAL_TOTAL_PIXELS) { + renderer->sprites[oamMax].y = obj->y; + renderer->sprites[oamMax].endY = obj->y + height; + renderer->sprites[oamMax].obj = *obj; + ++oamMax; + } } } renderer->oamMax = oamMax;