diff options
-rw-r--r-- | engines/tsage/events.h | 3 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 38 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 6 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 154 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.h | 37 |
5 files changed, 220 insertions, 18 deletions
diff --git a/engines/tsage/events.h b/engines/tsage/events.h index 2ffa862ca6..541da00147 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -92,6 +92,9 @@ enum CursorType { R2_43 = 43, R2_44 = 44, R2_45 = 45, R2_46 = 46, R2_47 = 47, R2_48 = 48, R2_49 = 49, R2_50 = 50, R2_51 = 51, R2_52 = 52, + // Ringworld 2 cursors + CURSOR_3 = 3, CURSOR_9 = 9, CURSOR_10 = 10, + // Cursors CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800, CURSOR_1000 = 0x1000, CURSOR_PRINTER = 0x4000, CURSOR_EXIT = 0x7004, CURSOR_9999 = 9999, diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 6a390df611..942d1e451f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -46,7 +46,10 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 160: case 175: case 180: + error("Missing scene %d from group 0", sceneNumber); case 200: + // Ship Corridor + return new Scene200(); case 205: case 250: error("Missing scene %d from group 0", sceneNumber); @@ -937,7 +940,7 @@ void SceneArea::process(Event &event) { R2_GLOBALS._events.setCursor(_cursorNum); } _insideArea = true; - } else if ((event.mousePos.y < 171) && _insideArea && (_cursorNum != cursor) && + } else if ((event.mousePos.y < 171) && _insideArea && (_cursorNum == cursor) && (_savedCursorNum != CURSOR_NONE)) { // Cursor moved outside bounded area R2_GLOBALS._events.setCursor(_savedCursorNum); @@ -980,21 +983,26 @@ void SceneExit::process(Event &event) { if (!R2_GLOBALS._insetUp) { SceneArea::process(event); - if (_enabled && (event.eventType == EVENT_BUTTON_DOWN)) { - if (!_bounds.contains(event.mousePos)) - _moving = 0; - else if (!R2_GLOBALS._player._canWalk) { - _moving = 0; - changeScene(); - event.handled = true; - } else { - Common::Point dest((_destPos.x == -1) ? event.mousePos.x : _destPos.x, - (_destPos.y == -1) ? event.mousePos.y : _destPos.y); - ADD_PLAYER_MOVER(dest.x, dest.y); - - _moving = true; - event.handled = true; + if (_enabled) { + if (event.eventType == EVENT_BUTTON_DOWN) { + if (!_bounds.contains(event.mousePos)) + _moving = false; + else if (!R2_GLOBALS._player._canWalk) { + _moving = false; + changeScene(); + event.handled = true; + } else { + Common::Point dest((_destPos.x == -1) ? event.mousePos.x : _destPos.x, + (_destPos.y == -1) ? event.mousePos.y : _destPos.y); + ADD_PLAYER_MOVER(dest.x, dest.y); + + _moving = true; + event.handled = true; + } } + + if (_moving && (_bounds.contains(R2_GLOBALS._player._position) || (R2_GLOBALS._player._position == _destPos))) + changeScene(); } } } diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 152e6f8518..9eaa1b0cd1 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -66,9 +66,9 @@ public: Common::Point _destPos; public: SceneExit(); - void setDetails(const Rect &bounds, CursorType cursor, int sceneNumber); - void setDest(const Common::Point &p) { _destPos = p; } - void changeScene(); + virtual void setDetails(const Rect &bounds, CursorType cursor, int sceneNumber); + virtual void setDest(const Common::Point &p) { _destPos = p; } + virtual void changeScene(); virtual void synchronize(Serializer &s); virtual void process(Event &event); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 4df081d0cb..5db5ee011c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1199,6 +1199,160 @@ Common::String Scene125::parseMessage(const Common::String &msg) { } /*-------------------------------------------------------------------------- + * Scene 200 - Ship Corridor + * + *--------------------------------------------------------------------------*/ + +bool Scene200::NorthDoor::startAction(CursorType action, Event &event) { + Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 202; + scene->setAction(&scene->_sequenceManager, scene, 202, &R2_GLOBALS._player, this, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene200::EastDoor::startAction(CursorType action, Event &event) { + Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 200; + scene->setAction(&scene->_sequenceManager, scene, 200, &R2_GLOBALS._player, this, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene200::WestDoor::startAction(CursorType action, Event &event) { + Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 204; + scene->setAction(&scene->_sequenceManager, scene, 204, &R2_GLOBALS._player, this, NULL); + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene200::EastExit::changeScene() { + Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 206; + scene->setAction(&scene->_sequenceManager, scene, 206, &R2_GLOBALS._player, NULL); +} + +void Scene200::WestExit::changeScene() { + Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 208; + scene->setAction(&scene->_sequenceManager, scene, 208, &R2_GLOBALS._player, NULL); +} + +/*--------------------------------------------------------------------------*/ + +void Scene200::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(200); + + _westExit.setDetails(Rect(94, 0, 123, 58), CURSOR_9, 175); + _westExit.setDest(Common::Point(125, 52)); + _eastExit.setDetails(Rect(133, 0, 167, 58), CURSOR_10, 150); + _eastExit.setDest(Common::Point(135, 52)); + + _northDoor.postInit(); + _northDoor.setVisage(200); + _northDoor.setPosition(Common::Point(188, 79)); + _northDoor.setDetails(200, 3, -1, -1, 1, NULL); + + _eastDoor.postInit(); + _eastDoor.setVisage(200); + _eastDoor.setStrip(2); + _eastDoor.setPosition(Common::Point(305, 124)); + _eastDoor.setDetails(200, 6, -1, -1, 1, NULL); + + _westDoor.postInit(); + _westDoor.setVisage(200); + _westDoor.setStrip(3); + _westDoor.setPosition(Common::Point(62, 84)); + _westDoor.setDetails(200, 9, -1, -1, 1, NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _compartment.setDetails(Rect(4, 88, 153, 167), 200, 12, -1, -1, 1, NULL); + _westDoorDisplay.setDetails(Rect(41, 51, 48, 61), 200, 15, -1, -1, 1, NULL); + _eastDoorDisplay.setDetails(Rect(279, 67, 286, 78), 200, 18, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 200, 0, -1, -1, 1, NULL); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 100: + _sceneMode = 201; + setAction(&_sequenceManager, this, 201, &R2_GLOBALS._player, &_eastDoor, NULL); + break; + case 150: + _sceneMode = 207; + setAction(&_sequenceManager, this, 207, &R2_GLOBALS._player, NULL); + break; + case 175: + _sceneMode = 209; + setAction(&_sequenceManager, this, 209, &R2_GLOBALS._player, NULL); + break; + case 250: + _sceneMode = 203; + setAction(&_sequenceManager, this, 203, &R2_GLOBALS._player, &_northDoor, NULL); + break; + case 400: + _sceneMode = 205; + setAction(&_sequenceManager, this, 205, &R2_GLOBALS._player, &_westDoor, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(215, 115)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene200::signal() { + switch (_sceneMode) { + case 200: + R2_GLOBALS._sceneManager.changeScene(100); + break; + case 202: + R2_GLOBALS._sceneManager.changeScene(250); + break; + case 204: + R2_GLOBALS._sceneManager.changeScene(400); + break; + case 206: + R2_GLOBALS._sceneManager.changeScene(150); + break; + case 208: + R2_GLOBALS._sceneManager.changeScene(175); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +/*-------------------------------------------------------------------------- * Scene 300 - Bridge * *--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index c207118372..4d2c454c4e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -157,6 +157,43 @@ public: Common::String parseMessage(const Common::String &msg); }; +class Scene200: public SceneExt { + /* Objects */ + class NorthDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class EastDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class WestDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Scene Exits */ + class EastExit: public SceneExit { + public: + virtual void changeScene(); + }; + class WestExit: public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _background, _compartment, _westDoorDisplay, _eastDoorDisplay; + NorthDoor _northDoor; + EastDoor _eastDoor; + WestDoor _westDoor; + EastExit _eastExit; + WestExit _westExit; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + class Scene300: public SceneExt { /* Actions */ class Action1: public Action { |