AVALANCHE: Merge Gyro, Lucerna and Avalot

This commit is contained in:
Strangerke 2013-09-21 22:26:36 +02:00
parent 89471e76d1
commit 4b4f07a7f6
18 changed files with 3236 additions and 3466 deletions

View file

@ -30,8 +30,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
#include "avalanche/dialogs.h" #include "avalanche/dialogs.h"
#include "avalanche/lucerna.h"
#include "avalanche/gyro.h"
#include "avalanche/background.h" #include "avalanche/background.h"
#include "avalanche/sequence.h" #include "avalanche/sequence.h"
#include "avalanche/timer.h" #include "avalanche/timer.h"
@ -149,8 +147,8 @@ void AnimationType::turn(byte whichway) {
void AnimationType::appear(int16 wx, int16 wy, byte wf) { void AnimationType::appear(int16 wx, int16 wy, byte wf) {
_x = (wx / 8) * 8; _x = (wx / 8) * 8;
_y = wy; _y = wy;
_oldX[_anim->_vm->_gyro->_cp] = wx; _oldX[_anim->_vm->_avalot->_cp] = wx;
_oldY[_anim->_vm->_gyro->_cp] = wy; _oldY[_anim->_vm->_avalot->_cp] = wy;
turn(wf); turn(wf);
_visible = true; _visible = true;
_moveX = 0; _moveX = 0;
@ -182,9 +180,9 @@ void AnimationType::walk() {
r._y2 = _y + _info._yLength + 2; r._y2 = _y + _info._yLength + 2;
} }
if (!_anim->_vm->_gyro->_doingSpriteRun) { if (!_anim->_vm->_avalot->_doingSpriteRun) {
_oldX[_anim->_vm->_gyro->_cp] = _x; _oldX[_anim->_vm->_avalot->_cp] = _x;
_oldY[_anim->_vm->_gyro->_cp] = _y; _oldY[_anim->_vm->_avalot->_cp] = _y;
if (_homing) if (_homing)
homeStep(); homeStep();
_x += _moveX; _x += _moveX;
@ -197,40 +195,40 @@ void AnimationType::walk() {
return; return;
} }
byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_gyro->_cp], _y, _info._yLength) - 1; byte magicColor = _anim->checkFeet(_x, _x + _info._xLength, _oldY[_anim->_vm->_avalot->_cp], _y, _info._yLength) - 1;
// -1 is because the modified array indexes of magics[] compared to Pascal . // -1 is because the modified array indexes of magics[] compared to Pascal .
if ((magicColor != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { if ((magicColor != 255) & (!_anim->_vm->_avalot->_doingSpriteRun)) {
MagicType *magic = &_anim->_vm->_gyro->_magics[magicColor]; MagicType *magic = &_anim->_vm->_avalot->_magics[magicColor];
switch (magic->_operation) { switch (magic->_operation) {
case Gyro::kMagicExclaim: case Avalot::kMagicExclaim:
bounce(); bounce();
_anim->_mustExclaim = true; _anim->_mustExclaim = true;
_anim->_sayWhat = magic->_data; _anim->_sayWhat = magic->_data;
break; break;
case Gyro::kMagicBounce: case Avalot::kMagicBounce:
bounce(); bounce();
break; break;
case Gyro::kMagicTransport: case Avalot::kMagicTransport:
_anim->flipRoom(magic->_data >> 8, magic->_data & 0xff); _anim->flipRoom(magic->_data >> 8, magic->_data & 0xff);
break; break;
case Gyro::kMagicUnfinished: { case Avalot::kMagicUnfinished: {
bounce(); bounce();
Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman); Common::String tmpStr = Common::String::format("%c%cSorry.%cThis place is not available yet!", Dialogs::kControlBell, Dialogs::kControlCenter, Dialogs::kControlRoman);
_anim->_vm->_dialogs->displayText(tmpStr); _anim->_vm->_dialogs->displayText(tmpStr);
} }
break; break;
case Gyro::kMagicSpecial: case Avalot::kMagicSpecial:
_anim->callSpecial(magic->_data); _anim->callSpecial(magic->_data);
break; break;
case Gyro::kMagicOpenDoor: case Avalot::kMagicOpenDoor:
_anim->openDoor(magic->_data >> 8, magic->_data & 0xff, magicColor); _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, magicColor);
break; break;
} }
} }
} }
if (!_anim->_vm->_gyro->_doingSpriteRun) { if (!_anim->_vm->_avalot->_doingSpriteRun) {
_count++; _count++;
if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) {
_stepNum++; _stepNum++;
@ -242,13 +240,13 @@ void AnimationType::walk() {
} }
void AnimationType::bounce() { void AnimationType::bounce() {
_x = _oldX[_anim->_vm->_gyro->_cp]; _x = _oldX[_anim->_vm->_avalot->_cp];
_y = _oldY[_anim->_vm->_gyro->_cp]; _y = _oldY[_anim->_vm->_avalot->_cp];
if (_doCheck) if (_doCheck)
_anim->stopWalking(); _anim->stopWalking();
else else
stopWalk(); stopWalk();
_anim->_vm->_lucerna->drawDirection(); _anim->_vm->_avalot->drawDirection();
} }
int8 AnimationType::getSign(int16 val) { int8 AnimationType::getSign(int16 val) {
@ -261,7 +259,7 @@ int8 AnimationType::getSign(int16 val) {
} }
void AnimationType::walkTo(byte pedNum) { void AnimationType::walkTo(byte pedNum) {
PedType *curPed = &_anim->_vm->_gyro->_peds[pedNum]; PedType *curPed = &_anim->_vm->_avalot->_peds[pedNum];
setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y));
_homingX = curPed->_x - _info._xLength / 2; _homingX = curPed->_x - _info._xLength / 2;
@ -329,10 +327,10 @@ void AnimationType::stopWalk() {
} }
void AnimationType::chatter() { void AnimationType::chatter() {
_anim->_vm->_gyro->_talkX = _x + _info._xLength / 2; _anim->_vm->_avalot->_talkX = _x + _info._xLength / 2;
_anim->_vm->_gyro->_talkY = _y; _anim->_vm->_avalot->_talkY = _y;
_anim->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; _anim->_vm->_avalot->_talkFontColor = _stat._fgBubbleCol;
_anim->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; _anim->_vm->_avalot->_talkBackgroundColor = _stat._bgBubbleCol;
} }
void AnimationType::remove() { void AnimationType::remove() {
@ -370,7 +368,7 @@ void Animation::loadAnims() {
} }
byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) {
if (!_vm->_gyro->_alive) if (!_vm->_avalot->_alive)
return 0; return 0;
if (x1 < 0) if (x1 < 0)
@ -415,8 +413,8 @@ void Animation::catacombMove(byte ped) {
// XY_uint16 is cat_x+cat_y*256. Thus, every room in the // XY_uint16 is cat_x+cat_y*256. Thus, every room in the
// catacombs has a different number for it. // catacombs has a different number for it.
xy_uint16 = _vm->_gyro->_catacombX + _vm->_gyro->_catacombY * 256; xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256;
_vm->_gyro->_geidaSpin = 0; _vm->_avalot->_geidaSpin = 0;
switch (xy_uint16) { switch (xy_uint16) {
case 1801: // Exit catacombs case 1801: // Exit catacombs
@ -435,78 +433,78 @@ void Animation::catacombMove(byte ped) {
case 2307: case 2307:
flipRoom(kRoomLusties, 5); flipRoom(kRoomLusties, 5);
_vm->_dialogs->displayText("Oh no... here we go again..."); _vm->_dialogs->displayText("Oh no... here we go again...");
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
_sprites[0]._moveY = 1; _sprites[0]._moveY = 1;
_sprites[0]._moveX = 0; _sprites[0]._moveX = 0;
return; return;
} }
if (!_vm->_gyro->_enterCatacombsFromLustiesRoom) if (!_vm->_avalot->_enterCatacombsFromLustiesRoom)
_vm->_lucerna->loadRoom(29); _vm->_avalot->loadRoom(29);
here = _vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1]; here = _vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1];
switch (here & 0xf) { // West. switch (here & 0xf) { // West.
case 0: // no connection (wall) case 0: // no connection (wall)
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); _vm->_background->drawBackgroundSprite(-1, -1, 27);
break; break;
case 0x1: // no connection (wall + shield), case 0x1: // no connection (wall + shield),
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield.
break; break;
case 0x2: // wall with door case 0x2: // wall with door
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door. _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door.
break; break;
case 0x3: // wall with door and shield case 0x3: // wall with door and shield
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield. _vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield.
break; break;
case 0x4: // no connection (wall + window), case 0x4: // no connection (wall + window),
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window.
break; break;
case 0x5: // wall with door and window case 0x5: // wall with door and window
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window. _vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window.
break; break;
case 0x6: // no connection (wall + torches), case 0x6: // no connection (wall + torches),
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // No door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches.
break; break;
case 0x7: // wall with door and torches case 0x7: // wall with door and torches
_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches. _vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches.
break; break;
case 0xf: // straight-through corridor. case 0xf: // straight-through corridor.
_vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // Sloping wall. _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall.
_vm->_gyro->_magics[2]._operation = Gyro::kMagicSpecial; // Straight wall. _vm->_avalot->_magics[2]._operation = Avalot::kMagicSpecial; // Straight wall.
break; break;
} }
@ -514,127 +512,127 @@ void Animation::catacombMove(byte ped) {
switch ((here & 0xf0) >> 4) { // East switch ((here & 0xf0) >> 4) { // East
case 0: // no connection (wall) case 0: // no connection (wall)
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); _vm->_background->drawBackgroundSprite(-1, -1, 18);
break; break;
case 0x1: // no connection (wall + window), case 0x1: // no connection (wall + window),
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window. _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window.
break; break;
case 0x2: // wall with door case 0x2: // wall with door
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door. _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door.
break; break;
case 0x3: // wall with door and window case 0x3: // wall with door and window
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window. _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window.
break; break;
case 0x6: // no connection (wall + torches), case 0x6: // no connection (wall + torches),
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // No door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches.
break; break;
case 0x7: // wall with door and torches case 0x7: // wall with door and torches
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus... _vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and... _vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches. _vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches.
break; break;
case 0xf: // straight-through corridor. case 0xf: // straight-through corridor.
_vm->_gyro->_magics[4]._operation = Gyro::kMagicNothing; // Sloping wall. _vm->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicSpecial; // Straight wall. _vm->_avalot->_magics[5]._operation = Avalot::kMagicSpecial; // Straight wall.
_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.
break; break;
} }
switch ((here & 0xf00) >> 8) { // South switch ((here & 0xf00) >> 8) { // South
case 0: // No connection. case 0: // No connection.
_vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce;
_vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce;
_vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;
break; break;
case 0x1: case 0x1:
_vm->_background->drawBackgroundSprite(-1, -1, 21); _vm->_background->drawBackgroundSprite(-1, -1, 21);
if ((xy_uint16 == 2051) && (_vm->_gyro->_geidaFollows)) if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows))
_vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; _vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim;
else else
_vm->_gyro->_magics[12]._operation = Gyro::kMagicSpecial; // Right exit south. _vm->_avalot->_magics[12]._operation = Avalot::kMagicSpecial; // Right exit south.
_vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce;
_vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce;
break; break;
case 0x2: case 0x2:
_vm->_background->drawBackgroundSprite(-1, -1, 22); _vm->_background->drawBackgroundSprite(-1, -1, 22);
_vm->_gyro->_magics[6]._operation = Gyro::kMagicSpecial; // Middle exit south. _vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south.
_vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce;
_vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;
break; break;
case 0x3: case 0x3:
_vm->_background->drawBackgroundSprite(-1, -1, 23); _vm->_background->drawBackgroundSprite(-1, -1, 23);
_vm->_gyro->_magics[11]._operation = Gyro::kMagicSpecial; // Left exit south. _vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south.
_vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce;
_vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;
break; break;
} }
switch ((here & 0xf000) >> 12) { // North switch ((here & 0xf000) >> 12) { // North
case 0: // No connection case 0: // No connection
_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce;
_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
break; break;
// LEFT handles: // LEFT handles:
#if 0 #if 0
case 0x1: case 0x1:
_vm->_celer->show_one(-1, -1, 4); _vm->_celer->show_one(-1, -1, 4);
_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! }
_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }
break; break;
#endif #endif
case 0x2: case 0x2:
_vm->_background->drawBackgroundSprite(-1, -1, 3); _vm->_background->drawBackgroundSprite(-1, -1, 3);
_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north.
_vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.
break; break;
#if 0 #if 0
case 0x3: case 0x3:
_vm->_celer->show_one(-1, -1, 4); _vm->_celer->show_one(-1, -1, 4);
_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } { Change magic number! }
_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }
break; break;
// RIGHT handles: // RIGHT handles:
case 0x4: case 0x4:
_vm->_celer->show_one(-1, -1, 3); _vm->_celer->show_one(-1, -1, 3);
_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! }
_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }
break; break;
#endif #endif
case 0x5: case 0x5:
_vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north.
_vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.
break; break;
#if 0 #if 0
case 0x6: case 0x6:
_vm->_celer->show_one(-1, -1, 3); _vm->_celer->show_one(-1, -1, 3);
_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } _vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. }
_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } _vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }
break; break;
#endif #endif
// ARCHWAYS: // ARCHWAYS:
@ -648,25 +646,25 @@ void Animation::catacombMove(byte ped) {
if (((here & 0xf000) >> 12) == 0x9) if (((here & 0xf000) >> 12) == 0x9)
_vm->_background->drawBackgroundSprite(-1, -1, 31); _vm->_background->drawBackgroundSprite(-1, -1, 31);
_vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. _vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north.
_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
break; break;
// DECORATIONS: // DECORATIONS:
case 0xd: // No connection + WINDOW case 0xd: // No connection + WINDOW
_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce;
_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 13); _vm->_background->drawBackgroundSprite(-1, -1, 13);
break; break;
case 0xe: // No connection + TORCH case 0xe: // No connection + TORCH
_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; _vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce;
_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 7); _vm->_background->drawBackgroundSprite(-1, -1, 7);
break; break;
// Recessed door: // Recessed door:
case 0xf: case 0xf:
_vm->_gyro->_magics[0]._operation = Gyro::kMagicNothing; // Door to Geida's room. _vm->_avalot->_magics[0]._operation = Avalot::kMagicNothing; // Door to Geida's room.
_vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. _vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.
break; break;
} }
@ -702,7 +700,7 @@ void Animation::catacombMove(byte ped) {
break; // [1,1] : the other two. break; // [1,1] : the other two.
} }
if ((_vm->_gyro->_geidaFollows) && (ped > 0)) { if ((_vm->_avalot->_geidaFollows) && (ped > 0)) {
if (!_sprites[1]._quick) // If we don't already have her... if (!_sprites[1]._quick) // If we don't already have her...
_sprites[1].init(5, true, this); // ...Load Geida. _sprites[1].init(5, true, this); // ...Load Geida.
appearPed(1, geidaPed(ped)); appearPed(1, geidaPed(ped));
@ -711,36 +709,36 @@ void Animation::catacombMove(byte ped) {
} }
} }
// This proc gets called whenever you touch a line defined as _vm->_gyro->special. // This proc gets called whenever you touch a line defined as _vm->_avalot->special.
void Animation::dawnDelay() { void Animation::dawnDelay() {
_vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay); _vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay);
} }
void Animation::callSpecial(uint16 which) { void Animation::callSpecial(uint16 which) {
switch (which) { switch (which) {
case 1: // _vm->_gyro->special 1: Room 22: top of stairs. case 1: // _vm->_avalot->special 1: Room 22: top of stairs.
_vm->_background->drawBackgroundSprite(-1, -1, 0); _vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_gyro->_brummieStairs = 1; _vm->_avalot->_brummieStairs = 1;
_vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing;
_vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs); _vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs);
stopWalking(); stopWalking();
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
break; break;
case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. case 2: // _vm->_avalot->special 2: Room 22: bottom of stairs.
_vm->_gyro->_brummieStairs = 3; _vm->_avalot->_brummieStairs = 3;
_vm->_gyro->_magics[10]._operation = Gyro::kMagicNothing; _vm->_avalot->_magics[10]._operation = Avalot::kMagicNothing;
_vm->_gyro->_magics[11]._operation = Gyro::kMagicExclaim; _vm->_avalot->_magics[11]._operation = Avalot::kMagicExclaim;
_vm->_gyro->_magics[11]._data = 5; _vm->_avalot->_magics[11]._data = 5;
_vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! _vm->_avalot->_magics[3]._operation = Avalot::kMagicBounce; // Now works as planned!
stopWalking(); stopWalking();
_vm->_dialogs->displayScrollChain('q', 26); _vm->_dialogs->displayScrollChain('q', 26);
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
break; break;
case 3: // _vm->_gyro->special 3: Room 71: triggers dart. case 3: // _vm->_avalot->special 3: Room 71: triggers dart.
_sprites[0].bounce(); // Must include that. _sprites[0].bounce(); // Must include that.
if (!_vm->_gyro->_arrowTriggered) { if (!_vm->_avalot->_arrowTriggered) {
_vm->_gyro->_arrowTriggered = true; _vm->_avalot->_arrowTriggered = true;
appearPed(1, 3); // The dart starts at ped 4, and... appearPed(1, 3); // The dart starts at ped 4, and...
_sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). _sprites[1].walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion).
_sprites[1]._facingDir = kDirUp; // Only face. _sprites[1]._facingDir = kDirUp; // Only face.
@ -754,80 +752,80 @@ void Animation::callSpecial(uint16 which) {
} }
break; break;
case 4: // This is the ghost room link. case 4: // This is the ghost room link.
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
_sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap _sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap
_vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew); _vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew);
//_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! //_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then!
break; break;
case 5: case 5:
if (_vm->_gyro->_friarWillTieYouUp) { if (_vm->_avalot->_friarWillTieYouUp) {
// _vm->_gyro->special 5: Room 42: touched tree, and get tied up. // _vm->_avalot->special 5: Room 42: touched tree, and get tied up.
_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. _vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Boundary effect is now working again.
_vm->_dialogs->displayScrollChain('q', 35); _vm->_dialogs->displayScrollChain('q', 35);
_sprites[0].remove(); _sprites[0].remove();
//tr[1].vanishifstill:=true; //tr[1].vanishifstill:=true;
_vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_dialogs->displayScrollChain('q', 36); _vm->_dialogs->displayScrollChain('q', 36);
_vm->_gyro->_tiedUp = true; _vm->_avalot->_tiedUp = true;
_vm->_gyro->_friarWillTieYouUp = false; _vm->_avalot->_friarWillTieYouUp = false;
_sprites[1].walkTo(2); _sprites[1].walkTo(2);
_sprites[1]._vanishIfStill = true; _sprites[1]._vanishIfStill = true;
_sprites[1]._doCheck = true; // One of them must have Check_Me switched on. _sprites[1]._doCheck = true; // One of them must have Check_Me switched on.
_vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then. _vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomDummy; // Not here, then.
_vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround); _vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround);
} }
break; break;
case 6: // _vm->_gyro->special 6: fall down oubliette. case 6: // _vm->_avalot->special 6: fall down oubliette.
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
_sprites[0]._moveX = 3; _sprites[0]._moveX = 3;
_sprites[0]._moveY = 0; _sprites[0]._moveY = 0;
_sprites[0]._facingDir = kDirRight; _sprites[0]._facingDir = kDirRight;
_vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette); _vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette);
break; break;
case 7: // _vm->_gyro->special 7: stop falling down oubliette. case 7: // _vm->_avalot->special 7: stop falling down oubliette.
_sprites[0]._visible = false; _sprites[0]._visible = false;
_vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; _vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing;
stopWalking(); stopWalking();
_vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); _vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette);
//_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); //_vm->_avalot->mblit(12, 80, 38, 160, 3, 0);
//_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); //_vm->_avalot->mblit(12, 80, 38, 160, 3, 1);
_vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_dialogs->displayText("Oh dear, you seem to be down the bottom of an oubliette.");
_vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid); _vm->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid);
break; break;
case 8: // _vm->_gyro->special 8: leave du Lustie's room. case 8: // _vm->_avalot->special 8: leave du Lustie's room.
if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { if ((_vm->_avalot->_geidaFollows) && (!_vm->_avalot->_lustieIsAsleep)) {
_vm->_dialogs->displayScrollChain('q', 63); _vm->_dialogs->displayScrollChain('q', 63);
_sprites[1].turn(kDirDown); _sprites[1].turn(kDirDown);
_sprites[1].stopWalk(); _sprites[1].stopWalk();
_sprites[1]._callEachStepFl = false; // Geida _sprites[1]._callEachStepFl = false; // Geida
_vm->_lucerna->gameOver(); _vm->_avalot->gameOver();
} }
break; break;
case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... case 9: // _vm->_avalot->special 9: lose Geida to Robin Hood...
if (!_vm->_gyro->_geidaFollows) if (!_vm->_avalot->_geidaFollows)
return; // DOESN'T COUNT: no Geida. return; // DOESN'T COUNT: no Geida.
_sprites[1]._callEachStepFl = false; // She no longer follows Avvy around. _sprites[1]._callEachStepFl = false; // She no longer follows Avvy around.
_sprites[1].walkTo(3); // She walks to somewhere... _sprites[1].walkTo(3); // She walks to somewhere...
_sprites[0].remove(); // Lose Avvy. _sprites[0].remove(); // Lose Avvy.
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
_vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida); _vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida);
break; break;
case 10: // _vm->_gyro->special 10: transfer north in catacombs. case 10: // _vm->_avalot->special 10: transfer north in catacombs.
if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { if ((_vm->_avalot->_catacombX == 4) && (_vm->_avalot->_catacombY == 1)) {
// Into Geida's room. // Into Geida's room.
if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) if (_vm->_avalot->_objects[Avalot::kObjectKey - 1])
_vm->_dialogs->displayScrollChain('q', 62); _vm->_dialogs->displayScrollChain('q', 62);
else { else {
_vm->_dialogs->displayScrollChain('q', 61); _vm->_dialogs->displayScrollChain('q', 61);
return; return;
} }
} }
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
_vm->_gyro->_catacombY--; _vm->_avalot->_catacombY--;
catacombMove(4); catacombMove(4);
if (_vm->_gyro->_room != kRoomCatacombs) if (_vm->_avalot->_room != kRoomCatacombs)
return; return;
switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1] & 0xf00) >> 8) { switch ((_vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1] & 0xf00) >> 8) {
case 0x1: case 0x1:
appearPed(0, 11); appearPed(0, 11);
break; break;
@ -839,29 +837,29 @@ void Animation::callSpecial(uint16 which) {
} }
dawnDelay(); dawnDelay();
break; break;
case 11: // _vm->_gyro->special 11: transfer east in catacombs. case 11: // _vm->_avalot->special 11: transfer east in catacombs.
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
_vm->_gyro->_catacombX++; _vm->_avalot->_catacombX++;
catacombMove(1); catacombMove(1);
if (_vm->_gyro->_room != kRoomCatacombs) if (_vm->_avalot->_room != kRoomCatacombs)
return; return;
appearPed(0, 0); appearPed(0, 0);
dawnDelay(); dawnDelay();
break; break;
case 12: // _vm->_gyro->special 12: transfer south in catacombs. case 12: // _vm->_avalot->special 12: transfer south in catacombs.
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
_vm->_gyro->_catacombY += 1; _vm->_avalot->_catacombY += 1;
catacombMove(2); catacombMove(2);
if (_vm->_gyro->_room != kRoomCatacombs) if (_vm->_avalot->_room != kRoomCatacombs)
return; return;
appearPed(0, 1); appearPed(0, 1);
dawnDelay(); dawnDelay();
break; break;
case 13: // _vm->_gyro->special 13: transfer west in catacombs. case 13: // _vm->_avalot->special 13: transfer west in catacombs.
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
_vm->_gyro->_catacombX--; _vm->_avalot->_catacombX--;
catacombMove(3); catacombMove(3);
if (_vm->_gyro->_room != kRoomCatacombs) if (_vm->_avalot->_room != kRoomCatacombs)
return; return;
appearPed(0, 2); appearPed(0, 2);
dawnDelay(); dawnDelay();
@ -877,7 +875,7 @@ void Animation::callSpecial(uint16 which) {
* @remarks Originally called 'open_the_door' * @remarks Originally called 'open_the_door'
*/ */
void Animation::openDoor(byte whither, byte ped, byte magicnum) { void Animation::openDoor(byte whither, byte ped, byte magicnum) {
switch (_vm->_gyro->_room) { switch (_vm->_avalot->_room) {
case kRoomOutsideYours: case kRoomOutsideYours:
case kRoomOutsideNottsPub: case kRoomOutsideNottsPub:
case kRoomOutsideDucks: case kRoomOutsideDucks:
@ -904,7 +902,7 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) {
case kRoomLusties: case kRoomLusties:
switch (magicnum) { switch (magicnum) {
case 14: case 14:
if (_vm->_gyro->_avvysInTheCupboard) { if (_vm->_avalot->_avvysInTheCupboard) {
hideInCupboard(); hideInCupboard();
_vm->_sequence->firstShow(8); _vm->_sequence->firstShow(8);
_vm->_sequence->thenShow(7); _vm->_sequence->thenShow(7);
@ -935,12 +933,12 @@ void Animation::updateSpeed() {
_sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; _sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX;
if (_sprites[0]._speedX == _vm->_gyro->kRun) if (_sprites[0]._speedX == _vm->_avalot->kRun)
_vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow);
else else
_vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow);
if (_sprites[0]._speedX == _vm->_gyro->kRun) if (_sprites[0]._speedX == _vm->_avalot->kRun)
_vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue);
else else
_vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue);
@ -977,7 +975,7 @@ void Animation::changeDirection(byte t, byte dir) {
void Animation::appearPed(byte sprNum, byte pedNum) { void Animation::appearPed(byte sprNum, byte pedNum) {
AnimationType *curSpr = &_sprites[sprNum]; AnimationType *curSpr = &_sprites[sprNum];
PedType *curPed = &_vm->_gyro->_peds[pedNum]; PedType *curPed = &_vm->_avalot->_peds[pedNum];
curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction);
changeDirection(sprNum, curPed->_direction); changeDirection(sprNum, curPed->_direction);
} }
@ -1037,15 +1035,15 @@ void Animation::arrowProcs(byte tripnum) {
_vm->_dialogs->displayScrollChain('Q', 47); // Complaint! _vm->_dialogs->displayScrollChain('Q', 47); // Complaint!
_sprites[tripnum].remove(); // Deallocate the arrow. _sprites[tripnum].remove(); // Deallocate the arrow.
_vm->_lucerna->gameOver(); _vm->_avalot->gameOver();
_vm->_gyro->_userMovesAvvy = false; // Stop the user from moving him. _vm->_avalot->_userMovesAvvy = false; // Stop the user from moving him.
_vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke); _vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke);
} }
} else { // Arrow has hit the wall! } else { // Arrow has hit the wall!
_sprites[tripnum].remove(); // Deallocate the arrow. _sprites[tripnum].remove(); // Deallocate the arrow.
_vm->_background->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door. _vm->_background->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door.
_vm->_gyro->_arrowInTheDoor = true; // So that we can pick it up. _vm->_avalot->_arrowInTheDoor = true; // So that we can pick it up.
} }
} }
@ -1088,21 +1086,21 @@ void Animation::spin(byte whichway, byte &tripnum) {
if (_sprites[tripnum]._id == 2) if (_sprites[tripnum]._id == 2)
return; // Not for Spludwick return; // Not for Spludwick
_vm->_gyro->_geidaSpin += 1; _vm->_avalot->_geidaSpin += 1;
_vm->_gyro->_geidaTime = 20; _vm->_avalot->_geidaTime = 20;
if (_vm->_gyro->_geidaSpin == 5) { if (_vm->_avalot->_geidaSpin == 5) {
_vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); _vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!");
_vm->_gyro->_geidaSpin = 0; _vm->_avalot->_geidaSpin = 0;
_vm->_gyro->_geidaTime = 0; // knock out records _vm->_avalot->_geidaTime = 0; // knock out records
} }
} }
} }
void Animation::geidaProcs(byte tripnum) { void Animation::geidaProcs(byte tripnum) {
if (_vm->_gyro->_geidaTime > 0) { if (_vm->_avalot->_geidaTime > 0) {
_vm->_gyro->_geidaTime--; _vm->_avalot->_geidaTime--;
if (_vm->_gyro->_geidaTime == 0) if (_vm->_avalot->_geidaTime == 0)
_vm->_gyro->_geidaSpin = 0; _vm->_avalot->_geidaSpin = 0;
} }
if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) {
@ -1178,7 +1176,7 @@ void Animation::drawSprites() {
* @remarks Originally called 'trippancy_link' * @remarks Originally called 'trippancy_link'
*/ */
void Animation::animLink() { void Animation::animLink() {
if (_vm->_menu->isActive() | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) if (_vm->_menu->isActive() | _vm->_avalot->_onToolbar | _vm->_avalot->_seeScroll)
return; return;
for (int16 i = 0; i < kSpriteNumbMax; i++) { for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (_sprites[i]._quick && _sprites[i]._visible) if (_sprites[i]._quick && _sprites[i]._visible)
@ -1222,7 +1220,7 @@ void Animation::animLink() {
void Animation::stopWalking() { void Animation::stopWalking() {
_sprites[0].stopWalk(); _sprites[0].stopWalk();
_direction = kDirStopped; _direction = kDirStopped;
if (_vm->_gyro->_alive) if (_vm->_avalot->_alive)
_sprites[0]._stepNum = 1; _sprites[0]._stepNum = 1;
} }
@ -1231,16 +1229,16 @@ void Animation::stopWalking() {
* @remarks Originally called 'hide_in_the_cupboard' * @remarks Originally called 'hide_in_the_cupboard'
*/ */
void Animation::hideInCupboard() { void Animation::hideInCupboard() {
if (_vm->_gyro->_avvysInTheCupboard) { if (_vm->_avalot->_avvysInTheCupboard) {
if (_vm->_gyro->_wearing == Parser::kNothing) { if (_vm->_avalot->_wearing == Parser::kNothing) {
Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman);
_vm->_dialogs->displayText(tmpStr); _vm->_dialogs->displayText(tmpStr);
} else { } else {
_sprites[0]._visible = true; _sprites[0]._visible = true;
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
appearPed(0, 2); // Walk out of the cupboard. appearPed(0, 2); // Walk out of the cupboard.
_vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); _vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!");
_vm->_gyro->_avvysInTheCupboard = false; _vm->_avalot->_avvysInTheCupboard = false;
_vm->_sequence->firstShow(8); _vm->_sequence->firstShow(8);
_vm->_sequence->thenShow(7); _vm->_sequence->thenShow(7);
_vm->_sequence->startToClose(); _vm->_sequence->startToClose();
@ -1248,65 +1246,65 @@ void Animation::hideInCupboard() {
} else { } else {
// Not hiding in the cupboard // Not hiding in the cupboard
_sprites[0]._visible = false; _sprites[0]._visible = false;
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \ Common::String tmpStr = Common::String::format("You walk into the room...%cIt seems to be an empty, " \
"but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph); "but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph);
_vm->_dialogs->displayText(tmpStr); _vm->_dialogs->displayText(tmpStr);
_vm->_gyro->_avvysInTheCupboard = true; _vm->_avalot->_avvysInTheCupboard = true;
_vm->_background->drawBackgroundSprite(-1, -1, 7); _vm->_background->drawBackgroundSprite(-1, -1, 7);
} }
} }
void Animation::flipRoom(byte room, byte ped) { void Animation::flipRoom(byte room, byte ped) {
assert((ped > 0) && (ped < 15)); assert((ped > 0) && (ped < 15));
if (!_vm->_gyro->_alive) { if (!_vm->_avalot->_alive) {
// You can't leave the room if you're dead. // You can't leave the room if you're dead.
_sprites[0]._moveX = 0; _sprites[0]._moveX = 0;
_sprites[0]._moveY = 0; // Stop him from moving. _sprites[0]._moveY = 0; // Stop him from moving.
return; return;
} }
if ((room == kRoomDummy) && (_vm->_gyro->_room == kRoomLusties)) { if ((room == kRoomDummy) && (_vm->_avalot->_room == kRoomLusties)) {
hideInCupboard(); hideInCupboard();
return; return;
} }
if ((_vm->_gyro->_jumpStatus > 0) && (_vm->_gyro->_room == kRoomInsideCardiffCastle)) { if ((_vm->_avalot->_jumpStatus > 0) && (_vm->_avalot->_room == kRoomInsideCardiffCastle)) {
// You can't *jump* out of Cardiff Castle! // You can't *jump* out of Cardiff Castle!
_sprites[0]._moveX = 0; _sprites[0]._moveX = 0;
return; return;
} }
_vm->_lucerna->exitRoom(_vm->_gyro->_room); _vm->_avalot->exitRoom(_vm->_avalot->_room);
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
for (int16 i = 1; i < kSpriteNumbMax; i++) { for (int16 i = 1; i < kSpriteNumbMax; i++) {
if (_sprites[i]._quick) if (_sprites[i]._quick)
_sprites[i].remove(); _sprites[i].remove();
} // Deallocate sprite } // Deallocate sprite
if (_vm->_gyro->_room == kRoomLustiesRoom) if (_vm->_avalot->_room == kRoomLustiesRoom)
_vm->_gyro->_enterCatacombsFromLustiesRoom = true; _vm->_avalot->_enterCatacombsFromLustiesRoom = true;
_vm->_lucerna->enterRoom(room, ped); _vm->_avalot->enterRoom(room, ped);
appearPed(0, ped - 1); appearPed(0, ped - 1);
_vm->_gyro->_enterCatacombsFromLustiesRoom = false; _vm->_avalot->_enterCatacombsFromLustiesRoom = false;
_oldDirection = _direction; _oldDirection = _direction;
_direction = _sprites[0]._facingDir; _direction = _sprites[0]._facingDir;
_vm->_lucerna->drawDirection(); _vm->_avalot->drawDirection();
_vm->_lucerna->dawn(); _vm->_avalot->dawn();
} }
bool Animation::inField(byte which) { bool Animation::inField(byte which) {
FieldType *curField = &_vm->_gyro->_fields[which]; FieldType *curField = &_vm->_avalot->_fields[which];
int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength;
return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2);
} }
bool Animation::nearDoor() { bool Animation::nearDoor() {
if (_vm->_gyro->_fieldNum < 8) { if (_vm->_avalot->_fieldNum < 8) {
// there ARE no doors here! // there ARE no doors here!
return false; return false;
} }
@ -1314,8 +1312,8 @@ bool Animation::nearDoor() {
int16 ux = _sprites[0]._x; int16 ux = _sprites[0]._x;
int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; int16 uy = _sprites[0]._y + _sprites[0]._info._yLength;
for (int i = 8; i < _vm->_gyro->_fieldNum; i++) { for (int i = 8; i < _vm->_avalot->_fieldNum; i++) {
FieldType *curField = &_vm->_gyro->_fields[i]; FieldType *curField = &_vm->_avalot->_fields[i];
if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2))
return true; return true;
} }
@ -1324,7 +1322,7 @@ bool Animation::nearDoor() {
} }
void Animation::handleMoveKey(const Common::Event &event) { void Animation::handleMoveKey(const Common::Event &event) {
if (!_vm->_gyro->_userMovesAvvy) if (!_vm->_avalot->_userMovesAvvy)
return; return;
if (_vm->_menu->_activeMenuItem._activeNow) if (_vm->_menu->_activeMenuItem._activeNow)

View file

@ -64,14 +64,12 @@ AvalancheEngine::~AvalancheEngine() {
delete _avalot; delete _avalot;
delete _pingo; delete _pingo;
delete _dialogs; delete _dialogs;
delete _lucerna;
delete _background; delete _background;
delete _sequence; delete _sequence;
delete _timer; delete _timer;
delete _animation; delete _animation;
delete _menu; delete _menu;
delete _closing; delete _closing;
delete _gyro;
delete _sound; delete _sound;
} }
@ -80,10 +78,8 @@ Common::ErrorCode AvalancheEngine::initialize() {
_parser = new Parser(this); _parser = new Parser(this);
_avalot = new Avalot(this); _avalot = new Avalot(this);
_gyro = new Gyro(this);
_pingo = new Pingo(this); _pingo = new Pingo(this);
_dialogs = new Dialogs(this); _dialogs = new Dialogs(this);
_lucerna = new Lucerna(this);
_background = new Background(this); _background = new Background(this);
_sequence = new Sequence(this); _sequence = new Sequence(this);
_timer = new Timer(this); _timer = new Timer(this);
@ -94,7 +90,7 @@ Common::ErrorCode AvalancheEngine::initialize() {
_graphics->init(); _graphics->init();
_dialogs->init(); _dialogs->init();
_lucerna->init(); _avalot->init();
_parser->init(); _parser->init();
return Common::kNoError; return Common::kNoError;
@ -119,145 +115,145 @@ const char *AvalancheEngine::getCopyrightString() const {
void AvalancheEngine::synchronize(Common::Serializer &sz) { void AvalancheEngine::synchronize(Common::Serializer &sz) {
//blockwrite(f, dna, sizeof(dna)); //blockwrite(f, dna, sizeof(dna));
sz.syncAsByte(_animation->_direction); sz.syncAsByte(_animation->_direction);
sz.syncAsByte(_gyro->_carryNum); sz.syncAsByte(_avalot->_carryNum);
for (int i = 0; i < kObjectNum; i++) for (int i = 0; i < kObjectNum; i++)
sz.syncAsByte(_gyro->_objects[i]); sz.syncAsByte(_avalot->_objects[i]);
sz.syncAsSint16LE(_gyro->_dnascore); sz.syncAsSint16LE(_avalot->_dnascore);
sz.syncAsSint32LE(_gyro->_money); sz.syncAsSint32LE(_avalot->_money);
sz.syncAsByte(_gyro->_room); sz.syncAsByte(_avalot->_room);
sz.syncAsByte(_gyro->_wearing); sz.syncAsByte(_avalot->_wearing);
sz.syncAsByte(_gyro->_sworeNum); sz.syncAsByte(_avalot->_sworeNum);
sz.syncAsByte(_gyro->_saveNum); sz.syncAsByte(_avalot->_saveNum);
sz.syncBytes(_gyro->_roomCount, 100); sz.syncBytes(_avalot->_roomCount, 100);
sz.syncAsByte(_gyro->_alcoholLevel); sz.syncAsByte(_avalot->_alcoholLevel);
sz.syncAsByte(_gyro->_playedNim); sz.syncAsByte(_avalot->_playedNim);
sz.syncAsByte(_gyro->_wonNim); sz.syncAsByte(_avalot->_wonNim);
sz.syncAsByte(_gyro->_wineState); sz.syncAsByte(_avalot->_wineState);
sz.syncAsByte(_gyro->_cwytalotGone); sz.syncAsByte(_avalot->_cwytalotGone);
sz.syncAsByte(_gyro->_passwordNum); sz.syncAsByte(_avalot->_passwordNum);
sz.syncAsByte(_gyro->_aylesIsAwake); sz.syncAsByte(_avalot->_aylesIsAwake);
sz.syncAsByte(_gyro->_drawbridgeOpen); sz.syncAsByte(_avalot->_drawbridgeOpen);
sz.syncAsByte(_gyro->_avariciusTalk); sz.syncAsByte(_avalot->_avariciusTalk);
sz.syncAsByte(_gyro->_boughtOnion); sz.syncAsByte(_avalot->_boughtOnion);
sz.syncAsByte(_gyro->_rottenOnion); sz.syncAsByte(_avalot->_rottenOnion);
sz.syncAsByte(_gyro->_onionInVinegar); sz.syncAsByte(_avalot->_onionInVinegar);
sz.syncAsByte(_gyro->_givenToSpludwick); sz.syncAsByte(_avalot->_givenToSpludwick);
sz.syncAsByte(_gyro->_brummieStairs); sz.syncAsByte(_avalot->_brummieStairs);
sz.syncAsByte(_gyro->_cardiffQuestionNum); sz.syncAsByte(_avalot->_cardiffQuestionNum);
sz.syncAsByte(_gyro->_passedCwytalotInHerts); sz.syncAsByte(_avalot->_passedCwytalotInHerts);
sz.syncAsByte(_gyro->_avvyIsAwake); sz.syncAsByte(_avalot->_avvyIsAwake);
sz.syncAsByte(_gyro->_avvyInBed); sz.syncAsByte(_avalot->_avvyInBed);
sz.syncAsByte(_gyro->_userMovesAvvy); sz.syncAsByte(_avalot->_userMovesAvvy);
sz.syncAsByte(_gyro->_npcFacing); sz.syncAsByte(_avalot->_npcFacing);
sz.syncAsByte(_gyro->_givenBadgeToIby); sz.syncAsByte(_avalot->_givenBadgeToIby);
sz.syncAsByte(_gyro->_friarWillTieYouUp); sz.syncAsByte(_avalot->_friarWillTieYouUp);
sz.syncAsByte(_gyro->_tiedUp); sz.syncAsByte(_avalot->_tiedUp);
sz.syncAsByte(_gyro->_boxContent); sz.syncAsByte(_avalot->_boxContent);
sz.syncAsByte(_gyro->_talkedToCrapulus); sz.syncAsByte(_avalot->_talkedToCrapulus);
sz.syncAsByte(_gyro->_jacquesState); sz.syncAsByte(_avalot->_jacquesState);
sz.syncAsByte(_gyro->_bellsAreRinging); sz.syncAsByte(_avalot->_bellsAreRinging);
sz.syncAsByte(_gyro->_standingOnDais); sz.syncAsByte(_avalot->_standingOnDais);
sz.syncAsByte(_gyro->_takenPen); sz.syncAsByte(_avalot->_takenPen);
sz.syncAsByte(_gyro->_arrowTriggered); sz.syncAsByte(_avalot->_arrowTriggered);
sz.syncAsByte(_gyro->_arrowInTheDoor); sz.syncAsByte(_avalot->_arrowInTheDoor);
if (sz.isSaving()) { if (sz.isSaving()) {
uint16 like2drinkSize = _gyro->_favouriteDrink.size(); uint16 like2drinkSize = _avalot->_favouriteDrink.size();
sz.syncAsUint16LE(like2drinkSize); sz.syncAsUint16LE(like2drinkSize);
for (uint16 i = 0; i < like2drinkSize; i++) { for (uint16 i = 0; i < like2drinkSize; i++) {
char actChr = _gyro->_favouriteDrink[i]; char actChr = _avalot->_favouriteDrink[i];
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
} }
uint16 favourite_songSize = _gyro->_favouriteSong.size(); uint16 favourite_songSize = _avalot->_favouriteSong.size();
sz.syncAsUint16LE(favourite_songSize); sz.syncAsUint16LE(favourite_songSize);
for (uint16 i = 0; i < favourite_songSize; i++) { for (uint16 i = 0; i < favourite_songSize; i++) {
char actChr = _gyro->_favouriteSong[i]; char actChr = _avalot->_favouriteSong[i];
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
} }
uint16 worst_place_on_earthSize = _gyro->_worstPlaceOnEarth.size(); uint16 worst_place_on_earthSize = _avalot->_worstPlaceOnEarth.size();
sz.syncAsUint16LE(worst_place_on_earthSize); sz.syncAsUint16LE(worst_place_on_earthSize);
for (uint16 i = 0; i < worst_place_on_earthSize; i++) { for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
char actChr = _gyro->_worstPlaceOnEarth[i]; char actChr = _avalot->_worstPlaceOnEarth[i];
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
} }
uint16 spare_eveningSize = _gyro->_spareEvening.size(); uint16 spare_eveningSize = _avalot->_spareEvening.size();
sz.syncAsUint16LE(spare_eveningSize); sz.syncAsUint16LE(spare_eveningSize);
for (uint16 i = 0; i < spare_eveningSize; i++) { for (uint16 i = 0; i < spare_eveningSize; i++) {
char actChr = _gyro->_spareEvening[i]; char actChr = _avalot->_spareEvening[i];
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
} }
} else { } else {
if (!_gyro->_favouriteDrink.empty()) if (!_avalot->_favouriteDrink.empty())
_gyro->_favouriteDrink.clear(); _avalot->_favouriteDrink.clear();
uint16 like2drinkSize = 0; uint16 like2drinkSize = 0;
char actChr = ' '; char actChr = ' ';
sz.syncAsUint16LE(like2drinkSize); sz.syncAsUint16LE(like2drinkSize);
for (uint16 i = 0; i < like2drinkSize; i++) { for (uint16 i = 0; i < like2drinkSize; i++) {
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
_gyro->_favouriteDrink += actChr; _avalot->_favouriteDrink += actChr;
} }
if (!_gyro->_favouriteSong.empty()) if (!_avalot->_favouriteSong.empty())
_gyro->_favouriteSong.clear(); _avalot->_favouriteSong.clear();
uint16 favourite_songSize = 0; uint16 favourite_songSize = 0;
sz.syncAsUint16LE(favourite_songSize); sz.syncAsUint16LE(favourite_songSize);
for (uint16 i = 0; i < favourite_songSize; i++) { for (uint16 i = 0; i < favourite_songSize; i++) {
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
_gyro->_favouriteSong += actChr; _avalot->_favouriteSong += actChr;
} }
if (!_gyro->_worstPlaceOnEarth.empty()) if (!_avalot->_worstPlaceOnEarth.empty())
_gyro->_worstPlaceOnEarth.clear(); _avalot->_worstPlaceOnEarth.clear();
uint16 worst_place_on_earthSize = 0; uint16 worst_place_on_earthSize = 0;
sz.syncAsUint16LE(worst_place_on_earthSize); sz.syncAsUint16LE(worst_place_on_earthSize);
for (uint16 i = 0; i < worst_place_on_earthSize; i++) { for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
_gyro->_worstPlaceOnEarth += actChr; _avalot->_worstPlaceOnEarth += actChr;
} }
if (!_gyro->_spareEvening.empty()) if (!_avalot->_spareEvening.empty())
_gyro->_spareEvening.clear(); _avalot->_spareEvening.clear();
uint16 spare_eveningSize = 0; uint16 spare_eveningSize = 0;
sz.syncAsUint16LE(spare_eveningSize); sz.syncAsUint16LE(spare_eveningSize);
for (uint16 i = 0; i < spare_eveningSize; i++) { for (uint16 i = 0; i < spare_eveningSize; i++) {
sz.syncAsByte(actChr); sz.syncAsByte(actChr);
_gyro->_spareEvening += actChr; _avalot->_spareEvening += actChr;
} }
} }
sz.syncAsSint32LE(_gyro->_totalTime); sz.syncAsSint32LE(_avalot->_totalTime);
sz.syncAsByte(_gyro->_jumpStatus); sz.syncAsByte(_avalot->_jumpStatus);
sz.syncAsByte(_gyro->_mushroomGrowing); sz.syncAsByte(_avalot->_mushroomGrowing);
sz.syncAsByte(_gyro->_spludwickAtHome); sz.syncAsByte(_avalot->_spludwickAtHome);
sz.syncAsByte(_gyro->_lastRoom); sz.syncAsByte(_avalot->_lastRoom);
sz.syncAsByte(_gyro->_lastRoomNotMap); sz.syncAsByte(_avalot->_lastRoomNotMap);
sz.syncAsByte(_gyro->_crapulusWillTell); sz.syncAsByte(_avalot->_crapulusWillTell);
sz.syncAsByte(_gyro->_enterCatacombsFromLustiesRoom); sz.syncAsByte(_avalot->_enterCatacombsFromLustiesRoom);
sz.syncAsByte(_gyro->_teetotal); sz.syncAsByte(_avalot->_teetotal);
sz.syncAsByte(_gyro->_malagauche); sz.syncAsByte(_avalot->_malagauche);
sz.syncAsByte(_gyro->_drinking); sz.syncAsByte(_avalot->_drinking);
sz.syncAsByte(_gyro->_enteredLustiesRoomAsMonk); sz.syncAsByte(_avalot->_enteredLustiesRoomAsMonk);
sz.syncAsByte(_gyro->_catacombX); sz.syncAsByte(_avalot->_catacombX);
sz.syncAsByte(_gyro->_catacombY); sz.syncAsByte(_avalot->_catacombY);
sz.syncAsByte(_gyro->_avvysInTheCupboard); sz.syncAsByte(_avalot->_avvysInTheCupboard);
sz.syncAsByte(_gyro->_geidaFollows); sz.syncAsByte(_avalot->_geidaFollows);
sz.syncAsByte(_gyro->_geidaSpin); sz.syncAsByte(_avalot->_geidaSpin);
sz.syncAsByte(_gyro->_geidaTime); sz.syncAsByte(_avalot->_geidaTime);
sz.syncAsByte(_gyro->_nextBell); sz.syncAsByte(_avalot->_nextBell);
sz.syncAsByte(_gyro->_givenPotionToGeida); sz.syncAsByte(_avalot->_givenPotionToGeida);
sz.syncAsByte(_gyro->_lustieIsAsleep); sz.syncAsByte(_avalot->_lustieIsAsleep);
sz.syncAsByte(_gyro->_flipToWhere); sz.syncAsByte(_avalot->_flipToWhere);
sz.syncAsByte(_gyro->_flipToPed); sz.syncAsByte(_avalot->_flipToPed);
sz.syncAsByte(_gyro->_beenTiedUp); sz.syncAsByte(_avalot->_beenTiedUp);
sz.syncAsByte(_gyro->_sittingInPub); sz.syncAsByte(_avalot->_sittingInPub);
sz.syncAsByte(_gyro->_spurgeTalkCount); sz.syncAsByte(_avalot->_spurgeTalkCount);
sz.syncAsByte(_gyro->_metAvaroid); sz.syncAsByte(_avalot->_metAvaroid);
sz.syncAsByte(_gyro->_takenMushroom); sz.syncAsByte(_avalot->_takenMushroom);
sz.syncAsByte(_gyro->_givenPenToAyles); sz.syncAsByte(_avalot->_givenPenToAyles);
sz.syncAsByte(_gyro->_askedDogfoodAboutNim); sz.syncAsByte(_avalot->_askedDogfoodAboutNim);
#if 0 #if 0
@ -334,7 +330,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
} }
bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!! bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!!
return (!_gyro->_seeScroll && _gyro->_alive); return (!_avalot->_seeScroll && _avalot->_alive);
} }
Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) { Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) {
@ -380,7 +376,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) {
} }
bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!!
return (!_gyro->_seeScroll); return (!_avalot->_seeScroll);
} }
Common::Error AvalancheEngine::loadGameState(int slot) { Common::Error AvalancheEngine::loadGameState(int slot) {
@ -429,29 +425,29 @@ bool AvalancheEngine::loadGame(const int16 slot) {
synchronize(sz); synchronize(sz);
delete f; delete f;
_gyro->_isLoaded = true; _avalot->_isLoaded = true;
_gyro->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded. _avalot->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded.
if (_gyro->_holdTheDawn) { if (_avalot->_holdTheDawn) {
_gyro->_holdTheDawn = false; _avalot->_holdTheDawn = false;
_lucerna->dawn(); _avalot->dawn();
} }
_background->forgetBackgroundSprites(); _background->forgetBackgroundSprites();
_lucerna->minorRedraw(); _avalot->minorRedraw();
_menu->setup(); _menu->setup();
_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room; _avalot->_whereIs[Avalot::kPeopleAvalot - 150] = _avalot->_room;
_gyro->_alive = true; _avalot->_alive = true;
_lucerna->refreshObjectList(); _avalot->refreshObjectList();
_animation->updateSpeed(); _animation->updateSpeed();
_lucerna->drawDirection(); _avalot->drawDirection();
_gyro->_onToolbar = false; _avalot->_onToolbar = false;
_animation->animLink(); _animation->animLink();
_background->updateBackgroundSprites(); _background->updateBackgroundSprites();
Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.", Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.",
Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter, Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter,
Dialogs::kControlNewLine, Dialogs::kControlNewLine, _gyro->_roomnName.c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, _avalot->_roomnName.c_str(), Dialogs::kControlNewLine,
Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); Dialogs::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str());
_dialogs->displayText(tmpStr); _dialogs->displayText(tmpStr);
@ -468,7 +464,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) {
}; };
Common::String month = months[m]; Common::String month = months[m];
Common::String day = _gyro->intToStr(d); Common::String day = _avalot->intToStr(d);
if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31)))
switch (d % 10) { switch (d % 10) {
@ -485,7 +481,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) {
day += "th"; day += "th";
} }
return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); return day + ' ' + month + ' ' + _avalot->intToStr(y + 1900);
} }
void AvalancheEngine::updateEvents() { void AvalancheEngine::updateEvents() {
@ -494,10 +490,10 @@ void AvalancheEngine::updateEvents() {
while (_eventMan->pollEvent(event)) { while (_eventMan->pollEvent(event)) {
switch (event.type) { switch (event.type) {
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:
_lucerna->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). _avalot->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link().
break; break;
case Common::EVENT_LBUTTONUP: case Common::EVENT_LBUTTONUP:
_lucerna->_holdLeftMouse = false; // Same as above. _avalot->_holdLeftMouse = false; // Same as above.
break; break;
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
_avalot->handleKeyDown(event); _avalot->handleKeyDown(event);
@ -541,7 +537,7 @@ Common::Error AvalancheEngine::run() {
//} //}
#endif #endif
} while (!_gyro->_letMeOut && !shouldQuit()); } while (!_avalot->_letMeOut && !shouldQuit());
return Common::kNoError; return Common::kNoError;
} }

View file

@ -32,10 +32,8 @@
#include "avalanche/graphics.h" #include "avalanche/graphics.h"
#include "avalanche/parser.h" #include "avalanche/parser.h"
#include "avalanche/avalot.h" #include "avalanche/avalot.h"
#include "avalanche/gyro.h"
#include "avalanche/pingo.h" #include "avalanche/pingo.h"
#include "avalanche/dialogs.h" #include "avalanche/dialogs.h"
#include "avalanche/lucerna.h"
#include "avalanche/background.h" #include "avalanche/background.h"
#include "avalanche/sequence.h" #include "avalanche/sequence.h"
#include "avalanche/timer.h" #include "avalanche/timer.h"
@ -67,10 +65,8 @@ public:
Parser *_parser; Parser *_parser;
Avalot *_avalot; Avalot *_avalot;
Gyro *_gyro;
Pingo *_pingo; Pingo *_pingo;
Dialogs *_dialogs; Dialogs *_dialogs;
Lucerna *_lucerna;
Background *_background; Background *_background;
Sequence *_sequence; Sequence *_sequence;
Timer *_timer; Timer *_timer;

File diff suppressed because it is too large Load diff

View file

@ -32,20 +32,412 @@
#include "common/events.h" #include "common/events.h"
#include "common/system.h" #include "common/system.h"
#include "common/str.h"
#include "common/scummsys.h"
#include "common/file.h"
#include "graphics/surface.h"
namespace Avalanche { namespace Avalanche {
class AvalancheEngine; class AvalancheEngine;
class Clock {
public:
Clock(AvalancheEngine *vm);
void update();
private:
static const int kCenterX = 510;
static const int kCenterY = 183;
AvalancheEngine *_vm;
uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle;
Common::Point _clockHandHour, _clockHandMinute;
void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color);
void drawHand(const Common::Point &endPoint, byte color);
void plotHands();
void chime();
};
enum Color {
kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed,
kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue,
kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow,
kColorWhite
};
// CHECKME: kRoomBossKey is a guess
enum Room {
kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3,
kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10,
kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14,
kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20,
kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25,
kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29,
kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47,
kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71,
kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room
};
static const byte kObjectNum = 18; // always preface with a #
static const int16 kCarryLimit = 12; // carry limit
static const int16 kNumlockCode = 32; // Code for Num Lock
static const int16 kMouseSize = 134;
struct MouseHotspotType { // mouse-void
int16 _horizontal, _vertical;
};
struct PedType {
int16 _x, _y;
byte _direction;
};
struct MagicType {
byte _operation; // one of the operations
uint16 _data; // data for them
};
class FieldType {
public:
int16 _x1, _y1, _x2, _y2;
};
struct ByteField {
byte _x1, _y1, _x2, _y2;
};
class LineType : public FieldType {
public:
byte _color;
};
typedef int8 TuneType[31];
struct QuasipedType {
byte _whichPed, _foregroundColor, _room, _backgroundColor;
uint16 _who;
};
#if 0
struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA.
Common::String _qEnidFilename;
bool _qSoundFx;
byte _qThinks;
bool _qThinkThing;
};
#endif
class Avalot { class Avalot {
public: public:
// Objects you can hold:
enum Object {
kObjectWine = 1,
kObjectMoney,
kObjectBodkin,
kObjectPotion,
kObjectChastity,
kObjectBolt,
kObjectCrossbow,
kObjectLute,
kObjectBadge,
kObjectMushroom,
kObjectKey,
kObjectBell,
kObjectPrescription,
kObjectPen,
kObjectInk,
kObjectClothes,
kObjectHabit,
kObjectOnion
};
// People who hang around this game.
enum People {
// Boys:
kPeopleAvalot = 150,
kPeopleSpludwick = 151,
kPeopleCrapulus = 152,
kPeopleDrDuck = 153,
kPeopleMalagauche = 154,
kPeopleFriarTuck = 155,
kPeopleRobinHood = 156,
kPeopleCwytalot = 157,
kPeopleDuLustie = 158,
kPeopleDuke = 159,
kPeopleDogfood = 160,
kPeopleTrader = 161,
kPeopleIbythneth = 162,
kPeopleAyles = 163,
kPeoplePort = 164,
kPeopleSpurge = 165,
kPeopleJacques = 166,
// Girls:
kPeopleArkata = 175,
kPeopleGeida = 176,
kPeopleInvisible = 177,
kPeopleWisewoman = 178
};
static const int16 kXW = 30;
static const int16 kYW = 36; // x width & y whatsit
static const int16 kMargin = 5;
static const MouseHotspotType kMouseHotSpots[9];
static const int16 kMaxSprites = 2; // Current max no. of sprites.
// For Thinkabout:
static const bool kThing = true;
static const bool kPerson = false;
// Magic/portal constants:
enum Magics {
kMagicNothing, // Ignore it if this line is touched.
kMagicBounce, // Bounce off this line. Not valid for portals.
kMagicExclaim, // Put up a chain of scrolls.
kMagicTransport, // Enter new room.
kMagicUnfinished, // Unfinished connection.
kMagicSpecial, // Special function.
kMagicOpenDoor // Opening door.
};
// These following static constants should be included in CFG when it's written.
static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar.
static const int16 kBorder = 1; // size of border on shadowboxes
static const int16 kWalk = 3;
static const int16 kRun = 5;
static const int32 kCatacombMap[8][8];
static const char kSpludwicksOrder[3];
static const QuasipedType kQuasipeds[16];
enum Pitch {
kPitchInvalid,
kPitchLower,
kPitchSame,
kPitchHigher
};
static const uint16 kNotes[12];
static const TuneType kTune;
static const char *kVersionNum;
static const char *kCopyright;
static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".".
static const int16 kGameCode = 2; // Avalot's code number
Avalot(AvalancheEngine *vm); Avalot(AvalancheEngine *vm);
~Avalot();
bool _holdLeftMouse;
Clock _clock;
// If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value.
// If a scroll comes up, or you leave the room, it's automatically set to zero.
byte _interrogation;
static byte _whereIs[29];
// Former DNA structure
byte _carryNum; // How many objects you're carrying...
bool _objects[kObjectNum]; // ...and which ones they are.
int16 _dnascore; // your score, of course
int32 _money; // your current amount of dosh
byte _room; // your current room
byte _wearing; // what you're wearing
byte _sworeNum; // number of times you've sworn
byte _saveNum; // number of times this game has been saved
byte _roomCount[100]; // Add one to each every time you enter a room
byte _alcoholLevel; // Your blood alcohol level.
byte _playedNim; // How many times you've played Nim.
bool _wonNim; // Have you *won* Nim? (That's harder.)
byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar.
bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet?
byte _passwordNum; // Number of the passw for this game.
bool _aylesIsAwake; // pretty obvious!
byte _drawbridgeOpen; // Between 0 (shut) and 4 (open).
byte _avariciusTalk; // How much Avaricius has said to you.
bool _boughtOnion; // Have you bought an onion yet?
bool _rottenOnion; // And has it rotted?
bool _onionInVinegar; // Is the onion in the vinegar?
byte _givenToSpludwick; // 0 = nothing given, 1 = onion...
byte _brummieStairs; // Progression through the stairs trick.
byte _cardiffQuestionNum; // Things you get asked in Cardiff.
bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts?
bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.)
bool _avvyInBed; // True if Avvy's in bed, but awake.
bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements.
byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment.
bool _givenBadgeToIby; // Have you given the badge to Iby yet?
bool _friarWillTieYouUp; // If you're going to get tied up.
bool _tiedUp; // You ARE tied up!
byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box.
bool _talkedToCrapulus; // Pretty self-explanatory.
byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone.
bool _bellsAreRinging; // Is Jacques ringing the bells?
bool _standingOnDais; // In room 71, inside Cardiff Castle.
bool _takenPen; // Have you taken the pen (in Cardiff?)
bool _arrowTriggered; // And has the arrow been triggered?
bool _arrowInTheDoor; // Did the arrow hit the wall?
Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's
uint32 _totalTime; // Your total time playing this game, in ticks.
byte _jumpStatus; // Fixes how high you're jumping.
bool _mushroomGrowing; // Is the mushroom growing in 42?
bool _spludwickAtHome; // Is Spludwick at home?
byte _lastRoom;
byte _lastRoomNotMap;
bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away?
bool _enterCatacombsFromLustiesRoom;
bool _teetotal; // Are we touching any more drinks?
byte _malagauche; // Position of Malagauche. See Celer for more info.
char _drinking; // What's he getting you?
bool _enteredLustiesRoomAsMonk;
byte _catacombX, _catacombY; // XY coords in the catacombs.
bool _avvysInTheCupboard; // On screen 22.
bool _geidaFollows; // Is Geida following you?
byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke.
byte _nextBell; // For the ringing.
bool _givenPotionToGeida; // Does Geida have the potion?
bool _lustieIsAsleep; // Is BDL asleep?
byte _flipToWhere, _flipToPed; // For the sequencer.
bool _beenTiedUp; // In r__Robins.
bool _sittingInPub; // Are you sitting down in the pub?
byte _spurgeTalkCount; // Count for talking to Spurge.
bool _metAvaroid;
bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim;
// End of former DNA Structure
byte _lineNum; // Number of lines.
LineType _lines[50]; // For Also.
enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse;
bool _dropsOk, _scReturn, _soundFx, _cheat;
Common::String _mouseText;
bool _weirdWord;
bool _letMeOut;
Common::String _scroll[15];
byte _scrollNum, _whichwas;
byte _thinks;
bool _thinkThing;
int16 _talkX, _talkY;
byte _talkBackgroundColor, _talkFontColor;
byte _scrollBells; // no. of times to ring the bell
bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll?
char _objectList[10];
::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!!
::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead.
// Called .free() for them in ~Gyro().
int8 _scoreToDisplay[3];
byte _currentMouse; // current mouse-void
Common::String _verbStr; // what you can do with your object. :-)
Common::String *_also[31][2];
PedType _peds[15];
MagicType _magics[15];
MagicType _portals[7];
FieldType _fields[30];
byte _fieldNum;
Common::String _flags;
Common::String _listen;
Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1".
byte _cp, _ledStatus, _defaultLed;
FontType _font;
bool _alive;
byte _buffer[2000];
uint16 _bufSize;
int16 _underScroll; // Y-coord of just under the scroll text.
Common::String _roomnName; // Name of actual room
Common::String _subject; // What you're talking to them about.
byte _subjectNum; // The same thing.
bool _keyboardClick; // Is a keyboard click noise wanted?
byte _him, _her, _it;
int32 _roomTime; // Set to 0 when you enter a room, added to in every loop.
byte _lastPerson; // Last person to have been selected using the People menu.
bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites.
bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning.
bool _isLoaded; // Is it a loaded gamestate?
Common::String _enidFilename;
void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein(). void handleKeyDown(Common::Event &event); // To replace Basher::keyboard_link() and Basher::typein().
void setup(); void setup();
void runAvalot(); void runAvalot();
void init();
void callVerb(byte id);
void drawAlsoLines();
void loadRoom(byte num);
void exitRoom(byte x);
void enterRoom(byte room, byte ped);
void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!!
void loadDigits(); // Load the scoring digits & rwlites
void drawToolbar();
void drawScore();
void incScore(byte num); // Add on no. of points
void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement.
void fxToggle();
void refreshObjectList();
void checkClick();
void errorLed();
void dusk();
void dawn();
void drawDirection(); // Draws the little icon at the left end of the text input field.
void gameOver();
uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees.
void fixFlashers();
void loadAlso(byte num);
// There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING.
void minorRedraw();
void majorRedraw();
void spriteRun();
Common::String intToStr(int32 num);
void newMouse(byte id);
void setMousePointerWait(); // Makes hourglass.
void loadMouse(byte which);
void setBackgroundColor(byte x);
void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t);
void resetVariables();
void newGame(); // This sets up the DNA for a completely new game.
void slowDown();
bool setFlag(char x);
bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original.
void hangAroundForAWhile();
Common::String getName(byte whose);
byte getNameChar(byte whose);
Common::String getThing(byte which);
char getThingChar(byte which);
Common::String getItem(byte which); // Called get_better in the original.
Common::String f5Does(); // This procedure determines what f5 does.
private: private:
AvalancheEngine *_vm; AvalancheEngine *_vm;
Common::File file;
Common::String readAlsoStringFromFile();
void scram(Common::String &str);
void unScramble();
void zoomOut(int16 x, int16 y); // Only used when entering the map.
void enterNewTown();
void findPeople(byte room);
void putGeidaAt(byte whichPed, byte ped);
void guideAvvy(Common::Point cursorPos);
// Will be used in dusk() and dawn().
bool _fxHidden;
int8 fades(int8 x);
void fadeOut(byte n);
void fadeIn(byte n);
void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc);
}; };
} // End of namespace Avalanche } // End of namespace Avalanche

