diff options
-rw-r--r-- | engines/avalanche/animation.cpp | 44 | ||||
-rw-r--r-- | engines/avalanche/animation.h | 4 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 3 | ||||
-rw-r--r-- | engines/avalanche/parser.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/pingo.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/pingo.h | 2 |
7 files changed, 55 insertions, 12 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 66097b2812..9f9822eaa0 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1399,6 +1399,50 @@ void Animation::handleMoveKey(const Common::Event &event) { } } +/** +* Draws a part of the lightning bolt for thunder(). +* @remarks Originally called 'zl' +*/ +void Animation::drawLightning(int16 x1, int16 y1, int16 x2, int16 y2) { + _vm->_graphics->drawLine(x1, y1 - 1, x2, y2 - 1, 1, 3, kColorBlue); + _vm->_graphics->drawLine(x1, y1, x2, y2, 1, 1, kColorLightcyan); +} + +/** +* Plays the actual thunder animation when Avvy (the player) swears too much. +* @remarks Originally called 'zonk' +*/ +void Animation::thunder() { + _vm->_graphics->setBackgroundColor(kColorYellow); + + _vm->_graphics->saveScreen(); + + int x = _vm->_animation->_sprites[0]->_x + _vm->_animation->_sprites[0]->_xLength / 2; + int y = _vm->_animation->_sprites[0]->_y; + + for (int i = 0; i < 256; i++) { + _vm->_sound->playNote(270 - i, 1); + + drawLightning(640, 0, 0, y / 4); + drawLightning(0, y / 4, 640, y / 2); + drawLightning(640, y / 2, x, y); + _vm->_graphics->refreshScreen(); + + _vm->_sound->playNote(2700 - 10 * i, 5); + _vm->_system->delayMillis(5); + _vm->_sound->playNote(270 - i, 1); + + _vm->_graphics->restoreScreen(); + _vm->_sound->playNote(2700 - 10 * i, 5); + _vm->_system->delayMillis(5); + } + + _vm->_graphics->restoreScreen(); + _vm->_graphics->removeBackup(); + + _vm->_graphics->setBackgroundColor(kColorBlack); +} + void Animation::setDirection(Direction dir) { _direction = dir; } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index cda5f05bd0..d3b52c704d 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -125,6 +125,10 @@ public: void handleMoveKey(const Common::Event &event); void hideInCupboard(); + // These 2 functions are responsible for playing the thunder animation when the player swears too much. + void drawLightning(int16 x1, int16 y1, int16 x2, int16 y2); + void thunder(); + void setDirection(Direction dir); void setOldDirection(Direction dir); Direction getDirection(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index ec90e9604f..fec483b933 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -281,6 +281,10 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 return endPoint; } +void GraphicManager::drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color) { + _surface.drawThickLine(x1, y1, x2, y2, penX, penY, color); +} + Common::Point GraphicManager::drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { return drawArc(_surface, x, y, stAngle, endAngle, radius, color); } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e19438f0c0..4c811e5378 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -58,6 +58,7 @@ public: void loadDigits(); void loadMouse(byte which); + void drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color); Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawTriangle(Common::Point *p, Color color); @@ -115,8 +116,8 @@ public: void getNaturalPicture(SpriteType &sprite); void saveScreen(); - void removeBackup(); void restoreScreen(); + void removeBackup(); private: static const uint16 kBackgroundWidth = kScreenWidth; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 7ba482f049..362c818ed1 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -2108,7 +2108,7 @@ void Parser::doThat() { } break; default: { - _vm->_pingo->zonk(); + _vm->_animation->thunder(); Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you." \ "%c%c(`Such is the anger of the gods, Avvy!\")", kControlNewLine, kControlNewLine); _vm->_dialogs->displayText(tmpStr); diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 433924f594..d8550f9275 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -60,14 +60,6 @@ void Pingo::wobble() { warning("STUB: Pingo::wobble()"); } -void Pingo::zl(int16 x1, int16 y1, int16 x2, int16 y2) { - warning("STUB: Pingo::zl()"); -} - -void Pingo::zonk() { - warning("STUB: Pingo::zonk()"); -} - void Pingo::winningPic() { Common::File f; _vm->fadeOut(); diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h index 72fdb54c2a..e3a516c04c 100644 --- a/engines/avalanche/pingo.h +++ b/engines/avalanche/pingo.h @@ -44,14 +44,12 @@ public: void copy03(); void copyPage(byte frp, byte top); void wobble(); - void zonk(); void winningPic(); private: AvalancheEngine *_vm; void dPlot(int16 x, int16 y, Common::String z); - void zl(int16 x1, int16 y1, int16 x2, int16 y2); }; } // End of namespace Avalanche. |