diff options
author | Eugene Sandulenko | 2005-04-11 21:44:08 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-04-11 21:44:08 +0000 |
commit | 510fcec93de60df2363aa8f90851eefe310038b3 (patch) | |
tree | a9419164e84b1fef59198fa9b0ef125b0c93407f | |
parent | 17163ea7a50fc09d5146d27716c186882f129ed4 (diff) | |
download | scummvm-rg350-510fcec93de60df2363aa8f90851eefe310038b3.tar.gz scummvm-rg350-510fcec93de60df2363aa8f90851eefe310038b3.tar.bz2 scummvm-rg350-510fcec93de60df2363aa8f90851eefe310038b3.zip |
Patch from wjp. Support for CD and EGA versions.
svn-id: r17555
-rw-r--r-- | gob/driver_vga.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/gob/driver_vga.cpp b/gob/driver_vga.cpp index 12add0bf9f..30eb8f2dad 100644 --- a/gob/driver_vga.cpp +++ b/gob/driver_vga.cpp @@ -106,7 +106,42 @@ void VGAVideoDriver::drawLine(SurfaceDesc *dest, int16 x0, int16 y0, int16 x1, i } void VGAVideoDriver::drawPackedSprite(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, SurfaceDesc *dest) { - STUB_FUNC; + int destRight = x + width; + int destBottom = y + height; + + byte* dst = dest->vidPtr + x + dest->width * y; + + int curx = x; + int cury = y; + + while (1) { + uint8 val = *sprBuf++; + unsigned int repeat = val & 7; + val &= 0xF8; + if (!(val & 8)) { + repeat <<= 8; + repeat |= *sprBuf++; + } + repeat++; + val >>= 4; + + for (unsigned int i = 0; i < repeat; ++i) { + if (curx < dest->width && cury < dest->height) + if (!transp || val) + *dst = val; + + dst++; + curx++; + if (curx == destRight) { + dst += dest->width + x - curx; + curx = x; + cury++; + if (cury == destBottom) + return; + } + } + } + } } |