diff options
author | uruk | 2014-02-04 19:54:41 +0100 |
---|---|---|
committer | uruk | 2014-02-04 19:54:41 +0100 |
commit | 5a1c9bc717ef4fb4d70c73c57d867591495de826 (patch) | |
tree | ec12f91693e918820de6a83c38a779d996b0997c /engines/avalanche | |
parent | 3eb2c05faf3b0b29f076c0809043781047920d5e (diff) | |
download | scummvm-rg350-5a1c9bc717ef4fb4d70c73c57d867591495de826.tar.gz scummvm-rg350-5a1c9bc717ef4fb4d70c73c57d867591495de826.tar.bz2 scummvm-rg350-5a1c9bc717ef4fb4d70c73c57d867591495de826.zip |
AVALANCHE: Implement rest of the loading in Ghostroom.
Also move it to it's own function: loadPictures(). Remove some unused
variables and change the order of declaration of the remaining ones
during the implementation. Change void * types to Graphics::Surface.
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/ghostroom.cpp | 88 | ||||
-rw-r--r-- | engines/avalanche/ghostroom.h | 17 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 2 |
4 files changed, 81 insertions, 32 deletions
diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp index 00120105f7..95b5476714 100644 --- a/engines/avalanche/ghostroom.cpp +++ b/engines/avalanche/ghostroom.cpp @@ -38,24 +38,33 @@ const byte GhostRoom::kGreldetFade[18] = { 1, 2, 3, 4, 5, 6, 6, 6, 5, 5, 4, 4, 3 GhostRoom::GhostRoom(AvalancheEngine *vm) { _vm = vm; - for (int i = 0; i < 5; i++) - _greenEyes[i] = nullptr; - - _glerk = nullptr; _glerkStage = 0; _aarghCount = 0; _batX = _batY = 0; _batCount = 0; _greldetX = _greldetY = 0; _greldetCount = 0; - _gb = false; _redGreldet = false; } GhostRoom::~GhostRoom() { for (int i = 0; i < 2; i++) _eyes[i].free(); + _exclamation.free(); + + for (int i = 0; i < 3; i++) + _bat[i].free(); + + for (int i = 0; i < 6; i++) + _aargh[i].free(); + + for (int i = 0; i < 5; i++) + _greenEyes[i].free(); + + for (int i = 0; i < 2; i++) + for (int j = 0; j < 6; j++) + _greldet[j][i].free(); } void GhostRoom::wait(uint16 howLong) { @@ -81,16 +90,13 @@ ChunkBlock GhostRoom::readChunkBlock(Common::File &file) { return cb; } -void GhostRoom::run() { - _vm->_graphics->saveScreen(); - _vm->fadeOut(); - _vm->fadeIn(); - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); +void GhostRoom::loadPictures() { + Common::File file; - if (!_file.open("spooky.avd")) + if (!file.open("spooky.avd")) error("AVALANCHE: GhostRoom: File not found: spooky.avd"); - _file.seek(44); + file.seek(44); // Initializing ghost's array. for (int i = 0; i < 5; i++) @@ -99,21 +105,63 @@ void GhostRoom::run() { for (int x = 0; x < 26; x++) _ghost[i][j][y][x] = 0; - // Reading in the pictures of the ghost. + // Read in the pictures of the ghost. for (int i = 0; i < 5; i++) { - ChunkBlock cb = readChunkBlock(_file); + ChunkBlock cb = readChunkBlock(file); for (int j = 0; j < 2; j++) - for (uint16 y = 0; y <= cb._height; y++) - _file.read(_ghost[i][j][y], cb._width / 8); + for (int y = 0; y <= cb._height; y++) + file.read(_ghost[i][j][y], cb._width / 8); } - // Load some smaller pictures. for (int i = 0; i < 2; i++) - _eyes[i] = _vm->_graphics->ghostLoadPicture(_file); - _exclamation = _vm->_graphics->ghostLoadPicture(_file); + _eyes[i] = _vm->_graphics->ghostLoadPicture(file, dummyCoord); + + _exclamation = _vm->_graphics->ghostLoadPicture(file, dummyCoord); + + // Actually this function not just loads, but also draws the images, but they are part of the background + // and they are need to be drawn only once. + _vm->_graphics->ghostDrawBackgroundItems(file); + + for (int i = 0; i < 3; i++) + _bat[i] = _vm->_graphics->ghostLoadPicture(file, dummyCoord); - _vm->_graphics->ghostDrawBackgroundItems(_file); + // Initializing glerk's array. + for (int i = 0; i < 6; i++) + for (int j = 0; j < 4; j++) + for (int y = 0; y < 35; y++) + for (int x = 0; x < 9; x++) + _glerk[i][j][y][x] = 0; + + // Read in the pictures of the "glerk". + for (int i = 0; i < 6; i++) { + ChunkBlock cb = readChunkBlock(file); + for (int j = 0; j < 4; j++) + for (int y = 0; y <= cb._height; y++) + file.read(_glerk[i][j][y], cb._width / 8); + } + + for (int i = 0; i < 6; i++) + _aargh[i] = _vm->_graphics->ghostLoadPicture(file, _aarghWhere[i]); + + for (int i = 0; i < 5; i++) + _greenEyes[i] = _vm->_graphics->ghostLoadPicture(file, dummyCoord); + + for (int i = 0; i < 2; i++) + for (int j = 0; j < 6; j++) + _greldet[j][i] = _vm->_graphics->ghostLoadPicture(file, dummyCoord); + + file.close(); +} + +void GhostRoom::run() { + _vm->_graphics->saveScreen(); + _vm->fadeOut(); + _vm->fadeIn(); + _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen. + + loadPictures(); + warning("STUB: run()"); } diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h index 9c048f5836..3779fa0408 100644 --- a/engines/avalanche/ghostroom.h +++ b/engines/avalanche/ghostroom.h @@ -56,22 +56,18 @@ private: static const byte kWaveOrder[5]; static const byte kGlerkFade[26]; static const byte kGreldetFade[18]; - - typedef byte GlerkType[6][4][35][9]; - Common::File _file; + Common::Point dummyCoord; byte _ghost[5][2][66][26]; - void *_memLevel; - byte _y, _yy, _bit, _xofs; Graphics::Surface _eyes[2]; Graphics::Surface _exclamation; - Graphics::Surface _aargh[6]; Graphics::Surface _bat[3]; - GlerkType *_glerk; - void *_greenEyes[5]; - void *_greldet[6][2]; + byte _glerk[6][4][35][9]; + Graphics::Surface _aargh[6]; Common::Point _aarghWhere[6]; - bool _gb; + Graphics::Surface _greenEyes[5]; + Graphics::Surface _greldet[6][2]; + byte _glerkStage; int16 _batX, _batY; uint16 _batCount; @@ -80,6 +76,7 @@ private: byte _greldetCount; bool _redGreldet; + void loadPictures(); void wait(uint16 howLong); void doBat(); void bigGreenEyes(byte how); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index a3e3718a36..1a06ebc3c6 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -528,10 +528,14 @@ void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint } /** + * With the use of the second argument, it replaces get_meg_aargh as well. * @remarks Originally called 'get_me' and was located in Ghostroom. */ -Graphics::Surface GraphicManager::ghostLoadPicture(Common::File &file) { +Graphics::Surface GraphicManager::ghostLoadPicture(Common::File &file, Common::Point &coord) { ChunkBlock cb = _vm->_ghostroom->readChunkBlock(file); + + coord.x = cb._x; + coord.y = cb._y; Graphics::Surface picture = loadPictureGraphic(file); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 525616d1f1..791e04ac1e 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -93,7 +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. - Graphics::Surface ghostLoadPicture(Common::File &file); + Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord); void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY); void ghostDrawBackgroundItems(Common::File &file); |