AVALANCHE: Merge Gyro, Lucerna and Avalot

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

View file

@ -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.