From 9643b543f088449bc6728c5a884087789aa4c5c7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Apr 2014 07:45:35 +0200 Subject: MADS: Implement scene 110 --- engines/mads/animation.cpp | 4 + engines/mads/animation.h | 1 + engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 123 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 16 ++++ 5 files changed, 146 insertions(+) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 380770fd8f..06eeaf8278 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -609,4 +609,8 @@ void Animation::setCurrentFrame(int frameNumber) { _nextScrollTimer = _nextFrameTimer = _vm->_game->_scene._frameStartTime; } +void Animation::setNextFrameTimer(int frameNumber) { + _nextFrameTimer = frameNumber; +} + } // End of namespace MADS diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 75f14a52b3..3b0341780c 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -213,6 +213,7 @@ public: */ void update(); + void setNextFrameTimer(int frameNumber); void setCurrentFrame(int frameNumber); int getCurrentFrame() const { return _currentFrame; } diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 50c4b9449a..3ad856bdf8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -65,6 +65,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene108(vm); case 109: return new Scene109(vm); + case 110: + return new Scene110(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 5e2ed3de16..37c993ebe7 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2658,6 +2658,129 @@ void Scene109::actions() { } +/*------------------------------------------------------------------------*/ + +void Scene110::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0x5B); +} + +void Scene110::enter() { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('X', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('X', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('X', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('X', 3)); + + crabs_here = false; + + if (_scene->_priorSceneId == 109) { + _game._player._playerPos = Common::Point(59, 71); + + _globals._sequenceIndexes[0] = _scene->_sequences.startCycle(_globals._spriteIndexes[0], false, 1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + + crabs_here = true; + + int idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(194, 23); + _game._player._facing = FACING_SOUTH; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(Resources::formatName(110, 'T', 1,EXT_AA, ""), 70); + } + + sceneEntrySound(); + _game.loadQuoteSet(0x59, 0); + + if (!_game._visitedScenes._sceneRevisited && (_scene->_priorSceneId == 109)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(109)); +} + +void Scene110::step() { + if (_game._trigger == 70) { + _game._player._visible = true; + _game._player._stepEnabled = true; + } +} + +void Scene110::preActions() { + if (_action.isAction(0x15B, 0x41)) + _game._player._walkOffScreenSceneId = 109; + + if (crabs_here) { + crabs_here = false; + + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 16, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 16, 1, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 16, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 16, 1, 0, 0); + + int idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + } +} + +void Scene110::actions() { + if (_action.isAction(0x15B, 0x178)) { + switch (_game._trigger) { + case 0: + _scene->loadAnimation(Resources::formatName(110, 'T', 0, EXT_AA, ""), 1); + _scene->_activeAnimation->setNextFrameTimer(_game._player._ticksAmount + _game._player._priorTimer); + _game._player._stepEnabled = false; + _game._player._visible = false; + break; + case 1: + _game._player._visible = true; + _game._player._stepEnabled = true; + _scene->_nextSceneId = 111; + break; + } + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x3F)) + _vm->_dialogs->show(0x2AF9); + else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(0xD1, 0x40)) + _vm->_dialogs->show(0x2AFA); + else if (_action.isAction(VERB_LOOK, 0x129)) + _vm->_dialogs->show(0x2AFB); + else if (_action.isAction(VERB_TAKE, 0x129)) + _vm->_dialogs->show(0x2AFC); + else if (_action.isAction(VERB_LOOK, 0x178)) + _vm->_dialogs->show(0x2AFD); + else if (_action.isAction(VERB_LOOK, 0x41)) + _vm->_dialogs->show(0x2AFE); + else if (_action.isAction(VERB_LOOK, 0x8F)) + _vm->_dialogs->show(0x2AFF); + else if (_action.isAction(VERB_TAKE, 0x8F)) + _vm->_dialogs->show(0x2B00); + else + return; + + _action._inProgress = false; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 267234c7d1..d4f69c321e 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -212,6 +212,22 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene110 : public Scene1xx { +private: + int crabs_here; /* Flag if crabs are here */ + +public: + Scene110(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3