diff options
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes7.cpp | 536 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes7.h | 32 |
3 files changed, 564 insertions, 6 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index df193262e0..fb7bb057c9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -255,7 +255,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 702: // outside teleporter (after city is submerged) return new Scene702(vm); case 703: // water - return new DummyScene(vm); // TODO + return new Scene703(vm); case 704: // water, building in the distance return new DummyScene(vm); // TODO case 705: // water, outside building diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 302c8ba28a..ec99f14413 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -126,7 +126,7 @@ void Scene701::enter() { _globals[kBoatStatus] = BOAT_TIED_FLOATING; else if (_game._difficulty == DIFFICULTY_HARD) _globals[kBoatStatus] = BOAT_ADRIFT; - else + else _globals[kBoatStatus] = BOAT_TIED; } @@ -382,7 +382,7 @@ void Scene702::actions() { case 1: _vm->_sound->command(0xF); if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.setRoom(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); _vm->_dialogs->show(OBJ_BONES, 70218); break; @@ -423,6 +423,532 @@ void Scene702::actions() { /*------------------------------------------------------------------------*/ +void Scene703::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene703::handleBottleInterface() { + switch (_globals[kBottleStatus]) { + case 0: + _dialog1.write(0x311, true); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 1: + _dialog1.write(0x311, false); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 2: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 3: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, false); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + default: + break; + } +} + +void Scene703::setBottleSequence() { + _scene->_userInterface.setup(kInputBuildingSentences); + _game._player._stepEnabled = false; + if (_boatDir == 2) + _curSequence = 6; + else + _curSequence = 7; +} + +void Scene703::handleFillBottle(int quote) { + switch (quote) { + case 0x311: + _globals[kBottleStatus] = 1; + setBottleSequence(); + break; + + case 0x312: + _globals[kBottleStatus] = 2; + setBottleSequence(); + break; + + case 0x313: + _globals[kBottleStatus] = 3; + setBottleSequence(); + break; + + case 0x314: + _globals[kBottleStatus] = 4; + setBottleSequence(); + break; + + case 0x315: + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + default: + break; + } +} + +void Scene703::enter() { + _game._player._visible = false; + + if (!_game._visitedScenes._sceneRevisited) { + if (_scene->_priorSceneId == 704) + _globals[kMonsterAlive] = false; + else + _globals[kMonsterAlive] = true; + } + + _startMonsterTimer = true; + _rexDeathFl = true; + _monsterTime = 0; + _restartTrigger70Fl = true; + _useBomb = false; + _boatFrame = -1; + + if (!_globals[kMonsterAlive]) + _scene->_hotspots.activate(0x468, false); + + if (_scene->_priorSceneId == 704) { + _game._player._stepEnabled = false; + _curSequence = 2; + _boatDir = 2; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->_activeAnimation->setCurrentFrame(34); + } else if (_scene->_priorSceneId != -2) { + _game._player._stepEnabled = false; + _boatDir = 1; + if (_globals[kMonsterAlive]) { + _monsterMode = 1; + _curSequence = 0; + _scene->loadAnimation(formAnimName('B', -1), 0); + } else { + _curSequence = 0; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + } + } else if (_globals[kMonsterAlive]) { + _curSequence = 0; + _boatDir = 1; + _monsterMode = 1; + _scene->loadAnimation(formAnimName('B', -1), 0); + _scene->_activeAnimation->setCurrentFrame(39); + } else if (_boatDir == 1) { + _curSequence = 0; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->_activeAnimation->setCurrentFrame(9); + } else if (_boatDir == 2) { + _curSequence = 0; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->_activeAnimation->setCurrentFrame(56); + } + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_TWINKIFRUIT); + _game._objects.addToInventory(OBJ_BOMB); + _game._objects.addToInventory(OBJ_CHICKEN); + _game._objects.addToInventory(OBJ_BONES); + } + + _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0); + _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0); + sceneEntrySound(); + _vm->_sound->command(28); +} + +void Scene703::step() { + if (_startMonsterTimer) { + long diff = _scene->_frameStartTime - _lastFrameTime; + if ((diff >= 0) && (diff <= 12)) + _monsterTime += diff; + else + _monsterTime++; + + _lastFrameTime = _scene->_frameStartTime; + } + + if ((_monsterTime >= 2400) && !_rexDeathFl && !_useBomb) { + _startMonsterTimer = false; + _rexDeathFl = true; + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 3; + _scene->loadAnimation(formAnimName('D', -1), 0); + _rexDeathFl = false; + _monsterTime = 0; + } + + + if (_game._trigger == 70) + _scene->_reloadSceneFlag = true; + + if ((_monsterMode == 3) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + if (_boatFrame == 62) { + nextBoatFrame = 61; + if (_restartTrigger70Fl) { + _restartTrigger70Fl = false; + _scene->_sequences.addTimer(15, 70); + } + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } + + if (_game._trigger == 70) + _scene->_reloadSceneFlag = true; + + if ((_monsterMode == 0) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + switch (_boatFrame) { + case 11: + if (_curSequence == 7) { + _curSequence = 0; + nextBoatFrame = 100; + } else if (_curSequence == 5) + nextBoatFrame = 82; + else if (_curSequence == 1) + nextBoatFrame = 11; + else { + nextBoatFrame = 9; + if (!_game._player._stepEnabled) + _game._player._stepEnabled = true; + } + break; + + case 34: + if (_curSequence != 2) + _scene->_nextSceneId = 704; + break; + + case 57: + if (_curSequence == 6) { + _curSequence = 0; + nextBoatFrame = 91; + } else if (_curSequence == 4) + nextBoatFrame = 73; + else if (_curSequence == 3) + nextBoatFrame = 57; + else { + nextBoatFrame = 56; + if (!_game._player._stepEnabled) + _game._player._stepEnabled = true; + } + break; + + case 73: + _scene->_nextSceneId = 701; + break; + + case 82: + nextBoatFrame = 11; + break; + + case 91: + nextBoatFrame = 57; + break; + + case 100: + nextBoatFrame = 56; + if (!_game._player._stepEnabled) { + _scene->_sequences.addTimer(30, 80); + _game._player._stepEnabled = true; + } + break; + + case 110: + nextBoatFrame = 9; + if (!_game._player._stepEnabled) { + _scene->_sequences.addTimer(30, 80); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } + + if (_game._trigger == 80) { + switch (_globals[kBottleStatus]) { + case 0: + _vm->_dialogs->show(432); + break; + + case 1: + _vm->_dialogs->show(70324); + break; + + case 2: + _vm->_dialogs->show(70325); + break; + + case 3: + _vm->_dialogs->show(70326); + break; + + case 4: + _vm->_dialogs->show(70327); + break; + + default: + break; + } + } + + + if ((_monsterMode == 1) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + switch (_boatFrame) { + case 39: + _game._player._stepEnabled = true; + _startMonsterTimer = true; + _rexDeathFl = false; + break; + + case 40: + case 49: + case 54: + case 67: + case 78: + case 87: + case 96: + case 105: + case 114: + case 123: + if (_curSequence == 8) + nextBoatFrame = 129; + + break; + + case 129: + nextBoatFrame = 39; + break; + + case 151: + _scene->_nextSceneId = 701; + break; + + default: + break; + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } + + if ((_monsterMode == 2) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + switch (_boatFrame) { + case 14: + if (!_useBomb) { + if (_game._difficulty == DIFFICULTY_HARD) + _game._objects.setRoom(OBJ_CHICKEN, 1); + else + _vm->_dialogs->show(70319); + } + nextBoatFrame = 80; + break; + + case 33: + if (_game._objects.isInInventory(OBJ_BONES)) { + _game._objects.setRoom(OBJ_BONES, 1); + _game._objects.addToInventory(OBJ_BONE); + } else + _game._objects.setRoom(OBJ_BONE, 1); + + nextBoatFrame = 80; + break; + + case 53: + _game._objects.setRoom(OBJ_TWINKIFRUIT, 1); + nextBoatFrame = 80; + _curSequence = 9; + break; + + case 80: + if (_game._difficulty == DIFFICULTY_HARD) { + _game._objects.setRoom(OBJ_BOMB, 1); + _vm->_dialogs->show(70318); + } else + _vm->_dialogs->show(70317); + + _scene->freeAnimation(); + _monsterMode = 1; + _scene->loadAnimation(formAnimName('B', -1)); + _scene->_activeAnimation->setCurrentFrame(39); + _game._player._stepEnabled = true; + break; + + case 91: + if (!_useBomb) { + _scene->freeAnimation(); + _monsterMode = 1; + _scene->loadAnimation(formAnimName('B', -1)); + _scene->_activeAnimation->setCurrentFrame(39); + _game._player._stepEnabled = true; + } else + _game._objects.setRoom(OBJ_CHICKEN_BOMB, 1); + + break; + + case 126: + _scene->_hotspots.activate(0x468, false); + _globals[kMonsterAlive] = false; + _scene->freeAnimation(); + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(9); + _game._player._stepEnabled = true; + if (_game._storyMode == STORYMODE_NAUGHTY) + _vm->_dialogs->show(70321); + else + _vm->_dialogs->show(70322); + + break; + + default: + break; + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } +} + +void Scene703::actions() { + if (_game._screenObjects._inputMode == 1) + handleFillBottle(_action._activeAction._verbId); + else if (_action.isAction(0x3B1, 0x3B0)) { + _game._player._stepEnabled = false; + if (_globals[kMonsterAlive]) + _curSequence = 8; + else if (_boatDir == 1) + _curSequence = 5; + else + _curSequence = 3; + } else if (_action.isAction(0x3B1, 0x3B2)) { + _game._player._stepEnabled = false; + if (_globals[kMonsterAlive]) { + _startMonsterTimer = false; + _rexDeathFl = true; + _monsterTime = 0; + _scene->freeAnimation(); + _monsterMode = 3; + _scene->loadAnimation(formAnimName('D', -1)); + } else if (_boatDir == 2) + _curSequence = 4; + else + _curSequence = 1; + } else if (_action.isAction(VERB_THROW, 0x2C, 0x468) || _action.isAction(VERB_THROW, 0x2D, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + _scene->_activeAnimation->setCurrentFrame(19); + } else if (_action.isAction(VERB_THROW, 0x49, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + } else if (_action.isAction(VERB_THROW, 0x17A, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + _scene->_activeAnimation->setCurrentFrame(39); + } else if (_action.isAction(VERB_THROW, 0x2A, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + _scene->_activeAnimation->setCurrentFrame(59); + } else if (_action.isAction(VERB_THROW, 0x4A, 0x468)) { + _useBomb = true; + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + } else if (_action.isAction(VERB_PUT, 0x2E, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + if (_globals[kBottleStatus] != 4) { + handleBottleInterface(); + _dialog1.start(); + } else + _vm->_dialogs->show(70323); + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x468)) { + if (_globals[kMonsterAlive]) + _vm->_dialogs->show(70310); + } else if (_action.isAction(VERB_LOOK, 0x18F)) { + if (!_globals[kMonsterAlive]) + _vm->_dialogs->show(70311); + else + _vm->_dialogs->show(70312); + } else if (_action.isAction(VERB_LOOK, 0x3B2)) { + if (_globals[kMonsterAlive]) + _vm->_dialogs->show(70313); + else if (_game._visitedScenes.exists(710)) + _vm->_dialogs->show(70314); + else + _vm->_dialogs->show(70315); + } else if (_action.isAction(VERB_LOOK, 0x3B3)) + _vm->_dialogs->show(70316); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() @@ -588,14 +1114,14 @@ void Scene752::enter() { if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) { _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('i', -1)); - _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1); + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); int idx = _scene->_dynamicHotspots.add(0xB3, VERB_WALKTO, _globals._sequenceIndexes[13], Common::Rect(0, 0, 0, 0)); _cardId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 135), FACING_NORTH); } if (_game._globals[kLaserHoleIsThere]) { - _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); + _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 13); int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_LOOK_AT, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(215, 130), FACING_NORTHWEST); @@ -681,7 +1207,7 @@ void Scene752::actions() { case 1: _vm->_sound->command(0xF); if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.setRoom(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); _vm->_dialogs->show(OBJ_BONES, 75221); break; diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index c878149bfd..049cc54bf4 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -74,6 +74,38 @@ public: virtual void actions(); }; +class Scene703: public Scene7xx{ +private: + int _monsterMode; + int _boatFrame; + int _curSequence; + int _boatDir; + + bool _useBomb; + bool _startMonsterTimer; + bool _rexDeathFl; + bool _restartTrigger70Fl; + + uint32 _lastFrameTime; + uint32 _monsterTime; + + Conversation _dialog1; + + void handleBottleInterface(); + void setBottleSequence(); + void handleFillBottle(int quote); + +public: + Scene703(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene707: public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} |