diff options
-rw-r--r-- | engines/mads/game.h | 2 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes.cpp | 2 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes2.cpp | 920 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes2.h | 32 |
4 files changed, 955 insertions, 1 deletions
diff --git a/engines/mads/game.h b/engines/mads/game.h index c5dfcbbc5a..bdc7fc9d7a 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -240,8 +240,10 @@ public: typedef struct { //TODO + bool _panFrame; } Camera; Camera _camX, _camY; + void camPanTo(Camera *camera, int target); }; diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp index a9ae84e06f..222efb4274 100644 --- a/engines/mads/phantom/phantom_scenes.cpp +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -78,7 +78,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 201: // entrance / ticket office return new Scene201(vm); case 202: // outside offices / paintings room - return new DummyScene(vm); // TODO + return new Scene202(vm); case 203: // office return new DummyScene(vm); // TODO case 204: // library diff --git a/engines/mads/phantom/phantom_scenes2.cpp b/engines/mads/phantom/phantom_scenes2.cpp index eac175c166..aafcc9a165 100644 --- a/engines/mads/phantom/phantom_scenes2.cpp +++ b/engines/mads/phantom/phantom_scenes2.cpp @@ -573,5 +573,925 @@ void Scene201::handleConversation() { /*------------------------------------------------------------------------*/ +Scene202::Scene202(MADSEngine *vm) : Scene2xx(vm) { + _ticketGivenFl = false; + _anim0ActvFl = false; + _anim1ActvFl = false; + _skipWalkFl = false; + + for (int i = 0; i < 5; i++) { + _chandeliersPosX[i] = -1; + _chandeliersHotspotId[i] = -1; + } + + _conversationCount = -1; + _usherStatus = -1; + _usherFrame = -1; + _usherCount = -1; + _degasStatus = -1; + _degasFrame = -1; +} + +void Scene202::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + + s.syncAsByte(_ticketGivenFl); + s.syncAsByte(_anim0ActvFl); + s.syncAsByte(_anim1ActvFl); + s.syncAsByte(_skipWalkFl); + + for (int i = 0; i < 5; i++) { + s.syncAsSint16LE(_chandeliersPosX[i]); + s.syncAsSint16LE(_chandeliersHotspotId[i]); + } + + s.syncAsSint16LE(_conversationCount); + s.syncAsSint16LE(_usherStatus); + s.syncAsSint16LE(_usherFrame); + s.syncAsSint16LE(_usherCount); + s.syncAsSint16LE(_degasStatus); + s.syncAsSint16LE(_degasFrame); +} + +void Scene202::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + if (_globals[kTicketPeoplePresent] == 2) + _scene->_initialVariant = 1; + + _scene->addActiveVocab(NOUN_CHANDELIER); + _scene->addActiveVocab(NOUN_EDGAR_DEGAS); +} + +void Scene202::enter() { + _vm->_disableFastwalk = true; + _ticketGivenFl = false; + _chandeliersPosX[0] = 77; + _chandeliersPosX[1] = 192; + _chandeliersPosX[2] = 319; + _chandeliersPosX[3] = 445; + _chandeliersPosX[4] = 560; + + if (_globals[kTicketPeoplePresent] == 2) + _globals[kMakeRichLeave203] = true; + + if ((_globals[kDegasNameIsKnown]) || (_globals[kCurrentYear] == 1993)) + _scene->_hotspots.activate(NOUN_GENTLEMAN, false); + + for (int i = 0; i < 5; i++) { + _globals._sequenceIndexes[2 + i] = -1; + _chandeliersHotspotId[i] = -1; + } + + if (_scene->_priorSceneId != RETURNING_FROM_LOADING) { + _anim0ActvFl = false; + _anim1ActvFl = false; + _skipWalkFl = false; + } + + _conversationCount = 0; + _vm->_gameConv->get(17); + _vm->_gameConv->get(9); + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RDR_9", false); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0), false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('f', 0), false); + + if (_globals[kTicketPeoplePresent] == 2) { + _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('b', 0), 0); + _anim0ActvFl = true; + _usherStatus = 2; + } else + _scene->_hotspots.activate(NOUN_USHER, false); + + if (_globals[kDegasNameIsKnown]) + _anim1ActvFl = false; + + if ((_globals[kCurrentYear] == 1881) && (!_globals[kDegasNameIsKnown])) { + _globals._animationIndexes[1] = _scene->loadAnimation(formAnimName('d', 1), 100); + _anim1ActvFl = true; + _degasStatus = 4; + } + + if (_vm->_gameConv->_restoreRunning == 17) { + _vm->_gameConv->run(17); + _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET)); + _vm->_gameConv->exportValue(0); + _game._player._playerPos = Common::Point(569, 147); + _game._player._facing = FACING_NORTHEAST; + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + } + + if (_vm->_gameConv->_restoreRunning == 9) { + _vm->_gameConv->run(9); + _vm->_gameConv->exportPointer(&_globals[kPlayerScore]); + _game._player._playerPos = Common::Point(400, 141); + _game._player._facing = FACING_NORTHWEST; + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + } + + if (_scene->_priorSceneId == 201) { + _game._player._playerPos = Common::Point(3, 141); + _game._player.walk(Common::Point(40, 141), FACING_EAST); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } else if (_scene->_priorSceneId == 203) { + _game._player._playerPos = Common::Point(134, 112); + _game._player._facing = FACING_SOUTH; + _game._player._stepEnabled = false; + _game._player.walk(Common::Point(126, 123), FACING_SOUTH); + _game._player.setWalkTrigger(60); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } else if (_scene->_priorSceneId == 204) { + _game._player._playerPos = Common::Point(253, 117); + _game._player.walk(Common::Point(255, 133), FACING_SOUTH); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + _scene->setCamera(Common::Point(70, 0)); + } else if (_scene->_priorSceneId == 205) { + _game._player._playerPos = Common::Point(510, 117); + _game._player.walk(Common::Point(512, 133), FACING_SOUTH); + _scene->setCamera(Common::Point(320, 0)); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } else if ((_scene->_priorSceneId == 101) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) { + _game._player._playerPos = Common::Point(636, 143); + _game._player.walk(Common::Point(598, 143), FACING_WEST); + _scene->setCamera(Common::Point(320, 0)); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } else if (_scene->_priorSceneId == RETURNING_FROM_LOADING) { + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } + + handleChandeliersPositions(); + sceneEntrySound(); +} + +void Scene202::step() { + if (_game._camX._panFrame) + handleChandeliersPositions(); + + if (_anim0ActvFl) + handleUsherAnimation(); + + if (_game._trigger == 100) + _anim1ActvFl = false; + + if (_anim1ActvFl) + handleDegasAnimation(); + + if ((_globals[kCurrentYear] == 1881) && !_globals[kDegasNameIsKnown] && (_game._player._playerPos.x < 405) && !_skipWalkFl) { + _game._player.walk(Common::Point(400, 141), FACING_NORTHWEST); + _game._player.setWalkTrigger(90); + _game._player._stepEnabled = false; + _skipWalkFl = true; + } + + if (_game._trigger == 90) { + _game._player._stepEnabled = true; + _vm->_gameConv->run(9); + _vm->_gameConv->exportPointer(&_globals[kPlayerScore]); + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + } + + switch (_game._trigger) { + case 60: + _scene->deleteSequence(_globals._sequenceIndexes[0]); + _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 61); + break; + + case 61: + _vm->_sound->command(25); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + _game._player._stepEnabled = true; + break; + + default: + break; + } + + if ((_globals[kWalkerConverse] == 2) || (_globals[kWalkerConverse] == 3)) { + ++_conversationCount; + if (_conversationCount > 200) + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + } +} + +void Scene202::actions() { + if (_vm->_gameConv->_running == 17) { + handleConversation1(); + _action._inProgress = false; + return; + } + + if (_vm->_gameConv->_running == 9) { + handleConversation2(); + _action._inProgress = false; + return; + } + + if ((_globals[kTicketPeoplePresent] == 2) && (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_ARCHWAY) || _action.isAction(VERB_TALK_TO, NOUN_USHER))) { + _vm->_gameConv->run(17); + _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET)); + _vm->_gameConv->exportValue(0); + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_GIVE, NOUN_TICKET, NOUN_USHER)) { + _ticketGivenFl = true; + _vm->_gameConv->run(17); + _vm->_gameConv->exportValue(_game._objects.isInInventory(OBJ_TICKET)); + _vm->_gameConv->exportValue(1); + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_TALK_TO, NOUN_GENTLEMAN)) || (_action.isAction(VERB_TALK_TO, NOUN_EDGAR_DEGAS))) { + if (!_globals[kDegasNameIsKnown] ) { + _vm->_gameConv->run(9); + _vm->_gameConv->exportPointer(&_globals[kPlayerScore]); + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + } else + _vm->_dialogs->show(20224); + + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_DOOR) || _action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)) { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[1] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[1], false, 5, 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 4); + _scene->_sequences.setSeqPlayer(_globals._sequenceIndexes[1], true); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[1], 2, 4, 80); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[1], 0, 0, 82); + break; + + case 80: + _scene->deleteSequence(_globals._sequenceIndexes[0]); + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 81); + _vm->_sound->command(24); + break; + + case 81: { + int idx = _globals._sequenceIndexes[0]; + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5); + _game.syncTimers(1, _globals._sequenceIndexes[0], 1, idx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + _game._player.walk(Common::Point(134, 112), FACING_NORTH); + _game._player.setWalkTrigger(83); + } + break; + + case 82: + _game._player._visible = true; + break; + + case 83: + _scene->deleteSequence(_globals._sequenceIndexes[0]); + _globals._sequenceIndexes[0] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[0], false, 8, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 1, 5); + _scene->_sequences.setTrigger(_globals._sequenceIndexes[0], 0, 0, 84); + _vm->_sound->command(25); + break; + + case 84: + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1); + _scene->_nextSceneId = 203; + break; + + default: + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALK_THROUGH, NOUN_LEFT_ARCHWAY)) { + _scene->_nextSceneId = 201; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_ARCHWAY)) { + _scene->_nextSceneId = 101; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALK_THROUGH, NOUN_MIDDLE_DOOR)) { + _scene->_nextSceneId = 204; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR)) { + _scene->_nextSceneId = 205; + _action._inProgress = false; + return; + } + + if (_action._lookFlag) { + _vm->_dialogs->show(20210); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) { + if (_action.isObject(NOUN_FLOOR)) { + _vm->_dialogs->show(20211); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_WALL)) { + _vm->_dialogs->show(20212); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_LEFT_ARCHWAY)) { + _vm->_dialogs->show(20213); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_RIGHT_ARCHWAY)) { + _vm->_dialogs->show(20214); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_LEFT_DOOR)) { + _vm->_dialogs->show(20215); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_MIDDLE_DOOR)) { + _vm->_dialogs->show(20216); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_RIGHT_DOOR)) { + _vm->_dialogs->show(20217); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_LIGHT_FIXTURE)) { + _vm->_dialogs->show(20218); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_OVERDOOR_MEDALLION)) { + _vm->_dialogs->show(20219); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_DECORATIVE_MOLDING)) { + _vm->_dialogs->show(20220); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_PAINTING)) { + _vm->_dialogs->show(20221); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_EDGAR_DEGAS) || _action.isObject(NOUN_GENTLEMAN)) { + _vm->_dialogs->show(20223); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_USHER)) { + _vm->_dialogs->show(20225); + _action._inProgress = false; + return; + } + + if (_action.isObject(NOUN_CHANDELIER)) { + _vm->_dialogs->show(20218); + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_TAKE) && (_action.isObject(NOUN_GENTLEMAN) || _action.isObject(NOUN_EDGAR_DEGAS))) { + _vm->_dialogs->show(20226); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, NOUN_USHER)) { + _vm->_dialogs->show(20227); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_CLOSE, NOUN_DOOR)) { + _vm->_dialogs->show(20222); + _action._inProgress = false; + return; + } +} + +void Scene202::preActions() { + if (_action.isAction(VERB_OPEN, NOUN_LEFT_DOOR)) + _game._player.walk(Common::Point(126, 123), FACING_NORTHEAST); + + if ((_globals[kTicketPeoplePresent] == 2) && (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_ARCHWAY))) + _game._player.walk(Common::Point(569, 147), FACING_NORTHEAST); + + if (_action.isAction(VERB_TAKE, NOUN_GENTLEMAN) || _action.isAction(VERB_TAKE, NOUN_EDGAR_DEGAS)) + _game._player._needToWalk = false; +} + +void Scene202::handleConversation1() { + int interlocutorFl = false; + int heroFl = false; + + switch (_action._activeAction._verbId) { + case 0: + if (!_ticketGivenFl) + _usherStatus = 4; + + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + interlocutorFl = true; + heroFl = true; + break; + + case 3: + _vm->_gameConv->setInterlocutorTrigger(72); + _vm->_gameConv->setHeroTrigger(76); + interlocutorFl = true; + heroFl = true; + break; + + case 4: + _vm->_gameConv->setHeroTrigger(76); + heroFl = true; + interlocutorFl = true; + break; + + default: + break; + } + + switch (_game._trigger) { + case 70: + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + _usherStatus = 0; + break; + + case 72: + _usherStatus = 17; + break; + + case 74: + _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3); + _usherStatus = 2; + _conversationCount = 0; + break; + + case 76: + _globals[kWalkerConverse] = 0; + _ticketGivenFl = false; + heroFl = true; + interlocutorFl = true; + break; + + default: + break; + } + + if (!heroFl) + _vm->_gameConv->setHeroTrigger(74); + + if (!interlocutorFl) + _vm->_gameConv->setInterlocutorTrigger(70); + + _usherCount = 0; +} + +void Scene202::handleConversation2() { + int interlocutorFl = false; + int heroFl = false; + + switch (_action._activeAction._verbId) { + case 1: + _globals[kDegasNameIsKnown] = 1; + break; + + case 10: + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + _vm->_gameConv->setHeroTrigger(96); + interlocutorFl = true; + heroFl = true; + break; + + default: + break; + } + + switch (_game._trigger) { + case 74: + _globals[kWalkerConverse] = _vm->getRandomNumber(2, 3); + _degasStatus = 4; + _conversationCount = 0; + break; + + case 93: + _globals[kWalkerConverse] = _vm->getRandomNumber(1, 4); + switch (_action._activeAction._verbId) { + case 1: + _degasStatus = 1; + break; + + case 2: + _degasStatus = 2; + break; + + default: + if ((_action._activeAction._verbId != 11) && (_action._activeAction._verbId != 12)) + _degasStatus = 0; + break; + } + break; + + case 96: + _vm->_gameConv->setInterlocutorTrigger(97); + interlocutorFl = true; + heroFl = true; + break; + + case 97: + _vm->_gameConv->setHeroTrigger(98); + _degasStatus = 0; + interlocutorFl = true; + heroFl = true; + break; + + case 98: + _globals[kWalkerConverse] = 0; + _degasStatus = 3; + + if (_globals[kDegasNameIsKnown] == 1) { + int idx = _scene->_dynamicHotspots.add(NOUN_EDGAR_DEGAS, VERB_WALK_TO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON; + _scene->_dynamicHotspots.setPosition(idx, Common::Point(596, 144), FACING_EAST); + _scene->setDynamicAnim(idx, _globals._animationIndexes[1], 1); + } else { + int idx = _scene->_dynamicHotspots.add(NOUN_GENTLEMAN, VERB_WALK_TO, SYNTAX_SINGULAR_MASC, EXT_NONE, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON; + _scene->_dynamicHotspots.setPosition(idx, Common::Point(596, 144), FACING_EAST); + _scene->setDynamicAnim(idx, _globals._animationIndexes[1], 1); + } + + _globals[kDegasNameIsKnown] = 2; + interlocutorFl = true; + heroFl = true; + _scene->_hotspots.activate(NOUN_GENTLEMAN, false); + _game._player._stepEnabled = false; + _vm->_gameConv->hold(); + break; + + default: + break; + } + + if (!heroFl) + _vm->_gameConv->setHeroTrigger(74); + + if (!interlocutorFl) + _vm->_gameConv->setInterlocutorTrigger(93); +} + +void Scene202::handleChandeliersPositions() { + int center = _scene->_posAdjust.x + 160; + + for (int chandelier = 0; chandelier < 5; chandelier++) { + if (_globals._sequenceIndexes[chandelier + 2] >= 0) + _scene->deleteSequence(_globals._sequenceIndexes[chandelier + 2]); + + int diff = center - _chandeliersPosX[chandelier]; + int dir = 0; + + if (diff < 0) + dir = 1; + else if (diff > 0) + dir = -1; + + int shiftBase = (int)(abs(diff) / 5); + if (dir < 0) + shiftBase = -shiftBase; + + int posX = _chandeliersPosX[chandelier] + shiftBase - 1; + int posY = _scene->_sprites[_globals._spriteIndexes[2]]->getFrameHeight(0) - 1; + int frameWidth = _scene->_sprites[_globals._spriteIndexes[2]]->getFrameWidth(0); + + if (((posX - ((frameWidth >> 1) + 1)) >= (_scene->_posAdjust.x + 320)) || ((posX + ((frameWidth >> 1) + 1)) < _scene->_posAdjust.x)) + _globals._sequenceIndexes[chandelier + 2] = -1; + else { + if (_chandeliersHotspotId[chandelier] != -1) + _scene->_dynamicHotspots.remove(_chandeliersHotspotId[chandelier]); + + _chandeliersHotspotId[chandelier] = _scene->_dynamicHotspots.add(NOUN_CHANDELIER, VERB_LOOK_AT, SYNTAX_SINGULAR, EXT_NONE, Common::Rect(posX - 8, posY - 12, posX + 8, posY + 1)); + + _globals._sequenceIndexes[chandelier + 2] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setPosition(_globals._sequenceIndexes[chandelier + 2], Common::Point(posX, posY)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[chandelier + 2], 1); + } + } +} + +void Scene202::handleUsherAnimation() { + if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _usherFrame) + return; + + _usherFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame(); + int resetFrame = -1; + int random; + switch (_usherFrame) { + case 1: + case 13: + case 35: + case 51: + case 52: + case 53: + case 54: + switch (_usherStatus) { + case 0: + random = _vm->getRandomNumber(1, 3); + ++_usherCount; + if (_usherCount > 15) { + if (_action._activeAction._verbId == 0) { + _usherStatus = 3; + random = 5; + } else { + _usherStatus = 2; + random = 7; + } + } + break; + + case 3: + random = 5; + break; + + case 4: + random = 6; + break; + + case 17: + random = 4; + break; + + default: + random = 7; + break; + } + + switch (random) { + case 1: + resetFrame = 51; + break; + + case 2: + resetFrame = 52; + break; + + case 3: + resetFrame = 53; + break; + + case 4: + resetFrame = 21; + _usherStatus = 17; + break; + + case 5: + resetFrame = 1; + break; + + case 6: + resetFrame = 35; + _usherStatus = 0; + break; + + default: + resetFrame = 0; + break; + } + break; + + case 7: + if (_usherStatus == 3) + random = 1; + else + random = 2; + + if (random == 1) + resetFrame = 6; + else + resetFrame = 7; + + break; + + case 28: + if (_usherStatus == 17) { + random = 1; + ++_usherCount; + if (_usherCount > 15) { + _usherStatus = 2; + random = 2; + } + } else + random = 2; + + if (random == 1) + resetFrame = 27; + else + resetFrame = 28; + break; + } + + if (resetFrame >= 0) { + _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame); + _usherFrame = resetFrame; + } +} + + +void Scene202::handleDegasAnimation() { + if (_scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame() == _degasFrame) + return; + + _degasFrame = _scene->_animation[_globals._animationIndexes[1]]->getCurrentFrame(); + int resetFrame = -1; + int random; + + switch (_degasFrame) { + case 1: + case 17: + case 58: + switch (_degasStatus) { + case 0: + _degasStatus = 4; + random = 1; + break; + + case 1: + case 2: + case 3: + random = 2; + break; + + default: + random = _vm->getRandomNumber(3, 50); + break; + } + + switch (random) { + case 1: + resetFrame = 1; + break; + + case 2: + resetFrame = 58; + break; + + case 3: + resetFrame = 58; + break; + + default: + resetFrame = 0; + break; + } + break; + + case 33: + case 40: + case 55: + case 62: + switch (_degasStatus) { + case 0: + _degasStatus = 4; + random = 1; + break; + + case 1: + _degasStatus = 4; + random = 2; + break; + + case 2: + _degasStatus = 4; + random = 3; + break; + + case 3: + random = 4; + break; + + default: + random = _vm->getRandomNumber(5, 50); + break; + } + + switch (random) { + case 1: + resetFrame = 33; + break; + + case 2: + resetFrame = 17; + break; + + case 3: + resetFrame = 42; + break; + + case 4: + resetFrame = 62; + break; + + case 5: + resetFrame = 41; + break; + + case 6: + resetFrame = 55; + break; + + default: + resetFrame = 39; + break; + } + break; + + case 42: + switch (_degasStatus) { + case 0: + case 1: + case 2: + case 3: + random = 1; + break; + + default: + random = _vm->getRandomNumber(1, 50); + break; + } + + if (random == 1) + resetFrame = 39; + else + resetFrame = 41; + + break; + + case 110: + _vm->_gameConv->release(); + break; + + default: + break; + } + + if (resetFrame >= 0) { + _scene->setAnimFrame(_globals._animationIndexes[1], resetFrame); + _degasFrame = resetFrame; + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Phantom } // End of namespace MADS diff --git a/engines/mads/phantom/phantom_scenes2.h b/engines/mads/phantom/phantom_scenes2.h index e30224e418..cff6640eff 100644 --- a/engines/mads/phantom/phantom_scenes2.h +++ b/engines/mads/phantom/phantom_scenes2.h @@ -78,6 +78,38 @@ public: virtual void preActions(); virtual void actions(); }; + +class Scene202 : public Scene2xx { +private: + bool _ticketGivenFl; + bool _anim0ActvFl; + bool _anim1ActvFl; + bool _skipWalkFl; + int _chandeliersPosX[5]; + int _chandeliersHotspotId[5]; + int _conversationCount; + int _usherStatus; + int _usherFrame; + int _usherCount; + int _degasStatus; + int _degasFrame; + + void handleConversation1(); + void handleConversation2(); + void handleUsherAnimation(); + void handleDegasAnimation(); + void handleChandeliersPositions(); + +public: + Scene202(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 |