aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-04-29 16:18:33 +0200
committerStapleButter <thetotalworm@gmail.com>2017-04-29 16:18:33 +0200
commitee0effd22fda3dc2134f5f8aa4839c293684cd93 (patch)
tree214d9e33b87f6ba07bf3818fceb1a7fde41f3ca3 /src
parentda31af92029af5f9db3c9fcc226414e3789f2682 (diff)
implement xflip for bitmap sprites (fixes #32)
Diffstat (limited to 'src')
-rw-r--r--src/GPU2D.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index ce8714d..77b79b4 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -1859,21 +1859,44 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d
}
u32 pixelsaddr = (Num ? 0x06600000 : 0x06400000) + tilenum;
- pixelsaddr += (xoff << 1);
- for (; xoff < xend;)
+ if (attrib[1] & 0x1000)
{
- u16 color = GPU::ReadVRAM_OBJ<u16>(pixelsaddr);
- pixelsaddr += 2;
+ pixelsaddr += ((width-1 - xoff) << 1);
- if (color & 0x8000)
+ for (; xoff < xend;)
{
- if (window) ((u8*)dst)[xpos] = 1;
- else dst[xpos] = color | prio;
+ u16 color = GPU::ReadVRAM_OBJ<u16>(pixelsaddr);
+ pixelsaddr -= 2;
+
+ if (color & 0x8000)
+ {
+ if (window) ((u8*)dst)[xpos] = 1;
+ else dst[xpos] = color | prio;
+ }
+
+ xoff++;
+ xpos++;
}
+ }
+ else
+ {
+ pixelsaddr += (xoff << 1);
- xoff++;
- xpos++;
+ for (; xoff < xend;)
+ {
+ u16 color = GPU::ReadVRAM_OBJ<u16>(pixelsaddr);
+ pixelsaddr += 2;
+
+ if (color & 0x8000)
+ {
+ if (window) ((u8*)dst)[xpos] = 1;
+ else dst[xpos] = color | prio;
+ }
+
+ xoff++;
+ xpos++;
+ }
}
}
else