aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-03-07 01:36:16 +0100
committerStapleButter <thetotalworm@gmail.com>2017-03-07 01:36:16 +0100
commit7799b33dfea5bf8c3d816b1ff2f3738cedf2a64e (patch)
tree15142b87fd9e8b3da4bb12993ea437849d0386e6
parentd95d22837bf01188a851904eb346c9a4577aa25e (diff)
horizontal scrolling for 3D layer
-rw-r--r--GPU2D.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/GPU2D.cpp b/GPU2D.cpp
index 9082025..8c1afd4 100644
--- a/GPU2D.cpp
+++ b/GPU2D.cpp
@@ -871,12 +871,30 @@ void GPU2D::DrawPixel(u32* dst, u16 color, u32 flag)
void GPU2D::DrawBG_3D(u32 line, u32* dst)
{
- // TODO: scroll, etc
+ // TODO: window, as for everything
+ // also check if window can prevent blending from happening
u32* src = GPU3D::GetLine(line);
- for (int i = 0; i < 256; i++)
+
+ u16 xoff = BGXPos[0];
+ int i = 0;
+ int iend = 256;
+
+ if (xoff & 0x100)
+ {
+ i = (0x100 - (xoff & 0xFF));
+ xoff += i;
+ }
+ if ((xoff + iend - 1) & 0x100)
{
- u32 c = src[i];
+ iend -= (xoff & 0xFF);
+ }
+
+ for (; i < iend; i++)
+ {
+ u32 c = src[xoff];
+ xoff++;
+
if ((c >> 24) == 0) continue;
dst[i+256] = dst[i];