View file

@ -30,8 +30,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/background.h" #include "avalanche/background.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
#include "avalanche/lucerna.h"
#include "avalanche/gyro.h"
#include "common/textconsole.h" #include "common/textconsole.h"
@ -55,28 +53,28 @@ void Background::updateBackgroundSprites() {
if (_vm->_menu->isActive()) if (_vm->_menu->isActive())
return; // No animation when the menus are up. return; // No animation when the menus are up.
switch (_vm->_gyro->_room) { switch (_vm->_avalot->_room) {
case kRoomOutsideArgentPub: case kRoomOutsideArgentPub:
if ((_vm->_gyro->_roomTime % 12) == 0) if ((_vm->_avalot->_roomTime % 12) == 0)
drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 4); drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 4);
break; break;
case kRoomBrummieRoad: case kRoomBrummieRoad:
if ((_vm->_gyro->_roomTime % 2) == 0) if ((_vm->_avalot->_roomTime % 2) == 0)
drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 2) % 4); drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 2) % 4);
break; break;
case kRoomBridge: case kRoomBridge:
if ((_vm->_gyro->_roomTime % 2) == 0) if ((_vm->_avalot->_roomTime % 2) == 0)
drawBackgroundSprite(-1, -1, 3 + (_vm->_gyro->_roomTime / 2) % 4); drawBackgroundSprite(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4);
break; break;
case kRoomYours: case kRoomYours:
if ((!_vm->_gyro->_avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0))
drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 2); drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 2);
break; break;
case kRoomArgentPub: case kRoomArgentPub:
if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_malagauche != 177)) { if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) {
// Malagauche cycle. // Malagauche cycle.
_vm->_gyro->_malagauche += 1; _vm->_avalot->_malagauche += 1;
switch (_vm->_gyro->_malagauche) { switch (_vm->_avalot->_malagauche) {
case 1: case 1:
case 11: case 11:
case 21: case 21:
@ -92,12 +90,12 @@ void Background::updateBackgroundSprites() {
drawBackgroundSprite(-1, -1, 12); // Winks. drawBackgroundSprite(-1, -1, 12); // Winks.
break; break;
case 33: case 33:
_vm->_gyro->_malagauche = 0; _vm->_avalot->_malagauche = 0;
break; break;
} }
} }
switch (_vm->_gyro->_roomTime % 200) { switch (_vm->_avalot->_roomTime % 200) {
case 179: case 179:
case 197: case 197:
drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle. drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle.
@ -110,13 +108,13 @@ void Background::updateBackgroundSprites() {
drawBackgroundSprite(-1, -1, 6); drawBackgroundSprite(-1, -1, 6);
break; break;
case 199: case 199:
_vm->_gyro->_npcFacing = 177; // Impossible value for this. _vm->_avalot->_npcFacing = 177; // Impossible value for this.
break; break;
} }
if ((_vm->_gyro->_roomTime % 200 >= 0) && (_vm->_gyro->_roomTime % 200 <= 178)) { // Normally. if ((_vm->_avalot->_roomTime % 200 >= 0) && (_vm->_avalot->_roomTime % 200 <= 178)) { // Normally.
byte direction = 0; byte direction = 0;
uint16 angle = _vm->_lucerna->bearing(1); uint16 angle = _vm->_avalot->bearing(1);
if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360))) if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360)))
direction = 3; direction = 3;
else if ((angle >= 293) && (angle <= 357)) else if ((angle >= 293) && (angle <= 357))
@ -124,15 +122,15 @@ void Background::updateBackgroundSprites() {
else if ((angle >= 271) && (angle <= 292)) else if ((angle >= 271) && (angle <= 292))
direction = 4; direction = 4;
if (direction != _vm->_gyro->_npcFacing) { // Dogfood. if (direction != _vm->_avalot->_npcFacing) { // Dogfood.
drawBackgroundSprite(-1, -1, direction - 1); drawBackgroundSprite(-1, -1, direction - 1);
_vm->_gyro->_npcFacing = direction; _vm->_avalot->_npcFacing = direction;
} }
} }
break; break;
case kRoomWestHall: case kRoomWestHall:
if ((_vm->_gyro->_roomTime % 3) == 0) { if ((_vm->_avalot->_roomTime % 3) == 0) {
switch ((_vm->_gyro->_roomTime / int32(3)) % int32(6)) { switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) {
case 4: case 4:
drawBackgroundSprite(-1, -1, 0); drawBackgroundSprite(-1, -1, 0);
break; break;
@ -149,10 +147,10 @@ void Background::updateBackgroundSprites() {
} }
break; break;
case kRoomLustiesRoom: case kRoomLustiesRoom:
if (!(_vm->_gyro->_lustieIsAsleep)) { if (!(_vm->_avalot->_lustieIsAsleep)) {
byte direction = 0; byte direction = 0;
uint16 angle = _vm->_lucerna->bearing(1); uint16 angle = _vm->_avalot->bearing(1);
if ((_vm->_gyro->_roomTime % 45) > 42) if ((_vm->_avalot->_roomTime % 45) > 42)
direction = 4; // du Lustie blinks. direction = 4; // du Lustie blinks.
// Bearing of Avvy from du Lustie. // Bearing of Avvy from du Lustie.
else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) else if ((angle <= 45) || ((angle >= 315) && (angle <= 360)))
@ -162,15 +160,15 @@ void Background::updateBackgroundSprites() {
else if ((angle >= 181) && (angle <= 314)) else if ((angle >= 181) && (angle <= 314))
direction = 3; // Right. direction = 3; // Right.
if (direction != _vm->_gyro->_npcFacing) { // du Lustie. if (direction != _vm->_avalot->_npcFacing) { // du Lustie.
drawBackgroundSprite(-1, -1, direction - 1); drawBackgroundSprite(-1, -1, direction - 1);
_vm->_gyro->_npcFacing = direction; _vm->_avalot->_npcFacing = direction;
} }
} }
break; break;
case kRoomAylesOffice: case kRoomAylesOffice:
if ((!_vm->_gyro->_aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) {
switch ((_vm->_gyro->_roomTime / 14) % 2) { switch ((_vm->_avalot->_roomTime / 14) % 2) {
case 0: case 0:
drawBackgroundSprite(-1, -1, 0); // Frame 2: EGA. drawBackgroundSprite(-1, -1, 0); // Frame 2: EGA.
break; break;
@ -181,8 +179,8 @@ void Background::updateBackgroundSprites() {
} }
break; break;
case kRoomRobins: case kRoomRobins:
if (_vm->_gyro->_tiedUp) { if (_vm->_avalot->_tiedUp) {
switch (_vm->_gyro->_roomTime % 54) { switch (_vm->_avalot->_roomTime % 54) {
case 20: case 20:
drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks. drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks.
break; break;
@ -195,7 +193,7 @@ void Background::updateBackgroundSprites() {
case kRoomNottsPub: { case kRoomNottsPub: {
// Bearing of Avvy from Port. // Bearing of Avvy from Port.
byte direction = 0; byte direction = 0;
uint16 angle = _vm->_lucerna->bearing(4); uint16 angle = _vm->_avalot->bearing(4);
if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) if ((angle <= 45) || ((angle >= 315) && (angle <= 360)))
direction = 2; // Middle. direction = 2; // Middle.
else if ((angle >= 45) && (angle <= 180)) else if ((angle >= 45) && (angle <= 180))
@ -203,15 +201,15 @@ void Background::updateBackgroundSprites() {
else if ((angle >= 181) && (angle <= 314)) else if ((angle >= 181) && (angle <= 314))
direction = 8; // Right. direction = 8; // Right.
if ((_vm->_gyro->_roomTime % 60) > 57) if ((_vm->_avalot->_roomTime % 60) > 57)
direction--; // Blinks. direction--; // Blinks.
if (direction != _vm->_gyro->_npcFacing) { // Port. if (direction != _vm->_avalot->_npcFacing) { // Port.
drawBackgroundSprite(-1, -1, direction - 1); drawBackgroundSprite(-1, -1, direction - 1);
_vm->_gyro->_npcFacing = direction; _vm->_avalot->_npcFacing = direction;
} }
switch (_vm->_gyro->_roomTime % 50) { switch (_vm->_avalot->_roomTime % 50) {
case 45 : case 45 :
drawBackgroundSprite(-1, -1, 8); // Spurge blinks. drawBackgroundSprite(-1, -1, 8); // Spurge blinks.
break; break;
@ -222,12 +220,12 @@ void Background::updateBackgroundSprites() {
break; break;
} }
case kRoomDucks: { case kRoomDucks: {
if ((_vm->_gyro->_roomTime % 3) == 0) // The fire flickers. if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers.
drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 3) % 3); drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 3) % 3);
// Bearing of Avvy from Duck. // Bearing of Avvy from Duck.
byte direction = 0; byte direction = 0;
uint16 angle = _vm->_lucerna->bearing(1); uint16 angle = _vm->_avalot->bearing(1);
if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) if ((angle <= 45) || ((angle >= 315) && (angle <= 360)))
direction = 4; // Middle. direction = 4; // Middle.
else if ((angle >= 45) && (angle <= 180)) else if ((angle >= 45) && (angle <= 180))
@ -235,26 +233,26 @@ void Background::updateBackgroundSprites() {
else if ((angle >= 181) && (angle <= 314)) else if ((angle >= 181) && (angle <= 314))
direction = 8; // Right. direction = 8; // Right.
if ((_vm->_gyro->_roomTime % 45) > 42) if ((_vm->_avalot->_roomTime % 45) > 42)
direction++; // Duck blinks. direction++; // Duck blinks.
if (direction != _vm->_gyro->_npcFacing) { // Duck. if (direction != _vm->_avalot->_npcFacing) { // Duck.
drawBackgroundSprite(-1, -1, direction - 1); drawBackgroundSprite(-1, -1, direction - 1);
_vm->_gyro->_npcFacing = direction; _vm->_avalot->_npcFacing = direction;
} }
break; break;
} }
} }
if ((_vm->_gyro->_bellsAreRinging) && (_vm->_gyro->setFlag('B'))) { if ((_vm->_avalot->_bellsAreRinging) && (_vm->_avalot->setFlag('B'))) {
// They're ringing the bells. // They're ringing the bells.
switch (_vm->_gyro->_roomTime % 4) { switch (_vm->_avalot->_roomTime % 4) {
case 1: case 1:
if (_vm->_gyro->_nextBell < 5) if (_vm->_avalot->_nextBell < 5)
_vm->_gyro->_nextBell = 12; _vm->_avalot->_nextBell = 12;
_vm->_gyro->_nextBell--; _vm->_avalot->_nextBell--;
// CHECKME: 2 is a guess. No length in the original? // CHECKME: 2 is a guess. No length in the original?
_vm->_sound->playNote(_vm->_gyro->kNotes[_vm->_gyro->_nextBell], 2); _vm->_sound->playNote(_vm->_avalot->kNotes[_vm->_avalot->_nextBell], 2);
break; break;
case 2: case 2:
_vm->_sound->stopSound(); _vm->_sound->stopSound();

View file

@ -29,8 +29,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/closing.h" #include "avalanche/closing.h"
#include "avalanche/gyro.h"
#include "avalanche/lucerna.h"
#include "common/textconsole.h" #include "common/textconsole.h"
#include "common/random.h" #include "common/random.h"

View file

@ -29,8 +29,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/dialogs.h" #include "avalanche/dialogs.h"
#include "avalanche/gyro.h"
#include "avalanche/lucerna.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
#include "avalanche/timer.h" #include "avalanche/timer.h"
@ -50,7 +48,7 @@ void Dialogs::init() {
} }
void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever
if (_vm->_gyro->_ledStatus == state) if (_vm->_avalot->_ledStatus == state)
return; // Already like that! return; // Already like that!
byte color = kColorBlack; byte color = kColorBlack;
@ -71,7 +69,7 @@ void Dialogs::setReadyLight(byte state) { // Sets "Ready" light to whatever
_vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color); _vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color);
CursorMan.showMouse(true); CursorMan.showMouse(true);
_vm->_gyro->_ledStatus = state; _vm->_avalot->_ledStatus = state;
} }
void Dialogs::easterEgg() { void Dialogs::easterEgg() {
@ -116,8 +114,8 @@ void Dialogs::scrollModeNormal() {
Common::String e = "(c) 1994"; Common::String e = "(c) 1994";
setReadyLight(3); setReadyLight(3);
_vm->_gyro->_seeScroll = true; _vm->_avalot->_seeScroll = true;
_vm->_gyro->newMouse(3); _vm->_avalot->newMouse(3);
::Graphics::Surface temp; ::Graphics::Surface temp;
temp.copyFrom(_vm->_graphics->_surface); temp.copyFrom(_vm->_graphics->_surface);
@ -145,7 +143,7 @@ void Dialogs::scrollModeNormal() {
bool oktoexit; bool oktoexit;
do { do {
do { do {
_vm->_gyro->check(); // was "checkclick;" _vm->_avalot->check(); // was "checkclick;"
//#ifdef RECORD slowdown(); basher::count += 1; #endif //#ifdef RECORD slowdown(); basher::count += 1; #endif
@ -170,12 +168,12 @@ void Dialogs::scrollModeNormal() {
//#ifdef RECORD record_one(); #endif //#ifdef RECORD record_one(); #endif
_vm->_gyro->screturn = r == '#'; // "back door" _vm->_avalot->screturn = r == '#'; // "back door"
#endif #endif
setReadyLight(0); setReadyLight(0);
_vm->_gyro->_seeScroll = false; _vm->_avalot->_seeScroll = false;
_vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). _vm->_avalot->_holdLeftMouse = false; // Used in Lucerna::checkclick().
warning("STUB: Scrolls::scrollModeNormal()"); warning("STUB: Scrolls::scrollModeNormal()");
} }
@ -193,7 +191,7 @@ bool Dialogs::theyMatch(TuneType &played) {
byte mistakes = 0; byte mistakes = 0;
for (unsigned int i = 0; i < sizeof(played); i++) { for (unsigned int i = 0; i < sizeof(played); i++) {
if (played[i] != _vm->_gyro->kTune[i]) if (played[i] != _vm->_avalot->kTune[i])
mistakes += 1; mistakes += 1;
} }
@ -202,16 +200,16 @@ bool Dialogs::theyMatch(TuneType &played) {
void Dialogs::scrollModeMusic() { void Dialogs::scrollModeMusic() {
setReadyLight(3); setReadyLight(3);
_vm->_gyro->_seeScroll = true; _vm->_avalot->_seeScroll = true;
CursorMan.showMouse(false); CursorMan.showMouse(false);
_vm->_gyro->newMouse(3); _vm->_avalot->newMouse(3);
TuneType played; TuneType played;
for (unsigned int i = 0; i < sizeof(played); i++) for (unsigned int i = 0; i < sizeof(played); i++)
played[i] = Gyro::kPitchInvalid; played[i] = Avalot::kPitchInvalid;
int8 lastOne = -1, thisOne = -1; // Invalid values. int8 lastOne = -1, thisOne = -1; // Invalid values.
_vm->_gyro->_seeScroll = true; _vm->_avalot->_seeScroll = true;
::Graphics::Surface temp; ::Graphics::Surface temp;
temp.copyFrom(_vm->_graphics->_surface); temp.copyFrom(_vm->_graphics->_surface);
@ -282,16 +280,16 @@ void Dialogs::scrollModeMusic() {
lastOne = thisOne; lastOne = thisOne;
thisOne = value; thisOne = value;
_vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); _vm->_sound->playNote(_vm->_avalot->kNotes[thisOne], 100);
_vm->_system->delayMillis(200); _vm->_system->delayMillis(200);
if (!_vm->_gyro->_bellsAreRinging) { // These handle playing the right tune. if (!_vm->_avalot->_bellsAreRinging) { // These handle playing the right tune.
if (thisOne < lastOne) if (thisOne < lastOne)
store(Gyro::kPitchLower, played); store(Avalot::kPitchLower, played);
else if (thisOne == lastOne) else if (thisOne == lastOne)
store(Gyro::kPitchSame, played); store(Avalot::kPitchSame, played);
else else
store(Gyro::kPitchHigher, played); store(Avalot::kPitchHigher, played);
} }
if (theyMatch(played)) { if (theyMatch(played)) {
@ -304,30 +302,30 @@ void Dialogs::scrollModeMusic() {
_vm->_graphics->_surface.copyFrom(temp); _vm->_graphics->_surface.copyFrom(temp);
temp.free(); temp.free();
_vm->_gyro->_seeScroll = false; _vm->_avalot->_seeScroll = false;
CursorMan.showMouse(true); CursorMan.showMouse(true);
} }
void Dialogs::resetScrollDriver() { void Dialogs::resetScrollDriver() {
_vm->_gyro->_scrollBells = 0; _vm->_avalot->_scrollBells = 0;
_currentFont = kFontStyleRoman; _currentFont = kFontStyleRoman;
_useIcon = 0; _useIcon = 0;
_vm->_gyro->_interrogation = 0; // Always reset after a scroll comes up. _vm->_avalot->_interrogation = 0; // Always reset after a scroll comes up.
} }
void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little...
for (int i = 0; i < _vm->_gyro->_scrollBells; i++) for (int i = 0; i < _vm->_avalot->_scrollBells; i++)
_vm->_lucerna->errorLed(); // Ring the bell "x" times. _vm->_avalot->errorLed(); // Ring the bell "x" times.
} }
void Dialogs::dodgem() { void Dialogs::dodgem() {
_dodgeCoord = _vm->getMousePos(); _dodgeCoord = _vm->getMousePos();
g_system->warpMouse(_dodgeCoord.x, _vm->_gyro->_underScroll); // Move the pointer off the scroll. g_system->warpMouse(_dodgeCoord.x, _vm->_avalot->_underScroll); // Move the pointer off the scroll.
} }
void Dialogs::unDodgem() { void Dialogs::unDodgem() {
Common::Point actCoord = _vm->getMousePos(); Common::Point actCoord = _vm->getMousePos();
if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_gyro->_underScroll)) if ((actCoord.x == _dodgeCoord.x) && (actCoord.y == _vm->_avalot->_underScroll))
g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position. g_system->warpMouse(_dodgeCoord.x, _dodgeCoord.y); // No change, so restore the pointer's original position.
} }
@ -358,7 +356,7 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) {
error("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); error("AVALANCHE: Scrolls: File not found: %s", filename.c_str());
#if 0 #if 0
uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_avalot->cp) * _vm->_avalot->pagetop);
byte bit; byte bit;
for (uint16 i = 1; i <= yl; i++) for (uint16 i = 1; i <= yl; i++)
for (bit = 0; bit <= 3; bit++) { for (bit = 0; bit <= 3; bit++) {
@ -378,10 +376,10 @@ void Dialogs::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) {
void Dialogs::drawScroll(DialogFunctionType modeFunc) { void Dialogs::drawScroll(DialogFunctionType modeFunc) {
int16 lx = 0; int16 lx = 0;
int16 ly = (_vm->_gyro->_scrollNum) * 6; int16 ly = (_vm->_avalot->_scrollNum) * 6;
int16 ex; int16 ex;
for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { for (int i = 0; i < _vm->_avalot->_scrollNum; i++) {
ex = _vm->_gyro->_scroll[i].size() * 8; ex = _vm->_avalot->_scroll[i].size() * 8;
if (lx < ex) if (lx < ex)
lx = ex; lx = ex;
} }
@ -447,47 +445,47 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) {
iconIndent = 53; iconIndent = 53;
} }
for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { for (int i = 0; i < _vm->_avalot->_scrollNum; i++) {
if (!_vm->_gyro->_scroll[i].empty()) if (!_vm->_avalot->_scroll[i].empty())
switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { switch (_vm->_avalot->_scroll[i][_vm->_avalot->_scroll[i].size() - 1]) {
case kControlCenter: case kControlCenter:
centre = true; centre = true;
_vm->_gyro->_scroll[i].deleteLastChar(); _vm->_avalot->_scroll[i].deleteLastChar();
break; break;
case kControlLeftJustified: case kControlLeftJustified:
centre = false; centre = false;
_vm->_gyro->_scroll[i].deleteLastChar(); _vm->_avalot->_scroll[i].deleteLastChar();
break; break;
case kControlQuestion: case kControlQuestion:
//settextjustify(1, 1); //settextjustify(1, 1);
_shadowBoxX = mx + lx; _shadowBoxX = mx + lx;
_shadowBoxY = my + ly; _shadowBoxY = my + ly;
_vm->_gyro->_scroll[i].setChar(' ', 0); _vm->_avalot->_scroll[i].setChar(' ', 0);
// byte groi = *_vm->_graphics->getPixel(0, 0); // byte groi = *_vm->_graphics->getPixel(0, 0);
// inc(diy,14); // inc(diy,14);
_vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); _vm->_avalot->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes.");
_vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); _vm->_avalot->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No.");
break; break;
} }
if (centre) if (centre)
say(320 - _vm->_gyro->_scroll[i].size() * 4 + iconIndent, my, _vm->_gyro->_scroll[i]); say(320 - _vm->_avalot->_scroll[i].size() * 4 + iconIndent, my, _vm->_avalot->_scroll[i]);
else else
say(mx + iconIndent, my, _vm->_gyro->_scroll[i]); say(mx + iconIndent, my, _vm->_avalot->_scroll[i]);
my += 12; my += 12;
} }
_vm->_gyro->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height. _vm->_avalot->_underScroll = my * 2 + 6; // Multiplying because of the doubled screen height.
ringBell(); ringBell();
_vm->_gyro->_dropsOk = false; _vm->_avalot->_dropsOk = false;
dodgem(); dodgem();
(this->*modeFunc)(); (this->*modeFunc)();
unDodgem(); unDodgem();
_vm->_gyro->_dropsOk = true; _vm->_avalot->_dropsOk = true;
resetScrollDriver(); resetScrollDriver();
} }
@ -497,9 +495,9 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) {
CursorMan.showMouse(false); CursorMan.showMouse(false);
int16 xl = 0; int16 xl = 0;
int16 yl = _vm->_gyro->_scrollNum * 5; int16 yl = _vm->_avalot->_scrollNum * 5;
for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { for (int i = 0; i < _vm->_avalot->_scrollNum; i++) {
uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; uint16 textWidth = _vm->_avalot->_scroll[i].size() * 8;
if (textWidth > xl) if (textWidth > xl)
xl = textWidth; xl = textWidth;
} }
@ -510,55 +508,55 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) {
int16 my = yw * 2 - 2; int16 my = yw * 2 - 2;
int16 xc = 0; int16 xc = 0;
if ((_vm->_gyro->_talkX - xw) < 0) if ((_vm->_avalot->_talkX - xw) < 0)
xc = -(_vm->_gyro->_talkX - xw); xc = -(_vm->_avalot->_talkX - xw);
if ((_vm->_gyro->_talkX + xw) > 639) if ((_vm->_avalot->_talkX + xw) > 639)
xc = 639 - (_vm->_gyro->_talkX + xw); xc = 639 - (_vm->_avalot->_talkX + xw);
points[0].x = _vm->_gyro->_talkX - 10; points[0].x = _vm->_avalot->_talkX - 10;
points[0].y = yw; points[0].y = yw;
points[1].x = _vm->_gyro->_talkX + 10; points[1].x = _vm->_avalot->_talkX + 10;
points[1].y = yw; points[1].y = yw;
points[2].x = _vm->_gyro->_talkX; points[2].x = _vm->_avalot->_talkX;
points[2].y = _vm->_gyro->_talkY; points[2].y = _vm->_avalot->_talkY;
// Backup the screen before drawing the bubble. // Backup the screen before drawing the bubble.
_vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface); _vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface);
// The body of the bubble. // The body of the bubble.
_vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw + 9, 7, _vm->_gyro->_talkX + xw - 8 + xc, my + 1), _vm->_gyro->_talkBackgroundColor); _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw + 9, 7, _vm->_avalot->_talkX + xw - 8 + xc, my + 1), _vm->_avalot->_talkBackgroundColor);
_vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_gyro->_talkX - xw - 1, 12, _vm->_gyro->_talkX + xw + xc + 2, my - 4), _vm->_gyro->_talkBackgroundColor); _vm->_graphics->_scrolls.fillRect(Common::Rect(xc + _vm->_avalot->_talkX - xw - 1, 12, _vm->_avalot->_talkX + xw + xc + 2, my - 4), _vm->_avalot->_talkBackgroundColor);
// Top right corner of the bubble. // Top right corner of the bubble.
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, 11, 0, 90, 9, _vm->_gyro->_talkBackgroundColor); _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, 11, 0, 90, 9, _vm->_avalot->_talkBackgroundColor);
// Bottom right corner of the bubble. // Bottom right corner of the bubble.
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_gyro->_talkBackgroundColor); _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_avalot->_talkBackgroundColor);
// Top left corner of the bubble. // Top left corner of the bubble.
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, 11, 90, 180, 9, _vm->_gyro->_talkBackgroundColor); _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, 11, 90, 180, 9, _vm->_avalot->_talkBackgroundColor);
// Bottom left corner of the bubble. // Bottom left corner of the bubble.
_vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_gyro->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_gyro->_talkBackgroundColor); _vm->_graphics->drawPieSlice(_vm->_graphics->_scrolls, xc + _vm->_avalot->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_avalot->_talkBackgroundColor);
// "Tail" of the speech bubble. // "Tail" of the speech bubble.
_vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_gyro->_talkBackgroundColor); _vm->_graphics->drawTriangle(_vm->_graphics->_scrolls, points, _vm->_avalot->_talkBackgroundColor);
// Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify().
// The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Avalot::characters instead.
// It's almost the same, only notable differences are '?', '!', etc. // It's almost the same, only notable differences are '?', '!', etc.
for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { for (int i = 0; i < _vm->_avalot->_scrollNum; i++) {
int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; int16 x = xc + _vm->_avalot->_talkX - _vm->_avalot->_scroll[i].size() / 2 * 8;
bool offset = _vm->_gyro->_scroll[i].size() % 2; bool offset = _vm->_avalot->_scroll[i].size() % 2;
_vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->_scroll[i], _vm->_gyro->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_gyro->_talkFontColor); _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_avalot->_scroll[i], _vm->_avalot->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_avalot->_talkFontColor);
} }
ringBell(); ringBell();
CursorMan.showMouse(false); CursorMan.showMouse(false);
_vm->_gyro->_dropsOk = false; _vm->_avalot->_dropsOk = false;
// This does the actual drawing to the screen. // This does the actual drawing to the screen.
(this->*modeFunc)(); (this->*modeFunc)();
_vm->_gyro->_dropsOk = true; _vm->_avalot->_dropsOk = true;
CursorMan.showMouse(true); // sink; CursorMan.showMouse(true); // sink;
resetScrollDriver(); resetScrollDriver();
} }
@ -569,36 +567,36 @@ bool Dialogs::displayQuestion(Common::String question) {
} }
void Dialogs::reset() { void Dialogs::reset() {
_vm->_gyro->_scrollNum = 1; _vm->_avalot->_scrollNum = 1;
for (int i = 0; i < 15; i++) { for (int i = 0; i < 15; i++) {
if (!_vm->_gyro->_scroll[i].empty()) if (!_vm->_avalot->_scroll[i].empty())
_vm->_gyro->_scroll[i].clear(); _vm->_avalot->_scroll[i].clear();
} }
} }
void Dialogs::setBubbleStateNatural() { void Dialogs::setBubbleStateNatural() {
_vm->_gyro->_talkX = 320; _vm->_avalot->_talkX = 320;
_vm->_gyro->_talkY = 200; _vm->_avalot->_talkY = 200;
_vm->_gyro->_talkBackgroundColor = 8; _vm->_avalot->_talkBackgroundColor = 8;
_vm->_gyro->_talkFontColor = 15; _vm->_avalot->_talkFontColor = 15;
} }
Common::String Dialogs::displayMoney() { Common::String Dialogs::displayMoney() {
Common::String result; Common::String result;
if (_vm->_gyro->_money < 12) { // just pence if (_vm->_avalot->_money < 12) { // just pence
result = Common::String::format("%dd", _vm->_gyro->_money); result = Common::String::format("%dd", _vm->_avalot->_money);
} else if (_vm->_gyro->_money < 240) { // shillings & pence } else if (_vm->_avalot->_money < 240) { // shillings & pence
if ((_vm->_gyro->_money % 12) == 0) if ((_vm->_avalot->_money % 12) == 0)
result = Common::String::format("%d/-", _vm->_gyro->_money / 12); result = Common::String::format("%d/-", _vm->_avalot->_money / 12);
else else
result = Common::String::format("%d/%d", _vm->_gyro->_money / 12, _vm->_gyro->_money % 12); result = Common::String::format("%d/%d", _vm->_avalot->_money / 12, _vm->_avalot->_money % 12);
} else { // L, s & d } else { // L, s & d
result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_money / 240, (_vm->_gyro->_money / 12) % 20, result = Common::String::format("\x9C%d.%d.%d", _vm->_avalot->_money / 240, (_vm->_avalot->_money / 12) % 20,
_vm->_gyro->_money % 12); _vm->_avalot->_money % 12);
} }
if (_vm->_gyro->_money > 12) { if (_vm->_avalot->_money > 12) {
Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_money); Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_avalot->_money);
result += extraStr; result += extraStr;
} }
@ -611,16 +609,16 @@ void Dialogs::stripTrailingSpaces(Common::String &str) {
} }
void Dialogs::solidify(byte n) { void Dialogs::solidify(byte n) {
if (!_vm->_gyro->_scroll[n].contains(' ')) if (!_vm->_avalot->_scroll[n].contains(' '))
return; // No spaces. return; // No spaces.
// So there MUST be a space there, somewhere... // So there MUST be a space there, somewhere...
do { do {
_vm->_gyro->_scroll[n + 1] = _vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] + _vm->_gyro->_scroll[n + 1]; _vm->_avalot->_scroll[n + 1] = _vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] + _vm->_avalot->_scroll[n + 1];
_vm->_gyro->_scroll[n].deleteLastChar(); _vm->_avalot->_scroll[n].deleteLastChar();
} while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); } while (_vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] != ' ');
stripTrailingSpaces(_vm->_gyro->_scroll[n]); stripTrailingSpaces(_vm->_avalot->_scroll[n]);
} }
void Dialogs::callDialogDriver() { void Dialogs::callDialogDriver() {
@ -630,60 +628,60 @@ void Dialogs::callDialogDriver() {
_vm->_sound->stopSound(); _vm->_sound->stopSound();
setReadyLight(0); setReadyLight(0);
_vm->_gyro->_scReturn = false; _vm->_avalot->_scReturn = false;
bool mouthnext = false; bool mouthnext = false;
bool call_spriterun = true; // Only call sprite_run the FIRST time. bool call_spriterun = true; // Only call sprite_run the FIRST time.
switch (_vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1]) { switch (_vm->_avalot->_buffer[_vm->_avalot->_bufSize - 1]) {
case kControlToBuffer: case kControlToBuffer:
_vm->_gyro->_bufSize--; _vm->_avalot->_bufSize--;
break; // ^D = (D)on't include pagebreak break; // ^D = (D)on't include pagebreak
case kControlSpeechBubble: case kControlSpeechBubble:
case kControlQuestion: case kControlQuestion:
break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box
default: default:
_vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = kControlParagraph;
_vm->_gyro->_bufSize++; _vm->_avalot->_bufSize++;
} }
uint16 size = _vm->_gyro->_bufSize; uint16 size = _vm->_avalot->_bufSize;
for (uint16 i = 0; i < size; i++) { for (uint16 i = 0; i < size; i++) {
if (mouthnext) { if (mouthnext) {
if (_vm->_gyro->_buffer[i] == kControlRegister) if (_vm->_avalot->_buffer[i] == kControlRegister)
_param = 0; _param = 0;
else if (('0' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= '9')) else if (('0' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= '9'))
_param = _vm->_gyro->_buffer[i] - 48; _param = _vm->_avalot->_buffer[i] - 48;
else if (('A' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= 'Z')) else if (('A' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= 'Z'))
_param = _vm->_gyro->_buffer[i] - 55; _param = _vm->_avalot->_buffer[i] - 55;
mouthnext = false; mouthnext = false;
} else { } else {
switch (_vm->_gyro->_buffer[i]) { switch (_vm->_avalot->_buffer[i]) {
case kControlParagraph: case kControlParagraph:
if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty()))
break; break;
if (call_spriterun) if (call_spriterun)
_vm->_lucerna->spriteRun(); _vm->_avalot->spriteRun();
call_spriterun = false; call_spriterun = false;
drawScroll(&Avalanche::Dialogs::scrollModeNormal); drawScroll(&Avalanche::Dialogs::scrollModeNormal);
reset(); reset();
if (_vm->_gyro->_scReturn) if (_vm->_avalot->_scReturn)
return; return;
break; break;
case kControlBell: case kControlBell:
_vm->_gyro->_scrollBells++; _vm->_avalot->_scrollBells++;
break; // #7 = "Bel" break; // #7 = "Bel"
case kControlSpeechBubble: case kControlSpeechBubble:
if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty()))
break; break;
if (call_spriterun) if (call_spriterun)
_vm->_lucerna->spriteRun(); _vm->_avalot->spriteRun();
call_spriterun = false; call_spriterun = false;
if (_param == 0) if (_param == 0)
@ -691,7 +689,7 @@ void Dialogs::callDialogDriver() {
else if ((1 <= _param) && (_param <= 9)) { else if ((1 <= _param) && (_param <= 9)) {
AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; AnimationType *spr = &_vm->_animation->_sprites[_param - 1];
if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid.
_vm->_lucerna->errorLed(); _vm->_avalot->errorLed();
setBubbleStateNatural(); setBubbleStateNatural();
} else } else
spr->chatter(); // Normal sprite talking routine. spr->chatter(); // Normal sprite talking routine.
@ -699,14 +697,14 @@ void Dialogs::callDialogDriver() {
// Quasi-peds. (This routine performs the same // Quasi-peds. (This routine performs the same
// thing with QPs as triptype.chatter does with the // thing with QPs as triptype.chatter does with the
// sprites.) // sprites.)
PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed]; PedType *quasiPed = &_vm->_avalot->_peds[_vm->_avalot->kQuasipeds[_param - 10]._whichPed];
_vm->_gyro->_talkX = quasiPed->_x; _vm->_avalot->_talkX = quasiPed->_x;
_vm->_gyro->_talkY = quasiPed->_y; // Position. _vm->_avalot->_talkY = quasiPed->_y; // Position.
_vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; _vm->_avalot->_talkFontColor = _vm->_avalot->kQuasipeds[_param - 10]._foregroundColor;
_vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. _vm->_avalot->_talkBackgroundColor = _vm->_avalot->kQuasipeds[_param - 10]._backgroundColor; // Colors.
} else { } else {
_vm->_lucerna->errorLed(); // Not valid. _vm->_avalot->errorLed(); // Not valid.
setBubbleStateNatural(); setBubbleStateNatural();
} }
@ -714,7 +712,7 @@ void Dialogs::callDialogDriver() {
reset(); reset();
if (_vm->_gyro->_scReturn) if (_vm->_avalot->_scReturn)
return; return;
break; break;
@ -725,46 +723,46 @@ void Dialogs::callDialogDriver() {
displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion) displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion)
break; break;
case 2: { case 2: {
int pwdId = _vm->_parser->kFirstPassword + _vm->_gyro->_passwordNum; int pwdId = _vm->_parser->kFirstPassword + _vm->_avalot->_passwordNum;
displayText(_vm->_parser->_vocabulary[pwdId]._word + kControlToBuffer); displayText(_vm->_parser->_vocabulary[pwdId]._word + kControlToBuffer);
} }
break; break;
case 3: case 3:
displayText(_vm->_gyro->_favouriteDrink + kControlToBuffer); displayText(_vm->_avalot->_favouriteDrink + kControlToBuffer);
break; break;
case 4: case 4:
displayText(_vm->_gyro->_favouriteSong + kControlToBuffer); displayText(_vm->_avalot->_favouriteSong + kControlToBuffer);
break; break;
case 5: case 5:
displayText(_vm->_gyro->_worstPlaceOnEarth + kControlToBuffer); displayText(_vm->_avalot->_worstPlaceOnEarth + kControlToBuffer);
break; break;
case 6: case 6:
displayText(_vm->_gyro->_spareEvening + kControlToBuffer); displayText(_vm->_avalot->_spareEvening + kControlToBuffer);
break; break;
case 9: { case 9: {
Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_gyro->_catacombX, _vm->_gyro->_catacombY, kControlToBuffer); Common::String tmpStr = Common::String::format("%d,%d%c",_vm->_avalot->_catacombX, _vm->_avalot->_catacombY, kControlToBuffer);
displayText(tmpStr); displayText(tmpStr);
} }
break; break;
case 10: case 10:
switch (_vm->_gyro->_boxContent) { switch (_vm->_avalot->_boxContent) {
case 0: // Sixpence. case 0: // Sixpence.
displayScrollChain('q', 37); // You find the sixpence. displayScrollChain('q', 37); // You find the sixpence.
_vm->_gyro->_money += 6; _vm->_avalot->_money += 6;
_vm->_gyro->_boxContent = _vm->_parser->kNothing; _vm->_avalot->_boxContent = _vm->_parser->kNothing;
_vm->_lucerna->incScore(2); _vm->_avalot->incScore(2);
return; return;
case Parser::kNothing: case Parser::kNothing:
displayText("nothing at all. It's completely empty."); displayText("nothing at all. It's completely empty.");
break; break;
default: default:
displayText(_vm->_gyro->getItem(_vm->_gyro->_boxContent) + '.'); displayText(_vm->_avalot->getItem(_vm->_avalot->_boxContent) + '.');
} }
break; break;
case 11: case 11:
for (int j = 0; j < kObjectNum; j++) { for (int j = 0; j < kObjectNum; j++) {
if (_vm->_gyro->_objects[j]) if (_vm->_avalot->_objects[j])
displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); displayText(_vm->_avalot->getItem(j) + ", " + kControlToBuffer);
} }
break; break;
} }
@ -773,15 +771,15 @@ void Dialogs::callDialogDriver() {
_useIcon = _param; _useIcon = _param;
break; break;
case kControlNewLine: case kControlNewLine:
_vm->_gyro->_scrollNum++; _vm->_avalot->_scrollNum++;
break; break;
case kControlQuestion: case kControlQuestion:
if (call_spriterun) if (call_spriterun)
_vm->_lucerna->spriteRun(); _vm->_avalot->spriteRun();
call_spriterun = false; call_spriterun = false;
_vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; _vm->_avalot->_scroll[_vm->_avalot->_scrollNum] = kControlQuestion;
_vm->_gyro->_scrollNum++; _vm->_avalot->_scrollNum++;
drawScroll(&Avalanche::Dialogs::scrollModeDialogue); drawScroll(&Avalanche::Dialogs::scrollModeDialogue);
reset(); reset();
@ -791,14 +789,14 @@ void Dialogs::callDialogDriver() {
break; break;
case kControlInsertSpaces: case kControlInsertSpaces:
for (int j = 0; j < 9; j++) for (int j = 0; j < 9; j++)
_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += ' ';
break; break;
default: // Add new char. default: // Add new char.
if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { if (_vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1].size() == 50) {
solidify(_vm->_gyro->_scrollNum - 1); solidify(_vm->_avalot->_scrollNum - 1);
_vm->_gyro->_scrollNum++; _vm->_avalot->_scrollNum++;
} }
_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i]; _vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += _vm->_avalot->_buffer[i];
break; break;
} }
} }
@ -806,8 +804,8 @@ void Dialogs::callDialogDriver() {
} }
void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!!
_vm->_gyro->_bufSize = text.size(); _vm->_avalot->_bufSize = text.size();
memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); memcpy(_vm->_avalot->_buffer, text.c_str(), _vm->_avalot->_bufSize);
callDialogDriver(); callDialogDriver();
} }
@ -832,7 +830,7 @@ void Dialogs::loadFont() {
error("AVALANCHE: Scrolls: File not found: ttsmall.fnt"); error("AVALANCHE: Scrolls: File not found: ttsmall.fnt");
for (int16 i = 0; i < 256; i++) for (int16 i = 0; i < 256; i++)
file.read(_vm->_gyro->_font[i],16); file.read(_vm->_avalot->_font[i],16);
file.close(); file.close();
} }
@ -841,7 +839,7 @@ void Dialogs::displayMusicalScroll() {
kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer); kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer);
displayText(tmpStr); displayText(tmpStr);
_vm->_lucerna->spriteRun(); _vm->_avalot->spriteRun();
CursorMan.showMouse(false); CursorMan.showMouse(false);
drawScroll(&Avalanche::Dialogs::scrollModeMusic); drawScroll(&Avalanche::Dialogs::scrollModeMusic);
CursorMan.showMouse(true); CursorMan.showMouse(true);
@ -851,13 +849,13 @@ void Dialogs::displayMusicalScroll() {
// From Visa: // From Visa:
void Dialogs::unSkrimble() { void Dialogs::unSkrimble() {
for (uint16 i = 0; i < _vm->_gyro->_bufSize; i++) for (uint16 i = 0; i < _vm->_avalot->_bufSize; i++)
_vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; _vm->_avalot->_buffer[i] = (~(_vm->_avalot->_buffer[i] - (i + 1))) % 256;
} }
void Dialogs::doTheBubble() { void Dialogs::doTheBubble() {
_vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; _vm->_avalot->_buffer[_vm->_avalot->_bufSize] = 2;
_vm->_gyro->_bufSize++; _vm->_avalot->_bufSize++;
} }
/** /**
@ -898,8 +896,8 @@ void Dialogs::displayScrollChain(char block, byte point, bool report, bool bubbl
::error("AVALANCHE: Visa: File not found: avalot.sez"); ::error("AVALANCHE: Visa: File not found: avalot.sez");
sezfile.seek(sez_offset); sezfile.seek(sez_offset);
_vm->_gyro->_bufSize = sezfile.readUint16LE(); _vm->_avalot->_bufSize = sezfile.readUint16LE();
sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize);
sezfile.close(); sezfile.close();
unSkrimble(); unSkrimble();
@ -944,8 +942,8 @@ void Dialogs::speak(byte who, byte subject) {
error("AVALANCHE: Visa: File not found: avalot.sez"); error("AVALANCHE: Visa: File not found: avalot.sez");
sezfile.seek(sez_offset); sezfile.seek(sez_offset);
_vm->_gyro->_bufSize = sezfile.readUint16LE(); _vm->_avalot->_bufSize = sezfile.readUint16LE();
sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize);
sezfile.close(); sezfile.close();
unSkrimble(); unSkrimble();
@ -957,26 +955,26 @@ void Dialogs::speak(byte who, byte subject) {
void Dialogs::talkTo(byte whom) { void Dialogs::talkTo(byte whom) {
if (_vm->_parser->_person == _vm->_parser->kPardon) { if (_vm->_parser->_person == _vm->_parser->kPardon) {
_vm->_parser->_person = _vm->_gyro->_subjectNum; _vm->_parser->_person = _vm->_avalot->_subjectNum;
_vm->_gyro->_subjectNum = 0; _vm->_avalot->_subjectNum = 0;
} }
if (_vm->_gyro->_subjectNum == 0) { if (_vm->_avalot->_subjectNum == 0) {
switch (whom) { switch (whom) {
case Gyro::kPeopleSpludwick: case Avalot::kPeopleSpludwick:
if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[Avalot::kObjectPotion - 1])) {
displayScrollChain('q', 68); displayScrollChain('q', 68);
_vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; _vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true;
_vm->_lucerna->refreshObjectList(); _vm->_avalot->refreshObjectList();
_vm->_lucerna->incScore(3); _vm->_avalot->incScore(3);
return; return;
} else if (_vm->_gyro->_talkedToCrapulus) { } else if (_vm->_avalot->_talkedToCrapulus) {
// Spludwick - what does he need? // Spludwick - what does he need?
// 0 - let it through to use normal routine. // 0 - let it through to use normal routine.
switch (_vm->_gyro->_givenToSpludwick) { switch (_vm->_avalot->_givenToSpludwick) {
case 1: // Fallthrough is intended. case 1: // Fallthrough is intended.
case 2: { case 2: {
Common::String objStr = _vm->_gyro->getItem(Gyro::kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); Common::String objStr = _vm->_avalot->getItem(Avalot::kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]);
Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); Common::String tmpStr = Common::String::format("Can you get me %s, please?%c2%c", objStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble);
displayText(tmpStr); displayText(tmpStr);
} }
@ -990,57 +988,57 @@ void Dialogs::talkTo(byte whom) {
return; return;
} }
break; break;
case Gyro::kPeopleIbythneth: case Avalot::kPeopleIbythneth:
if (_vm->_gyro->_givenBadgeToIby) { if (_vm->_avalot->_givenBadgeToIby) {
displayScrollChain('q', 33); // Thanks a lot! displayScrollChain('q', 33); // Thanks a lot!
return; // And leave the proc. return; // And leave the proc.
} }
break; // Or... just continue, 'cos he hasn't got it. break; // Or... just continue, 'cos he hasn't got it.
case Gyro::kPeopleDogfood: case Avalot::kPeopleDogfood:
if (_vm->_gyro->_wonNim) { // We've won the game. if (_vm->_avalot->_wonNim) { // We've won the game.
displayScrollChain('q', 6); // "I'm Not Playing!" displayScrollChain('q', 6); // "I'm Not Playing!"
return; // Zap back. return; // Zap back.
} else } else
_vm->_gyro->_askedDogfoodAboutNim = true; _vm->_avalot->_askedDogfoodAboutNim = true;
break; break;
case Gyro::kPeopleAyles: case Avalot::kPeopleAyles:
if (!_vm->_gyro->_aylesIsAwake) { if (!_vm->_avalot->_aylesIsAwake) {
displayScrollChain('q', 43); // He's fast asleep! displayScrollChain('q', 43); // He's fast asleep!
return; return;
} else if (!_vm->_gyro->_givenPenToAyles) { } else if (!_vm->_avalot->_givenPenToAyles) {
displayScrollChain('q', 44); // Can you get me a pen, Avvy? displayScrollChain('q', 44); // Can you get me a pen, Avvy?
return; return;
} }
break; break;
case Gyro::kPeopleJacques: case Avalot::kPeopleJacques:
displayScrollChain('q', 43); displayScrollChain('q', 43);
return; return;
case Gyro::kPeopleGeida: case Avalot::kPeopleGeida:
if (_vm->_gyro->_givenPotionToGeida) if (_vm->_avalot->_givenPotionToGeida)
_vm->_gyro->_geidaFollows = true; _vm->_avalot->_geidaFollows = true;
else { else {
displayScrollChain('u', 17); displayScrollChain('u', 17);
return; return;
} }
break; break;
case Gyro::kPeopleSpurge: case Avalot::kPeopleSpurge:
if (!_vm->_gyro->_sittingInPub) { if (!_vm->_avalot->_sittingInPub) {
displayScrollChain('q', 71); // Try going over and sitting down. displayScrollChain('q', 71); // Try going over and sitting down.
return; return;
} else { } else {
if (_vm->_gyro->_spurgeTalkCount < 5) if (_vm->_avalot->_spurgeTalkCount < 5)
_vm->_gyro->_spurgeTalkCount++; _vm->_avalot->_spurgeTalkCount++;
if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through if (_vm->_avalot->_spurgeTalkCount > 1) { // no. 1 falls through
displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); displayScrollChain('q', 70 + _vm->_avalot->_spurgeTalkCount);
return; return;
} }
} }
break; break;
} }
// On a subject. Is there any reason to block it? // On a subject. Is there any reason to block it?
} else if ((whom == Gyro::kPeopleAyles) && (!_vm->_gyro->_aylesIsAwake)) { } else if ((whom == Avalot::kPeopleAyles) && (!_vm->_avalot->_aylesIsAwake)) {
displayScrollChain('q', 43); // He's fast asleep! displayScrollChain('q', 43); // He's fast asleep!
return; return;
} }
@ -1063,23 +1061,23 @@ void Dialogs::talkTo(byte whom) {
displayText(tmpStr); displayText(tmpStr);
} }
speak(whom, _vm->_gyro->_subjectNum); speak(whom, _vm->_avalot->_subjectNum);
if (!_noError) if (!_noError)
displayScrollChain('n', whom); // File not found! displayScrollChain('n', whom); // File not found!
if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == Avalot::kPeopleCrapulus)) { // Crapulus: get the badge - first time only
_vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; _vm->_avalot->_objects[Avalot::kObjectBadge - 1] = true;
_vm->_lucerna->refreshObjectList(); _vm->_avalot->refreshObjectList();
displayScrollChain('q', 1); // Circular from Cardiff. displayScrollChain('q', 1); // Circular from Cardiff.
_vm->_gyro->_talkedToCrapulus = true; _vm->_avalot->_talkedToCrapulus = true;
_vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. _vm->_avalot->_whereIs[Avalot::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off.
AnimationType *spr = &_vm->_animation->_sprites[1]; AnimationType *spr = &_vm->_animation->_sprites[1];
spr->_vanishIfStill = true; spr->_vanishIfStill = true;
spr->walkTo(2); // Walks away. spr->walkTo(2); // Walks away.
_vm->_lucerna->incScore(2); _vm->_avalot->incScore(2);
} }
} }

View file

@ -1,599 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
/* GYRO It all revolves around this bit! */
#include "avalanche/avalanche.h"
#include "avalanche/gyro.h"
#include "avalanche/pingo.h"
#include "avalanche/dialogs.h"
#include "avalanche/lucerna.h"
#include "avalanche/animation.h"
#include "common/file.h"
#include "common/random.h"
#include "common/textconsole.h"
namespace Avalanche {
const char *Gyro::kVersionNum = "1.30";
const char *Gyro::kCopyright = "1995";
const MouseHotspotType Gyro::kMouseHotSpots[9] = {
{8,0}, // 1 - up-arrow
{0,0}, // 2 - screwdriver
{15,6}, // 3 - right-arrow
{0,0}, // 4 - fletch
{8,7}, // 5 - hourglass
{4,0}, // 6 - TTHand
{8,5}, // 7- Mark's crosshairs
{8,7}, // 8- I-beam
{0,0} // 9 - question mark
};
// Art gallery at 2,1; notice about this at 2,2.
const int32 Gyro::kCatacombMap[8][8] = {
// Geida's room
// 1 2 3 | 4 5 6 7 8
{0x204, 0x200, 0xd0f0, 0xf0ff, 0xff, 0xd20f, 0xd200, 0x200},
{0x50f1, 0x20ff, 0x2ff, 0xff, 0xe0ff, 0x20ff, 0x200f, 0x7210},
{0xe3f0, 0xe10f, 0x72f0, 0xff, 0xe0ff, 0xff, 0xff, 0x800f},
{0x2201, 0x2030, 0x800f, 0x220, 0x20f, 0x30, 0xff, 0x23f}, // >> Oubliette
{0x5024, 0xf3, 0xff, 0x200f, 0x22f0, 0x20f, 0x200, 0x7260},
{0xf0, 0x2ff, 0xe2ff, 0xff, 0x200f, 0x50f0, 0x72ff, 0x201f},
{0xf6, 0x220f, 0x22f0, 0x30f, 0xf0, 0x20f, 0x8200, 0x2f0}, // <<< In here
{0x34, 0x200f, 0x51f0, 0x201f, 0xf1, 0x50ff, 0x902f, 0x2062}
};
// vv Stairs trap.
/* Explanation: $NSEW.
Nibble N: North.
0 = no connection,
2 = (left,) middle(, right) door with left-hand handle,
5 = (left,) middle(, right) door with right-hand handle,
7 = arch,
8 = arch and 1 north of it,
9 = arch and 2 north of it,
D = no connection + WINDOW,
E = no connection + TORCH,
F = recessed door (to Geida's room.)
Nibble S: South.
0 = no connection,
1,2,3 = left, middle, right door.
Nibble E: East.
0 = no connection (wall),
1 = no connection (wall + window),
2 = wall with door,
3 = wall with door and window,
6 = wall with candles,
7 = wall with door and candles,
F = straight-through corridor.
Nibble W: West.
0 = no connection (wall),
1 = no connection (wall + shield),
2 = wall with door,
3 = wall with door and shield,
4 = no connection (window),
5 = wall with door and window,
6 = wall with candles,
7 = wall with door and candles,
F = straight-through corridor. */
const char Gyro::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom};
// A quasiped defines how people who aren't sprites talk. For example, quasiped
// "A" is Dogfood. The rooms aren't stored because I'm leaving that to context.
const QuasipedType Gyro::kQuasipeds[16] = {
//_whichPed, _foregroundColor, _room, _backgroundColor, _who
{1, kColorLightgray, kRoomArgentPub, kColorBrown, kPeopleDogfood}, // A: Dogfood (screen 19).
{2, kColorGreen, kRoomArgentPub, kColorWhite, kPeopleIbythneth}, // B: Ibythneth (screen 19).
{2, kColorWhite, kRoomYours, kColorMagenta, kPeopleArkata}, // C: Arkata (screen 1).
{2, kColorBlack, kRoomLustiesRoom, kColorRed, kPeopleInvisible}, // D: Hawk (screen 23).
{2, kColorLightgreen, kRoomOutsideDucks, kColorBrown, kPeopleTrader}, // E: Trader (screen 50).
{5, kColorYellow, kRoomRobins, kColorRed, kPeopleAvalot}, // F: Avvy, tied up (scr.42)
{1, kColorBlue, kRoomAylesOffice, kColorWhite, kPeopleAyles}, // G: Ayles (screen 16).
{1, kColorBrown, kRoomMusicRoom, kColorWhite, kPeopleJacques}, // H: Jacques (screen 7).
{1, kColorLightgreen, kRoomNottsPub, kColorGreen, kPeopleSpurge}, // I: Spurge (screen 47).
{2, kColorYellow, kRoomNottsPub, kColorRed, kPeopleAvalot}, // J: Avalot (screen 47).
{1, kColorLightgray, kRoomLustiesRoom, kColorBlack, kPeopleDuLustie}, // K: du Lustie (screen 23).
{1, kColorYellow, kRoomOubliette, kColorRed, kPeopleAvalot}, // L: Avalot (screen 27).
{2, kColorWhite, kRoomOubliette, kColorRed, kPeopleInvisible}, // M: Avaroid (screen 27).
{3, kColorLightgray, kRoomArgentPub, kColorDarkgray, kPeopleMalagauche},// N: Malagauche (screen 19).
{4, kColorLightmagenta, kRoomNottsPub, kColorRed, kPeoplePort}, // O: Port (screen 47).
{1, kColorLightgreen, kRoomDucks, kColorDarkgray, kPeopleDrDuck} // P: Duck (screen 51).
};
const uint16 Gyro::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587};
const TuneType Gyro::kTune = {
kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher,
kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher,
kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher
};
byte Gyro::_whereIs[29] = {
// The Lads
kRoomYours, // Avvy
kRoomSpludwicks, // Spludwick
kRoomOutsideYours, // Crapulus
kRoomDucks, // Duck - r__DucksRoom's not defined yet.
kRoomArgentPub, // Malagauche
kRoomRobins, // Friar Tuck.
kRoomDummy, // Robin Hood - can't meet him at the start.
kRoomBrummieRoad, // Cwytalot
kRoomLustiesRoom, // Baron du Lustie.
kRoomOutsideCardiffCastle, // The Duke of Cardiff.
kRoomArgentPub, // Dogfood
kRoomOutsideDucks, // Trader
kRoomArgentPub, // Ibythneth
kRoomAylesOffice, // Ayles
kRoomNottsPub, // Port
kRoomNottsPub, // Spurge
kRoomMusicRoom, // Jacques
0, 0, 0, 0, 0, 0, 0, 0,
// The Lasses
kRoomYours, // Arkata
kRoomGeidas, // Geida
kRoomDummy, // nobody allocated here!
kRoomWiseWomans // The Wise Woman.
};
Gyro::Gyro(AvalancheEngine *vm) : _interrogation(0) {
_vm = vm;
// Needed because of Lucerna::load_also()
for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++)
_also[i][j] = 0;
}
_totalTime = 0;
}
Gyro::~Gyro() {
for (int i = 0; i < 9; i++) {
_digits[i].free();
_directions[i].free();
}
_digits[9].free();
}
Common::String Gyro::intToStr(int32 num) {
return Common::String::format("%d", num);
}
void Gyro::newMouse(byte id) {
if (id == _currentMouse)
return;
_currentMouse = id;
loadMouse(id);
}
/**
* Set the mouse pointer to 'HourGlass"
* @remarks Originally called 'wait'
*/
void Gyro::setMousePointerWait() {
newMouse(4);
}
void Gyro::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) {
warning("STUB: Gyro::shadow()");
}
void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) {
warning("STUB: Gyro::shbox()");
}
void Gyro::resetVariables() {
// Replaces memset(&_vm->_gyro->_dna, 0, sizeof(DnaType));
_vm->_animation->_direction = 0;
_carryNum = 0;
for (int i = 0; i < kObjectNum; i++)
_objects[i] = false;
_dnascore = 0;
_money = 0;
_room = kRoomNowhere;
_wearing = 0;
_sworeNum = 0;
_saveNum = 0;
for (int i = 0; i < 100; i++)
_roomCount[i] = 0;
_alcoholLevel = 0;
_playedNim = 0;
_wonNim = false;
_wineState = 0;
_cwytalotGone = false;
_passwordNum = 0;
_aylesIsAwake = false;
_drawbridgeOpen = 0;
_avariciusTalk = 0;
_boughtOnion = false;
_rottenOnion = false;
_onionInVinegar = false;
_givenToSpludwick = 0;
_brummieStairs = 0;
_cardiffQuestionNum = 0;
_passedCwytalotInHerts = false;
_avvyIsAwake = false;
_avvyInBed = false;
_userMovesAvvy = false;
_npcFacing = 0;
_givenBadgeToIby = false;
_friarWillTieYouUp = false;
_tiedUp = false;
_boxContent = 0;
_talkedToCrapulus = false;
_jacquesState = 0;
_bellsAreRinging = false;
_standingOnDais = false;
_takenPen = false;
_arrowTriggered = false;
_arrowInTheDoor = false;
_favouriteDrink = "";
_favouriteSong = "";
_worstPlaceOnEarth = "";
_spareEvening = "";
_totalTime = 0;
_jumpStatus = 0;
_mushroomGrowing = false;
_spludwickAtHome = false;
_lastRoom = 0;
_lastRoomNotMap = 0;
_crapulusWillTell = false;
_enterCatacombsFromLustiesRoom = false;
_teetotal = false;
_malagauche = 0;
_drinking = 0;
_enteredLustiesRoomAsMonk = false;
_catacombX = 0;
_catacombY = 0;
_avvysInTheCupboard = false;
_geidaFollows = false;
_geidaSpin = 0;
_geidaTime = 0;
_nextBell = 0;
_givenPotionToGeida = false;
_lustieIsAsleep = false;
_flipToWhere = 0;
_flipToPed = 0;
_beenTiedUp = false;
_sittingInPub = false;
_spurgeTalkCount = 0;
_metAvaroid = false;
_takenMushroom = false;
_givenPenToAyles = false;
_askedDogfoodAboutNim = false;
}
void Gyro::newGame() {
for (int i = 0; i < kMaxSprites; i++) {
AnimationType *spr = &_vm->_animation->_sprites[i];
if (spr->_quick)
spr->remove();
}
// Deallocate sprite. Sorry, beta testers!
AnimationType *avvy = &_vm->_animation->_sprites[0];
avvy->init(0, true, _vm->_animation);
_alive = true;
resetVariables();
_vm->_dialogs->setBubbleStateNatural();
_spareEvening = "answer a questionnaire";
_favouriteDrink = "beer";
_money = 30; // 2/6
_vm->_animation->_direction = Animation::kDirStopped;
_wearing = kObjectClothes;
_objects[kObjectMoney - 1] = true;
_objects[kObjectBodkin - 1] = true;
_objects[kObjectBell - 1] = true;
_objects[kObjectClothes - 1] = true;
_thinkThing = true;
_thinks = 2;
_vm->_lucerna->refreshObjectList();
_onToolbar = false;
_seeScroll = false;
avvy->appear(300, 117, Animation::kDirRight); // Needed to initialize Avalot.
//for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil;
// fillchar(previous^,sizeof(previous^),#0); { blank out array }
_him = Parser::kPardon;
_her = Parser::kPardon;
_it = Parser::kPardon;
_lastPerson = Parser::kPardon; // = Pardon?
_passwordNum = _vm->_rnd->getRandomNumber(30) + 1; //Random(30) + 1;
_userMovesAvvy = false;
_doingSpriteRun = false;
_avvyInBed = true;
_enidFilename = "";
_vm->_lucerna->enterRoom(1, 1);
avvy->_visible = false;
_vm->_lucerna->drawScore();
_vm->_menu->setup();
_vm->_lucerna->_clock.update();
_vm->_lucerna->spriteRun();
}
void Gyro::slowDown() {
warning("STUB: Gyro::slowdown()");
}
bool Gyro::setFlag(char x) {
for (uint16 i = 0; i < _flags.size(); i++) {
if (_flags[i] == x)
return true;
}
return false;
}
bool Gyro::decreaseMoney(uint16 howmuchby) {
_money -= howmuchby;
if (_money < 0) {
_vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!"
_vm->_lucerna->gameOver();
return false;
} else
return true;
}
Common::String Gyro::getName(byte whose) {
static const Common::String kLads[17] = {
"Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck",
"Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood",
"A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques"
};
static const Common::String kLasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"};
if (whose < 175)
return kLads[whose - 150];
else
return kLasses[whose - 175];
}
byte Gyro::getNameChar(byte whose) {
static const char kLadChar[] = "ASCDMTRwLfgeIyPu";
static const char kLassChar[] = "kG\0xB1o";
if (whose < 175)
return kLadChar[whose - 150];
else
return kLassChar[whose - 175];
}
Common::String Gyro::getThing(byte which) {
static const Common::String kThings[kObjectNum] = {
"Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt",
"Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key",
"Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion"
};
Common::String get_thing_result;
switch (which) {
case kObjectWine:
switch (_wineState) {
case 1:
case 4:
get_thing_result = kThings[which - 1];
break;
case 3:
get_thing_result = "Vinegar";
break;
}
break;
case kObjectOnion:
if (_rottenOnion)
get_thing_result = "rotten onion";
else
get_thing_result = kThings[which - 1];
break;
default:
get_thing_result = kThings[which - 1];
}
return get_thing_result;
}
char Gyro::getThingChar(byte which) {
static const char kThingsChar[] = "WMBParCLguKeSnIohn"; // V=Vinegar
char get_thingchar_result;
switch (which) {
case kObjectWine:
if (_wineState == 3)
get_thingchar_result = 'V'; // Vinegar
else
get_thingchar_result = kThingsChar[which - 1];
break;
default:
get_thingchar_result = kThingsChar[which - 1];
}
return get_thingchar_result;
}
Common::String Gyro::getItem(byte which) {
static const Common::String kItems[kObjectNum] = {
"some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt",
"a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom",
"a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit",
"an onion"
};
Common::String get_better_result;
if (which > 150)
which -= 149;
switch (which) {
case kObjectWine:
switch (_wineState) {
case 0:
case 1:
case 4:
get_better_result = kItems[which - 1];
break;
case 3:
get_better_result = "some vinegar";
break;
}
break;
case kObjectOnion:
if (_rottenOnion)
get_better_result = "a rotten onion";
else if (_onionInVinegar)
get_better_result = "a pickled onion (in the vinegar)";
else
get_better_result = kItems[which - 1];
break;
default:
if ((which < kObjectNum) && (which > 0))
get_better_result = kItems[which - 1];
else
get_better_result = "";
}
return get_better_result;
}
Common::String Gyro::f5Does() {
switch (_room) {
case kRoomYours:
if (!_avvyIsAwake)
return Common::String::format("%cWWake up", Parser::kVerbCodeWake);
else if (_avvyInBed)
return Common::String::format("%cGGet up", Parser::kVerbCodeStand);
break;
case kRoomInsideCardiffCastle:
if (_standingOnDais)
return Common::String::format("%cCClimb down", Parser::kVerbCodeClimb);
else
return Common::String::format("%cCClimb up", Parser::kVerbCodeClimb);
break;
case kRoomNottsPub:
if (_sittingInPub)
return Common::String::format("%cSStand up", Parser::kVerbCodeStand);
else
return Common::String::format("%cSSit down", Parser::kVerbCodeSit);
break;
case kRoomMusicRoom:
if (_vm->_animation->inField(5))
return Common::String::format("%cPPlay the harp", Parser::kVerbCodePlay);
break;
}
return Common::String::format("%c", _vm->_parser->kPardon); // If all else fails...
}
void Gyro::loadMouse(byte which) {
Common::File f;
if (!f.open("mice.avd"))
error("AVALANCHE: Gyro: File not found: mice.avd");
::Graphics::Surface cursor;
cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8());
cursor.fillRect(Common::Rect(0, 0, 16, 32), 255);
// The AND mask.
f.seek(kMouseSize * 2 * which + 134);
::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f);
for (int j = 0; j < mask.h; j++) {
for (int i = 0; i < mask.w; i++) {
for (int k = 0; k < 2; k++) {
if (*(byte *)mask.getBasePtr(i, j) == 0)
*(byte *)cursor.getBasePtr(i, j * 2 + k) = 0;
}
}
}
mask.free();
// The OR mask.
f.seek(kMouseSize * 2 * which + 134 * 2);
mask = _vm->_graphics->loadPictureGraphic(f);
for (int j = 0; j < mask.h; j++) {
for (int i = 0; i < mask.w; i++) {
for (int k = 0; k < 2; k++) {
byte pixel = *(byte *)mask.getBasePtr(i, j);
if (pixel != 0)
*(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel;
}
}
}
mask.free();
f.close();
CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false);
cursor.free();
}
void Gyro::setBackgroundColor(byte x) {
warning("STUB: Gyro::background()");
}
void Gyro::hangAroundForAWhile() {
for (int i = 0; i < 28; i++)
slowDown();
}
void Gyro::init() {
_mouse = kMouseStateNo;
_letMeOut = false;
_holdTheDawn = true;
_currentMouse = 177;
_dropsOk = true;
_mouseText = "";
_cheat = false;
_cp = 0;
_ledStatus = 177;
_defaultLed = 2;
_enidFilename = ""; // Undefined.
for (int i = 0; i < 3; i++)
_scoreToDisplay[i] = -1; // Impossible digits.
_holdTheDawn = false;
setMousePointerWait();
CursorMan.showMouse(true);
}
} // End of namespace Avalanche

