diff options
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes7.cpp | 264 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes7.h | 19 |
3 files changed, 284 insertions, 1 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index fe336a63d4..04c4c6e3e0 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -259,7 +259,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 704: // water, building in the distance return new Scene704(vm); case 705: // water, outside building - return new DummyScene(vm); // TODO + return new Scene705(vm); case 706: // inside building, pedestral room, outside teleporter return new DummyScene(vm); // TODO case 707: // teleporter diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 9e639786ae..6470624304 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1300,6 +1300,270 @@ void Scene704::actions() { /*------------------------------------------------------------------------*/ +void Scene705::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene705::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 Scene705::setBottleSequence() { + _scene->_userInterface.setup(kInputBuildingSentences); + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->loadAnimation(formAnimName('F', -1), 90); +} + +void Scene705::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 Scene705::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); + + _game._player._visible = false; + + if (_scene->_priorSceneId == 706) { + _game._player._stepEnabled = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + } else if (_scene->_priorSceneId != -2) { + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(1, 80); + _vm->_sound->command(28); + } else + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_BOTTLE); + + _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0); + _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0); + sceneEntrySound(); +} + +void Scene705::step() { + switch (_game._trigger) { + case 70: + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 71: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + switch (_game._trigger) { + case 80: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: { + _vm->_sound->command(19); + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + switch (_game._trigger) { + case 90: + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.addTimer(30, 91); + break; + + case 91: + 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; + } + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene705::actions() { + if (_game._screenObjects._inputMode == 1) + handleFillBottle(_action._activeAction._verbId); + else if (_action.isAction(0x3B1, 0x3B4)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _vm->_sound->command(18); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_nextSceneId = 704; + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + } else if (_action.isAction(0x4F, 0x197)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 16); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 16); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 706; + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + } else if (_action.isAction(0x85, 0x2E, 0x18F) || _action.isAction(VERB_PUT, 0x2E, 0x18F)) { + if (_globals[kBottleStatus] != 4) { + handleBottleInterface(); + _dialog1.start(); + } else + _vm->_dialogs->show(70323); + } if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x18F)) + _vm->_dialogs->show(70511); + else if (_action.isAction(VERB_LOOK, 0x3B3)) + _vm->_dialogs->show(70512); + else if (_action.isAction(VERB_LOOK, 0x3B4)) + _vm->_dialogs->show(70513); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(70514); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(70515); + else if (_action.isAction(VERB_LOOK, 0x197)) + _vm->_dialogs->show(70516); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 34695dd402..06d5d04b1f 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -132,6 +132,25 @@ public: virtual void postActions() {}; }; +class Scene705: public Scene7xx{ +private: + Conversation _dialog1; + + void handleFillBottle(int quote); + void setBottleSequence(); + void handleBottleInterface(); + +public: + Scene705(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) {} |