From 464717602f2d69c558644368d7930f6bd4601f17 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Thu, 2 Mar 2017 01:53:08 +0100 Subject: * compressed textures (asfafdgasfgadf) * fix bug where sprites too close to the right border shat themselves --- GPU2D.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'GPU2D.cpp') diff --git a/GPU2D.cpp b/GPU2D.cpp index b7a0780..9a2c2e9 100644 --- a/GPU2D.cpp +++ b/GPU2D.cpp @@ -1200,11 +1200,12 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d u32 wmask = width - 8; // really ((width - 1) & ~0x7) u32 xoff; + u32 xend = width; if (xpos >= 0) { xoff = 0; - if ((xpos+width) > 256) - width = 256-xpos; + if ((xpos+xend) > 256) + xend = 256-xpos; } else { @@ -1249,7 +1250,7 @@ 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 < width;) + for (; xoff < xend;) { u16 color = GPU::ReadVRAM_OBJ(pixelsaddr); pixelsaddr += 2; @@ -1291,7 +1292,7 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d pixelsaddr += (((width-1 - xoff) & wmask) << 3); pixelsaddr += ((width-1 - xoff) & 0x7); - for (; xoff < width;) + for (; xoff < xend;) { u8 color = GPU::ReadVRAM_OBJ(pixelsaddr); pixelsaddr--; @@ -1309,7 +1310,7 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d pixelsaddr += ((xoff & wmask) << 3); pixelsaddr += (xoff & 0x7); - for (; xoff < width;) + for (; xoff < xend;) { u8 color = GPU::ReadVRAM_OBJ(pixelsaddr); pixelsaddr++; @@ -1338,7 +1339,7 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d pixelsaddr += (((width-1 - xoff) & wmask) << 2); pixelsaddr += (((width-1 - xoff) & 0x7) >> 1); - for (; xoff < width;) + for (; xoff < xend;) { u8 color; if (xoff & 0x1) @@ -1364,7 +1365,7 @@ void GPU2D::DrawSprite_Normal(u16* attrib, u32 width, s32 xpos, u32 ypos, u32* d pixelsaddr += ((xoff & wmask) << 2); pixelsaddr += ((xoff & 0x7) >> 1); - for (; xoff < width;) + for (; xoff < xend;) { u8 color; if (xoff & 0x1) -- cgit v1.2.3