View file

@ -1,367 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
/* GYRO It all revolves around this bit! */
#ifndef AVALANCHE_GYRO2_H
#define AVALANCHE_GYRO2_H
#include "common/str.h"
#include "common/scummsys.h"
#include "common/file.h"
#include "graphics/surface.h"
namespace Avalanche {
class AvalancheEngine;
enum Color {
kColorBlack, kColorBlue, kColorGreen, kColorCyan, kColorRed,
kColorMagenta, kColorBrown, kColorLightgray, kColorDarkgray, kColorLightblue,
kColorLightgreen, kColorLightcyan, kColorLightred, kColorLightmagenta, kColorYellow,
kColorWhite
};
// CHECKME: kRoomBossKey is a guess
enum Room {
kRoomNowhere = 0, kRoomYours = 1, kRoomOutsideYours = 2, kRoomOutsideSpludwicks = 3,
kRoomYourHall = 5, kRoomMusicRoom = 7, kRoomOutsideArgentPub = 9, kRoomArgentRoad = 10,
kRoomWiseWomans = 11, kRoomSpludwicks = 12, kRoomInsideAbbey = 13, kRoomOutsideAbbey = 14,
kRoomAvvysGarden = 15, kRoomAylesOffice = 16, kRoomArgentPub = 19, kRoomBrummieRoad = 20,
kRoomBridge = 21, kRoomLusties = 22, kRoomLustiesRoom = 23, kRoomWestHall = 25,
kRoomEastHall = 26, kRoomOubliette = 27, kRoomGeidas = 28, kRoomCatacombs = 29,
kRoomEntranceHall = 40, kRoomRobins = 42, kRoomOutsideNottsPub = 46, kRoomNottsPub = 47,
kRoomOutsideDucks = 50, kRoomDucks = 51, kRoomOutsideCardiffCastle = 70, kRoomInsideCardiffCastle = 71,
kRoomBossKey = 98, kRoomMap = 99, kRoomDummy = 177 // Dummy room
};
static const byte kObjectNum = 18; // always preface with a #
static const int16 kCarryLimit = 12; // carry limit
static const int16 kNumlockCode = 32; // Code for Num Lock
static const int16 kMouseSize = 134;
struct MouseHotspotType { // mouse-void
int16 _horizontal, _vertical;
};
struct PedType {
int16 _x, _y;
byte _direction;
};
struct MagicType {
byte _operation; // one of the operations
uint16 _data; // data for them
};
class FieldType {
public:
int16 _x1, _y1, _x2, _y2;
};
struct ByteField {
byte _x1, _y1, _x2, _y2;
};
class LineType : public FieldType {
public:
byte _color;
};
typedef int8 TuneType[31];
struct QuasipedType {
byte _whichPed, _foregroundColor, _room, _backgroundColor;
uint16 _who;
};
#if 0
struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA.
Common::String _qEnidFilename;
bool _qSoundFx;
byte _qThinks;
bool _qThinkThing;
};
#endif
class Gyro {
public:
static const char *kVersionNum;
static const char *kCopyright;
static const int16 kVersionCode = 130; // Same as kVersionCode, but numerically & without the ".".
static const int16 kGameCode = 2; // Avalot's code number
// Objects you can hold:
enum Object {
kObjectWine = 1,
kObjectMoney,
kObjectBodkin,
kObjectPotion,
kObjectChastity,
kObjectBolt,
kObjectCrossbow,
kObjectLute,
kObjectBadge,
kObjectMushroom,
kObjectKey,
kObjectBell,
kObjectPrescription,
kObjectPen,
kObjectInk,
kObjectClothes,
kObjectHabit,
kObjectOnion
};
// People who hang around this game.
enum People {
// Boys:
kPeopleAvalot = 150,
kPeopleSpludwick = 151,
kPeopleCrapulus = 152,
kPeopleDrDuck = 153,
kPeopleMalagauche = 154,
kPeopleFriarTuck = 155,
kPeopleRobinHood = 156,
kPeopleCwytalot = 157,
kPeopleDuLustie = 158,
kPeopleDuke = 159,
kPeopleDogfood = 160,
kPeopleTrader = 161,
kPeopleIbythneth = 162,
kPeopleAyles = 163,
kPeoplePort = 164,
kPeopleSpurge = 165,
kPeopleJacques = 166,
// Girls:
kPeopleArkata = 175,
kPeopleGeida = 176,
kPeopleInvisible = 177,
kPeopleWisewoman = 178
};
static const int16 kXW = 30;
static const int16 kYW = 36; // x width & y whatsit
static const int16 kMargin = 5;
static const MouseHotspotType kMouseHotSpots[9];
static const int16 kMaxSprites = 2; // Current max no. of sprites.
// For Thinkabout:
static const bool kThing = true;
static const bool kPerson = false;
// Magic/portal constants:
enum Magics {
kMagicNothing, // Ignore it if this line is touched.
kMagicBounce, // Bounce off this line. Not valid for portals.
kMagicExclaim, // Put up a chain of scrolls.
kMagicTransport, // Enter new room.
kMagicUnfinished, // Unfinished connection.
kMagicSpecial, // Special function.
kMagicOpenDoor // Opening door.
};
// These following static constants should be included in CFG when it's written.
static const bool kSlowComputer = false; // Stops walking when mouse touches toolbar.
static const int16 kBorder = 1; // size of border on shadowboxes
static const int16 kWalk = 3;
static const int16 kRun = 5;
static const int32 kCatacombMap[8][8];
static const char kSpludwicksOrder[3];
static const QuasipedType kQuasipeds[16];
enum Pitch {
kPitchInvalid,
kPitchLower,
kPitchSame,
kPitchHigher
};
static const uint16 kNotes[12];
static const TuneType kTune;
// If this is greater than zero, the next line you type is stored in the DNA in a position dictated by the value.
// If a scroll comes up, or you leave the room, it's automatically set to zero.
byte _interrogation;
static byte _whereIs[29];
// Former DNA structure
byte _carryNum; // How many objects you're carrying...
bool _objects[kObjectNum]; // ...and which ones they are.
int16 _dnascore; // your score, of course
int32 _money; // your current amount of dosh
byte _room; // your current room
byte _wearing; // what you're wearing
byte _sworeNum; // number of times you've sworn
byte _saveNum; // number of times this game has been saved
byte _roomCount[100]; // Add one to each every time you enter a room
byte _alcoholLevel; // Your blood alcohol level.
byte _playedNim; // How many times you've played Nim.
bool _wonNim; // Have you *won* Nim? (That's harder.)
byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar.
bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet?
byte _passwordNum; // Number of the passw for this game.
bool _aylesIsAwake; // pretty obvious!
byte _drawbridgeOpen; // Between 0 (shut) and 4 (open).
byte _avariciusTalk; // How much Avaricius has said to you.
bool _boughtOnion; // Have you bought an onion yet?
bool _rottenOnion; // And has it rotted?
bool _onionInVinegar; // Is the onion in the vinegar?
byte _givenToSpludwick; // 0 = nothing given, 1 = onion...
byte _brummieStairs; // Progression through the stairs trick.
byte _cardiffQuestionNum; // Things you get asked in Cardiff.
bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts?
bool _avvyIsAwake; // Well? Is Avvy awake? (Screen 1 only.)
bool _avvyInBed; // True if Avvy's in bed, but awake.
bool _userMovesAvvy; // If this is false, the user has no control over Avvy's movements.
byte _npcFacing; // If there's an NPC in the current room which turns it's head according to Avvy's movement (keep looking at him), this variable tells which way it's facing at the moment.
bool _givenBadgeToIby; // Have you given the badge to Iby yet?
bool _friarWillTieYouUp; // If you're going to get tied up.
bool _tiedUp; // You ARE tied up!
byte _boxContent; // 0 = money (sixpence), 254 = empty, any other number implies the contents of the box.
bool _talkedToCrapulus; // Pretty self-explanatory.
byte _jacquesState; // 0=asleep, 1=awake, 2=gets up, 3=gone.
bool _bellsAreRinging; // Is Jacques ringing the bells?
bool _standingOnDais; // In room 71, inside Cardiff Castle.
bool _takenPen; // Have you taken the pen (in Cardiff?)
bool _arrowTriggered; // And has the arrow been triggered?
bool _arrowInTheDoor; // Did the arrow hit the wall?
Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's
uint32 _totalTime; // Your total time playing this game, in ticks.
byte _jumpStatus; // Fixes how high you're jumping.
bool _mushroomGrowing; // Is the mushroom growing in 42?
bool _spludwickAtHome; // Is Spludwick at home?
byte _lastRoom;
byte _lastRoomNotMap;
bool _crapulusWillTell; // Will Crapulus tell you about Spludwick being away?
bool _enterCatacombsFromLustiesRoom;
bool _teetotal; // Are we touching any more drinks?
byte _malagauche; // Position of Malagauche. See Celer for more info.
char _drinking; // What's he getting you?
bool _enteredLustiesRoomAsMonk;
byte _catacombX, _catacombY; // XY coords in the catacombs.
bool _avvysInTheCupboard; // On screen 22.
bool _geidaFollows; // Is Geida following you?
byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke.
byte _nextBell; // For the ringing.
bool _givenPotionToGeida; // Does Geida have the potion?
bool _lustieIsAsleep; // Is BDL asleep?
byte _flipToWhere, _flipToPed; // For the sequencer.
bool _beenTiedUp; // In r__Robins.
bool _sittingInPub; // Are you sitting down in the pub?
byte _spurgeTalkCount; // Count for talking to Spurge.
bool _metAvaroid;
bool _takenMushroom, _givenPenToAyles, _askedDogfoodAboutNim;
// End of former DNA Structure
byte _lineNum; // Number of lines.
LineType _lines[50]; // For Also.
enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse;
bool _dropsOk, _scReturn, _soundFx, _cheat;
Common::String _mouseText;
bool _weirdWord;
bool _letMeOut;
Common::String _scroll[15];
byte _scrollNum, _whichwas;
byte _thinks;
bool _thinkThing;
int16 _talkX, _talkY;
byte _talkBackgroundColor, _talkFontColor;
byte _scrollBells; // no. of times to ring the bell
bool _onToolbar, _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll?
char _objectList[10];
::Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in Lucerna::load_digits() !!!
::Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead.
// Called .free() for them in ~Gyro().
int8 _scoreToDisplay[3];
byte _currentMouse; // current mouse-void
Common::String _verbStr; // what you can do with your object. :-)
Common::String *_also[31][2];
PedType _peds[15];
MagicType _magics[15];
MagicType _portals[7];
FieldType _fields[30];
byte _fieldNum;
Common::String _flags;
Common::String _listen;
Common::String _atKey; // For XTs, set to "alt-". For ATs, set to "f1".
byte _cp, _ledStatus, _defaultLed;
FontType _font;
bool _alive;
byte _buffer[2000];
uint16 _bufSize;
int16 _underScroll; // Y-coord of just under the scroll text.
Common::String _roomnName; // Name of actual room
Common::String _subject; // What you're talking to them about.
byte _subjectNum; // The same thing.
bool _keyboardClick; // Is a keyboard click noise wanted?
byte _him, _her, _it;
int32 _roomTime; // Set to 0 when you enter a room, added to in every loop.
byte _lastPerson; // Last person to have been selected using the People menu.
bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites.
bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning.
bool _isLoaded; // Is it a loaded gamestate?
Common::String _enidFilename;
Gyro(AvalancheEngine *vm);
~Gyro();
Common::String intToStr(int32 num);
void newMouse(byte id);
void setMousePointerWait(); // Makes hourglass.
void loadMouse(byte which);
void setBackgroundColor(byte x);
void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t);
void resetVariables();
void newGame(); // This sets up the DNA for a completely new game.
void slowDown();
bool setFlag(char x);
bool decreaseMoney(uint16 howmuchby); // Called pennycheck in the original.
void hangAroundForAWhile();
Common::String getName(byte whose);
byte getNameChar(byte whose);
Common::String getThing(byte which);
char getThingChar(byte which);
Common::String getItem(byte which); // Called get_better in the original.
Common::String f5Does(); // This procedure determines what f5 does.
void init();
private:
AvalancheEngine *_vm;
void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc);
};
} // End of namespace Avalanche
#endif // AVALANCHE_GYRO2_H

