aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche
diff options
context:
space:
mode:
authoruruk2014-02-08 16:48:29 +0100
committeruruk2014-02-08 16:48:29 +0100
commit2642b0640c5950e1db5c08852ab4a24994505b39 (patch)
tree1cd1a7261b13624fe58fef89fcd1701149719324 /engines/avalanche
parent410d548ac039eb0d071d6b6bd925414622ab3176 (diff)
downloadscummvm-rg350-2642b0640c5950e1db5c08852ab4a24994505b39.tar.gz
scummvm-rg350-2642b0640c5950e1db5c08852ab4a24994505b39.tar.bz2
scummvm-rg350-2642b0640c5950e1db5c08852ab4a24994505b39.zip
AVALANCHE: Implement the animation of the ghost.
Modify GraphicManager::ghostDrawGhost() to do so.
Diffstat (limited to 'engines/avalanche')
-rw-r--r--engines/avalanche/ghostroom.cpp25
-rw-r--r--engines/avalanche/graphics.cpp19
-rw-r--r--engines/avalanche/graphics.h2
3 files changed, 39 insertions, 7 deletions
diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 98dd90974a..d5d10ab83f 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -31,7 +31,7 @@
namespace Avalanche {
const int8 GhostRoom::kAdjustment[5] = { 7, 0, 7, 7, 7 };
-const byte GhostRoom::kWaveOrder[5] = { 5, 1, 2, 3, 4 };
+const byte GhostRoom::kWaveOrder[5] = { 4, 0, 1, 2, 3 };
const byte GhostRoom::kGlerkFade[26] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 0 };
const byte GhostRoom::kGreldetFade[18] = { 1, 2, 3, 4, 5, 6, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1 };
@@ -236,6 +236,29 @@ void GhostRoom::run() {
_vm->_graphics->drawFilledRectangle(Common::Rect(456, 14, 530, 50), kColorBlack);
_vm->_graphics->refreshScreen();
+
+ // Here comes the descending ghost:
+ for (int y = -64; y <= 103; y++) {
+ _vm->_graphics->ghostDrawGhost(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y);
+ if (y > 0)
+ _vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8, y), kColorBlack);
+ _vm->_graphics->refreshScreen();
+
+ wait(27);
+ }
+
+ // Then it waves:
+ _aarghCount = -14;
+
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 5; j++) {
+ _vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 169 + kAdjustment[j]), kColorBlack);
+ _vm->_graphics->ghostDrawGhost(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j]);
+ _vm->_graphics->refreshScreen();
+
+ wait(177);
+ }
+
warning("STUB: run()");
CursorMan.showMouse(true);
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 06c8c83b94..6cafc0bde9 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -504,19 +504,28 @@ void GraphicManager::nimFree() {
_nimLogo.free();
}
-void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint16 destY) {
+void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY) {
const byte kPlaneToUse[4] = { 0, 0, 0, 1 };
- // Constants from the original code.
- const uint16 height = 66;
+ // Constants from the original code:
+ uint16 height = 66;
const uint16 width = 26 * 8;
+ // We have to mess around with the coords and the sizes since
+ // the ghost isn't always placed fully on the screen.
+ int yStart = 0;
+ if (destY < 0) {
+ yStart = abs(destY);
+ height -= yStart;
+ destY = 0;
+ }
+
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];
+ byte pixel = ghostArr[kPlaneToUse[plane]][y + yStart][x];
for (int bit = 0; bit < 8; bit++) {
byte pixelBit = (pixel >> bit) & 1;
*(byte *)ghostPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
@@ -531,7 +540,7 @@ void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, uint
}
void GraphicManager::ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY) {
- // Constants from the original code.
+ // Constants from the original code:
const uint16 height = 35;
const uint16 width = 9 * 8;
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index a372ce8012..d6625ccb61 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -93,7 +93,7 @@ public:
void shiftScreen();
// 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 ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 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);