diff options
-rw-r--r-- | engines/tsage/core.cpp | 37 | ||||
-rw-r--r-- | engines/tsage/core.h | 24 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.cpp | 45 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.h | 15 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes1.cpp | 5 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes6.cpp | 1120 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes6.h | 153 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/scenes.h | 3 |
9 files changed, 1395 insertions, 9 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 785afda2ae..06df34ee20 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -449,7 +449,7 @@ void ObjectMover3::dispatch() { } void ObjectMover3::startMove(SceneObject *sceneObj, va_list va) { - _sceneObject = va_arg(va, SceneObject *); + _sceneObject = sceneObj; _destObject = va_arg(va, SceneObject *); _minArea = va_arg(va, int); _action = va_arg(va, Action *); @@ -996,6 +996,38 @@ bool PlayerMover::sub_F8E5(const Common::Point &pt1, const Common::Point &pt2, c /*--------------------------------------------------------------------------*/ +void PlayerMover2::synchronise(Serialiser &s) { + SYNC_POINTER(_destObject); + s.syncAsSint16LE(_field7E); + s.syncAsSint16LE(_minArea); +} + +void PlayerMover2::dispatch() { + int total = _sceneObject->getSpliceArea(_destObject); + + if (total <= _minArea) + endMove(); + else { + setDest(_destObject->_position); + ObjectMover::dispatch(); + } +} + +void PlayerMover2::startMove(SceneObject *sceneObj, va_list va) { + _sceneObject = sceneObj; + _field7E = va_arg(va, int); + _minArea = va_arg(va, int); + _destObject = va_arg(va, SceneObject *); + + PlayerMover::setDest(_destObject->_position); +} + +void PlayerMover2::endMove() { + _sceneObject->_field6E = 0x40; +} + +/*--------------------------------------------------------------------------*/ + PaletteModifier::PaletteModifier() { _scenePalette = NULL; _action = NULL; @@ -1045,8 +1077,7 @@ void PaletteRotation::signal() { if (_disabled) return; - bool flag = true; - switch (_rotationMode) { + bool flag = true; switch (_rotationMode) { case -1: if (--_currIndex < _start) { flag = decDuration(); diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 32260c0dc3..d55eacb911 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -259,7 +259,7 @@ public: }; class PlayerMover: public NpcMover { -private: +protected: void setDest(const Common::Point &destPos); void pathfind(Common::Point *routeList, Common::Point srcPos, Common::Point destPos, RouteEnds routeEnds); int regionIndexOf(const Common::Point &pt); @@ -286,9 +286,16 @@ public: class PlayerMover2: public PlayerMover { public: - int _field7A; + SceneObject *_destObject; int _field7E; - PlayerMover2(): PlayerMover() { _field7A = 0; } + int _minArea; + PlayerMover2(): PlayerMover() { _destObject = NULL; } + + virtual void synchronise(Serialiser &s); + virtual Common::String getClassName() { return "PlayerMover2"; } + virtual void dispatch(); + virtual void startMove(SceneObject *sceneObj, va_list va); + virtual void endMove(); }; /*--------------------------------------------------------------------------*/ @@ -413,6 +420,17 @@ public: } }; +class SceneItemExt: public SceneItem { +public: + int _state; + + virtual Common::String getClassName() { return "SceneItemExt"; } + virtual void synchronise(Serialiser &s) { + SceneItem::synchronise(s); + s.syncAsSint16LE(_state); + } +}; + class SceneHotspot: public SceneItem { public: SceneHotspot(): SceneItem() {} diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index b9cbb39a8a..8a174a4822 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -133,6 +133,10 @@ Scene *SceneFactory::createScene(int sceneNumber) { /* Scene group 6 */ // Caverns - Entrance case 5000: return new Scene5000(); + // Caverns + case 5100: return new Scene5100(); + // Caverns - Throne-room + case 5200: return new Scene5200(); /* Scene group 8 */ // Scene 7000: Landing @@ -518,6 +522,16 @@ SpeakerFLText::SpeakerFLText() { /*--------------------------------------------------------------------------*/ +SpeakerBatText::SpeakerBatText() { + _speakerName = "BATTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTRE; + _colour1 = 3; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + SpeakerSKL::SpeakerSKL(): AnimatedSpeaker() { _speakerName = "SKL"; _newSceneNumber = 7011; @@ -546,6 +560,7 @@ void SpeakerSKL::setText(const Common::String &msg) { Speaker::setText(msg); } + /*--------------------------------------------------------------------------*/ SpeakerQL::SpeakerQL(): AnimatedSpeaker() { @@ -1044,4 +1059,34 @@ void SpeakerCDL::setText(const Common::String &msg) { } /*--------------------------------------------------------------------------*/ + +SpeakerFLL::SpeakerFLL() { + _speakerName = "FLL"; + _newSceneNumber = 5221; + _textPos = Common::Point(10, 40); + _colour1 = 17; +} + +void SpeakerFLL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(5223); + _object1.setStrip2(2); + _object1.setPriority2(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(216, 129)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(5223); + _object2.setStrip2(1); + _object2.setPriority2(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(210, 67)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h index 2e066e2f9a..047c6220d5 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -229,6 +229,13 @@ public: virtual Common::String getClassName() { return "SpeakerFLText"; } }; +class SpeakerBatText: public ScreenSpeaker { +public: + SpeakerBatText(); + + virtual Common::String getClassName() { return "SpeakerFLText"; } +}; + class SpeakerQR: public AnimatedSpeaker { public: SpeakerQR(); @@ -367,6 +374,14 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerFLL: public AnimatedSpeaker { +public: + SpeakerFLL(); + + virtual Common::String getClassName() { return "SpeakerFLL"; } + virtual void setText(const Common::String &msg); +}; + } // End of namespace tSage #endif diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index b1bcaabf28..23cbad9994 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -2463,13 +2463,12 @@ void Scene90::Action1::signal() { break; } case 10: { - Common::Point pt(10, 15); PlayerMover2 *mover = new PlayerMover2(); - scene->_object1.addMover(mover, &pt, &scene->_object5); + scene->_object1.addMover(mover, 10, 15, &scene->_object5); if (!_globals->getFlag(104)) { mover = new PlayerMover2(); - scene->_object4.addMover(mover, &pt, &scene->_object1); + scene->_object4.addMover(mover, 10, 15, &scene->_object1); } setDelay(60); break; diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp index 8bbeb1acaa..a630a9486c 100644 --- a/engines/tsage/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld_scenes6.cpp @@ -607,4 +607,1124 @@ void Scene5000::dispatch() { } } +/*-------------------------------------------------------------------------- + * Scene 5100 - Caverns + * + *--------------------------------------------------------------------------*/ + +void Scene5100::Action1::signal() { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(5); + break; + case 1: + ADD_MOVER(_globals->_player, 1111, 165); + break; + case 2: + _globals->_player.setStrip(6); + _globals->_player.setFrame(1); + setDelay(60); + break; + case 3: + if (_globals->getFlag(10)) { + _globals->_player.enableControl(); + remove(); + } else { + _globals->setFlag(10); + scene->_stripManager.start(5102, this); + } + break; + case 4: + scene->_soundHandler.startSound(206); + + scene->_hotspot5.postInit(); + scene->_hotspot5.setVisage(5362); + scene->_hotspot5.setPosition(Common::Point(1160, 34)); + scene->_hotspot5.setStrip2(2); + scene->_hotspot5.animate(ANIM_MODE_1, NULL); + scene->_hotspot5.setPriority2(10); + + _globals->_sceneItems.push_front(&scene->_hotspot5); + ADD_MOVER(scene->_hotspot5, 999, 14); + break; + case 5: + scene->_hotspot5.setStrip2(4); + scene->_hotspot5._frame = 1; + scene->_hotspot5.animate(ANIM_MODE_5, this); + break; + case 6: + _globals->_player.enableControl(); + remove(); + break; + } +} + +void Scene5100::Action2::signal() { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->_player.disableControl(); + setDelay(5); + break; + case 1: + if (scene->_hotspot8._visage == 2806) + setDelay(1); + else + scene->_hotspot8.animate(ANIM_MODE_5, this); + break; + case 2: + if (scene->_hotspot8._visage != 2806) { + scene->_hotspot8.setVisage(2806); + scene->_hotspot8.setPosition(Common::Point(548, 193)); + scene->_hotspot8.animate(ANIM_MODE_1, NULL); + scene->_hotspot8._angle = 325; + scene->_hotspot8.setObjectWrapper(new SceneObjectWrapper()); + scene->_hotspot8.setStrip(8); + } + + scene->_stripManager.start(5129, this); + break; + case 3: + if (_globals->_player._position.x >= 966) { + ADD_PLAYER_MOVER(1215, 155); + } else { + ADD_PLAYER_MOVER_THIS(scene->_hotspot8, 966, 185); + } + + if (_globals->_player._position.x >= 966) { + setDelay(1); + } else { + ADD_PLAYER_MOVER(966, 190); + } + break; + case 4: + ADD_PLAYER_MOVER_THIS(scene->_hotspot8, 1215, 155); + ADD_PLAYER_MOVER(1215, 155); + break; + case 5: + _globals->_sceneManager.changeScene(2100); + break; + } +} + +void Scene5100::Action3::signal() { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->setFlag(62); + _globals->_player.disableControl(); + _globals->_player.addMover(NULL); + + scene->_hotspot2.addMover(NULL); + scene->_hotspot3.addMover(NULL); + _globals->_player.setVisage(2672); + + if (static_cast<SceneObject *>(_owner)->_position.x >= _globals->_player._position.x) + _globals->_player._strip = 4; + else + _globals->_player._strip = 3; + _globals->_player._frame = 1; + _globals->_player.animate(ANIM_MODE_5, this); + break; + case 1: + _globals->_player.setVisage(2674); + _globals->_player.setFrame(1); + _globals->_player.animate(ANIM_MODE_5, this); + break; + case 2: + scene->_soundHandler.startSound(28); + if (static_cast<SceneObject *>(_owner)->_position.x < _globals->_player._position.x) { + scene->_hotspot2.setVisage(5130); + scene->_hotspot2._strip = 1; + scene->_hotspot2._frame = 1; + scene->_hotspot2.animate(ANIM_MODE_5, this); + scene->_hotspot2.setAction(NULL); + + scene->_hotspot3.setStrip2(1); + ADD_PLAYER_MOVER_THIS(scene->_hotspot3, 1200, 100); + } else { + scene->_hotspot3.setVisage(5130); + scene->_hotspot3._strip = 1; + scene->_hotspot3._frame = 1; + scene->_hotspot3.animate(ANIM_MODE_5, this); + scene->_hotspot3.setAction(NULL); + + scene->_hotspot2.setStrip2(2); + ADD_PLAYER_MOVER_NULL(scene->_hotspot2, 10, 140); + + } + + _globals->_player.setVisage(2672); + _globals->_player._frame = _globals->_player.getFrameCount(); + _globals->_player.animate(ANIM_MODE_6, this); + break; + case 3: + break; + case 4: + SceneItem::display2(5100, 38); + _globals->_player.enableControl(); + + _globals->_player.setVisage(0); + _globals->_player._strip = 8; + _globals->_player.animate(ANIM_MODE_1, NULL); + remove(); + break; + } +} + +void Scene5100::Action4::signal() { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: { + _globals->_player.disableControl(); + scene->_soundHandler.startSound(208); + SceneItem::display2(5100, 15); + + ObjectMover3 *mover = new ObjectMover3(); + scene->_hotspot2.addMover(mover, &_globals->_player, 20, this); + break; + } + case 1: + scene->_hotspot1.postInit(); + scene->_hotspot1.setVisage(5120); + scene->_hotspot1.setPosition(Common::Point(795, 161)); + scene->_hotspot1._strip = 4; + scene->_hotspot1.animate(ANIM_MODE_5, this); + break; + case 2: + setDelay(15); + break; + case 3: + _globals->_sceneManager.changeScene(5200); + break; + } +} + +void Scene5100::Action5::signal() { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->_player.disableControl(); + setDelay(60); + break; + case 1: + scene->_stripManager.start(5128, this); + break; + case 2: + setDelay(15); + break; + case 3: + scene->_sceneMode = 5106; + scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, NULL); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene5100::HotspotGroup1::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, _globals->getFlag(62) ? 41 : 26); + break; + case CURSOR_USE: + SceneItem::display2(5100, 11); + break; + case OBJECT_SCANNER: + SceneItem::display2(5100, 17); + break; + case OBJECT_STUNNER: + if (_globals->getFlag(62)) + SceneItem::display2(5100, 42); + else + setAction(&scene->_action3); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::Hotspot4::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, 31); + break; + case CURSOR_USE: + _globals->_player.disableControl(); + scene->_sceneMode = 5110; + scene->setAction(&scene->_sequenceManager, scene, 5110, &_globals->_player, this, &scene->_hotspot7, NULL); + break; + case CURSOR_TALK: + SceneItem::display2(5100, 34); + break; + case OBJECT_STUNNER: + SceneItem::display2(5100, 36); + break; + case OBJECT_SCANNER: + SceneItem::display2(5100, 37); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::HotspotGroup2::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, _globals->getFlag(62) ? 47 : 23); + break; + case CURSOR_USE: + SceneItem::display2(5100, 29); + break; + case CURSOR_TALK: + if (_position.x >= 600) + SceneItem::display2(5100, 28); + else { + _globals->_player.disableControl(); + scene->_sceneMode = 5114; + scene->setAction(&scene->_sequenceManager, scene, 5114, NULL); + } + break; + case OBJECT_SCANNER: + SceneItem::display2(5100, 43); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::Hotspot9::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, 32); + break; + case CURSOR_USE: + _globals->_player.disableControl(); + scene->_sceneMode = 5117; + scene->setAction(&scene->_sequenceManager, scene, 5117, &_globals->_player, NULL); + break; + case OBJECT_STUNNER: + SceneItem::display2(5100, 35); + break; + case OBJECT_SCANNER: + SceneItem::display2(5100, 44); + break; + case OBJECT_BONE: + _globals->_player.disableControl(); + scene->_sceneMode = 5116; + scene->setAction(&scene->_sequenceManager, scene, 5116, &_globals->_player, &scene->_hotspot10, + &scene->_hotspot4, NULL); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::Hotspot17::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, 18); + break; + case CURSOR_USE: + if (_globals->getFlag(67)) + SceneItem::display2(5100, 19); + else { + _globals->_player.disableControl(); + scene->_sceneMode = 5101; + scene->setAction(&scene->_sequenceManager, scene, 5101, &_globals->_player, this, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::Hotspot18::doAction(int action) { + switch (action) { + case CURSOR_LOOK: + if (_globals->_sceneManager._previousScene != 5000) { + SceneItem::display2(5100, 3); + } else { + switch (_index1) { + case 0: + SceneItem::display2(5100, 0); + ++_index1; + break; + case 1: + SceneItem::display2(5100, 1); + ++_index1; + break; + default: + SceneItem::display2(5100, 2); + break; + } + } + break; + case CURSOR_USE: + switch (_index2) { + case 0: + SceneItem::display2(5100, 8); + ++_index2; + break; + case 1: + SceneItem::display2(5100, 9); + ++_index2; + break; + default: + SceneItem::display2(5100, 10); + break; + } + break; + + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::Hotspot19::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, _globals->_sceneObjects->contains(&scene->_hotspot14) ? 27 : 20); + break; + case CURSOR_USE: + _globals->_player.disableControl(); + scene->_sceneMode = 5106; + + if (_globals->getFlag(66)) + scene->setAction(&scene->_sequenceManager, scene, 5113, &_globals->_player, NULL); + else { + _globals->setFlag(66); + scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, &scene->_hotspot14, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5100::Hotspot20::doAction(int action) { + Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5100, 21); + break; + case CURSOR_USE: + _globals->_player.disableControl(); + + if (_globals->getFlag(67)) { + scene->_sceneMode = 5112; + scene->setAction(&scene->_sequenceManager, scene, 5112, &_globals->_player, NULL); + } else { + scene->_sceneMode = 5101; + scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, &scene->_hotspot17, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene5100::Scene5100(): + _hotspot16(0, CURSOR_LOOK, 5100, 48, LIST_END), + _hotspot21(0, CURSOR_LOOK, 5100, 4, CURSOR_USE, 5100, 5, LIST_END) { +} + +void Scene5100::postInit(SceneObjectList *OwnerList) { + Scene::postInit(); + setZoomPercents(50, 10, 200, 100); + _sceneMode = 0; + + _stripManager.addSpeaker(&_speakerMText); + _stripManager.addSpeaker(&_speakerQText); + _stripManager.addSpeaker(&_speakerSText); + _stripManager.addSpeaker(&_speakerGameText); + _stripManager.addSpeaker(&_speakerBatText); + _speakerQText._npc = &_globals->_player; + _speakerMText._npc = &_globals->_player; + _speakerSText._npc = &_hotspot8; + + _globals->_player.postInit(); + _globals->_player.setVisage(0); + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.disableControl(); + + if (!_globals->getFlag(66)) { + _hotspot14.postInit(); + _hotspot14.setVisage(5101); + _hotspot14.setPosition(Common::Point(498, 147)); + _hotspot14.setPriority2(200); + _hotspot14._moveDiff.y = 10; + } + + _hotspot17.postInit(); + _hotspot17.setVisage(5101); + _hotspot17._strip = 2; + _hotspot17.setPriority2(200); + + if (_globals->getFlag(67)) + _hotspot17.setPosition(Common::Point(554, 192)); + else + _hotspot17.setPosition(Common::Point(539, 179)); + + _hotspot19.setBounds(Rect(488, 115, 508, 148)); + _hotspot21.setBounds(Rect(1150, 85, 1173, 112)); + _hotspot20.setBounds(Rect(517, 193, 562, 200)); + _globals->_sceneItems.addItems(&_hotspot19, &_hotspot21, NULL); + + if (_globals->getFlag(67)) { + _globals->_sceneItems.addItems(&_hotspot20, &_hotspot17, NULL); + } else { + _globals->_sceneItems.addItems(&_hotspot17, &_hotspot20, NULL); + } + + if (!_globals->getFlag(105)) { + _hotspot4.postInit(); + _hotspot4.setVisage(5363); + _hotspot4.setPosition(Common::Point(1025, 65)); + _hotspot4.setStrip(4); + _hotspot4.animate(ANIM_MODE_7, 0, NULL);; + _globals->_sceneItems.push_back(&_hotspot4); + + _hotspot9.postInit(); + _hotspot9.setVisage(5363); + _hotspot9.setPosition(Common::Point(966, 120)); + _globals->_sceneItems.push_back(&_hotspot9); + + _hotspot10.postInit(); + _hotspot10.setVisage(5363); + _hotspot10.setPosition(Common::Point(999, 68)); + _hotspot10.setStrip(2); + + _hotspot6.postInit(); + _hotspot6.setVisage(5362); + _hotspot6.setPosition(Common::Point(1017, 34)); + _hotspot6._strip = 4; + _hotspot6._frame = _hotspot6.getFrameCount(); + _globals->_sceneItems.push_back(&_hotspot6); + } + + _hotspot16._sceneRegionId = 15; + _globals->_sceneItems.push_back(&_hotspot16); + + if (!_globals->getFlag(62)) { + _hotspot2.postInit(); + _hotspot2.setVisage(5110); + _hotspot2.animate(ANIM_MODE_1, NULL); + _hotspot2._moveDiff.x = 4; + _globals->_sceneItems.push_back(&_hotspot2); + + _hotspot3.postInit(); + _hotspot3.setVisage(5110); + _hotspot3.animate(ANIM_MODE_1, NULL); + _hotspot3._moveDiff.x = 4; + _globals->_sceneItems.push_back(&_hotspot3); + + if (_globals->getFlag(61)) { + _hotspot2.setPosition(Common::Point(483, 189)); + _hotspot3.setPosition(Common::Point(811, 182)); + } else { + _hotspot2.setPosition(Common::Point(610, 170)); + _hotspot3.setPosition(Common::Point(600, 180)); + } + } + + if (_globals->getFlag(60) && (_globals->_inventory._stasisBox._sceneNumber == 1) && + _globals->getFlag(107) && _globals->getFlag(67)) { + _hotspot8.postInit(); + _hotspot8.setVisage(2806); + _hotspot8.setPosition(Common::Point(557, 178)); + _hotspot8.animate(ANIM_MODE_1, NULL); + _hotspot8.setObjectWrapper(new SceneObjectWrapper()); + + _globals->clearFlag(59); + } + + switch (_globals->_sceneManager._previousScene) { + case 5000: + default: + _globals->_player.setPosition(Common::Point(1184, 160)); + setAction(&_action1); + break; + case 5200: + if (_globals->_stripNum == 5200) { + _globals->_player.setVisage(5101); + _globals->_player.setPriority2(200); + _globals->_player.setStrip(5); + _globals->_player.setFrame(1); + _globals->_player.setPosition(Common::Point(513, 199)); + + _sceneMode = 5108; + setAction(&_sequenceManager, this, 5108, &_globals->_player, NULL); + } else { + _globals->_player.setPosition(Common::Point(20, 175)); + + _hotspot13.postInit(); + _hotspot13.setVisage(5110); + _hotspot13.setPosition(Common::Point(578, 192)); + _hotspot13._strip = 2; + + _hotspot11.postInit(); + _hotspot11.setVisage(5110); + _hotspot11.setPosition(Common::Point(5, 162)); + _hotspot11.setStrip2(1); + _hotspot11._moveDiff = Common::Point(4, 2); + _hotspot11.animate(ANIM_MODE_1, NULL); + + ObjectMover2 *mover = new ObjectMover2(); + _hotspot11.addMover(mover, 15, 20, &_globals->_player); + + _hotspot12.postInit(); + _hotspot12.setVisage(5110); + _hotspot12.setPosition(Common::Point(15, 164)); + _hotspot12.setStrip2(1); + _hotspot12._moveDiff = Common::Point(4, 2); + _hotspot12.animate(ANIM_MODE_1, NULL); + + ObjectMover2 *mover2 = new ObjectMover2(); + _hotspot12.addMover(mover2, 25, 50, &_globals->_player); + + _hotspot17.setPosition(Common::Point(554, 182)); + _globals->_player.disableControl(); + + _sceneMode = 5105; + setAction(&_sequenceManager, this, 5105, &_globals->_player, NULL); + } + break; + case 5300: + switch (_globals->_stripNum) { + case 5300: + _sceneMode = 5111; + + _globals->_player.setVisage(5101); + _globals->_player.setStrip(6); + _globals->_player.setPriority2(170); + _globals->_player.setPosition(Common::Point(1168, 110)); + + setAction(&_sequenceManager, this, 5111, &_globals->_player, NULL); + _hotspot8.setPosition(Common::Point(1107, 178)); + break; + case 5302: + _globals->_player.setPosition(Common::Point(512, 190)); + + if (_globals->_sceneObjects->contains(&_hotspot8)) + setAction(&_action2); + else + _globals->_player.enableControl(); + break; + case 5303: + _hotspot8.setVisage(5102); + _hotspot8.setPosition(Common::Point(533, 172)); + _globals->_player.setPosition(Common::Point(512, 190)); + setAction(&_action2); + break; + } + + if (_globals->getFlag(108)) { + _hotspot6.postInit(); + _hotspot6.setVisage(5362); + _hotspot6.setPosition(Common::Point(542, 19)); + _hotspot6.setStrip(6); + _hotspot6.setFrame(1); + _globals->_sceneItems.push_back(&_hotspot6); + } else if (_globals->_inventory._vial._sceneNumber != 5100) { + _hotspot6.postInit(); + _hotspot6.setVisage(5362); + _hotspot6.setPosition(Common::Point(1152, 70)); + _hotspot6.setPriority2(170); + _hotspot6.setStrip(6); + _hotspot6.setFrame(1); + _globals->_sceneItems.push_back(&_hotspot6); + } + break; + } + + _hotspot18.setBounds(Rect(0, 0, 1280, 200)); + _globals->_sceneItems.push_back(&_hotspot18); + + _hotspot15.postInit(); + _hotspot15.setVisage(5140); + _hotspot15.setStrip(3); + _hotspot15.setPosition(Common::Point(977, 173)); + _hotspot15.setPriority2(1); + + _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); + loadScene(5100); + _globals->_soundHandler.startSound(205); +} + +void Scene5100::signal() { + switch (_sceneMode) { + case 5101: + case 5112: + _globals->setFlag(67); + _globals->_sceneManager.changeScene(5300); + break; + case 5102: + case 5114: + _globals->_player.enableControl(); + break; + case 5103: + if (_globals->getFlag(61)) { + SceneItem::display2(5100, 46); + _globals->_sceneManager.changeScene(5300); + } else { + SceneItem::display2(5100, 45); + _globals->_sceneManager.changeScene(5200); + } + break; + case 5105: + _globals->_sceneManager.changeScene(5300); + break; + case 5106: + _globals->_stripNum = 5111; + _globals->_sceneManager.changeScene(5200); + break; + case 5108: + if (!_globals->getFlag(60)) + _globals->_player.enableControl(); + else if (_globals->_inventory._stasisBox._sceneNumber == 1) + setAction(&_action2); + else + setAction(&_action5); + break; + case 5110: + SceneItem::display2(5100, 30); + _globals->_player._angle = 325; + _globals->_player.enableControl(); + break; + case 5111: + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + _globals->_player.setVisage(6); + _globals->_player.setStrip(6); + _globals->_player.setPriority2(-1); + _globals->_player.animate(ANIM_MODE_1, NULL); + + if ((_globals->_inventory._vial._sceneNumber != 5100) && !_globals->getFlag(108)) { + _globals->setFlag(108); + _sceneMode = 5130; + _globals->_player.disableControl(); + + _speakerBatText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 20, 30)); + setAction(&_sequenceManager, this, 5130, &_globals->_player, &_hotspot6, NULL); + } else if (_globals->_sceneObjects->contains(&_hotspot8)) { + setAction(&_action2); + } else { + _globals->_player.enableControl(); + } + break; + case 5116: + _globals->setFlag(105); + _globals->_inventory._bone._sceneNumber = 0; + + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + _globals->_player.setVisage(0); + _globals->_player.setStrip(6); + _globals->_player.setPriority2(-1); + _globals->_player.animate(ANIM_MODE_1, NULL); + break; + case 5117: + _globals->_player.enableControl(); + break; + case 5130: + _hotspot6.setVisage(5362); + _hotspot6.setPosition(Common::Point(542, 25)); + _hotspot6.setStrip(6); + _hotspot6.setFrame(1); + _globals->_player.enableControl(); + break; + case 5150: + _globals->clearFlag(60); + _globals->_sceneManager.changeScene(5300); + break; + } +} + +void Scene5100::dispatch() { + if (_hotspot15._bounds.contains(_globals->_player._position) && !_globals->_player._visage) { + _globals->_player.disableControl(); + _globals->_player.addMover(NULL); + + _soundHandler.startSound(207); + _sceneMode = 5103; + setAction(&_sequenceManager, this, (_globals->_player._position.x >= 966) ? 5104 : 5103, + &_globals->_player, &_hotspot15, NULL); + } + + if (_globals->getFlag(61) && !_globals->getFlag(62) && + ((_globals->_player._position.x - _hotspot2._position.x) < 160) && + (_globals->_sceneManager._previousScene != 5200) && + (_globals->_sceneManager._previousScene != 5150)) { + setAction(NULL); + _sceneMode = 5150; + _soundHandler.startSound(208); + + if (_globals->_inventory._vial._sceneNumber == 5100) { + _globals->_player.addMover(NULL); + _globals->_player.disableControl(); + SceneItem::display2(5100, 39); + } + + _hotspot2.setStrip2(1); + _hotspot3.setStrip2(2); + + ObjectMover3 *mover1 = new ObjectMover3(); + _hotspot2.addMover(mover1, 20, this); + ObjectMover3 *mover2 = new ObjectMover3(); + _hotspot3.addMover(mover2, 20, this); + } + + if (!_action) { + if (((_globals->_player._position.x - _hotspot2._position.x) < 130) && !_globals->getFlag(61)) { + _globals->_player._canWalk = false; + _globals->_player.addMover(NULL); + + PlayerMover2 *mover = new PlayerMover2(); + _hotspot3.addMover(mover, 20, 25, &_globals->_player); + setAction(&_action4); + } + + if ((_globals->_sceneManager._scene->_backgroundBounds.right - 85) <= _globals->_player._position.x) + _globals->_sceneManager.changeScene(5000); + + if (_globals->_player.getRegionIndex() == 8) { + _sceneMode = 5114; + setAction(&_sequenceManager, this, 5115, &_globals->_player, NULL); + } + } + + Scene::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 5200 - Caverns - Throne Room + * + *--------------------------------------------------------------------------*/ + +void Scene5200::Action1::signal() { + Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(_globals->_randomSource.getRandomNumber(59) + 120); + break; + case 1: + scene->_hotspot3.animate(ANIM_MODE_8, 1, this); + _actionIndex = 0; + break; + } +} + +void Scene5200::Action2::signal() { + Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->_player.disableControl(); + ADD_PLAYER_MOVER(92, 52); + break; + case 1: + _globals->_player.setVisage(5202); + _globals->_player._strip = 4; + _globals->_player._frame = 1; + _globals->_player.animate(ANIM_MODE_4, 3, 1, this); + break; + case 2: + scene->_soundHandler.proc3(); + scene->_hotspot14.remove(); + + _globals->_inventory._stasisBox._sceneNumber = 1; + _globals->_player.animate(ANIM_MODE_5, this); + break; + case 3: + _globals->_player.setVisage(0); + _globals->_player._strip = 3; + _globals->_player.animate(ANIM_MODE_1, NULL); + + scene->_hotspot8.animate(ANIM_MODE_2, NULL); + ADD_MOVER(scene->_hotspot8, 141, 77); + break; + case 4: + scene->_soundHandler.startSound(303); + + scene->_hotspot8._strip = 2; + scene->_hotspot8._frame = 1; + scene->_hotspot8.animate(ANIM_MODE_5, this); + break; + case 5: + _globals->_player.enableControl(); + remove(); + break; + } +} + +void Scene5200::Action3::signal() { + switch (_actionIndex++) { + _globals->_player.disableControl(); + setDelay(5); + break; + case 1: + ADD_PLAYER_MOVER(285, 62); + break; + case 2: + _globals->_player.enableControl(); + remove(); + break; + } +} + +void Scene5200::Action4::signal() { + Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(120); + break; + case 1: + _globals->_soundHandler.startSound(209); + scene->_stripManager.start(5202, this, scene); + break; + case 2: + scene->_hotspot6.animate(ANIM_MODE_5, this); + break; + case 3: + setDelay(10); + break; + case 4: + scene->_stripManager.start(5204, this, scene); + break; + case 5: + setDelay(60); + break; + case 6: + _globals->_sceneManager.changeScene(5100); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene5200::Hotspot9::doAction(int action) { + switch (action) { + case CURSOR_LOOK: + if (!_state) { + ++_state; + SceneItem::display2(5200, 5); + } else { + SceneItem::display2(5200, 6); + } + break; + case CURSOR_USE: + SceneItem::display2(5200, 14); + break; + default: + SceneItem::doAction(action); + break; + } +} + +void Scene5200::Hotspot10::doAction(int action) { + switch (action) { + case CURSOR_LOOK: + if (!_state) { + ++_state; + SceneItem::display2(5200, 7); + } else { + SceneItem::display2(5200, 8); + } + break; + default: + SceneItem::doAction(action); + break; + } +} + +void Scene5200::Hotspot14::doAction(int action) { + Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5200, 4); + break; + case CURSOR_USE: + scene->setAction(&scene->_action2); + break; + default: + SceneItem::doAction(action); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene5200::Scene5200(): + _hotspot11(0, CURSOR_LOOK, 5200, 0, CURSOR_USE, 5200, 13, LIST_END), + _hotspot12(10, CURSOR_LOOK, 5200, 9, LIST_END), + _hotspot13(8, CURSOR_LOOK, 5200, 0, CURSOR_USE, 5200, 13, LIST_END) { +} + + +void Scene5200::postInit(SceneObjectList *OwnerList) { + Scene::postInit(); + setZoomPercents(0, 150, 199, 150); + _fieldA = 5600; + _fieldE = 5100; + + _hotspot9._state = 0; + _hotspot10._state = 0; + _stripManager.addSpeaker(&_speakerQText); + _stripManager.addSpeaker(&_speakerGameText); + _stripManager.addSpeaker(&_speakerFLText); + _stripManager.addSpeaker(&_speakerFLL); + _stripManager.addSpeaker(&_speakerQL); + _stripManager.setCallback(this); + + _speakerFLText._textPos.x = 160; + _speakerQText._textPos.x = 20; + + if (_globals->_inventory._stasisBox._sceneNumber == 5200) { + _soundHandler.startSound(216); + _soundHandler.proc5(true); + + _hotspot14.postInit(); + _hotspot14.setVisage(5202); + _hotspot14._strip = 3; + _hotspot14.setPosition(Common::Point(105, 52)); + _hotspot14.setPriority2(90); + + _hotspot8.postInit(); + _hotspot8.setVisage(5202); + _hotspot8._strip = 1; + _hotspot8.setPosition(Common::Point(96, 53)); + _hotspot8.setPriority2(90); + _globals->_sceneItems.push_back(&_hotspot14); + } + + if (_globals->_stripNum == 1111) { + _globals->_soundHandler.startSound(205); + _globals->_player.disableControl(); + + _globals->_player.postInit(); + _globals->_player.setVisage(0); + _globals->_player.changeZoom(75); + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.setStrip(1); + _globals->_player.setFrame(3); + _globals->_player.setPosition(Common::Point(307, 62)); + + setAction(&_action3); + } else { + _globals->_player.postInit(); + _globals->_player.setVisage(2640); + _globals->_player._strip = 1; + _globals->_player._frame = 4; + _globals->_player.setPosition(Common::Point(105, 199)); + + _hotspot5.postInit(); + _hotspot5.setVisage(5210); + _hotspot5._frame = 2; + _hotspot5.setPosition(Common::Point(189, 167)); + + _hotspot6.postInit(); + _hotspot6.setVisage(5210); + _hotspot6._frame = 1; + _hotspot6._strip = 2; + _hotspot6.setPosition(Common::Point(159, 137)); + + _hotspot7.postInit(); + _hotspot7.setVisage(5210); + _hotspot7._frame = 1; + _hotspot7._strip = 4; + _hotspot7.setPriority2(168); + _hotspot7.setPosition(Common::Point(186, 106)); + + _hotspot1.postInit(); + _hotspot1.setVisage(5212); + _hotspot1._frame = 1; + _hotspot1.setPosition(Common::Point(62, 132)); + + _hotspot2.postInit(); + _hotspot2.setVisage(5212); + _hotspot2._strip = 3; + _hotspot2.setPosition(Common::Point(148, 141)); + _hotspot2.setPriority2(90); + + _hotspot3.postInit(); + _hotspot3.setVisage(5212); + _hotspot3._strip = 2; + _hotspot3.setPosition(Common::Point(62, 109)); + _hotspot3.setPriority2(138); + _hotspot3.setAction(&_action1); + + _hotspot4.postInit(); + _hotspot4.setVisage(5212); + _hotspot4._strip = 4; + _hotspot4.setPosition(Common::Point(146, 110)); + _hotspot4.setPriority2(90); + + _globals->_player.disableControl(); + _globals->setFlag(61); + + setAction(&_action4); + } + + _hotspot11.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + _hotspot9._sceneRegionId = 11; + _hotspot10._sceneRegionId = 9; + + _globals->_sceneItems.addItems(&_hotspot12, &_hotspot13, &_hotspot9, &_hotspot10, &_hotspot11, NULL); + _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); + loadScene(5200); +} + +void Scene5200::stripCallback(int v) { + switch (v) { + case 1: + _hotspot7.animate(ANIM_MODE_2, NULL); + break; + case 2: + _hotspot7.animate(ANIM_MODE_NONE, NULL); + break; + } +} + +void Scene5200::dispatch() { + Scene::dispatch(); + + if (!_action && (_globals->_player.getRegionIndex() == 12)) { + _globals->_stripNum = 5200; + _globals->_sceneManager.changeScene(5100); + } +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_scenes6.h b/engines/tsage/ringworld_scenes6.h index 493e555c6f..f9d519f4ce 100644 --- a/engines/tsage/ringworld_scenes6.h +++ b/engines/tsage/ringworld_scenes6.h @@ -101,6 +101,159 @@ public: virtual void dispatch(); }; +class Scene5100: public Scene { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; + class Action3: public Action { + public: + virtual void signal(); + }; + class Action4: public Action { + public: + virtual void signal(); + }; + class Action5: public Action { + public: + virtual void signal(); + }; + class Action6: public Action { + public: + virtual void signal(); + }; + + /* Hotspots */ + class HotspotGroup1: public SceneObject { + public: + virtual void doAction(int action); + }; + class HotspotGroup2: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot4: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot9: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot17: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot18: public SceneHotspot { + public: + int _index1; + int _index2; + + virtual void doAction(int action); + }; + class Hotspot19: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot20: public SceneObject { + public: + virtual void doAction(int action); + }; +public: + SequenceManager _sequenceManager; + SoundHandler _soundHandler; + SpeakerMText _speakerMText; + SpeakerQText _speakerQText; + SpeakerSText _speakerSText; + SpeakerBatText _speakerBatText; + SpeakerGameText _speakerGameText; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Action5 _action5; + HotspotGroup1 _hotspot1, _hotspot2, _hotspot3; + Hotspot4 _hotspot4; + HotspotGroup2 _hotspot5, _hotspot6, _hotspot7; + SceneObject _hotspot8; + Hotspot9 _hotspot9; + SceneObject _hotspot10, _hotspot11, _hotspot12, _hotspot13, _hotspot14, _hotspot15; + DisplayHotspot _hotspot16; + Hotspot17 _hotspot17; + Hotspot18 _hotspot18; + Hotspot19 _hotspot19; + Hotspot20 _hotspot20; + DisplayHotspot _hotspot21; + + Scene5100(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene5200: public Scene { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; + class Action3: public Action { + public: + virtual void signal(); + }; + class Action4: public Action { + public: + virtual void signal(); + }; + + /* Hotspots */ + class Hotspot9: public SceneItemExt { + public: + virtual void doAction(int action); + }; + class Hotspot10: public SceneItemExt { + public: + virtual void doAction(int action); + }; + class Hotspot14: public SceneObject { + public: + virtual void doAction(int action); + }; +public: + SoundHandler _soundHandler; + SpeakerFLL _speakerFLL; + SpeakerFLText _speakerFLText; + SpeakerQL _speakerQL; + SpeakerQText _speakerQText; + SpeakerGameText _speakerGameText; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + + SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5, _hotspot6, _hotspot7; + SceneObject _hotspot8; + Hotspot9 _hotspot9; + Hotspot10 _hotspot10; + DisplayHotspot _hotspot11, _hotspot12, _hotspot13; + Hotspot14 _hotspot14; + + Scene5200(); + virtual void stripCallback(int v); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void dispatch(); +}; + + } // End of namespace tSage #endif diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index ae9f94967c..de5fe1e5cb 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -238,6 +238,8 @@ void Scene::synchronise(Serialiser &s) { _backgroundBounds.synchronise(s); _sceneBounds.synchronise(s); _oldSceneBounds.synchronise(s); + s.syncAsSint16LE(_fieldA); + s.syncAsSint16LE(_fieldE); for (int i = 0; i < 256; ++i) s.syncAsUint16LE(_enabledSections[i]); diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 2295da0074..85e7c7251e 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -51,6 +51,9 @@ public: int _enabledSections[256]; int _zoomPercents[256]; ScenePriorities _priorities; + + int _fieldA; + int _fieldE; public: Scene(); virtual ~Scene(); |