diff options
Diffstat (limited to 'engines/avalanche/timer.cpp')
-rw-r--r-- | engines/avalanche/timer.cpp | 108 |
1 files changed, 66 insertions, 42 deletions
diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 019f2da84f..2df7ce217a 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -308,10 +308,12 @@ void Timer::getTiedUp() { _vm->_gyro->_userMovesAvvy = false; _vm->_gyro->_beenTiedUp = true; _vm->_animation->stopWalking(); - _vm->_animation->_sprites[1].stopWalk(); - _vm->_animation->_sprites[1].stopHoming(); - _vm->_animation->_sprites[1]._callEachStepFl = true; - _vm->_animation->_sprites[1]._eachStepProc = Animation::kProcGrabAvvy; + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->stopWalk(); + spr->stopHoming(); + spr->_callEachStepFl = true; + spr->_eachStepProc = Animation::kProcGrabAvvy; addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp); } @@ -324,22 +326,25 @@ void Timer::getTiedUp2() { void Timer::hangAround() { _vm->_animation->_sprites[1]._doCheck = false; - _vm->_animation->_sprites[0].init(7, true, _vm->_animation); // Robin Hood + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[Gyro::kPeopleRobinHood - 150] = r__robins; _vm->_animation->appearPed(1, 2); _vm->_visa->displayScrollChain('q', 39); - _vm->_animation->_sprites[0].walkTo(7); + avvy->walkTo(7); addTimer(55, kProcHangAround2, kReasonHangingAround); } void Timer::hangAround2() { _vm->_visa->displayScrollChain('q', 40); - _vm->_animation->_sprites[1]._vanishIfStill = false; - _vm->_animation->_sprites[1].walkTo(4); + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->_vanishIfStill = false; + spr->walkTo(4); _vm->_gyro->_whereIs[Gyro::kPeopleFriarTuck - 150] = r__robins; _vm->_visa->displayScrollChain('q', 41); _vm->_animation->_sprites[0].remove(); - _vm->_animation->_sprites[1].remove(); // Get rid of Robin Hood and Friar Tuck. + spr->remove(); // Get rid of Robin Hood and Friar Tuck. addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). @@ -424,9 +429,10 @@ void Timer::jacquesWakesUp() { } void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money. - _vm->_animation->_sprites[1].init(9, false, _vm->_animation); // Here comes the Duke. + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->init(9, false, _vm->_animation); // Here comes the Duke. _vm->_animation->appearPed(2, 1); // He starts at the door... - _vm->_animation->_sprites[1].walkTo(3); // He walks over to you. + spr->walkTo(3); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -437,9 +443,10 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon } void Timer::naughtyDuke2() { + AnimationType *spr = &_vm->_animation->_sprites[1]; _vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!" - _vm->_animation->_sprites[1].walkTo(1); // Walk to the door. - _vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away! + spr->walkTo(1); // Walk to the door. + spr->_vanishIfStill = true; // Then go away! addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke); } @@ -450,8 +457,9 @@ void Timer::naughtyDuke3() { } void Timer::jump() { - _vm->_gyro->_jumpStatus++; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + _vm->_gyro->_jumpStatus++; switch (_vm->_gyro->_jumpStatus) { case 1: case 2: @@ -459,7 +467,7 @@ void Timer::jump() { case 5: case 7: case 9: - _vm->_animation->_sprites[0]._y--; + avvy->_y--; break; case 12: case 13: @@ -467,7 +475,7 @@ void Timer::jump() { case 16: case 18: case 19: - _vm->_animation->_sprites[0]._y++; + avvy->_y++; break; } @@ -539,8 +547,10 @@ void Timer::greetsMonk() { void Timer::fallDownOubliette() { _vm->_gyro->_magics[8]._operation = Gyro::kMagicNothing; - _vm->_animation->_sprites[0]._moveY++; // Increments dx/dy! - _vm->_animation->_sprites[0]._y += _vm->_animation->_sprites[0]._moveY; // Dowwwn we go... + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->_moveY++; // Increments dx/dy! + avvy->_y += avvy->_moveY; // Dowwwn we go... addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette); } @@ -554,48 +564,59 @@ void Timer::meetAvaroid() { _vm->_gyro->_metAvaroid = true; addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette); - _vm->_animation->_sprites[0]._facingDir = Animation::kDirLeft; - _vm->_animation->_sprites[0]._x = 151; - _vm->_animation->_sprites[0]._moveX = -3; - _vm->_animation->_sprites[0]._moveY = -5; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->_facingDir = Animation::kDirLeft; + avvy->_x = 151; + avvy->_moveX = -3; + avvy->_moveY = -5; _vm->_gyro->setBackgroundColor(2); } } void Timer::riseUpOubliette() { - _vm->_animation->_sprites[0]._visible = true; - _vm->_animation->_sprites[0]._moveY++; // Decrements dx/dy! - _vm->_animation->_sprites[0]._y -= _vm->_animation->_sprites[0]._moveY; // Uuuupppp we go... - if (_vm->_animation->_sprites[0]._moveY > 0) + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->_visible = true; + avvy->_moveY++; // Decrements dx/dy! + avvy->_y -= avvy->_moveY; // Uuuupppp we go... + if (avvy->_moveY > 0) addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette); else _vm->_gyro->_userMovesAvvy = true; } void Timer::robinHoodAndGeida() { - _vm->_animation->_sprites[0].init(7, true, _vm->_animation); + AnimationType *avvy = &_vm->_animation->_sprites[0]; + avvy->init(7, true, _vm->_animation); _vm->_animation->appearPed(1, 7); - _vm->_animation->_sprites[0].walkTo(6); - _vm->_animation->_sprites[1].stopWalk(); - _vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft; + avvy->walkTo(6); + + AnimationType *spr = &_vm->_animation->_sprites[1]; + spr->stopWalk(); + spr->_facingDir = Animation::kDirLeft; addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida); _vm->_gyro->_geidaFollows = false; } void Timer::robinHoodAndGeidaTalk() { _vm->_visa->displayScrollChain('q', 66); - _vm->_animation->_sprites[0].walkTo(2); - _vm->_animation->_sprites[1].walkTo(2); - _vm->_animation->_sprites[0]._vanishIfStill = true; - _vm->_animation->_sprites[1]._vanishIfStill = true; + + AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *spr = &_vm->_animation->_sprites[1]; + avvy->walkTo(2); + spr->walkTo(2); + avvy->_vanishIfStill = true; + spr->_vanishIfStill = true; + addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida); } void Timer::avalotReturns() { - _vm->_animation->_sprites[0].remove(); - _vm->_animation->_sprites[1].remove(); - _vm->_animation->_sprites[0].init(0, true, _vm->_animation); + AnimationType *avvy = &_vm->_animation->_sprites[0]; + AnimationType *spr = &_vm->_animation->_sprites[1]; + avvy->remove(); + spr->remove(); + avvy->init(0, true, _vm->_animation); _vm->_animation->appearPed(1, 1); _vm->_visa->displayScrollChain('q', 67); _vm->_gyro->_userMovesAvvy = true; @@ -607,18 +628,20 @@ void Timer::avalotReturns() { * @remarks Originally called 'avvy_sit_down' */ void Timer::avvySitDown() { - if (_vm->_animation->_sprites[0]._homing) // Still walking. + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (avvy->_homing) // Still walking. addTimer(1, kProcAvvySitDown, kReasonSittingDown); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_sittingInPub = true; _vm->_gyro->_userMovesAvvy = false; - _vm->_animation->_sprites[0]._visible = false; + avvy->_visible = false; } } void Timer::ghostRoomPhew() { - Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); + Common::String tmpStr = Common::String::format("%cPHEW!%c You're glad to get out of %cthere!", + Scrolls::kControlItalic, Scrolls::kControlRoman, Scrolls::kControlItalic); _vm->_scrolls->displayText(tmpStr); } @@ -648,8 +671,9 @@ void Timer::winning() { } void Timer::avalotFalls() { - if (_vm->_animation->_sprites[0]._stepNum < 5) { - _vm->_animation->_sprites[0]._stepNum++; + AnimationType *avvy = &_vm->_animation->_sprites[0]; + if (avvy->_stepNum < 5) { + avvy->_stepNum++; addTimer(3, kProcAvalotFalls, kReasonFallingOver); } else { Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", |