diff --git a/gfx.cpp b/gfx.cpp index 6f307cd6..73656332 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -1351,8 +1351,8 @@ static void DrawBackgroundMosaic (int bg, uint8 Zh, uint8 Zl) for (uint32 Y = GFX.StartY - MosaicStart; Y <= GFX.EndY; Y += PPU.Mosaic) { uint32 Y2 = HiresInterlace ? Y * 2 : Y; - uint32 VOffset = LineData[Y].BG[bg].VOffset + (HiresInterlace ? 1 : 0); - uint32 HOffset = LineData[Y].BG[bg].HOffset; + uint32 VOffset = LineData[Y + MosaicStart].BG[bg].VOffset + (HiresInterlace ? 1 : 0); + uint32 HOffset = LineData[Y + MosaicStart].BG[bg].HOffset; Lines = PPU.Mosaic - MosaicStart; if (Y + MosaicStart + Lines > GFX.EndY) @@ -1759,8 +1759,8 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff) for (uint32 Y = GFX.StartY - MosaicStart; Y <= GFX.EndY; Y += PPU.Mosaic) { uint32 Y2 = HiresInterlace ? Y * 2 : Y; - uint32 VOff = LineData[Y].BG[2].VOffset - 1; - uint32 HOff = LineData[Y].BG[2].HOffset; + uint32 VOff = LineData[Y + MosaicStart].BG[2].VOffset - 1; + uint32 HOff = LineData[Y + MosaicStart].BG[2].HOffset; Lines = PPU.Mosaic - MosaicStart; if (Y + MosaicStart + Lines > GFX.EndY) @@ -1789,7 +1789,7 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff) uint32 Left = GFX.Clip[bg].Left[clip]; uint32 Right = GFX.Clip[bg].Right[clip]; uint32 Offset = Left * PixWidth + (Y + MosaicStart) * GFX.PPL; - uint32 HScroll = LineData[Y].BG[bg].HOffset; + uint32 HScroll = LineData[Y + MosaicStart].BG[bg].HOffset; uint32 Width = Right - Left; while (Left < Right) @@ -1799,7 +1799,7 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff) if (Left < (8 - (HScroll & 7))) { // SNES cannot do OPT for leftmost tile column - VOffset = LineData[Y].BG[bg].VOffset; + VOffset = LineData[Y + MosaicStart].BG[bg].VOffset; HOffset = HScroll; } else @@ -1840,7 +1840,7 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff) if (VCellOffset & OffsetEnableMask) VOffset = VCellOffset + 1; else - VOffset = LineData[Y].BG[bg].VOffset; + VOffset = LineData[Y + MosaicStart].BG[bg].VOffset; if (HCellOffset & OffsetEnableMask) HOffset = (HCellOffset & ~7) | (HScroll & 7);