From 29a20ed7dddb178eecfbcc4b7db11364c2c30606 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Dec 2011 09:05:09 +1100 Subject: TSAGE: Implemented R2R Scene 850 - Deck #5 By Lift --- engines/tsage/events.h | 4 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 7 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 176 +++++++++++++++++++++++- engines/tsage/ringworld2/ringworld2_scenes0.h | 39 ++++++ 4 files changed, 221 insertions(+), 5 deletions(-) diff --git a/engines/tsage/events.h b/engines/tsage/events.h index ecc710ed99..303c2201ea 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -85,8 +85,8 @@ enum CursorType { // Ringworld 2 objects R2_OPTO_DISK = 1, R2_READER = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, R2_ATTRACTOR_UNIT = 5, R2_SENSOR_PROBE = 6, - R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_14 = 14, - R2_15 = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21, + R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_OPTICAL_FIBRE = 14, + R2_CLAMP = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21, R2_22 = 22, R2_23 = 23, R2_24 = 24, R2_25 = 25, R2_26 = 26, R2_27 = 27, R2_28 = 28, R2_29 = 29, R2_30 = 30, R2_31 = 31, R2_32 = 32, R2_33 = 33, R2_34 = 34, R2_35 = 35, R2_36 = 36, R2_37 = 37, R2_38 = 38, R2_39 = 39, R2_40 = 40, R2_41 = 41, R2_42 = 42, diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index a33a9a5e9e..201b44eeef 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -77,7 +77,10 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 700: case 800: case 825: + error("Missing scene %d from group 0", sceneNumber); case 850: + // Deck #5 - By Lift + return new Scene850(); case 900: error("Missing scene %d from group 0", sceneNumber); /* Scene group #1 */ @@ -607,8 +610,8 @@ void Ringworld2InvObjectList::reset() { setObjectScene(R2_11, 400); setObjectScene(R2_12, 500); setObjectScene(R2_13, 1550); - setObjectScene(R2_14, 850); - setObjectScene(R2_15, 850); + setObjectScene(R2_OPTICAL_FIBRE, 850); + setObjectScene(R2_CLAMP, 850); setObjectScene(R2_16, 0); setObjectScene(R2_17, 1550); setObjectScene(R2_18, 1550); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 1c25c896a6..7a3b0cdd78 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1701,7 +1701,7 @@ void Scene250::signal() { R2_GLOBALS._sceneManager.changeScene(139); break; case 91: - R2_GLOBALS._sceneManager.changeScene(91); + R2_GLOBALS._sceneManager.changeScene(850); break; default: break; @@ -2900,6 +2900,180 @@ void Scene400::dispatch() { } } +/*-------------------------------------------------------------------------- + * Scene 850 - Deck #5 - By Lift + * + *--------------------------------------------------------------------------*/ + +bool Scene850::Indicator::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 850)) + return NamedHotspot::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 851; + scene->setAction(&scene->_sequenceManager1, scene, 851, &R2_GLOBALS._player, &scene->_fibre, NULL); + return true; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene850::LiftDoor::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 202; + scene->setAction(&scene->_sequenceManager1, scene, 202, &R2_GLOBALS._player, this, NULL); + return true; + } +} + +bool Scene850::SickBayDoor::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 204; + scene->setAction(&scene->_sequenceManager1, scene, 204, &R2_GLOBALS._player, this, NULL); + return true; + } +} + +bool Scene850::Clamp::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (!R2_GLOBALS.getFlag(7)) + return false; + else if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_object1.postInit(); + scene->_sceneMode = 850; + scene->setAction(&scene->_sequenceManager1, scene, 850, &R2_GLOBALS._player, this, &scene->_object1, NULL); + return true; + } +} + +bool Scene850::Panel::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || R2_GLOBALS.getFlag(7)) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 852; + scene->setAction(&scene->_sequenceManager1, scene, 852, &R2_GLOBALS._player, this, &scene->_object1, NULL); + return true; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene850::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(850); + + _liftDoor.postInit(); + _liftDoor.setup(850, 2, 1); + _liftDoor.setPosition(Common::Point(188, 79)); + _liftDoor.setDetails(850, 3, -1, -1, 1, NULL); + + _sickBayDoor.postInit(); + _sickBayDoor.setup(850, 3, 1); + _sickBayDoor.setPosition(Common::Point(62, 84)); + _sickBayDoor.setDetails(850, 9, -1, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_CLAMP) == 850) { + _clamp.postInit(); + _clamp.setup(850, 5, 1); + _clamp.setPosition(Common::Point(242, 93)); + _clamp.fixPriority(81); + _clamp.animate(ANIM_MODE_2, NULL); + _clamp.setDetails(850, 27, -1, -1, 1, NULL); + } + + _panel.postInit(); + _panel.setVisage(850); + + if (R2_GLOBALS.getFlag(7)) + _panel.setFrame(7); + + _panel.setPosition(Common::Point(232, 119)); + _panel.fixPriority(82); + _panel.setDetails(850, 24, -1, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 850) { + _fibre.postInit(); + _fibre.setup(850, 6, 1); + _fibre.setPosition(Common::Point(280, 87)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _eastDoor.setDetails(Rect(289, 53, 315, 125), 850, 6, -1, 8, 1, NULL); + _indicator.setDetails(Rect(275, 67, 286, 79), 850, 18, -1, 20, 1, NULL); + _sickBayIndicator.setDetails(Rect(41, 51, 48, 61), 850, 15, -1, -1, 1, NULL); + _liftControls.setDetails(Rect(156, 32, 166, 44), 850, 21, -1, -1, 1, NULL); + _compartment.setDetails(Rect(4, 88, 153, 167), 850, 12, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 850, 0, -1, -1, 1, NULL); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 250: + _sceneMode = 203; + setAction(&_sequenceManager1, this, 203, &R2_GLOBALS._player, &_liftDoor, NULL); + break; + case 800: + _sceneMode = 205; + setAction(&_sequenceManager1, this, 205, &R2_GLOBALS._player, &_sickBayDoor, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(215, 115)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene850::signal() { + switch (_sceneMode) { + case 202: + R2_GLOBALS._sceneManager.changeScene(250); + break; + case 204: + R2_GLOBALS._sceneManager.changeScene(800); + break; + case 850: + R2_INVENTORY.setObjectScene(R2_CLAMP, 1); + _clamp.remove(); + _object1.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 851: + R2_INVENTORY.setObjectScene(R2_OPTICAL_FIBRE, 1); + _fibre.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 852: + R2_GLOBALS.setFlag(7); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index a0c3f92668..5f2d768f90 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -370,6 +370,45 @@ public: virtual void dispatch(); }; +class Scene850: public SceneExt { + /* Items */ + class Indicator: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class LiftDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class SickBayDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Clamp: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Panel: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _eastDoor, _compartment, _sickBayIndicator; + NamedHotspot _liftControls; + Indicator _indicator; + SceneActor _object1, _fibre; + LiftDoor _liftDoor; + SickBayDoor _sickBayDoor; + Clamp _clamp; + Panel _panel; + SequenceManager _sequenceManager1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3