diff options
-rw-r--r-- | src/GPU2D.cpp | 34 | ||||
-rw-r--r-- | src/GPU2D.h | 1 |
2 files changed, 20 insertions, 15 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp index 891c7e0..b510767 100644 --- a/src/GPU2D.cpp +++ b/src/GPU2D.cpp @@ -1465,6 +1465,8 @@ void GPU2D::DrawScanline_BGOBJ(u32 line) else memset(WindowMask, 0xFF, 256); + ApplySpriteMosaicX(); + switch (DispCnt & 0x7) { case 0: DrawScanlineBGMode<0>(line); break; @@ -2236,30 +2238,32 @@ void GPU2D::DrawBG_Large(u32 line) // BG is always BG2 BGYRefInternal[0] += rotD; } -void GPU2D::InterleaveSprites(u32 prio) +void GPU2D::ApplySpriteMosaicX() { // apply X mosaic if needed // X mosaic for sprites is applied after all sprites are rendered - if (OBJMosaicSize[0] > 0) - { - u32 lastcolor = OBJLine[0]; + if (OBJMosaicSize[0] == 0) return; - for (u32 i = 1; i < 256; i++) - { - if (!(OBJLine[i] & 0x100000)) - { - // not a mosaic'd sprite pixel - continue; - } + u32 lastcolor = OBJLine[0]; - if ((!(OBJLine[i-1] & 0x100000)) || (CurOBJXMosaicTable[i] == 0)) - lastcolor = OBJLine[i]; - else - OBJLine[i] = lastcolor; + for (u32 i = 1; i < 256; i++) + { + if (!(OBJLine[i] & 0x100000)) + { + // not a mosaic'd sprite pixel + continue; } + + if ((!(OBJLine[i-1] & 0x100000)) || (CurOBJXMosaicTable[i] == 0)) + lastcolor = OBJLine[i]; + else + OBJLine[i] = lastcolor; } +} +void GPU2D::InterleaveSprites(u32 prio) +{ u16* pal = (u16*)&GPU::Palette[Num ? 0x600 : 0x200]; if (DispCnt & 0x80000000) diff --git a/src/GPU2D.h b/src/GPU2D.h index 1e5e6e0..8c6ec27 100644 --- a/src/GPU2D.h +++ b/src/GPU2D.h @@ -154,6 +154,7 @@ private: template<bool mosaic> void DrawBG_Extended(u32 line, u32 bgnum); template<bool mosaic> void DrawBG_Large(u32 line); + void ApplySpriteMosaicX(); void InterleaveSprites(u32 prio); template<bool window> void DrawSprite_Rotscale(u16* attrib, u16* rotparams, u32 boundwidth, u32 boundheight, u32 width, u32 height, s32 xpos, s32 ypos); template<bool window> void DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, s32 ypos); |