From d449751c399c47ab971a1d9dfae5e9281e90a447 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Nov 2015 19:26:59 +0100 Subject: MADS: Phantom: Implement scene 409 --- engines/mads/phantom/phantom_scenes.cpp | 2 +- engines/mads/phantom/phantom_scenes4.cpp | 612 +++++++++++++++++++++++++++++++ engines/mads/phantom/phantom_scenes4.h | 22 ++ 3 files changed, 635 insertions(+), 1 deletion(-) diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp index 13c5a417f8..f6007c239e 100644 --- a/engines/mads/phantom/phantom_scenes.cpp +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -132,7 +132,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 408: // catacomb corridor return new Scene408(vm); case 409: // catacomb room, door with switch panel - return new DummyScene(vm); // TODO + return new Scene409(vm); case 410: // skull switch panel return new DummyScene(vm); // TODO case 453: // Labyrinth room (big), 4 exits + 1 bricked door, right diff --git a/engines/mads/phantom/phantom_scenes4.cpp b/engines/mads/phantom/phantom_scenes4.cpp index 2157e11502..f76e3e117b 100644 --- a/engines/mads/phantom/phantom_scenes4.cpp +++ b/engines/mads/phantom/phantom_scenes4.cpp @@ -2893,5 +2893,617 @@ void Scene408::preActions() { /*------------------------------------------------------------------------*/ +Scene409::Scene409(MADSEngine *vm) : Scene4xx(vm) { + _frameInRoomFl = false; + _takingFrameInRoomFl = false; + + _redFrameHotspotId = -1; + _greenFrameHotspotId = -1; + _blueFrameHotspotId = -1; + _yellowFrameHotspotId = -1; +} + +void Scene409::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_frameInRoomFl); + s.syncAsByte(_takingFrameInRoomFl); + + s.syncAsSint16LE(_redFrameHotspotId); + s.syncAsSint16LE(_greenFrameHotspotId); + s.syncAsSint16LE(_blueFrameHotspotId); + s.syncAsSint16LE(_yellowFrameHotspotId); +} + +void Scene409::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(NOUN_RED_FRAME); + _scene->addActiveVocab(NOUN_YELLOW_FRAME); + _scene->addActiveVocab(NOUN_BLUE_FRAME); + _scene->addActiveVocab(NOUN_GREEN_FRAME); +} + +void Scene409::enter() { + _game.initCatacombs(); + + _scene->loadSpeech(3); + _scene->_hotspots.activate(NOUN_SWORD, false); + + _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RDR_9", false); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RRD_9", false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0), false); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 1), false); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 2), false); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', 3), false); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 0), false); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 0), false); + + if (_game._objects.isInRoom(OBJ_SWORD)) { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', 0), false); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RRD_9", false); + _globals._sequenceIndexes[1] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14); + _scene->_hotspots.activate(NOUN_SWORD, true); + } + + + if (!_globals[kDoorIn409IsOpen]) { + _globals._sequenceIndexes[6] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14); + _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, false); + } else + _scene->_hotspots.activate(NOUN_DOOR, false); +0 + if (_scene->_priorSceneId == 410) { + _game._player._facing = FACING_NORTH; + _game._player._playerPos = Common::Point(229, 106); + + if (_globals[kFlickedLever1] && _globals[kFlickedLever2] && _globals[kFlickedLever3] && _globals[kFlickedLever4]) { + if ((_globals[kFlickedLever1] == 5) && (_globals[kFlickedLever2] == 18) && (_globals[kFlickedLever3] == 9) && (_globals[kFlickedLever4] == 11)) { + if (!_globals[kDoorIn409IsOpen]) { + _globals[kPlayerScore] += 5; + _vm->_sound->command(24); + _scene->deleteSequence(_globals._sequenceIndexes[6]); + _game._player._stepEnabled = false; + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -1, -2); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[6], 0, 0, 65); + } + } else { + _globals[kFlickedLever1] = 0; + _globals[kFlickedLever2] = 0; + _globals[kFlickedLever3] = 0; + _globals[kFlickedLever4] = 0; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], -1, -2); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[7], 2, 15, 60); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[7], 0, 0, 61); + _vm->_sound->command(68); + } + } else { + _globals[kFlickedLever1] = 0; + _globals[kFlickedLever2] = 0; + _globals[kFlickedLever3] = 0; + _globals[kFlickedLever4] = 0; + } + } else if (_scene->_priorSceneId != RETURNING_FROM_LOADING) { + switch (_globals[kCatacombsFrom]) { + case 0: + _game._player._playerPos = Common::Point(195, 92); + _game._player._facing = FACING_SOUTH; + _game._player.walk(Common::Point(195, 107), FACING_SOUTH); + break; + + case 2: + _game._player._playerPos = Common::Point(184, 45); + _game._player._facing = FACING_NORTH; + break; + + default: + break; + } + } + + if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + sceneEntrySound(); +} + +void Scene409::step() { + if (_game._trigger == 60) { + _game._player._visible = false; + _game.syncTimers(2, 0, 1, _globals._sequenceIndexes[7]); + _scene->playSpeech(3); + } + + if (_game._trigger == 61) { + _globals._sequenceIndexes[7] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[7], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); + _scene->_sequences.setTimingTrigger(60, 62); + _vm->_sound->command(27); + } + + if (_game._trigger == 62) + _scene->_reloadSceneFlag = true; + + if (_game._trigger == 65) { + _game._player._stepEnabled = true; + _globals[kDoorIn409IsOpen] = true; + _scene->_hotspots.activate(NOUN_DOOR, false); + _scene->_hotspots.activate(NOUN_ARCHWAY_TO_NORTH, true); + } +} + +void Scene409::actions() { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) || _action.isAction(VERB_OPEN, NOUN_DOOR)) { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 5, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 4); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], true); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[8], 0, 0, 1); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[8], 2, 4, 4); + _action._inProgress = false; + return; + + case 1: { + int syncIdx = _globals._sequenceIndexes[8]; + _globals._sequenceIndexes[8] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[8], false, 4); + _game.syncTimers(1, _globals._sequenceIndexes[8], 1, syncIdx); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], false); + _scene->_sequences.setTimingTrigger(30, 2); + _action._inProgress = false; + } + return; + + case 2: + _scene->deleteSequence(_globals._sequenceIndexes[8]); + _globals._sequenceIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 5, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 4); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[8], false); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[8], 0, 0, 3); + _action._inProgress = false; + return; + + case 3: + _game.syncTimers(2, 0, 1, _globals._sequenceIndexes[8]); + _game._player._visible = true; + _vm->_dialogs->show(40923); + _game._player._stepEnabled = true; + _action._inProgress = false; + return; + + case 4: + _vm->_sound->command(70); + _action._inProgress = false; + return; + + default: + break; + } + } + + if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR)) { + if (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME)) { + if (_frameInRoomFl) { + _vm->_dialogs->show(29); + } else { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 2, 5, 1); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 2); + break; + + case 1: + if (_action.isObject(NOUN_RED_FRAME)) { + _game._objects.setRoom(OBJ_RED_FRAME, NOWHERE); + _game._objects[OBJ_RED_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600; + _globals._sequenceIndexes[2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _redFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_RED_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_redFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + if (_action.isObject(NOUN_GREEN_FRAME)) { + _game._objects.setRoom(OBJ_GREEN_FRAME, NOWHERE); + _game._objects[OBJ_GREEN_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600; + _globals._sequenceIndexes[3] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _greenFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_GREEN_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_greenFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + if (_action.isObject(NOUN_BLUE_FRAME)) { + _game._objects.setRoom(OBJ_BLUE_FRAME, NOWHERE); + _game._objects[OBJ_BLUE_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600; + _globals._sequenceIndexes[4] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _blueFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_BLUE_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_blueFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + + if (_action.isObject(NOUN_YELLOW_FRAME)) { + _game._objects.setRoom(OBJ_YELLOW_FRAME, NOWHERE); + _game._objects[OBJ_YELLOW_FRAME]._roomNumber = _globals[kCatacombsRoom] + 600; + _globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14); + + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _yellowFrameHotspotId = _scene->_dynamicHotspots.add(NOUN_YELLOW_FRAME, VERB_WALK_TO, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(pos.x - 5, pos.y - 5, pos.x + 5, pos.y + 1)); + _scene->_dynamicHotspots.setPosition(_yellowFrameHotspotId, Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + break; + + case 2: + _game.syncTimers(2, 0, 1, _globals._sequenceIndexes[0]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_TAKE)) { + if ((_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_GREEN_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME)) + && (_takingFrameInRoomFl || _game._trigger)) { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 2, 5, 1); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 2); + break; + + case 1: + if (_action.isObject(NOUN_RED_FRAME)) { + _scene->deleteSequence(_globals._sequenceIndexes[2]); + _scene->_dynamicHotspots.remove(_redFrameHotspotId); + _game._objects.addToInventory(OBJ_RED_FRAME); + } + + if (_action.isObject(NOUN_GREEN_FRAME)) { + _scene->deleteSequence(_globals._sequenceIndexes[3]); + _scene->_dynamicHotspots.remove(_greenFrameHotspotId); + _game._objects.addToInventory(OBJ_GREEN_FRAME); + } + + if (_action.isObject(NOUN_BLUE_FRAME)) { + _scene->deleteSequence(_globals._sequenceIndexes[4]); + _scene->_dynamicHotspots.remove(_blueFrameHotspotId); + _game._objects.addToInventory(OBJ_BLUE_FRAME); + } + + if (_action.isObject(NOUN_YELLOW_FRAME)) { + _scene->deleteSequence(_globals._sequenceIndexes[5]); + _scene->_dynamicHotspots.remove(_yellowFrameHotspotId); + _game._objects.addToInventory(OBJ_YELLOW_FRAME); + } + + _vm->_sound->command(26); + break; + + case 2: + _game.syncTimers(2, 0, 1, _globals._sequenceIndexes[0]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_WALK_THROUGH, NOUN_ARCHWAY_TO_NORTH)) { + _game.enterCatacombs(true); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_EXIT_TO, NOUN_MORE_CATACOMBS)) { + _game.enterCatacombs(false); + _action._inProgress = false; + return; + } + + if (_action._lookFlag) { + _vm->_dialogs->show(40910); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, NOUN_SWORD) && (_game._objects.isInRoom(OBJ_SWORD) || _game._trigger)) { + switch (_game._trigger) { + case (0): + _globals[kPlayerScore] += 5; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[0] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[0], true, 5, 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 2, 5, 1); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 2); + break; + + case 1: + _scene->deleteSequence(_globals._sequenceIndexes[1]); + _scene->_hotspots.activate(NOUN_SWORD, false); + _game._objects.addToInventory(OBJ_SWORD); + _vm->_sound->command(26); + break; + + case 2: + _game.syncTimers(2, 0, 1, _globals._sequenceIndexes[0]); + _game._player._visible = true; + _scene->_sequences.setTimingTrigger(20, 3); + break; + + case 3: + _vm->_dialogs->showItem(OBJ_SWORD, 808, 0); + _game._player._stepEnabled = true; + break; + + default: + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) { + if (_action.isObject(NOUN_WALL)) { + _vm->_dialogs->show(40911); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_FLOOR)) { + _vm->_dialogs->show(40912); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_ARCHWAY)) { + _vm->_dialogs->show(40913); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_EXPOSED_BRICK)) { + _vm->_dialogs->show(40914); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_MORE_CATACOMBS)) { + _vm->_dialogs->show(40915); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_BLOCKED_ARCHWAY)) { + _vm->_dialogs->show(40916); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_GRATE)) { + _vm->_dialogs->show(40917); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_UNLUCKY_ADVENTURER)) { + _vm->_dialogs->show(40920); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_RED_FRAME) && !_game._objects.isInInventory(OBJ_RED_FRAME)) { + _vm->_dialogs->showItem(OBJ_RED_FRAME, 802, 0); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_GREEN_FRAME) && !_game._objects.isInInventory(OBJ_GREEN_FRAME)) { + _vm->_dialogs->showItem(OBJ_GREEN_FRAME, 819, 0); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_BLUE_FRAME) && !_game._objects.isInInventory(OBJ_BLUE_FRAME)) { + _vm->_dialogs->showItem(OBJ_BLUE_FRAME, 817, 0); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_YELLOW_FRAME) && !_game._objects.isInInventory(OBJ_YELLOW_FRAME)) { + _vm->_dialogs->showItem(OBJ_YELLOW_FRAME, 804, 0); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_SWORD) && _game._objects.isInRoom(OBJ_SWORD)) { + _vm->_dialogs->show(40921); + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_LOOK, NOUN_SWITCH_PANEL)) { + _vm->_dialogs->show(40919); + _scene->_nextSceneId = 410; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALK_TO, NOUN_SWITCH_PANEL)) { + _scene->_nextSceneId = 410; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, NOUN_GRATE) || _action.isAction(VERB_PUSH, NOUN_GRATE) || _action.isAction(VERB_PULL, NOUN_GRATE)) { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 5, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 2); + break; + + case 2: + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -2); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], true); + _scene->_sequences.setTimingTrigger(30, 3); + break; + + case 3: + _scene->deleteSequence(_globals._sequenceIndexes[0]); + _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 5, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -1, -2); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[0], false); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 4); + break; + + case 4: + _game._player._visible = true; + _game.syncTimers(2, 0, 1, _globals._sequenceIndexes[0]); + _scene->_sequences.setTimingTrigger(6, 5); + break; + + case 5: + _game._player._stepEnabled = true; + _vm->_dialogs->show(40918); + break; + + default: + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TALK_TO, NOUN_UNLUCKY_ADVENTURER)) { + _vm->_dialogs->show(40924); + _action._inProgress = false; + } +} + +void Scene409::preActions() { + _frameInRoomFl = false; + _takingFrameInRoomFl = false; + + if (_game._objects[OBJ_RED_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _frameInRoomFl = true; + if (_action.isAction(VERB_TAKE, NOUN_RED_FRAME)) + _takingFrameInRoomFl = true; + } + + if (_game._objects[OBJ_YELLOW_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _frameInRoomFl = true; + if (_action.isAction(VERB_TAKE, NOUN_YELLOW_FRAME)) + _takingFrameInRoomFl = true; + } + + if (_game._objects[OBJ_BLUE_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _frameInRoomFl = true; + if (_action.isAction(VERB_TAKE, NOUN_BLUE_FRAME)) + _takingFrameInRoomFl = true; + } + + if (_game._objects[OBJ_GREEN_FRAME]._roomNumber == _globals[kCatacombsRoom] + 600) { + _frameInRoomFl = true; + if (_action.isAction(VERB_TAKE, NOUN_GREEN_FRAME)) + _takingFrameInRoomFl = true; + } + + if (_action.isAction(VERB_PUT) && _action.isTarget(NOUN_FLOOR) + && (_action.isObject(NOUN_RED_FRAME) || _action.isObject(NOUN_BLUE_FRAME) || _action.isObject(NOUN_YELLOW_FRAME) || _action.isObject(NOUN_GREEN_FRAME))) { + if (_frameInRoomFl) + _game._player._needToWalk = false; + else { + Common::Point pos = _scene->_sprites[_globals._spriteIndexes[2]]->getFramePos(0); + _game._player.walk(Common::Point(pos.x + 12, pos.y), FACING_NORTHWEST); + } + } + + if (_action.isAction(VERB_LOOK, NOUN_SWITCH_PANEL)) + _game._player.walk(Common::Point(229, 106), FACING_NORTH); + + if (_action.isAction(VERB_OPEN, NOUN_DOOR)) + _game._player.walk(Common::Point(191, 104), FACING_NORTHEAST); + + if (_action.isAction(VERB_OPEN, NOUN_GRATE)) + _game._player._needToWalk = true; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Phantom } // End of namespace MADS diff --git a/engines/mads/phantom/phantom_scenes4.h b/engines/mads/phantom/phantom_scenes4.h index b20585c02e..0de833fc69 100644 --- a/engines/mads/phantom/phantom_scenes4.h +++ b/engines/mads/phantom/phantom_scenes4.h @@ -180,6 +180,28 @@ public: virtual void preActions(); virtual void actions(); }; + +class Scene409 : public Scene4xx { +private: + bool _frameInRoomFl; + bool _takingFrameInRoomFl; + + int _redFrameHotspotId; + int _greenFrameHotspotId; + int _blueFrameHotspotId; + int _yellowFrameHotspotId; + +public: + Scene409(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 -- cgit v1.2.3