diff options
author | Strangerke | 2014-05-09 00:32:18 +0200 |
---|---|---|
committer | Strangerke | 2014-05-09 00:32:18 +0200 |
commit | 214e051c30a6541fbd53af66edd255d304ac149c (patch) | |
tree | 93aab93a1999246ebb91256329285712975a1c91 | |
parent | 2cf67c9af2c5378510bb1c203ee2ce8f1ab69898 (diff) | |
download | scummvm-rg350-214e051c30a6541fbd53af66edd255d304ac149c.tar.gz scummvm-rg350-214e051c30a6541fbd53af66edd255d304ac149c.tar.bz2 scummvm-rg350-214e051c30a6541fbd53af66edd255d304ac149c.zip |
MADS: Implement scene 508
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 4 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes5.cpp | 259 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes5.h | 17 |
3 files changed, 278 insertions, 2 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 71489b4510..2ae5b073da 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -209,9 +209,9 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 506: // shopping street return new Scene506(vm); case 507: // inside software house - return new DummyScene(vm); // TODO + return new Scene507(vm); case 508: // laser cannon - return new DummyScene(vm); // TODO + return new Scene508(vm); case 511: // outside pleasure dome return new DummyScene(vm); // TODO case 512: // inside pleasure dome diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index f832b2e712..65498ec155 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -1461,5 +1461,264 @@ void Scene507::actions() { /*------------------------------------------------------------------------*/ +void Scene508::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x364); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x343); +} + +void Scene508::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('h', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('l', 2)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('t', 0)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('l', 3)); + + if (!_game._visitedScenes._sceneRevisited) { + _globals[kLaserOn] = false; + _chosenObject = 0; + } + + if (!_globals[kLaserOn]) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); + _scene->_hotspots.activate(0x342, false); + _scene->_hotspots.activate(0x343, false); + } else { + _scene->changeVariant(1); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); + if (_globals[kLaserHoleIsThere]) { + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); + _scene->_hotspots.activate(0x342, true); + _scene->_hotspots.activate(0x343, true); + } + _vm->_sound->command(21); + } + _vm->_sound->command(20); + + if (_scene->_priorSceneId == 515) { + _game._player._playerPos = Common::Point(57, 116); + _game._player._facing = FACING_NORTHEAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(289, 139); + _game._player._facing = FACING_WEST; + } + + sceneEntrySound(); + _game.loadQuoteSet(0x273, 0); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_COMPACT_CASE); + _game._objects.addToInventory(OBJ_REARVIEW_MIRROR); + } +} + +void Scene508::preActions() { + if (_action.isAction(0x32F, 0xF9)) + _game._player._walkOffScreenSceneId = 506; +} + +void Scene508::handlePedestral() { + if (!_globals[kLaserOn]) + _vm->_dialogs->show(50835); + + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50836); + + if (_globals[kLaserOn] && !_globals[kLaserHoleIsThere]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 1: + if (_chosenObject == 2) + _game._objects.removeFromInventory(OBJ_COMPACT_CASE, 1); + else + _game._objects.removeFromInventory(OBJ_REARVIEW_MIRROR, 1); + + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); + _scene->_hotspots.activate(0x342, true); + _scene->_hotspots.activate(0x343, true); + break; + + case 3: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[6]); + _game._player._visible = true; + _scene->_sequences.addTimer(120, 4); + break; + + case 4: + _vm->_dialogs->show(50834); + _globals[kLaserHoleIsThere] = true; + _scene->_nextSceneId = 515; + break; + + default: + break; + } + } +} + +void Scene508::actions() { + if (_action.isAction(VERB_PULL, 0x2AC)) { + if (!_globals[kLaserOn]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 2, 120, _game.getQuote(0x273)); + break; + + case 2: + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], -1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: + _vm->_sound->command(19); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[1]); + _game._player._visible = true; + _scene->_sequences.addTimer(15, 5); + break; + + case 4: + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); + break; + + case 5: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _scene->loadAnimation(formAnimName('B', 1), 6); + break; + + case 6: { + _vm->_sound->command(22); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); + _scene->_kernelMessages.reset(); + _scene->changeVariant(1); + _scene->_sequences.addTimer(30, 7); + } + break; + + case 7: + _globals[kLaserOn] = true; + _vm->_dialogs->show(50833); + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else { + _vm->_dialogs->show(50837); + } + } else if (_action.isAction(0x365, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x120, 0x344) || _action.isAction(VERB_PUT, 0x120, 0x343)) { + _chosenObject = 1; + handlePedestral(); + } else if (_action.isAction(VERB_PUT, 0x57, 0x344) || _action.isAction(VERB_PUT, 0x57, 0x343) || _action.isAction(0x365, 0x57, 0x343)) { + _chosenObject = 2; + handlePedestral(); + } else if (_action._lookFlag) + _vm->_dialogs->show(50822); + else if (_action.isAction(VERB_LOOK, 0x485)) + _vm->_dialogs->show(50810); + else if (_action.isAction(VERB_LOOK, 0x364)) + _vm->_dialogs->show(50811); + else if (_action.isAction(VERB_TAKE, 0x364)) + _vm->_dialogs->show(50812); + else if (_action.isAction(VERB_LOOK, 0x37A)) + _vm->_dialogs->show(50816); + else if (_action.isAction(VERB_TAKE, 0x37A)) + _vm->_dialogs->show(50817); + else if (_action.isAction(VERB_LOOK, 0x2AF)) + _vm->_dialogs->show(50818); + else if (_action.isAction(VERB_LOOK, 0xE2)) { + if (_globals[kLaserOn]) + _vm->_dialogs->show(50820); + else + _vm->_dialogs->show(50819); + } else if (_action.isAction(VERB_LOOK, 0x379)) { + if (_globals[kLaserOn]) + _vm->_dialogs->show(50822); + else + _vm->_dialogs->show(50821); + } else if (_action.isAction(VERB_TAKE, 0x379)) + _vm->_dialogs->show(50823); + else if (_action.isAction(VERB_LOOK, 0x2AC)) { + if (_globals[kLaserOn]) + _vm->_dialogs->show(50825); + else + _vm->_dialogs->show(50824); + } else if (_action.isAction(VERB_PUSH, 0x2AC)) + _vm->_dialogs->show(50826); + else if (_action.isAction(VERB_LOOK, 0x343)) { + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50828); + else + _vm->_dialogs->show(50827); + } else if (_action.isAction(VERB_TAKE, 0x343)) + _vm->_dialogs->show(50829); + else if (_action.isAction(VERB_LOOK, 0x46)) { + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50831); + else + _vm->_dialogs->show(50830); + } else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(50832); + else if (_action.isAction(VERB_LOOK, 0x344)) { + if (!_globals[kLaserOn]) + _vm->_dialogs->show(50813); + else if (!_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50814); + else + _vm->_dialogs->show(50815); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 369371daeb..29ec69f605 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -177,6 +177,23 @@ public: virtual void postActions() {}; }; +class Scene508: public Scene5xx{ +private: + int _chosenObject; + + void handlePedestral(); + +public: + Scene508(MADSEngine *vm) : Scene5xx(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 |