diff options
| author | Strangerke | 2013-09-21 22:26:36 +0200 | 
|---|---|---|
| committer | Strangerke | 2013-09-21 22:28:48 +0200 | 
| commit | 4b4f07a7f6e8643080de8048d94e7d22bc7f3753 (patch) | |
| tree | 49a3150f9069f61192398717af7845baa02d65d2 | |
| parent | 89471e76d1177f2cbe5f2b638fe69559de85b84f (diff) | |
| download | scummvm-rg350-4b4f07a7f6e8643080de8048d94e7d22bc7f3753.tar.gz scummvm-rg350-4b4f07a7f6e8643080de8048d94e7d22bc7f3753.tar.bz2 scummvm-rg350-4b4f07a7f6e8643080de8048d94e7d22bc7f3753.zip  | |
AVALANCHE: Merge Gyro, Lucerna and Avalot
| -rw-r--r-- | engines/avalanche/animation.cpp | 418 | ||||
| -rw-r--r-- | engines/avalanche/avalanche.cpp | 224 | ||||
| -rw-r--r-- | engines/avalanche/avalanche.h | 4 | ||||
| -rw-r--r-- | engines/avalanche/avalot.cpp | 1774 | ||||
| -rw-r--r-- | engines/avalanche/avalot.h | 392 | ||||
| -rw-r--r-- | engines/avalanche/background.cpp | 96 | ||||
| -rw-r--r-- | engines/avalanche/closing.cpp | 2 | ||||
| -rw-r--r-- | engines/avalanche/dialogs.cpp | 374 | ||||
| -rw-r--r-- | engines/avalanche/gyro.cpp | 599 | ||||
| -rw-r--r-- | engines/avalanche/gyro.h | 367 | ||||
| -rw-r--r-- | engines/avalanche/lucerna.cpp | 1224 | ||||
| -rw-r--r-- | engines/avalanche/lucerna.h | 124 | ||||
| -rw-r--r-- | engines/avalanche/menu.cpp | 210 | ||||
| -rw-r--r-- | engines/avalanche/module.mk | 2 | ||||
| -rw-r--r-- | engines/avalanche/parser.cpp | 706 | ||||
| -rw-r--r-- | engines/avalanche/pingo.cpp | 8 | ||||
| -rw-r--r-- | engines/avalanche/sequence.cpp | 11 | ||||
| -rw-r--r-- | engines/avalanche/timer.cpp | 167 | 
18 files changed, 3236 insertions, 3466 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index d274591fde..0593b046af 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -30,8 +30,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/animation.h"  #include "avalanche/dialogs.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h"  #include "avalanche/background.h"  #include "avalanche/sequence.h"  #include "avalanche/timer.h" @@ -149,8 +147,8 @@ void AnimationType::turn(byte whichway) {  void AnimationType::appear(int16 wx, int16 wy, byte wf) {  	_x = (wx / 8) * 8;  	_y = wy; -	_oldX[_anim->_vm->_gyro->_cp] = wx; -	_oldY[_anim->_vm->_gyro->_cp] = wy; +	_oldX[_anim->_vm->_avalot->_cp] = wx; +	_oldY[_anim->_vm->_avalot->_cp] = wy;  	turn(wf);  	_visible = true;  	_moveX = 0; @@ -182,9 +180,9 @@ void AnimationType::walk() {  		r._y2 = _y + _info._yLength + 2;  	} -	if (!_anim->_vm->_gyro->_doingSpriteRun) { -		_oldX[_anim->_vm->_gyro->_cp] = _x; -		_oldY[_anim->_vm->_gyro->_cp] = _y; +	if (!_anim->_vm->_avalot->_doingSpriteRun) { +		_oldX[_anim->_vm->_avalot->_cp] = _x; +		_oldY[_anim->_vm->_avalot->_cp] = _y;  		if (_homing)  			homeStep();  		_x += _moveX; @@ -197,40 +195,40 @@ void AnimationType::walk() {  			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 . -		if ((magicColor != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { -			MagicType *magic = &_anim->_vm->_gyro->_magics[magicColor]; +		if ((magicColor != 255) & (!_anim->_vm->_avalot->_doingSpriteRun)) { +			MagicType *magic = &_anim->_vm->_avalot->_magics[magicColor];  			switch (magic->_operation) { -			case Gyro::kMagicExclaim: +			case Avalot::kMagicExclaim:  				bounce();  				_anim->_mustExclaim = true;  				_anim->_sayWhat = magic->_data;  				break; -			case Gyro::kMagicBounce: +			case Avalot::kMagicBounce:  				bounce();  				break; -			case Gyro::kMagicTransport: +			case Avalot::kMagicTransport:  				_anim->flipRoom(magic->_data >> 8, magic->_data & 0xff);  				break; -			case Gyro::kMagicUnfinished: { +			case Avalot::kMagicUnfinished: {  				bounce();  				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);  				}  				break; -			case Gyro::kMagicSpecial: +			case Avalot::kMagicSpecial:  				_anim->callSpecial(magic->_data);  				break; -			case Gyro::kMagicOpenDoor: +			case Avalot::kMagicOpenDoor:  				_anim->openDoor(magic->_data >> 8, magic->_data & 0xff, magicColor);  				break;  			}  		}  	} -	if (!_anim->_vm->_gyro->_doingSpriteRun) { +	if (!_anim->_vm->_avalot->_doingSpriteRun) {  		_count++;  		if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) {  			_stepNum++; @@ -242,13 +240,13 @@ void AnimationType::walk() {  }  void AnimationType::bounce() { -	_x = _oldX[_anim->_vm->_gyro->_cp]; -	_y = _oldY[_anim->_vm->_gyro->_cp]; +	_x = _oldX[_anim->_vm->_avalot->_cp]; +	_y = _oldY[_anim->_vm->_avalot->_cp];  	if (_doCheck)  		_anim->stopWalking();  	else  		stopWalk(); -	_anim->_vm->_lucerna->drawDirection(); +	_anim->_vm->_avalot->drawDirection();  }  int8 AnimationType::getSign(int16 val) { @@ -261,7 +259,7 @@ int8 AnimationType::getSign(int16 val) {  }  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));  	_homingX = curPed->_x - _info._xLength / 2; @@ -329,10 +327,10 @@ void AnimationType::stopWalk() {  }  void AnimationType::chatter() { -	_anim->_vm->_gyro->_talkX = _x + _info._xLength / 2; -	_anim->_vm->_gyro->_talkY = _y; -	_anim->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; -	_anim->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; +	_anim->_vm->_avalot->_talkX = _x + _info._xLength / 2; +	_anim->_vm->_avalot->_talkY = _y; +	_anim->_vm->_avalot->_talkFontColor = _stat._fgBubbleCol; +	_anim->_vm->_avalot->_talkBackgroundColor = _stat._bgBubbleCol;  }  void AnimationType::remove() { @@ -370,7 +368,7 @@ void Animation::loadAnims() {  }  byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { -	if (!_vm->_gyro->_alive) +	if (!_vm->_avalot->_alive)  		return 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  	// catacombs has a different number for it. -	xy_uint16 = _vm->_gyro->_catacombX + _vm->_gyro->_catacombY * 256; -	_vm->_gyro->_geidaSpin = 0; +	xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256; +	_vm->_avalot->_geidaSpin = 0;  	switch (xy_uint16) {  	case 1801: // Exit catacombs @@ -435,78 +433,78 @@ void Animation::catacombMove(byte ped) {  	case 2307:  		flipRoom(kRoomLusties, 5);  		_vm->_dialogs->displayText("Oh no... here we go again..."); -		_vm->_gyro->_userMovesAvvy = false; +		_vm->_avalot->_userMovesAvvy = false;  		_sprites[0]._moveY = 1;  		_sprites[0]._moveX = 0;  		return;  	} -	if (!_vm->_gyro->_enterCatacombsFromLustiesRoom) -		_vm->_lucerna->loadRoom(29); -	here = _vm->_gyro->kCatacombMap[_vm->_gyro->_catacombY - 1][_vm->_gyro->_catacombX - 1]; +	if (!_vm->_avalot->_enterCatacombsFromLustiesRoom) +		_vm->_avalot->loadRoom(29); +	here = _vm->_avalot->kCatacombMap[_vm->_avalot->_catacombY - 1][_vm->_avalot->_catacombX - 1];  	switch (here & 0xf) { // West.  	case 0: // no connection (wall) -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27);  		break;  	case 0x1: // no connection (wall + shield), -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield.  		break;  	case 0x2: // wall with door -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door.  		break;  	case 0x3: // wall with door and shield -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...  		_vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield.  		break;  	case 0x4: // no connection (wall + window), -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 4);  // ...window.  		break;  	case 0x5: // wall with door and window -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...  		_vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window.  		break;  	case 0x6: // no connection (wall + torches), -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicNothing; // No door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches.  		break;  	case 0x7: // wall with door and torches -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[4]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...  		_vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches.  		break;  	case 0xf: // straight-through corridor. -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // Sloping wall. -		_vm->_gyro->_magics[2]._operation = Gyro::kMagicSpecial; // Straight wall. +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall. +		_vm->_avalot->_magics[2]._operation = Avalot::kMagicSpecial; // Straight wall.  		break;  	} @@ -514,127 +512,127 @@ void Animation::catacombMove(byte ped) {  	switch ((here & 0xf0) >> 4) { // East  	case 0: // no connection (wall) -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 18);  		break;  	case 0x1: // no connection (wall + window), -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window.  		break;  	case 0x2: // wall with door -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door.  		break;  	case 0x3: // wall with door and window -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and...  		_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window.  		break;  	case 0x6: // no connection (wall + torches), -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // No door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door.  		_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches.  		break;  	case 0x7: // wall with door and torches -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicNothing; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...  		_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and...  		_vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches.  		break;  	case 0xf: // straight-through corridor. -		_vm->_gyro->_magics[4]._operation = Gyro::kMagicNothing; // Sloping wall. -		_vm->_gyro->_magics[5]._operation = Gyro::kMagicSpecial; // Straight wall. -		_vm->_gyro->_portals[6]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall. +		_vm->_avalot->_magics[5]._operation = Avalot::kMagicSpecial; // Straight wall. +		_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.  		break;  	}  	switch ((here & 0xf00) >> 8) { // South  	case 0: // No connection. -		_vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; +		_vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;  		break;  	case 0x1:  		_vm->_background->drawBackgroundSprite(-1, -1, 21); -		if ((xy_uint16 == 2051) && (_vm->_gyro->_geidaFollows)) -			_vm->_gyro->_magics[12]._operation = Gyro::kMagicExclaim; +		if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows)) +			_vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim;  		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->_gyro->_magics[11]._operation = Gyro::kMagicBounce; +		_vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce;  		break;  	case 0x2:  		_vm->_background->drawBackgroundSprite(-1, -1, 22); -		_vm->_gyro->_magics[6]._operation = Gyro::kMagicSpecial; // Middle exit south. -		_vm->_gyro->_magics[11]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; +		_vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south. +		_vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;  		break;  	case 0x3:  		_vm->_background->drawBackgroundSprite(-1, -1, 23); -		_vm->_gyro->_magics[11]._operation = Gyro::kMagicSpecial; // Left exit south. -		_vm->_gyro->_magics[6]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_magics[12]._operation = Gyro::kMagicBounce; +		_vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south. +		_vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;  		break;  	}  	switch ((here & 0xf000) >> 12) { // North  	case 0: // No connection -		_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.  		break;  	// LEFT handles:  #if 0  	case 0x1:  		_vm->_celer->show_one(-1, -1, 4); -		_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } -		_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } +		_vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } +		_vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }  		break;  #endif  	case 0x2:  		_vm->_background->drawBackgroundSprite(-1, -1, 3); -		_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. -		_vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.  		break;  #if 0  	case 0x3:  		_vm->_celer->show_one(-1, -1, 4); -		_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } -		_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } +		_vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } { Change magic number! } +		_vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }  		break;  	// RIGHT handles:  	case 0x4:  		_vm->_celer->show_one(-1, -1, 3); -		_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } -		_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } +		_vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Left exit north. } { Change magic number! } +		_vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }  		break;  #endif  	case 0x5:  		_vm->_background->drawBackgroundSprite(-1, -1, 2); -		_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; // Middle exit north. -		_vm->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north. +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.  		break;  #if 0  	case 0x6:  		_vm->_celer->show_one(-1, -1, 3); -		_vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } -		_vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } +		_vm->_avalot->magics[1].op = _vm->_avalot->bounces; // { Right exit north. } +		_vm->_avalot->portals[12].op = _vm->_avalot->special; // { Door. }  		break;  #endif  	// ARCHWAYS: @@ -648,25 +646,25 @@ void Animation::catacombMove(byte ped) {  		if (((here & 0xf000) >> 12) == 0x9)  			_vm->_background->drawBackgroundSprite(-1, -1, 31); -		_vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. -		_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north. +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.  		break;  	// DECORATIONS:  	case 0xd: // No connection + WINDOW -		_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 13);  		break;  	case 0xe: // No connection + TORCH -		_vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; -		_vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. +		_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.  		_vm->_background->drawBackgroundSprite(-1, -1, 7);  		break;  	// Recessed door:  	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->_gyro->_portals[3]._operation = Gyro::kMagicSpecial; // Door. +		_vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.  		break;  	} @@ -702,7 +700,7 @@ void Animation::catacombMove(byte ped) {  		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...  			_sprites[1].init(5, true, this); // ...Load Geida.  		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() {  	_vm->_timer->addTimer(2, Timer::kProcDawnDelay, Timer::kReasonDawndelay);  }  void Animation::callSpecial(uint16 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->_gyro->_brummieStairs = 1; -		_vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; +		_vm->_avalot->_brummieStairs = 1; +		_vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing;  		_vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs);  		stopWalking(); -		_vm->_gyro->_userMovesAvvy = false; +		_vm->_avalot->_userMovesAvvy = false;  		break; -	case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. -		_vm->_gyro->_brummieStairs = 3; -		_vm->_gyro->_magics[10]._operation = Gyro::kMagicNothing; -		_vm->_gyro->_magics[11]._operation = Gyro::kMagicExclaim; -		_vm->_gyro->_magics[11]._data = 5; -		_vm->_gyro->_magics[3]._operation = Gyro::kMagicBounce; // Now works as planned! +	case 2: // _vm->_avalot->special 2: Room 22: bottom of stairs. +		_vm->_avalot->_brummieStairs = 3; +		_vm->_avalot->_magics[10]._operation = Avalot::kMagicNothing; +		_vm->_avalot->_magics[11]._operation = Avalot::kMagicExclaim; +		_vm->_avalot->_magics[11]._data = 5; +		_vm->_avalot->_magics[3]._operation = Avalot::kMagicBounce; // Now works as planned!  		stopWalking();  		_vm->_dialogs->displayScrollChain('q', 26); -		_vm->_gyro->_userMovesAvvy = true; +		_vm->_avalot->_userMovesAvvy = true;  		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. -		if (!_vm->_gyro->_arrowTriggered) { -			_vm->_gyro->_arrowTriggered = true; +		if (!_vm->_avalot->_arrowTriggered) { +			_vm->_avalot->_arrowTriggered = true;  			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]._facingDir = kDirUp; // Only face. @@ -754,80 +752,80 @@ void Animation::callSpecial(uint16 which) {  		}  		break;  	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  		_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!  		break;  	case 5: -		if (_vm->_gyro->_friarWillTieYouUp) { -			// _vm->_gyro->special 5: Room 42: touched tree, and get tied up. -			_vm->_gyro->_magics[4]._operation = Gyro::kMagicBounce; // Boundary effect is now working again. +		if (_vm->_avalot->_friarWillTieYouUp) { +			// _vm->_avalot->special 5: Room 42: touched tree, and get tied up. +			_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Boundary effect is now working again.  			_vm->_dialogs->displayScrollChain('q', 35);  			_sprites[0].remove();  			//tr[1].vanishifstill:=true;  			_vm->_background->drawBackgroundSprite(-1, -1, 1);  			_vm->_dialogs->displayScrollChain('q', 36); -			_vm->_gyro->_tiedUp = true; -			_vm->_gyro->_friarWillTieYouUp = false; +			_vm->_avalot->_tiedUp = true; +			_vm->_avalot->_friarWillTieYouUp = false;  			_sprites[1].walkTo(2);  			_sprites[1]._vanishIfStill = true;  			_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);  		}  		break; -	case 6: // _vm->_gyro->special 6: fall down oubliette. -		_vm->_gyro->_userMovesAvvy = false; +	case 6: // _vm->_avalot->special 6: fall down oubliette. +		_vm->_avalot->_userMovesAvvy = false;  		_sprites[0]._moveX = 3;  		_sprites[0]._moveY = 0;  		_sprites[0]._facingDir = kDirRight;  		_vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette);  		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; -		_vm->_gyro->_magics[9]._operation = Gyro::kMagicNothing; +		_vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing;  		stopWalking();  		_vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); -		//_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); -		//_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); +		//_vm->_avalot->mblit(12, 80, 38, 160, 3, 0); +		//_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->_timer->addTimer(200, Timer::kProcMeetAvaroid, Timer::kReasonMeetingAvaroid);  		break; -	case 8:        // _vm->_gyro->special 8: leave du Lustie's room. -		if ((_vm->_gyro->_geidaFollows) && (!_vm->_gyro->_lustieIsAsleep)) { +	case 8:        // _vm->_avalot->special 8: leave du Lustie's room. +		if ((_vm->_avalot->_geidaFollows) && (!_vm->_avalot->_lustieIsAsleep)) {  			_vm->_dialogs->displayScrollChain('q', 63);  			_sprites[1].turn(kDirDown);  			_sprites[1].stopWalk();  			_sprites[1]._callEachStepFl = false; // Geida -			_vm->_lucerna->gameOver(); +			_vm->_avalot->gameOver();  		}  		break; -	case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... -		if (!_vm->_gyro->_geidaFollows) +	case 9: // _vm->_avalot->special 9: lose Geida to Robin Hood... +		if (!_vm->_avalot->_geidaFollows)  			return;   // DOESN'T COUNT: no Geida.  		_sprites[1]._callEachStepFl = false; // She no longer follows Avvy around.  		_sprites[1].walkTo(3); // She walks to somewhere...  		_sprites[0].remove();     // Lose Avvy. -		_vm->_gyro->_userMovesAvvy = false; +		_vm->_avalot->_userMovesAvvy = false;  		_vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida);  		break; -	case 10: // _vm->_gyro->special 10: transfer north in catacombs. -		if ((_vm->_gyro->_catacombX == 4) && (_vm->_gyro->_catacombY == 1)) { +	case 10: // _vm->_avalot->special 10: transfer north in catacombs. +		if ((_vm->_avalot->_catacombX == 4) && (_vm->_avalot->_catacombY == 1)) {  			// Into Geida's room. -			if (_vm->_gyro->_objects[Gyro::kObjectKey - 1]) +			if (_vm->_avalot->_objects[Avalot::kObjectKey - 1])  				_vm->_dialogs->displayScrollChain('q', 62);  			else {  				_vm->_dialogs->displayScrollChain('q', 61);  				return;  			}  		} -		_vm->_lucerna->dusk(); -		_vm->_gyro->_catacombY--; +		_vm->_avalot->dusk(); +		_vm->_avalot->_catacombY--;  		catacombMove(4); -		if (_vm->_gyro->_room != kRoomCatacombs) +		if (_vm->_avalot->_room != kRoomCatacombs)  			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:  			appearPed(0, 11);  			break; @@ -839,29 +837,29 @@ void Animation::callSpecial(uint16 which) {  		}  		dawnDelay();  		break; -	case 11: // _vm->_gyro->special 11: transfer east in catacombs. -		_vm->_lucerna->dusk(); -		_vm->_gyro->_catacombX++; +	case 11: // _vm->_avalot->special 11: transfer east in catacombs. +		_vm->_avalot->dusk(); +		_vm->_avalot->_catacombX++;  		catacombMove(1); -		if (_vm->_gyro->_room != kRoomCatacombs) +		if (_vm->_avalot->_room != kRoomCatacombs)  			return;  		appearPed(0, 0);  		dawnDelay();  		break; -	case 12: // _vm->_gyro->special 12: transfer south in catacombs. -		_vm->_lucerna->dusk(); -		_vm->_gyro->_catacombY += 1; +	case 12: // _vm->_avalot->special 12: transfer south in catacombs. +		_vm->_avalot->dusk(); +		_vm->_avalot->_catacombY += 1;  		catacombMove(2); -		if (_vm->_gyro->_room != kRoomCatacombs) +		if (_vm->_avalot->_room != kRoomCatacombs)  			return;  		appearPed(0, 1);  		dawnDelay();  		break; -	case 13: // _vm->_gyro->special 13: transfer west in catacombs. -		_vm->_lucerna->dusk(); -		_vm->_gyro->_catacombX--; +	case 13: // _vm->_avalot->special 13: transfer west in catacombs. +		_vm->_avalot->dusk(); +		_vm->_avalot->_catacombX--;  		catacombMove(3); -		if (_vm->_gyro->_room != kRoomCatacombs) +		if (_vm->_avalot->_room != kRoomCatacombs)  			return;  		appearPed(0, 2);  		dawnDelay(); @@ -877,7 +875,7 @@ void Animation::callSpecial(uint16 which) {   * @remarks	Originally called 'open_the_door'   */  void Animation::openDoor(byte whither, byte ped, byte magicnum) { -	switch (_vm->_gyro->_room) { +	switch (_vm->_avalot->_room) {  	case kRoomOutsideYours:  	case kRoomOutsideNottsPub:  	case kRoomOutsideDucks: @@ -904,7 +902,7 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) {  	case kRoomLusties:  		switch (magicnum) {  		case 14: -			if (_vm->_gyro->_avvysInTheCupboard) { +			if (_vm->_avalot->_avvysInTheCupboard) {  				hideInCupboard();  				_vm->_sequence->firstShow(8);  				_vm->_sequence->thenShow(7); @@ -935,12 +933,12 @@ void Animation::updateSpeed() {  	_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);  	else  		_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);  	else  		_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) {  	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);  	changeDirection(sprNum, curPed->_direction);  } @@ -1037,15 +1035,15 @@ void Animation::arrowProcs(byte tripnum) {  			_vm->_dialogs->displayScrollChain('Q', 47); // Complaint!  			_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);  		}  	} else { // Arrow has hit the wall!  		_sprites[tripnum].remove(); // Deallocate the arrow.  		_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)  			return; // Not for Spludwick -		_vm->_gyro->_geidaSpin += 1; -		_vm->_gyro->_geidaTime = 20; -		if (_vm->_gyro->_geidaSpin == 5) { +		_vm->_avalot->_geidaSpin += 1; +		_vm->_avalot->_geidaTime = 20; +		if (_vm->_avalot->_geidaSpin == 5) {  			_vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!"); -			_vm->_gyro->_geidaSpin = 0; -			_vm->_gyro->_geidaTime = 0; // knock out records +			_vm->_avalot->_geidaSpin = 0; +			_vm->_avalot->_geidaTime = 0; // knock out records  		}  	}  }  void Animation::geidaProcs(byte tripnum) { -	if (_vm->_gyro->_geidaTime > 0) { -		_vm->_gyro->_geidaTime--; -		if (_vm->_gyro->_geidaTime == 0) -			_vm->_gyro->_geidaSpin = 0; +	if (_vm->_avalot->_geidaTime > 0) { +		_vm->_avalot->_geidaTime--; +		if (_vm->_avalot->_geidaTime == 0) +			_vm->_avalot->_geidaSpin = 0;  	}  	if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { @@ -1178,7 +1176,7 @@ void Animation::drawSprites() {   * @remarks	Originally called 'trippancy_link'   */  void Animation::animLink() { -	if (_vm->_menu->isActive() | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) +	if (_vm->_menu->isActive() | _vm->_avalot->_onToolbar | _vm->_avalot->_seeScroll)  		return;  	for (int16 i = 0; i < kSpriteNumbMax; i++) {  		if (_sprites[i]._quick && _sprites[i]._visible) @@ -1222,7 +1220,7 @@ void Animation::animLink() {  void Animation::stopWalking() {  	_sprites[0].stopWalk();  	_direction = kDirStopped; -	if (_vm->_gyro->_alive) +	if (_vm->_avalot->_alive)  		_sprites[0]._stepNum = 1;  } @@ -1231,16 +1229,16 @@ void Animation::stopWalking() {   * @remarks	Originally called 'hide_in_the_cupboard'   */  void Animation::hideInCupboard() { -	if (_vm->_gyro->_avvysInTheCupboard) { -		if (_vm->_gyro->_wearing == Parser::kNothing) { +	if (_vm->_avalot->_avvysInTheCupboard) { +		if (_vm->_avalot->_wearing == Parser::kNothing) {  			Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman);  			_vm->_dialogs->displayText(tmpStr);  		} else {  			_sprites[0]._visible = true; -			_vm->_gyro->_userMovesAvvy = true; +			_vm->_avalot->_userMovesAvvy = true;  			appearPed(0, 2); // Walk out of the cupboard.  			_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->thenShow(7);  			_vm->_sequence->startToClose(); @@ -1248,65 +1246,65 @@ void Animation::hideInCupboard() {  	} else {  		// Not hiding in the cupboard  		_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, " \  			"but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph);  		_vm->_dialogs->displayText(tmpStr); -		_vm->_gyro->_avvysInTheCupboard = true; +		_vm->_avalot->_avvysInTheCupboard = true;  		_vm->_background->drawBackgroundSprite(-1, -1, 7);  	}  }  void Animation::flipRoom(byte room, byte ped) {  	assert((ped > 0) && (ped < 15)); -	if (!_vm->_gyro->_alive) { +	if (!_vm->_avalot->_alive) {  		// You can't leave the room if you're dead.  		_sprites[0]._moveX = 0;  		_sprites[0]._moveY = 0; // Stop him from moving.  		return;  	} -	if ((room == kRoomDummy) && (_vm->_gyro->_room == kRoomLusties)) { +	if ((room == kRoomDummy) && (_vm->_avalot->_room == kRoomLusties)) {  		hideInCupboard();  		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!  		_sprites[0]._moveX = 0;  		return;  	} -	_vm->_lucerna->exitRoom(_vm->_gyro->_room); -	_vm->_lucerna->dusk(); +	_vm->_avalot->exitRoom(_vm->_avalot->_room); +	_vm->_avalot->dusk();  	for (int16 i = 1; i < kSpriteNumbMax; i++) {  		if (_sprites[i]._quick)  			_sprites[i].remove();  	} // Deallocate sprite -	if (_vm->_gyro->_room == kRoomLustiesRoom) -		_vm->_gyro->_enterCatacombsFromLustiesRoom = true; +	if (_vm->_avalot->_room == kRoomLustiesRoom) +		_vm->_avalot->_enterCatacombsFromLustiesRoom = true; -	_vm->_lucerna->enterRoom(room, ped); +	_vm->_avalot->enterRoom(room, ped);  	appearPed(0, ped - 1); -	_vm->_gyro->_enterCatacombsFromLustiesRoom = false; +	_vm->_avalot->_enterCatacombsFromLustiesRoom = false;  	_oldDirection = _direction;  	_direction = _sprites[0]._facingDir; -	_vm->_lucerna->drawDirection(); +	_vm->_avalot->drawDirection(); -	_vm->_lucerna->dawn(); +	_vm->_avalot->dawn();  }  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;  	return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2);  }  bool Animation::nearDoor() { -	if (_vm->_gyro->_fieldNum < 8) { +	if (_vm->_avalot->_fieldNum < 8) {  		// there ARE no doors here!  		return false;  	} @@ -1314,8 +1312,8 @@ bool Animation::nearDoor() {  	int16 ux = _sprites[0]._x;  	int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; -	for (int i = 8; i < _vm->_gyro->_fieldNum; i++) { -		FieldType *curField = &_vm->_gyro->_fields[i]; +	for (int i = 8; i < _vm->_avalot->_fieldNum; i++) { +		FieldType *curField = &_vm->_avalot->_fields[i];  		if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2))  			return true;  	} @@ -1324,7 +1322,7 @@ bool Animation::nearDoor() {  }  void Animation::handleMoveKey(const Common::Event &event) { -	if (!_vm->_gyro->_userMovesAvvy) +	if (!_vm->_avalot->_userMovesAvvy)  		return;  	if (_vm->_menu->_activeMenuItem._activeNow) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7dcf4a0e1f..673280cb4b 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -64,14 +64,12 @@ AvalancheEngine::~AvalancheEngine() {  	delete _avalot;  	delete _pingo;  	delete _dialogs; -	delete _lucerna;  	delete _background;  	delete _sequence;  	delete _timer;  	delete _animation;  	delete _menu;  	delete _closing; -	delete _gyro;  	delete _sound;  } @@ -80,10 +78,8 @@ Common::ErrorCode AvalancheEngine::initialize() {  	_parser = new Parser(this);  	_avalot = new Avalot(this); -	_gyro = new Gyro(this);  	_pingo = new Pingo(this);  	_dialogs = new Dialogs(this); -	_lucerna = new Lucerna(this);  	_background = new Background(this);  	_sequence = new Sequence(this);  	_timer = new Timer(this); @@ -94,7 +90,7 @@ Common::ErrorCode AvalancheEngine::initialize() {  	_graphics->init();  	_dialogs->init(); -	_lucerna->init(); +	_avalot->init();  	_parser->init();  	return Common::kNoError; @@ -119,145 +115,145 @@ const char *AvalancheEngine::getCopyrightString() const {  void AvalancheEngine::synchronize(Common::Serializer &sz) {  	//blockwrite(f, dna, sizeof(dna));  	sz.syncAsByte(_animation->_direction); -	sz.syncAsByte(_gyro->_carryNum); +	sz.syncAsByte(_avalot->_carryNum);  	for (int i = 0; i < kObjectNum; i++) -		sz.syncAsByte(_gyro->_objects[i]); -	sz.syncAsSint16LE(_gyro->_dnascore); -	sz.syncAsSint32LE(_gyro->_money); -	sz.syncAsByte(_gyro->_room); -	sz.syncAsByte(_gyro->_wearing); -	sz.syncAsByte(_gyro->_sworeNum); -	sz.syncAsByte(_gyro->_saveNum); -	sz.syncBytes(_gyro->_roomCount, 100); -	sz.syncAsByte(_gyro->_alcoholLevel); -	sz.syncAsByte(_gyro->_playedNim); -	sz.syncAsByte(_gyro->_wonNim); -	sz.syncAsByte(_gyro->_wineState); -	sz.syncAsByte(_gyro->_cwytalotGone); -	sz.syncAsByte(_gyro->_passwordNum); -	sz.syncAsByte(_gyro->_aylesIsAwake); -	sz.syncAsByte(_gyro->_drawbridgeOpen); -	sz.syncAsByte(_gyro->_avariciusTalk); -	sz.syncAsByte(_gyro->_boughtOnion); -	sz.syncAsByte(_gyro->_rottenOnion); -	sz.syncAsByte(_gyro->_onionInVinegar); -	sz.syncAsByte(_gyro->_givenToSpludwick); -	sz.syncAsByte(_gyro->_brummieStairs); -	sz.syncAsByte(_gyro->_cardiffQuestionNum); -	sz.syncAsByte(_gyro->_passedCwytalotInHerts); -	sz.syncAsByte(_gyro->_avvyIsAwake); -	sz.syncAsByte(_gyro->_avvyInBed); -	sz.syncAsByte(_gyro->_userMovesAvvy); -	sz.syncAsByte(_gyro->_npcFacing); -	sz.syncAsByte(_gyro->_givenBadgeToIby); -	sz.syncAsByte(_gyro->_friarWillTieYouUp); -	sz.syncAsByte(_gyro->_tiedUp); -	sz.syncAsByte(_gyro->_boxContent); -	sz.syncAsByte(_gyro->_talkedToCrapulus); -	sz.syncAsByte(_gyro->_jacquesState); -	sz.syncAsByte(_gyro->_bellsAreRinging); -	sz.syncAsByte(_gyro->_standingOnDais); -	sz.syncAsByte(_gyro->_takenPen); -	sz.syncAsByte(_gyro->_arrowTriggered); -	sz.syncAsByte(_gyro->_arrowInTheDoor); +		sz.syncAsByte(_avalot->_objects[i]); +	sz.syncAsSint16LE(_avalot->_dnascore); +	sz.syncAsSint32LE(_avalot->_money); +	sz.syncAsByte(_avalot->_room); +	sz.syncAsByte(_avalot->_wearing); +	sz.syncAsByte(_avalot->_sworeNum); +	sz.syncAsByte(_avalot->_saveNum); +	sz.syncBytes(_avalot->_roomCount, 100); +	sz.syncAsByte(_avalot->_alcoholLevel); +	sz.syncAsByte(_avalot->_playedNim); +	sz.syncAsByte(_avalot->_wonNim); +	sz.syncAsByte(_avalot->_wineState); +	sz.syncAsByte(_avalot->_cwytalotGone); +	sz.syncAsByte(_avalot->_passwordNum); +	sz.syncAsByte(_avalot->_aylesIsAwake); +	sz.syncAsByte(_avalot->_drawbridgeOpen); +	sz.syncAsByte(_avalot->_avariciusTalk); +	sz.syncAsByte(_avalot->_boughtOnion); +	sz.syncAsByte(_avalot->_rottenOnion); +	sz.syncAsByte(_avalot->_onionInVinegar); +	sz.syncAsByte(_avalot->_givenToSpludwick); +	sz.syncAsByte(_avalot->_brummieStairs); +	sz.syncAsByte(_avalot->_cardiffQuestionNum); +	sz.syncAsByte(_avalot->_passedCwytalotInHerts); +	sz.syncAsByte(_avalot->_avvyIsAwake); +	sz.syncAsByte(_avalot->_avvyInBed); +	sz.syncAsByte(_avalot->_userMovesAvvy); +	sz.syncAsByte(_avalot->_npcFacing); +	sz.syncAsByte(_avalot->_givenBadgeToIby); +	sz.syncAsByte(_avalot->_friarWillTieYouUp); +	sz.syncAsByte(_avalot->_tiedUp); +	sz.syncAsByte(_avalot->_boxContent); +	sz.syncAsByte(_avalot->_talkedToCrapulus); +	sz.syncAsByte(_avalot->_jacquesState); +	sz.syncAsByte(_avalot->_bellsAreRinging); +	sz.syncAsByte(_avalot->_standingOnDais); +	sz.syncAsByte(_avalot->_takenPen); +	sz.syncAsByte(_avalot->_arrowTriggered); +	sz.syncAsByte(_avalot->_arrowInTheDoor);  	if (sz.isSaving()) { -		uint16 like2drinkSize = _gyro->_favouriteDrink.size(); +		uint16 like2drinkSize = _avalot->_favouriteDrink.size();  		sz.syncAsUint16LE(like2drinkSize);  		for (uint16 i = 0; i < like2drinkSize; i++) { -			char actChr = _gyro->_favouriteDrink[i]; +			char actChr = _avalot->_favouriteDrink[i];  			sz.syncAsByte(actChr);  		} -		uint16 favourite_songSize = _gyro->_favouriteSong.size(); +		uint16 favourite_songSize = _avalot->_favouriteSong.size();  		sz.syncAsUint16LE(favourite_songSize);  		for (uint16 i = 0; i < favourite_songSize; i++) { -			char actChr = _gyro->_favouriteSong[i]; +			char actChr = _avalot->_favouriteSong[i];  			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);  		for (uint16 i = 0; i < worst_place_on_earthSize; i++) { -			char actChr = _gyro->_worstPlaceOnEarth[i]; +			char actChr = _avalot->_worstPlaceOnEarth[i];  			sz.syncAsByte(actChr);  		} -		uint16 spare_eveningSize = _gyro->_spareEvening.size(); +		uint16 spare_eveningSize = _avalot->_spareEvening.size();  		sz.syncAsUint16LE(spare_eveningSize);  		for (uint16 i = 0; i < spare_eveningSize; i++) { -			char actChr = _gyro->_spareEvening[i]; +			char actChr = _avalot->_spareEvening[i];  			sz.syncAsByte(actChr);  		}  	} else { -		if (!_gyro->_favouriteDrink.empty()) -			_gyro->_favouriteDrink.clear(); +		if (!_avalot->_favouriteDrink.empty()) +			_avalot->_favouriteDrink.clear();  		uint16 like2drinkSize = 0;  		char actChr = ' ';  		sz.syncAsUint16LE(like2drinkSize);  		for (uint16 i = 0; i < like2drinkSize; i++) {  			sz.syncAsByte(actChr); -			_gyro->_favouriteDrink += actChr; +			_avalot->_favouriteDrink += actChr;  		} -		if (!_gyro->_favouriteSong.empty()) -			_gyro->_favouriteSong.clear(); +		if (!_avalot->_favouriteSong.empty()) +			_avalot->_favouriteSong.clear();  		uint16 favourite_songSize = 0;  		sz.syncAsUint16LE(favourite_songSize);  		for (uint16 i = 0; i < favourite_songSize; i++) {  			sz.syncAsByte(actChr); -			_gyro->_favouriteSong += actChr; +			_avalot->_favouriteSong += actChr;  		} -		if (!_gyro->_worstPlaceOnEarth.empty()) -			_gyro->_worstPlaceOnEarth.clear(); +		if (!_avalot->_worstPlaceOnEarth.empty()) +			_avalot->_worstPlaceOnEarth.clear();  		uint16 worst_place_on_earthSize = 0;  		sz.syncAsUint16LE(worst_place_on_earthSize);  		for (uint16 i = 0; i < worst_place_on_earthSize; i++) {  			sz.syncAsByte(actChr); -			_gyro->_worstPlaceOnEarth += actChr; +			_avalot->_worstPlaceOnEarth += actChr;  		} -		if (!_gyro->_spareEvening.empty()) -			_gyro->_spareEvening.clear(); +		if (!_avalot->_spareEvening.empty()) +			_avalot->_spareEvening.clear();  		uint16 spare_eveningSize = 0;  		sz.syncAsUint16LE(spare_eveningSize);  		for (uint16 i = 0; i < spare_eveningSize; i++) {  			sz.syncAsByte(actChr); -			_gyro->_spareEvening += actChr; +			_avalot->_spareEvening += actChr;  		}  	} -	sz.syncAsSint32LE(_gyro->_totalTime); -	sz.syncAsByte(_gyro->_jumpStatus); -	sz.syncAsByte(_gyro->_mushroomGrowing); -	sz.syncAsByte(_gyro->_spludwickAtHome); -	sz.syncAsByte(_gyro->_lastRoom); -	sz.syncAsByte(_gyro->_lastRoomNotMap); -	sz.syncAsByte(_gyro->_crapulusWillTell); -	sz.syncAsByte(_gyro->_enterCatacombsFromLustiesRoom); -	sz.syncAsByte(_gyro->_teetotal); -	sz.syncAsByte(_gyro->_malagauche); -	sz.syncAsByte(_gyro->_drinking); -	sz.syncAsByte(_gyro->_enteredLustiesRoomAsMonk); -	sz.syncAsByte(_gyro->_catacombX); -	sz.syncAsByte(_gyro->_catacombY); -	sz.syncAsByte(_gyro->_avvysInTheCupboard); -	sz.syncAsByte(_gyro->_geidaFollows); -	sz.syncAsByte(_gyro->_geidaSpin); -	sz.syncAsByte(_gyro->_geidaTime); -	sz.syncAsByte(_gyro->_nextBell); -	sz.syncAsByte(_gyro->_givenPotionToGeida); -	sz.syncAsByte(_gyro->_lustieIsAsleep); -	sz.syncAsByte(_gyro->_flipToWhere); -	sz.syncAsByte(_gyro->_flipToPed); -	sz.syncAsByte(_gyro->_beenTiedUp); -	sz.syncAsByte(_gyro->_sittingInPub); -	sz.syncAsByte(_gyro->_spurgeTalkCount); -	sz.syncAsByte(_gyro->_metAvaroid); -	sz.syncAsByte(_gyro->_takenMushroom); -	sz.syncAsByte(_gyro->_givenPenToAyles); -	sz.syncAsByte(_gyro->_askedDogfoodAboutNim); +	sz.syncAsSint32LE(_avalot->_totalTime); +	sz.syncAsByte(_avalot->_jumpStatus); +	sz.syncAsByte(_avalot->_mushroomGrowing); +	sz.syncAsByte(_avalot->_spludwickAtHome); +	sz.syncAsByte(_avalot->_lastRoom); +	sz.syncAsByte(_avalot->_lastRoomNotMap); +	sz.syncAsByte(_avalot->_crapulusWillTell); +	sz.syncAsByte(_avalot->_enterCatacombsFromLustiesRoom); +	sz.syncAsByte(_avalot->_teetotal); +	sz.syncAsByte(_avalot->_malagauche); +	sz.syncAsByte(_avalot->_drinking); +	sz.syncAsByte(_avalot->_enteredLustiesRoomAsMonk); +	sz.syncAsByte(_avalot->_catacombX); +	sz.syncAsByte(_avalot->_catacombY); +	sz.syncAsByte(_avalot->_avvysInTheCupboard); +	sz.syncAsByte(_avalot->_geidaFollows); +	sz.syncAsByte(_avalot->_geidaSpin); +	sz.syncAsByte(_avalot->_geidaTime); +	sz.syncAsByte(_avalot->_nextBell); +	sz.syncAsByte(_avalot->_givenPotionToGeida); +	sz.syncAsByte(_avalot->_lustieIsAsleep); +	sz.syncAsByte(_avalot->_flipToWhere); +	sz.syncAsByte(_avalot->_flipToPed); +	sz.syncAsByte(_avalot->_beenTiedUp); +	sz.syncAsByte(_avalot->_sittingInPub); +	sz.syncAsByte(_avalot->_spurgeTalkCount); +	sz.syncAsByte(_avalot->_metAvaroid); +	sz.syncAsByte(_avalot->_takenMushroom); +	sz.syncAsByte(_avalot->_givenPenToAyles); +	sz.syncAsByte(_avalot->_askedDogfoodAboutNim);  #if 0 @@ -334,7 +330,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {  }  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) { @@ -380,7 +376,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) {  }  bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!! -	return (!_gyro->_seeScroll); +	return (!_avalot->_seeScroll);  }  Common::Error AvalancheEngine::loadGameState(int slot) { @@ -429,29 +425,29 @@ bool AvalancheEngine::loadGame(const int16 slot) {  	synchronize(sz);  	delete f; -	_gyro->_isLoaded = true; -	_gyro->_seeScroll = true;  // This prevents display of the new sprites before the new picture is loaded. +	_avalot->_isLoaded = true; +	_avalot->_seeScroll = true;  // This prevents display of the new sprites before the new picture is loaded. -	if (_gyro->_holdTheDawn) { -		_gyro->_holdTheDawn = false; -		_lucerna->dawn(); +	if (_avalot->_holdTheDawn) { +		_avalot->_holdTheDawn = false; +		_avalot->dawn();  	}  	_background->forgetBackgroundSprites(); -	_lucerna->minorRedraw(); +	_avalot->minorRedraw();  	_menu->setup(); -	_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room; -	_gyro->_alive = true; -	_lucerna->refreshObjectList(); +	_avalot->_whereIs[Avalot::kPeopleAvalot - 150] = _avalot->_room; +	_avalot->_alive = true; +	_avalot->refreshObjectList();  	_animation->updateSpeed(); -	_lucerna->drawDirection(); -	_gyro->_onToolbar = false; +	_avalot->drawDirection(); +	_avalot->_onToolbar = false;  	_animation->animLink();  	_background->updateBackgroundSprites();  	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::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->displayText(tmpStr); @@ -468,7 +464,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) {  	};  	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)))  		switch (d % 10) { @@ -485,7 +481,7 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) {  			day += "th";  		} -	return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900); +	return day + ' ' + month + ' ' + _avalot->intToStr(y + 1900);  }  void AvalancheEngine::updateEvents() { @@ -494,10 +490,10 @@ void AvalancheEngine::updateEvents() {  	while (_eventMan->pollEvent(event)) {  		switch (event.type) {  		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;  		case Common::EVENT_LBUTTONUP: -			_lucerna->_holdLeftMouse = false; // Same as above. +			_avalot->_holdLeftMouse = false; // Same as above.  			break;  		case Common::EVENT_KEYDOWN:  			_avalot->handleKeyDown(event); @@ -541,7 +537,7 @@ Common::Error AvalancheEngine::run() {  		//}  #endif -	} while (!_gyro->_letMeOut && !shouldQuit()); +	} while (!_avalot->_letMeOut && !shouldQuit());  	return Common::kNoError;  } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 781031c9c1..289cf60d30 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -32,10 +32,8 @@  #include "avalanche/graphics.h"  #include "avalanche/parser.h"  #include "avalanche/avalot.h" -#include "avalanche/gyro.h"  #include "avalanche/pingo.h"  #include "avalanche/dialogs.h" -#include "avalanche/lucerna.h"  #include "avalanche/background.h"  #include "avalanche/sequence.h"  #include "avalanche/timer.h" @@ -67,10 +65,8 @@ public:  	Parser *_parser;  	Avalot *_avalot; -	Gyro *_gyro;  	Pingo *_pingo;  	Dialogs *_dialogs; -	Lucerna *_lucerna;  	Background *_background;  	Sequence *_sequence;  	Timer *_timer; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5dc7fcfcba..e514d7933d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -30,10 +30,7 @@  #include "avalanche/avalanche.h"  #include "avalanche/graphics.h"  #include "avalanche/avalot.h" -#include "avalanche/gyro.h"  #include "avalanche/animation.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h"  #include "avalanche/dialogs.h"  #include "avalanche/menu.h"  #include "avalanche/pingo.h" @@ -41,14 +38,232 @@  #include "avalanche/background.h"  #include "avalanche/closing.h" +#include "common/file.h" +#include "common/random.h"  #include "common/str.h"  #include "common/textconsole.h"  #include "common/config-manager.h"  namespace Avalanche { -Avalot::Avalot(AvalancheEngine *vm) { +const char *Avalot::kVersionNum = "1.30"; +const char *Avalot::kCopyright = "1995"; + +const MouseHotspotType Avalot::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 Avalot::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 Avalot::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 Avalot::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 Avalot::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; + +const TuneType Avalot::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 Avalot::_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. +}; + +Clock::Clock(AvalancheEngine *vm) { +	_vm = vm; +	_oldHour = _oldHourAngle = _oldMinute = 17717; +} + +void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. +	TimeDate t; +	_vm->_system->getTimeAndDate(t); +	_hour = t.tm_hour; +	_minute = t.tm_min; +	_second = t.tm_sec; + +	_hourAngle = (_hour % 12) * 30 + _minute / 2; + +	if (_oldHour != _hour)  { +		plotHands(); +		chime(); +	} + +	if (_oldMinute != _minute) +		plotHands(); + +	if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { +		Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ +			"midnight. Are you having an all-night Avvy session? Glad you like the game that much!",  +			Dialogs::kControlNewLine, Dialogs::kControlNewLine); +		_vm->_dialogs->displayText(tmpStr); +	} +	_oldHour = _hour; +	_oldHourAngle = _hourAngle; +	_oldMinute = _minute; +} + +void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { +	if (angle > 900) { +		endPoint.x = 177; +		return; +	} + +	endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); +} + +void Clock::drawHand(const Common::Point &endPoint, byte color) { +	if (endPoint.x == 177) +		return; + +	_vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); +} + +void Clock::plotHands() { +	calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); +	calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); +	drawHand(_clockHandHour, kColorBrown); +	drawHand(_clockHandMinute, kColorBrown); + +	calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); +	calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); +	drawHand(_clockHandHour, kColorYellow); +	drawHand(_clockHandMinute, kColorYellow); +} + +void Clock::chime() { +	warning("STUB: Clock::chime()"); +} + + +Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(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; +} + +Avalot::~Avalot() { +	for (int i = 0; i < 31; i++) { +		for (int j = 0; j < 2; j++) { +			if (_also[i][j] != 0)  { +				delete _also[i][j]; +				_also[i][j] = 0; +			} +		} +	} + +	for (int i = 0; i < 9; i++) { +		_digits[i].free(); +		_directions[i].free(); +	} +	_digits[9].free();  }  void Avalot::handleKeyDown(Common::Event &event) { @@ -99,9 +314,9 @@ void Avalot::handleKeyDown(Common::Event &event) {  	case Common::KEYCODE_HOME:  	case Common::KEYCODE_END:  	case Common::KEYCODE_KP5: -		if (_vm->_gyro->_alive && _vm->_gyro->_avvyIsAwake) { +		if (_alive && _avvyIsAwake) {  			_vm->_animation->handleMoveKey(event); // Fallthroughs are intended. -			_vm->_lucerna->drawDirection(); +			drawDirection();  			return;  		}  	case Common::KEYCODE_BACKSPACE: @@ -114,46 +329,46 @@ void Avalot::handleKeyDown(Common::Event &event) {  		break;  	} -	_vm->_lucerna->drawDirection(); +	drawDirection();  }  void Avalot::setup() { -	_vm->_gyro->init(); +	init();  	_vm->_dialogs->reset(); -	_vm->_lucerna->dusk(); -	_vm->_lucerna->loadDigits(); +	dusk(); +	loadDigits();  	_vm->_parser->_inputTextPos = 0;  	_vm->_parser->_quote = true; -	_vm->_lucerna->drawToolbar(); +	drawToolbar();  	_vm->_dialogs->setReadyLight(2);  	_vm->_animation->_direction = Animation::kDirStopped;  	_vm->_animation->loadAnims(); -	_vm->_lucerna->dawn(); +	dawn();  	_vm->_parser->_cursorState = false;  	_vm->_parser->cursorOn(); -	_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; +	_vm->_animation->_sprites[0]._speedX = kWalk;  	_vm->_animation->updateSpeed();  	_vm->_menu->init();  	int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot");  	if (loadSlot >= 0) { -		_vm->_gyro->_thinks = 2; // You always have money. -		_vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); +		_thinks = 2; // You always have money. +		thinkAbout(Avalot::kObjectMoney, Avalot::kThing);  		_vm->loadGame(loadSlot);  	} else { -		_vm->_gyro->_isLoaded = false; // Set to true in _vm->loadGame(). -		_vm->_gyro->newGame(); +		_isLoaded = false; // Set to true in _vm->loadGame(). +		newGame(); -		_vm->_gyro->_soundFx = !_vm->_gyro->_soundFx; -		_vm->_lucerna->fxToggle(); -		_vm->_lucerna->thinkAbout(Gyro::kObjectMoney, Gyro::kThing); +		_soundFx = !_soundFx; +		fxToggle(); +		thinkAbout(Avalot::kObjectMoney, Avalot::kThing);  		_vm->_dialogs->displayScrollChain('q', 83); // Info on the game, etc.  	} @@ -167,21 +382,21 @@ void Avalot::runAvalot() {  		_vm->updateEvents(); // The event handler. -		_vm->_lucerna->_clock.update(); +		_clock.update();  		_vm->_menu->update();  		_vm->_background->updateBackgroundSprites();  		_vm->_animation->animLink(); -		_vm->_lucerna->checkClick(); +		checkClick();  		_vm->_timer->updateTimer();  #ifdef DEBUG -		for (int i = 0; i < _vm->_gyro->_lineNum; i++) { -			LineType *curLine = &_vm->_gyro->_lines[i]; +		for (int i = 0; i < _lineNum; i++) { +			LineType *curLine = &_lines[i];  			_vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col);  		} -		for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { -			FieldType *curField = &_vm->_gyro->_fields[i]; +		for (int i = 0; i < _fieldNum; i++) { +			FieldType *curField = &_fields[i];  			if (curField->_x1 < 640)  				_vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta);  		} @@ -191,8 +406,8 @@ void Avalot::runAvalot() {  		uint32 delay = _vm->_system->getMillis() - beginLoop;  		if (delay <= 55) -			_vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight). -	} while (!_vm->_gyro->_letMeOut && !_vm->shouldQuit()); +			_vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). +	} while (!_letMeOut && !_vm->shouldQuit());  	//if (logging)  	//	close(logfile); @@ -201,4 +416,1507 @@ void Avalot::runAvalot() {  	_vm->_closing->exitGame();  } +void Avalot::init() { +	for (int i = 0; i < 31; i++) { +		for (int j = 0; j < 2; j++) +			_also[i][j] = 0; +	} + +#if 0 +	if (_vm->_enhanced->atbios) +		atkey = "f1"; +	else +		atkey = "alt-"; +#endif + +	_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); +} + +/** + * Call a given Verb + * @remarks	Originally called 'callverb' + */ +void Avalot::callVerb(byte id) { +	if (id == _vm->_parser->kPardon) { +		Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ +			"situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ +			"what the current setting of this key is."); +		_vm->_dialogs->displayText(tmpStr); +	} else { +		_weirdWord = false; +		_vm->_parser->_polite = true; +		_vm->_parser->_verb = id; +		_vm->_parser->doThat(); +	} +} + +void Avalot::drawAlsoLines() { +	CursorMan.showMouse(false); + +	_vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); +	_vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); + +	for (int i = 0; i < _lineNum; i++) { +		// We had to check if the lines are within the borders of the screen. +		if ((_lines[i]._x1 >= 0) && (_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_lines[i]._y1 >= 0) && (_lines[i]._y1 < _vm->_graphics->kScreenHeight) +		 && (_lines[i]._x2 >= 0) && (_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_lines[i]._y2 >= 0) && (_lines[i]._y2 < _vm->_graphics->kScreenHeight)) +			_vm->_graphics->_magics.drawLine(_lines[i]._x1, _lines[i]._y1, _lines[i]._x2, _lines[i]._y2, _lines[i]._color); +	} + +	CursorMan.showMouse(true); +} + +/** + * Check is it's possible to give something to Spludwick + * @remarks	Originally called 'nextstring' + */ +Common::String Avalot::readAlsoStringFromFile() { +	Common::String str; +	byte length = file.readByte(); +	for (int i = 0; i < length; i++) +		str += file.readByte(); +	return str; +} + +void Avalot::scram(Common::String &str) { +	for (uint i = 0; i < str.size(); i++) +		str.setChar(str[i] ^ 177, i); +} + +void Avalot::unScramble() { +	for (int i = 0; i < 31; i++) { +		for (int j = 0; j < 2; j++) { +			if (_also[i][j] != 0) +				scram(*_also[i][j]); +		} +	} +	scram(_listen); +	scram(_flags); +} + +void Avalot::loadAlso(byte num) { +	for (int i = 0; i < 31; i++) { +		for (int j = 0; j < 2; j++) { +			if (_also[i][j] != 0)  { +				delete _also[i][j]; +				_also[i][j] = 0; +			} +		} +	} +	Common::String filename; +	filename = Common::String::format("also%d.avd", num); +	if (!file.open(filename)) +		error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + +	file.seek(128); + +	byte alsoNum = file.readByte(); +	Common::String tmpStr; +	for (int i = 0; i <= alsoNum; i++) { +		for (int j = 0; j < 2; j++) { +			_also[i][j] = new Common::String; +			*_also[i][j] = readAlsoStringFromFile(); +		} +		tmpStr = Common::String::format("\x9D%s\x9D", _also[i][0]->c_str()); +		*_also[i][0] = tmpStr; +	} + +	memset(_lines, 0xFF, sizeof(_lines)); + +	_lineNum = file.readByte(); +	for (int i = 0; i < _lineNum; i++) { +		LineType *curLine = &_lines[i]; +		curLine->_x1 = file.readSint16LE(); +		curLine->_y1 = file.readSint16LE(); +		curLine->_x2 = file.readSint16LE(); +		curLine->_y2 = file.readSint16LE(); +		curLine->_color = file.readByte(); +	} + +	memset(_peds, 177, sizeof(_peds)); +	byte pedNum = file.readByte(); +	for (int i = 0; i < pedNum; i++) { +		PedType *curPed = &_peds[i]; +		curPed->_x = file.readSint16LE(); +		curPed->_y = file.readSint16LE(); +		curPed->_direction = file.readByte(); +	} + +	_fieldNum = file.readByte(); +	for (int i = 0; i < _fieldNum; i++) { +		FieldType *curField = &_fields[i]; +		curField->_x1 = file.readSint16LE(); +		curField->_y1 = file.readSint16LE(); +		curField->_x2 = file.readSint16LE(); +		curField->_y2 = file.readSint16LE(); +	} + +	for (int i = 0; i < 15; i++) { +		MagicType *magic = &_magics[i]; +		magic->_operation = file.readByte(); +		magic->_data = file.readUint16LE(); +	} + +	for (int i = 0; i < 7; i++) { +		MagicType *portal = &_portals[i]; +		portal->_operation = file.readByte(); +		portal->_data = file.readUint16LE(); +	} + +	_flags.clear(); +	for (int i = 0;  i < 26; i++) +		_flags += file.readByte(); + +	int16 listen_length = file.readByte(); +	_listen.clear(); +	for (int i = 0; i < listen_length; i++) +		_listen += file.readByte(); + +	drawAlsoLines(); + +	file.close(); +	unScramble(); +	for (int i = 0; i <= alsoNum; i++) { +		tmpStr = Common::String::format(",%s,", _also[i][0]->c_str()); +		*_also[i][0] = tmpStr; +	} +} + +void Avalot::loadRoom(byte num) { +	CursorMan.showMouse(false); + +	_vm->_graphics->fleshColors(); + +	Common::String filename = Common::String::format("place%d.avd", num); +	if (!file.open(filename)) +		error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); + +	file.seek(146); +	if (!_roomnName.empty()) +		_roomnName.clear(); +	for (int i = 0; i < 30; i++) { +		char actChar = file.readByte(); +		if ((32 <= actChar) && (actChar <= 126)) +			_roomnName += actChar; +	} +	// Compression method byte follows this... + +	file.seek(177); + +	_vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); +	_vm->_graphics->refreshBackground(); + +	file.close(); + +	loadAlso(num); +	_vm->_background->loadBackgroundSprites(num); +	CursorMan.showMouse(true); +} + +void Avalot::zoomOut(int16 x, int16 y) { +	warning("STUB: Avalot::zoomout()"); +} + +void Avalot::findPeople(byte room) { +	for (int i = 1; i < 29; i++) { +		if (_whereIs[i] == room) { +			if (i < 25) +				_him = i + 150; +			else +				_her = i + 150; +		} +	} +} + +void Avalot::exitRoom(byte x) { +	_vm->_sound->stopSound(); +	_vm->_background->forgetBackgroundSprites(); +	_seeScroll = true;  // This stops the trippancy system working over the length of this procedure. + +	switch (x) { +	case kRoomSpludwicks: +		_vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); +		 _avariciusTalk = 0; +		// He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. +		break; +	case kRoomBridge: +		if (_drawbridgeOpen > 0) { +			_drawbridgeOpen = 4; // Fully open. +			_vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); +		} +		break; +	case kRoomOutsideCardiffCastle: +		_vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); +		break; +	case kRoomRobins: +		_vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); +		break; +	} + +	_interrogation = 0; // Leaving the room cancels all the questions automatically. +	_seeScroll = false; // Now it can work again! + +	_lastRoom = _room; +	if (_room != kRoomMap) +		_lastRoomNotMap = _room; +} + + +/** + * Only when entering a NEW town! Not returning to the last one, + * but choosing another from the map. + * @remarks	Originally called 'new_town' + */ +void Avalot::enterNewTown() { +	_vm->_menu->setup(); + +	switch (_room) { +	case kRoomOutsideNottsPub: // Entry into Nottingham. +		if ((_roomCount[kRoomRobins] > 0) && (_beenTiedUp) && (!_takenMushroom)) +			_mushroomGrowing = true; +		break; +	case kRoomWiseWomans: // Entry into Argent. +		if (_talkedToCrapulus && (!_lustieIsAsleep)) { +			_spludwickAtHome = !((_roomCount[kRoomWiseWomans] % 3) == 1); +			_crapulusWillTell = !_spludwickAtHome; +		} else { +			_spludwickAtHome = true; +			_crapulusWillTell = false; +		} +		if (_boxContent == Avalot::kObjectWine) +			_wineState = 3; // Vinegar +		break; +	} + +	if ((_room != kRoomOutsideDucks) && (_objects[Avalot::kObjectOnion - 1]) && !(_onionInVinegar)) +		_rottenOnion = true; // You're holding the onion +} + +void Avalot::putGeidaAt(byte whichPed, byte ped) { +	if (ped == 0) +		return; +	AnimationType *spr1 = &_vm->_animation->_sprites[1]; + +	spr1->init(5, false, _vm->_animation); // load Geida +	_vm->_animation->appearPed(1, whichPed); +	spr1->_callEachStepFl = true; +	spr1->_eachStepProc = Animation::kProcGeida; +} + +void Avalot::enterRoom(byte room, byte ped) { +	_seeScroll = true;  // This stops the trippancy system working over the length of this procedure. + +	findPeople(room); +	_room = room; +	if (ped != 0) +		_roomCount[room]++; + +	loadRoom(room); + +	if ((_roomCount[room] == 0) && (!setFlag('S'))) +		incScore(1); + +	_whereIs[Avalot::kPeopleAvalot - 150] = _room; + +	if (_geidaFollows) +		_whereIs[Avalot::kPeopleGeida - 150] = room; + +	_roomTime = 0; + + +	if ((_lastRoom == kRoomMap) && (_lastRoomNotMap != _room)) +		enterNewTown(); + +	switch (room) { +	case kRoomYours: +		if (_avvyInBed) { +			_vm->_background->drawBackgroundSprite(-1, -1, 2); +			_vm->_graphics->refreshBackground(); +			_vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); +		} +		break; + +	case kRoomOutsideYours: +		if (ped > 0) { +			AnimationType *spr1 = &_vm->_animation->_sprites[1]; +			if (!_talkedToCrapulus) { +				_whereIs[Avalot::kPeopleCrapulus - 150] = kRoomOutsideYours; +				spr1->init(8, false, _vm->_animation); // load Crapulus + +				if (_roomCount[kRoomOutsideYours] == 1) { +					_vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. +					spr1->walkTo(4); // Walks up to greet you. +				} else { +					_vm->_animation->appearPed(1, 4); // Starts where he was before. +					spr1->_facingDir = Animation::kDirLeft; +				} + +				spr1->_callEachStepFl = true; +				spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. + +			} else +				_whereIs[Avalot::kPeopleCrapulus - 150] = kRoomNowhere; + +			if (_crapulusWillTell) { +				spr1->init(8, false, _vm->_animation); +				_vm->_animation->appearPed(1, 1); +				spr1->walkTo(3); +				_vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); +				_crapulusWillTell = false; +			} +		} +		break; + +	case kRoomOutsideSpludwicks: +		if ((_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { +			_vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); +			_spludwickAtHome = true; +		} +		break; + +	case kRoomSpludwicks: +		if (_spludwickAtHome) { +			AnimationType *spr1 = &_vm->_animation->_sprites[1]; +			if (ped > 0) { +				spr1->init(2, false, _vm->_animation); // load Spludwick +				_vm->_animation->appearPed(1, 1); +				_whereIs[Avalot::kPeopleSpludwick - 150] = kRoomSpludwicks; +			} + +			spr1->_callEachStepFl = true; +			spr1->_eachStepProc = Animation::kProcGeida; +		} else +			_whereIs[Avalot::kPeopleSpludwick - 150] = kRoomNowhere; +		break; + +	case kRoomBrummieRoad: +		if (_geidaFollows) +			putGeidaAt(4, ped); +		if (_cwytalotGone) { +			_magics[kColorLightred - 1]._operation = Avalot::kMagicNothing; +			_whereIs[Avalot::kPeopleCwytalot - 150] = kRoomNowhere; +		} else { +			if (ped > 0) { +				AnimationType *spr1 = &_vm->_animation->_sprites[1]; +				spr1->init(4, false, _vm->_animation); // 4 = Cwytalot +				spr1->_callEachStepFl = true; +				spr1->_eachStepProc = Animation::kProcFollowAvvyY; +				_whereIs[Avalot::kPeopleCwytalot - 150] = kRoomBrummieRoad; + +				if (_roomCount[kRoomBrummieRoad] == 1) { // First time here... +					_vm->_animation->appearPed(1, 1); // He appears on the right of the screen... +					spr1->walkTo(3); // ...and he walks up... +				} else { +					// You've been here before. +					_vm->_animation->appearPed(1, 3); // He's standing in your way straight away... +					spr1->_facingDir = Animation::kDirLeft; +				} +			} +		} +		break; + +	case kRoomArgentRoad: +		if ((_cwytalotGone) && (!_passedCwytalotInHerts) && (ped == 2) && (_roomCount[kRoomArgentRoad] > 3)) { +			AnimationType *spr1 = &_vm->_animation->_sprites[1]; +			spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again +			_vm->_animation->appearPed(1, 0); +			spr1->walkTo(1); +			spr1->_vanishIfStill = true; +			_passedCwytalotInHerts = true; +			// whereis[#157] = r__Nowhere; // can we fit this in? +			_vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); +		} +		break; + +	case kRoomBridge: +		if (_drawbridgeOpen == 4) { // open +			_vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge +			_vm->_graphics->refreshBackground(); +			_magics[kColorGreen - 1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge. +		} +		if (_geidaFollows) +			putGeidaAt(ped + 2, ped); // load Geida +		break; + +	case kRoomRobins: +		if (ped > 0) { +			if (!_beenTiedUp) { +				// A welcome party... or maybe not... +				AnimationType *spr1 = &_vm->_animation->_sprites[1]; +				spr1->init(6, false, _vm->_animation); +				_vm->_animation->appearPed(1, 1); +				spr1->walkTo(2); +				_vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); +			} +		} + +		if (_beenTiedUp) { +			_whereIs[Avalot::kPeopleRobinHood - 150] = 0; +			_whereIs[Avalot::kPeopleFriarTuck - 150] = 0; +		} + +		if (_tiedUp) +			_vm->_background->drawBackgroundSprite(-1, -1, 1); + +		if (!_mushroomGrowing) +			_vm->_background->drawBackgroundSprite(-1, -1, 2); +		_vm->_graphics->refreshBackground(); +		break; + +	case kRoomOutsideCardiffCastle: +		if (ped > 0) { +			AnimationType *spr1 = &_vm->_animation->_sprites[1]; +			switch (_cardiffQuestionNum) { +			case 0 : // You've answered NONE of his questions. +				spr1->init(9, false, _vm->_animation); +				_vm->_animation->appearPed(1, 1); +				spr1->walkTo(2); +				_vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); +				break; +			case 5 : +				_magics[1]._operation = Avalot::kMagicNothing; +				break; // You've answered ALL his questions. => nothing happens. +			default: // You've answered SOME of his questions. +				spr1->init(9, false, _vm->_animation); +				_vm->_animation->appearPed(1, 2); +				spr1->_facingDir = Animation::kDirRight; +				_vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); +			} +		} + +		if (_cardiffQuestionNum < 5) +			_interrogation = _cardiffQuestionNum; +		else +			_interrogation = 0; +		break; + +	case kRoomMap: +		// You're entering the map. +		dawn(); +		if (ped > 0) +			zoomOut(_peds[ped]._x, _peds[ped]._y); + +		if ((_objects[Avalot::kObjectWine - 1]) && (_wineState != 3)) { +			_vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! +			_objects[Avalot::kObjectWine - 1] = false; +			refreshObjectList(); +		} + +		_vm->_dialogs->displayScrollChain('q', 69); +		break; + +	case kRoomCatacombs: +		if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { + +			switch (ped) { +			case 3: // Enter from oubliette +				_catacombX = 8; +				_catacombY = 4; +				break; +			case 5: // Enter from du Lustie's +				_catacombX = 8; +				_catacombY = 7; +				break; +			case 6: // Enter from Geida's +				_catacombX = 4; +				_catacombY = 1; +				break; +			} + +			_enterCatacombsFromLustiesRoom = true; +			_vm->_animation->catacombMove(ped); +			_enterCatacombsFromLustiesRoom = false; +		} +		break; + +	case kRoomArgentPub: +		if (_wonNim) +			_vm->_background->drawBackgroundSprite(-1, -1, 0);   // No lute by the settle. +		_malagauche = 0; // Ready to boot Malagauche +		if (_givenBadgeToIby) { +			_vm->_background->drawBackgroundSprite(-1, -1, 7); +			_vm->_background->drawBackgroundSprite(-1, -1, 8); +		} +		_vm->_graphics->refreshBackground(); +		break; + +	case kRoomLustiesRoom: +		_npcFacing = 1; // du Lustie. +		if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes +			_vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); +		else if (!_enteredLustiesRoomAsMonk) // already +			// Presumably, Avvy dressed as a monk. +			_vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); + +		if (_geidaFollows) { +			putGeidaAt(4, ped); +			if (_lustieIsAsleep) { +				_vm->_background->drawBackgroundSprite(-1, -1, 4); +				_vm->_graphics->refreshBackground(); +			} +		} +		break; + +	case kRoomMusicRoom: +		if (_jacquesState > 0) { +			_jacquesState = 5; +			_vm->_background->drawBackgroundSprite(-1, -1, 1); +			_vm->_graphics->refreshBackground(); +			_vm->_background->drawBackgroundSprite(-1, -1, 3); +			_magics[kColorBrown - 1]._operation = Avalot::kMagicNothing; +			_whereIs[Avalot::kPeopleJacques - 150] = 0; +		} +		if (ped != 0) { +			_vm->_background->drawBackgroundSprite(-1, -1, 5); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(6); +			_vm->_sequence->thenShow(5); +			_vm->_sequence->thenShow(7); +			_vm->_sequence->startToClose(); +		} +		break; + +	case kRoomOutsideNottsPub: +		if (ped == 2) { +			_vm->_background->drawBackgroundSprite(-1, -1, 2); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(3); +			_vm->_sequence->thenShow(2); +			_vm->_sequence->thenShow(1); +			_vm->_sequence->thenShow(4); +			_vm->_sequence->startToClose(); +		} +		break; + +	case kRoomOutsideArgentPub: +		if (ped == 2)  { +			_vm->_background->drawBackgroundSprite(-1, -1, 5); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(6); +			_vm->_sequence->thenShow(5); +			_vm->_sequence->thenShow(7); +			_vm->_sequence->startToClose(); +		} +		break; + +	case kRoomWiseWomans: { +		AnimationType *spr1 = &_vm->_animation->_sprites[1]; +		spr1->init(11, false, _vm->_animation); +		if ((_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { +			_vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. +			spr1->walkTo(3); // Walks up to greet you. +		} else { +			_vm->_animation->appearPed(1, 3); // Starts where she was before. +			spr1->_facingDir = Animation::kDirLeft; +		} + +		spr1->_callEachStepFl = true; +		spr1->_eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. +		} +		break; + +	case kRoomInsideCardiffCastle: +		if (ped > 0) { +			_vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. +			_vm->_background->drawBackgroundSprite(-1, -1, 0); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(1); +			if (_arrowInTheDoor) +				_vm->_sequence->thenShow(3); +			else +				_vm->_sequence->thenShow(2); + +			if (_takenPen) +				_vm->_background->drawBackgroundSprite(-1, -1, 3); + +			_vm->_sequence->startToClose(); +		} else { +			_vm->_background->drawBackgroundSprite(-1, -1, 0); +			if (_arrowInTheDoor) +				_vm->_background->drawBackgroundSprite(-1, -1, 2); +			else +				_vm->_background->drawBackgroundSprite(-1, -1, 1); +			_vm->_graphics->refreshBackground(); +		} +		break; + +	case kRoomAvvysGarden: +		if (ped == 1)  { +			_vm->_background->drawBackgroundSprite(-1, -1, 1); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(2); +			_vm->_sequence->thenShow(1); +			_vm->_sequence->thenShow(3); +			_vm->_sequence->startToClose(); +		} +		break; + +	case kRoomEntranceHall: +	case kRoomInsideAbbey: +	case kRoomYourHall: +		if (ped == 2)  { +#if 0 +			// It was the original: +			_vm->_celer->show_one(-1, -1, 2); +			_vm->_sequence->first_show(1); +			_vm->_sequence->then_show(3); +			_vm->_sequence->start_to_close(); +#endif + +			_vm->_background->drawBackgroundSprite(-1, -1, 1); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(2); +			_vm->_sequence->thenShow(1); +			_vm->_sequence->thenShow(3); +			_vm->_sequence->startToClose(); +		} +		break; + +	case kRoomAylesOffice: +		if (_aylesIsAwake) +			_vm->_background->drawBackgroundSprite(-1, -1, 1); +		_vm->_graphics->refreshBackground(); +		break; // Ayles awake. + +	case kRoomGeidas: +		putGeidaAt(1, ped); +		break; // load Geida + +	case kRoomEastHall: +	case kRoomWestHall: +		if (_geidaFollows) +			putGeidaAt(ped + 1, ped); +		break; + +	case kRoomLusties: +		if (_geidaFollows) +			putGeidaAt(ped + 5, ped); +		break; + +	case kRoomNottsPub: +		if (_sittingInPub) +			_vm->_background->drawBackgroundSprite(-1, -1, 2); +		_npcFacing = 1; // Port. +		break; + +	case kRoomOutsideDucks: +		if (ped == 2) { +			// Shut the door +			_vm->_background->drawBackgroundSprite(-1, -1, 2); +			_vm->_graphics->refreshBackground(); +			_vm->_sequence->firstShow(3); +			_vm->_sequence->firstShow(2); +			_vm->_sequence->thenShow(1); +			_vm->_sequence->thenShow(4); +			_vm->_sequence->startToClose(); +		} +		break; + +	case kRoomDucks: +		_npcFacing = 1; // Duck. +		break;  +	} + +	_seeScroll = false; // Now it can work again! +	_isLoaded = false; +} + +void Avalot::thinkAbout(byte object, bool type) { +	const int16 picSize = 966; + +	_thinks = object; +	object--; + +	setMousePointerWait(); + +	if (type == Avalot::kThing) { +		if (!file.open("thinks.avd")) +			error("AVALANCHE: Lucerna: File not found: thinks.avd"); +	} else { // Avalot::kPerson +		if (!file.open("folk.avd")) +			error("AVALANCHE: Lucerna: File not found: folk.avd"); + +		object -= 149; +		if (object >= 25) +			object -= 8; +		if (object == 20) +			object--; // Last time... +	} + +	CursorMan.showMouse(false); + +	file.seek(object * picSize + 65); +	::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); +	_vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); + +	picture.free(); +	file.close(); + +	CursorMan.showMouse(true); +	_thinkThing = type; +} + +void Avalot::loadDigits() {   // Load the scoring digits & rwlites +	const byte digitsize = 134; +	const byte rwlitesize = 126; + +	if (!file.open("digit.avd")) +		error("AVALANCHE: Lucerna: File not found: digit.avd"); + +	for (int i = 0; i < 10; i++) { +		file.seek(i * digitsize); +		_digits[i] = _vm->_graphics->loadPictureGraphic(file); +	} + +	for (int i = 0; i < 9; i++) { +		file.seek(10 * digitsize + i * rwlitesize); +		_directions[i] = _vm->_graphics->loadPictureGraphic(file); +	} + +	file.close(); +} + +void Avalot::drawToolbar() { +	if (!file.open("useful.avd")) +		error("AVALANCHE: Lucerna: File not found: useful.avd"); + +	file.seek(40); + +	CursorMan.showMouse(false); +	::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); +	_vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); + +	picture.free(); +	file.close(); + +	CursorMan.showMouse(true); +	_vm->_animation->_oldDirection = 177; +	drawDirection(); +} + +void Avalot::drawScore() { +	uint16 score = _dnascore; +	int8 numbers[3] = {0, 0, 0}; +	for (int i = 0; i < 2; i++) { +		byte divisor = 1; +		for (int j = 0; j < (2 - i); j++) +			divisor *= 10; +		numbers[i] = score / divisor; +		score -= numbers[i] * divisor; +	} +	numbers[2] = score; + +	CursorMan.showMouse(false); + +	for (int i = 0; i < 3; i++) { +		if (_scoreToDisplay[i] != numbers[i]) +			_vm->_graphics->drawPicture(_vm->_graphics->_surface, _digits[numbers[i]], 250 + (i + 1) * 15, 177); +	} + +	CursorMan.showMouse(true); + +	for (int i = 0; i < 3; i++) +		_scoreToDisplay[i] = numbers[i]; +} + +void Avalot::incScore(byte num) {     +	for (int i = 1; i <= num; i++) { +		_dnascore++; + +//		if (soundfx) { +			for (int j = 1; j <= 97; j++) +				// Length os 2 is a guess, the original doesn't have a delay specified +				_vm->_sound->playNote(177 + _dnascore * 3, 2); +//		} +	} +	warning("STUB: Avalot::points()"); + +	drawScore(); +} + +void Avalot::useCompass(const Common::Point &cursorPos) { +	byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); + +	switch (color) { +	case kColorGreen: +		_vm->_animation->_direction = Animation::kDirUp; +		_vm->_animation->changeDirection(0, Animation::kDirUp); +		drawDirection(); +		break; +	case kColorBrown: +		_vm->_animation->_direction = Animation::kDirDown; +		_vm->_animation->changeDirection(0, Animation::kDirDown); +		drawDirection(); +		break; +	case kColorCyan: +		_vm->_animation->_direction = Animation::kDirLeft; +		_vm->_animation->changeDirection(0, Animation::kDirLeft); +		drawDirection(); +		break; +	case kColorLightmagenta: +		_vm->_animation->_direction = Animation::kDirRight; +		_vm->_animation->changeDirection(0, Animation::kDirRight); +		drawDirection(); +		break; +	case kColorRed: +	case kColorWhite: +	case kColorLightcyan: +	case kColorYellow: // Fall-throughs are intended. +		_vm->_animation->stopWalking(); +		drawDirection(); +		break; +	} +} + +void Avalot::fxToggle() { +	warning("STUB: Avalot::fxtoggle()"); +} + +void Avalot::refreshObjectList() { +	_carryNum = 0; +	if (_thinkThing && !_objects[_thinks - 1]) +		thinkAbout(Avalot::kObjectMoney, Avalot::kThing); // you always have money + +	for (int i = 0; i < kObjectNum; i++) { +		if (_objects[i]) { +			_objectList[_carryNum] = i + 1; +			_carryNum++; +		} +	} +} + +/** + * @remarks	Originally called 'verte' + */ +void Avalot::guideAvvy(Common::Point cursorPos) { +	if (!_userMovesAvvy) +		return; + +	cursorPos.y /= 2; +	byte what; + +	// _vm->_animation->tr[0] is Avalot.) +	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	if (cursorPos.x < avvy->_x) +		what = 1; +	else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) +		what = 2; +	else +		what = 0; // On top + +	if (cursorPos.y < avvy->_y) +		what += 3; +	else if (cursorPos.y > (avvy->_y + avvy->_info._yLength)) +		what += 6; + +	switch (what) { +	case 0: +		_vm->_animation->stopWalking(); +		break; // Clicked on Avvy: no movement. +	case 1: +		_vm->_animation->changeDirection(0, Animation::kDirLeft); +		break; +	case 2: +		_vm->_animation->changeDirection(0, Animation::kDirRight); +		break; +	case 3: +		_vm->_animation->changeDirection(0, Animation::kDirUp); +		break; +	case 4: +		_vm->_animation->changeDirection(0, Animation::kDirUpLeft); +		break; +	case 5: +		_vm->_animation->changeDirection(0, Animation::kDirUpRight); +		break; +	case 6: +		_vm->_animation->changeDirection(0, Animation::kDirDown); +		break; +	case 7: +		_vm->_animation->changeDirection(0, Animation::kDirDownLeft); +		break; +	case 8: +		_vm->_animation->changeDirection(0, Animation::kDirDownRight); +		break; +	}    // No other values are possible. + +	drawDirection(); +} + +void Avalot::checkClick() { +	Common::Point cursorPos = _vm->getMousePos(); +	_onToolbar = kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); + +	/*if (mrelease > 0) +		after_the_scroll = false;*/ + +	if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) +		newMouse(0); // up arrow +	else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) +		newMouse(7); //I-beam +	else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) +		newMouse(1); // screwdriver +	else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. +		if (_holdLeftMouse) { +			newMouse(6); // Mark's crosshairs +			guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. +		} else +			newMouse(3); // fletch +	} + +	if (_holdLeftMouse) { +		if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. +			if (_dropsOk) +				_vm->_menu->update(); +		} else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. +			_vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; +			if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) +				_vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; +			if (_vm->_parser->_inputTextPos < 1) +				_vm->_parser->_inputTextPos = 1; +			_vm->_parser->_inputTextPos--; +			_vm->_parser->plotText(); +		} else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. +			if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. +				if (_alive && _avvyIsAwake) +					useCompass(cursorPos); +			} else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. +				do { +					_vm->updateEvents(); +				} while (_holdLeftMouse); + +				if (_thinkThing) { +					_vm->_parser->_thing = _thinks; +					_vm->_parser->_thing += 49; +					_vm->_parser->_person = _vm->_parser->kPardon; +				} else { +					_vm->_parser->_person = _thinks; +					_vm->_parser->_thing = _vm->_parser->kPardon; +				} +				callVerb(Parser::kVerbCodeExam); +			} else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. +				do { +					_vm->updateEvents(); +				} while (_holdLeftMouse); + +				callVerb(Parser::kVerbCodeScore); +			} else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. +				_vm->_animation->_sprites[0]._speedX = kWalk; +				_vm->_animation->updateSpeed(); +			} else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. +				_vm->_animation->_sprites[0]._speedX = kRun; +				_vm->_animation->updateSpeed(); +			} else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) +				fxToggle(); +			else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) +				_mouseText.insertChar(Dialogs::kControlNewLine, 0); +		} else if (!_dropsOk) +			_mouseText = Common::String(13) + _mouseText; +	} +} + +void Avalot::errorLed() { +	warning("STUB: Avalot::errorled()"); +} + +int8 Avalot::fades(int8 x) { +	warning("STUB: Avalot::fades()"); +	return 0; +} + +void Avalot::fadeOut(byte n) { +	warning("STUB: Avalot::fadeOut()"); +} + +void Avalot::dusk() { +	warning("STUB: Avalot::dusk()"); +} + +void Avalot::fadeIn(byte n) { +	warning("STUB: Avalot::fadeIn()"); +} + +void Avalot::dawn() { +	warning("STUB: Avalot::dawn()"); +} + +void Avalot::drawDirection() { // It's data is loaded in load_digits(). +	if (_vm->_animation->_oldDirection == _vm->_animation->_direction) +		return; + +	_vm->_animation->_oldDirection = _vm->_animation->_direction; + +	CursorMan.showMouse(false); +	_vm->_graphics->drawPicture(_vm->_graphics->_surface, _directions[_vm->_animation->_direction], 0, 161); +	CursorMan.showMouse(true); +} + + +void Avalot::gameOver() { +	_userMovesAvvy = false; + +	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	int16 sx = avvy->_x; +	int16 sy = avvy->_y; + +	avvy->remove(); +	avvy->init(12, true, _vm->_animation); // 12 = Avalot falls +	avvy->_stepNum = 0; +	avvy->appear(sx, sy, 0); + +	_vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); +	_alive = false; +} + +void Avalot::minorRedraw() { +	dusk(); + +	enterRoom(_room, 0); // Ped unknown or non-existant. + +	for (int i = 0; i < 3; i++) +		_scoreToDisplay[i] = -1; // impossible digits +	drawScore(); + +	dawn(); +} + +void Avalot::majorRedraw() { +	warning("STUB: Avalot::major_redraw()"); +} + +uint16 Avalot::bearing(byte whichPed) { +	static const double rad2deg = 180 / 3.14; // Pi +	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	PedType *curPed = &_peds[whichPed]; + +	if (avvy->_x == curPed->_x) +		return 0; +	else if (avvy->_x < curPed->_x) { +		return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); +	} else { +		return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); +	} +} + +/**  + * @remarks	Originally called 'sprite_run' + */ +void Avalot::spriteRun() { +	_doingSpriteRun = true; +	_vm->_animation->animLink(); +	_doingSpriteRun = false; +} + +void Avalot::fixFlashers() { +	_ledStatus = 177; +	_vm->_animation->_oldDirection = 177; +	_vm->_dialogs->setReadyLight(2); +	drawDirection(); +} + +Common::String Avalot::intToStr(int32 num) { +	return Common::String::format("%d", num); +} + +void Avalot::newMouse(byte id) { +	if (id == _currentMouse) +		return; + +	_currentMouse = id; +	loadMouse(id); +} + +/** + * Set the mouse pointer to 'HourGlass" + * @remarks	Originally called 'wait' + */ +void Avalot::setMousePointerWait() { +	newMouse(4); +} + +void Avalot::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) { +	warning("STUB: Avalot::shadow()"); +} + +void Avalot::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { +	warning("STUB: Avalot::shbox()"); +} + +void Avalot::resetVariables() { +// Replaces memset(&_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 Avalot::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; +	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 = ""; + +	enterRoom(1, 1); +	avvy->_visible = false; +	drawScore(); +	_vm->_menu->setup(); +	_clock.update(); +	spriteRun(); +} + +void Avalot::slowDown() { +	warning("STUB: Avalot::slowdown()"); +} + +bool Avalot::setFlag(char x) { +	for (uint16 i = 0; i < _flags.size(); i++) { +		if (_flags[i] == x) +			return true; +	} + +	return false; +} + +bool Avalot::decreaseMoney(uint16 howmuchby) { +	_money -= howmuchby; +	if (_money < 0) { +		_vm->_dialogs->displayScrollChain('Q', 2); // "You are now denariusless!" +		gameOver(); +		return false; +	} else +		return true; +} + +Common::String Avalot::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 Avalot::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 Avalot::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 Avalot::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 Avalot::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 Avalot::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 Avalot::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 Avalot::setBackgroundColor(byte x) { +	warning("STUB: Avalot::background()"); +} + +void Avalot::hangAroundForAWhile() { +	for (int i = 0; i < 28; i++) +		slowDown(); +}  } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 1f2046604f..51be1a3dd4 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -32,20 +32,412 @@  #include "common/events.h"  #include "common/system.h" +#include "common/str.h" +#include "common/scummsys.h" +#include "common/file.h" +#include "graphics/surface.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(); +}; + +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 {  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(); + +	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 setup();  	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:  	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 diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index 3a70fd7915..9da9161110 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -30,8 +30,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/background.h"  #include "avalanche/animation.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h"  #include "common/textconsole.h" @@ -55,28 +53,28 @@ void Background::updateBackgroundSprites() {  	if (_vm->_menu->isActive())  		return; // No animation when the menus are up. -	switch (_vm->_gyro->_room) { +	switch (_vm->_avalot->_room) {  	case kRoomOutsideArgentPub: -		if ((_vm->_gyro->_roomTime % 12) == 0) -			drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 4); +		if ((_vm->_avalot->_roomTime % 12) == 0) +			drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 4);  		break;  	case kRoomBrummieRoad: -		if ((_vm->_gyro->_roomTime % 2) == 0) -			drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 2) % 4); +		if ((_vm->_avalot->_roomTime % 2) == 0) +			drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 2) % 4);  		break;  	case kRoomBridge: -		if ((_vm->_gyro->_roomTime % 2) == 0) -			drawBackgroundSprite(-1, -1, 3 + (_vm->_gyro->_roomTime / 2) % 4); +		if ((_vm->_avalot->_roomTime % 2) == 0) +			drawBackgroundSprite(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4);  		break;  	case kRoomYours: -		if ((!_vm->_gyro->_avvyIsAwake) && ((_vm->_gyro->_roomTime % 4) == 0)) -			drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 12) % 2); +		if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0)) +			drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 2);  		break;  	case kRoomArgentPub: -		if (((_vm->_gyro->_roomTime % 7) == 1) && (_vm->_gyro->_malagauche != 177)) { +		if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) {  			// Malagauche cycle. -			_vm->_gyro->_malagauche += 1; -			switch (_vm->_gyro->_malagauche) { +			_vm->_avalot->_malagauche += 1; +			switch (_vm->_avalot->_malagauche) {  			case 1:  			case 11:  			case 21: @@ -92,12 +90,12 @@ void Background::updateBackgroundSprites() {  				drawBackgroundSprite(-1, -1, 12); // Winks.  				break;  			case 33: -				_vm->_gyro->_malagauche = 0; +				_vm->_avalot->_malagauche = 0;  				break;  			}  		} -		switch (_vm->_gyro->_roomTime % 200) { +		switch (_vm->_avalot->_roomTime % 200) {  		case 179:  		case 197:  			drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle. @@ -110,13 +108,13 @@ void Background::updateBackgroundSprites() {  			drawBackgroundSprite(-1, -1, 6);  			break;  		case 199: -			_vm->_gyro->_npcFacing = 177; // Impossible value for this. +			_vm->_avalot->_npcFacing = 177; // Impossible value for this.  			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; -			uint16 angle = _vm->_lucerna->bearing(1); +			uint16 angle = _vm->_avalot->bearing(1);  			if (((angle >= 1) && (angle <= 90)) || ((angle >= 358) && (angle <= 360)))  				direction = 3;  			else if ((angle >= 293) && (angle <= 357)) @@ -124,15 +122,15 @@ void Background::updateBackgroundSprites() {  			else if ((angle >= 271) && (angle <= 292))  				direction = 4; -			if (direction != _vm->_gyro->_npcFacing) { // Dogfood. +			if (direction != _vm->_avalot->_npcFacing) { // Dogfood.  				drawBackgroundSprite(-1, -1, direction - 1); -				_vm->_gyro->_npcFacing = direction; +				_vm->_avalot->_npcFacing = direction;  			}  		}  		break;  	case kRoomWestHall: -		if ((_vm->_gyro->_roomTime % 3) == 0) { -			switch ((_vm->_gyro->_roomTime / int32(3)) % int32(6)) { +		if ((_vm->_avalot->_roomTime % 3) == 0) { +			switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) {  			case 4:  				drawBackgroundSprite(-1, -1, 0);  				break; @@ -149,10 +147,10 @@ void Background::updateBackgroundSprites() {  		}  		break;  	case kRoomLustiesRoom: -		if (!(_vm->_gyro->_lustieIsAsleep)) { +		if (!(_vm->_avalot->_lustieIsAsleep)) {  			byte direction = 0; -			uint16 angle = _vm->_lucerna->bearing(1); -			if ((_vm->_gyro->_roomTime % 45) > 42) +			uint16 angle = _vm->_avalot->bearing(1); +			if ((_vm->_avalot->_roomTime % 45) > 42)  				direction = 4; // du Lustie blinks.  			// Bearing of Avvy from du Lustie.  			else if ((angle <= 45) || ((angle >= 315) && (angle <= 360))) @@ -162,15 +160,15 @@ void Background::updateBackgroundSprites() {  			else if ((angle >= 181) && (angle <= 314))  				direction = 3; // Right. -			if (direction != _vm->_gyro->_npcFacing) { // du Lustie. +			if (direction != _vm->_avalot->_npcFacing) { // du Lustie.  				drawBackgroundSprite(-1, -1, direction - 1); -				_vm->_gyro->_npcFacing = direction; +				_vm->_avalot->_npcFacing = direction;  			}  		}  		break;  	case kRoomAylesOffice: -		if ((!_vm->_gyro->_aylesIsAwake) && (_vm->_gyro->_roomTime % 14 == 0)) { -			switch ((_vm->_gyro->_roomTime / 14) % 2) { +		if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) { +			switch ((_vm->_avalot->_roomTime / 14) % 2) {  			case 0:  				drawBackgroundSprite(-1, -1, 0);  // Frame 2: EGA.  				break; @@ -181,8 +179,8 @@ void Background::updateBackgroundSprites() {  		}  		break;  	case kRoomRobins: -		if (_vm->_gyro->_tiedUp) { -			switch (_vm->_gyro->_roomTime % 54) { +		if (_vm->_avalot->_tiedUp) { +			switch (_vm->_avalot->_roomTime % 54) {  			case 20:  				drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks.  				break; @@ -195,7 +193,7 @@ void Background::updateBackgroundSprites() {  	case kRoomNottsPub: {  		// Bearing of Avvy from Port.  		byte direction = 0; -		uint16 angle = _vm->_lucerna->bearing(4); +		uint16 angle = _vm->_avalot->bearing(4);  		if ((angle <= 45) || ((angle >= 315) && (angle <= 360)))  			direction = 2; // Middle.  		else if ((angle >= 45) && (angle <= 180)) @@ -203,15 +201,15 @@ void Background::updateBackgroundSprites() {  		else if ((angle >= 181) && (angle <= 314))  			direction = 8; // Right. -		if ((_vm->_gyro->_roomTime % 60) > 57) +		if ((_vm->_avalot->_roomTime % 60) > 57)  			direction--; // Blinks. -		if (direction != _vm->_gyro->_npcFacing) { // Port. +		if (direction != _vm->_avalot->_npcFacing) { // Port.  			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 :  			drawBackgroundSprite(-1, -1, 8); // Spurge blinks.  			break; @@ -222,12 +220,12 @@ void Background::updateBackgroundSprites() {  		break;  	  }  	case kRoomDucks: { -		if ((_vm->_gyro->_roomTime % 3) == 0) // The fire flickers. -			drawBackgroundSprite(-1, -1, (_vm->_gyro->_roomTime / 3) % 3); +		if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers. +			drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 3) % 3);  		// Bearing of Avvy from Duck.  		byte direction = 0; -		uint16 angle = _vm->_lucerna->bearing(1); +		uint16 angle = _vm->_avalot->bearing(1);  		if ((angle <= 45) || ((angle >= 315) && (angle <= 360)))  			direction = 4; // Middle.  		else if ((angle >= 45) && (angle <= 180)) @@ -235,26 +233,26 @@ void Background::updateBackgroundSprites() {  		else if ((angle >= 181) && (angle <= 314))  			direction = 8; // Right. -		if ((_vm->_gyro->_roomTime % 45) > 42) +		if ((_vm->_avalot->_roomTime % 45) > 42)  			direction++; // Duck blinks. -		if (direction != _vm->_gyro->_npcFacing) { // Duck. +		if (direction != _vm->_avalot->_npcFacing) { // Duck.  			drawBackgroundSprite(-1, -1, direction - 1); -			_vm->_gyro->_npcFacing = direction; +			_vm->_avalot->_npcFacing = direction;  		}  		break;  	   }  	} -	if ((_vm->_gyro->_bellsAreRinging) && (_vm->_gyro->setFlag('B'))) { +	if ((_vm->_avalot->_bellsAreRinging) && (_vm->_avalot->setFlag('B'))) {  		// They're ringing the bells. -		switch (_vm->_gyro->_roomTime % 4) { +		switch (_vm->_avalot->_roomTime % 4) {  		case 1: -			if (_vm->_gyro->_nextBell < 5) -				_vm->_gyro->_nextBell = 12; -			_vm->_gyro->_nextBell--; +			if (_vm->_avalot->_nextBell < 5) +				_vm->_avalot->_nextBell = 12; +			_vm->_avalot->_nextBell--;  			// 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;  		case 2:  			_vm->_sound->stopSound(); diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 39f177e6aa..822148499a 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -29,8 +29,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/closing.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h"  #include "common/textconsole.h"  #include "common/random.h" diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 69a398439a..3004f621a4 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -29,8 +29,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/dialogs.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h"  #include "avalanche/animation.h"  #include "avalanche/timer.h" @@ -50,7 +48,7 @@ void Dialogs::init() {  }  void Dialogs::setReadyLight(byte state) {     // Sets "Ready" light to whatever -	if (_vm->_gyro->_ledStatus == state) +	if (_vm->_avalot->_ledStatus == state)  		return; // Already like that!  	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);  	CursorMan.showMouse(true); -	_vm->_gyro->_ledStatus = state; +	_vm->_avalot->_ledStatus = state;  }  void Dialogs::easterEgg() { @@ -116,8 +114,8 @@ void Dialogs::scrollModeNormal() {  	Common::String e = "(c) 1994";  	setReadyLight(3); -	_vm->_gyro->_seeScroll = true; -	_vm->_gyro->newMouse(3); +	_vm->_avalot->_seeScroll = true; +	_vm->_avalot->newMouse(3);  	::Graphics::Surface temp;  	temp.copyFrom(_vm->_graphics->_surface); @@ -145,7 +143,7 @@ void Dialogs::scrollModeNormal() {  	bool oktoexit;  	do {  		do { -			_vm->_gyro->check(); // was "checkclick;" +			_vm->_avalot->check(); // was "checkclick;"  //#ifdef RECORD slowdown(); basher::count += 1; #endif @@ -170,12 +168,12 @@ void Dialogs::scrollModeNormal() {  //#ifdef RECORD record_one(); #endif -	_vm->_gyro->screturn = r == '#'; // "back door" +	_vm->_avalot->screturn = r == '#'; // "back door"  #endif  	setReadyLight(0); -	_vm->_gyro->_seeScroll = false; -	_vm->_lucerna->_holdLeftMouse = false; // Used in Lucerna::checkclick(). +	_vm->_avalot->_seeScroll = false; +	_vm->_avalot->_holdLeftMouse = false; // Used in Lucerna::checkclick().  	warning("STUB: Scrolls::scrollModeNormal()");  } @@ -193,7 +191,7 @@ bool Dialogs::theyMatch(TuneType &played) {  	byte mistakes = 0;  	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;  	} @@ -202,16 +200,16 @@ bool Dialogs::theyMatch(TuneType &played) {  void Dialogs::scrollModeMusic() {  	setReadyLight(3); -	_vm->_gyro->_seeScroll = true; +	_vm->_avalot->_seeScroll = true;  	CursorMan.showMouse(false); -	_vm->_gyro->newMouse(3); +	_vm->_avalot->newMouse(3);  	TuneType played;  	for (unsigned int i = 0; i < sizeof(played); i++) -		played[i] = Gyro::kPitchInvalid; +		played[i] = Avalot::kPitchInvalid;  	int8 lastOne = -1, thisOne = -1; // Invalid values. -	_vm->_gyro->_seeScroll = true; +	_vm->_avalot->_seeScroll = true;  	::Graphics::Surface temp;  	temp.copyFrom(_vm->_graphics->_surface); @@ -282,16 +280,16 @@ void Dialogs::scrollModeMusic() {  				lastOne = thisOne;  				thisOne = value; -				_vm->_sound->playNote(_vm->_gyro->kNotes[thisOne], 100); +				_vm->_sound->playNote(_vm->_avalot->kNotes[thisOne], 100);  				_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) -						store(Gyro::kPitchLower, played); +						store(Avalot::kPitchLower, played);  					else if (thisOne == lastOne) -						store(Gyro::kPitchSame, played); +						store(Avalot::kPitchSame, played);  					else -						store(Gyro::kPitchHigher, played); +						store(Avalot::kPitchHigher, played);  				}  				if (theyMatch(played)) { @@ -304,30 +302,30 @@ void Dialogs::scrollModeMusic() {  	_vm->_graphics->_surface.copyFrom(temp);  	temp.free(); -	_vm->_gyro->_seeScroll = false; +	_vm->_avalot->_seeScroll = false;  	CursorMan.showMouse(true);  }  void Dialogs::resetScrollDriver() { -	_vm->_gyro->_scrollBells = 0; +	_vm->_avalot->_scrollBells = 0;  	_currentFont = kFontStyleRoman;  	_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... -	for (int i = 0; i < _vm->_gyro->_scrollBells; i++) -		_vm->_lucerna->errorLed(); // Ring the bell "x" times. +	for (int i = 0; i < _vm->_avalot->_scrollBells; i++) +		_vm->_avalot->errorLed(); // Ring the bell "x" times.  }  void Dialogs::dodgem() {  	_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() {  	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.  } @@ -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());  #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;  	for (uint16 i = 1; i <= yl; i++)  		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) {  	int16 lx = 0; -	int16 ly = (_vm->_gyro->_scrollNum) * 6; +	int16 ly = (_vm->_avalot->_scrollNum) * 6;  	int16 ex; -	for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { -		ex = _vm->_gyro->_scroll[i].size() * 8; +	for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { +		ex = _vm->_avalot->_scroll[i].size() * 8;  		if (lx < ex)  			lx = ex;  	} @@ -447,47 +445,47 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) {  		iconIndent = 53;  	} -	for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { -		if (!_vm->_gyro->_scroll[i].empty()) -			switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { +	for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { +		if (!_vm->_avalot->_scroll[i].empty()) +			switch (_vm->_avalot->_scroll[i][_vm->_avalot->_scroll[i].size() - 1]) {  			case kControlCenter:  				centre = true; -				_vm->_gyro->_scroll[i].deleteLastChar(); +				_vm->_avalot->_scroll[i].deleteLastChar();  				break;  			case kControlLeftJustified:  				centre = false; -				_vm->_gyro->_scroll[i].deleteLastChar(); +				_vm->_avalot->_scroll[i].deleteLastChar();  				break;  			case kControlQuestion:  				//settextjustify(1, 1);  				_shadowBoxX = mx + lx;  				_shadowBoxY = my + ly; -				_vm->_gyro->_scroll[i].setChar(' ', 0); +				_vm->_avalot->_scroll[i].setChar(' ', 0);  				// byte groi = *_vm->_graphics->getPixel(0, 0);  				// inc(diy,14); -				_vm->_gyro->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 - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); +				_vm->_avalot->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No.");  				break;  			}  		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 -			say(mx + iconIndent, my, _vm->_gyro->_scroll[i]); +			say(mx + iconIndent, my, _vm->_avalot->_scroll[i]);  		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(); -	_vm->_gyro->_dropsOk = false; +	_vm->_avalot->_dropsOk = false;  	dodgem();  	(this->*modeFunc)();  	unDodgem(); -	_vm->_gyro->_dropsOk = true; +	_vm->_avalot->_dropsOk = true;  	resetScrollDriver();  } @@ -497,9 +495,9 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) {  	CursorMan.showMouse(false);  	int16 xl = 0; -	int16 yl = _vm->_gyro->_scrollNum * 5; -	for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { -		uint16 textWidth = _vm->_gyro->_scroll[i].size() * 8; +	int16 yl = _vm->_avalot->_scrollNum * 5; +	for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { +		uint16 textWidth = _vm->_avalot->_scroll[i].size() * 8;  		if (textWidth > xl)  			xl = textWidth;  	} @@ -510,55 +508,55 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) {  	int16 my = yw * 2 - 2;  	int16 xc = 0; -	if ((_vm->_gyro->_talkX - xw) < 0) -		xc = -(_vm->_gyro->_talkX - xw); -	if ((_vm->_gyro->_talkX + xw) > 639) -		xc = 639 - (_vm->_gyro->_talkX + xw); +	if ((_vm->_avalot->_talkX - xw) < 0) +		xc = -(_vm->_avalot->_talkX - xw); +	if ((_vm->_avalot->_talkX + xw) > 639) +		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[1].x = _vm->_gyro->_talkX + 10; +	points[1].x = _vm->_avalot->_talkX + 10;  	points[1].y = yw; -	points[2].x = _vm->_gyro->_talkX; -	points[2].y = _vm->_gyro->_talkY; +	points[2].x = _vm->_avalot->_talkX; +	points[2].y = _vm->_avalot->_talkY;  	// Backup the screen before drawing the bubble.  	_vm->_graphics->_scrolls.copyFrom(_vm->_graphics->_surface);  	// 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->_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 + 9, 7, _vm->_avalot->_talkX + xw - 8 + xc, my + 1), _vm->_avalot->_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. -	_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. -	_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. -	_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. -	_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. -	_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(). -	// 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. -	for (int i = 0; i < _vm->_gyro->_scrollNum; i++) { -		int16 x = xc + _vm->_gyro->_talkX - _vm->_gyro->_scroll[i].size() / 2 * 8; -		bool offset = _vm->_gyro->_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); +	for (int i = 0; i < _vm->_avalot->_scrollNum; i++) { +		int16 x = xc + _vm->_avalot->_talkX - _vm->_avalot->_scroll[i].size() / 2 * 8; +		bool offset = _vm->_avalot->_scroll[i].size() % 2; +		_vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_avalot->_scroll[i], _vm->_avalot->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_avalot->_talkFontColor);  	}  	ringBell();  	CursorMan.showMouse(false); -	_vm->_gyro->_dropsOk = false; +	_vm->_avalot->_dropsOk = false;  	// This does the actual drawing to the screen.  	(this->*modeFunc)(); -	_vm->_gyro->_dropsOk = true; +	_vm->_avalot->_dropsOk = true;  	CursorMan.showMouse(true); // sink;  	resetScrollDriver();  } @@ -569,36 +567,36 @@ bool Dialogs::displayQuestion(Common::String question) {  }  void Dialogs::reset() { -	_vm->_gyro->_scrollNum = 1; +	_vm->_avalot->_scrollNum = 1;  	for (int i = 0; i < 15; i++) { -		if (!_vm->_gyro->_scroll[i].empty()) -			_vm->_gyro->_scroll[i].clear(); +		if (!_vm->_avalot->_scroll[i].empty()) +			_vm->_avalot->_scroll[i].clear();  	}  }  void Dialogs::setBubbleStateNatural() { -	_vm->_gyro->_talkX = 320; -	_vm->_gyro->_talkY = 200; -	_vm->_gyro->_talkBackgroundColor = 8; -	_vm->_gyro->_talkFontColor = 15; +	_vm->_avalot->_talkX = 320; +	_vm->_avalot->_talkY = 200; +	_vm->_avalot->_talkBackgroundColor = 8; +	_vm->_avalot->_talkFontColor = 15;  }  Common::String Dialogs::displayMoney() {  	Common::String result; -	if (_vm->_gyro->_money < 12) { // just pence -		result = Common::String::format("%dd", _vm->_gyro->_money); -	} else if (_vm->_gyro->_money < 240) { // shillings & pence -		if ((_vm->_gyro->_money % 12) == 0) -			result = Common::String::format("%d/-", _vm->_gyro->_money / 12); +	if (_vm->_avalot->_money < 12) { // just pence +		result = Common::String::format("%dd", _vm->_avalot->_money); +	} else if (_vm->_avalot->_money < 240) { // shillings & pence +		if ((_vm->_avalot->_money % 12) == 0) +			result = Common::String::format("%d/-", _vm->_avalot->_money / 12);  		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 -		result = Common::String::format("\x9C%d.%d.%d", _vm->_gyro->_money / 240, (_vm->_gyro->_money / 12) % 20,  -		                _vm->_gyro->_money % 12); +		result = Common::String::format("\x9C%d.%d.%d", _vm->_avalot->_money / 240, (_vm->_avalot->_money / 12) % 20,  +		                _vm->_avalot->_money % 12);  	} -	if (_vm->_gyro->_money > 12) { -		Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_gyro->_money); +	if (_vm->_avalot->_money > 12) { +		Common::String extraStr = Common::String::format(" (that's %dd)", _vm->_avalot->_money);  		result += extraStr;  	} @@ -611,16 +609,16 @@ void Dialogs::stripTrailingSpaces(Common::String &str) {  }  void Dialogs::solidify(byte n) { -	if (!_vm->_gyro->_scroll[n].contains(' ')) +	if (!_vm->_avalot->_scroll[n].contains(' '))  		return; // No spaces.  	// So there MUST be a space there, somewhere...  	do { -		_vm->_gyro->_scroll[n + 1] = _vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] + _vm->_gyro->_scroll[n + 1]; -		_vm->_gyro->_scroll[n].deleteLastChar(); -	} while (_vm->_gyro->_scroll[n][_vm->_gyro->_scroll[n].size() - 1] != ' '); +		_vm->_avalot->_scroll[n + 1] = _vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] + _vm->_avalot->_scroll[n + 1]; +		_vm->_avalot->_scroll[n].deleteLastChar(); +	} while (_vm->_avalot->_scroll[n][_vm->_avalot->_scroll[n].size() - 1] != ' '); -	stripTrailingSpaces(_vm->_gyro->_scroll[n]); +	stripTrailingSpaces(_vm->_avalot->_scroll[n]);  }  void Dialogs::callDialogDriver() { @@ -630,60 +628,60 @@ void Dialogs::callDialogDriver() {  	_vm->_sound->stopSound();  	setReadyLight(0); -	_vm->_gyro->_scReturn = false; +	_vm->_avalot->_scReturn = false;  	bool mouthnext = false;  	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: -		_vm->_gyro->_bufSize--; +		_vm->_avalot->_bufSize--;  		break; // ^D = (D)on't include pagebreak  	case kControlSpeechBubble:  	case kControlQuestion:  		break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box  	default: -		_vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; -		_vm->_gyro->_bufSize++; +		_vm->_avalot->_buffer[_vm->_avalot->_bufSize] = kControlParagraph; +		_vm->_avalot->_bufSize++;  	} -	uint16 size = _vm->_gyro->_bufSize; +	uint16 size = _vm->_avalot->_bufSize;  	for (uint16 i = 0; i < size; i++) {  		if (mouthnext) { -			if (_vm->_gyro->_buffer[i] == kControlRegister) +			if (_vm->_avalot->_buffer[i] == kControlRegister)  				_param = 0; -			else if (('0' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= '9')) -				_param = _vm->_gyro->_buffer[i] - 48; -			else if (('A' <= _vm->_gyro->_buffer[i]) && (_vm->_gyro->_buffer[i] <= 'Z')) -				_param = _vm->_gyro->_buffer[i] - 55; +			else if (('0' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= '9')) +				_param = _vm->_avalot->_buffer[i] - 48; +			else if (('A' <= _vm->_avalot->_buffer[i]) && (_vm->_avalot->_buffer[i] <= 'Z')) +				_param = _vm->_avalot->_buffer[i] - 55;  			mouthnext = false;  		} else { -			switch (_vm->_gyro->_buffer[i]) { +			switch (_vm->_avalot->_buffer[i]) {  			case kControlParagraph: -				if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) +				if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty()))  					break;  				if (call_spriterun) -					_vm->_lucerna->spriteRun(); +					_vm->_avalot->spriteRun();  				call_spriterun = false;  				drawScroll(&Avalanche::Dialogs::scrollModeNormal);  				reset(); -				if (_vm->_gyro->_scReturn) +				if (_vm->_avalot->_scReturn)  					return;  				break;  			case kControlBell: -				_vm->_gyro->_scrollBells++; +				_vm->_avalot->_scrollBells++;  				break; // #7 = "Bel"  			case kControlSpeechBubble: -				if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) +				if ((_vm->_avalot->_scrollNum == 1) && (_vm->_avalot->_scroll[0].empty()))  					break;  				if (call_spriterun) -					_vm->_lucerna->spriteRun(); +					_vm->_avalot->spriteRun();  				call_spriterun = false;  				if (_param == 0) @@ -691,7 +689,7 @@ void Dialogs::callDialogDriver() {  				else if ((1 <= _param) && (_param <= 9)) {  					AnimationType *spr = &_vm->_animation->_sprites[_param - 1];  					if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. -						_vm->_lucerna->errorLed(); +						_vm->_avalot->errorLed();  						setBubbleStateNatural();  					} else  						spr->chatter(); // Normal sprite talking routine. @@ -699,14 +697,14 @@ void Dialogs::callDialogDriver() {  					// Quasi-peds. (This routine performs the same  					// thing with QPs as triptype.chatter does with the  					// sprites.) -					PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed]; -					_vm->_gyro->_talkX = quasiPed->_x; -					_vm->_gyro->_talkY = quasiPed->_y; // Position. +					PedType *quasiPed = &_vm->_avalot->_peds[_vm->_avalot->kQuasipeds[_param - 10]._whichPed]; +					_vm->_avalot->_talkX = quasiPed->_x; +					_vm->_avalot->_talkY = quasiPed->_y; // Position. -					_vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; -					_vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. +					_vm->_avalot->_talkFontColor = _vm->_avalot->kQuasipeds[_param - 10]._foregroundColor; +					_vm->_avalot->_talkBackgroundColor = _vm->_avalot->kQuasipeds[_param - 10]._backgroundColor; // Colors.  				} else { -					_vm->_lucerna->errorLed(); // Not valid. +					_vm->_avalot->errorLed(); // Not valid.  					setBubbleStateNatural();  				} @@ -714,7 +712,7 @@ void Dialogs::callDialogDriver() {  				reset(); -				if (_vm->_gyro->_scReturn) +				if (_vm->_avalot->_scReturn)  					return;  				break; @@ -725,46 +723,46 @@ void Dialogs::callDialogDriver() {  					displayText(displayMoney() + kControlToBuffer); // Insert cash balance. (Recursion)  					break;  				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);  					}  					break;  				case 3: -					displayText(_vm->_gyro->_favouriteDrink + kControlToBuffer); +					displayText(_vm->_avalot->_favouriteDrink + kControlToBuffer);  					break;  				case 4: -					displayText(_vm->_gyro->_favouriteSong + kControlToBuffer); +					displayText(_vm->_avalot->_favouriteSong + kControlToBuffer);  					break;  				case 5: -					displayText(_vm->_gyro->_worstPlaceOnEarth + kControlToBuffer); +					displayText(_vm->_avalot->_worstPlaceOnEarth + kControlToBuffer);  					break;  				case 6: -					displayText(_vm->_gyro->_spareEvening + kControlToBuffer); +					displayText(_vm->_avalot->_spareEvening + kControlToBuffer);  					break;  				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);  					}  					break;  				case 10: -					switch (_vm->_gyro->_boxContent) { +					switch (_vm->_avalot->_boxContent) {  					case 0: // Sixpence.  						displayScrollChain('q', 37); // You find the sixpence. -						_vm->_gyro->_money += 6; -						_vm->_gyro->_boxContent = _vm->_parser->kNothing; -						_vm->_lucerna->incScore(2); +						_vm->_avalot->_money += 6; +						_vm->_avalot->_boxContent = _vm->_parser->kNothing; +						_vm->_avalot->incScore(2);  						return;  					case Parser::kNothing:  						displayText("nothing at all. It's completely empty.");  						break;  					default: -						displayText(_vm->_gyro->getItem(_vm->_gyro->_boxContent) + '.'); +						displayText(_vm->_avalot->getItem(_vm->_avalot->_boxContent) + '.');  					}  					break;  				case 11:  					for (int j = 0; j < kObjectNum; j++) { -						if (_vm->_gyro->_objects[j])  -							displayText(_vm->_gyro->getItem(j) + ", " + kControlToBuffer); +						if (_vm->_avalot->_objects[j])  +							displayText(_vm->_avalot->getItem(j) + ", " + kControlToBuffer);  					}  					break;  				} @@ -773,15 +771,15 @@ void Dialogs::callDialogDriver() {  				_useIcon = _param;  				break;  			case kControlNewLine: -				_vm->_gyro->_scrollNum++; +				_vm->_avalot->_scrollNum++;  				break;  			case kControlQuestion:  				if (call_spriterun) -					_vm->_lucerna->spriteRun(); +					_vm->_avalot->spriteRun();  				call_spriterun = false; -				_vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; -				_vm->_gyro->_scrollNum++; +				_vm->_avalot->_scroll[_vm->_avalot->_scrollNum] = kControlQuestion; +				_vm->_avalot->_scrollNum++;  				drawScroll(&Avalanche::Dialogs::scrollModeDialogue);  				reset(); @@ -791,14 +789,14 @@ void Dialogs::callDialogDriver() {  				break;  			case kControlInsertSpaces:  				for (int j = 0; j < 9; j++) -					_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' '; +					_vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1] += ' ';  				break;  			default: // Add new char. -				if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) { -					solidify(_vm->_gyro->_scrollNum - 1); -					_vm->_gyro->_scrollNum++; +				if (_vm->_avalot->_scroll[_vm->_avalot->_scrollNum - 1].size() == 50) { +					solidify(_vm->_avalot->_scrollNum - 1); +					_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;  			}  		} @@ -806,8 +804,8 @@ void Dialogs::callDialogDriver() {  }  void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A STRING!!!!!!!!!! -	_vm->_gyro->_bufSize = text.size(); -	memcpy(_vm->_gyro->_buffer, text.c_str(), _vm->_gyro->_bufSize); +	_vm->_avalot->_bufSize = text.size(); +	memcpy(_vm->_avalot->_buffer, text.c_str(), _vm->_avalot->_bufSize);  	callDialogDriver();  } @@ -832,7 +830,7 @@ void Dialogs::loadFont() {  		error("AVALANCHE: Scrolls: File not found: ttsmall.fnt");  	for (int16 i = 0; i < 256; i++) -		file.read(_vm->_gyro->_font[i],16); +		file.read(_vm->_avalot->_font[i],16);  	file.close();  } @@ -841,7 +839,7 @@ void Dialogs::displayMusicalScroll() {  		        kControlNewLine, kControlNewLine, kControlNewLine, kControlInsertSpaces, kControlNewLine, kControlNewLine, kControlToBuffer);  	displayText(tmpStr); -	_vm->_lucerna->spriteRun(); +	_vm->_avalot->spriteRun();  	CursorMan.showMouse(false);  	drawScroll(&Avalanche::Dialogs::scrollModeMusic);  	CursorMan.showMouse(true); @@ -851,13 +849,13 @@ void Dialogs::displayMusicalScroll() {  // From Visa:  void Dialogs::unSkrimble() { -	for (uint16  i = 0; i < _vm->_gyro->_bufSize; i++) -		_vm->_gyro->_buffer[i] = (~(_vm->_gyro->_buffer[i] - (i + 1))) % 256; +	for (uint16  i = 0; i < _vm->_avalot->_bufSize; i++) +		_vm->_avalot->_buffer[i] = (~(_vm->_avalot->_buffer[i] - (i + 1))) % 256;  }  void Dialogs::doTheBubble() { -	_vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; -	_vm->_gyro->_bufSize++; +	_vm->_avalot->_buffer[_vm->_avalot->_bufSize] = 2; +	_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");  	sezfile.seek(sez_offset); -	_vm->_gyro->_bufSize = sezfile.readUint16LE(); -	sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); +	_vm->_avalot->_bufSize = sezfile.readUint16LE(); +	sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize);  	sezfile.close();  	unSkrimble(); @@ -944,8 +942,8 @@ void Dialogs::speak(byte who, byte subject) {  		error("AVALANCHE: Visa: File not found: avalot.sez");  	sezfile.seek(sez_offset); -	_vm->_gyro->_bufSize = sezfile.readUint16LE(); -	sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize); +	_vm->_avalot->_bufSize = sezfile.readUint16LE(); +	sezfile.read(_vm->_avalot->_buffer, _vm->_avalot->_bufSize);  	sezfile.close();  	unSkrimble(); @@ -957,26 +955,26 @@ void Dialogs::speak(byte who, byte subject) {  void Dialogs::talkTo(byte whom) {  	if (_vm->_parser->_person == _vm->_parser->kPardon) { -		_vm->_parser->_person = _vm->_gyro->_subjectNum; -		_vm->_gyro->_subjectNum = 0; +		_vm->_parser->_person = _vm->_avalot->_subjectNum; +		_vm->_avalot->_subjectNum = 0;  	} -	if (_vm->_gyro->_subjectNum == 0) { +	if (_vm->_avalot->_subjectNum == 0) {  		switch (whom) { -		case Gyro::kPeopleSpludwick: -			if ((_vm->_gyro->_lustieIsAsleep) & (!_vm->_gyro->_objects[Gyro::kObjectPotion - 1])) { +		case Avalot::kPeopleSpludwick: +			if ((_vm->_avalot->_lustieIsAsleep) & (!_vm->_avalot->_objects[Avalot::kObjectPotion - 1])) {  				displayScrollChain('q', 68); -				_vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; -				_vm->_lucerna->refreshObjectList(); -				_vm->_lucerna->incScore(3); +				_vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true; +				_vm->_avalot->refreshObjectList(); +				_vm->_avalot->incScore(3);  				return; -			} else if (_vm->_gyro->_talkedToCrapulus) { +			} else if (_vm->_avalot->_talkedToCrapulus) {  				// Spludwick - what does he need?  				// 0 - let it through to use normal routine. -				switch (_vm->_gyro->_givenToSpludwick) { +				switch (_vm->_avalot->_givenToSpludwick) {  				case 1: // Fallthrough is intended.  				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);  					displayText(tmpStr);  					} @@ -990,57 +988,57 @@ void Dialogs::talkTo(byte whom) {  				return;  			}  			break; -		case Gyro::kPeopleIbythneth: -			if (_vm->_gyro->_givenBadgeToIby) { +		case Avalot::kPeopleIbythneth: +			if (_vm->_avalot->_givenBadgeToIby) {  				displayScrollChain('q', 33); // Thanks a lot!  				return; // And leave the proc.  			}  			break; // Or... just continue, 'cos he hasn't got it. -		case Gyro::kPeopleDogfood: -			if (_vm->_gyro->_wonNim) { // We've won the game. +		case Avalot::kPeopleDogfood: +			if (_vm->_avalot->_wonNim) { // We've won the game.  				displayScrollChain('q', 6); // "I'm Not Playing!"  				return; // Zap back.  			} else -				_vm->_gyro->_askedDogfoodAboutNim = true; +				_vm->_avalot->_askedDogfoodAboutNim = true;  			break; -		case Gyro::kPeopleAyles: -			if (!_vm->_gyro->_aylesIsAwake) { +		case Avalot::kPeopleAyles: +			if (!_vm->_avalot->_aylesIsAwake) {  				displayScrollChain('q', 43); // He's fast asleep!  				return; -			} else if (!_vm->_gyro->_givenPenToAyles) { +			} else if (!_vm->_avalot->_givenPenToAyles) {  				displayScrollChain('q', 44); // Can you get me a pen, Avvy?  				return;  			}  			break; -		case Gyro::kPeopleJacques: +		case Avalot::kPeopleJacques:  			displayScrollChain('q', 43);  			return; -		case Gyro::kPeopleGeida: -			if (_vm->_gyro->_givenPotionToGeida) -				_vm->_gyro->_geidaFollows = true; +		case Avalot::kPeopleGeida: +			if (_vm->_avalot->_givenPotionToGeida) +				_vm->_avalot->_geidaFollows = true;  			else {  				displayScrollChain('u', 17);  				return;  			}  			break; -		case Gyro::kPeopleSpurge: -			if (!_vm->_gyro->_sittingInPub) { +		case Avalot::kPeopleSpurge: +			if (!_vm->_avalot->_sittingInPub) {  				displayScrollChain('q', 71); // Try going over and sitting down.  				return;  			} else { -				if (_vm->_gyro->_spurgeTalkCount < 5) -					_vm->_gyro->_spurgeTalkCount++; -				if (_vm->_gyro->_spurgeTalkCount > 1) { // no. 1 falls through -					displayScrollChain('q', 70 + _vm->_gyro->_spurgeTalkCount); +				if (_vm->_avalot->_spurgeTalkCount < 5) +					_vm->_avalot->_spurgeTalkCount++; +				if (_vm->_avalot->_spurgeTalkCount > 1) { // no. 1 falls through +					displayScrollChain('q', 70 + _vm->_avalot->_spurgeTalkCount);  					return;  				}  			}  			break;  		}  	// 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!  		return;  	} @@ -1063,23 +1061,23 @@ void Dialogs::talkTo(byte whom) {  		displayText(tmpStr);  	} -	speak(whom, _vm->_gyro->_subjectNum); +	speak(whom, _vm->_avalot->_subjectNum);  	if (!_noError)  		displayScrollChain('n', whom); // File not found! -	if ((_vm->_gyro->_subjectNum == 0) && ((whom + 149) == Gyro::kPeopleCrapulus)) { // Crapulus: get the badge - first time only -		_vm->_gyro->_objects[Gyro::kObjectBadge - 1] = true; -		_vm->_lucerna->refreshObjectList(); +	if ((_vm->_avalot->_subjectNum == 0) && ((whom + 149) == Avalot::kPeopleCrapulus)) { // Crapulus: get the badge - first time only +		_vm->_avalot->_objects[Avalot::kObjectBadge - 1] = true; +		_vm->_avalot->refreshObjectList();  		displayScrollChain('q', 1); // Circular from Cardiff. -		_vm->_gyro->_talkedToCrapulus = true; -		_vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off. +		_vm->_avalot->_talkedToCrapulus = true; +		_vm->_avalot->_whereIs[Avalot::kPeopleCrapulus - 150] = kRoomDummy; // Crapulus walks off.  		AnimationType *spr = &_vm->_animation->_sprites[1];  		spr->_vanishIfStill = true;  		spr->walkTo(2); // Walks away. -		_vm->_lucerna->incScore(2); +		_vm->_avalot->incScore(2);  	}  } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp deleted file mode 100644 index 99608399d8..0000000000 --- a/engines/avalanche/gyro.cpp +++ /dev/null @@ -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 diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h deleted file mode 100644 index 99fe6f7142..0000000000 --- a/engines/avalanche/gyro.h +++ /dev/null @@ -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 diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp deleted file mode 100644 index 88c13571a0..0000000000 --- a/engines/avalanche/lucerna.cpp +++ /dev/null @@ -1,1224 +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.*/ - -#include "avalanche/avalanche.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h" -#include "avalanche/dialogs.h" -#include "avalanche/timer.h" -#include "avalanche/animation.h" -#include "avalanche/background.h" -#include "avalanche/pingo.h" -#include "avalanche/sequence.h" - -#include "common/rect.h" -#include "common/system.h" - -#include "graphics/palette.h" - -namespace Avalanche { - -Clock::Clock(AvalancheEngine *vm) { -	_vm = vm; -	_oldHour = _oldHourAngle = _oldMinute = 17717; -} - -void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. -	TimeDate t; -	_vm->_system->getTimeAndDate(t); -	_hour = t.tm_hour; -	_minute = t.tm_min; -	_second = t.tm_sec; - -	_hourAngle = (_hour % 12) * 30 + _minute / 2; - -	if (_oldHour != _hour)  { -		plotHands(); -		chime(); -	} - -	if (_oldMinute != _minute) -		plotHands(); - -	if ((_hour == 0) && (_oldHour != 0) && (_oldHour != 17717)) { -		Common::String tmpStr = Common::String::format("Good morning!%c%cYes, it's just past " \ -			"midnight. Are you having an all-night Avvy session? Glad you like the game that much!",  -			Dialogs::kControlNewLine, Dialogs::kControlNewLine); -		_vm->_dialogs->displayText(tmpStr); -	} -	_oldHour = _hour; -	_oldHourAngle = _hourAngle; -	_oldMinute = _minute; -} - -void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, byte color) { -	if (angle > 900) { -		endPoint.x = 177; -		return; -	} - -	endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); -} - -void Clock::drawHand(const Common::Point &endPoint, byte color) { -	if (endPoint.x == 177) -		return; - -	_vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color); -} - -void Clock::plotHands() { -	calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); -	calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); -	drawHand(_clockHandHour, kColorBrown); -	drawHand(_clockHandMinute, kColorBrown); - -	calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); -	calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); -	drawHand(_clockHandHour, kColorYellow); -	drawHand(_clockHandMinute, kColorYellow); -} - -void Clock::chime() { -	warning("STUB: Clock::chime()"); -} - -Lucerna::Lucerna(AvalancheEngine *vm) : _fxHidden(false), _clock(vm) { -	_vm = vm; -} - -Lucerna::~Lucerna() { -	for (int i = 0; i < 31; i++) { -		for (int j = 0; j < 2; j++) { -			if (_vm->_gyro->_also[i][j] != 0)  { -				delete _vm->_gyro->_also[i][j]; -				_vm->_gyro->_also[i][j] = 0; -			} -		} -	} -} - -void Lucerna::init() { -	for (int i = 0; i < 31; i++) { -		for (int j = 0; j < 2; j++) -			_vm->_gyro->_also[i][j] = 0; -	} - -#if 0 -	if (_vm->_enhanced->atbios) -		_vm->_gyro->atkey = "f1"; -	else -		_vm->_gyro->atkey = "alt-"; -#endif -} - -/** - * Call a given Verb - * @remarks	Originally called 'callverb' - */ -void Lucerna::callVerb(byte id) { -	if (id == _vm->_parser->kPardon) { -		Common::String tmpStr = Common::String::format("The f5 key lets you do a particular action in certain " \ -			"situations. However, at the moment there is nothing assigned to it. You may press alt-A to see " \ -			"what the current setting of this key is."); -		_vm->_dialogs->displayText(tmpStr); -	} else { -		_vm->_gyro->_weirdWord = false; -		_vm->_parser->_polite = true; -		_vm->_parser->_verb = id; -		_vm->_parser->doThat(); -	} -} - -void Lucerna::drawAlsoLines() { -	CursorMan.showMouse(false); - -	_vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); -	_vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - -	for (int i = 0; i < _vm->_gyro->_lineNum; i++) { -		// We had to check if the lines are within the borders of the screen. -		if ((_vm->_gyro->_lines[i]._x1 >= 0) && (_vm->_gyro->_lines[i]._x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y1 >= 0) && (_vm->_gyro->_lines[i]._y1 < _vm->_graphics->kScreenHeight) -		 && (_vm->_gyro->_lines[i]._x2 >= 0) && (_vm->_gyro->_lines[i]._x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->_lines[i]._y2 >= 0) && (_vm->_gyro->_lines[i]._y2 < _vm->_graphics->kScreenHeight)) -			_vm->_graphics->_magics.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i]._color); -	} - -	CursorMan.showMouse(true); -} - -/** - * Check is it's possible to give something to Spludwick - * @remarks	Originally called 'nextstring' - */ -Common::String Lucerna::readAlsoStringFromFile() { -	Common::String str; -	byte length = file.readByte(); -	for (int i = 0; i < length; i++) -		str += file.readByte(); -	return str; -} - -void Lucerna::scram(Common::String &str) { -	for (uint i = 0; i < str.size(); i++) -		str.setChar(str[i] ^ 177, i); -} - -void Lucerna::unScramble() { -	for (int i = 0; i < 31; i++) { -		for (int j = 0; j < 2; j++) { -			if (_vm->_gyro->_also[i][j] != 0) -				scram(*_vm->_gyro->_also[i][j]); -		} -	} -	scram(_vm->_gyro->_listen); -	scram(_vm->_gyro->_flags); -} - -void Lucerna::loadAlso(byte num) { -	for (int i = 0; i < 31; i++) { -		for (int j = 0; j < 2; j++) { -			if (_vm->_gyro->_also[i][j] != 0)  { -				delete _vm->_gyro->_also[i][j]; -				_vm->_gyro->_also[i][j] = 0; -			} -		} -	} -	Common::String filename; -	filename = Common::String::format("also%d.avd", num); -	if (!file.open(filename)) -		error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); - -	file.seek(128); - -	byte alsoNum = file.readByte(); -	Common::String tmpStr; -	for (int i = 0; i <= alsoNum; i++) { -		for (int j = 0; j < 2; j++) { -			_vm->_gyro->_also[i][j] = new Common::String; -			*_vm->_gyro->_also[i][j] = readAlsoStringFromFile(); -		} -		tmpStr = Common::String::format("\x9D%s\x9D", _vm->_gyro->_also[i][0]->c_str()); -		*_vm->_gyro->_also[i][0] = tmpStr; -	} - -	memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); - -	_vm->_gyro->_lineNum = file.readByte(); -	for (int i = 0; i < _vm->_gyro->_lineNum; i++) { -		LineType *curLine = &_vm->_gyro->_lines[i]; -		curLine->_x1 = file.readSint16LE(); -		curLine->_y1 = file.readSint16LE(); -		curLine->_x2 = file.readSint16LE(); -		curLine->_y2 = file.readSint16LE(); -		curLine->_color = file.readByte(); -	} - -	memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); -	byte pedNum = file.readByte(); -	for (int i = 0; i < pedNum; i++) { -		PedType *curPed = &_vm->_gyro->_peds[i]; -		curPed->_x = file.readSint16LE(); -		curPed->_y = file.readSint16LE(); -		curPed->_direction = file.readByte(); -	} - -	_vm->_gyro->_fieldNum = file.readByte(); -	for (int i = 0; i < _vm->_gyro->_fieldNum; i++) { -		FieldType *curField = &_vm->_gyro->_fields[i]; -		curField->_x1 = file.readSint16LE(); -		curField->_y1 = file.readSint16LE(); -		curField->_x2 = file.readSint16LE(); -		curField->_y2 = file.readSint16LE(); -	} - -	for (int i = 0; i < 15; i++) { -		MagicType *magic = &_vm->_gyro->_magics[i]; -		magic->_operation = file.readByte(); -		magic->_data = file.readUint16LE(); -	} - -	for (int i = 0; i < 7; i++) { -		MagicType *portal = &_vm->_gyro->_portals[i]; -		portal->_operation = file.readByte(); -		portal->_data = file.readUint16LE(); -	} - -	_vm->_gyro->_flags.clear(); -	for (int i = 0;  i < 26; i++) -		_vm->_gyro->_flags += file.readByte(); - -	int16 listen_length = file.readByte(); -	_vm->_gyro->_listen.clear(); -	for (int i = 0; i < listen_length; i++) -		_vm->_gyro->_listen += file.readByte(); - -	drawAlsoLines(); - -	file.close(); -	unScramble(); -	for (int i = 0; i <= alsoNum; i++) { -		tmpStr = Common::String::format(",%s,", _vm->_gyro->_also[i][0]->c_str()); -		*_vm->_gyro->_also[i][0] = tmpStr; -	} -} - -void Lucerna::loadRoom(byte num) { -	CursorMan.showMouse(false); - -	_vm->_graphics->fleshColors(); - -	Common::String filename = Common::String::format("place%d.avd", num); -	if (!file.open(filename)) -		error("AVALANCHE: Lucerna: File not found: %s", filename.c_str()); - -	file.seek(146); -	if (!_vm->_gyro->_roomnName.empty()) -		_vm->_gyro->_roomnName.clear(); -	for (int i = 0; i < 30; i++) { -		char actChar = file.readByte(); -		if ((32 <= actChar) && (actChar <= 126)) -			_vm->_gyro->_roomnName += actChar; -	} -	// Compression method byte follows this... - -	file.seek(177); - -	_vm->_graphics->_background = _vm->_graphics->loadPictureRow(file, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); -	_vm->_graphics->refreshBackground(); - -	file.close(); - -	loadAlso(num); -	_vm->_background->loadBackgroundSprites(num); -	CursorMan.showMouse(true); -} - -void Lucerna::zoomOut(int16 x, int16 y) { -	warning("STUB: Lucerna::zoomout()"); -} - -void Lucerna::findPeople(byte room) { -	for (int i = 1; i < 29; i++) { -		if (_vm->_gyro->_whereIs[i] == room) { -			if (i < 25) -				_vm->_gyro->_him = i + 150; -			else -				_vm->_gyro->_her = i + 150; -		} -	} -} - -void Lucerna::exitRoom(byte x) { -	_vm->_sound->stopSound(); -	_vm->_background->forgetBackgroundSprites(); -	_vm->_gyro->_seeScroll = true;  // This stops the trippancy system working over the length of this procedure. - -	switch (x) { -	case kRoomSpludwicks: -		_vm->_timer->loseTimer(Timer::kReasonAvariciusTalks); -		 _vm->_gyro->_avariciusTalk = 0; -		// He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. -		break; -	case kRoomBridge: -		if (_vm->_gyro->_drawbridgeOpen > 0) { -			_vm->_gyro->_drawbridgeOpen = 4; // Fully open. -			_vm->_timer->loseTimer(Timer::kReasonDrawbridgeFalls); -		} -		break; -	case kRoomOutsideCardiffCastle: -		_vm->_timer->loseTimer(Timer::kReasonCardiffsurvey); -		break; -	case kRoomRobins: -		_vm->_timer->loseTimer(Timer::kReasonGettingTiedUp); -		break; -	} - -	_vm->_gyro->_interrogation = 0; // Leaving the room cancels all the questions automatically. -	_vm->_gyro->_seeScroll = false; // Now it can work again! - -	_vm->_gyro->_lastRoom = _vm->_gyro->_room; -	if (_vm->_gyro->_room != kRoomMap) -		_vm->_gyro->_lastRoomNotMap = _vm->_gyro->_room; -} - - -/** - * Only when entering a NEW town! Not returning to the last one, - * but choosing another from the map. - * @remarks	Originally called 'new_town' - */ -void Lucerna::enterNewTown() { -	_vm->_menu->setup(); - -	switch (_vm->_gyro->_room) { -	case kRoomOutsideNottsPub: // Entry into Nottingham. -		if ((_vm->_gyro->_roomCount[kRoomRobins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) -			_vm->_gyro->_mushroomGrowing = true; -		break; -	case kRoomWiseWomans: // Entry into Argent. -		if (_vm->_gyro->_talkedToCrapulus && (!_vm->_gyro->_lustieIsAsleep)) { -			_vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[kRoomWiseWomans] % 3) == 1); -			_vm->_gyro->_crapulusWillTell = !_vm->_gyro->_spludwickAtHome; -		} else { -			_vm->_gyro->_spludwickAtHome = true; -			_vm->_gyro->_crapulusWillTell = false; -		} -		if (_vm->_gyro->_boxContent == Gyro::kObjectWine) -			_vm->_gyro->_wineState = 3; // Vinegar -		break; -	} - -	if (_vm->_gyro->_room != kRoomOutsideDucks) { -		if ((_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) && !(_vm->_gyro->_onionInVinegar)) -			_vm->_gyro->_rottenOnion = true; // You're holding the onion -	} -} - -void Lucerna::putGeidaAt(byte whichPed, byte ped) { -	if (ped == 0) -		return; -	AnimationType *spr1 = &_vm->_animation->_sprites[1]; - -	spr1->init(5, false, _vm->_animation); // load Geida -	_vm->_animation->appearPed(1, whichPed); -	spr1->_callEachStepFl = true; -	spr1->_eachStepProc = Animation::kProcGeida; -} - -void Lucerna::enterRoom(byte room, byte ped) { -	_vm->_gyro->_seeScroll = true;  // This stops the trippancy system working over the length of this procedure. - -	findPeople(room); -	_vm->_gyro->_room = room; -	if (ped != 0) -		_vm->_gyro->_roomCount[room]++; - -	loadRoom(room); - -	if ((_vm->_gyro->_roomCount[room] == 0) && (!_vm->_gyro->setFlag('S'))) -		incScore(1); - -	_vm->_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _vm->_gyro->_room; - -	if (_vm->_gyro->_geidaFollows) -		_vm->_gyro->_whereIs[Gyro::kPeopleGeida - 150] = room; - -	_vm->_gyro->_roomTime = 0; - - -	if ((_vm->_gyro->_lastRoom == kRoomMap) && (_vm->_gyro->_lastRoomNotMap != _vm->_gyro->_room)) -		enterNewTown(); - -	switch (room) { -	case kRoomYours: -		if (_vm->_gyro->_avvyInBed) { -			_vm->_background->drawBackgroundSprite(-1, -1, 2); -			_vm->_graphics->refreshBackground(); -			_vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts); -		} -		break; - -	case kRoomOutsideYours: -		if (ped > 0) { -			AnimationType *spr1 = &_vm->_animation->_sprites[1]; -			if (!_vm->_gyro->_talkedToCrapulus) { -				_vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomOutsideYours; -				spr1->init(8, false, _vm->_animation); // load Crapulus - -				if (_vm->_gyro->_roomCount[kRoomOutsideYours] == 1) { -					_vm->_animation->appearPed(1, 3); // Start on the right-hand side of the screen. -					spr1->walkTo(4); // Walks up to greet you. -				} else { -					_vm->_animation->appearPed(1, 4); // Starts where he was before. -					spr1->_facingDir = Animation::kDirLeft; -				} - -				spr1->_callEachStepFl = true; -				spr1->_eachStepProc = Animation::kProcFaceAvvy; // He always faces Avvy. - -			} else -				_vm->_gyro->_whereIs[Gyro::kPeopleCrapulus - 150] = kRoomNowhere; - -			if (_vm->_gyro->_crapulusWillTell) { -				spr1->init(8, false, _vm->_animation); -				_vm->_animation->appearPed(1, 1); -				spr1->walkTo(3); -				_vm->_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); -				_vm->_gyro->_crapulusWillTell = false; -			} -		} -		break; - -	case kRoomOutsideSpludwicks: -		if ((_vm->_gyro->_roomCount[kRoomOutsideSpludwicks] == 1) && (ped == 1)) { -			_vm->_timer->addTimer(20, Timer::kProcBang, Timer::kReasonExplosion); -			_vm->_gyro->_spludwickAtHome = true; -		} -		break; - -	case kRoomSpludwicks: -		if (_vm->_gyro->_spludwickAtHome) { -			AnimationType *spr1 = &_vm->_animation->_sprites[1]; -			if (ped > 0) { -				spr1->init(2, false, _vm->_animation); // load Spludwick -				_vm->_animation->appearPed(1, 1); -				_vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomSpludwicks; -			} - -			spr1->_callEachStepFl = true; -			spr1->_eachStepProc = Animation::kProcGeida; -		} else -			_vm->_gyro->_whereIs[Gyro::kPeopleSpludwick - 150] = kRoomNowhere; -		break; - -	case kRoomBrummieRoad: -		if (_vm->_gyro->_geidaFollows) -			putGeidaAt(4, ped); -		if (_vm->_gyro->_cwytalotGone) { -			_vm->_gyro->_magics[kColorLightred - 1]._operation = Gyro::kMagicNothing; -			_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomNowhere; -		} else { -			if (ped > 0) { -				AnimationType *spr1 = &_vm->_animation->_sprites[1]; -				spr1->init(4, false, _vm->_animation); // 4 = Cwytalot -				spr1->_callEachStepFl = true; -				spr1->_eachStepProc = Animation::kProcFollowAvvyY; -				_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomBrummieRoad; - -				if (_vm->_gyro->_roomCount[kRoomBrummieRoad] == 1) { // First time here... -					_vm->_animation->appearPed(1, 1); // He appears on the right of the screen... -					spr1->walkTo(3); // ...and he walks up... -				} else { -					// You've been here before. -					_vm->_animation->appearPed(1, 3); // He's standing in your way straight away... -					spr1->_facingDir = Animation::kDirLeft; -				} -			} -		} -		break; - -	case kRoomArgentRoad: -		if ((_vm->_gyro->_cwytalotGone) && (!_vm->_gyro->_passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_roomCount[kRoomArgentRoad] > 3)) { -			AnimationType *spr1 = &_vm->_animation->_sprites[1]; -			spr1->init(4, false, _vm->_animation); // 4 = Cwytalot again -			_vm->_animation->appearPed(1, 0); -			spr1->walkTo(1); -			spr1->_vanishIfStill = true; -			_vm->_gyro->_passedCwytalotInHerts = true; -			// _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? -			_vm->_timer->addTimer(20, Timer::kProcCwytalotInHerts, Timer::kReasonCwytalotInHerts); -		} -		break; - -	case kRoomBridge: -		if (_vm->_gyro->_drawbridgeOpen == 4) { // open -			_vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge -			_vm->_graphics->refreshBackground(); -			_vm->_gyro->_magics[kColorGreen - 1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. -		} -		if (_vm->_gyro->_geidaFollows) -			putGeidaAt(ped + 2, ped); // load Geida -		break; - -	case kRoomRobins: -		if (ped > 0) { -			if (!_vm->_gyro->_beenTiedUp) { -				// A welcome party... or maybe not... -				AnimationType *spr1 = &_vm->_animation->_sprites[1]; -				spr1->init(6, false, _vm->_animation); -				_vm->_animation->appearPed(1, 1); -				spr1->walkTo(2); -				_vm->_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); -			} -		} - -		if (_vm->_gyro->_beenTiedUp) { -			_vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = 0; -			_vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = 0; -		} - -		if (_vm->_gyro->_tiedUp) -			_vm->_background->drawBackgroundSprite(-1, -1, 1); - -		if (!_vm->_gyro->_mushroomGrowing) -			_vm->_background->drawBackgroundSprite(-1, -1, 2); -		_vm->_graphics->refreshBackground(); -		break; - -	case kRoomOutsideCardiffCastle: -		if (ped > 0) { -			AnimationType *spr1 = &_vm->_animation->_sprites[1]; -			switch (_vm->_gyro->_cardiffQuestionNum) { -			case 0 : // You've answered NONE of his questions. -				spr1->init(9, false, _vm->_animation); -				_vm->_animation->appearPed(1, 1); -				spr1->walkTo(2); -				_vm->_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); -				break; -			case 5 : -				_vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; -				break; // You've answered ALL his questions. => nothing happens. -			default: // You've answered SOME of his questions. -				spr1->init(9, false, _vm->_animation); -				_vm->_animation->appearPed(1, 2); -				spr1->_facingDir = Animation::kDirRight; -				_vm->_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); -			} -		} - -		if (_vm->_gyro->_cardiffQuestionNum < 5) -			_vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; -		else -			_vm->_gyro->_interrogation = 0; -		break; - -	case kRoomMap: -		// You're entering the map. -		dawn(); -		if (ped > 0) -			zoomOut(_vm->_gyro->_peds[ped]._x, _vm->_gyro->_peds[ped]._y); - -		if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { -			_vm->_dialogs->displayScrollChain('q', 9); // Don't want to waste the wine! -			_vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; -			refreshObjectList(); -		} - -		_vm->_dialogs->displayScrollChain('q', 69); -		break; - -	case kRoomCatacombs: -		if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { - -			switch (ped) { -			case 3: // Enter from oubliette -				_vm->_gyro->_catacombX = 8; -				_vm->_gyro->_catacombY = 4; -				break; -			case 5: // Enter from du Lustie's -				_vm->_gyro->_catacombX = 8; -				_vm->_gyro->_catacombY = 7; -				break; -			case 6: // Enter from Geida's -				_vm->_gyro->_catacombX = 4; -				_vm->_gyro->_catacombY = 1; -				break; -			} - -			_vm->_gyro->_enterCatacombsFromLustiesRoom = true; -			_vm->_animation->catacombMove(ped); -			_vm->_gyro->_enterCatacombsFromLustiesRoom = false; -		} -		break; - -	case kRoomArgentPub: -		if (_vm->_gyro->_wonNim) -			_vm->_background->drawBackgroundSprite(-1, -1, 0);   // No lute by the settle. -		_vm->_gyro->_malagauche = 0; // Ready to boot Malagauche -		if (_vm->_gyro->_givenBadgeToIby) { -			_vm->_background->drawBackgroundSprite(-1, -1, 7); -			_vm->_background->drawBackgroundSprite(-1, -1, 8); -		} -		_vm->_graphics->refreshBackground(); -		break; - -	case kRoomLustiesRoom: -		_vm->_gyro->_npcFacing = 1; // du Lustie. -		if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes -			_vm->_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks); -		else if (!_vm->_gyro->_enteredLustiesRoomAsMonk) // already -			// Presumably, Avvy dressed as a monk. -			_vm->_timer->addTimer(3, Timer::kProcGreetsMonk, Timer::kReasonDuLustieTalks); - -		if (_vm->_gyro->_geidaFollows) { -			putGeidaAt(4, ped); -			if (_vm->_gyro->_lustieIsAsleep) { -				_vm->_background->drawBackgroundSprite(-1, -1, 4); -				_vm->_graphics->refreshBackground(); -			} -		} -		break; - -	case kRoomMusicRoom: -		if (_vm->_gyro->_jacquesState > 0) { -			_vm->_gyro->_jacquesState = 5; -			_vm->_background->drawBackgroundSprite(-1, -1, 1); -			_vm->_graphics->refreshBackground(); -			_vm->_background->drawBackgroundSprite(-1, -1, 3); -			_vm->_gyro->_magics[kColorBrown - 1]._operation = Gyro::kMagicNothing; -			_vm->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; -		} -		if (ped != 0) { -			_vm->_background->drawBackgroundSprite(-1, -1, 5); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(6); -			_vm->_sequence->thenShow(5); -			_vm->_sequence->thenShow(7); -			_vm->_sequence->startToClose(); -		} -		break; - -	case kRoomOutsideNottsPub: -		if (ped == 2) { -			_vm->_background->drawBackgroundSprite(-1, -1, 2); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(3); -			_vm->_sequence->thenShow(2); -			_vm->_sequence->thenShow(1); -			_vm->_sequence->thenShow(4); -			_vm->_sequence->startToClose(); -		} -		break; - -	case kRoomOutsideArgentPub: -		if (ped == 2)  { -			_vm->_background->drawBackgroundSprite(-1, -1, 5); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(6); -			_vm->_sequence->thenShow(5); -			_vm->_sequence->thenShow(7); -			_vm->_sequence->startToClose(); -		} -		break; - -	case kRoomWiseWomans: { -		AnimationType *spr1 = &_vm->_animation->_sprites[1]; -		spr1->init(11, false, _vm->_animation); -		if ((_vm->_gyro->_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) { -			_vm->_animation->appearPed(1, 1); // Start on the right-hand side of the screen. -			spr1->walkTo(3); // Walks up to greet you. -		} else { -			_vm->_animation->appearPed(1, 3); // Starts where she was before. -			spr1->_facingDir = Animation::kDirLeft; -		} - -		spr1->_callEachStepFl = true; -		spr1->_eachStepProc = Animation::kProcFaceAvvy; // She always faces Avvy. -		} -		break; - -	case kRoomInsideCardiffCastle: -		if (ped > 0) { -			_vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart. -			_vm->_background->drawBackgroundSprite(-1, -1, 0); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(1); -			if (_vm->_gyro->_arrowInTheDoor) -				_vm->_sequence->thenShow(3); -			else -				_vm->_sequence->thenShow(2); - -			if (_vm->_gyro->_takenPen) -				_vm->_background->drawBackgroundSprite(-1, -1, 3); - -			_vm->_sequence->startToClose(); -		} else { -			_vm->_background->drawBackgroundSprite(-1, -1, 0); -			if (_vm->_gyro->_arrowInTheDoor) -				_vm->_background->drawBackgroundSprite(-1, -1, 2); -			else -				_vm->_background->drawBackgroundSprite(-1, -1, 1); -			_vm->_graphics->refreshBackground(); -		} -		break; - -	case kRoomAvvysGarden: -		if (ped == 1)  { -			_vm->_background->drawBackgroundSprite(-1, -1, 1); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(2); -			_vm->_sequence->thenShow(1); -			_vm->_sequence->thenShow(3); -			_vm->_sequence->startToClose(); -		} -		break; - -	case kRoomEntranceHall: -	case kRoomInsideAbbey: -	case kRoomYourHall: -		if (ped == 2)  { -#if 0 -			// It was the original: -			_vm->_celer->show_one(-1, -1, 2); -			_vm->_sequence->first_show(1); -			_vm->_sequence->then_show(3); -			_vm->_sequence->start_to_close(); -#endif - -			_vm->_background->drawBackgroundSprite(-1, -1, 1); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(2); -			_vm->_sequence->thenShow(1); -			_vm->_sequence->thenShow(3); -			_vm->_sequence->startToClose(); -		} -		break; - -	case kRoomAylesOffice: -		if (_vm->_gyro->_aylesIsAwake) -			_vm->_background->drawBackgroundSprite(-1, -1, 1); -		_vm->_graphics->refreshBackground(); -		break; // Ayles awake. - -	case kRoomGeidas: -		putGeidaAt(1, ped); -		break; // load Geida - -	case kRoomEastHall: -	case kRoomWestHall: -		if (_vm->_gyro->_geidaFollows) -			putGeidaAt(ped + 1, ped); -		break; - -	case kRoomLusties: -		if (_vm->_gyro->_geidaFollows) -			putGeidaAt(ped + 5, ped); -		break; - -	case kRoomNottsPub: -		if (_vm->_gyro->_sittingInPub) -			_vm->_background->drawBackgroundSprite(-1, -1, 2); -		_vm->_gyro->_npcFacing = 1; // Port. -		break; - -	case kRoomOutsideDucks: -		if (ped == 2) { -			// Shut the door -			_vm->_background->drawBackgroundSprite(-1, -1, 2); -			_vm->_graphics->refreshBackground(); -			_vm->_sequence->firstShow(3); -			_vm->_sequence->firstShow(2); -			_vm->_sequence->thenShow(1); -			_vm->_sequence->thenShow(4); -			_vm->_sequence->startToClose(); -		} -		break; - -	case kRoomDucks: -		_vm->_gyro->_npcFacing = 1; // Duck. -		break;  -	} - -	_vm->_gyro->_seeScroll = false; // Now it can work again! -	_vm->_gyro->_isLoaded = false; -} - -void Lucerna::thinkAbout(byte object, bool type) { -	const int16 picSize = 966; - -	_vm->_gyro->_thinks = object; -	object--; - -	_vm->_gyro->setMousePointerWait(); - -	if (type == Gyro::kThing) { -		if (!file.open("thinks.avd")) -			error("AVALANCHE: Lucerna: File not found: thinks.avd"); -	} else { // Gyro::kPerson -		if (!file.open("folk.avd")) -			error("AVALANCHE: Lucerna: File not found: folk.avd"); - -		object -= 149; -		if (object >= 25) -			object -= 8; -		if (object == 20) -			object--; // Last time... -	} - -	CursorMan.showMouse(false); - -	file.seek(object * picSize + 65); -	::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); -	_vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170); - -	picture.free(); -	file.close(); - -	CursorMan.showMouse(true); -	_vm->_gyro->_thinkThing = type; -} - -void Lucerna::loadDigits() {   // Load the scoring digits & rwlites -	const byte digitsize = 134; -	const byte rwlitesize = 126; - -	if (!file.open("digit.avd")) -		error("AVALANCHE: Lucerna: File not found: digit.avd"); - -	for (int i = 0; i < 10; i++) { -		file.seek(i * digitsize); -		_vm->_gyro->_digits[i] = _vm->_graphics->loadPictureGraphic(file); -	} - -	for (int i = 0; i < 9; i++) { -		file.seek(10 * digitsize + i * rwlitesize); -		_vm->_gyro->_directions[i] = _vm->_graphics->loadPictureGraphic(file); -	} - -	file.close(); -} - -void Lucerna::drawToolbar() { -	if (!file.open("useful.avd")) -		error("AVALANCHE: Lucerna: File not found: useful.avd"); - -	file.seek(40); - -	CursorMan.showMouse(false); -	::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file); -	_vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169); - -	picture.free(); -	file.close(); - -	CursorMan.showMouse(true); -	_vm->_animation->_oldDirection = 177; -	drawDirection(); -} - -void Lucerna::drawScore() { -	uint16 score = _vm->_gyro->_dnascore; -	int8 numbers[3] = {0, 0, 0}; -	for (int i = 0; i < 2; i++) { -		byte divisor = 1; -		for (int j = 0; j < (2 - i); j++) -			divisor *= 10; -		numbers[i] = score / divisor; -		score -= numbers[i] * divisor; -	} -	numbers[2] = score; - -	CursorMan.showMouse(false); - -	for (int i = 0; i < 3; i++) { -		if (_vm->_gyro->_scoreToDisplay[i] != numbers[i]) -			_vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_digits[numbers[i]], 250 + (i + 1) * 15, 177); -	} - -	CursorMan.showMouse(true); - -	for (int i = 0; i < 3; i++) -		_vm->_gyro->_scoreToDisplay[i] = numbers[i]; -} - -void Lucerna::incScore(byte num) {     -	for (int i = 1; i <= num; i++) { -		_vm->_gyro->_dnascore++; - -//		if (soundfx) { -			for (int j = 1; j <= 97; j++) -				// Length os 2 is a guess, the original doesn't have a delay specified -				_vm->_sound->playNote(177 + _vm->_gyro->_dnascore * 3, 2); -//		} -	} -	warning("STUB: Lucerna::points()"); - -	drawScore(); -} - -void Lucerna::useCompass(const Common::Point &cursorPos) { -	byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); - -	switch (color) { -	case kColorGreen: -		_vm->_animation->_direction = Animation::kDirUp; -		_vm->_animation->changeDirection(0, Animation::kDirUp); -		drawDirection(); -		break; -	case kColorBrown: -		_vm->_animation->_direction = Animation::kDirDown; -		_vm->_animation->changeDirection(0, Animation::kDirDown); -		drawDirection(); -		break; -	case kColorCyan: -		_vm->_animation->_direction = Animation::kDirLeft; -		_vm->_animation->changeDirection(0, Animation::kDirLeft); -		drawDirection(); -		break; -	case kColorLightmagenta: -		_vm->_animation->_direction = Animation::kDirRight; -		_vm->_animation->changeDirection(0, Animation::kDirRight); -		drawDirection(); -		break; -	case kColorRed: -	case kColorWhite: -	case kColorLightcyan: -	case kColorYellow: // Fall-throughs are intended. -		_vm->_animation->stopWalking(); -		drawDirection(); -		break; -	} -} - -void Lucerna::fxToggle() { -	warning("STUB: Lucerna::fxtoggle()"); -} - -void Lucerna::refreshObjectList() { -	_vm->_gyro->_carryNum = 0; -	if (_vm->_gyro->_thinkThing && !_vm->_gyro->_objects[_vm->_gyro->_thinks - 1]) -		thinkAbout(Gyro::kObjectMoney, Gyro::kThing); // you always have money - -	for (int i = 0; i < kObjectNum; i++) { -		if (_vm->_gyro->_objects[i]) { -			_vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1; -			_vm->_gyro->_carryNum++; -		} -	} -} - -/** - * @remarks	Originally called 'verte' - */ -void Lucerna::guideAvvy(Common::Point cursorPos) { -	if (!_vm->_gyro->_userMovesAvvy) -		return; - -	cursorPos.y /= 2; -	byte what; - -	// _vm->_animation->tr[0] is Avalot.) -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	if (cursorPos.x < avvy->_x) -		what = 1; -	else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) -		what = 2; -	else -		what = 0; // On top - -	if (cursorPos.y < avvy->_y) -		what += 3; -	else if (cursorPos.y > (avvy->_y + avvy->_info._yLength)) -		what += 6; - -	switch (what) { -	case 0: -		_vm->_animation->stopWalking(); -		break; // Clicked on Avvy: no movement. -	case 1: -		_vm->_animation->changeDirection(0, Animation::kDirLeft); -		break; -	case 2: -		_vm->_animation->changeDirection(0, Animation::kDirRight); -		break; -	case 3: -		_vm->_animation->changeDirection(0, Animation::kDirUp); -		break; -	case 4: -		_vm->_animation->changeDirection(0, Animation::kDirUpLeft); -		break; -	case 5: -		_vm->_animation->changeDirection(0, Animation::kDirUpRight); -		break; -	case 6: -		_vm->_animation->changeDirection(0, Animation::kDirDown); -		break; -	case 7: -		_vm->_animation->changeDirection(0, Animation::kDirDownLeft); -		break; -	case 8: -		_vm->_animation->changeDirection(0, Animation::kDirDownRight); -		break; -	}    // No other values are possible. - -	drawDirection(); -} - -void Lucerna::checkClick() { -	Common::Point cursorPos = _vm->getMousePos(); -	_vm->_gyro->_onToolbar = _vm->_gyro->kSlowComputer && ((cursorPos.y >= 169) || (cursorPos.y <= 10)); - -	/*if (_vm->_gyro->mrelease > 0) -	_vm->_gyro->after_the_scroll = false;*/ - -	if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) -		_vm->_gyro->newMouse(0); // up arrow -	else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) -		_vm->_gyro->newMouse(7); //I-beam -	else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) -		_vm->_gyro->newMouse(1); // screwdriver -	else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers. -		if (_holdLeftMouse) { -			_vm->_gyro->newMouse(6); // Mark's crosshairs -			guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around. -		} else -			_vm->_gyro->newMouse(3); // fletch -	} - -	if (_holdLeftMouse) { -		if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu. -			if (_vm->_gyro->_dropsOk) -				_vm->_menu->update(); -		} else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line. -			_vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8; -			if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1) -				_vm->_parser->_inputTextPos = _vm->_parser->_inputText.size() + 1; -			if (_vm->_parser->_inputTextPos < 1) -				_vm->_parser->_inputTextPos = 1; -			_vm->_parser->_inputTextPos--; -			_vm->_parser->plotText(); -		} else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) { // Check the toolbar. -			if ((137 <= cursorPos.x) && (cursorPos.x <= 207)) { // Control Avvy with the compass. -				if (_vm->_gyro->_alive && _vm->_gyro->_avvyIsAwake) -					useCompass(cursorPos); -			} else if ((208 <= cursorPos.x) && (cursorPos.x <= 260)) { // Examine the _thing. -				do { -					_vm->updateEvents(); -				} while (_holdLeftMouse); - -				if (_vm->_gyro->_thinkThing) { -					_vm->_parser->_thing = _vm->_gyro->_thinks; -					_vm->_parser->_thing += 49; -					_vm->_parser->_person = _vm->_parser->kPardon; -				} else { -					_vm->_parser->_person = _vm->_gyro->_thinks; -					_vm->_parser->_thing = _vm->_parser->kPardon; -				} -				callVerb(Parser::kVerbCodeExam); -			} else if ((261 <= cursorPos.x) && (cursorPos.x <= 319)) { // Display the score. -				do { -					_vm->updateEvents(); -				} while (_holdLeftMouse); - -				callVerb(Parser::kVerbCodeScore); -			} else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. -				_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk; -				_vm->_animation->updateSpeed(); -			} else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. -				_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun; -				_vm->_animation->updateSpeed(); -			} else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) -				fxToggle(); -			else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) -				_vm->_gyro->_mouseText.insertChar(Dialogs::kControlNewLine, 0); -		} else if (!_vm->_gyro->_dropsOk) -			_vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; -	} -} - -void Lucerna::errorLed() { -	warning("STUB: Lucerna::errorled()"); -} - -int8 Lucerna::fades(int8 x) { -	warning("STUB: Lucerna::fades()"); -	return 0; -} - -void Lucerna::fadeOut(byte n) { -	warning("STUB: Lucerna::fadeOut()"); -} - -void Lucerna::dusk() { -	warning("STUB: Lucerna::dusk()"); -} - -void Lucerna::fadeIn(byte n) { -	warning("STUB: Lucerna::fadeIn()"); -} - -void Lucerna::dawn() { -	warning("STUB: Lucerna::dawn()"); -} - -void Lucerna::drawDirection() { // It's data is loaded in load_digits(). -	if (_vm->_animation->_oldDirection == _vm->_animation->_direction) -		return; - -	_vm->_animation->_oldDirection = _vm->_animation->_direction; - -	CursorMan.showMouse(false); -	_vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->_directions[_vm->_animation->_direction], 0, 161); -	CursorMan.showMouse(true); -} - - -void Lucerna::gameOver() { -	_vm->_gyro->_userMovesAvvy = false; - -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	int16 sx = avvy->_x; -	int16 sy = avvy->_y; - -	avvy->remove(); -	avvy->init(12, true, _vm->_animation); // 12 = Avalot falls -	avvy->_stepNum = 0; -	avvy->appear(sx, sy, 0); - -	_vm->_timer->addTimer(3, Timer::kProcAvalotFalls, Timer::kReasonFallingOver); -	_vm->_gyro->_alive = false; -} - -void Lucerna::minorRedraw() { -	dusk(); - -	enterRoom(_vm->_gyro->_room, 0); // Ped unknown or non-existant. - -	for (int i = 0; i < 3; i++) -		_vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits -	drawScore(); - -	dawn(); -} - -void Lucerna::majorRedraw() { -	warning("STUB: Lucerna::major_redraw()"); -} - -uint16 Lucerna::bearing(byte whichPed) { -	static const double rad2deg = 180 / 3.14; // Pi -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	PedType *curPed = &_vm->_gyro->_peds[whichPed]; - -	if (avvy->_x == curPed->_x) -		return 0; -	else if (avvy->_x < curPed->_x) { -		return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); -	} else { -		return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); -	} -} - -/**  - * @remarks	Originally called 'sprite_run' - */ -void Lucerna::spriteRun() { -	_vm->_gyro->_doingSpriteRun = true; -	_vm->_animation->animLink(); -	_vm->_gyro->_doingSpriteRun = false; -} - -void Lucerna::fixFlashers() { -	_vm->_gyro->_ledStatus = 177; -	_vm->_animation->_oldDirection = 177; -	_vm->_dialogs->setReadyLight(2); -	drawDirection(); -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/lucerna.h b/engines/avalanche/lucerna.h deleted file mode 100644 index 87b1931e25..0000000000 --- a/engines/avalanche/lucerna.h +++ /dev/null @@ -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 diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 64b3b97eca..0fb1f62ca5 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -29,8 +29,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/menu.h" -#include "avalanche/lucerna.h" -#include "avalanche/gyro.h"  #include "avalanche/animation.h"  #include "common/textconsole.h" @@ -67,7 +65,7 @@ void HeadType::highlight() {  	_menu->_activeMenuItem._activeNum = _position;  	_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) { @@ -137,8 +135,8 @@ void MenuItem::display() {  	for (int y = 1; y < _optionNum; y++)  		displayOption(y, false); -	_dr->_vm->_gyro->_defaultLed = 1; -	_dr->_vm->_gyro->_currentMouse = 177; +	_dr->_vm->_avalot->_defaultLed = 1; +	_dr->_vm->_avalot->_currentMouse = 177;  	CursorMan.showMouse(true); // 4 = fletch  } @@ -151,7 +149,7 @@ void MenuItem::wipe() {  	_activeNow = false;  	_dr->_menuActive = false;  	_firstlix = false; -	_dr->_vm->_gyro->_defaultLed = 2; +	_dr->_vm->_avalot->_defaultLed = 2;  	CursorMan.showMouse(true);  } @@ -220,13 +218,13 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Menu  void MenuBar::draw() {  	_dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); -	byte savecp = _dr->_vm->_gyro->_cp; -	_dr->_vm->_gyro->_cp = 3; +	byte savecp = _dr->_vm->_avalot->_cp; +	_dr->_vm->_avalot->_cp = 3;  	for (int i = 0; i < _menuNum; i++)  		_menuItems[i].draw(); -	_dr->_vm->_gyro->_cp = savecp; +	_dr->_vm->_avalot->_cp = savecp;  }  void MenuBar::parseAltTrigger(char c) { @@ -264,30 +262,30 @@ Menu::Menu(AvalancheEngine *vm) {  }  void Menu::findWhatYouCanDoWithIt() { -	switch (_vm->_gyro->_thinks) { -	case Gyro::kObjectWine: -	case Gyro::kObjectPotion: -	case Gyro::kObjectInk: -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink; +	switch (_vm->_avalot->_thinks) { +	case Avalot::kObjectWine: +	case Avalot::kObjectPotion: +	case Avalot::kObjectInk: +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeDrink;  		break; -	case Gyro::kObjectBell: -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing; +	case Avalot::kObjectBell: +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeRing;  		break; -	case Gyro::kObjectChastity: -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; +	case Avalot::kObjectChastity: +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear;  		break; -	case Gyro::kObjectLute: -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay; +	case Avalot::kObjectLute: +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodePlay;  		break; -	case Gyro::kObjectMushroom: -	case Gyro::kObjectOnion: -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat; +	case Avalot::kObjectMushroom: +	case Avalot::kObjectOnion: +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeEat;  		break; -	case Gyro::kObjectClothes: -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear; +	case Avalot::kObjectClothes: +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeWear;  		break;  	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 (int j = 0; j < 8; j++) {  			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.  			for (int k = 0; k < 8; k++)  				*(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + k, y + j) = backgroundColor; @@ -414,9 +412,9 @@ void Menu::setupMenuFile() {  	_activeMenuItem.reset();  	_activeMenuItem.setupOption("New game", 'N', "f4", true);  	_activeMenuItem.setupOption("Load...", 'L', "^f3", true); -	_activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_gyro->_alive); -	_activeMenuItem.setupOption("Save As...", 'v', "", _vm->_gyro->_alive); -	_activeMenuItem.setupOption("DOS Shell", 'D', _vm->_gyro->_atKey + '1', true); +	_activeMenuItem.setupOption("Save", 'S', "^f2", _vm->_avalot->_alive); +	_activeMenuItem.setupOption("Save As...", 'v', "", _vm->_avalot->_alive); +	_activeMenuItem.setupOption("DOS Shell", 'D', _vm->_avalot->_atKey + '1', true);  	_activeMenuItem.setupOption("Quit", 'Q', "alt-X", true);  	_activeMenuItem.display();  } @@ -424,7 +422,7 @@ void Menu::setupMenuFile() {  void Menu::setupMenuAction() {  	_activeMenuItem.reset(); -	Common::String f5Does = _vm->_gyro->f5Does(); +	Common::String f5Does = _vm->_avalot->f5Does();  	for (int i = 0; i < 2; i++)  		if (!f5Does.empty())  			f5Does.deleteChar(0); @@ -433,13 +431,13 @@ void Menu::setupMenuAction() {  	else  		_activeMenuItem.setupOption(f5Does, f5Does[0], "f5", 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());  	else  		_activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor());  	_activeMenuItem.setupOption("Look around", 'L', "f8", 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);  	else  		_activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -454,8 +452,8 @@ void Menu::setupMenuPeople() {  	_activeMenuItem.reset();  	for (int i = 150; i <= 178; i++) { -		if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { -			_activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); +		if (_vm->_avalot->_whereIs[i - 150] == _vm->_avalot->_room) { +			_activeMenuItem.setupOption(_vm->_avalot->getName(i), _vm->_avalot->getNameChar(i), "", true);  			people += i;  		}  	} @@ -466,8 +464,8 @@ void Menu::setupMenuPeople() {  void Menu::setupMenuObjects() {  	_activeMenuItem.reset();  	for (int i = 0; i < kObjectNum; i++) { -		if (_vm->_gyro->_objects[i]) -			_activeMenuItem.setupOption(_vm->_gyro->getThing(i + 1), _vm->_gyro->getThingChar(i + 1), "", true); +		if (_vm->_avalot->_objects[i]) +			_activeMenuItem.setupOption(_vm->_avalot->getThing(i + 1), _vm->_avalot->getThingChar(i + 1), "", true);  	}  	_activeMenuItem.display();  } @@ -475,54 +473,54 @@ void Menu::setupMenuObjects() {  void Menu::setupMenuWith() {  	_activeMenuItem.reset(); -	if (_vm->_gyro->_thinkThing) { +	if (_vm->_avalot->_thinkThing) {  		findWhatYouCanDoWithIt(); -		for (uint i = 0; i < _vm->_gyro->_verbStr.size(); i++) { +		for (uint i = 0; i < _vm->_avalot->_verbStr.size(); i++) {  			char vbchar;  			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);  		}  		// 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! -		if ((_vm->_gyro->_lastPerson == Gyro::kPeopleAvalot) || (_vm->_gyro->_lastPerson == _vm->_parser->kNothing) -			|| (_vm->_gyro->_whereIs[_vm->_gyro->_lastPerson - 150] != _vm->_gyro->_room)) +		if ((_vm->_avalot->_lastPerson == Avalot::kPeopleAvalot) || (_vm->_avalot->_lastPerson == _vm->_parser->kNothing) +			|| (_vm->_avalot->_whereIs[_vm->_avalot->_lastPerson - 150] != _vm->_avalot->_room))  			_activeMenuItem.setupOption("Give to...", 'G', "", false); // Not here.  		else { -			_activeMenuItem.setupOption(Common::String("Give to ") + _vm->_gyro->getName(_vm->_gyro->_lastPerson), 'G', "", true); -			_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeGive; +			_activeMenuItem.setupOption(Common::String("Give to ") + _vm->_avalot->getName(_vm->_avalot->_lastPerson), 'G', "", true); +			_vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeGive;  		}  	} else {  		_activeMenuItem.setupOption("Examine", 'x', "", true); -		_activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_gyro->_thinks), 'T', "", true); -		_vm->_gyro->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; -		switch (_vm->_gyro->_thinks) { -		case Gyro::kPeopleGeida: -		case Gyro::kPeopleArkata: +		_activeMenuItem.setupOption(Common::String("Talk to h") + selectGender(_vm->_avalot->_thinks), 'T', "", true); +		_vm->_avalot->_verbStr = Common::String(Parser::kVerbCodeExam) + Parser::kVerbCodeTalk; +		switch (_vm->_avalot->_thinks) { +		case Avalot::kPeopleGeida: +		case Avalot::kPeopleArkata:  			_activeMenuItem.setupOption("Kiss her", 'K', "", true); -			_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodeKiss; +			_vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodeKiss;  			break; -		case Gyro::kPeopleDogfood: -			_activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. -			_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Parser::kVerbCodePlay; +		case Avalot::kPeopleDogfood: +			_activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_avalot->_wonNim); // True if you HAVEN'T won. +			_vm->_avalot->_verbStr = _vm->_avalot->_verbStr + Parser::kVerbCodePlay;  			break; -		case Gyro::kPeopleMalagauche: { -			bool isSober = !_vm->_gyro->_teetotal; -			_activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_objects[Gyro::kObjectWine - 1]); +		case Avalot::kPeopleMalagauche: { +			bool isSober = !_vm->_avalot->_teetotal; +			_activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_avalot->_objects[Avalot::kObjectWine - 1]);  			_activeMenuItem.setupOption("Buy some beer", 'b', "", isSober);  			_activeMenuItem.setupOption("Buy some whisky", 'h', "", isSober);  			_activeMenuItem.setupOption("Buy some cider", 'c', "", 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; -		case Gyro::kPeopleTrader: -			_activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_objects[Gyro::kObjectOnion - 1]); -			_vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; +		case Avalot::kPeopleTrader: +			_activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_avalot->_objects[Avalot::kObjectOnion - 1]); +			_vm->_avalot->_verbStr = _vm->_avalot->_verbStr + 105;  			break;  		}  	} @@ -533,19 +531,19 @@ void Menu::runMenuGame() {  	// Help, boss, untrash screen.  	switch (_activeMenuItem._choiceNum) {  	case 0: -		_vm->_lucerna->callVerb(Parser::kVerbCodeHelp); +		_vm->_avalot->callVerb(Parser::kVerbCodeHelp);  		break;  	case 1: -		_vm->_lucerna->callVerb(Parser::kVerbCodeBoss); +		_vm->_avalot->callVerb(Parser::kVerbCodeBoss);  		break;  	case 2: -		_vm->_lucerna->majorRedraw(); +		_vm->_avalot->majorRedraw();  		break;  	case 3: -		_vm->_lucerna->callVerb(Parser::kVerbCodeScore); +		_vm->_avalot->callVerb(Parser::kVerbCodeScore);  		break;  	case 4: -		_vm->_lucerna->callVerb(Parser::kVerbCodeInfo); +		_vm->_avalot->callVerb(Parser::kVerbCodeInfo);  		break;  	}  } @@ -554,17 +552,17 @@ void Menu::runMenuFile() {  	// New game, load, save, save as, DOS shell, about, quit.  	switch (_activeMenuItem._choiceNum) {  	case 0: -		_vm->_lucerna->callVerb(Parser::kVerbCodeRestart); +		_vm->_avalot->callVerb(Parser::kVerbCodeRestart);  		break;  	case 1:  		if (!_vm->_parser->_realWords[1].empty())  			_vm->_parser->_realWords[1].clear(); -		_vm->_lucerna->callVerb(Parser::kVerbCodeLoad); +		_vm->_avalot->callVerb(Parser::kVerbCodeLoad);  		break;  	case 2:  		if (!_vm->_parser->_realWords[1].empty())  			_vm->_parser->_realWords[1].clear(); -		_vm->_lucerna->callVerb(Parser::kVerbCodeSave); +		_vm->_avalot->callVerb(Parser::kVerbCodeSave);  		break;  	case 3:  		//_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!  		break;  	case 5: -		_vm->_lucerna->callVerb(Parser::kVerbCodeQuit); +		_vm->_avalot->callVerb(Parser::kVerbCodeQuit);  		break;  	}  } @@ -586,29 +584,29 @@ void Menu::runMenuAction() {  	case 0:  		_vm->_parser->_person = _vm->_parser->kPardon;  		_vm->_parser->_thing = _vm->_parser->kPardon; -		f5Does = _vm->_gyro->f5Does(); -		_vm->_lucerna->callVerb(f5Does[0]); +		f5Does = _vm->_avalot->f5Does(); +		_vm->_avalot->callVerb(f5Does[0]);  		break;  	case 1:  		_vm->_parser->_thing = _vm->_parser->kPardon; -		_vm->_lucerna->callVerb(Parser::kVerbCodePause); +		_vm->_avalot->callVerb(Parser::kVerbCodePause);  		break;  	case 2: -		_vm->_lucerna->callVerb(Parser::kVerbCodeOpen); +		_vm->_avalot->callVerb(Parser::kVerbCodeOpen);  		break;  	case 3:  		_vm->_parser->_thing = _vm->_parser->kPardon; -		_vm->_lucerna->callVerb(Parser::kVerbCodeLook); +		_vm->_avalot->callVerb(Parser::kVerbCodeLook);  		break;  	case 4: -		_vm->_lucerna->callVerb(Parser::kVerbCodeInv); +		_vm->_avalot->callVerb(Parser::kVerbCodeInv);  		break;  	case 5: {  		AnimationType *avvy = &_vm->_animation->_sprites[0]; -		if (avvy->_speedX == _vm->_gyro->kWalk) -			avvy->_speedX = _vm->_gyro->kRun; +		if (avvy->_speedX == _vm->_avalot->kWalk) +			avvy->_speedX = _vm->_avalot->kRun;  		else -			avvy->_speedX = _vm->_gyro->kWalk; +			avvy->_speedX = _vm->_avalot->kWalk;  		_vm->_animation->updateSpeed();  		}  		break; @@ -616,57 +614,57 @@ void Menu::runMenuAction() {  }  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() { -	_vm->_lucerna->thinkAbout(people[_activeMenuItem._choiceNum], Gyro::kPerson); -	_vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum]; +	_vm->_avalot->thinkAbout(people[_activeMenuItem._choiceNum], Avalot::kPerson); +	_vm->_avalot->_lastPerson = people[_activeMenuItem._choiceNum];  }  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; -		if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) -			_vm->_parser->_person = _vm->_gyro->_lastPerson; +		if (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum] == Parser::kVerbCodeGive) +			_vm->_parser->_person = _vm->_avalot->_lastPerson;  		else  			_vm->_parser->_person = Parser::kPardon;  	} else { -		switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { +		switch (_vm->_avalot->_verbStr[_activeMenuItem._choiceNum]) {  		case 100: // Beer  			_vm->_parser->_thing = 100; -			_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); +			_vm->_avalot->callVerb(Parser::kVerbCodeBuy);  			return;  		case 101: // Wine  			_vm->_parser->_thing = 50; -			_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); +			_vm->_avalot->callVerb(Parser::kVerbCodeBuy);  			return;  		case 102: // Whisky  			_vm->_parser->_thing = 102; -			_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); +			_vm->_avalot->callVerb(Parser::kVerbCodeBuy);  			return;  		case 103: // Cider  			_vm->_parser->_thing = 103; -			_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); +			_vm->_avalot->callVerb(Parser::kVerbCodeBuy);  			return;  		case 104: // Mead  			_vm->_parser->_thing = 107; -			_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); +			_vm->_avalot->callVerb(Parser::kVerbCodeBuy);  			return;  		case 105: // Onion (trader)  			_vm->_parser->_thing = 67; -			_vm->_lucerna->callVerb(Parser::kVerbCodeBuy); +			_vm->_avalot->callVerb(Parser::kVerbCodeBuy);  			return;  		default:  			_vm->_parser->_person = _vm->_parser->_thing;  			_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() { @@ -688,11 +686,11 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...  	::Graphics::Surface backup;  	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);  		do  			_vm->updateEvents(); -		while (_vm->_lucerna->_holdLeftMouse); +		while (_vm->_avalot->_holdLeftMouse);  		while (!_vm->shouldQuit()) {  			do { @@ -702,28 +700,28 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...  				cursorPos = _vm->getMousePos();  				// Change arrow...  				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)) {  					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 -						_vm->_gyro->newMouse(3); // Fletch +						_vm->_avalot->newMouse(3); // Fletch  				} else if ((340 <= cursorPos.y) && (cursorPos.y <= 399)) -					_vm->_gyro->newMouse(1); // Screwdriver +					_vm->_avalot->newMouse(1); // Screwdriver  				_activeMenuItem.lightUp(cursorPos);  				_vm->_graphics->refreshScreen(); -			} while (!_vm->_lucerna->_holdLeftMouse); +			} while (!_vm->_avalot->_holdLeftMouse); -			if (_vm->_lucerna->_holdLeftMouse) { +			if (_vm->_avalot->_holdLeftMouse) {  				if (cursorPos.y > 21) {  					if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8)  						&& (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) {  							// Clicked OUTSIDE the menu.  							if (_activeMenuItem._activeNow) {  								_activeMenuItem.wipe(); -								_vm->_lucerna->_holdLeftMouse = false; +								_vm->_avalot->_holdLeftMouse = false;  								backup.free();  								return;  							} // 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 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();  							return;  						} else { -							_vm->_lucerna->_holdLeftMouse = true; +							_vm->_avalot->_holdLeftMouse = true;  							break;  						}  					} @@ -758,7 +756,7 @@ void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...  						_vm->_graphics->refreshScreen();  						_vm->updateEvents(); -						if (!_vm->_lucerna->_holdLeftMouse) +						if (!_vm->_avalot->_holdLeftMouse)  							break;  					} diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 541123f24f..9c1205df02 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -9,8 +9,6 @@ MODULE_OBJS = \  	console.o \  	detection.o \  	graphics.o \ -	gyro.o \ -	lucerna.o \  	menu.o \  	parser.o \  	pingo.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 29fadda330..4a58763d0c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -27,8 +27,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/parser.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h"  #include "avalanche/dialogs.h"  #include "avalanche/timer.h"  #include "avalanche/animation.h" @@ -53,7 +51,7 @@ void Parser::init() {  		_inputText.clear();  	_inputTextPos = 0; -	_vm->_gyro->_weirdWord = false; +	_vm->_avalot->_weirdWord = false;  	// Initailaze the vocabulary.  	// Verbs: 1-49 @@ -425,10 +423,10 @@ void Parser::handleFunctionKey(const Common::Event &event) {  	case Common::KEYCODE_F5:  		_person = kPardon;  		_thing = kPardon; -		_vm->_lucerna->callVerb(_vm->_gyro->f5Does()[0]); +		_vm->_avalot->callVerb(_vm->_avalot->f5Does()[0]);  		break;  	case Common::KEYCODE_F7: -		_vm->_lucerna->callVerb(Parser::kVerbCodeOpen); +		_vm->_avalot->callVerb(Parser::kVerbCodeOpen);  		break;  	default:  		break; @@ -440,7 +438,7 @@ void Parser::plotText() {  	cursorOff();  	_vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. -	_vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); +	_vm->_graphics->drawText(_vm->_graphics->_surface, _inputText, _vm->_avalot->_font, 8, 24, 161, kColorWhite);  	cursorOn();  	CursorMan.showMouse(true); @@ -539,7 +537,7 @@ Common::String Parser::rank() {  	};  	for (int i = 0; i < 8; i++) { -		if ((_vm->_gyro->_dnascore >= kRanks[i]._score) && (_vm->_gyro->_dnascore < kRanks[i + 1]._score)) { +		if ((_vm->_avalot->_dnascore >= kRanks[i]._score) && (_vm->_avalot->_dnascore < kRanks[i + 1]._score)) {  			return kRanks[i]._title;  		}  	} @@ -551,7 +549,7 @@ Common::String Parser::totalTime() {  	const double ticksInOneSec = (double)(65535) / 3600;  	uint16 h, m, s; -	h = floor(_vm->_gyro->_totalTime / ticksInOneSec); // No. of seconds. +	h = floor(_vm->_avalot->_totalTime / ticksInOneSec); // No. of seconds.  	m = h % 3600;  	h /= 3600;  	s = m % 60; @@ -593,10 +591,10 @@ void Parser::displayWhat(byte target, bool animate, bool &ambiguous) {  			_vm->_dialogs->displayText("What?");  	} else {  		if (animate) { -			Common::String tmpStr = Common::String::format("{ %s }", _vm->_gyro->getName(target).c_str()); +			Common::String tmpStr = Common::String::format("{ %s }", _vm->_avalot->getName(target).c_str());  			_vm->_dialogs->displayText(tmpStr);  		} else { -			Common::String z = _vm->_gyro->getItem(target); +			Common::String z = _vm->_avalot->getItem(target);  			if (z != "") {  				Common::String tmpStr = Common::String::format("{ %s }", z.c_str());  				_vm->_dialogs->displayText(tmpStr); @@ -612,16 +610,16 @@ bool Parser::doPronouns() {  		byte wordCode = _thats[i];  		switch (wordCode) {  		case 200: -			displayWhat(_vm->_gyro->_him, true, ambiguous); -			_thats.setChar(_vm->_gyro->_him, i); +			displayWhat(_vm->_avalot->_him, true, ambiguous); +			_thats.setChar(_vm->_avalot->_him, i);  			break;  		case 201: -			displayWhat(_vm->_gyro->_her, true, ambiguous); -			_thats.setChar(_vm->_gyro->_her, i); +			displayWhat(_vm->_avalot->_her, true, ambiguous); +			_thats.setChar(_vm->_avalot->_her, i);  			break;  		case 202: -			displayWhat(_vm->_gyro->_it, false, ambiguous); -			_thats.setChar(_vm->_gyro->_it, i); +			displayWhat(_vm->_avalot->_it, false, ambiguous); +			_thats.setChar(_vm->_avalot->_it, i);  			break;  		}  	} @@ -666,32 +664,32 @@ void Parser::storeInterrogation(byte interrogation) {  	case 1:  		_inputText.toLowercase();  		sayIt(); -		_vm->_gyro->_favouriteDrink = _inputText; -		_vm->_gyro->_cardiffQuestionNum = 2; +		_vm->_avalot->_favouriteDrink = _inputText; +		_vm->_avalot->_cardiffQuestionNum = 2;  		break;  	case 2:  		properNouns();  		sayIt(); -		_vm->_gyro->_favouriteSong = _inputText; -		_vm->_gyro->_cardiffQuestionNum = 3; +		_vm->_avalot->_favouriteSong = _inputText; +		_vm->_avalot->_cardiffQuestionNum = 3;  		break;  	case 3:  		properNouns();  		sayIt(); -		_vm->_gyro->_worstPlaceOnEarth = _inputText; -		_vm->_gyro->_cardiffQuestionNum = 4; +		_vm->_avalot->_worstPlaceOnEarth = _inputText; +		_vm->_avalot->_cardiffQuestionNum = 4;  		break;  	case 4:  		_inputText.toLowercase();  		sayIt(); -		if (!_vm->_gyro->_spareEvening.empty()) -			_vm->_gyro->_spareEvening.clear(); -		_vm->_gyro->_spareEvening = _inputText; +		if (!_vm->_avalot->_spareEvening.empty()) +			_vm->_avalot->_spareEvening.clear(); +		_vm->_avalot->_spareEvening = _inputText;  		_vm->_dialogs->displayScrollChain('z', 5); // His closing statement...  		_vm->_animation->_sprites[1].walkTo(3); // The end of the drawbridge  		_vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; -		_vm->_gyro->_cardiffQuestionNum = 5; +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; +		_vm->_avalot->_cardiffQuestionNum = 5;  		break;  	case 99:  		//store_high(_inputText); @@ -727,9 +725,9 @@ void Parser::parse() {  	}  	// Are we being interrogated right now? -	if (_vm->_gyro->_interrogation > 0) { -		storeInterrogation(_vm->_gyro->_interrogation); -		_vm->_gyro->_weirdWord = true; +	if (_vm->_avalot->_interrogation > 0) { +		storeInterrogation(_vm->_avalot->_interrogation); +		_vm->_avalot->_weirdWord = true;  		return;  	} @@ -761,7 +759,7 @@ void Parser::parse() {  		// Check also[] first, which contains words about the actual room.  		if (!thisword.empty()) {  			for (int i = 0; i < 31; i++) { -				if ((_vm->_gyro->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_gyro->_also[i][0]) > -1)) { +				if ((_vm->_avalot->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) {  					_thats += Common::String(99 + i);  					notfound = false;  				} @@ -813,12 +811,12 @@ void Parser::parse() {  	replace(Common::String("\x4\xE5"),  20); // "take off" = "doff"  	// Words that could mean more than one _person -	if (_vm->_gyro->_room == kRoomNottsPub) +	if (_vm->_avalot->_room == kRoomNottsPub)  		replace(Common::String('\xCC'), 164); // Barman = Port  	else  		replace(Common::String('\xCC'), 154); // Barman = Malagauche -	switch (_vm->_gyro->_room) { +	switch (_vm->_avalot->_room) {  	case kRoomAylesOffice:  		replace(Common::String('\xCB'), 163); // Monk = Ayles  		break; @@ -830,39 +828,39 @@ void Parser::parse() {  	}  	if (doPronouns()) { -		_vm->_gyro->_weirdWord = true; +		_vm->_avalot->_weirdWord = true;  		_thats = kNothing;  		return;  	}  	// Second parsing. -	if (!_vm->_gyro->_subject.empty()) -		_vm->_gyro->_subject.clear(); -	_vm->_gyro->_subjectNum = 0; // Find subject of conversation. +	if (!_vm->_avalot->_subject.empty()) +		_vm->_avalot->_subject.clear(); +	_vm->_avalot->_subjectNum = 0; // Find subject of conversation.  	for (int i = 0; (i < 11) && !_realWords[i].empty(); i++) {  		if ((_realWords[i][0] == '\'') || (_realWords[i][0] == '\"')) { -			_vm->_gyro->_subjectNum = (byte)_thats[i]; +			_vm->_avalot->_subjectNum = (byte)_thats[i];  			_thats.setChar(kMoved, i);  			break;  		}  	} -	if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // Still not found. +	if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // Still not found.  		for (uint16 i = 0; i < _thats.size() - 1; i++) {  			if ((byte)_thats[i] == 252) { // The word is "about", or something similar. -				_vm->_gyro->_subjectNum = (byte)_thats[i + 1]; +				_vm->_avalot->_subjectNum = (byte)_thats[i + 1];  				_thats.setChar(0, i + 1);  				break;  			}  		}  	} -	if ((_vm->_gyro->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". +	if ((_vm->_avalot->_subjectNum == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say".  		for (uint16 i = 0; i < _thats.size() - 1; i++) {  			if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) {  				// SAY not followed by a preposition -				_vm->_gyro->_subjectNum = (byte)_thats[i + 1]; +				_vm->_avalot->_subjectNum = (byte)_thats[i + 1];  				_thats.setChar(0, i + 1);  				break;  			} @@ -884,30 +882,30 @@ void Parser::parse() {  	if ((!unkString.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) {  		Common::String tmpStr = Common::String::format("Sorry, but I have no idea what \"%s\" means. Can you rephrase it?", unkString.c_str());  		_vm->_dialogs->displayText(tmpStr); -		_vm->_gyro->_weirdWord = true; +		_vm->_avalot->_weirdWord = true;  	} else -		_vm->_gyro->_weirdWord = false; +		_vm->_avalot->_weirdWord = false;  	if (_thats.empty())  		_thats = kNothing;  	if (_thing != kPardon) -		_vm->_gyro->_it = _thing; +		_vm->_avalot->_it = _thing;  	if (_person != kPardon) { -		if (_person < Gyro::kPeopleArkata) -			_vm->_gyro->_him = _person; +		if (_person < Avalot::kPeopleArkata) +			_vm->_avalot->_him = _person;  		else -			_vm->_gyro->_her = _person; +			_vm->_avalot->_her = _person;  	}  }  void Parser::examineObject() { -	if (_thing != _vm->_gyro->_thinks) -		_vm->_lucerna->thinkAbout(_thing, Gyro::kThing); +	if (_thing != _vm->_avalot->_thinks) +		_vm->_avalot->thinkAbout(_thing, Avalot::kThing);  	switch (_thing) { -	case Gyro::kObjectWine : -		switch (_vm->_gyro->_wineState) {// 4 is perfect wine. 0 is not holding the wine. +	case Avalot::kObjectWine : +		switch (_vm->_avalot->_wineState) {// 4 is perfect wine. 0 is not holding the wine.  		case 1:  			_vm->_dialogs->displayScrollChain('t', 1); // Normal examine wine scroll  			break; @@ -919,8 +917,8 @@ void Parser::examineObject() {  			break;  		}  		break; -	case Gyro::kObjectOnion: -		if (_vm->_gyro->_rottenOnion) +	case Avalot::kObjectOnion: +		if (_vm->_avalot->_rottenOnion)  			_vm->_dialogs->displayScrollChain('q', 21); // Yucky onion  		else  			_vm->_dialogs->displayScrollChain('t', 18);  // Normal onion @@ -931,11 +929,11 @@ void Parser::examineObject() {  }  bool Parser::isPersonHere() { // Person equivalent of "holding". -	if ((_person == kPardon) || (_person == 0) || (_vm->_gyro->_whereIs[_person - 150] == _vm->_gyro->_room)) +	if ((_person == kPardon) || (_person == 0) || (_vm->_avalot->_whereIs[_person - 150] == _vm->_avalot->_room))  		return true;  	else {  		Common::String tmpStr; -		if (_person < Gyro::kPeopleArkata) +		if (_person < Avalot::kPeopleArkata)  			tmpStr = "He isn't around at the moment.";  		else  			tmpStr = "She isn't around at the moment."; @@ -946,19 +944,19 @@ bool Parser::isPersonHere() { // Person equivalent of "holding".  void Parser::exampers() {  	if (isPersonHere()) { -		if (_thing != _vm->_gyro->_thinks) -			_vm->_lucerna->thinkAbout(_person, Gyro::kPerson); +		if (_thing != _vm->_avalot->_thinks) +			_vm->_avalot->thinkAbout(_person, Avalot::kPerson);  		byte newPerson = _person - 149; -		if ((_person == Gyro::kPeopleDogfood) && _vm->_gyro->_wonNim) +		if ((_person == Avalot::kPeopleDogfood) && _vm->_avalot->_wonNim)  			_vm->_dialogs->displayScrollChain('Q', 8); // "I'm Not Playing!" -		else if ((_person == Gyro::kPeopleDuLustie) && _vm->_gyro->_lustieIsAsleep) +		else if ((_person == Avalot::kPeopleDuLustie) && _vm->_avalot->_lustieIsAsleep)  			_vm->_dialogs->displayScrollChain('Q', 65); // He's asleep.  		else  			_vm->_dialogs->displayScrollChain('p', newPerson); -		if ((_person == Gyro::kPeopleAyles) && !_vm->_gyro->_aylesIsAwake) +		if ((_person == Avalot::kPeopleAyles) && !_vm->_avalot->_aylesIsAwake)  			_vm->_dialogs->displayScrollChain('Q', 13);  		_person = newPerson; @@ -977,7 +975,7 @@ bool Parser::isHolding() {  	if (_thing > 100)  		_vm->_dialogs->displayText("Be reasonable!"); -	else if (!_vm->_gyro->_objects[_thing - 1])  // Verbs that need "_thing" to be in the inventory. +	else if (!_vm->_avalot->_objects[_thing - 1])  // Verbs that need "_thing" to be in the inventory.  		_vm->_dialogs->displayText("You're not holding it, Avvy.");  	else  		holdingResult = true; @@ -986,7 +984,7 @@ bool Parser::isHolding() {  }  void Parser::openBox(bool isOpening) { -	if ((_vm->_gyro->_room == kRoomYours) && (_thing == 54)) { +	if ((_vm->_avalot->_room == kRoomYours) && (_thing == 54)) {  		_vm->_background->drawBackgroundSprite(-1, -1, 4);  		_vm->_background->updateBackgroundSprites(); @@ -1013,7 +1011,7 @@ void Parser::examine() {  				examineObject();  			else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing  				openBox(true); -				_vm->_dialogs->displayText(*_vm->_gyro->_also[_thing - 50][1]); +				_vm->_dialogs->displayText(*_vm->_avalot->_also[_thing - 50][1]);  				openBox(false);  			}  		} @@ -1028,22 +1026,22 @@ void Parser::inventory() {  	Common::String tmpStr = Common::String("You're carrying ");  	for (int i = 0; i < kObjectNum; i++) { -		if (_vm->_gyro->_objects[i]) { +		if (_vm->_avalot->_objects[i]) {  			itemNum++; -			if (itemNum == _vm->_gyro->_carryNum) +			if (itemNum == _vm->_avalot->_carryNum)  				tmpStr += "and "; -			tmpStr += _vm->_gyro->getItem(i + 1); +			tmpStr += _vm->_avalot->getItem(i + 1); -			if ((i + 1) == _vm->_gyro->_wearing) +			if ((i + 1) == _vm->_avalot->_wearing)  				tmpStr += ", which you're wearing"; -			if (itemNum < _vm->_gyro->_carryNum) +			if (itemNum < _vm->_avalot->_carryNum)  				tmpStr += ", ";  		}  	} -	if (_vm->_gyro->_wearing == kNothing) +	if (_vm->_avalot->_wearing == kNothing)  		tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine);  	else  		tmpStr += '.'; @@ -1053,18 +1051,18 @@ void Parser::inventory() {  void Parser::swallow() { // Eat something.  	switch (_thing) { -	case Gyro::kObjectWine: -		switch (_vm->_gyro->_wineState) { // 4 is perfect +	case Avalot::kObjectWine: +		switch (_vm->_avalot->_wineState) { // 4 is perfect  		case 1: -			if (_vm->_gyro->_teetotal)  { +			if (_vm->_avalot->_teetotal)  {  				_vm->_dialogs->displayScrollChain('D', 6);  				return;  			}  			_vm->_dialogs->displayScrollChain('U', 1);  			_vm->_pingo->wobble();  			_vm->_dialogs->displayScrollChain('U', 2); -			_vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; -			_vm->_lucerna->refreshObjectList(); +			_vm->_avalot->_objects[Avalot::kObjectWine - 1] = false; +			_vm->_avalot->refreshObjectList();  			drink();  			break;  		case 2: @@ -1073,33 +1071,33 @@ void Parser::swallow() { // Eat something.  			break; // You can't drink it!  		}  		break; -	case Gyro::kObjectPotion: -		_vm->_gyro->setBackgroundColor(4); +	case Avalot::kObjectPotion: +		_vm->_avalot->setBackgroundColor(4);  		_vm->_dialogs->displayScrollChain('U', 3); -		_vm->_lucerna->gameOver(); -		_vm->_gyro->setBackgroundColor(0); +		_vm->_avalot->gameOver(); +		_vm->_avalot->setBackgroundColor(0);  		break; -	case Gyro::kObjectInk: +	case Avalot::kObjectInk:  		_vm->_dialogs->displayScrollChain('U', 4);  		break; -	case Gyro::kObjectChastity: +	case Avalot::kObjectChastity:  		_vm->_dialogs->displayScrollChain('U', 5);  		break; -	case Gyro::kObjectMushroom: +	case Avalot::kObjectMushroom:  		_vm->_dialogs->displayScrollChain('U', 6); -		_vm->_lucerna->gameOver(); +		_vm->_avalot->gameOver();  		break; -	case Gyro::kObjectOnion: -		if (_vm->_gyro->_rottenOnion) +	case Avalot::kObjectOnion: +		if (_vm->_avalot->_rottenOnion)  			_vm->_dialogs->displayScrollChain('U', 11);  		else {  			_vm->_dialogs->displayScrollChain('U', 8); -			_vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; -			_vm->_lucerna->refreshObjectList(); +			_vm->_avalot->_objects[Avalot::kObjectOnion - 1] = false; +			_vm->_avalot->refreshObjectList();  		}  		break;  	default: -		if ((_vm->_gyro->_room == kRoomArgentPub) || (_vm->_gyro->_room == kRoomNottsPub)) +		if ((_vm->_avalot->_room == kRoomArgentPub) || (_vm->_avalot->_room == kRoomNottsPub))  			_vm->_dialogs->displayText("Try BUYing things before you drink them!");  		else  			_vm->_dialogs->displayText("The taste of it makes you retch!"); @@ -1110,7 +1108,7 @@ void Parser::peopleInRoom() {  	byte numPeople = 0; // Number of people in the room.  	for (int i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! -		if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) +		if (_vm->_avalot->_whereIs[i] == _vm->_avalot->_room)  			numPeople++;  	} @@ -1120,14 +1118,14 @@ void Parser::peopleInRoom() {  	Common::String tmpStr;  	byte actPerson = 0; // Actually listed people.  	for (int i = 1; i < 29; i++) { -		if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_room) { +		if (_vm->_avalot->_whereIs[i] == _vm->_avalot->_room) {  			actPerson++;  			if (actPerson == 1) // First on the list. -				tmpStr = _vm->_gyro->getName(i + 150); +				tmpStr = _vm->_avalot->getName(i + 150);  			else if (actPerson < numPeople) // The middle... -				tmpStr += ", " + _vm->_gyro->getName(i + 150); +				tmpStr += ", " + _vm->_avalot->getName(i + 150);  			else // The end. -				tmpStr += " and " + _vm->_gyro->getName(i + 150); +				tmpStr += " and " + _vm->_avalot->getName(i + 150);  		}  	} @@ -1140,30 +1138,30 @@ void Parser::peopleInRoom() {  }  void Parser::lookAround() { -	_vm->_dialogs->displayText(*_vm->_gyro->_also[0][1]); -	switch (_vm->_gyro->_room) { +	_vm->_dialogs->displayText(*_vm->_avalot->_also[0][1]); +	switch (_vm->_avalot->_room) {  	case kRoomSpludwicks: -		if (_vm->_gyro->_avariciusTalk > 0) +		if (_vm->_avalot->_avariciusTalk > 0)  			_vm->_dialogs->displayScrollChain('q', 23);  		else  			peopleInRoom();  		break;  	case kRoomRobins: -		if (_vm->_gyro->_tiedUp) +		if (_vm->_avalot->_tiedUp)  			_vm->_dialogs->displayScrollChain('q', 38); -		if (_vm->_gyro->_mushroomGrowing) +		if (_vm->_avalot->_mushroomGrowing)  			_vm->_dialogs->displayScrollChain('q', 55);  		break;  	case kRoomInsideCardiffCastle: -		if (!_vm->_gyro->_takenPen) +		if (!_vm->_avalot->_takenPen)  			_vm->_dialogs->displayScrollChain('q', 49);  		break;  	case kRoomLustiesRoom: -		if (_vm->_gyro->_lustieIsAsleep) +		if (_vm->_avalot->_lustieIsAsleep)  			_vm->_dialogs->displayScrollChain('q', 65);  		break;  	case kRoomCatacombs: -		switch (_vm->_gyro->_catacombY * 256 + _vm->_gyro->_catacombX) { +		switch (_vm->_avalot->_catacombY * 256 + _vm->_avalot->_catacombX) {  		case 258 :  			_vm->_dialogs->displayScrollChain('q', 80); // Inside art gallery.  			break; @@ -1182,7 +1180,7 @@ void Parser::lookAround() {  void Parser::openDoor() {  	// Special cases. -	switch (_vm->_gyro->_room) { +	switch (_vm->_avalot->_room) {  	case kRoomYours:  		if (_vm->_animation->inField(1)) {  			// Opening the box. @@ -1200,28 +1198,28 @@ void Parser::openDoor() {  		break;  	} -	if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != kRoomLusties)) +	if ((!_vm->_avalot->_userMovesAvvy) && (_vm->_avalot->_room != kRoomLusties))  		return; // No doors can open if you can't move Avvy.  	for (int i = 0; i < 7; i++) {  		if (_vm->_animation->inField(i + 8)) { -			MagicType *portal = &_vm->_gyro->_portals[i]; +			MagicType *portal = &_vm->_avalot->_portals[i];  			switch (portal->_operation) { -			case Gyro::kMagicExclaim: +			case Avalot::kMagicExclaim:  				_vm->_animation->_sprites[0].bounce();  				_vm->_dialogs->displayScrollChain('x', portal->_data);  				break; -			case Gyro::kMagicTransport: +			case Avalot::kMagicTransport:  				_vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F);  				break; -			case Gyro::kMagicUnfinished: +			case Avalot::kMagicUnfinished:  				_vm->_animation->_sprites[0].bounce();  				_vm->_dialogs->displayText("Sorry. This place is not available yet!");  				break; -			case Gyro::kMagicSpecial: +			case Avalot::kMagicSpecial:  				_vm->_animation->callSpecial(portal->_data);  				break; -			case Gyro::kMagicOpenDoor: +			case Avalot::kMagicOpenDoor:  				_vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9);  				break;  			} @@ -1230,7 +1228,7 @@ void Parser::openDoor() {  		}  	} -	if (_vm->_gyro->_room == kRoomMap) +	if (_vm->_avalot->_room == kRoomMap)  		_vm->_dialogs->displayText("Avvy, you can complete the whole game without ever going " \  				"to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich.");  	else @@ -1254,17 +1252,17 @@ void Parser::putProc() {  	// Thing is the _thing which you're putting in. _thing2 is where you're putting it.  	switch (_thing2) { -	case Gyro::kObjectWine: -		if (_thing == Gyro::kObjectOnion) { -			if (_vm->_gyro->_rottenOnion) +	case Avalot::kObjectWine: +		if (_thing == Avalot::kObjectOnion) { +			if (_vm->_avalot->_rottenOnion)  				_vm->_dialogs->displayText("That's a bit like shutting the stable door after the horse has bolted!");  			else { // Put onion into wine? -				if (_vm->_gyro->_wineState != 3) { +				if (_vm->_avalot->_wineState != 3) {  					Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Dialogs::kControlItalic, Dialogs::kControlRoman);  					_vm->_dialogs->displayText(tmpStr);  				} else { // Put onion into vinegar! Yes! -					_vm->_gyro->_onionInVinegar = true; -					_vm->_lucerna->incScore(7); +					_vm->_avalot->_onionInVinegar = true; +					_vm->_avalot->incScore(7);  					_vm->_dialogs->displayScrollChain('u', 9);  				}  			} @@ -1273,33 +1271,33 @@ void Parser::putProc() {  		break;  	case 54: -		if (_vm->_gyro->_room == kRoomYours) { // Put something into the box. -			if (_vm->_gyro->_boxContent != kNothing) +		if (_vm->_avalot->_room == kRoomYours) { // Put something into the box. +			if (_vm->_avalot->_boxContent != kNothing)  				_vm->_dialogs->displayText("There's something in the box already, Avvy. Try taking that out first.");  			else {  				switch (_thing) { -				case Gyro::kObjectMoney: +				case Avalot::kObjectMoney:  					_vm->_dialogs->displayText("You'd better keep some ready cash on you!");  					break; -				case Gyro::kObjectBell: +				case Avalot::kObjectBell:  					_vm->_dialogs->displayText("That's a silly place to keep a bell.");  					break; -				case Gyro::kObjectBodkin: +				case Avalot::kObjectBodkin:  					_vm->_dialogs->displayText("But you might need it!");  					break; -				case Gyro::kObjectOnion: +				case Avalot::kObjectOnion:  					_vm->_dialogs->displayText("Just give it to Spludwick, Avvy!");  					break;  				default: // Put the object into the box... -					if (_vm->_gyro->_wearing == _thing) { -						Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_gyro->getItem(_thing).c_str()); +					if (_vm->_avalot->_wearing == _thing) { +						Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_avalot->getItem(_thing).c_str());  						_vm->_dialogs->displayText(tmpStr);  					} else {  						openBox(true); // Open box. -						_vm->_gyro->_boxContent = _thing; -						_vm->_gyro->_objects[_thing - 1] = false; -						_vm->_lucerna->refreshObjectList(); +						_vm->_avalot->_boxContent = _thing; +						_vm->_avalot->_objects[_thing - 1] = false; +						_vm->_avalot->refreshObjectList();  						_vm->_dialogs->displayText("OK, it's in the box.");  						openBox(false); // Shut box. @@ -1320,7 +1318,7 @@ void Parser::putProc() {   * @remarks	Originally called 'not_in_order'   */  void Parser::notInOrder() { -	Common::String itemStr = _vm->_gyro->getItem(_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick]); +	Common::String itemStr = _vm->_avalot->getItem(_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick]);  	Common::String tmpStr = Common::String::format("Sorry, I need the ingredients in the right order for this potion. " \  		"What I need next is %s%c2%c", itemStr.c_str(), Dialogs::kControlRegister, Dialogs::kControlSpeechBubble);  	_vm->_dialogs->displayText(tmpStr); @@ -1341,40 +1339,40 @@ void Parser::goToCauldron() {   * @remarks	Originally called 'give2spludwick'   */  bool Parser::giveToSpludwick() { -	if (_vm->_gyro->kSpludwicksOrder[_vm->_gyro->_givenToSpludwick] != _thing) { +	if (_vm->_avalot->kSpludwicksOrder[_vm->_avalot->_givenToSpludwick] != _thing) {  		notInOrder();  		return false;  	}  	switch (_thing) { -	case Gyro::kObjectOnion: -		_vm->_gyro->_objects[Gyro::kObjectOnion - 1] = false; -		if (_vm->_gyro->_rottenOnion) +	case Avalot::kObjectOnion: +		_vm->_avalot->_objects[Avalot::kObjectOnion - 1] = false; +		if (_vm->_avalot->_rottenOnion)  			_vm->_dialogs->displayScrollChain('q', 22);  		else { -			_vm->_gyro->_givenToSpludwick++; +			_vm->_avalot->_givenToSpludwick++;  			_vm->_dialogs->displayScrollChain('q', 20);  			goToCauldron(); -			_vm->_lucerna->incScore(3); +			_vm->_avalot->incScore(3);  		} -		_vm->_lucerna->refreshObjectList(); +		_vm->_avalot->refreshObjectList();  		break; -	case Gyro::kObjectInk: -		_vm->_gyro->_objects[Gyro::kObjectInk - 1] = false; -		_vm->_lucerna->refreshObjectList(); -		_vm->_gyro->_givenToSpludwick++; +	case Avalot::kObjectInk: +		_vm->_avalot->_objects[Avalot::kObjectInk - 1] = false; +		_vm->_avalot->refreshObjectList(); +		_vm->_avalot->_givenToSpludwick++;  		_vm->_dialogs->displayScrollChain('q', 24);  		goToCauldron(); -		_vm->_lucerna->incScore(3); +		_vm->_avalot->incScore(3);  		break; -	case Gyro::kObjectMushroom: -		_vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = false; +	case Avalot::kObjectMushroom: +		_vm->_avalot->_objects[Avalot::kObjectMushroom - 1] = false;  		_vm->_dialogs->displayScrollChain('q', 25); -		_vm->_lucerna->incScore(5); -		_vm->_gyro->_givenToSpludwick++; +		_vm->_avalot->incScore(5); +		_vm->_avalot->_givenToSpludwick++;  		goToCauldron(); -		_vm->_gyro->_objects[Gyro::kObjectPotion - 1] = true; -		_vm->_lucerna->refreshObjectList(); +		_vm->_avalot->_objects[Avalot::kObjectPotion - 1] = true; +		_vm->_avalot->refreshObjectList();  		break;  	default:  		return true; @@ -1384,29 +1382,29 @@ bool Parser::giveToSpludwick() {  }  void Parser::drink() { -	_vm->_gyro->_alcoholLevel += 1; -	if (_vm->_gyro->_alcoholLevel == 5) { -		_vm->_gyro->_objects[Gyro::kObjectKey - 1] = true; // Get the key. -		_vm->_gyro->_teetotal = true; -		_vm->_gyro->_avvyIsAwake = false; -		_vm->_gyro->_avvyInBed = true; -		_vm->_lucerna->refreshObjectList(); -		_vm->_lucerna->dusk(); -		_vm->_gyro->hangAroundForAWhile(); +	_vm->_avalot->_alcoholLevel += 1; +	if (_vm->_avalot->_alcoholLevel == 5) { +		_vm->_avalot->_objects[Avalot::kObjectKey - 1] = true; // Get the key. +		_vm->_avalot->_teetotal = true; +		_vm->_avalot->_avvyIsAwake = false; +		_vm->_avalot->_avvyInBed = true; +		_vm->_avalot->refreshObjectList(); +		_vm->_avalot->dusk(); +		_vm->_avalot->hangAroundForAWhile();  		_vm->_animation->flipRoom(1, 1); -		_vm->_gyro->setBackgroundColor(14); +		_vm->_avalot->setBackgroundColor(14);  		_vm->_animation->_sprites[0]._visible = false;  	}  }  void Parser::cardiffClimbing() { -	if (_vm->_gyro->_standingOnDais) { // Clamber up. +	if (_vm->_avalot->_standingOnDais) { // Clamber up.  		_vm->_dialogs->displayText("You climb down, back onto the floor."); -		_vm->_gyro->_standingOnDais = false; +		_vm->_avalot->_standingOnDais = false;  		_vm->_animation->appearPed(0, 2);  	} else if (_vm->_animation->inField(0)) { // Clamber down  		_vm->_dialogs->displayText("You clamber up onto the dais."); -		_vm->_gyro->_standingOnDais = true; +		_vm->_avalot->_standingOnDais = true;  		_vm->_animation->appearPed(0, 1);  	} else  			_vm->_dialogs->displayText("Get a bit closer, Avvy."); @@ -1417,21 +1415,21 @@ void Parser::already() {  }  void Parser::standUp() { -	switch (_vm->_gyro->_room) { +	switch (_vm->_avalot->_room) {  	case kRoomYours: // Avvy isn't asleep. -		if (_vm->_gyro->_avvyIsAwake && _vm->_gyro->_avvyInBed) {  // But he's in bed. -			if (_vm->_gyro->_teetotal) { +		if (_vm->_avalot->_avvyIsAwake && _vm->_avalot->_avvyInBed) {  // But he's in bed. +			if (_vm->_avalot->_teetotal) {  				_vm->_dialogs->displayScrollChain('d', 12); -				_vm->_gyro->setBackgroundColor(0); +				_vm->_avalot->setBackgroundColor(0);  				_vm->_dialogs->displayScrollChain('d', 14);  			}  			_vm->_animation->_sprites[0]._visible = true; -			_vm->_gyro->_userMovesAvvy = true; +			_vm->_avalot->_userMovesAvvy = true;  			_vm->_animation->appearPed(0, 1);  			_vm->_animation->_direction = Animation::kDirLeft;  			_vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow. -			_vm->_lucerna->incScore(1); -			_vm->_gyro->_avvyInBed = false; +			_vm->_avalot->incScore(1); +			_vm->_avalot->_avvyInBed = false;  			_vm->_timer->loseTimer(Timer::kReasonArkataShouts);  		} else  			already(); @@ -1442,12 +1440,12 @@ void Parser::standUp() {  		break;  	case kRoomNottsPub: -		if (_vm->_gyro->_sittingInPub)  { +		if (_vm->_avalot->_sittingInPub)  {  			_vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down.  			_vm->_animation->_sprites[0]._visible = true; // But standing up.  			_vm->_animation->appearPed(0, 3); // And walking away. -			_vm->_gyro->_sittingInPub = false; // Really not sitting down. -			_vm->_gyro->_userMovesAvvy = true; // And ambulant. +			_vm->_avalot->_sittingInPub = false; // Really not sitting down. +			_vm->_avalot->_userMovesAvvy = true; // And ambulant.  		} else  			already();  		break; @@ -1457,18 +1455,18 @@ void Parser::standUp() {  }  void Parser::getProc(char thing) { -	switch (_vm->_gyro->_room) { +	switch (_vm->_avalot->_room) {  	case kRoomYours:  		if (_vm->_animation->inField(1)) { -			if (_vm->_gyro->_boxContent == thing) { +			if (_vm->_avalot->_boxContent == thing) {  				_vm->_background->drawBackgroundSprite(-1, -1, 4);  				_vm->_dialogs->displayText("OK, I've got it."); -				_vm->_gyro->_objects[thing - 1] = true; -				_vm->_lucerna->refreshObjectList(); -				_vm->_gyro->_boxContent = kNothing; +				_vm->_avalot->_objects[thing - 1] = true; +				_vm->_avalot->refreshObjectList(); +				_vm->_avalot->_boxContent = kNothing;  				_vm->_background->drawBackgroundSprite(-1, -1, 5);  			} else { -				Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_gyro->getItem(thing).c_str()); +				Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_avalot->getItem(thing).c_str());  				_vm->_dialogs->displayText(tmpStr);  			}  		} else @@ -1476,25 +1474,25 @@ void Parser::getProc(char thing) {  		break;  	case kRoomInsideCardiffCastle:  		switch (thing) { -		case Gyro::kObjectPen: +		case Avalot::kObjectPen:  			if (_vm->_animation->inField(1)) { // Standing on the dais. -				if (_vm->_gyro->_takenPen) +				if (_vm->_avalot->_takenPen)  					_vm->_dialogs->displayText("It's not there, Avvy.");  				else {  					// OK: we're taking the pen, and it's there.  					_vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now.  					_vm->_animation->callSpecial(3); // Zap! -					_vm->_gyro->_takenPen = true; -					_vm->_gyro->_objects[Gyro::kObjectPen - 1] = true; -					_vm->_lucerna->refreshObjectList(); +					_vm->_avalot->_takenPen = true; +					_vm->_avalot->_objects[Avalot::kObjectPen - 1] = true; +					_vm->_avalot->refreshObjectList();  					_vm->_dialogs->displayText("Taken.");  				} -			} else if (_vm->_gyro->_standingOnDais) +			} else if (_vm->_avalot->_standingOnDais)  				_vm->_dialogs->displayScrollChain('q', 53);  			else  				_vm->_dialogs->displayScrollChain('q', 51);  			break; -		case Gyro::kObjectBolt: +		case Avalot::kObjectBolt:  			_vm->_dialogs->displayScrollChain('q', 52);  			break;  		default: @@ -1502,14 +1500,14 @@ void Parser::getProc(char thing) {  		}  		break;  	case kRoomRobins: -		if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) { +		if ((thing == Avalot::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) {  			_vm->_background->drawBackgroundSprite(-1, -1, 2);  			_vm->_dialogs->displayText("Got it!"); -			_vm->_gyro->_mushroomGrowing = false; -			_vm->_gyro->_takenMushroom = true; -			_vm->_gyro->_objects[Gyro::kObjectMushroom - 1] = true; -			_vm->_lucerna->refreshObjectList(); -			_vm->_lucerna->incScore(3); +			_vm->_avalot->_mushroomGrowing = false; +			_vm->_avalot->_takenMushroom = true; +			_vm->_avalot->_objects[Avalot::kObjectMushroom - 1] = true; +			_vm->_avalot->refreshObjectList(); +			_vm->_avalot->incScore(3);  		} else  			_vm->_dialogs->displayScrollChain('q', 57);  		break; @@ -1523,13 +1521,13 @@ void Parser::getProc(char thing) {   * @remarks	Originally called 'give_Geida_the_lute'   */  void Parser::giveGeidaTheLute() { -	if (_vm->_gyro->_room != kRoomLustiesRoom) { +	if (_vm->_avalot->_room != kRoomLustiesRoom) {  		Common::String tmpStr = Common::String::format("Not yet. Try later!%c2%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble);  		_vm->_dialogs->displayText(tmpStr);  		return;  	} -	_vm->_gyro->_objects[Gyro::kObjectLute - 1] = false; -	_vm->_lucerna->refreshObjectList(); +	_vm->_avalot->_objects[Avalot::kObjectLute - 1] = false; +	_vm->_avalot->refreshObjectList();  	_vm->_dialogs->displayScrollChain('q', 64); // She plays it.  	_vm->_timer->addTimer(1, Timer::kProcGiveLuteToGeida, Timer::kReasonGeidaSings); @@ -1554,13 +1552,13 @@ void Parser::winSequence() {  Common::String Parser::personSpeaks() {  	if ((_person == kPardon) || (_person == 0)) { -		if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_room)) -			_person = _vm->_gyro->_her; +		if ((_vm->_avalot->_him == kPardon) || (_vm->_avalot->_whereIs[_vm->_avalot->_him - 150] != _vm->_avalot->_room)) +			_person = _vm->_avalot->_her;  		else -			_person = _vm->_gyro->_him; +			_person = _vm->_avalot->_him;  	} -	if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_room) { +	if (_vm->_avalot->_whereIs[_person - 150] != _vm->_avalot->_room) {  		return Common::String::format("%c1", Dialogs::kControlRegister); // Avvy himself!  	} @@ -1578,7 +1576,7 @@ Common::String Parser::personSpeaks() {  		return tmpStr;  	for (int i = 0; i < 16; i++) { -		if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_room)) +		if ((_vm->_avalot->kQuasipeds[i]._who == _person) && (_vm->_avalot->kQuasipeds[i]._room == _vm->_avalot->_room))  			tmpStr += Common::String::format("%c%c", Dialogs::kControlRegister, 'A' + i);  	} @@ -1589,7 +1587,7 @@ void Parser::heyThanks() {  	Common::String tmpStr = personSpeaks();  	tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Dialogs::kControlSpeechBubble);  	_vm->_dialogs->displayText(tmpStr); -	_vm->_gyro->_objects[_thing - 1] = false; +	_vm->_avalot->_objects[_thing - 1] = false;  }  /** @@ -1605,7 +1603,7 @@ void Parser::doThat() {  		return;  	} -	if (_vm->_gyro->_weirdWord) +	if (_vm->_avalot->_weirdWord)  		return;  	if (_thing < 200) @@ -1615,11 +1613,11 @@ void Parser::doThat() {  	if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp)  	&& (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart)  	&& (_verb != kVerbCodeDir) && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { -		if (!_vm->_gyro->_alive) { +		if (!_vm->_avalot->_alive) {  			_vm->_dialogs->displayText("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!");  			return;  		} -		if (!_vm->_gyro->_avvyIsAwake  && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { +		if (!_vm->_avalot->_avvyIsAwake  && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) {  			_vm->_dialogs->displayText("Talking in your sleep? Try waking up!");  			return;  		} @@ -1639,7 +1637,7 @@ void Parser::doThat() {  		break;  	case kVerbCodeGet:  		if (_thing != kPardon) { // Legitimate try to pick something up. -			if (_vm->_gyro->_carryNum >= kCarryLimit) +			if (_vm->_avalot->_carryNum >= kCarryLimit)  				_vm->_dialogs->displayText("You can't carry any more!");  			else  				getProc(_thing); @@ -1659,21 +1657,21 @@ void Parser::doThat() {  		break;  	case kVerbCodeTalk:  		if (_person == kPardon) { -			if (_vm->_gyro->_subjectNum == 99) { // They typed "say password". +			if (_vm->_avalot->_subjectNum == 99) { // They typed "say password".  				Common::String tmpStr = Common::String::format("Yes, but what %cis%c the password?", Dialogs::kControlItalic, Dialogs::kControlRoman);  				_vm->_dialogs->displayText(tmpStr); -			} else if (((1 <= _vm->_gyro->_subjectNum) && (_vm->_gyro->_subjectNum <= 49)) || (_vm->_gyro->_subjectNum == 253) || (_vm->_gyro->_subjectNum == 249)) { +			} else if (((1 <= _vm->_avalot->_subjectNum) && (_vm->_avalot->_subjectNum <= 49)) || (_vm->_avalot->_subjectNum == 253) || (_vm->_avalot->_subjectNum == 249)) {  				_thats.deleteChar(0);  				for (int i = 0; i < 10; i++)  					_realWords[i] = _realWords[i + 1]; -				_verb = _vm->_gyro->_subjectNum; +				_verb = _vm->_avalot->_subjectNum;  				doThat();  				return;  			} else { -				_person = _vm->_gyro->_subjectNum; -				_vm->_gyro->_subjectNum = 0; +				_person = _vm->_avalot->_subjectNum; +				_vm->_avalot->_subjectNum = 0;  				if ((_person == 0) || (_person == kPardon))  					_vm->_dialogs->displayText("Talk to whom?");  				else if (isPersonHere()) @@ -1688,80 +1686,80 @@ void Parser::doThat() {  				_vm->_dialogs->displayText("Give to whom?");  			else if (isPersonHere()) {  				switch (_thing) { -				case Gyro::kObjectMoney : +				case Avalot::kObjectMoney :  					_vm->_dialogs->displayText("You can't bring yourself to give away your moneybag.");  					break; -				case Gyro::kObjectBodkin: -				case Gyro::kObjectBell: -				case Gyro::kObjectClothes: -				case Gyro::kObjectHabit : +				case Avalot::kObjectBodkin: +				case Avalot::kObjectBell: +				case Avalot::kObjectClothes: +				case Avalot::kObjectHabit :  					_vm->_dialogs->displayText("Don't give it away, it might be useful!");  					break;  				default:  					switch (_person) { -					case Gyro::kPeopleCrapulus: -						if (_thing == Gyro::kObjectWine) { +					case Avalot::kPeopleCrapulus: +						if (_thing == Avalot::kObjectWine) {  							_vm->_dialogs->displayText("Crapulus grabs the wine and gulps it down."); -							_vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; +							_vm->_avalot->_objects[Avalot::kObjectWine - 1] = false;  						} else  							heyThanks();  						break; -					case Gyro::kPeopleCwytalot: -						if ((_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) +					case Avalot::kPeopleCwytalot: +						if ((_thing == Avalot::kObjectCrossbow) || (_thing == Avalot::kObjectBolt))  							_vm->_dialogs->displayText("You might be able to influence Cwytalot more if you used it!");  						else  							heyThanks();  						break; -					case Gyro::kPeopleSpludwick: +					case Avalot::kPeopleSpludwick:  						if (giveToSpludwick())  							heyThanks();  						break; -					case Gyro::kPeopleIbythneth: -						if (_thing == Gyro::kObjectBadge) { +					case Avalot::kPeopleIbythneth: +						if (_thing == Avalot::kObjectBadge) {  							_vm->_dialogs->displayScrollChain('q', 32); // Thanks! Wow! -							_vm->_lucerna->incScore(3); -							_vm->_gyro->_objects[Gyro::kObjectBadge - 1] = false; -							_vm->_gyro->_objects[Gyro::kObjectHabit - 1] = true; -							_vm->_gyro->_givenBadgeToIby = true; +							_vm->_avalot->incScore(3); +							_vm->_avalot->_objects[Avalot::kObjectBadge - 1] = false; +							_vm->_avalot->_objects[Avalot::kObjectHabit - 1] = true; +							_vm->_avalot->_givenBadgeToIby = true;  							_vm->_background->drawBackgroundSprite(-1, -1, 7);  							_vm->_background->drawBackgroundSprite(-1, -1, 8);  						} else  							heyThanks();  						break; -					case Gyro::kPeopleAyles: -						if (_vm->_gyro->_aylesIsAwake) { -							if (_thing == Gyro::kObjectPen) { -								_vm->_gyro->_objects[Gyro::kObjectPen - 1] = false; +					case Avalot::kPeopleAyles: +						if (_vm->_avalot->_aylesIsAwake) { +							if (_thing == Avalot::kObjectPen) { +								_vm->_avalot->_objects[Avalot::kObjectPen - 1] = false;  								_vm->_dialogs->displayScrollChain('q', 54); -								_vm->_gyro->_objects[Gyro::kObjectInk - 1] = true; -								_vm->_gyro->_givenPenToAyles = true; -								_vm->_lucerna->refreshObjectList(); -								_vm->_lucerna->incScore(2); +								_vm->_avalot->_objects[Avalot::kObjectInk - 1] = true; +								_vm->_avalot->_givenPenToAyles = true; +								_vm->_avalot->refreshObjectList(); +								_vm->_avalot->incScore(2);  							} else  								heyThanks();  						} else  							_vm->_dialogs->displayText("But he's asleep!");  						break; -					case Gyro::kPeopleGeida: +					case Avalot::kPeopleGeida:  						switch (_thing) { -						case Gyro::kObjectPotion: -							_vm->_gyro->_objects[Gyro::kObjectPotion - 1] = false; +						case Avalot::kObjectPotion: +							_vm->_avalot->_objects[Avalot::kObjectPotion - 1] = false;  							_vm->_dialogs->displayScrollChain('u', 16); // She drinks it. -							_vm->_lucerna->incScore(2); -							_vm->_gyro->_givenPotionToGeida = true; -							_vm->_lucerna->refreshObjectList(); +							_vm->_avalot->incScore(2); +							_vm->_avalot->_givenPotionToGeida = true; +							_vm->_avalot->refreshObjectList();  							break; -						case Gyro::kObjectLute: +						case Avalot::kObjectLute:  							giveGeidaTheLute();  							break;  						default:  							heyThanks();  						}  						break; -					case Gyro::kPeopleArkata: +					case Avalot::kPeopleArkata:  						switch (_thing) { -						case Gyro::kObjectPotion: -							if (_vm->_gyro->_givenPotionToGeida) +						case Avalot::kObjectPotion: +							if (_vm->_avalot->_givenPotionToGeida)  								winSequence();  							else  								_vm->_dialogs->displayScrollChain('q', 77); // That Geida woman! @@ -1775,7 +1773,7 @@ void Parser::doThat() {  					}  				}  			} -			_vm->_lucerna->refreshObjectList(); // Just in case... +			_vm->_avalot->refreshObjectList(); // Just in case...  		}  		break; @@ -1806,7 +1804,7 @@ void Parser::doThat() {  		else {  			Common::String tmpStr = Common::String::format("%cC%cDo you really want to quit?", Dialogs::kControlRegister, Dialogs::kControlIcon);  			if (_vm->_dialogs->displayQuestion(tmpStr)) -				_vm->_gyro->_letMeOut = true; +				_vm->_avalot->_letMeOut = true;  		}  		break;  	case kVerbCodeGo: @@ -1821,45 +1819,45 @@ void Parser::doThat() {  		toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + Dialogs::kControlCenter + Dialogs::kControlNewLine  			+ "The medi\x91val descendant of" + Dialogs::kControlNewLine  			+ "Denarius Avaricius Sextus" + Dialogs::kControlNewLine + Dialogs::kControlNewLine -			+ "version " + _vm->_gyro->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " -			+ _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon; +			+ "version " + _vm->_avalot->kVersionNum + Dialogs::kControlNewLine + Dialogs::kControlNewLine + "Copyright \xEF " +			+ _vm->_avalot->kCopyright + ", Mark, Mike and Thomas Thurman." + Dialogs::kControlRegister + 'Y' + Dialogs::kControlIcon;  		_vm->_dialogs->displayText(toDisplay);  		_vm->_dialogs->_aboutBox = false;  		}  		break;  	case kVerbCodeUndress: -		if (_vm->_gyro->_wearing == kNothing) +		if (_vm->_avalot->_wearing == kNothing)  			_vm->_dialogs->displayText("You're already stark naked!"); -		else if (_vm->_gyro->_avvysInTheCupboard) { -			Common::String tmpStr = Common::String::format("You take off %s.", _vm->_gyro->getItem(_vm->_gyro->_wearing).c_str()); +		else if (_vm->_avalot->_avvysInTheCupboard) { +			Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_vm->_avalot->_wearing).c_str());  			_vm->_dialogs->displayText(tmpStr); -			_vm->_gyro->_wearing = kNothing; -			_vm->_lucerna->refreshObjectList(); +			_vm->_avalot->_wearing = kNothing; +			_vm->_avalot->refreshObjectList();  		} else  			_vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?");  		break;  	case kVerbCodeWear:  		if (isHolding()) { // Wear something.  			switch (_thing) { -			case Gyro::kObjectChastity: +			case Avalot::kObjectChastity:  				// \? are used to avoid that ??! is parsed as a trigraph  				_vm->_dialogs->displayText("Hey, what kind of a weirdo are you\?\?!");  				break; -			case Gyro::kObjectClothes: -			case Gyro::kObjectHabit: { // Change this! -				if (_vm->_gyro->_wearing != kNothing) { -					if (_vm->_gyro->_wearing == _thing) +			case Avalot::kObjectClothes: +			case Avalot::kObjectHabit: { // Change this! +				if (_vm->_avalot->_wearing != kNothing) { +					if (_vm->_avalot->_wearing == _thing)  						_vm->_dialogs->displayText("You're already wearing that.");  					else  						_vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!");  					return;  				} else -					_vm->_gyro->_wearing = _thing; +					_vm->_avalot->_wearing = _thing; -				_vm->_lucerna->refreshObjectList(); +				_vm->_avalot->refreshObjectList();  				byte i; -				if (_thing == Gyro::kObjectHabit) +				if (_thing == Avalot::kObjectHabit)  					i = 3;  				else  					i = 0; @@ -1881,36 +1879,36 @@ void Parser::doThat() {  		break;  	case kVerbCodePlay:  		if (_thing == kPardon) { -			switch (_vm->_gyro->_room) { // They just typed "play"... +			switch (_vm->_avalot->_room) { // They just typed "play"...  			case kRoomArgentPub: // ...in the pub, => play Nim.  				warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()");  				// play_nim();  				// The following parts are copied from play_nim().  				// The player automatically wins the game everytime he wins, until I implement the mini-game. -				if (_vm->_gyro->_wonNim) { // Already won the game. +				if (_vm->_avalot->_wonNim) { // Already won the game.  					_vm->_dialogs->displayScrollChain('Q', 6);  					return;  				} -				if (!_vm->_gyro->_askedDogfoodAboutNim) { +				if (!_vm->_avalot->_askedDogfoodAboutNim) {  					_vm->_dialogs->displayScrollChain('q', 84);  					return;  				}  				_vm->_dialogs->displayScrollChain('Q', 3); -				_vm->_gyro->_playedNim++; +				_vm->_avalot->_playedNim++;  				// You won - strange!  				_vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! -				_vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; -				_vm->_lucerna->refreshObjectList(); -				_vm->_gyro->_wonNim = true; +				_vm->_avalot->_objects[Avalot::kObjectLute - 1] = true; +				_vm->_avalot->refreshObjectList(); +				_vm->_avalot->_wonNim = true;  				_vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. -				_vm->_lucerna->incScore(7); // 7 points for winning! +				_vm->_avalot->incScore(7); // 7 points for winning! -				if (_vm->_gyro->_playedNim == 1) -					_vm->_lucerna->incScore(3); // 3 points for playing your 1st game. +				if (_vm->_avalot->_playedNim == 1) +					_vm->_avalot->incScore(3); // 3 points for playing your 1st game.  				// A warning to the player that there should have been a mini-game. TODO: Remove it later!!!  				_vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") @@ -1922,23 +1920,23 @@ void Parser::doThat() {  			}  		} else if (isHolding()) {  			switch (_thing) { -			case Gyro::kObjectLute : +			case Avalot::kObjectLute :  					_vm->_dialogs->displayScrollChain('U', 7); -					if (_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room) +					if (_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] == _vm->_avalot->_room)  						_vm->_dialogs->displayScrollChain('U', 10); -					if (_vm->_gyro->_whereIs[Gyro::kPeopleDuLustie - 150] == _vm->_gyro->_room) +					if (_vm->_avalot->_whereIs[Avalot::kPeopleDuLustie - 150] == _vm->_avalot->_room)  						_vm->_dialogs->displayScrollChain('U', 15);  				break;  			case 52: -				if (_vm->_gyro->_room == kRoomMusicRoom) +				if (_vm->_avalot->_room == kRoomMusicRoom)  					playHarp();  				else  					_vm->_dialogs->displayText(kWhat);  				break;  			case 55: -				if (_vm->_gyro->_room == kRoomArgentPub) +				if (_vm->_avalot->_room == kRoomArgentPub)  					// play_nim();  					warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()");  				else @@ -1951,9 +1949,9 @@ void Parser::doThat() {  		break;  	case kVerbCodeRing:  		if (isHolding()) { -			if (_thing == Gyro::kObjectBell) { +			if (_thing == Avalot::kObjectBell) {  				_vm->_dialogs->displayText("Ding, dong, ding, dong, ding, dong, ding, dong..."); -				if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) +				if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B')))  					// \? are used to avoid that ??! is parsed as a trigraph  					_vm->_dialogs->displayText("(Are you trying to join in, Avvy\?\?!)");  			} else @@ -1975,7 +1973,7 @@ void Parser::doThat() {  		warning("STUB: Parser::doThat() - case kVerbCodeboss");  		break;  	case kVerbCodePee: -		if (_vm->_gyro->setFlag('P')) { +		if (_vm->_avalot->setFlag('P')) {  			_vm->_dialogs->displayText("Hmm, I don't think anyone will notice...");  			_vm->_timer->addTimer(4, Timer::kProcUrinate, Timer::kReasonGoToToilet);  		} else { @@ -1986,16 +1984,16 @@ void Parser::doThat() {  	case kVerbCodeCheat: {  		Common::String tmpStr = Common::String::format("%cCheat mode now enabled.", Dialogs::kControlItalic);  		_vm->_dialogs->displayText(tmpStr); -		_vm->_gyro->_cheat = true; +		_vm->_avalot->_cheat = true;  		}  		break;  	case kVerbCodeMagic: -		if (_vm->_gyro->_avariciusTalk > 0) +		if (_vm->_avalot->_avariciusTalk > 0)  			_vm->_dialogs->displayScrollChain('q', 19);  		else { -			if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears! +			if ((_vm->_avalot->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears!  				_vm->_dialogs->displayScrollChain('q', 17); -				if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) +				if (_vm->_avalot->_whereIs[1] == kRoomSpludwicks)  					_vm->_dialogs->displayScrollChain('q', 18);  				else {  					Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -2004,7 +2002,7 @@ void Parser::doThat() {  					spr->walkTo(4);  					spr->_callEachStepFl = true;  					spr->_eachStepProc = Animation::kProcBackAndForth; -					_vm->_gyro->_avariciusTalk = 14; +					_vm->_avalot->_avariciusTalk = 14;  					_vm->_timer->addTimer(177, Timer::kProcAvariciusTalks, Timer::kReasonAvariciusTalks);  				}  			} else @@ -2015,7 +2013,7 @@ void Parser::doThat() {  		_vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric.");  		break;  	case kVerbCodeExpletive: -		switch (_vm->_gyro->_sworeNum) { +		switch (_vm->_avalot->_sworeNum) {  		case 0: {  			Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \  				"(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); @@ -2033,21 +2031,21 @@ void Parser::doThat() {  			// CHECKME: Weird character in string  			Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you.%c%c(`Such is the anger of the gods, Avvy!\")", Dialogs::kControlNewLine, Dialogs::kControlNewLine);  			_vm->_dialogs->displayText(tmpStr); -			_vm->_lucerna->gameOver(); +			_vm->_avalot->gameOver();  			}  		} -		_vm->_gyro->_sworeNum++; +		_vm->_avalot->_sworeNum++;  		break;  	case kVerbCodeListen: -		if ((_vm->_gyro->_bellsAreRinging) & (_vm->_gyro->setFlag('B'))) +		if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B')))  			_vm->_dialogs->displayText("All other noise is drowned out by the ringing of the bells."); -		else if (_vm->_gyro->_listen.empty()) +		else if (_vm->_avalot->_listen.empty())  			_vm->_dialogs->displayText("You can't hear anything much at the moment, Avvy.");  		else -			_vm->_dialogs->displayText(_vm->_gyro->_listen); +			_vm->_dialogs->displayText(_vm->_avalot->_listen);  		break;  	case kVerbCodeBuy: // What are they trying to buy? -		switch (_vm->_gyro->_room) { +		switch (_vm->_avalot->_room) {  		case kRoomArgentPub:  			if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar.  				switch (_thing) { @@ -2055,40 +2053,40 @@ void Parser::doThat() {  				case 53:  				case 54:  				case 58: // Beer, whisky, cider or mead. -					if (_vm->_gyro->_malagauche == 177) { // Already getting us one. +					if (_vm->_avalot->_malagauche == 177) { // Already getting us one.  						_vm->_dialogs->displayScrollChain('D', 15);  						return;  					} -					if (_vm->_gyro->_teetotal)  { +					if (_vm->_avalot->_teetotal)  {  						_vm->_dialogs->displayScrollChain('D', 6);  						return;  					} -					if (_vm->_gyro->_alcoholLevel == 0) -						_vm->_lucerna->incScore(3); +					if (_vm->_avalot->_alcoholLevel == 0) +						_vm->_avalot->incScore(3);  					_vm->_background->drawBackgroundSprite(-1, -1, 11);  					_vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble); -					_vm->_gyro->_drinking = _thing; +					_vm->_avalot->_drinking = _thing;  					_vm->_background->drawBackgroundSprite(-1, -1, 9); -					_vm->_gyro->_malagauche = 177; +					_vm->_avalot->_malagauche = 177;  					_vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks);  					break;  				case 52:  					examine();  					break; // We have a right one here - buy Pepsi??! -				case Gyro::kObjectWine: -					if (_vm->_gyro->_objects[Gyro::kObjectWine - 1])  // We've already got the wine! +				case Avalot::kObjectWine: +					if (_vm->_avalot->_objects[Avalot::kObjectWine - 1])  // We've already got the wine!  						_vm->_dialogs->displayScrollChain('D', 2); // 1 bottle's shufishent!  					else { -						if (_vm->_gyro->_malagauche == 177) { // Already getting us one. +						if (_vm->_avalot->_malagauche == 177) { // Already getting us one.  							_vm->_dialogs->displayScrollChain('D', 15);  							return;  						} -						if (_vm->_gyro->_carryNum >= kCarryLimit) { +						if (_vm->_avalot->_carryNum >= kCarryLimit) {  							_vm->_dialogs->displayText("Your hands are full.");  							return;  						} @@ -2096,10 +2094,10 @@ void Parser::doThat() {  						_vm->_background->drawBackgroundSprite(-1, -1, 11);  						Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble);  						_vm->_dialogs->displayText(tmpStr); -						if (_vm->_gyro->_alcoholLevel == 0) -							_vm->_lucerna->incScore(3); +						if (_vm->_avalot->_alcoholLevel == 0) +							_vm->_avalot->incScore(3);  						_vm->_background->drawBackgroundSprite(-1, -1, 9); -						_vm->_gyro->_malagauche = 177; +						_vm->_avalot->_malagauche = 177;  						_vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks);  					} @@ -2111,24 +2109,24 @@ void Parser::doThat() {  		case kRoomOutsideDucks:  			if (_vm->_animation->inField(5)) { -				if (_thing == Gyro::kObjectOnion) { -					if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) +				if (_thing == Avalot::kObjectOnion) { +					if (_vm->_avalot->_objects[Avalot::kObjectOnion - 1])  						_vm->_dialogs->displayScrollChain('D', 10); // Not planning to juggle with the things! -					else if (_vm->_gyro->_carryNum >= kCarryLimit) +					else if (_vm->_avalot->_carryNum >= kCarryLimit)  						_vm->_dialogs->displayText("Before you ask, you remember that your hands are full.");  					else { -						if (_vm->_gyro->_boughtOnion) +						if (_vm->_avalot->_boughtOnion)  							_vm->_dialogs->displayScrollChain('D', 11);  						else {  							_vm->_dialogs->displayScrollChain('D', 9); -							_vm->_lucerna->incScore(3); +							_vm->_avalot->incScore(3);  						} -						_vm->_gyro->decreaseMoney(3); // It costs thruppence. -						_vm->_gyro->_objects[Gyro::kObjectOnion - 1] = true; -						_vm->_lucerna->refreshObjectList(); -						_vm->_gyro->_boughtOnion = true; -						_vm->_gyro->_rottenOnion = false; // It's OK when it leaves the stall! -						_vm->_gyro->_onionInVinegar = false; +						_vm->_avalot->decreaseMoney(3); // It costs thruppence. +						_vm->_avalot->_objects[Avalot::kObjectOnion - 1] = true; +						_vm->_avalot->refreshObjectList(); +						_vm->_avalot->_boughtOnion = true; +						_vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! +						_vm->_avalot->_onionInVinegar = false;  					}  				} else  					_vm->_dialogs->displayScrollChain('D', 0); @@ -2144,33 +2142,33 @@ void Parser::doThat() {  		}  		break;  	case kVerbCodeAttack: -		if ((_vm->_gyro->_room == kRoomBrummieRoad) && -			((_person == Gyro::kPeopleCwytalot) || (_thing == Gyro::kObjectCrossbow) || (_thing == Gyro::kObjectBolt)) && -			(_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] == _vm->_gyro->_room)) { -			switch (_vm->_gyro->_objects[Gyro::kObjectBolt - 1] + _vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] * 2) { +		if ((_vm->_avalot->_room == kRoomBrummieRoad) && +			((_person == Avalot::kPeopleCwytalot) || (_thing == Avalot::kObjectCrossbow) || (_thing == Avalot::kObjectBolt)) && +			(_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] == _vm->_avalot->_room)) { +			switch (_vm->_avalot->_objects[Avalot::kObjectBolt - 1] + _vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] * 2) {  				// 0 = neither, 1 = only bolt, 2 = only crossbow, 3 = both.  			case 0:  				_vm->_dialogs->displayScrollChain('Q', 10);  				_vm->_dialogs->displayText("(At the very least, don't use your bare hands!)");  				break;  			case 1: -				_vm->_dialogs->displayText("Attack _vm->_gyro->him with only a crossbow bolt? Are you planning on playing darts?!"); +				_vm->_dialogs->displayText("Attack _vm->_avalot->him with only a crossbow bolt? Are you planning on playing darts?!");  				break;  			case 2:  				_vm->_dialogs->displayText("Come on, Avvy! You're not going to get very far with only a crossbow!");  				break;  			case 3:  				_vm->_dialogs->displayScrollChain('Q', 11); -				_vm->_gyro->_cwytalotGone = true; -				_vm->_gyro->_objects[Gyro::kObjectBolt - 1] = false; -				_vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = false; -				_vm->_lucerna->refreshObjectList(); -				_vm->_gyro->_magics[11]._operation = Gyro::kMagicNothing; -				_vm->_lucerna->incScore(7); +				_vm->_avalot->_cwytalotGone = true; +				_vm->_avalot->_objects[Avalot::kObjectBolt - 1] = false; +				_vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = false; +				_vm->_avalot->refreshObjectList(); +				_vm->_avalot->_magics[11]._operation = Avalot::kMagicNothing; +				_vm->_avalot->incScore(7);  				_vm->_animation->_sprites[1].walkTo(1);  				_vm->_animation->_sprites[1]._vanishIfStill = true;  				_vm->_animation->_sprites[1]._callEachStepFl = false; -				_vm->_gyro->_whereIs[Gyro::kPeopleCwytalot - 150] = kRoomDummy; +				_vm->_avalot->_whereIs[Avalot::kPeopleCwytalot - 150] = kRoomDummy;  				break;  			default:  				_vm->_dialogs->displayScrollChain('Q', 10); // Please try not to be so violent! @@ -2179,14 +2177,14 @@ void Parser::doThat() {  			_vm->_dialogs->displayScrollChain('Q', 10);  		break;  	case kVerbCodePasswd: -		if (_vm->_gyro->_room != kRoomBridge) +		if (_vm->_avalot->_room != kRoomBridge)  			_vm->_dialogs->displayScrollChain('Q', 12);  		else {  			bool ok = true;  			for (uint i = 0; i < _thats.size(); i++) {  				Common::String temp = _realWords[i];  				temp.toUppercase(); -				int pwdId = _vm->_gyro->_passwordNum + kFirstPassword; +				int pwdId = _vm->_avalot->_passwordNum + kFirstPassword;  				for (uint j = 0; j < _vocabulary[pwdId]._word.size(); j++) {  					if (_vocabulary[pwdId]._word[j] != temp[j])  						ok = false; @@ -2194,13 +2192,13 @@ void Parser::doThat() {  			}  			if (ok) { -				if (_vm->_gyro->_drawbridgeOpen != 0) +				if (_vm->_avalot->_drawbridgeOpen != 0)  					_vm->_dialogs->displayText("Contrary to your expectations, the drawbridge fails to close again.");  				else { -					_vm->_lucerna->incScore(4); +					_vm->_avalot->incScore(4);  					_vm->_dialogs->displayText("The drawbridge opens!");  					_vm->_timer->addTimer(7, Timer::kProcOpenDrawbridge, Timer::kReasonDrawbridgeFalls); -					_vm->_gyro->_drawbridgeOpen = 1; +					_vm->_avalot->_drawbridgeOpen = 1;  				}  			} else  				_vm->_dialogs->displayScrollChain('Q', 12); @@ -2210,10 +2208,10 @@ void Parser::doThat() {  		//_vm->_enid->dir(_realWords[1]); TODO: Replace it with proper ScummVM-friendly function(s)!  		break;  	case kVerbCodeDie: -		_vm->_lucerna->gameOver(); +		_vm->_avalot->gameOver();  		break;  	case kVerbCodeScore: { -		Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_gyro->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str()); +		Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%cThis gives you a rank of %s.%c%c%s", _vm->_avalot->_dnascore, Dialogs::kControlCenter, Dialogs::kControlNewLine, Dialogs::kControlNewLine, Dialogs::kControlNewLine, rank().c_str(), Dialogs::kControlNewLine, Dialogs::kControlNewLine, totalTime().c_str());  		_vm->_dialogs->displayText(tmpStr);  		}  		break; @@ -2228,31 +2226,31 @@ void Parser::doThat() {  			_vm->_dialogs->displayText("Kiss whom?");  		else if (isPersonHere()) {  			switch (_person) { -			case Gyro::kPeopleArkata: +			case Avalot::kPeopleArkata:  				_vm->_dialogs->displayScrollChain('U', 12);  				break; -			case Gyro::kPeopleGeida: +			case Avalot::kPeopleGeida:  				_vm->_dialogs->displayScrollChain('U', 13);  				break; -			case Gyro::kPeopleWisewoman: +			case Avalot::kPeopleWisewoman:  				_vm->_dialogs->displayScrollChain('U', 14);  				break;  			default:  				_vm->_dialogs->displayScrollChain('U', 5); // You WHAT?  			} -		} else if ((Gyro::kPeopleAvalot <= _person) && (_person < Gyro::kPeopleArkata)) +		} else if ((Avalot::kPeopleAvalot <= _person) && (_person < Avalot::kPeopleArkata))  			_vm->_dialogs->displayText("Hey, what kind of a weirdo are you??");  		break;  	case kVerbCodeClimb: -		if (_vm->_gyro->_room == kRoomInsideCardiffCastle) +		if (_vm->_avalot->_room == kRoomInsideCardiffCastle)  			cardiffClimbing();  		else // In the wrong room!  			_vm->_dialogs->displayText("Not with your head for heights, Avvy!");  		break;  	case kVerbCodeJump:  		_vm->_timer->addTimer(1, Timer::kProcJump, Timer::kReasonJumping); -		_vm->_gyro->_userMovesAvvy = false; +		_vm->_avalot->_userMovesAvvy = false;  		break;  	case kVerbCodeHiscores:  		//	show_highs(); @@ -2262,23 +2260,23 @@ void Parser::doThat() {  		if (isPersonHere())  			switch (_person) {  			case kPardon: -			case Gyro::kPeopleAvalot: +			case Avalot::kPeopleAvalot:  			case 0: -				if (!_vm->_gyro->_avvyIsAwake) { -					_vm->_gyro->_avvyIsAwake = true; -					_vm->_lucerna->incScore(1); -					_vm->_gyro->_avvyInBed = true; +				if (!_vm->_avalot->_avvyIsAwake) { +					_vm->_avalot->_avvyIsAwake = true; +					_vm->_avalot->incScore(1); +					_vm->_avalot->_avvyInBed = true;  					_vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed. -					if (_vm->_gyro->_teetotal) +					if (_vm->_avalot->_teetotal)  						_vm->_dialogs->displayScrollChain('d', 13);  				} else  					_vm->_dialogs->displayText("You're already awake, Avvy!");  				break; -			case Gyro::kPeopleAyles: -				if (!_vm->_gyro->_aylesIsAwake) +			case Avalot::kPeopleAyles: +				if (!_vm->_avalot->_aylesIsAwake)  					_vm->_dialogs->displayText("You can't seem to wake him by yourself.");  				break; -			case Gyro::kPeopleJacques: { +			case Avalot::kPeopleJacques: {  				Common::String tmpStr = Common::String::format("Brother Jacques, Brother Jacques, are you asleep?%c1%c" \  					"Hmmm... that doesn't seem to do any good...", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble);  				_vm->_dialogs->displayText(tmpStr); @@ -2289,26 +2287,26 @@ void Parser::doThat() {  		}  		break;  	case kVerbCodeSit: -		if (_vm->_gyro->_room == kRoomNottsPub) { -			if (_vm->_gyro->_sittingInPub) +		if (_vm->_avalot->_room == kRoomNottsPub) { +			if (_vm->_avalot->_sittingInPub)  				_vm->_dialogs->displayText("You're already sitting!");  			else {  				_vm->_animation->_sprites[0].walkTo(3); // Move Avvy to the place, and sit him down.  				_vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown);  			}  		} else { // Default doodah. -			_vm->_lucerna->dusk(); -			_vm->_gyro->hangAroundForAWhile(); -			_vm->_lucerna->dawn(); +			_vm->_avalot->dusk(); +			_vm->_avalot->hangAroundForAWhile(); +			_vm->_avalot->dawn();  			Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", Dialogs::kControlParagraph);  			_vm->_dialogs->displayText(tmpStr);  		}  		break;  	case kVerbCodeRestart:  		if (_vm->_dialogs->displayQuestion("Restart game and lose changes?"))  { -			_vm->_lucerna->dusk(); -			_vm->_gyro->newGame(); -			_vm->_lucerna->dawn(); +			_vm->_avalot->dusk(); +			_vm->_avalot->newGame(); +			_vm->_avalot->dawn();  		}  		break;  	case kPardon: diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp index 95e15e599f..368fa0dfd7 100644 --- a/engines/avalanche/pingo.cpp +++ b/engines/avalanche/pingo.cpp @@ -30,8 +30,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/pingo.h" -#include "avalanche/gyro.h" -#include "avalanche/lucerna.h"  #include "avalanche/animation.h"  #include "avalanche/dialogs.h" @@ -78,7 +76,7 @@ void Pingo::zonk() {  void Pingo::winningPic() {  	Common::File f; -	_vm->_lucerna->dusk(); +	_vm->_avalot->dusk();  	if (!f.open("finale.avd"))  		error("AVALANCHE: Lucerna: File not found: finale.avd"); @@ -97,11 +95,11 @@ void Pingo::winningPic() {  	warning("STUB: Pingo::winningPic()"); -	_vm->_lucerna->dawn(); +	_vm->_avalot->dawn();  #if 0  	do { -		_vm->_gyro->check(); +		_vm->_avalot->check();  	} while (!(keypressed() || (mrelease > 0)));  	while (keypressed())  		char r = readkey(); diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 712275e73d..8ca3844bc9 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -29,7 +29,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/sequence.h" -#include "avalanche/gyro.h"  #include "avalanche/timer.h"  #include "avalanche/background.h"  #include "avalanche/animation.h" @@ -61,8 +60,8 @@ void Sequence::thenShow(byte what) {  void Sequence::thenFlip(byte where, byte ped) {  	thenShow(kNowFlip); -	_vm->_gyro->_flipToWhere = where; -	_vm->_gyro->_flipToPed = ped; +	_vm->_avalot->_flipToWhere = where; +	_vm->_avalot->_flipToPed = ped;  }  void Sequence::startToClose() { @@ -71,7 +70,7 @@ void Sequence::startToClose() {  }  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.  	startToClose(); // Apart from that, it's the same thing.  } @@ -90,8 +89,8 @@ void Sequence::callSequencer() {  		return; // No more routines.  		break;  	case 177: // Flip room. -		_vm->_gyro->_userMovesAvvy = true; -		_vm->_animation->flipRoom(_vm->_gyro->_flipToWhere, _vm->_gyro->_flipToPed); +		_vm->_avalot->_userMovesAvvy = true; +		_vm->_animation->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed);  		if (curSeq == 177)  			shoveLeft();  		break; diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b40731adc6..081f7a314b 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -29,7 +29,6 @@  #include "avalanche/avalanche.h"  #include "avalanche/timer.h" -#include "avalanche/lucerna.h"  #include "avalanche/animation.h"  #include "avalanche/dialogs.h"  #include "avalanche/sequence.h" @@ -55,7 +54,7 @@ Timer::Timer(AvalancheEngine *vm) {   * @remarks	Originally called 'set_up_timer'   */  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;  		while ((i < 7) && (_times[i]._timeLeft != 0))  			i++; @@ -68,7 +67,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) {  		_times[i]._action = action;  		_times[i]._reason = reason;  	} else { -		_vm->_gyro->_isLoaded = false; +		_vm->_avalot->_isLoaded = false;  		return;  	}  } @@ -156,7 +155,7 @@ void Timer::updateTimer() {  				crapulusSaysSpludOut();  				break;  			case kProcDawnDelay: -				_vm->_lucerna->dawn(); +				_vm->_avalot->dawn();  				break;  			case kProcBuyDrinks:  				buyDrinks(); @@ -215,8 +214,8 @@ void Timer::updateTimer() {  			}  		}  	} -	_vm->_gyro->_roomTime++; // Cycles since you've been in this room. -	_vm->_gyro->_totalTime++; // Total amount of time for this game. +	_vm->_avalot->_roomTime++; // Cycles since you've been in this room. +	_vm->_avalot->_totalTime++; // Total amount of time for this game.  }  void Timer::loseTimer(byte which) { @@ -229,29 +228,29 @@ void Timer::loseTimer(byte which) {  }  void Timer::openDrawbridge() { -	_vm->_gyro->_drawbridgeOpen++; -	_vm->_background->drawBackgroundSprite(-1, -1, _vm->_gyro->_drawbridgeOpen - 2); +	_vm->_avalot->_drawbridgeOpen++; +	_vm->_background->drawBackgroundSprite(-1, -1, _vm->_avalot->_drawbridgeOpen - 2); -	if (_vm->_gyro->_drawbridgeOpen == 4) -		_vm->_gyro->_magics[1]._operation = Gyro::kMagicNothing; // You may enter the drawbridge. +	if (_vm->_avalot->_drawbridgeOpen == 4) +		_vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge.  	else  		addTimer(7, kProcOpenDrawbridge, kReasonDrawbridgeFalls);  }  void Timer::avariciusTalks() { -	_vm->_dialogs->displayScrollChain('q', _vm->_gyro->_avariciusTalk); -	_vm->_gyro->_avariciusTalk++; +	_vm->_dialogs->displayScrollChain('q', _vm->_avalot->_avariciusTalk); +	_vm->_avalot->_avariciusTalk++; -	if (_vm->_gyro->_avariciusTalk < 17) +	if (_vm->_avalot->_avariciusTalk < 17)  		addTimer(177, kProcAvariciusTalks, kReasonAvariciusTalks);  	else -		_vm->_lucerna->incScore(3); +		_vm->_avalot->incScore(3);  }  void Timer::urinate() {  	_vm->_animation->_sprites[0].turn(Animation::kDirUp);  	_vm->_animation->stopWalking(); -	_vm->_lucerna->drawDirection(); +	_vm->_avalot->drawDirection();  	addTimer(14, kProcToilet, kReasonGoToToilet);  } @@ -273,20 +272,20 @@ void Timer::stairs() {  	_vm->_sound->blip();  	_vm->_animation->_sprites[0].walkTo(3);  	_vm->_background->drawBackgroundSprite(-1, -1, 1); -	_vm->_gyro->_brummieStairs = 2; -	_vm->_gyro->_magics[10]._operation = Gyro::kMagicSpecial; -	_vm->_gyro->_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->_brummieStairs = 2; +	_vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial; +	_vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs. +	_vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // Stop them hitting the sides (or the game will hang.)  }  void Timer::cardiffSurvey() { -	if (_vm->_gyro->_cardiffQuestionNum == 0) { -		_vm->_gyro->_cardiffQuestionNum++; +	if (_vm->_avalot->_cardiffQuestionNum == 0) { +		_vm->_avalot->_cardiffQuestionNum++;  		_vm->_dialogs->displayScrollChain('q', 27);  	} -	_vm->_dialogs->displayScrollChain('z', _vm->_gyro->_cardiffQuestionNum); -	_vm->_gyro->_interrogation = _vm->_gyro->_cardiffQuestionNum; +	_vm->_dialogs->displayScrollChain('z', _vm->_avalot->_cardiffQuestionNum); +	_vm->_avalot->_interrogation = _vm->_avalot->_cardiffQuestionNum;  	addTimer(182, kProcCardiffSurvey, kReasonCardiffsurvey);  } @@ -301,8 +300,8 @@ void Timer::cwytalotInHerts() {  void Timer::getTiedUp() {  	_vm->_dialogs->displayScrollChain('q', 34); // ...Trouble! -	_vm->_gyro->_userMovesAvvy = false; -	_vm->_gyro->_beenTiedUp = true; +	_vm->_avalot->_userMovesAvvy = false; +	_vm->_avalot->_beenTiedUp = true;  	_vm->_animation->stopWalking();  	AnimationType *spr = &_vm->_animation->_sprites[1]; @@ -316,8 +315,8 @@ void Timer::getTiedUp() {  void Timer::getTiedUp2() {  	_vm->_animation->_sprites[0].walkTo(3);  	_vm->_animation->_sprites[1].walkTo(4); -	_vm->_gyro->_magics[3]._operation = Gyro::kMagicNothing; // No effect when you touch the boundaries. -	_vm->_gyro->_friarWillTieYouUp = true; +	_vm->_avalot->_magics[3]._operation = Avalot::kMagicNothing; // No effect when you touch the boundaries. +	_vm->_avalot->_friarWillTieYouUp = true;  }  void Timer::hangAround() { @@ -325,7 +324,7 @@ void Timer::hangAround() {  	AnimationType *avvy = &_vm->_animation->_sprites[0];  	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->_dialogs->displayScrollChain('q', 39);  	avvy->walkTo(6); @@ -337,7 +336,7 @@ void Timer::hangAround2() {  	AnimationType *spr = &_vm->_animation->_sprites[1];  	spr->_vanishIfStill = false;  	spr->walkTo(3); -	_vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = kRoomRobins; +	_vm->_avalot->_whereIs[Avalot::kPeopleFriarTuck - 150] = kRoomRobins;  	_vm->_dialogs->displayScrollChain('q', 41);  	_vm->_animation->_sprites[0].remove();  	spr->remove(); // Get rid of Robin Hood and Friar Tuck. @@ -345,20 +344,20 @@ void Timer::hangAround2() {  	addTimer(1, kProcAfterTheShootemup, kReasonHangingAround);  	// 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!  }  void Timer::afterTheShootemup() {  	// 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->appearPed(0, 1); -	_vm->_gyro->_userMovesAvvy = true; -	_vm->_gyro->_objects[Gyro::kObjectCrossbow - 1] = true; -	_vm->_lucerna->refreshObjectList(); +	_vm->_avalot->_userMovesAvvy = true; +	_vm->_avalot->_objects[Avalot::kObjectCrossbow - 1] = true; +	_vm->_avalot->refreshObjectList();  	// 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.") @@ -386,9 +385,9 @@ void Timer::afterTheShootemup() {  }  void Timer::jacquesWakesUp() { -	_vm->_gyro->_jacquesState++; +	_vm->_avalot->_jacquesState++; -	switch (_vm->_gyro->_jacquesState) { // Additional pictures. +	switch (_vm->_avalot->_jacquesState) { // Additional pictures.  	case 1 :  		_vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open.  		_vm->_dialogs->displayScrollChain('Q', 45); @@ -396,22 +395,22 @@ void Timer::jacquesWakesUp() {  	case 2 : // Going through the door.  		_vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor.  		_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;  	case 3 :  // Gone through the door.  		_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->_gyro->_whereIs[Gyro::kPeopleJacques - 150] = 0; // Gone! +		_vm->_avalot->_whereIs[Avalot::kPeopleJacques - 150] = 0; // Gone!  		break;  	} -	if (_vm->_gyro->_jacquesState == 5) { -		_vm->_gyro->_bellsAreRinging = true; -		_vm->_gyro->_aylesIsAwake = true; -		_vm->_lucerna->incScore(2); +	if (_vm->_avalot->_jacquesState == 5) { +		_vm->_avalot->_bellsAreRinging = true; +		_vm->_avalot->_aylesIsAwake = true; +		_vm->_avalot->incScore(2);  	} -	switch (_vm->_gyro->_jacquesState) { +	switch (_vm->_avalot->_jacquesState) {  	case 1:  	case 2:  	case 3: @@ -454,8 +453,8 @@ void Timer::naughtyDuke3() {  void Timer::jump() {  	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	_vm->_gyro->_jumpStatus++; -	switch (_vm->_gyro->_jumpStatus) { +	_vm->_avalot->_jumpStatus++; +	switch (_vm->_avalot->_jumpStatus) {  	case 1:  	case 2:  	case 3: @@ -474,73 +473,73 @@ void Timer::jump() {  		break;  	} -	if (_vm->_gyro->_jumpStatus == 20) { // End of jump. -		_vm->_gyro->_userMovesAvvy = true; -		_vm->_gyro->_jumpStatus = 0; +	if (_vm->_avalot->_jumpStatus == 20) { // End of jump. +		_vm->_avalot->_userMovesAvvy = true; +		_vm->_avalot->_jumpStatus = 0;  	} else // Still jumping.  		addTimer(1, kProcJump, kReasonJumping); -	if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. -			&& (_vm->_gyro->_room == kRoomInsideCardiffCastle) -			&& (_vm->_gyro->_arrowInTheDoor == true) +	if ((_vm->_avalot->_jumpStatus == 10) // You're at the highest point of your jump. +			&& (_vm->_avalot->_room == kRoomInsideCardiffCastle) +			&& (_vm->_avalot->_arrowInTheDoor == true)  			&& (_vm->_animation->inField(2))) { // Beside the wall  		// 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.");  		else {  			_vm->_background->drawBackgroundSprite(-1, -1, 1); -			_vm->_gyro->_arrowInTheDoor = false; // You've got it. -			_vm->_gyro->_objects[Gyro::kObjectBolt - 1] = true; -			_vm->_lucerna->refreshObjectList(); +			_vm->_avalot->_arrowInTheDoor = false; // You've got it. +			_vm->_avalot->_objects[Avalot::kObjectBolt - 1] = true; +			_vm->_avalot->refreshObjectList();  			_vm->_dialogs->displayScrollChain('q', 50); -			_vm->_lucerna->incScore(3); +			_vm->_avalot->incScore(3);  		}  	}  }  void Timer::crapulusSaysSpludOut() {  	_vm->_dialogs->displayScrollChain('q', 56); -	_vm->_gyro->_crapulusWillTell = false; +	_vm->_avalot->_crapulusWillTell = false;  }  void Timer::buyDrinks() {  	_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->_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->_parser->drink();  }  void Timer::buyWine() {  	_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', 1); // It'll be thruppence. -	if (_vm->_gyro->decreaseMoney(3)) { +	if (_vm->_avalot->decreaseMoney(3)) {  		_vm->_dialogs->displayScrollChain('D', 4); // You paid up. -		_vm->_gyro->_objects[Gyro::kObjectWine - 1] = true; -		_vm->_lucerna->refreshObjectList(); -		_vm->_gyro->_wineState = 1; // OK Wine. +		_vm->_avalot->_objects[Avalot::kObjectWine - 1] = true; +		_vm->_avalot->refreshObjectList(); +		_vm->_avalot->_wineState = 1; // OK Wine.  	}  }  void Timer::callsGuards() {  	_vm->_dialogs->displayScrollChain('Q', 58); // "GUARDS!!!" -	_vm->_lucerna->gameOver(); +	_vm->_avalot->gameOver();  }  void Timer::greetsMonk() {  	_vm->_dialogs->displayScrollChain('Q', 59); -	_vm->_gyro->_enteredLustiesRoomAsMonk = true; +	_vm->_avalot->_enteredLustiesRoomAsMonk = true;  }  void Timer::fallDownOubliette() { -	_vm->_gyro->_magics[8]._operation = Gyro::kMagicNothing; +	_vm->_avalot->_magics[8]._operation = Avalot::kMagicNothing;  	AnimationType *avvy = &_vm->_animation->_sprites[0];  	avvy->_moveY++; // Increments dx/dy! @@ -549,13 +548,13 @@ void Timer::fallDownOubliette() {  }  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);  		_vm->_dialogs->displayText(tmpStr); -		_vm->_lucerna->gameOver(); +		_vm->_avalot->gameOver();  	} else {  		_vm->_dialogs->displayScrollChain('Q', 60); -		_vm->_gyro->_metAvaroid = true; +		_vm->_avalot->_metAvaroid = true;  		addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette);  		AnimationType *avvy = &_vm->_animation->_sprites[0]; @@ -564,7 +563,7 @@ void Timer::meetAvaroid() {  		avvy->_moveX = -3;  		avvy->_moveY = -5; -		_vm->_gyro->setBackgroundColor(2); +		_vm->_avalot->setBackgroundColor(2);  	}  } @@ -576,7 +575,7 @@ void Timer::riseUpOubliette() {  	if (avvy->_moveY > 0)  		addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette);  	else -		_vm->_gyro->_userMovesAvvy = true; +		_vm->_avalot->_userMovesAvvy = true;  }  void Timer::robinHoodAndGeida() { @@ -589,7 +588,7 @@ void Timer::robinHoodAndGeida() {  	spr->stopWalk();  	spr->_facingDir = Animation::kDirLeft;  	addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); -	_vm->_gyro->_geidaFollows = false; +	_vm->_avalot->_geidaFollows = false;  }  void Timer::robinHoodAndGeidaTalk() { @@ -613,7 +612,7 @@ void Timer::avalotReturns() {  	avvy->init(0, true, _vm->_animation);  	_vm->_animation->appearPed(0, 0);  	_vm->_dialogs->displayScrollChain('q', 67); -	_vm->_gyro->_userMovesAvvy = true; +	_vm->_avalot->_userMovesAvvy = true;  }  /** @@ -627,8 +626,8 @@ void Timer::avvySitDown() {  		addTimer(1, kProcAvvySitDown, kReasonSittingDown);  	else {  		_vm->_background->drawBackgroundSprite(-1, -1, 2); -		_vm->_gyro->_sittingInPub = true; -		_vm->_gyro->_userMovesAvvy = false; +		_vm->_avalot->_sittingInPub = true; +		_vm->_avalot->_userMovesAvvy = false;  		avvy->_visible = false;  	}  } @@ -640,7 +639,7 @@ void Timer::ghostRoomPhew() {  }  void Timer::arkataShouts() { -	if (_vm->_gyro->_teetotal) +	if (_vm->_avalot->_teetotal)  		return;  	_vm->_dialogs->displayScrollChain('q', 76); @@ -654,14 +653,14 @@ void Timer::winning() {  	warning("STUB: Timer::winning()");  #if 0  	do { -		_vm->_lucerna->checkclick(); -	} while (!(_vm->_gyro->mrelease == 0)); +		_vm->_avalot->checkclick(); +	} while (!(_vm->_avalot->mrelease == 0));  #endif  	// 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->_gyro->_letMeOut = true; +	_vm->_avalot->_letMeOut = true;  }  void Timer::avalotFalls() { @@ -693,8 +692,8 @@ void Timer::spludwickLeavesCauldron() {  void Timer::giveLuteToGeida() { // Moved here from Acci.  	_vm->_dialogs->displayScrollChain('Q', 86); -	_vm->_lucerna->incScore(4); -	_vm->_gyro->_lustieIsAsleep = true; +	_vm->_avalot->incScore(4); +	_vm->_avalot->_lustieIsAsleep = true;  	_vm->_sequence->firstShow(5);  	_vm->_sequence->thenShow(6); // He falls asleep...  	_vm->_sequence->startToClose(); // Not really closing, but we're using the same procedure.  | 