File diff suppressed because it is too large Load diff

View file

@ -1,124 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
/* LUCERNA The screen, [keyboard] and mouse handler.*/
#ifndef AVALANCHE_LUCERNA2_H
#define AVALANCHE_LUCERNA2_H
#include "common/scummsys.h"
#include "common/file.h"
namespace Avalanche {
class AvalancheEngine;
class Clock {
public:
Clock(AvalancheEngine *vm);
void update();
private:
static const int kCenterX = 510;
static const int kCenterY = 183;
AvalancheEngine *_vm;
uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle;
Common::Point _clockHandHour, _clockHandMinute;
void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color);
void drawHand(const Common::Point &endPoint, byte color);
void plotHands();
void chime();
};
class Lucerna {
public:
bool _holdLeftMouse;
Clock _clock;
Lucerna(AvalancheEngine *vm);
~Lucerna();
void init();
void callVerb(byte id);
void drawAlsoLines();
void loadRoom(byte num);
void exitRoom(byte x);
void enterRoom(byte room, byte ped);
void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!!
void loadDigits(); // Load the scoring digits & rwlites
void drawToolbar();
void drawScore();
void incScore(byte num); // Add on no. of points
void useCompass(const Common::Point &cursorPos); // Click on the compass on the toolbar to control Avvy's movement.
void fxToggle();
void refreshObjectList();
void checkClick();
void errorLed();
void dusk();
void dawn();
void drawDirection(); // Draws the little icon at the left end of the text input field.
void gameOver();
uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees.
void fixFlashers();
void loadAlso(byte num);
// There are two kinds of redraw: Major and Minor. Minor is what happens when you load a game, etc. Major redraws EVERYTHING.
void minorRedraw();
void majorRedraw();
void spriteRun();
private:
AvalancheEngine *_vm;
Common::File file;
Common::String readAlsoStringFromFile();
void scram(Common::String &str);
void unScramble();
void zoomOut(int16 x, int16 y); // Only used when entering the map.
void enterNewTown();
void findPeople(byte room);
void putGeidaAt(byte whichPed, byte ped);
void guideAvvy(Common::Point cursorPos);
// Will be used in dusk() and dawn().
bool _fxHidden;
int8 fades(int8 x);
void fadeOut(byte n);
void fadeIn(byte n);
};
} // End of namespace Avalanche
#endif // AVALANCHE_LUCERNA2_H

