GBA Video: Add window y offsetting

This commit is contained in:
Vicki Pfau 2020-10-22 20:31:58 -07:00
parent c8e1e14d3f
commit 4aed125b3e
3 changed files with 9 additions and 3 deletions

View File

@ -120,6 +120,8 @@ struct GBAVideoSoftwareRenderer {
struct GBAVideoWindowRegion h;
struct GBAVideoWindowRegion v;
struct WindowControl control;
int16_t offsetX;
int16_t offsetY;
} winN[2];
struct WindowControl winout;

View File

@ -1099,6 +1099,10 @@ static void _GBACoreAdjustVideoLayer(struct mCore* core, size_t id, int32_t x, i
gbacore->renderer.objOffsetY = y;
gbacore->renderer.oamDirty = 1;
break;
case GBA_LAYER_WIN0:
gbacore->renderer.winN[id - GBA_LAYER_WIN0].offsetX = x;
gbacore->renderer.winN[id - GBA_LAYER_WIN0].offsetY = y;
break;
default:
return;
}

View File

@ -443,13 +443,13 @@ static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* render
static void _breakWindow(struct GBAVideoSoftwareRenderer* softwareRenderer, struct WindowN* win, int y) {
if (win->v.end >= win->v.start) {
if (y >= win->v.end) {
if (y >= win->v.end + win->offsetY) {
return;
}
if (y < win->v.start) {
if (y < win->v.start + win->offsetY) {
return;
}
} else if (y >= win->v.end && y < win->v.start) {
} else if (y >= win->v.end + win->offsetY && y < win->v.start + win->offsetY) {
return;
}
if (win->h.end > GBA_VIDEO_HORIZONTAL_PIXELS || win->h.end < win->h.start) {