From 2db45fac8c8808cb887e435db051e39c575d7667 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 May 2014 00:51:10 +0200 Subject: MADS: Implement Scene 612 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 209 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 18 +++ 3 files changed, 228 insertions(+), 1 deletion(-) (limited to 'engines/mads') diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a4ec04c317..64511a39d9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -245,7 +245,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 611: // back alley return new Scene611(vm); case 612: // expressway / maintenance building - return new DummyScene(vm); // TODO + return new Scene612(vm); case 620: // cutscene, viewport glass breaking return new Scene620(vm); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 7006acc924..4cacfacbc8 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -4259,6 +4259,215 @@ void Scene611::actions() { /*------------------------------------------------------------------------*/ +void Scene612::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x87); + _scene->addActiveVocab(0xD); +} + +void Scene612::handleWinchMovement() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + // CHECKME: Is the "else" block useful as action is always equal to 1 at this point? + // Or is it a missing bit of code we could fix? + if (action == 1) { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 17, 7, 0, 0); + _vm->_sound->command(19); + _game._objects.setRoom(OBJ_PADLOCK_KEY, 1); + _globals[kBoatRaised] = false; + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 17, 9, 0, 0); + _vm->_sound->command(18); + } + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); + _game._player._visible = true; + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, _cycleIndex); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F4)); + _game._player._stepEnabled = true; + + _vm->_dialogs->show(61217); + } + break; + + default: + break; + } +} + +void Scene612::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_3"); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXRC_6"); + + if ((_globals[kLineStatus] == 2) || (_globals[kLineStatus] == 3)) { + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1)); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(34, 117), FACING_SOUTHEAST); + } + + if (_globals[kBoatRaised]) + _cycleIndex = -2; + else + _cycleIndex = -1; + + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, _cycleIndex); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(280, 75); + _game._player._facing = FACING_SOUTHWEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 3); + _scene->loadAnimation(formAnimName('R', 1), 70); + } + + sceneEntrySound(); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_PADLOCK_KEY); + + _game.loadQuoteSet(0x2F5, 0x2F4, 0); +} + +void Scene612::step() { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene612::actions() { + if (_action.isAction(0x325, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], true, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], true, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action.isAction(0x17B, 0xFF, 0x45F)) { + _cycleIndex = -2; + action = 1; + handleWinchMovement(); + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x466)) + _vm->_dialogs->show(61210); + else if (_action.isAction(VERB_LOOK, 0x347) || _action.isAction(VERB_LOOK, 0x45E)) { + if (_globals[kBoatRaised]) + _vm->_dialogs->show(61211); + else + _vm->_dialogs->show(61212); + } else if (_action.isAction(VERB_TAKE, 0x347)) + _vm->_dialogs->show(61213); + else if (_action.isAction(VERB_LOOK, 0x45F)) { + if (_globals[kBoatRaised]) + _vm->_dialogs->show(61214); + else + _vm->_dialogs->show(61216); + } else if (_action.isAction(VERB_OPEN, 0x45F)) + _vm->_dialogs->show(61215); + else if (_action.isAction(VERB_LOOK, 0x33D)) + _vm->_dialogs->show(61218); + else if (_action.isAction(VERB_LOOK, 0x464)) + _vm->_dialogs->show(61219); + else if (_action.isAction(VERB_LOOK, 0x2CD)) + _vm->_dialogs->show(61220); + else if (_action.isAction(VERB_LOOK, 0x4A2)) + _vm->_dialogs->show(61221); + else if (_action.isAction(VERB_OPEN, 0x4A2)) + _vm->_dialogs->show(61222); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(61223); + else if (_action.isAction(VERB_LOOK, 0x257)) + _vm->_dialogs->show(61224); + else if (_action.isAction(0x1AD, 0x461) || _action.isAction(0x1AD, 0x463)) + _vm->_dialogs->show(61225); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene620::setup() { _game._player._spritesPrefix = ""; setAAName(); diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 4c465bf79f..294cf3560d 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -300,6 +300,24 @@ public: virtual void postActions() {}; }; +class Scene612: public Scene6xx{ +private: + int action; + int _cycleIndex; + + void handleWinchMovement(); + +public: + Scene612(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene620: public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} -- cgit v1.2.3