aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-02-05 10:16:05 +0100
committeruruk2014-02-05 10:51:31 +0100
commit89386900bb4b633356da05cd22aac7e4009a28c1 (patch)
tree49b77f38bd188289e100a29aff9c1ef0571de31e
parenta1a4e809f8645f76ede82a78d288f7cf5fc8f12d (diff)
downloadscummvm-rg350-89386900bb4b633356da05cd22aac7e4009a28c1.tar.gz
scummvm-rg350-89386900bb4b633356da05cd22aac7e4009a28c1.tar.bz2
scummvm-rg350-89386900bb4b633356da05cd22aac7e4009a28c1.zip
AVALANCHE: Add ghostDrawGlerk().
-rw-r--r--engines/avalanche/graphics.cpp28
-rw-r--r--engines/avalanche/graphics.h1
2 files changed, 28 insertions, 1 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 1a06ebc3c6..dd08eac7f0 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -527,6 +527,32 @@ void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint
ghostPic.free();
}
+void GraphicManager::ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY) {
+ // Constants from the original code.
+ uint16 height = 35;
+ uint16 width = 9 * 8;
+
+ Graphics::Surface glerkPic;
+ glerkPic.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 = glerkArr[plane][y][x];
+ for (int bit = 0; bit < 8; bit++) {
+ byte pixelBit = (pixel >> bit) & 1;
+ if (pixelBit != 0)
+ *(byte *)glerkPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
+ }
+ }
+ }
+ }
+
+ drawPicture(_surface, glerkPic, destX, destY);
+
+ glerkPic.free();
+}
+
/**
* With the use of the second argument, it replaces get_meg_aargh as well.
* @remarks Originally called 'get_me' and was located in Ghostroom.
@@ -538,7 +564,7 @@ Graphics::Surface GraphicManager::ghostLoadPicture(Common::File &file, Common::P
coord.y = cb._y;
Graphics::Surface picture = loadPictureGraphic(file);
-
+
int bytesPerRow = (picture.w / 8);
if ((picture.w % 8) > 0)
bytesPerRow += 1;
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 791e04ac1e..485da1f4ee 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -93,6 +93,7 @@ public:
// Ghostroom's functions:
void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible.
+ void ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY); // Very similar to ghostDrawGhost(), but not enough to unify the two.
Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord);
void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
void ghostDrawBackgroundItems(Common::File &file);