View file

@ -29,8 +29,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/menu.h" #include "avalanche/menu.h"
#include "avalanche/lucerna.h"
#include "avalanche/gyro.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
#include "common/textconsole.h" #include "common/textconsole.h"
@ -67,7 +65,7 @@ void HeadType::highlight() {
_menu->_activeMenuItem._activeNum = _position; _menu->_activeMenuItem._activeNum = _position;
_menu->_menuActive = true; _menu->_menuActive = true;
_menu->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor. _menu->_vm->_avalot->_currentMouse = 177; // Force redraw of cursor.
} }
bool HeadType::parseAltTrigger(char key) { bool HeadType::parseAltTrigger(char key) {
@ -137,8 +135,8 @@ void MenuItem::display() {
for (int y = 1; y < _optionNum; y++) for (int y = 1; y < _optionNum; y++)
displayOption(y, false); displayOption(y, false);
_dr->_vm->_gyro->_defaultLed = 1; _dr->_vm->_avalot->_defaultLed = 1;
_dr->_vm->_gyro->_currentMouse = 177; _dr->_vm->_avalot->_currentMouse = 177;
CursorMan.showMouse(true); // 4 = fletch CursorMan.showMouse(true); // 4 = fletch
} }
@ -151,7 +149,7 @@ void MenuItem::wipe() {
_activeNow = false; _activeNow = false;
_dr->_menuActive = false; _dr->_menuActive = false;
_firstlix = false; _firstlix = false;
_dr->_vm->_gyro->_defaultLed = 2; _dr->_vm->_avalot->_defaultLed = 2;
CursorMan.showMouse(true); CursorMan.showMouse(true);
} }
@ -220,13 +218,13 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu
void MenuBar::draw() { void MenuBar::draw() {
_dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor);
byte savecp = _dr->_vm->_gyro->_cp; byte savecp = _dr->_vm->_avalot->_cp;
_dr->_vm->_gyro->_cp = 3; _dr->_vm->_avalot->_cp = 3;
for (int i = 0; i < _menuNum; i++) for (int i = 0; i < _menuNum; i++)
_menuItems[i].draw(); _menuItems[i].draw();
_dr->_vm->_gyro->_cp = savecp; _dr->_vm->_avalot->_cp = savecp;
} }
void MenuBar::parseAltTrigger(char c) { void MenuBar::parseAltTrigger(char c) {
@ -264,30 +262,30 @@ Menu::Menu(AvalancheEngine *vm) {
} }
void Menu::findWhatYouCanDoWithIt() { void Menu::findWhatYouCanDoWithIt() {
switch (_vm->_gyro->_thinks) { switch (_vm->_avalot->_thinks) {
case Gyro::kObjectWine: case Avalot::kObjectWine:
case Gyro::kObjectPotion: case Avalot::kObjectPotion:
case Gyro::kObjectInk: case Avalot::kObjectInk:
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink;
break; break;
case Gyro::kObjectBell: case Avalot::kObjectBell:
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing;
break; break;
case Gyro::kObjectChastity: case Avalot::kObjectChastity:
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear;
break; break;
case Gyro::kObjectLute: case Avalot::kObjectLute:
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay;
break; break;
case Gyro::kObjectMushroom: case Avalot::kObjectMushroom:
case Gyro::kObjectOnion: case Avalot::kObjectOnion:
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat;
break; break;
case Gyro::kObjectClothes: case Avalot::kObjectClothes:
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear;
break; break;
default: default:
_vm->_gyro->_verbStr = Parser::kVerbCodeExam; // Anything else. _vm->_avalot->_verbStr = Parser::kVerbCodeExam; // Anything else.
} }
} }
@ -312,7 +310,7 @@ void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, boo
for (uint i = 0; i < text.size(); i++) { for (uint i = 0; i < text.size(); i++) {
for (int j = 0; j < 8; j++) { for (int j = 0; j < 8; j++) {
byte idx = text[i]; byte idx = text[i];
font[idx][j] = _vm->_gyro->_font[idx][j] & ander; // Set the font. font[idx][j] = _vm->_avalot->_font[idx][j] & ander; // Set the font.
// And set the background of the text to the desired color. // And set the background of the text to the desired color.
for (int k = 0; k < 8; k++) for (int k = 0; k < 8; k++)
*(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor;
@ -414,9 +412,9 @@ void Menu::setupMenuFile() {
_activeMenuItem.reset(); _activeMenuItem.reset();
_activeMenuItem.setupOption("New game", 'N', "f4", true); _activeMenuItem.setupOption("New game", 'N', "f4", true);
_activeMenuItem.setupOption("Load...", 'L', "^f3", true); _activeMenuItem.setupOption("Load...", 'L', "^f3", true);
_activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_gyro->_alive); _activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_avalot->_alive);
_activeMenuItem.setupOption("Save As...", 'v', "", _vm->_gyro->_alive); _activeMenuItem.setupOption("Save As...", 'v', "", _vm->_avalot->_alive);
_activeMenuItem.setupOption("DOS Shell", 'D', _vm->_gyro->_atKey + '1', true); _activeMenuItem.setupOption("DOS Shell", 'D', _vm->_avalot->_atKey + '1', true);
_activeMenuItem.setupOption("Quit", 'Q', "alt-X", true); _activeMenuItem.setupOption("Quit", 'Q', "alt-X", true);
_activeMenuItem.display(); _activeMenuItem.display();
} }
@ -424,7 +422,7 @@ void Menu::setupMenuFile() {
void Menu::setupMenuAction() { void Menu::setupMenuAction() {
_activeMenuItem.reset(); _activeMenuItem.reset();
Common::String f5Does = _vm->_gyro->f5Does(); Common::String f5Does = _vm->_avalot->f5Does();
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
if (!f5Does.empty()) if (!f5Does.empty())
f5Does.deleteChar(0); f5Does.deleteChar(0);
@ -433,13 +431,13 @@ void Menu::setupMenuAction() {
else else
_activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true);
_activeMenuItem.setupOption("Pause game", 'P', "f6", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true);
if (_vm->_gyro->_room == kRoomMap) if (_vm->_avalot->_room == kRoomMap)
_activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor());
else else
_activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor()); _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor());
_activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Look around", 'L', "f8", true);
_activeMenuItem.setupOption("Inventory", 'I', "Tab", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true);
if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk) if (_vm->_animation->_sprites[0]._speedX == _vm->_avalot->kWalk)
_activeMenuItem.setupOption("Run fast", 'R', "^R", true); _activeMenuItem.setupOption("Run fast", 'R', "^R", true);
else else
_activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true);
@ -454,8 +452,8 @@ void Menu::setupMenuPeople() {
_activeMenuItem.reset(); _activeMenuItem.reset();
for (int i = 150; i <= 178; i++) { for (int i = 150; i <= 178; i++) {
if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { if (_vm->_avalot->_whereIs[i - 150] == _vm->_avalot->_room) {
_activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); _activeMenuItem.setupOption(_vm->_avalot->getName(i), _vm->_avalot->getNameChar(i), "", true);
people += i; people += i;
} }
} }
@ -466,8 +464,8 @@ void Menu::setupMenuPeople() {
void Menu::setupMenuObjects() { void Menu::setupMenuObjects() {
_activeMenuItem.reset(); _activeMenuItem.reset();
for (int i = 0; i < kObjectNum; i++) { for (int i = 0; i < kObjectNum; i++) {
if (_vm->_gyro->_objects[i]) if (_vm->_avalot->_objects[i])
_activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); _activeMenuItem.setupOption(_vm->_avalot->getThing(i + 1), _vm->_avalot->getThingChar(i + 1), "", true);
} }
_activeMenuItem.display(); _activeMenuItem.display();
} }
@ -475,54 +473,54 @@ void Menu::setupMenuObjects() {
void Menu::setupMenuWith() { void Menu::setupMenuWith() {
_activeMenuItem.reset(); _activeMenuItem.reset();
if (_vm->_gyro->_thinkThing) { if (_vm->_avalot->_thinkThing) {
findWhatYouCanDoWithIt(); findWhatYouCanDoWithIt();
for (uint i = 0; i < _vm->_gyro->_verbStr.size(); i++) { for (uint i = 0; i < _vm->_avalot->_verbStr.size(); i++) {
char vbchar; char vbchar;
Common::String verb; Common::String verb;
_vm->_parser->verbOpt(_vm->_gyro->_verbStr[i], verb, vbchar); _vm->_parser->verbOpt(_vm->_avalot->_verbStr[i], verb, vbchar);
_activeMenuItem.setupOption(verb, vbchar, "", true); _activeMenuItem.setupOption(verb, vbchar, "", true);
} }
// We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room, // We disable the "give" option if: (a), you haven't selected anybody, (b), the _person you've selected isn't in the room,
// or (c), the _person you've selected is YOU! // or (c), the _person you've selected is YOU!
if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_parser->kNothing) if ((_vm->_avalot->_lastPerson == Avalot::kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing)
|| (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_room)) || (_vm->_avalot->_whereIs[_vm->_avalot->_lastPerson - 150] != _vm->_avalot->_room))
_activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here. _activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here.
else { else {
_activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); _activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true);
_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeGive; _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeGive;
} }
} else { } else {
_activeMenuItem.setupOption("Examine", 'x', "", true); _activeMenuItem.setupOption("Examine", 'x', "", true);
_activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->_thinks), 'T', "", true); _activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true);
_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; _vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk;
switch (_vm->_gyro->_thinks) { switch (_vm->_avalot->_thinks) {
case Gyro::kPeopleGeida: case Avalot::kPeopleGeida:
case Gyro::kPeopleArkata: case Avalot::kPeopleArkata:
_activeMenuItem.setupOption("Kiss her", 'K', "", true); _activeMenuItem.setupOption("Kiss her", 'K', "", true);
_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeKiss; _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeKiss;
break; break;
case Gyro::kPeopleDogfood: case Avalot::kPeopleDogfood:
_activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won.
_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodePlay; _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodePlay;
break; break;
case Gyro::kPeopleMalagauche: { case Avalot::kPeopleMalagauche: {
bool isSober = !_vm->_gyro->_teetotal; bool isSober = !_vm->_avalot->_teetotal;
_activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_objects[Gyro::kObjectWine - 1]); _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[Avalot::kObjectWine - 1]);
_activeMenuItem.setupOption("Buy some beer", 'b', "", isSober); _activeMenuItem.setupOption("Buy some beer", 'b', "", isSober);
_activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober); _activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober);
_activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober);
_activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober);
_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 101 + 100 + 102 + 103 + 104; _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 101 + 100 + 102 + 103 + 104;
} }
break; break;
case Gyro::kPeopleTrader: case Avalot::kPeopleTrader:
_activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_objects[Gyro::kObjectOnion - 1]); _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[Avalot::kObjectOnion - 1]);
_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; _vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 105;
break; break;
} }
} }
@ -533,19 +531,19 @@ void Menu::runMenuGame() {
// Help, boss, untrash screen. // Help, boss, untrash screen.
switch (_activeMenuItem._choiceNum) { switch (_activeMenuItem._choiceNum) {
case 0: case 0:
_vm->_lucerna->callVerb(Parser::kVerbCodeHelp); _vm->_avalot->callVerb(Parser::kVerbCodeHelp);
break; break;
case 1: case 1:
_vm->_lucerna->callVerb(Parser::kVerbCodeBoss); _vm->_avalot->callVerb(Parser::kVerbCodeBoss);
break; break;
case 2: case 2:
_vm->_lucerna->majorRedraw(); _vm->_avalot->majorRedraw();
break; break;
case 3: case 3:
_vm->_lucerna->callVerb(Parser::kVerbCodeScore); _vm->_avalot->callVerb(Parser::kVerbCodeScore);
break; break;
case 4: case 4:
_vm->_lucerna->callVerb(Parser::kVerbCodeInfo); _vm->_avalot->callVerb(Parser::kVerbCodeInfo);
break; break;
} }
} }
@ -554,17 +552,17 @@ void Menu::runMenuFile() {
// New game, load, save, save as, DOS shell, about, quit. // New game, load, save, save as, DOS shell, about, quit.
switch (_activeMenuItem._choiceNum) { switch (_activeMenuItem._choiceNum) {
case 0: case 0:
_vm->_lucerna->callVerb(Parser::kVerbCodeRestart); _vm->_avalot->callVerb(Parser::kVerbCodeRestart);
break; break;
case 1: case 1:
if (!_vm->_parser->_realWords[1].empty()) if (!_vm->_parser->_realWords[1].empty())
_vm->_parser->_realWords[1].clear(); _vm->_parser->_realWords[1].clear();
_vm->_lucerna->callVerb(Parser::kVerbCodeLoad); _vm->_avalot->callVerb(Parser::kVerbCodeLoad);
break; break;
case 2: case 2:
if (!_vm->_parser->_realWords[1].empty()) if (!_vm->_parser->_realWords[1].empty())
_vm->_parser->_realWords[1].clear(); _vm->_parser->_realWords[1].clear();
_vm->_lucerna->callVerb(Parser::kVerbCodeSave); _vm->_avalot->callVerb(Parser::kVerbCodeSave);
break; break;
case 3: case 3:
//_vm->_basher->filename_edit(); //_vm->_basher->filename_edit();
@ -574,7 +572,7 @@ void Menu::runMenuFile() {
//_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! //_vm->_enid->backToBootstrap(2); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then!
break; break;
case 5: case 5:
_vm->_lucerna->callVerb(Parser::kVerbCodeQuit); _vm->_avalot->callVerb(Parser::kVerbCodeQuit);
break; break;
} }
} }
@ -586,29 +584,29 @@ void Menu::runMenuAction() {
case 0: case 0:
_vm->_parser->_person = _vm->_parser->kPardon; _vm->_parser->_person = _vm->_parser->kPardon;
_vm->_parser->_thing = _vm->_parser->kPardon; _vm->_parser->_thing = _vm->_parser->kPardon;
f5Does = _vm->_gyro->f5Does(); f5Does = _vm->_avalot->f5Does();
_vm->_lucerna->callVerb(f5Does[0]); _vm->_avalot->callVerb(f5Does[0]);
break; break;
case 1: case 1:
_vm->_parser->_thing = _vm->_parser->kPardon; _vm->_parser->_thing = _vm->_parser->kPardon;
_vm->_lucerna->callVerb(Parser::kVerbCodePause); _vm->_avalot->callVerb(Parser::kVerbCodePause);
break; break;
case 2: case 2:
_vm->_lucerna->callVerb(Parser::kVerbCodeOpen); _vm->_avalot->callVerb(Parser::kVerbCodeOpen);
break; break;
case 3: case 3:
_vm->_parser->_thing = _vm->_parser->kPardon; _vm->_parser->_thing = _vm->_parser->kPardon;
_vm->_lucerna->callVerb(Parser::kVerbCodeLook); _vm->_avalot->callVerb(Parser::kVerbCodeLook);
break; break;
case 4: case 4:
_vm->_lucerna->callVerb(Parser::kVerbCodeInv); _vm->_avalot->callVerb(Parser::kVerbCodeInv);
break; break;
case 5: { case 5: {
AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *avvy = &_vm->_animation->_sprites[0];
if (avvy->_speedX == _vm->_gyro->kWalk) if (avvy->_speedX == _vm->_avalot->kWalk)
avvy->_speedX = _vm->_gyro->kRun; avvy->_speedX = _vm->_avalot->kRun;
else else
avvy->_speedX = _vm->_gyro->kWalk; avvy->_speedX = _vm->_avalot->kWalk;
_vm->_animation->updateSpeed(); _vm->_animation->updateSpeed();
} }
break; break;
@ -616,57 +614,57 @@ void Menu::runMenuAction() {
} }
void Menu::runMenuObjects() { void Menu::runMenuObjects() {
_vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum], Gyro::kThing); _vm->_avalot->thinkAbout(_vm->_avalot->_objectList[_activeMenuItem._choiceNum], Avalot::kThing);
} }
void Menu::runMenuPeople() { void Menu::runMenuPeople() {
_vm->_lucerna->thinkAbout(people[_activeMenuItem._choiceNum], Gyro::kPerson); _vm->_avalot->thinkAbout(people[_activeMenuItem._choiceNum], Avalot::kPerson);
_vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum]; _vm->_avalot->_lastPerson = people[_activeMenuItem._choiceNum];
} }
void Menu::runMenuWith() { void Menu::runMenuWith() {
_vm->_parser->_thing = _vm->_gyro->_thinks; _vm->_parser->_thing = _vm->_avalot->_thinks;
if (_vm->_gyro->_thinkThing) { if (_vm->_avalot->_thinkThing) {
_vm->_parser->_thing += 49; _vm->_parser->_thing += 49;
if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive)
_vm->_parser->_person = _vm->_gyro->_lastPerson; _vm->_parser->_person = _vm->_avalot->_lastPerson;
else else
_vm->_parser->_person = Parser::kPardon; _vm->_parser->_person = Parser::kPardon;
} else { } else {
switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) {
case 100: // Beer case 100: // Beer
_vm->_parser->_thing = 100; _vm->_parser->_thing = 100;
_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); _vm->_avalot->callVerb(Parser::kVerbCodeBuy);
return; return;
case 101: // Wine case 101: // Wine
_vm->_parser->_thing = 50; _vm->_parser->_thing = 50;
_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); _vm->_avalot->callVerb(Parser::kVerbCodeBuy);
return; return;
case 102: // Whisky case 102: // Whisky
_vm->_parser->_thing = 102; _vm->_parser->_thing = 102;
_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); _vm->_avalot->callVerb(Parser::kVerbCodeBuy);
return; return;
case 103: // Cider case 103: // Cider
_vm->_parser->_thing = 103; _vm->_parser->_thing = 103;
_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); _vm->_avalot->callVerb(Parser::kVerbCodeBuy);
return; return;
case 104: // Mead case 104: // Mead
_vm->_parser->_thing = 107; _vm->_parser->_thing = 107;
_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); _vm->_avalot->callVerb(Parser::kVerbCodeBuy);
return; return;
case 105: // Onion (trader) case 105: // Onion (trader)
_vm->_parser->_thing = 67; _vm->_parser->_thing = 67;
_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); _vm->_avalot->callVerb(Parser::kVerbCodeBuy);
return; return;
default: default:
_vm->_parser->_person = _vm->_parser->_thing; _vm->_parser->_person = _vm->_parser->_thing;
_vm->_parser->_thing = Parser::kPardon; _vm->_parser->_thing = Parser::kPardon;
_vm->_gyro->_subjectNum = 0; _vm->_avalot->_subjectNum = 0;
} }
} }
_vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); _vm->_avalot->callVerb(_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]);
} }
void Menu::setup() { void Menu::setup() {
@ -688,11 +686,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...
::Graphics::Surface backup; ::Graphics::Surface backup;
backup.copyFrom(_vm->_graphics->_surface); backup.copyFrom(_vm->_graphics->_surface);
while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_lucerna->_holdLeftMouse) { while (!_activeMenuItem._activeNow && (cursorPos.y <= 21) && _vm->_avalot->_holdLeftMouse) {
_menuBar.chooseMenuItem(cursorPos.x); _menuBar.chooseMenuItem(cursorPos.x);
do do
_vm->updateEvents(); _vm->updateEvents();
while (_vm->_lucerna->_holdLeftMouse); while (_vm->_avalot->_holdLeftMouse);
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
do { do {
@ -702,28 +700,28 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...
cursorPos = _vm->getMousePos(); cursorPos = _vm->getMousePos();
// Change arrow... // Change arrow...
if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) if ((0 <= cursorPos.y) && (cursorPos.y <= 21))
_vm->_gyro->newMouse(0); // Up arrow _vm->_avalot->newMouse(0); // Up arrow
else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) {
if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1)) if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1))
_vm->_gyro->newMouse(2); // Right-arrow _vm->_avalot->newMouse(2); // Right-arrow
else else
_vm->_gyro->newMouse(3); // Fletch _vm->_avalot->newMouse(3); // Fletch
} else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) } else if ((340 <= cursorPos.y) && (cursorPos.y <= 399))
_vm->_gyro->newMouse(1); // Screwdriver _vm->_avalot->newMouse(1); // Screwdriver
_activeMenuItem.lightUp(cursorPos); _activeMenuItem.lightUp(cursorPos);
_vm->_graphics->refreshScreen(); _vm->_graphics->refreshScreen();
} while (!_vm->_lucerna->_holdLeftMouse); } while (!_vm->_avalot->_holdLeftMouse);
if (_vm->_lucerna->_holdLeftMouse) { if (_vm->_avalot->_holdLeftMouse) {
if (cursorPos.y > 21) { if (cursorPos.y > 21) {
if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8)
&& (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) { && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) {
// Clicked OUTSIDE the menu. // Clicked OUTSIDE the menu.
if (_activeMenuItem._activeNow) { if (_activeMenuItem._activeNow) {
_activeMenuItem.wipe(); _activeMenuItem.wipe();
_vm->_lucerna->_holdLeftMouse = false; _vm->_avalot->_holdLeftMouse = false;
backup.free(); backup.free();
return; return;
} // No "else"- clicking on menu has no effect (only releasing). } // No "else"- clicking on menu has no effect (only releasing).
@ -737,11 +735,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...
if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels.
// If we clicked on the same menu item (the one that is already active) on the bar... // If we clicked on the same menu item (the one that is already active) on the bar...
_vm->_lucerna->_holdLeftMouse = false; _vm->_avalot->_holdLeftMouse = false;
backup.free(); backup.free();
return; return;
} else { } else {
_vm->_lucerna->_holdLeftMouse = true; _vm->_avalot->_holdLeftMouse = true;
break; break;
} }
} }
@ -758,7 +756,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...
_vm->_graphics->refreshScreen(); _vm->_graphics->refreshScreen();
_vm->updateEvents(); _vm->updateEvents();
if (!_vm->_lucerna->_holdLeftMouse) if (!_vm->_avalot->_holdLeftMouse)
break; break;
} }

