aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/graphics.cpp
diff options
context:
space:
mode:
authoruruk2014-02-04 08:58:48 +0100
committeruruk2014-02-04 08:59:03 +0100
commit9a08e0459c7544050bd18a637562ec444b5875a7 (patch)
treec578ed154e817227d229637d2ac08caae1893dc4 /engines/avalanche/graphics.cpp
parenta67b7f487c47fa833a5fa273d96f531708557edf (diff)
downloadscummvm-rg350-9a08e0459c7544050bd18a637562ec444b5875a7.tar.gz
scummvm-rg350-9a08e0459c7544050bd18a637562ec444b5875a7.tar.bz2
scummvm-rg350-9a08e0459c7544050bd18a637562ec444b5875a7.zip
AVALANCHE: Implement loading and drawing of the picture of the ghost.
Diffstat (limited to 'engines/avalanche/graphics.cpp')
-rw-r--r--engines/avalanche/graphics.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index a8efc4be9b..a85d7ebbf4 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -500,6 +500,33 @@ void GraphicManager::nimFree() {
_nimLogo.free();
}
+void GraphicManager::ghostDrawPicture(byte ghostArr[2][66][26], uint16 destX, uint16 destY) {
+ const byte kPlaneToUse[4] = { 0, 0, 0, 1 };
+ // Constants from the original code.
+ uint16 height = 66;
+ uint16 width = 26 * 8;
+
+ Graphics::Surface ghostPic;
+ ghostPic.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+
+ for (int y = 0; y < height; y++) {
+ for (int plane = 0; plane < 4; plane++) {
+ for (uint16 x = 0; x < width / 8; x ++) {
+ byte pixel = ghostArr[kPlaneToUse[plane]][y][x];
+ for (int bit = 0; bit < 8; bit++) {
+ byte pixelBit = (pixel >> bit) & 1;
+ if (pixelBit != 0)
+ *(byte *)ghostPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
+ }
+ }
+ }
+ }
+
+ drawPicture(_surface, ghostPic, destX, destY);
+
+ ghostPic.free();
+}
+
/**
* This function mimics Pascal's getimage().
*/