diff options
| -rw-r--r-- | engines/avalanche/animation.cpp | 258 | ||||
| -rw-r--r-- | engines/avalanche/animation.h | 6 | ||||
| -rw-r--r-- | engines/avalanche/avalanche.cpp | 2 | ||||
| -rw-r--r-- | engines/avalanche/avalot.cpp | 74 | ||||
| -rw-r--r-- | engines/avalanche/dialogs.cpp | 8 | ||||
| -rw-r--r-- | engines/avalanche/menu.cpp | 4 | ||||
| -rw-r--r-- | engines/avalanche/parser.cpp | 34 | ||||
| -rw-r--r-- | engines/avalanche/timer.cpp | 60 | 
8 files changed, 227 insertions, 219 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index e87341509a..f419034344 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -46,12 +46,14 @@ const int32 Animation::kCatacombMap[8][8] = {  	{0x34,   0x200f, 0x51f0, 0x201f, 0xf1,   0x50ff, 0x902f, 0x2062}  }; +AnimationType::AnimationType(Animation *anim) { +	_anim = anim; +} +  /**   * Loads & sets up the sprite.   */ -void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) { -	_anim = anim; - +void AnimationType::init(byte spritenum, bool doCheck) {  	const int32 idshould = -1317732048;  	if (spritenum == 177) @@ -180,7 +182,7 @@ void AnimationType::appear(int16 wx, int16 wy, Direction wf) {   */  bool AnimationType::checkCollision() {  	for (int i = 0; i < _anim->kSpriteNumbMax; i++) { -		AnimationType *spr = &_anim->_sprites[i]; +		AnimationType *spr = _anim->_sprites[i];  		if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y))  			return true;  	} @@ -381,14 +383,18 @@ void AnimationType::remove() {  Animation::Animation(AvalancheEngine *vm) {  	_vm = vm; -  	_mustExclaim = false; + +	for (int16 i = 0; i < kSpriteNumbMax; i++) { +		_sprites[i] = new AnimationType(this); +	}  }  Animation::~Animation() {  	for (int16 i = 0; i < kSpriteNumbMax; i++) { -		if (_sprites[i]._quick) -			_sprites[i].remove(); +		if (_sprites[i]->_quick) +			_sprites[i]->remove(); +		delete(_sprites[i]);  	}  } @@ -399,7 +405,7 @@ Animation::~Animation() {  void Animation::resetAnims() {  	setDirection(kDirStopped);  	for (int16 i = 0; i < kSpriteNumbMax; i++) -		_sprites[i].reset(); +		_sprites[i]->reset();  }  byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { @@ -463,8 +469,8 @@ void Animation::catacombMove(byte ped) {  		_vm->flipRoom(kRoomLusties, 5);  		_vm->_dialogs->displayText("Oh no... here we go again...");  		_vm->_userMovesAvvy = false; -		_sprites[0]._moveY = 1; -		_sprites[0]._moveX = 0; +		_sprites[0]->_moveY = 1; +		_sprites[0]->_moveX = 0;  		return;  	} @@ -730,11 +736,11 @@ void Animation::catacombMove(byte ped) {  	}  	if ((_vm->_geidaFollows) && (ped > 0)) { -		if (!_sprites[1]._quick)  // If we don't already have her... -			_sprites[1].init(5, true, this); // ...Load Geida. +		if (!_sprites[1]->_quick)  // If we don't already have her... +			_sprites[1]->init(5, true); // ...Load Geida.  		appearPed(1, geidaPed(ped)); -		_sprites[1]._callEachStepFl = true; -		_sprites[1]._eachStepProc = kProcGeida; +		_sprites[1]->_callEachStepFl = true; +		_sprites[1]->_eachStepProc = kProcGeida;  	}  } @@ -766,25 +772,25 @@ void Animation::callSpecial(uint16 which) {  		_vm->_userMovesAvvy = true;  		break;  	case 3: // _vm->special 3: Room 71: triggers dart. -		_sprites[0].bounce(); // Must include that. +		_sprites[0]->bounce(); // Must include that.  		if (!_arrowTriggered) {  			_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. +			_sprites[1]->walkTo(4); // flies to ped 5 (- 1 for pascal to C conversion). +			_sprites[1]->_facingDir = kDirUp; // Only face.  			// Should call some kind of Eachstep procedure which will deallocate  			// the sprite when it hits the wall, and replace it with the chunk  			// graphic of the arrow buried in the plaster. */  			// OK! -			_sprites[1]._callEachStepFl = true; -			_sprites[1]._eachStepProc = kProcArrow; +			_sprites[1]->_callEachStepFl = true; +			_sprites[1]->_eachStepProc = kProcArrow;  		}  		break;  	case 4: // This is the ghost room link.  		_vm->fadeOut(); -		_sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap +		_sprites[0]->turn(kDirRight); // you'll see this after we get back from bootstrap  		_vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew);  		//_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)!  Do not remove until then!  		break; @@ -793,28 +799,28 @@ void Animation::callSpecial(uint16 which) {  			// _vm->special 5: Room 42: touched tree, and get tied up.  			_vm->_magics[4]._operation = kMagicBounce; // Boundary effect is now working again.  			_vm->_dialogs->displayScrollChain('q', 35); -			_sprites[0].remove(); +			_sprites[0]->remove();  			//tr[1].vanishifstill:=true;  			_vm->_background->draw(-1, -1, 1);  			_vm->_dialogs->displayScrollChain('q', 36);  			_vm->_tiedUp = true;  			_vm->_friarWillTieYouUp = false; -			_sprites[1].walkTo(2); -			_sprites[1]._vanishIfStill = true; -			_sprites[1]._doCheck = true; // One of them must have Check_Me switched on. +			_sprites[1]->walkTo(2); +			_sprites[1]->_vanishIfStill = true; +			_sprites[1]->_doCheck = true; // One of them must have Check_Me switched on.  			_vm->setRoom(kPeopleFriarTuck, kRoomDummy); // Not here, then.  			_vm->_timer->addTimer(364, Timer::kProcHangAround, Timer::kReasonHangingAround);  		}  		break;  	case 6: // _vm->special 6: fall down oubliette.  		_vm->_userMovesAvvy = false; -		_sprites[0]._moveX = 3; -		_sprites[0]._moveY = 0; -		_sprites[0]._facingDir = kDirRight; +		_sprites[0]->_moveX = 3; +		_sprites[0]->_moveY = 0; +		_sprites[0]->_facingDir = kDirRight;  		_vm->_timer->addTimer(1, Timer::kProcFallDownOubliette, Timer::kReasonFallingDownOubliette);  		break;  	case 7: // _vm->special 7: stop falling down oubliette. -		_sprites[0]._visible = false; +		_sprites[0]->_visible = false;  		_vm->_magics[9]._operation = kMagicNothing;  		stopWalking();  		_vm->_timer->loseTimer(Timer::kReasonFallingDownOubliette); @@ -826,18 +832,18 @@ void Animation::callSpecial(uint16 which) {  	case 8:        // _vm->special 8: leave du Lustie's room.  		if ((_vm->_geidaFollows) && (!_vm->_lustieIsAsleep)) {  			_vm->_dialogs->displayScrollChain('q', 63); -			_sprites[1].turn(kDirDown); -			_sprites[1].stopWalk(); -			_sprites[1]._callEachStepFl = false; // Geida +			_sprites[1]->turn(kDirDown); +			_sprites[1]->stopWalk(); +			_sprites[1]->_callEachStepFl = false; // Geida  			_vm->gameOver();  		}  		break;  	case 9: // _vm->special 9: lose Geida to Robin Hood...  		if (!_vm->_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. +		_sprites[1]->_callEachStepFl = false; // She no longer follows Avvy around. +		_sprites[1]->walkTo(3); // She walks to somewhere... +		_sprites[0]->remove();     // Lose Avvy.  		_vm->_userMovesAvvy = false;  		_vm->_timer->addTimer(40, Timer::kProcRobinHoodAndGeida, Timer::kReasonRobinHoodAndGeida);  		break; @@ -900,35 +906,35 @@ void Animation::callSpecial(uint16 which) {  void Animation::updateSpeed() {  	// Given that you've just changed the speed in _speedX, this adjusts _moveX. -	_sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX; -	_vm->_graphics->drawSpeedBar(_sprites[0]._speedX); +	_sprites[0]->_moveX = (_sprites[0]->_moveX / 3) * _sprites[0]->_speedX; +	_vm->_graphics->drawSpeedBar(_sprites[0]->_speedX);  }  void Animation::setMoveSpeed(byte t, Direction dir) {  	switch (dir) {  	case kDirUp: -		_sprites[t].setSpeed(0, -_sprites[t]._speedY); +		_sprites[t]->setSpeed(0, -_sprites[t]->_speedY);  		break;  	case kDirDown: -		_sprites[t].setSpeed(0, _sprites[t]._speedY); +		_sprites[t]->setSpeed(0, _sprites[t]->_speedY);  		break;  	case kDirLeft: -		_sprites[t].setSpeed(-_sprites[t]._speedX,  0); +		_sprites[t]->setSpeed(-_sprites[t]->_speedX,  0);  		break;  	case kDirRight: -		_sprites[t].setSpeed(_sprites[t]._speedX,  0); +		_sprites[t]->setSpeed(_sprites[t]->_speedX,  0);  		break;  	case kDirUpLeft: -		_sprites[t].setSpeed(-_sprites[t]._speedX, -_sprites[t]._speedY); +		_sprites[t]->setSpeed(-_sprites[t]->_speedX, -_sprites[t]->_speedY);  		break;  	case kDirUpRight: -		_sprites[t].setSpeed(_sprites[t]._speedX, -_sprites[t]._speedY); +		_sprites[t]->setSpeed(_sprites[t]->_speedX, -_sprites[t]->_speedY);  		break;  	case kDirDownLeft: -		_sprites[t].setSpeed(-_sprites[t]._speedX, _sprites[t]._speedY); +		_sprites[t]->setSpeed(-_sprites[t]->_speedX, _sprites[t]->_speedY);  		break;  	case kDirDownRight: -		_sprites[t].setSpeed(_sprites[t]._speedX, _sprites[t]._speedY); +		_sprites[t]->setSpeed(_sprites[t]->_speedX, _sprites[t]->_speedY);  		break;  	default:  		break; @@ -936,7 +942,7 @@ void Animation::setMoveSpeed(byte t, Direction dir) {  }  void Animation::appearPed(byte sprNum, byte pedNum) { -	AnimationType *curSpr = &_sprites[sprNum]; +	AnimationType *curSpr = _sprites[sprNum];  	PedType *curPed = &_vm->_peds[pedNum];  	curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction);  	setMoveSpeed(sprNum, curPed->_direction); @@ -946,59 +952,59 @@ void Animation::appearPed(byte sprNum, byte pedNum) {   * @remarks	Originally called 'follow_avvy_y'   */  void Animation::followAvalotY(byte tripnum) { -	if (_sprites[0]._facingDir == kDirLeft) +	if (_sprites[0]->_facingDir == kDirLeft)  		return; -	if (_sprites[tripnum]._homing) -		_sprites[tripnum]._homingY = _sprites[1]._y; +	if (_sprites[tripnum]->_homing) +		_sprites[tripnum]->_homingY = _sprites[1]->_y;  	else { -		if (_sprites[tripnum]._y < _sprites[1]._y) -			_sprites[tripnum]._y++; -		else if (_sprites[tripnum]._y > _sprites[1]._y) -			_sprites[tripnum]._y--; +		if (_sprites[tripnum]->_y < _sprites[1]->_y) +			_sprites[tripnum]->_y++; +		else if (_sprites[tripnum]->_y > _sprites[1]->_y) +			_sprites[tripnum]->_y--;  		else  			return; -		if (_sprites[tripnum]._moveX == 0)  { -			_sprites[tripnum]._stepNum++; -			if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) -				_sprites[tripnum]._stepNum = 0; -			_sprites[tripnum]._count = 0; +		if (_sprites[tripnum]->_moveX == 0)  { +			_sprites[tripnum]->_stepNum++; +			if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) +				_sprites[tripnum]->_stepNum = 0; +			_sprites[tripnum]->_count = 0;  		}  	}  }  void Animation::backAndForth(byte tripnum) { -	if (!_sprites[tripnum]._homing) { -		if (_sprites[tripnum]._facingDir == kDirRight) -			_sprites[tripnum].walkTo(3); +	if (!_sprites[tripnum]->_homing) { +		if (_sprites[tripnum]->_facingDir == kDirRight) +			_sprites[tripnum]->walkTo(3);  		else -			_sprites[tripnum].walkTo(4); +			_sprites[tripnum]->walkTo(4);  	}  }  void Animation::faceAvvy(byte tripnum) { -	if (!_sprites[tripnum]._homing) { -		if (_sprites[0]._x >= _sprites[tripnum]._x) -			_sprites[tripnum]._facingDir = kDirRight; +	if (!_sprites[tripnum]->_homing) { +		if (_sprites[0]->_x >= _sprites[tripnum]->_x) +			_sprites[tripnum]->_facingDir = kDirRight;  		else -			_sprites[tripnum]._facingDir = kDirLeft; +			_sprites[tripnum]->_facingDir = kDirLeft;  	}  }  void Animation::arrowProcs(byte tripnum) { -	if (_sprites[tripnum]._homing) { +	if (_sprites[tripnum]->_homing) {  		// Arrow is still in flight.  		// We must check whether or not the arrow has collided tr[tripnum] Avvy's head.  		// This is so if: a) the bottom of the arrow is below Avvy's head,  		// b) the left of the arrow is left of the right of Avvy's head, and  		// c) the right of the arrow is right of the left of Avvy's head. -		if (((_sprites[tripnum]._y + _sprites[tripnum]._info._yLength) >= _sprites[0]._y) // A -				&& (_sprites[tripnum]._x <= (_sprites[0]._x + _sprites[0]._info._xLength)) // B -				&& ((_sprites[tripnum]._x + _sprites[tripnum]._info._xLength) >= _sprites[0]._x)) { // C +		if (((_sprites[tripnum]->_y + _sprites[tripnum]->_info._yLength) >= _sprites[0]->_y) // A +				&& (_sprites[tripnum]->_x <= (_sprites[0]->_x + _sprites[0]->_info._xLength)) // B +				&& ((_sprites[tripnum]->_x + _sprites[tripnum]->_info._xLength) >= _sprites[0]->_x)) { // C  			// OK, it's hit him... what now? -			_sprites[1]._callEachStepFl = false; // prevent recursion. +			_sprites[1]->_callEachStepFl = false; // prevent recursion.  			_vm->_dialogs->displayScrollChain('Q', 47); // Complaint! -			_sprites[tripnum].remove(); // Deallocate the arrow. +			_sprites[tripnum]->remove(); // Deallocate the arrow.  			_vm->gameOver(); @@ -1006,7 +1012,7 @@ void Animation::arrowProcs(byte tripnum) {  			_vm->_timer->addTimer(55, Timer::kProcNaughtyDuke, Timer::kReasonNaughtyDuke);  		}  	} else { // Arrow has hit the wall! -		_sprites[tripnum].remove(); // Deallocate the arrow. +		_sprites[tripnum]->remove(); // Deallocate the arrow.  		_vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door.  		_vm->_arrowInTheDoor = true; // So that we can pick it up.  	} @@ -1014,43 +1020,43 @@ void Animation::arrowProcs(byte tripnum) {  }  void Animation::grabAvvy(byte tripnum) {     // For Friar Tuck, in Nottingham. -	int16 tox = _sprites[0]._x + 17; -	int16 toy = _sprites[0]._y - 1; -	if ((_sprites[tripnum]._x == tox) && (_sprites[tripnum]._y == toy)) { -		_sprites[tripnum]._callEachStepFl = false; -		_sprites[tripnum]._facingDir = kDirLeft; -		_sprites[tripnum].stopWalk(); +	int16 tox = _sprites[0]->_x + 17; +	int16 toy = _sprites[0]->_y - 1; +	if ((_sprites[tripnum]->_x == tox) && (_sprites[tripnum]->_y == toy)) { +		_sprites[tripnum]->_callEachStepFl = false; +		_sprites[tripnum]->_facingDir = kDirLeft; +		_sprites[tripnum]->stopWalk();  		// ... whatever ...  	} else {  		// Still some way to go. -		if (_sprites[tripnum]._x < tox) { -			_sprites[tripnum]._x += 5; -			if (_sprites[tripnum]._x > tox) -				_sprites[tripnum]._x = tox; +		if (_sprites[tripnum]->_x < tox) { +			_sprites[tripnum]->_x += 5; +			if (_sprites[tripnum]->_x > tox) +				_sprites[tripnum]->_x = tox;  		} -		if (_sprites[tripnum]._y < toy) -			_sprites[tripnum]._y++; -		_sprites[tripnum]._stepNum++; -		if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) -			_sprites[tripnum]._stepNum = 0; +		if (_sprites[tripnum]->_y < toy) +			_sprites[tripnum]->_y++; +		_sprites[tripnum]->_stepNum++; +		if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) +			_sprites[tripnum]->_stepNum = 0;  	}  }  void Animation::takeAStep(byte &tripnum) { -	if (_sprites[tripnum]._moveX == 0) { -		_sprites[tripnum]._stepNum++; -		if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq) -			_sprites[tripnum]._stepNum = 0; -		_sprites[tripnum]._count = 0; +	if (_sprites[tripnum]->_moveX == 0) { +		_sprites[tripnum]->_stepNum++; +		if (_sprites[tripnum]->_stepNum == _sprites[tripnum]->_stat._seq) +			_sprites[tripnum]->_stepNum = 0; +		_sprites[tripnum]->_count = 0;  	}  }  void Animation::spin(Direction dir, byte &tripnum) { -	if (_sprites[tripnum]._facingDir == dir) +	if (_sprites[tripnum]->_facingDir == dir)  		return; -	_sprites[tripnum]._facingDir = dir; -	if (_sprites[tripnum]._id == 2) +	_sprites[tripnum]->_facingDir = dir; +	if (_sprites[tripnum]->_id == 2)  		return; // Not for Spludwick  	_geidaSpin++; @@ -1069,35 +1075,35 @@ void Animation::geidaProcs(byte tripnum) {  			_geidaSpin = 0;  	} -	if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) { +	if (_sprites[tripnum]->_y < (_sprites[0]->_y - 2)) {  		// Geida is further from the screen than Avvy.  		spin(kDirDown, tripnum); -		_sprites[tripnum]._moveY = 1; -		_sprites[tripnum]._moveX = 0; +		_sprites[tripnum]->_moveY = 1; +		_sprites[tripnum]->_moveX = 0;  		takeAStep(tripnum);  		return; -	} else if (_sprites[tripnum]._y > (_sprites[0]._y + 2)) { +	} else if (_sprites[tripnum]->_y > (_sprites[0]->_y + 2)) {  		// Avvy is further from the screen than Geida.  		spin(kDirUp, tripnum); -		_sprites[tripnum]._moveY = -1; -		_sprites[tripnum]._moveX = 0; +		_sprites[tripnum]->_moveY = -1; +		_sprites[tripnum]->_moveX = 0;  		takeAStep(tripnum);  		return;  	} -	_sprites[tripnum]._moveY = 0; +	_sprites[tripnum]->_moveY = 0;  	// These 12-s are not in the original, I added them to make the following method more "smooth".  	// Now the NPC which is following Avvy won't block his way and will walk next to him properly. -	if (_sprites[tripnum]._x < _sprites[0]._x - _sprites[0]._speedX * 8 - 12) { -		_sprites[tripnum]._moveX = _sprites[0]._speedX; +	if (_sprites[tripnum]->_x < _sprites[0]->_x - _sprites[0]->_speedX * 8 - 12) { +		_sprites[tripnum]->_moveX = _sprites[0]->_speedX;  		spin(kDirRight, tripnum);  		takeAStep(tripnum); -	} else if (_sprites[tripnum]._x > _sprites[0]._x + _sprites[0]._speedX * 8 + 12) { -		_sprites[tripnum]._moveX = -_sprites[0]._speedX; +	} else if (_sprites[tripnum]->_x > _sprites[0]->_x + _sprites[0]->_speedX * 8 + 12) { +		_sprites[tripnum]->_moveX = -_sprites[0]->_speedX;  		spin(kDirLeft, tripnum);  		takeAStep(tripnum);  	} else -		_sprites[tripnum]._moveX = 0; +		_sprites[tripnum]->_moveX = 0;  }  /** @@ -1112,7 +1118,7 @@ void Animation::drawSprites() {  		order[i] = -1;  	for (int16 i = 0; i < kSpriteNumbMax; i++) { -		if (_sprites[i]._quick && _sprites[i]._visible) +		if (_sprites[i]->_quick && _sprites[i]->_visible)  			order[i] = i;  	} @@ -1120,7 +1126,7 @@ void Animation::drawSprites() {  		ok = true;  		for (int i = 0; i < 4; i++) {  			if (((order[i] != -1) && (order[i + 1] != -1)) -					&& (_sprites[order[i]]._y > _sprites[order[i + 1]]._y)) { +					&& (_sprites[order[i]]->_y > _sprites[order[i + 1]]->_y)) {  				// Swap them!  				temp = order[i];  				order[i] = order[i + 1]; @@ -1134,7 +1140,7 @@ void Animation::drawSprites() {  	for (int i = 0; i < 5; i++) {  		if (order[i] > -1) -			_sprites[order[i]].draw(); +			_sprites[order[i]]->draw();  	}  } @@ -1146,15 +1152,15 @@ void Animation::animLink() {  	if (_vm->_menu->isActive() || _vm->_seeScroll)  		return;  	for (int16 i = 0; i < kSpriteNumbMax; i++) { -		if (_sprites[i]._quick && _sprites[i]._visible) -			_sprites[i].walk(); +		if (_sprites[i]->_quick && _sprites[i]->_visible) +			_sprites[i]->walk();  	}  	drawSprites();  	for (int16 i = 0; i < kSpriteNumbMax; i++) { -		if (_sprites[i]._quick && _sprites[i]._callEachStepFl) { -			switch (_sprites[i]._eachStepProc) { +		if (_sprites[i]->_quick && _sprites[i]->_callEachStepFl) { +			switch (_sprites[i]->_eachStepProc) {  			case kProcFollowAvvyY :  				followAvalotY(i);  				break; @@ -1185,10 +1191,10 @@ void Animation::animLink() {  }  void Animation::stopWalking() { -	_sprites[0].stopWalk(); +	_sprites[0]->stopWalk();  	_direction = kDirStopped;  	if (_vm->_alive) -		_sprites[0]._stepNum = 1; +		_sprites[0]->_stepNum = 1;  }  /** @@ -1201,7 +1207,7 @@ void Animation::hideInCupboard() {  			Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", kControlItalic, kControlRoman);  			_vm->_dialogs->displayText(tmpStr);  		} else { -			_sprites[0]._visible = true; +			_sprites[0]->_visible = true;  			_vm->_userMovesAvvy = true;  			appearPed(0, 2); // Walk out of the cupboard.  			_vm->_dialogs->displayText("You leave the cupboard. Nice to be out of there!"); @@ -1210,7 +1216,7 @@ void Animation::hideInCupboard() {  		}  	} else {  		// Not hiding in the cupboard -		_sprites[0]._visible = false; +		_sprites[0]->_visible = false;  		_vm->_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.", kControlParagraph); @@ -1225,9 +1231,9 @@ void Animation::hideInCupboard() {   */  bool Animation::inField(byte which) {  	FieldType *curField = &_vm->_fields[which]; -	int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; +	int16 yy = _sprites[0]->_y + _sprites[0]->_info._yLength; -	return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); +	return (_sprites[0]->_x >= curField->_x1) && (_sprites[0]->_x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2);  }  /** @@ -1239,8 +1245,8 @@ bool Animation::nearDoor() {  		return false;  	} -	int16 ux = _sprites[0]._x; -	int16 uy = _sprites[0]._y + _sprites[0]._info._yLength; +	int16 ux = _sprites[0]->_x; +	int16 uy = _sprites[0]->_y + _sprites[0]->_info._yLength;  	for (int i = 8; i < _vm->_fieldNum; i++) {  		FieldType *curField = &_vm->_fields[i]; @@ -1357,7 +1363,7 @@ void Animation::synchronize(Common::Serializer &sz) {  	byte spriteNum = 0;  	if (sz.isSaving()) {  		for (int i = 0; i < kSpriteNumbMax; i++) { -			if (_sprites[i]._quick) +			if (_sprites[i]->_quick)  				spriteNum++;  		}  	} @@ -1365,20 +1371,20 @@ void Animation::synchronize(Common::Serializer &sz) {  	if (sz.isLoading()) {  		for (int i = 0; i < kSpriteNumbMax; i++) { // Deallocate sprites. -			AnimationType *spr = &_sprites[i]; +			AnimationType *spr = _sprites[i];  			if (spr->_quick)  				spr->remove();  		}  	}  	for (int i = 0; i < spriteNum; i++) { -		AnimationType *spr = &_sprites[i]; +		AnimationType *spr = _sprites[i];  		sz.syncAsByte(spr->_id);  		sz.syncAsByte(spr->_doCheck);  		if (sz.isLoading()) {  			spr->_quick = true; -			spr->init(spr->_id, spr->_doCheck, this); +			spr->init(spr->_id, spr->_doCheck);  		}  		sz.syncAsByte(spr->_moveX); diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index ad70645036..ac247b8256 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -67,7 +67,9 @@ public:  	bool _callEachStepFl; // Do we call the eachstep procedure?  	byte _eachStepProc; -	void init(byte spritenum, bool doCheck, Animation *anim); +	AnimationType(Animation *anim); + +	void init(byte spritenum, bool doCheck);  	void reset();  	void draw();  	void turn(Direction whichway); @@ -107,7 +109,7 @@ public:  		kProcGeida // Spludwick uses it as well for homing! TODO: Unify it with kProcSpludwick.  	}; -	AnimationType _sprites[kSpriteNumbMax]; +	AnimationType *_sprites[kSpriteNumbMax];  	Animation(AvalancheEngine *vm);  	~Animation(); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 3e0bdb0507..29e9d02bb4 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -381,7 +381,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {  		expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str());  	_dialogs->displayText(tmpStr); -	AnimationType *avvy = &_animation->_sprites[0]; +	AnimationType *avvy = _animation->_sprites[0];  	if (avvy->_quick && avvy->_visible)  		_animation->setMoveSpeed(0, _animation->getDirection()); // We push Avvy in the right direction is he was moving. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index f74239c164..fdc2ddda6f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -278,7 +278,7 @@ void AvalancheEngine::setup() {  	fadeIn();  	_parser->_cursorState = false;  	_parser->cursorOn(); -	_animation->_sprites[0]._speedX = kWalk; +	_animation->_sprites[0]->_speedX = kWalk;  	_animation->updateSpeed();  	_menu->init(); @@ -610,9 +610,9 @@ void AvalancheEngine::enterNewTown() {  void AvalancheEngine::putGeidaAt(byte whichPed, byte ped) {  	if (ped == 0)  		return; -	AnimationType *spr1 = &_animation->_sprites[1]; +	AnimationType *spr1 = _animation->_sprites[1]; -	spr1->init(5, false, _animation); // load Geida +	spr1->init(5, false); // load Geida  	_animation->appearPed(1, whichPed);  	spr1->_callEachStepFl = true;  	spr1->_eachStepProc = Animation::kProcGeida; @@ -653,10 +653,10 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomOutsideYours:  		if (ped > 0) { -			AnimationType *spr1 = &_animation->_sprites[1]; +			AnimationType *spr1 = _animation->_sprites[1];  			if (!_talkedToCrapulus) {  				_whereIs[kPeopleCrapulus - 150] = kRoomOutsideYours; -				spr1->init(8, false, _animation); // load Crapulus +				spr1->init(8, false); // load Crapulus  				if (_roomCount[kRoomOutsideYours] == 1) {  					_animation->appearPed(1, 3); // Start on the right-hand side of the screen. @@ -673,7 +673,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  				_whereIs[kPeopleCrapulus - 150] = kRoomNowhere;  			if (_crapulusWillTell) { -				spr1->init(8, false, _animation); +				spr1->init(8, false);  				_animation->appearPed(1, 1);  				spr1->walkTo(3);  				_timer->addTimer(20, Timer::kProcCrapulusSpludOut, Timer::kReasonCrapulusSaysSpludwickOut); @@ -691,9 +691,9 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomSpludwicks:  		if (_spludwickAtHome) { -			AnimationType *spr1 = &_animation->_sprites[1]; +			AnimationType *spr1 = _animation->_sprites[1];  			if (ped > 0) { -				spr1->init(2, false, _animation); // load Spludwick +				spr1->init(2, false); // load Spludwick  				_animation->appearPed(1, 1);  				_whereIs[kPeopleSpludwick - 150] = kRoomSpludwicks;  			} @@ -711,8 +711,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  			_magics[kColorLightred - 1]._operation = kMagicNothing;  			_whereIs[kPeopleCwytalot - 150] = kRoomNowhere;  		} else if (ped > 0) { -			AnimationType *spr1 = &_animation->_sprites[1]; -			spr1->init(4, false, _animation); // 4 = Cwytalot +			AnimationType *spr1 = _animation->_sprites[1]; +			spr1->init(4, false); // 4 = Cwytalot  			spr1->_callEachStepFl = true;  			spr1->_eachStepProc = Animation::kProcFollowAvvyY;  			_whereIs[kPeopleCwytalot - 150] = kRoomBrummieRoad; @@ -730,8 +730,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomArgentRoad:  		if ((_cwytalotGone) && (!_passedCwytalotInHerts) && (ped == 2) && (_roomCount[kRoomArgentRoad] > 3)) { -			AnimationType *spr1 = &_animation->_sprites[1]; -			spr1->init(4, false, _animation); // 4 = Cwytalot again +			AnimationType *spr1 = _animation->_sprites[1]; +			spr1->init(4, false); // 4 = Cwytalot again  			_animation->appearPed(1, 0);  			spr1->walkTo(1);  			spr1->_vanishIfStill = true; @@ -754,8 +754,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomRobins:  		if ((ped > 0) && (!_beenTiedUp)) {  			// A welcome party... or maybe not... -			AnimationType *spr1 = &_animation->_sprites[1]; -			spr1->init(6, false, _animation); +			AnimationType *spr1 = _animation->_sprites[1]; +			spr1->init(6, false);  			_animation->appearPed(1, 1);  			spr1->walkTo(2);  			_timer->addTimer(36, Timer::kProcGetTiedUp, Timer::kReasonGettingTiedUp); @@ -776,10 +776,10 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomOutsideCardiffCastle:  		if (ped > 0) { -			AnimationType *spr1 = &_animation->_sprites[1]; +			AnimationType *spr1 = _animation->_sprites[1];  			switch (_cardiffQuestionNum) {  			case 0 : // You've answered NONE of his questions. -				spr1->init(9, false, _animation); +				spr1->init(9, false);  				_animation->appearPed(1, 1);  				spr1->walkTo(2);  				_timer->addTimer(47, Timer::kProcCardiffSurvey, Timer::kReasonCardiffsurvey); @@ -788,7 +788,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  				_magics[1]._operation = kMagicNothing;  				break; // You've answered ALL his questions. => nothing happens.  			default: // You've answered SOME of his questions. -				spr1->init(9, false, _animation); +				spr1->init(9, false);  				_animation->appearPed(1, 2);  				spr1->_facingDir = kDirRight;  				_timer->addTimer(3, Timer::kProcCardiffReturn, Timer::kReasonCardiffsurvey); @@ -853,7 +853,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomLustiesRoom:  		_npcFacing = 1; // du Lustie. -		if (_animation->_sprites[0]._id == 0) // Avvy in his normal clothes +		if (_animation->_sprites[0]->_id == 0) // Avvy in his normal clothes  			_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks);  		else if (!_enteredLustiesRoomAsMonk) // already  			// Presumably, Avvy dressed as a monk. @@ -901,8 +901,8 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  		break;  	case kRoomWiseWomans: { -		AnimationType *spr1 = &_animation->_sprites[1]; -		spr1->init(11, false, _animation); +		AnimationType *spr1 = _animation->_sprites[1]; +		spr1->init(11, false);  		if ((_roomCount[kRoomWiseWomans] == 1) && (ped > 0)) {  			_animation->appearPed(1, 1); // Start on the right-hand side of the screen.  			spr1->walkTo(3); // Walks up to greet you. @@ -918,7 +918,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {  	case kRoomInsideCardiffCastle:  		if (ped > 0) { -			_animation->_sprites[1].init(10, false, _animation); // Define the dart. +			_animation->_sprites[1]->init(10, false); // Define the dart.  			_background->draw(-1, -1, 0);  			_graphics->refreshBackground();  			_sequence->startCardiffSeq2(); @@ -1139,7 +1139,7 @@ void AvalancheEngine::guideAvvy(Common::Point cursorPos) {  	byte what;  	// _animation->tr[0] is Avalot.) -	AnimationType *avvy = &_animation->_sprites[0]; +	AnimationType *avvy = _animation->_sprites[0];  	if (cursorPos.x < avvy->_x)  		what = 1;  	else if (cursorPos.x > (avvy->_x + avvy->_info._xLength)) @@ -1242,10 +1242,10 @@ void AvalancheEngine::checkClick() {  				callVerb(kVerbCodeScore);  			} else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. -				_animation->_sprites[0]._speedX = kWalk; +				_animation->_sprites[0]->_speedX = kWalk;  				_animation->updateSpeed();  			} else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. -				_animation->_sprites[0]._speedX = kRun; +				_animation->_sprites[0]->_speedX = kRun;  				_animation->updateSpeed();  			} else if ((396 <= cursorPos.x) && (cursorPos.x <= 483))  				fxToggle(); @@ -1343,12 +1343,12 @@ void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits().  void AvalancheEngine::gameOver() {  	_userMovesAvvy = false; -	AnimationType *avvy = &_animation->_sprites[0]; +	AnimationType *avvy = _animation->_sprites[0];  	int16 sx = avvy->_x;  	int16 sy = avvy->_y;  	avvy->remove(); -	avvy->init(12, true, _animation); // 12 = Avalot falls +	avvy->init(12, true); // 12 = Avalot falls  	avvy->_stepNum = 0;  	avvy->appear(sx, sy, kDirUp); @@ -1373,7 +1373,7 @@ void AvalancheEngine::majorRedraw() {  }  uint16 AvalancheEngine::bearing(byte whichPed) { -	AnimationType *avvy = &_animation->_sprites[0]; +	AnimationType *avvy = _animation->_sprites[0];  	PedType *curPed = &_peds[whichPed];  	if (avvy->_x == curPed->_x) @@ -1488,14 +1488,14 @@ void AvalancheEngine::resetVariables() {  void AvalancheEngine::newGame() {  	for (int i = 0; i < kMaxSprites; i++) { -		AnimationType *spr = &_animation->_sprites[i]; +		AnimationType *spr = _animation->_sprites[i];  		if (spr->_quick)  			spr->remove();  	}  	// Deallocate sprite. Sorry, beta testers! -	AnimationType *avvy = &_animation->_sprites[0]; -	avvy->init(0, true, _animation); +	AnimationType *avvy = _animation->_sprites[0]; +	avvy->init(0, true);  	_alive = true;  	resetVariables(); @@ -1648,8 +1648,8 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {  	assert((ped > 0) && (ped < 15));  	if (!_alive) {  		// You can't leave the room if you're dead. -		_animation->_sprites[0]._moveX = 0; -		_animation->_sprites[0]._moveY = 0; // Stop him from moving. +		_animation->_sprites[0]->_moveX = 0; +		_animation->_sprites[0]->_moveY = 0; // Stop him from moving.  		return;  	} @@ -1660,7 +1660,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {  	if ((_jumpStatus > 0) && (_room == kRoomInsideCardiffCastle)) {  		// You can't *jump* out of Cardiff Castle! -		_animation->_sprites[0]._moveX = 0; +		_animation->_sprites[0]->_moveX = 0;  		return;  	} @@ -1668,8 +1668,8 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {  	fadeOut();  	for (int16 i = 1; i < _animation->kSpriteNumbMax; i++) { -		if (_animation->_sprites[i]._quick) -			_animation->_sprites[i].remove(); +		if (_animation->_sprites[i]->_quick) +			_animation->_sprites[i]->remove();  	} // Deallocate sprite  	if (_room == kRoomLustiesRoom) @@ -1679,7 +1679,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {  	_animation->appearPed(0, ped - 1);  	_enterCatacombsFromLustiesRoom = false;  	_animation->setOldDirection(_animation->getDirection()); -	_animation->setDirection(_animation->_sprites[0]._facingDir); +	_animation->setDirection(_animation->_sprites[0]->_facingDir);  	drawDirection();  	fadeIn(); @@ -1721,7 +1721,7 @@ void AvalancheEngine::openDoor(Room whither, byte ped, byte magicnum) {  				return;  			} else {  				_animation->appearPed(0, 5); -				_animation->_sprites[0]._facingDir = kDirRight; +				_animation->_sprites[0]->_facingDir = kDirRight;  				_sequence->startLustiesSeq2(whither, ped);  			}  			break; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index e9cc1c7f74..84dbed45e5 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -688,7 +688,7 @@ void Dialogs::callDialogDriver() {  				if (_param == 0)  					setBubbleStateNatural();  				else if ((1 <= _param) && (_param <= 9)) { -					AnimationType *spr = &_vm->_animation->_sprites[_param - 1]; +					AnimationType *spr = _vm->_animation->_sprites[_param - 1];  					if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid.  						_vm->errorLed();  						setBubbleStateNatural(); @@ -1074,7 +1074,7 @@ void Dialogs::talkTo(byte whom) {  	bool noMatches = true;  	for (int i = 0; i <= _vm->_animation->kSpriteNumbMax; i++) { -		if (_vm->_animation->_sprites[i]._stat._acciNum == whom) { +		if (_vm->_animation->_sprites[i]->_stat._acciNum == whom) {  			Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer);  			displayText(tmpStr);  			noMatches = false; @@ -1099,7 +1099,7 @@ void Dialogs::talkTo(byte whom) {  		_vm->_talkedToCrapulus = true;  		_vm->setRoom(kPeopleCrapulus, kRoomDummy); // Crapulus walks off. -		AnimationType *spr = &_vm->_animation->_sprites[1]; +		AnimationType *spr = _vm->_animation->_sprites[1];  		spr->_vanishIfStill = true;  		spr->walkTo(2); // Walks away. @@ -1134,7 +1134,7 @@ Common::String Dialogs::personSpeaks() {  	Common::String tmpStr;  	for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { -		if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _vm->_parser->_person)) { +		if (_vm->_animation->_sprites[i]->_quick && ((_vm->_animation->_sprites[i]->_stat._acciNum + 149) == _vm->_parser->_person)) {  			tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i);  			found = true;  		} diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index f722b128cc..59ac38f644 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -431,7 +431,7 @@ void Menu::setupMenuAction() {  		_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->kWalk) +	if (_vm->_animation->_sprites[0]->_speedX == _vm->kWalk)  		_activeMenuItem.setupOption("Run fast", 'R', "^R", true);  	else  		_activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -595,7 +595,7 @@ void Menu::runMenuAction() {  		_vm->callVerb(kVerbCodeInv);  		break;  	case 5: { -		AnimationType *avvy = &_vm->_animation->_sprites[0]; +		AnimationType *avvy = _vm->_animation->_sprites[0];  		if (avvy->_speedX == _vm->kWalk)  			avvy->_speedX = _vm->kRun;  		else diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 36d03492f0..d85e55032c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -714,8 +714,8 @@ void Parser::storeInterrogation(byte interrogation) {  			_vm->_spareEvening.clear();  		_vm->_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->_animation->_sprites[1]->walkTo(3); // The end of the drawbridge +		_vm->_animation->_sprites[1]->_vanishIfStill = true; // Then go away!  		_vm->_magics[1]._operation = kMagicNothing;  		_vm->_cardiffQuestionNum = 5;  		break; @@ -1265,14 +1265,14 @@ void Parser::openDoor() {  			MagicType *portal = &_vm->_portals[i];  			switch (portal->_operation) {  			case kMagicExclaim: -				_vm->_animation->_sprites[0].bounce(); +				_vm->_animation->_sprites[0]->bounce();  				_vm->_dialogs->displayScrollChain('x', portal->_data);  				break;  			case kMagicTransport:  				_vm->flipRoom((Room)((portal->_data) >> 8), portal->_data & 0x0F);  				break;  			case kMagicUnfinished: -				_vm->_animation->_sprites[0].bounce(); +				_vm->_animation->_sprites[0]->bounce();  				_vm->_dialogs->displayText("Sorry. This place is not available yet!");  				break;  			case kMagicSpecial: @@ -1393,9 +1393,9 @@ void Parser::notInOrder() {   */  void Parser::goToCauldron() {  	// Stops Geida_Procs. -	_vm->_animation->_sprites[1]._callEachStepFl = false; +	_vm->_animation->_sprites[1]->_callEachStepFl = false;  	_vm->_timer->addTimer(1, Timer::kProcSpludwickGoesToCauldron, Timer::kReasonSpludwickWalk); -	_vm->_animation->_sprites[1].walkTo(1); +	_vm->_animation->_sprites[1]->walkTo(1);  }  /** @@ -1456,7 +1456,7 @@ void Parser::drink() {  		_vm->fadeOut();  		_vm->flipRoom(kRoomYours, 1);  		_vm->_graphics->setBackgroundColor(kColorYellow); -		_vm->_animation->_sprites[0]._visible = false; +		_vm->_animation->_sprites[0]->_visible = false;  	}  } @@ -1490,7 +1490,7 @@ void Parser::standUp() {  				_vm->_graphics->setBackgroundColor(kColorBlack);  				_vm->_dialogs->displayScrollChain('d', 14);  			} -			_vm->_animation->_sprites[0]._visible = true; +			_vm->_animation->_sprites[0]->_visible = true;  			_vm->_userMovesAvvy = true;  			_vm->_animation->appearPed(0, 1);  			_vm->_animation->setDirection(kDirLeft); @@ -1512,7 +1512,7 @@ void Parser::standUp() {  			// Not sitting down.  			_vm->_background->draw(-1, -1, 3);  			// But standing up. -			_vm->_animation->_sprites[0]._visible = true; +			_vm->_animation->_sprites[0]->_visible = true;  			// And walking away.  			_vm->_animation->appearPed(0, 3);  			// Really not sitting down. @@ -1926,12 +1926,12 @@ void Parser::doThat() {  					i = 3;  				else  					i = 0; -				Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; +				Avalanche::AnimationType *spr = _vm->_animation->_sprites[0];  				if (spr->_id != i) {  					int16 x = spr->_x;  					int16 y = spr->_y;  					spr->remove(); -					spr->init(i, true, _vm->_animation); +					spr->init(i, true);  					spr->appear(x, y, kDirLeft);  					spr->_visible = false;  				} @@ -2072,9 +2072,9 @@ void Parser::doThat() {  				if (_vm->getRoom(kPeopleSpludwick) == kRoomSpludwicks)  					_vm->_dialogs->displayScrollChain('q', 18);  				else { -					Avalanche::AnimationType *spr = &_vm->_animation->_sprites[1]; +					Avalanche::AnimationType *spr = _vm->_animation->_sprites[1];  					// Avaricius -					spr->init(1, false, _vm->_animation); +					spr->init(1, false);  					_vm->_animation->appearPed(1, 3);  					spr->walkTo(4);  					spr->_callEachStepFl = true; @@ -2255,9 +2255,9 @@ void Parser::doThat() {  				_vm->refreshObjectList();  				_vm->_magics[11]._operation = kMagicNothing;  				_vm->incScore(7); -				_vm->_animation->_sprites[1].walkTo(1); -				_vm->_animation->_sprites[1]._vanishIfStill = true; -				_vm->_animation->_sprites[1]._callEachStepFl = false; +				_vm->_animation->_sprites[1]->walkTo(1); +				_vm->_animation->_sprites[1]->_vanishIfStill = true; +				_vm->_animation->_sprites[1]->_callEachStepFl = false;  				_vm->setRoom(kPeopleCwytalot, kRoomDummy);  				break;  			default: @@ -2385,7 +2385,7 @@ void Parser::doThat() {  				_vm->_dialogs->displayText("You're already sitting!");  			else {  				// Move Avvy to the place, and sit him down. -				_vm->_animation->_sprites[0].walkTo(3); +				_vm->_animation->_sprites[0]->walkTo(3);  				_vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown);  			}  		} else { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b4ba028242..4e90c7fe48 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -242,7 +242,7 @@ void Timer::avariciusTalks() {  }  void Timer::urinate() { -	_vm->_animation->_sprites[0].turn(kDirUp); +	_vm->_animation->_sprites[0]->turn(kDirUp);  	_vm->_animation->stopWalking();  	_vm->drawDirection();  	addTimer(14, kProcToilet, kReasonGoToToilet); @@ -264,7 +264,7 @@ void Timer::bang2() {  void Timer::stairs() {  	_vm->_sound->blip(); -	_vm->_animation->_sprites[0].walkTo(3); +	_vm->_animation->_sprites[0]->walkTo(3);  	_vm->_background->draw(-1, -1, 1);  	_vm->_brummieStairs = 2;  	_vm->_magics[10]._operation = kMagicSpecial; @@ -298,7 +298,7 @@ void Timer::getTiedUp() {  	_vm->_beenTiedUp = true;  	_vm->_animation->stopWalking(); -	AnimationType *spr = &_vm->_animation->_sprites[1]; +	AnimationType *spr = _vm->_animation->_sprites[1];  	spr->stopWalk();  	spr->stopHoming();  	spr->_callEachStepFl = true; @@ -307,17 +307,17 @@ void Timer::getTiedUp() {  }  void Timer::getTiedUp2() { -	_vm->_animation->_sprites[0].walkTo(3); -	_vm->_animation->_sprites[1].walkTo(4); +	_vm->_animation->_sprites[0]->walkTo(3); +	_vm->_animation->_sprites[1]->walkTo(4);  	_vm->_magics[3]._operation = kMagicNothing; // No effect when you touch the boundaries.  	_vm->_friarWillTieYouUp = true;  }  void Timer::hangAround() { -	_vm->_animation->_sprites[1]._doCheck = false; +	_vm->_animation->_sprites[1]->_doCheck = false; -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	avvy->init(7, true, _vm->_animation); // Robin Hood +	AnimationType *avvy = _vm->_animation->_sprites[0]; +	avvy->init(7, true); // Robin Hood  	_vm->setRoom(kPeopleRobinHood, kRoomRobins);  	_vm->_animation->appearPed(0, 1);  	_vm->_dialogs->displayScrollChain('q', 39); @@ -327,12 +327,12 @@ void Timer::hangAround() {  void Timer::hangAround2() {  	_vm->_dialogs->displayScrollChain('q', 40); -	AnimationType *spr = &_vm->_animation->_sprites[1]; +	AnimationType *spr = _vm->_animation->_sprites[1];  	spr->_vanishIfStill = false;  	spr->walkTo(3);  	_vm->setRoom(kPeopleFriarTuck, kRoomRobins);  	_vm->_dialogs->displayScrollChain('q', 41); -	_vm->_animation->_sprites[0].remove(); +	_vm->_animation->_sprites[0]->remove();  	spr->remove(); // Get rid of Robin Hood and Friar Tuck.  	addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); @@ -347,7 +347,7 @@ void Timer::afterTheShootemup() {  	// Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented!  	_vm->flipRoom(_vm->_room, 1); -	_vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot. +	_vm->_animation->_sprites[0]->init(0, true); // Avalot.  	_vm->_animation->appearPed(0, 1);  	_vm->_userMovesAvvy = true;  	_vm->_objects[kObjectCrossbow - 1] = true; @@ -417,8 +417,8 @@ void Timer::jacquesWakesUp() {  }  void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. -	AnimationType *spr = &_vm->_animation->_sprites[1]; -	spr->init(9, false, _vm->_animation); // Here comes the Duke. +	AnimationType *spr = _vm->_animation->_sprites[1]; +	spr->init(9, false); // Here comes the Duke.  	_vm->_animation->appearPed(1, 0); // He starts at the door...  	spr->walkTo(2); // He walks over to you. @@ -430,7 +430,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon  }  void Timer::naughtyDuke2() { -	AnimationType *spr = &_vm->_animation->_sprites[1]; +	AnimationType *spr = _vm->_animation->_sprites[1];  	_vm->_dialogs->displayScrollChain('q', 48); // "Ha ha, it worked again!"  	spr->walkTo(0); // Walk to the door.  	spr->_vanishIfStill = true; // Then go away! @@ -444,7 +444,7 @@ void Timer::naughtyDuke3() {  }  void Timer::jump() { -	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	AnimationType *avvy = _vm->_animation->_sprites[0];  	_vm->_jumpStatus++;  	switch (_vm->_jumpStatus) { @@ -534,7 +534,7 @@ void Timer::greetsMonk() {  void Timer::fallDownOubliette() {  	_vm->_magics[8]._operation = kMagicNothing; -	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	AnimationType *avvy = _vm->_animation->_sprites[0];  	avvy->_moveY++; // Increments dx/dy!  	avvy->_y += avvy->_moveY;   // Dowwwn we go...  	addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); @@ -551,7 +551,7 @@ void Timer::meetAvaroid() {  		_vm->_metAvaroid = true;  		addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); -		AnimationType *avvy = &_vm->_animation->_sprites[0]; +		AnimationType *avvy = _vm->_animation->_sprites[0];  		avvy->_facingDir = kDirLeft;  		avvy->_x = 151;  		avvy->_moveX = -3; @@ -562,7 +562,7 @@ void Timer::meetAvaroid() {  }  void Timer::riseUpOubliette() { -	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	AnimationType *avvy = _vm->_animation->_sprites[0];  	avvy->_visible = true;  	avvy->_moveY++; // Decrements dx/dy!  	avvy->_y -= avvy->_moveY; // Uuuupppp we go... @@ -573,12 +573,12 @@ void Timer::riseUpOubliette() {  }  void Timer::robinHoodAndGeida() { -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	avvy->init(7, true, _vm->_animation); +	AnimationType *avvy = _vm->_animation->_sprites[0]; +	avvy->init(7, true);  	_vm->_animation->appearPed(0, 6);  	avvy->walkTo(5); -	AnimationType *spr = &_vm->_animation->_sprites[1]; +	AnimationType *spr = _vm->_animation->_sprites[1];  	spr->stopWalk();  	spr->_facingDir = kDirLeft;  	addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); @@ -588,8 +588,8 @@ void Timer::robinHoodAndGeida() {  void Timer::robinHoodAndGeidaTalk() {  	_vm->_dialogs->displayScrollChain('q', 66); -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	AnimationType *spr = &_vm->_animation->_sprites[1]; +	AnimationType *avvy = _vm->_animation->_sprites[0]; +	AnimationType *spr = _vm->_animation->_sprites[1];  	avvy->walkTo(1);  	spr->walkTo(1);  	avvy->_vanishIfStill = true; @@ -599,11 +599,11 @@ void Timer::robinHoodAndGeidaTalk() {  }  void Timer::avalotReturns() { -	AnimationType *avvy = &_vm->_animation->_sprites[0]; -	AnimationType *spr = &_vm->_animation->_sprites[1]; +	AnimationType *avvy = _vm->_animation->_sprites[0]; +	AnimationType *spr = _vm->_animation->_sprites[1];  	avvy->remove();  	spr->remove(); -	avvy->init(0, true, _vm->_animation); +	avvy->init(0, true);  	_vm->_animation->appearPed(0, 0);  	_vm->_dialogs->displayScrollChain('q', 67);  	_vm->_userMovesAvvy = true; @@ -615,7 +615,7 @@ void Timer::avalotReturns() {   * @remarks	Originally called 'avvy_sit_down'   */  void Timer::avvySitDown() { -	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	AnimationType *avvy = _vm->_animation->_sprites[0];  	if (avvy->_homing)    // Still walking.  		addTimer(1, kProcAvvySitDown, kReasonSittingDown);  	else { @@ -658,7 +658,7 @@ void Timer::winning() {  }  void Timer::avalotFalls() { -	AnimationType *avvy = &_vm->_animation->_sprites[0]; +	AnimationType *avvy = _vm->_animation->_sprites[0];  	if (avvy->_stepNum < 5) {  		avvy->_stepNum++;  		addTimer(3, kProcAvalotFalls, kReasonFallingOver); @@ -673,14 +673,14 @@ void Timer::avalotFalls() {  }  void Timer::spludwickGoesToCauldron() { -	if (_vm->_animation->_sprites[1]._homing) +	if (_vm->_animation->_sprites[1]->_homing)  		addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludwickWalk);  	else  		addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludwickWalk);  }  void Timer::spludwickLeavesCauldron() { -	_vm->_animation->_sprites[1]._callEachStepFl = true; // So that normal procs will continue. +	_vm->_animation->_sprites[1]->_callEachStepFl = true; // So that normal procs will continue.  }  void Timer::giveLuteToGeida() { // Moved here from Acci.  | 
