diff options
author | uruk | 2014-02-04 18:51:13 +0100 |
---|---|---|
committer | uruk | 2014-02-04 18:51:13 +0100 |
commit | 3eb2c05faf3b0b29f076c0809043781047920d5e (patch) | |
tree | cefada05bbd867d7636b74152b041b3aa248f3f7 | |
parent | 81992bf6169b20762236894e58188e28decf6e2e (diff) | |
download | scummvm-rg350-3eb2c05faf3b0b29f076c0809043781047920d5e.tar.gz scummvm-rg350-3eb2c05faf3b0b29f076c0809043781047920d5e.tar.bz2 scummvm-rg350-3eb2c05faf3b0b29f076c0809043781047920d5e.zip |
AVALANCHE: Rename/move/implement plainGrab().
-rw-r--r-- | engines/avalanche/ghostroom.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/ghostroom.h | 1 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 41 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 1 |
4 files changed, 45 insertions, 6 deletions
diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp index 345d2a43b8..00120105f7 100644 --- a/engines/avalanche/ghostroom.cpp +++ b/engines/avalanche/ghostroom.cpp @@ -58,10 +58,6 @@ GhostRoom::~GhostRoom() { _exclamation.free(); } -void GhostRoom::plainGrab() { - warning("STUB: plainGrab()"); -} - void GhostRoom::wait(uint16 howLong) { warning("STUB: wait()"); } @@ -92,7 +88,7 @@ void GhostRoom::run() { _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); if (!_file.open("spooky.avd")) - error("AVALANCHE: Trip: File not found: spooky.avd"); + error("AVALANCHE: GhostRoom: File not found: spooky.avd"); _file.seek(44); @@ -116,6 +112,8 @@ void GhostRoom::run() { _eyes[i] = _vm->_graphics->ghostLoadPicture(_file); _exclamation = _vm->_graphics->ghostLoadPicture(_file); + _vm->_graphics->ghostDrawBackgroundItems(_file); + warning("STUB: run()"); } diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h index 9a2a5448e2..9c048f5836 100644 --- a/engines/avalanche/ghostroom.h +++ b/engines/avalanche/ghostroom.h @@ -80,7 +80,6 @@ private: byte _greldetCount; bool _redGreldet; - void plainGrab(); void wait(uint16 howLong); void doBat(); void bigGreenEyes(byte how); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index b98ca4b374..a3e3718a36 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -552,6 +552,47 @@ void GraphicManager::ghostDrawPicture(const Graphics::Surface &picture, uint16 d } /** + * Loads and puts 3 images (in this order: cobweb, Mark's signature, open door) into the background at the beginning of the ghostroom scene. + * @remarks Originally called 'plain_grab' and was located in Ghostroom. It was originally called 3 times. I unified these in one function, used a for cycle. + */ +void GraphicManager::ghostDrawBackgroundItems(Common::File &file) { + for (int num = 0; num < 3; num++) { + ChunkBlock cb = _vm->_ghostroom->readChunkBlock(file); + + int width = cb._width; + int height = cb._height + 1; + + Graphics::Surface picture; + picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + + // Load the picture according to it's type. + switch (cb._flavour) { + case kFlavourOne: // There is only one plane. + for (uint16 y = 0; y < height; y++) { + for (uint16 x = 0; x < width; x += 8) { + byte pixel = file.readByte(); + for (int i = 0; i < 8; i++) { + byte pixelBit = (pixel >> i) & 1; + *(byte *)picture.getBasePtr(x + 7 - i, y) = (pixelBit << 3); + } + } + } + break; + case kFlavourEga: + picture = loadPictureRaw(file, width, height); + break; + default: + break; + } + + drawPicture(_surface, picture, cb._x, cb._y); + + picture.free(); + } + refreshScreen(); +} + +/** * This function mimics Pascal's getimage(). */ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 2978468987..525616d1f1 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -95,6 +95,7 @@ public: void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible. Graphics::Surface ghostLoadPicture(Common::File &file); void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY); + void ghostDrawBackgroundItems(Common::File &file); void clearAlso(); void clearTextBar(); |