View file

@ -9,8 +9,6 @@ MODULE_OBJS = \
console.o \ console.o \
detection.o \ detection.o \
graphics.o \ graphics.o \
gyro.o \
lucerna.o \
menu.o \ menu.o \
parser.o \ parser.o \
pingo.o \ pingo.o \

File diff suppressed because it is too large Load diff

View file

@ -30,8 +30,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/pingo.h" #include "avalanche/pingo.h"
#include "avalanche/gyro.h"
#include "avalanche/lucerna.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
#include "avalanche/dialogs.h" #include "avalanche/dialogs.h"
@ -78,7 +76,7 @@ void Pingo::zonk() {
void Pingo::winningPic() { void Pingo::winningPic() {
Common::File f; Common::File f;
_vm->_lucerna->dusk(); _vm->_avalot->dusk();
if (!f.open("finale.avd")) if (!f.open("finale.avd"))
error("AVALANCHE: Lucerna: File not found: finale.avd"); error("AVALANCHE: Lucerna: File not found: finale.avd");
@ -97,11 +95,11 @@ void Pingo::winningPic() {
warning("STUB: Pingo::winningPic()"); warning("STUB: Pingo::winningPic()");
_vm->_lucerna->dawn(); _vm->_avalot->dawn();
#if 0 #if 0
do { do {
_vm->_gyro->check(); _vm->_avalot->check();
} while (!(keypressed() || (mrelease > 0))); } while (!(keypressed() || (mrelease > 0)));
while (keypressed()) while (keypressed())
char r = readkey(); char r = readkey();

View file

@ -29,7 +29,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/sequence.h" #include "avalanche/sequence.h"
#include "avalanche/gyro.h"
#include "avalanche/timer.h" #include "avalanche/timer.h"
#include "avalanche/background.h" #include "avalanche/background.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
@ -61,8 +60,8 @@ void Sequence::thenShow(byte what) {
void Sequence::thenFlip(byte where, byte ped) { void Sequence::thenFlip(byte where, byte ped) {
thenShow(kNowFlip); thenShow(kNowFlip);
_vm->_gyro->_flipToWhere = where; _vm->_avalot->_flipToWhere = where;
_vm->_gyro->_flipToPed = ped; _vm->_avalot->_flipToPed = ped;
} }
void Sequence::startToClose() { void Sequence::startToClose() {
@ -71,7 +70,7 @@ void Sequence::startToClose() {
} }
void Sequence::startToOpen() { void Sequence::startToOpen() {
_vm->_gyro->_userMovesAvvy = false; // They can't move. _vm->_avalot->_userMovesAvvy = false; // They can't move.
_vm->_animation->stopWalking(); // And they're not moving now. _vm->_animation->stopWalking(); // And they're not moving now.
startToClose(); // Apart from that, it's the same thing. startToClose(); // Apart from that, it's the same thing.
} }
@ -90,8 +89,8 @@ void Sequence::callSequencer() {
return; // No more routines. return; // No more routines.
break; break;
case 177: // Flip room. case 177: // Flip room.
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
_vm->_animation->flipRoom(_vm->_gyro->_flipToWhere, _vm->_gyro->_flipToPed); _vm->_animation->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed);
if (curSeq == 177) if (curSeq == 177)
shoveLeft(); shoveLeft();
break; break;

View file

@ -29,7 +29,6 @@
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/timer.h" #include "avalanche/timer.h"
#include "avalanche/lucerna.h"
#include "avalanche/animation.h" #include "avalanche/animation.h"
#include "avalanche/dialogs.h" #include "avalanche/dialogs.h"
#include "avalanche/sequence.h" #include "avalanche/sequence.h"
@ -55,7 +54,7 @@ Timer::Timer(AvalancheEngine *vm) {
* @remarks Originally called 'set_up_timer' * @remarks Originally called 'set_up_timer'
*/ */
void Timer::addTimer(int32 duration, byte action, byte reason) { void Timer::addTimer(int32 duration, byte action, byte reason) {
if ((_vm->_gyro->_isLoaded == false) || (_timerLost == true)) { if ((_vm->_avalot->_isLoaded == false) || (_timerLost == true)) {
byte i = 0; byte i = 0;
while ((i < 7) && (_times[i]._timeLeft != 0)) while ((i < 7) && (_times[i]._timeLeft != 0))
i++; i++;
@ -68,7 +67,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) {
_times[i]._action = action; _times[i]._action = action;
_times[i]._reason = reason; _times[i]._reason = reason;
} else { } else {
_vm->_gyro->_isLoaded = false; _vm->_avalot->_isLoaded = false;
return; return;
} }
} }
@ -156,7 +155,7 @@ void Timer::updateTimer() {
crapulusSaysSpludOut(); crapulusSaysSpludOut();
break; break;
case kProcDawnDelay: case kProcDawnDelay:
_vm->_lucerna->dawn(); _vm->_avalot->dawn();
break; break;
case kProcBuyDrinks: case kProcBuyDrinks:
buyDrinks(); buyDrinks();
@ -215,8 +214,8 @@ void Timer::updateTimer() {
} }
} }
} }
_vm->_gyro->_roomTime++; // Cycles since you've been in this room. _vm->_avalot->_roomTime++; // Cycles since you've been in this room.
_vm->_gyro->_totalTime++; // Total amount of time for this game. _vm->_avalot->_totalTime++; // Total amount of time for this game.
} }
void Timer::loseTimer(byte which) { void Timer::loseTimer(byte which) {
@ -229,29 +228,29 @@ void Timer::loseTimer(byte which) {
} }
void Timer::openDrawbridge() { void Timer::openDrawbridge() {
_vm->_gyro->_drawbridgeOpen++; _vm->_avalot->_drawbridgeOpen++;
_vm->_background->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 2); _vm->_background->drawBackgroundSprite(-1, -1, _vm->_avalot->_drawbridgeOpen - 2);
if (_vm->_gyro->_drawbridgeOpen == 4) if (_vm->_avalot->_drawbridgeOpen == 4)
_vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. _vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge.
else else
addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls); addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls);
} }
void Timer::avariciusTalks() { void Timer::avariciusTalks() {
_vm->_dialogs->displayScrollChain('q', _vm->_gyro->_avariciusTalk); _vm->_dialogs->displayScrollChain('q', _vm->_avalot->_avariciusTalk);
_vm->_gyro->_avariciusTalk++; _vm->_avalot->_avariciusTalk++;
if (_vm->_gyro->_avariciusTalk < 17) if (_vm->_avalot->_avariciusTalk < 17)
addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks); addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks);
else else
_vm->_lucerna->incScore(3); _vm->_avalot->incScore(3);
} }
void Timer::urinate() { void Timer::urinate() {
_vm->_animation->_sprites[0].turn(Animation::kDirUp); _vm->_animation->_sprites[0].turn(Animation::kDirUp);
_vm->_animation->stopWalking(); _vm->_animation->stopWalking();
_vm->_lucerna->drawDirection(); _vm->_avalot->drawDirection();
addTimer(14, kProcToilet, kReasonGoToToilet); addTimer(14, kProcToilet, kReasonGoToToilet);
} }
@ -273,20 +272,20 @@ void Timer::stairs() {
_vm->_sound->blip(); _vm->_sound->blip();
_vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[0].walkTo(3);
_vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_gyro->_brummieStairs = 2; _vm->_avalot->_brummieStairs = 2;
_vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; _vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial;
_vm->_gyro->_magics[10]._data = 2; // Reached the bottom of the stairs. _vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs.
_vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // Stop them hitting the sides (or the game will hang.) _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // Stop them hitting the sides (or the game will hang.)
} }
void Timer::cardiffSurvey() { void Timer::cardiffSurvey() {
if (_vm->_gyro->_cardiffQuestionNum == 0) { if (_vm->_avalot->_cardiffQuestionNum == 0) {
_vm->_gyro->_cardiffQuestionNum++; _vm->_avalot->_cardiffQuestionNum++;
_vm->_dialogs->displayScrollChain('q', 27); _vm->_dialogs->displayScrollChain('q', 27);
} }
_vm->_dialogs->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); _vm->_dialogs->displayScrollChain('z', _vm->_avalot->_cardiffQuestionNum);
_vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; _vm->_avalot->_interrogation = _vm->_avalot->_cardiffQuestionNum;
addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey); addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey);
} }
@ -301,8 +300,8 @@ void Timer::cwytalotInHerts() {
void Timer::getTiedUp() { void Timer::getTiedUp() {
_vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! _vm->_dialogs->displayScrollChain('q', 34); // ...Trouble!
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
_vm->_gyro->_beenTiedUp = true; _vm->_avalot->_beenTiedUp = true;
_vm->_animation->stopWalking(); _vm->_animation->stopWalking();
AnimationType *spr = &_vm->_animation->_sprites[1]; AnimationType *spr = &_vm->_animation->_sprites[1];
@ -316,8 +315,8 @@ void Timer::getTiedUp() {
void Timer::getTiedUp2() { void Timer::getTiedUp2() {
_vm->_animation->_sprites[0].walkTo(3); _vm->_animation->_sprites[0].walkTo(3);
_vm->_animation->_sprites[1].walkTo(4); _vm->_animation->_sprites[1].walkTo(4);
_vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // No effect when you touch the boundaries. _vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // No effect when you touch the boundaries.
_vm->_gyro->_friarWillTieYouUp = true; _vm->_avalot->_friarWillTieYouUp = true;
} }
void Timer::hangAround() { void Timer::hangAround() {
@ -325,7 +324,7 @@ void Timer::hangAround() {
AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *avvy = &_vm->_animation->_sprites[0];
avvy->init(7, true, _vm->_animation); // Robin Hood avvy->init(7, true, _vm->_animation); // Robin Hood
_vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = kRoomRobins; _vm->_avalot->_whereIs[Avalot::kPeopleRobinHood - 150] = kRoomRobins;
_vm->_animation->appearPed(0, 1); _vm->_animation->appearPed(0, 1);
_vm->_dialogs->displayScrollChain('q', 39); _vm->_dialogs->displayScrollChain('q', 39);
avvy->walkTo(6); avvy->walkTo(6);
@ -337,7 +336,7 @@ void Timer::hangAround2() {
AnimationType *spr = &_vm->_animation->_sprites[1]; AnimationType *spr = &_vm->_animation->_sprites[1];
spr->_vanishIfStill = false; spr->_vanishIfStill = false;
spr->walkTo(3); spr->walkTo(3);
_vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomRobins; _vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomRobins;
_vm->_dialogs->displayScrollChain('q', 41); _vm->_dialogs->displayScrollChain('q', 41);
_vm->_animation->_sprites[0].remove(); _vm->_animation->_sprites[0].remove();
spr->remove(); // Get rid of Robin Hood and Friar Tuck. spr->remove(); // Get rid of Robin Hood and Friar Tuck.
@ -345,20 +344,20 @@ void Timer::hangAround2() {
addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); addTimer(1, kProcAfterTheShootemup, kReasonHangingAround);
// Immediately call the following proc (when you have a chance). // Immediately call the following proc (when you have a chance).
_vm->_gyro->_tiedUp = false; _vm->_avalot->_tiedUp = false;
// _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! // _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then!
} }
void Timer::afterTheShootemup() { void Timer::afterTheShootemup() {
// Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented!
_vm->_animation->flipRoom(_vm->_gyro->_room, 1); _vm->_animation->flipRoom(_vm->_avalot->_room, 1);
_vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. _vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot.
_vm->_animation->appearPed(0, 1); _vm->_animation->appearPed(0, 1);
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
_vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = true; _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = true;
_vm->_lucerna->refreshObjectList(); _vm->_avalot->refreshObjectList();
// Same as the added line above: TODO: Remove it later!!! // Same as the added line above: TODO: Remove it later!!!
_vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.") _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", but I haven't implemented it yet: you get the crossbow automatically.")
@ -386,9 +385,9 @@ void Timer::afterTheShootemup() {
} }
void Timer::jacquesWakesUp() { void Timer::jacquesWakesUp() {
_vm->_gyro->_jacquesState++; _vm->_avalot->_jacquesState++;
switch (_vm->_gyro->_jacquesState) { // Additional pictures. switch (_vm->_avalot->_jacquesState) { // Additional pictures.
case 1 : case 1 :
_vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open. _vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open.
_vm->_dialogs->displayScrollChain('Q', 45); _vm->_dialogs->displayScrollChain('Q', 45);
@ -396,22 +395,22 @@ void Timer::jacquesWakesUp() {
case 2 : // Going through the door. case 2 : // Going through the door.
_vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor.
_vm->_background->drawBackgroundSprite(-1, -1, 2); // But going through the door. _vm->_background->drawBackgroundSprite(-1, -1, 2); // But going through the door.
_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // You can't wake him up now. _vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // You can't wake him up now.
break; break;
case 3 : // Gone through the door. case 3 : // Gone through the door.
_vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either. _vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either.
_vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open. _vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open.
_vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; // Gone! _vm->_avalot->_whereIs[Avalot::kPeopleJacques - 150] = 0; // Gone!
break; break;
} }
if (_vm->_gyro->_jacquesState == 5) { if (_vm->_avalot->_jacquesState == 5) {
_vm->_gyro->_bellsAreRinging = true; _vm->_avalot->_bellsAreRinging = true;
_vm->_gyro->_aylesIsAwake = true; _vm->_avalot->_aylesIsAwake = true;
_vm->_lucerna->incScore(2); _vm->_avalot->incScore(2);
} }
switch (_vm->_gyro->_jacquesState) { switch (_vm->_avalot->_jacquesState) {
case 1: case 1:
case 2: case 2:
case 3: case 3:
@ -454,8 +453,8 @@ void Timer::naughtyDuke3() {
void Timer::jump() { void Timer::jump() {
AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *avvy = &_vm->_animation->_sprites[0];
_vm->_gyro->_jumpStatus++; _vm->_avalot->_jumpStatus++;
switch (_vm->_gyro->_jumpStatus) { switch (_vm->_avalot->_jumpStatus) {
case 1: case 1:
case 2: case 2:
case 3: case 3:
@ -474,73 +473,73 @@ void Timer::jump() {
break; break;
} }
if (_vm->_gyro->_jumpStatus == 20) { // End of jump. if (_vm->_avalot->_jumpStatus == 20) { // End of jump.
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
_vm->_gyro->_jumpStatus = 0; _vm->_avalot->_jumpStatus = 0;
} else // Still jumping. } else // Still jumping.
addTimer(1, kProcJump, kReasonJumping); addTimer(1, kProcJump, kReasonJumping);
if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. if ((_vm->_avalot->_jumpStatus == 10) // You're at the highest point of your jump.
&& (_vm->_gyro->_room == kRoomInsideCardiffCastle) && (_vm->_avalot->_room == kRoomInsideCardiffCastle)
&& (_vm->_gyro->_arrowInTheDoor == true) && (_vm->_avalot->_arrowInTheDoor == true)
&& (_vm->_animation->inField(2))) { // Beside the wall && (_vm->_animation->inField(2))) { // Beside the wall
// Grab the arrow! // Grab the arrow!
if (_vm->_gyro->_carryNum >= kCarryLimit) if (_vm->_avalot->_carryNum >= kCarryLimit)
_vm->_dialogs->displayText("You fail to grab it, because your hands are full."); _vm->_dialogs->displayText("You fail to grab it, because your hands are full.");
else { else {
_vm->_background->drawBackgroundSprite(-1, -1, 1); _vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_gyro->_arrowInTheDoor = false; // You've got it. _vm->_avalot->_arrowInTheDoor = false; // You've got it.
_vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; _vm->_avalot->_objects[Avalot::kObjectBolt - 1] = true;
_vm->_lucerna->refreshObjectList(); _vm->_avalot->refreshObjectList();
_vm->_dialogs->displayScrollChain('q', 50); _vm->_dialogs->displayScrollChain('q', 50);
_vm->_lucerna->incScore(3); _vm->_avalot->incScore(3);
} }
} }
} }
void Timer::crapulusSaysSpludOut() { void Timer::crapulusSaysSpludOut() {
_vm->_dialogs->displayScrollChain('q', 56); _vm->_dialogs->displayScrollChain('q', 56);
_vm->_gyro->_crapulusWillTell = false; _vm->_avalot->_crapulusWillTell = false;
} }
void Timer::buyDrinks() { void Timer::buyDrinks() {
_vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again.
_vm->_gyro->_malagauche = 0; _vm->_avalot->_malagauche = 0;
_vm->_dialogs->displayScrollChain('D', _vm->_gyro->_drinking); // Display message about it. _vm->_dialogs->displayScrollChain('D', _vm->_avalot->_drinking); // Display message about it.
_vm->_pingo->wobble(); // Do the special effects. _vm->_pingo->wobble(); // Do the special effects.
_vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence. _vm->_dialogs->displayScrollChain('D', 1); // That'll be thruppence.
if (_vm->_gyro->decreaseMoney(3)) // Pay 3d. if (_vm->_avalot->decreaseMoney(3)) // Pay 3d.
_vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up. _vm->_dialogs->displayScrollChain('D', 3); // Tell 'em you paid up.
_vm->_parser->drink(); _vm->_parser->drink();
} }
void Timer::buyWine() { void Timer::buyWine() {
_vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again. _vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again.
_vm->_gyro->_malagauche = 0; _vm->_avalot->_malagauche = 0;
_vm->_dialogs->displayScrollChain('D', 50); // You buy the wine. _vm->_dialogs->displayScrollChain('D', 50); // You buy the wine.
_vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence. _vm->_dialogs->displayScrollChain('D', 1); // It'll be thruppence.
if (_vm->_gyro->decreaseMoney(3)) { if (_vm->_avalot->decreaseMoney(3)) {
_vm->_dialogs->displayScrollChain('D', 4); // You paid up. _vm->_dialogs->displayScrollChain('D', 4); // You paid up.
_vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; _vm->_avalot->_objects[Avalot::kObjectWine - 1] = true;
_vm->_lucerna->refreshObjectList(); _vm->_avalot->refreshObjectList();
_vm->_gyro->_wineState = 1; // OK Wine. _vm->_avalot->_wineState = 1; // OK Wine.
} }
} }
void Timer::callsGuards() { void Timer::callsGuards() {
_vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" _vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!"
_vm->_lucerna->gameOver(); _vm->_avalot->gameOver();
} }
void Timer::greetsMonk() { void Timer::greetsMonk() {
_vm->_dialogs->displayScrollChain('Q', 59); _vm->_dialogs->displayScrollChain('Q', 59);
_vm->_gyro->_enteredLustiesRoomAsMonk = true; _vm->_avalot->_enteredLustiesRoomAsMonk = true;
} }
void Timer::fallDownOubliette() { void Timer::fallDownOubliette() {
_vm->_gyro->_magics[8]._operation = Gyro::kMagicNothing; _vm->_avalot->_magics[8]._operation = Avalot::kMagicNothing;
AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *avvy = &_vm->_animation->_sprites[0];
avvy->_moveY++; // Increments dx/dy! avvy->_moveY++; // Increments dx/dy!
@ -549,13 +548,13 @@ void Timer::fallDownOubliette() {
} }
void Timer::meetAvaroid() { void Timer::meetAvaroid() {
if (_vm->_gyro->_metAvaroid) { if (_vm->_avalot->_metAvaroid) {
Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman); Common::String tmpStr = Common::String::format("You can't expect to be %cthat%c lucky twice in a row!", Dialogs::kControlItalic, Dialogs::kControlRoman);
_vm->_dialogs->displayText(tmpStr); _vm->_dialogs->displayText(tmpStr);
_vm->_lucerna->gameOver(); _vm->_avalot->gameOver();
} else { } else {
_vm->_dialogs->displayScrollChain('Q', 60); _vm->_dialogs->displayScrollChain('Q', 60);
_vm->_gyro->_metAvaroid = true; _vm->_avalot->_metAvaroid = true;
addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette);
AnimationType *avvy = &_vm->_animation->_sprites[0]; AnimationType *avvy = &_vm->_animation->_sprites[0];
@ -564,7 +563,7 @@ void Timer::meetAvaroid() {
avvy->_moveX = -3; avvy->_moveX = -3;
avvy->_moveY = -5; avvy->_moveY = -5;
_vm->_gyro->setBackgroundColor(2); _vm->_avalot->setBackgroundColor(2);
} }
} }
@ -576,7 +575,7 @@ void Timer::riseUpOubliette() {
if (avvy->_moveY > 0) if (avvy->_moveY > 0)
addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette);
else else
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
} }
void Timer::robinHoodAndGeida() { void Timer::robinHoodAndGeida() {
@ -589,7 +588,7 @@ void Timer::robinHoodAndGeida() {
spr->stopWalk(); spr->stopWalk();
spr->_facingDir = Animation::kDirLeft; spr->_facingDir = Animation::kDirLeft;
addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida);
_vm->_gyro->_geidaFollows = false; _vm->_avalot->_geidaFollows = false;
} }
void Timer::robinHoodAndGeidaTalk() { void Timer::robinHoodAndGeidaTalk() {
@ -613,7 +612,7 @@ void Timer::avalotReturns() {
avvy->init(0, true, _vm->_animation); avvy->init(0, true, _vm->_animation);
_vm->_animation->appearPed(0, 0); _vm->_animation->appearPed(0, 0);
_vm->_dialogs->displayScrollChain('q', 67); _vm->_dialogs->displayScrollChain('q', 67);
_vm->_gyro->_userMovesAvvy = true; _vm->_avalot->_userMovesAvvy = true;
} }
/** /**
@ -627,8 +626,8 @@ void Timer::avvySitDown() {
addTimer(1, kProcAvvySitDown, kReasonSittingDown); addTimer(1, kProcAvvySitDown, kReasonSittingDown);
else { else {
_vm->_background->drawBackgroundSprite(-1, -1, 2); _vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_gyro->_sittingInPub = true; _vm->_avalot->_sittingInPub = true;
_vm->_gyro->_userMovesAvvy = false; _vm->_avalot->_userMovesAvvy = false;
avvy->_visible = false; avvy->_visible = false;
} }
} }
@ -640,7 +639,7 @@ void Timer::ghostRoomPhew() {
} }
void Timer::arkataShouts() { void Timer::arkataShouts() {
if (_vm->_gyro->_teetotal) if (_vm->_avalot->_teetotal)
return; return;
_vm->_dialogs->displayScrollChain('q', 76); _vm->_dialogs->displayScrollChain('q', 76);
@ -654,14 +653,14 @@ void Timer::winning() {
warning("STUB: Timer::winning()"); warning("STUB: Timer::winning()");
#if 0 #if 0
do { do {
_vm->_lucerna->checkclick(); _vm->_avalot->checkclick();
} while (!(_vm->_gyro->mrelease == 0)); } while (!(_vm->_avalot->mrelease == 0));
#endif #endif
// TODO: To be implemented with Pingo::winningPic(). // TODO: To be implemented with Pingo::winningPic().
_vm->_lucerna->callVerb(Parser::kVerbCodeScore); _vm->_avalot->callVerb(Parser::kVerbCodeScore);
_vm->_dialogs->displayText(" T H E E N D "); _vm->_dialogs->displayText(" T H E E N D ");
_vm->_gyro->_letMeOut = true; _vm->_avalot->_letMeOut = true;
} }
void Timer::avalotFalls() { void Timer::avalotFalls() {
@ -693,8 +692,8 @@ void Timer::spludwickLeavesCauldron() {
void Timer::giveLuteToGeida() { // Moved here from Acci. void Timer::giveLuteToGeida() { // Moved here from Acci.
_vm->_dialogs->displayScrollChain('Q', 86); _vm->_dialogs->displayScrollChain('Q', 86);
_vm->_lucerna->incScore(4); _vm->_avalot->incScore(4);
_vm->_gyro->_lustieIsAsleep = true; _vm->_avalot->_lustieIsAsleep = true;
_vm->_sequence->firstShow(5); _vm->_sequence->firstShow(5);
_vm->_sequence->thenShow(6); // He falls asleep... _vm->_sequence->thenShow(6); // He falls asleep...
_vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure. _vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure.