From 4f40d98af0faa54922e1321157335001a3457145 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Sep 2012 11:25:21 +1000 Subject: HOPKINS: Fix bug with clipping in Sprite_Vesa --- engines/hopkins/graphics.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'engines/hopkins') diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 048d07241f..4d8a3b79a5 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1321,32 +1321,22 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, byte byteVal; int xc = 0; - // Loop through sequences of bytes to skip or output while ((byteVal = *srcP) != 253) { ++srcP; int width = READ_LE_UINT16(srcP); + srcP += 2; - if (byteVal != 254) { - // Skip over output bytes - tempDestP += width; - xc += width; - } else { - // Output byte range - while (width-- > 0) { - // Get the next byte - byteVal = *spriteP; + if (byteVal == 254) { + // Copy pixel range + for (int xv = 0; xv < width; ++xv, ++xc, ++spriteP, ++tempDestP) { if (clip_y == 0 && xc >= clip_x && xc < clip_x1) - // Not clipped, so display it - *tempDestP = byteVal; - - // Move to next pixel - xc++; - ++srcP; - ++tempDestP; + *tempDestP = *spriteP; } + } else { + // Skip over bytes + tempDestP += width; + xc += width; } - - srcP += 2; } if (clip_y > 0) -- cgit v1.2.3