Omit sprites that are off-screen vertically from OAM calculations
Jeffrey Pfau jeffrey@endrift.com
Fri, 31 Jan 2014 22:40:21 -0800
1 files changed,
6 insertions(+),
4 deletions(-)
M
src/gba/renderers/video-software.c
→
src/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;