diff options
author | Strangerke | 2015-10-27 22:28:43 +0100 |
---|---|---|
committer | Strangerke | 2015-10-27 22:28:43 +0100 |
commit | cbb302a550273a80b1826912396053d0309775c9 (patch) | |
tree | f53bcc3f8ceae6dd35bb316c6e0f92413265b922 | |
parent | 49a5b194d07304361aa46fab4900a5104b097f8a (diff) | |
download | scummvm-rg350-cbb302a550273a80b1826912396053d0309775c9.tar.gz scummvm-rg350-cbb302a550273a80b1826912396053d0309775c9.tar.bz2 scummvm-rg350-cbb302a550273a80b1826912396053d0309775c9.zip |
MADS: Phantom: Implement scene 301
-rw-r--r-- | engines/mads/phantom/phantom_scenes.cpp | 2 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes3.cpp | 349 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes3.h | 20 | ||||
-rw-r--r-- | engines/mads/user_interface.h | 4 |
4 files changed, 372 insertions, 3 deletions
diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp index 1e20db738e..ac2dda9e8a 100644 --- a/engines/mads/phantom/phantom_scenes.cpp +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -97,7 +97,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #3 (catwalks, chandelier, lake / catacombs entrance) case 301: // catwalk #1 above stage - return new DummyScene(vm); // TODO + return new Scene301(vm); case 302: // catwalk #2 above stage return new DummyScene(vm); // TODO case 303: // above chandelier diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp index 7e777bc742..4c6a67ba85 100644 --- a/engines/mads/phantom/phantom_scenes3.cpp +++ b/engines/mads/phantom/phantom_scenes3.cpp @@ -84,5 +84,354 @@ void Scene3xx::setPlayerSpritesPrefix() { /*------------------------------------------------------------------------*/ +Scene301::Scene301(MADSEngine *vm) : Scene3xx(vm) { + _anim0ActvFl = false; + _skip1Fl = false; + _skip2Fl = false; + + _lightingHotspotId = -1; + _sandbagHotspotId = -1; +} + +void Scene301::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_anim0ActvFl); + s.syncAsByte(_skip1Fl); + s.syncAsByte(_skip2Fl); + + s.syncAsSint16LE(_lightingHotspotId); + s.syncAsSint16LE(_sandbagHotspotId); +} + +void Scene301::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene301::enter() { + _vm->_disableFastwalk = true; + + _anim0ActvFl = false; + _skip2Fl = false; + _skip1Fl = false; + + _scene->loadSpeech(6); + + _scene->_hotspots.activate(NOUN_CABLE, false); + _scene->_hotspots.activate(NOUN_STOOL, false); + + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 0), false); + + if (_globals[kCurrentYear] == 1993) { + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1), false); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', 0), false); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('z', 1), false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('z', 2), false); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('z', 3), false); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('z', 4), false); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('z', 5), false); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('z', 6), false); + + _lightingHotspotId = _scene->_dynamicHotspots.add(NOUN_LIGHTING_INSTRUMENT, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(50, 116, 50 + 19, 116 + 10)); + _scene->_dynamicHotspots.setPosition(_lightingHotspotId, Common::Point(67, 129), FACING_NORTHWEST); + _lightingHotspotId = _scene->_dynamicHotspots.add(NOUN_LIGHTING_INSTRUMENT, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(126, 118, 126 + 29, 118 + 8)); + _scene->_dynamicHotspots.setPosition(_lightingHotspotId, Common::Point(152, 129), FACING_NORTHWEST); + + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + + _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14); + + _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); + + _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14); + + _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14); + + _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14); + + _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14); + + _scene->_hotspots.activate(NOUN_CABLE, true); + } else { + _sandbagHotspotId = _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(464, 114, 464 + 11, 114 + 9)); + _scene->_dynamicHotspots.setPosition(_sandbagHotspotId, Common::Point(475, 125), FACING_NORTHWEST); + _scene->_dynamicHotspots.add(NOUN_SANDBAG, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(468, 42, 468 + 6, 42 + 13)); + _scene->_hotspots.activate(NOUN_STOOL, true); + _scene->_hotspots.activate(NOUN_BIG_PROP, false); + } + + if (_scene->_priorSceneId == 302) { + _game._player.firstWalk(Common::Point(-20, 132), FACING_WEST, Common::Point(19, 132), FACING_EAST, true); + _scene->setCamera(Common::Point(0, 0)); + } else if ((_scene->_priorSceneId == 106) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) { + _game._player._playerPos = Common::Point(568, 133); + _game._player._facing = FACING_WEST; + _scene->setCamera(Common::Point(320, 0)); + } + + if (!_game._visitedScenes._sceneRevisited) { + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('x', 0), false); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 7, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -1, -2); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[9], 0, 0, 64); + } + + sceneEntrySound(); +} + +void Scene301::step() { + if ((_globals[kDoneBrieConv203] == 3) && (_scene->_posAdjust.x < 320) && (_game._player._playerPos.x < 350)) { + _game._player.cancelCommand(); + _game._player.walk(Common::Point(256, 130), FACING_NORTHWEST); + _game._player.setWalkTrigger(60); + _globals[kDoneBrieConv203] = 0; + _game._player._stepEnabled = false; + } + + if (_game._trigger == 60) { + _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('p', 1), 0); + _anim0ActvFl = true; + _game._player._visible = false; + _globals[kPlayerScore] += 10; + _game.syncTimers(3, _globals._animationIndexes[0], 2, 0); + } + + if (_anim0ActvFl && !_skip1Fl) { + if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 50) { + _scene->playSpeech(6); + _skip1Fl = true; + } + } + + if (_anim0ActvFl) { + if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == 61) { + _scene->setAnimFrame(_globals._animationIndexes[0], 60); + if (!_skip2Fl) { + _vm->_sound->command(1); + _scene->_sequences.setTimingTrigger(420, 70); + _skip2Fl = true; + } + } + } + + if (_game._trigger == 70) { + _scene->_userInterface.noInventoryAnim(); + // CHECKME: Not sure about the next function call + _scene->_userInterface.refresh(); + _scene->_nextSceneId = 104; + } + + if (_game._trigger == 64) + _scene->_sequences.setTimingTrigger(60, 65); + + if (_game._trigger == 65) + _vm->_dialogs->show(30137); +} + +void Scene301::actions() { + if (_action.isAction(VERB_CLIMB_DOWN, NOUN_CIRCULAR_STAIRCASE)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('d', 1), 1); + _game.syncTimers(3, _globals._animationIndexes[0], 2, 0); + break; + + case 1: + _scene->_nextSceneId = 106; + break; + + default: + break; + } + goto handled; + } + + if (_action._lookFlag) { + _vm->_dialogs->show(30110); + goto handled; + } + + if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) { + if (_action.isObject(NOUN_GRID)) { + _vm->_dialogs->show(30111); + goto handled; + } + + if (_action.isObject(NOUN_CATWALK)) { + _vm->_dialogs->show(30112); + goto handled; + } + + if (_action.isObject(NOUN_SIDE_WALL)) { + _vm->_dialogs->show(30113); + goto handled; + } + + if (_action.isObject(NOUN_BACK_WALL)) { + _vm->_dialogs->show(30114); + goto handled; + } + + if (_action.isObject(NOUN_SUPPORT)) { + _vm->_dialogs->show(30115); + goto handled; + } + + if (_action.isObject(NOUN_ACT_CURTAIN)) { + _vm->_dialogs->show(30116); + goto handled; + } + + if (_action.isObject(NOUN_HOUSE)) { + _vm->_dialogs->show(30117); + goto handled; + } + + if (_action.isObject(NOUN_OTHER_CATWALK)) { + _vm->_dialogs->show(30118); + goto handled; + } + + if (_action.isObject(NOUN_GRIDWORK)) { + _vm->_dialogs->show(30119); + goto handled; + } + + if (_action.isObject(NOUN_BEAM_POSITION)) { + _vm->_dialogs->show(30120); + goto handled; + } + + if (_action.isObject(NOUN_LIGHTING_INSTRUMENT)) { + if (_globals[kCurrentYear] == 1993) + _vm->_dialogs->show(30121); + else + _vm->_dialogs->show(30122); + + goto handled; + } + + if (_action.isObject(NOUN_TARP)) { + if (_globals[kCurrentYear] == 1993) + _vm->_dialogs->show(30123); + else + _vm->_dialogs->show(30140); + + goto handled; + } + + if (_action.isObject(NOUN_COUNTERWEIGHT_SYSTEM)) { + _vm->_dialogs->show(30124); + goto handled; + } + + if (_action.isObject(NOUN_SANDBAG) && (_action._mainObjectSource == CAT_HOTSPOT)) { + _vm->_dialogs->show(30125); + goto handled; + } + + if (_action.isObject(NOUN_BATTEN)) { + _vm->_dialogs->show(30126); + goto handled; + } + + if (_action.isObject(NOUN_STOOL)) { + _vm->_dialogs->show(30127); + goto handled; + } + + if (_action.isObject(NOUN_HEMP)) { + _vm->_dialogs->show(30128); + goto handled; + } + + if (_action.isObject(NOUN_CIRCULAR_STAIRCASE)) { + _vm->_dialogs->show(30129); + goto handled; + } + + if (_action.isObject(NOUN_CATWALK_OVER_HOUSE)) { + _vm->_dialogs->show(30130); + goto handled; + } + + if (_action.isObject(NOUN_STAIRCASE_POST)) { + _vm->_dialogs->show(30131); + goto handled; + } + + if (_action.isObject(NOUN_RAILING)) { + _vm->_dialogs->show(30132); + goto handled; + } + + if (_action.isObject(NOUN_CYCLORAMA)) { + _vm->_dialogs->show(30133); + goto handled; + } + + if (_action.isObject(NOUN_BIG_PROP)) { + _vm->_dialogs->show(30134); + goto handled; + } + + if (_action.isObject(NOUN_PROSCENIUM_ARCH)) { + _vm->_dialogs->show(30135); + goto handled; + } + + if (_action.isObject(NOUN_CABLE)) { + _vm->_dialogs->show(30136); + goto handled; + } + } + + if (_action.isAction(VERB_TAKE, NOUN_HEMP)) { + _vm->_dialogs->show(30138); + goto handled; + } + + if (_action.isAction(VERB_PULL, NOUN_HEMP)) { + _vm->_dialogs->show(30141); + goto handled; + } + + if (_action.isAction(VERB_TAKE, NOUN_SANDBAG) && (_action._mainObjectSource == CAT_HOTSPOT)) { + _vm->_dialogs->show(30139); + goto handled; + } + + if (_action.isAction(VERB_TAKE, NOUN_TARP)) { + _vm->_dialogs->show(30142); + goto handled; + } + + goto done; + +handled: + _action._inProgress = false; + +done: + ; +} + +void Scene301::preActions() { + if (_action.isAction(VERB_EXIT_TO, NOUN_CATWALK_OVER_HOUSE)) + _game._player._walkOffScreenSceneId = 302; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Phantom } // End of namespace MADS diff --git a/engines/mads/phantom/phantom_scenes3.h b/engines/mads/phantom/phantom_scenes3.h index cd6b63675c..4c200e93ed 100644 --- a/engines/mads/phantom/phantom_scenes3.h +++ b/engines/mads/phantom/phantom_scenes3.h @@ -53,6 +53,26 @@ public: Scene3xx(MADSEngine *vm) : PhantomScene(vm) { _game._player._scalingVelocity = true; } }; +class Scene301 : public Scene3xx { +private: + bool _anim0ActvFl; + bool _skip1Fl; + bool _skip2Fl; + + int _lightingHotspotId; + int _sandbagHotspotId; + +public: + Scene301(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); +}; + } // End of namespace Phantom } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 1366aa2c32..60cc1f736d 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -191,8 +191,6 @@ private: */ void writeVocab(ScrCategory category, int id); - void refresh(); - void updateRect(const Common::Rect &bounds); public: MSurface _surface; @@ -304,6 +302,8 @@ public: * Synchronize the data */ void synchronize(Common::Serializer &s); + + void refresh(); }; } // End of namespace MADS |