diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 4 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes5.cpp | 377 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes5.h | 20 |
3 files changed, 393 insertions, 8 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 970acb057a..08b01fe8e2 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -197,7 +197,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #5 (men's city, lower floor) case 501: // outside car - return new DummyScene(vm); // TODO + return new Scene501(vm); case 502: // inside male only teleporter return new Scene502(vm); case 503: // guard tower @@ -285,7 +285,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 805: // service panel return new DummyScene(vm); // TODO case 807: // teleporter - return new DummyScene(vm); // TODO + return new Scene807(vm); case 808: // antigrav control return new DummyScene(vm); // TODO case 810: // cutscene: Rex's ship leaving the planet diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index eb1aa42dd3..db6e6dad59 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -92,6 +92,371 @@ void Scene5xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene501::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x6E); + _scene->addActiveVocab(0x18B); +} + +void Scene501::handleSlotActions() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + int numTicks, frameIndex; + if (_globals[kSexOfRex] == REX_MALE) { + _mainSpriteId = _globals._spriteIndexes[4]; + numTicks = 8; + frameIndex = 3; + } else { + _mainSpriteId = _globals._spriteIndexes[5]; + numTicks = 10; + frameIndex = 2; + } + + _mainSequenceId = _scene->_sequences.startReverseCycle(_mainSpriteId, false, numTicks, 1, 0, 0); + _scene->_sequences.setAnimRange(_mainSequenceId, 1, frameIndex); + _scene->_sequences.setMsgLayout(_mainSequenceId); + _vm->_sound->command(10); + _scene->_sequences.addSubEntry(_mainSequenceId, SEQUENCE_TRIGGER_SPRITE, frameIndex, 1); + _scene->_sequences.addSubEntry(_mainSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 6, 0, 0); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _mainSequenceId); + _game._player._visible = true; + _scene->_sequences.addTimer(15, 3); + break; + + case 3: + _game._player.walk(Common::Point(282, 110), FACING_NORTH); + _scene->_sequences.addTimer(60, 4); + break; + + default: + break; + } +} + +void Scene501::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + + if (_globals[kSexOfRex] == REX_MALE) { + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RXCD_7"); + } else { + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*ROXRC_9"); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*ROXCD_7"); + } + + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + int idx = _scene->_dynamicHotspots.add(0x6E, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _doorHotspotid = _scene->_dynamicHotspots.setPosition(idx,Common::Point(282, 110), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _rexPunched = true; + + if (_scene->_priorSceneId == 504) { + _game._player._stepEnabled = false; + _game._player._playerPos = Common::Point(74, 121); + _game._player._facing = FACING_NORTHWEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + if (_globals[kSexOfRex] == REX_MALE) + _scene->loadAnimation(formAnimName('G', 2), 70); + else + _scene->loadAnimation(formAnimName('R', 2), 70); + } else if (_scene->_priorSceneId == 503) { + _game._player._playerPos = Common::Point(317, 102); + _game._player._facing = FACING_SOUTHWEST; + _scene->_sequences.addTimer(15, 80); + } else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(299, 131); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_FAKE_ID); + _game._objects.addToInventory(OBJ_SECURITY_CARD); + _game._objects.addToInventory(OBJ_ID_CARD); + } + + sceneEntrySound(); + _game.loadQuoteSet(0x275, 0x276, 0x277, 0); + + if (!_game._visitedScenes._sceneRevisited) + _scene->_sequences.addTimer(2, 90); +} + +void Scene501::step() { + if (_game._trigger == 90) + _vm->_dialogs->show(50127); + + if (_game._trigger >= 80) { + switch (_game._trigger) { + case 80: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 6, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _vm->_sound->command(11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: + _scene->_dynamicHotspots.remove(_doorHotspotid); + _game._player.walk(Common::Point(276, 110), FACING_SOUTHWEST); + _scene->_sequences.addTimer(120, 82); + break; + + case 82: + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _vm->_sound->command(12); + _doorHotspotid = _scene->_dynamicHotspots.add(0x6E, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_globals._sequenceIndexes[3], Common::Point(282, 110), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 83); + break; + + case 83: + _game._player._stepEnabled = true; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + break; + + default: + break; + } + } + + if (_game._trigger >= 70 && _game._trigger <= 73) { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.addTimer(15, 71); + break; + + case 71: + _game._player.walk(Common::Point(92, 130), FACING_SOUTH); + _scene->_sequences.addTimer(30, 72); + break; + + case 72: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + break; + + case 73: + _game._player._stepEnabled = true; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + break; + + default: + break; + } + } +} + +void Scene501::preActions() { + if (_action.isAction(0x1AD) && (_action.isAction(0x321) || _action.isAction(0x322))) + _game._player._walkOffScreenSceneId = 551; +} + +void Scene501::actions() { + if (_action.isAction(0x36A, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + 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], 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_sequences.addTimer(15, 2); + } + break; + + case 2: + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_MALE) + _mainSpriteId = _globals._spriteIndexes[6]; + else + _mainSpriteId = _globals._spriteIndexes[7]; + + _mainSequenceId = _scene->_sequences.addSpriteCycle(_mainSpriteId, false, 8, 1, 0, 0); + _scene->_sequences.setMsgLayout(_mainSequenceId); + _scene->_sequences.addSubEntry(_mainSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _mainSequenceId; + _mainSequenceId = _scene->_sequences.startCycle(_mainSpriteId, false, -2); + _scene->_sequences.setMsgLayout(_mainSequenceId); + _scene->_sequences.updateTimeout(_mainSequenceId, syncIdx); + _scene->_sequences.addTimer(30, 4); + } + break; + + case 4: + _scene->_nextSceneId = 504; + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUT, 0x131, 0x251)) + _vm->_dialogs->show(50113); + else if (_action.isAction(VERB_PUT, 0x305, 0x251)) { + switch (_game._trigger) { + case 0: + case 1: + case 2: + case 3: + handleSlotActions(); + break; + + case 4: + if (_globals[kSexOfRex] == REX_MALE) { + _game._player._visible = false; + _vm->_sound->command(13); + _scene->loadAnimation(formAnimName('G', 1), 5); + } else { + _rexPunched = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 6, 120, _game.getQuote(0x277)); + } + break; + + case 5: + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.addTimer(30, 6); + break; + + case 6: + if (_globals[kSexOfRex] == REX_MALE) { + if (_rexPunched) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x275)); + _rexPunched = false; + } else { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x276)); + } + } + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUT, 0xB3, 0x251)) { + switch (_game._trigger) { + case 0: + case 1: + case 2: + case 3: + handleSlotActions(); + + case 4: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _scene->_dynamicHotspots.remove(_doorHotspotid); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _vm->_sound->command(11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 6); + break; + + case 6: + _game._player.walk(Common::Point(317, 102), FACING_NORTHEAST); + _scene->_sequences.addTimer(120, 7); + break; + + case 7: { + _vm->_sound->command(12); + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _vm->_sound->command(12); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 8); + } + break; + + case 8: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 503; + } + break; + + default: + break; + } + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x31E)) + _vm->_dialogs->show(50121); + else if (_action.isAction(VERB_LOOK, 0x6E)) + _vm->_dialogs->show(50110); + else if (_action.isAction(VERB_LOOK, 0x251)) + _vm->_dialogs->show(50112); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(50114); + else if (_action.isAction(VERB_TAKE, 0x244)) + _vm->_dialogs->show(50115); + else if (_action.isAction(VERB_LOOK, 0x322)) + _vm->_dialogs->show(50118); + else if (_action.isAction(VERB_LOOK, 0x361) || _action.isAction(VERB_LOOK, 0x360) + || _action.isAction(0x1AD, 0x361) || _action.isAction(0x1AD, 0x360)) + _vm->_dialogs->show(50119); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(50120); + else if (_action.isAction(VERB_OPEN, 0x6E)) + _vm->_dialogs->show(50122); + else if (_action.isAction(VERB_LOOK, 0x1E6)) + _vm->_dialogs->show(50123); + else if (_action.isAction(VERB_OPEN, 0x1E6)) + _vm->_dialogs->show(50124); + else if (_action.isAction(VERB_LOOK, 0x369)) + _vm->_dialogs->show(50125); + else if (_action.isAction(VERB_LOOK, 0x1FA) || _action.isAction(VERB_LOOK, 0x10C)) + _vm->_dialogs->show(50126); + else if (_action.isAction(VERB_LOOK, 0x324)) { + if (!_game._visitedScenes.exists(504)) + _vm->_dialogs->show(50116); + else + _vm->_dialogs->show(50117); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene502::setup() { _game._player._spritesPrefix = ""; // The original is using Scene5xx_setAAName() @@ -132,12 +497,12 @@ void Scene502::actions() { else if (_action.isAction(VERB_LOOK, 0x1CC)) _vm->_dialogs->show(50212); else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) - || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) - || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) - || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) - || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) - || _action.isAction(VERB_LOOK, 0x1DA)) + || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) + || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) + || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) + || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) + || _action.isAction(VERB_LOOK, 0x1DA)) _vm->_dialogs->show(50213); else if (_action.isAction(VERB_LOOK, 0x1CF) || _action._lookFlag) _vm->_dialogs->show(50214); diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 562cfdfd76..e46207c09a 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -50,6 +50,26 @@ public: Scene5xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene501: public Scene5xx{ +private: + int _mainSequenceId; + int _mainSpriteId; + int _doorHotspotid; + bool _rexPunched; + + void handleSlotActions(); + +public: + Scene501(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene502: public SceneTeleporter { public: Scene502(MADSEngine *vm) : SceneTeleporter(vm) {} |