AVALANCHE: Implement, rename, move zonk() and connected functions.
Implementations: zonk(), zl(). Renames: zonk() -> thunder(), zl() -> drawLightning(). Moved: the 2 above from Pingo to Animation. Addition: GraphicManager::drawLine().
This commit is contained in:
parent
b5b0aa25e0
commit
96d4b67d41
7 changed files with 55 additions and 12 deletions
|
@ -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) {
|
void Animation::setDirection(Direction dir) {
|
||||||
_direction = dir;
|
_direction = dir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,10 @@ public:
|
||||||
void handleMoveKey(const Common::Event &event);
|
void handleMoveKey(const Common::Event &event);
|
||||||
void hideInCupboard();
|
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 setDirection(Direction dir);
|
||||||
void setOldDirection(Direction dir);
|
void setOldDirection(Direction dir);
|
||||||
Direction getDirection();
|
Direction getDirection();
|
||||||
|
|
|
@ -281,6 +281,10 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16
|
||||||
return endPoint;
|
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) {
|
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);
|
return drawArc(_surface, x, y, stAngle, endAngle, radius, color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
void loadDigits();
|
void loadDigits();
|
||||||
void loadMouse(byte which);
|
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);
|
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 drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
|
||||||
void drawTriangle(Common::Point *p, Color color);
|
void drawTriangle(Common::Point *p, Color color);
|
||||||
|
@ -115,8 +116,8 @@ public:
|
||||||
void getNaturalPicture(SpriteType &sprite);
|
void getNaturalPicture(SpriteType &sprite);
|
||||||
|
|
||||||
void saveScreen();
|
void saveScreen();
|
||||||
void removeBackup();
|
|
||||||
void restoreScreen();
|
void restoreScreen();
|
||||||
|
void removeBackup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint16 kBackgroundWidth = kScreenWidth;
|
static const uint16 kBackgroundWidth = kScreenWidth;
|
||||||
|
|
|
@ -2108,7 +2108,7 @@ void Parser::doThat() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
_vm->_pingo->zonk();
|
_vm->_animation->thunder();
|
||||||
Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you." \
|
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);
|
"%c%c(`Such is the anger of the gods, Avvy!\")", kControlNewLine, kControlNewLine);
|
||||||
_vm->_dialogs->displayText(tmpStr);
|
_vm->_dialogs->displayText(tmpStr);
|
||||||
|
|
|
@ -60,14 +60,6 @@ void Pingo::wobble() {
|
||||||
warning("STUB: 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() {
|
void Pingo::winningPic() {
|
||||||
Common::File f;
|
Common::File f;
|
||||||
_vm->fadeOut();
|
_vm->fadeOut();
|
||||||
|
|
|
@ -44,14 +44,12 @@ public:
|
||||||
void copy03();
|
void copy03();
|
||||||
void copyPage(byte frp, byte top);
|
void copyPage(byte frp, byte top);
|
||||||
void wobble();
|
void wobble();
|
||||||
void zonk();
|
|
||||||
void winningPic();
|
void winningPic();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AvalancheEngine *_vm;
|
AvalancheEngine *_vm;
|
||||||
|
|
||||||
void dPlot(int16 x, int16 y, Common::String z);
|
void dPlot(int16 x, int16 y, Common::String z);
|
||||||
void zl(int16 x1, int16 y1, int16 x2, int16 y2);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Avalanche.
|
} // End of namespace Avalanche.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue