Fix objwin on objs when objs are off in winout

This commit is contained in:
Jeffrey Pfau 2014-10-19 06:24:09 -07:00
parent f1afeae74c
commit 10509fe69d
1 changed files with 29 additions and 15 deletions

View File

@ -624,7 +624,7 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) {
renderer->start = renderer->end; renderer->start = renderer->end;
renderer->end = renderer->windows[w].endX; renderer->end = renderer->windows[w].endX;
renderer->currentWindow = renderer->windows[w].control; renderer->currentWindow = renderer->windows[w].control;
if (!GBAWindowControlIsObjEnable(renderer->currentWindow.packed)) { if (!GBAWindowControlIsObjEnable(renderer->currentWindow.packed) && !GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt)) {
continue; continue;
} }
int i; int i;
@ -1605,11 +1605,15 @@ static void _postprocessSprite(struct GBAVideoSoftwareRenderer* renderer, unsign
uint32_t flags = FLAG_TARGET_2 * renderer->target2Obj; uint32_t flags = FLAG_TARGET_2 * renderer->target2Obj;
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt); int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt);
int objwinDisable = 0; bool objwinDisable = false;
bool objwinOnly = false;
if (objwinSlowPath) { if (objwinSlowPath) {
objwinDisable = !GBAWindowControlIsObjEnable(renderer->objwin.packed); objwinDisable = !GBAWindowControlIsObjEnable(renderer->objwin.packed);
// TODO: Fix this for current window when WIN0/1 are enabled
objwinOnly = !objwinDisable && !GBAWindowControlIsObjEnable(renderer->winout.packed);
} }
if (objwinSlowPath && objwinDisable) { if (objwinSlowPath) {
if (objwinDisable) {
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x, ++pixel) { for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x, ++pixel) {
uint32_t color = renderer->spriteLayer[x] & ~FLAG_OBJWIN; uint32_t color = renderer->spriteLayer[x] & ~FLAG_OBJWIN;
uint32_t current = *pixel; uint32_t current = *pixel;
@ -1617,7 +1621,18 @@ static void _postprocessSprite(struct GBAVideoSoftwareRenderer* renderer, unsign
_compositeBlendObjwin(renderer, pixel, color | flags, current); _compositeBlendObjwin(renderer, pixel, color | flags, current);
} }
} }
} else { return;
} else if (objwinOnly) {
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x, ++pixel) {
uint32_t color = renderer->spriteLayer[x] & ~FLAG_OBJWIN;
uint32_t current = *pixel;
if ((color & FLAG_UNWRITTEN) != FLAG_UNWRITTEN && (current & FLAG_OBJWIN) && (color & FLAG_PRIORITY) >> OFFSET_PRIORITY == priority) {
_compositeBlendObjwin(renderer, pixel, color | flags, current);
}
}
return;
}
}
for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x, ++pixel) { for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x, ++pixel) {
uint32_t color = renderer->spriteLayer[x] & ~FLAG_OBJWIN; uint32_t color = renderer->spriteLayer[x] & ~FLAG_OBJWIN;
uint32_t current = *pixel; uint32_t current = *pixel;
@ -1625,7 +1640,6 @@ static void _postprocessSprite(struct GBAVideoSoftwareRenderer* renderer, unsign
_compositeBlendNoObjwin(renderer, pixel, color | flags, current); _compositeBlendNoObjwin(renderer, pixel, color | flags, current);
} }
} }
}
} }
static void _updatePalettes(struct GBAVideoSoftwareRenderer* renderer) { static void _updatePalettes(struct GBAVideoSoftwareRenderer* renderer) {