diff options
Diffstat (limited to 'engines/tsage/ringworld2/ringworld2_scenes2.cpp')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes2.cpp | 488 |
1 files changed, 472 insertions, 16 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index a81aee41de..107d7bad04 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -3071,7 +3071,7 @@ void Scene2700::Action4::signal() { void Scene2700::Area1::process(Event &event) { SceneArea::process(event); - if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -3121,7 +3121,7 @@ void Scene2700::Area1::process(Event &event) { void Scene2700::Area2::process(Event &event) { SceneArea::process(event); - if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -3536,7 +3536,7 @@ void Scene2700::signal() { void Scene2700::process(Event &event) { if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN)) { if (R2_GLOBALS._events.getCursor() == R2_36) { - if (R2_GLOBALS._player._bounds.contains(event.mousePos.x, event.mousePos.y)) { + if (R2_GLOBALS._player._bounds.contains(event.mousePos)) { _sceneMode = 10; _field414 = 2710; R2_GLOBALS._player.disableControl(); @@ -3593,38 +3593,38 @@ void Scene2700::process(Event &event) { SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); } } else if (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) { - if (_rect1.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect1.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + if (_rect1.contains(event.mousePos)) { + if (!_rect1.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 1; } - } else if (_rect2.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect2.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect2.contains(event.mousePos)) { + if (!_rect2.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 2; } - } else if (_rect3.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect3.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect3.contains(event.mousePos)) { + if (!_rect3.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 3; } - } else if (_rect4.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect4.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect4.contains(event.mousePos)) { + if (!_rect4.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 4; } - } else if (_rect5.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect5.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect5.contains(event.mousePos)) { + if (!_rect5.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 5; } - } else if (_rect6.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect6.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect6.contains(event.mousePos)) { + if (!_rect6.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 6; @@ -3633,7 +3633,7 @@ void Scene2700::process(Event &event) { event.handled = true; R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); } - if (_sceneMode = 10) { + if (_sceneMode == 10) { R2_GLOBALS._player.disableControl(); switch (_field412) { case 0: @@ -3706,5 +3706,461 @@ void Scene2700::process(Event &event) { Scene::process(event); } +/*-------------------------------------------------------------------------- + * Scene 2750 - Forest Maze + * + *--------------------------------------------------------------------------*/ +Scene2750::Scene2750(): SceneExt() { + _field412 = _field414 = _field416 = 0; +} + +void Scene2750::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); +} + +void Scene2750::Action1::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex) { + case 1: + setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(240)); + _actionIndex = 2; + scene->_actor5.show(); + scene->_actor5.animate(ANIM_MODE_8, 1, NULL); + break; + case 2: + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(600)); + _actionIndex = 0; + scene->_actor5.show(); + scene->_actor3.animate(ANIM_MODE_2, NULL); + break; + default: + setDelay(30); + _actionIndex = 1; + scene->_actor3.animate(ANIM_MODE_6, NULL); + scene->_actor4.animate(ANIM_MODE_8, 1, NULL); + break; + } +} + +void Scene2750::Action2::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor6.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action3::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (scene->_actor7._position.x <= 320) { + setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); + } else { + setDelay(60); + scene->_actor7.setPosition(Common::Point(-10, 25)); + Common::Point pt(330, 45); + NpcMover *mover = new NpcMover(); + scene->_actor7.addMover(mover, &pt, NULL); + } +} + +void Scene2750::Action4::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor8.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action5::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor9.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action6::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor10.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action7::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor11.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Area1::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2752; + switch (scene->_field412) { + case 1: { + scene->_sceneMode = 2752; + scene->setAction(&scene->_sequenceManager, scene, 2752, &R2_GLOBALS._player, NULL); + break; + } + case 2: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2750::Area2::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2753; + switch (scene->_field412) { + case 1: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + scene->_sceneMode = 2753; + scene->setAction(&scene->_sequenceManager, scene, 2753, &R2_GLOBALS._player, NULL); + break; + } + default: + break; + } + } +} + +void Scene2750::postInit(SceneObjectList *OwnerList) { + loadScene(2750); + R2_GLOBALS._sound2.stop(); + SceneExt::postInit(); + _area1.setDetails(Rect(0, 90, 20, 135), EXITCURSOR_W); + _area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E); + + _rect1.set(30, 127, 155, 147); + _rect2.set(130, 142, 210, 167); + _rect3.set(-1, 137, 290, 147); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._sound1.changeSound(235); + _actor2.postInit(); + _actor2.setup(2751, 1, 1); + _actor2.setPosition(Common::Point(104, 158)); + _actor2.animate(ANIM_MODE_2, NULL); + } + + _actor3.postInit(); + _actor3.setup(2750, 1, 1); + _actor3.setPosition(Common::Point(188, 34)); + _actor3.animate(ANIM_MODE_2, NULL); + _actor3._numFrames = 16; + + _actor4.postInit(); + _actor4.setup(2700, 4, 1); + _actor4.setPosition(Common::Point(188, 37)); + _actor4.fixPriority(26); + + _actor5.postInit(); + _actor5.setup(2750, 2, 1); + _actor5.setPosition(Common::Point(188, 34)); + _actor5.hide(); + + _actor3.setAction(&_action1); + + _actor6.postInit(); + _actor6.setup(2750, 3, 1); + _actor6.setPosition(Common::Point(9, 167)); + _actor6.fixPriority(252); + _actor6.setAction(&_action2); + + _actor7.postInit(); + _actor7.setup(2750, 4, 1); + _actor7.setPosition(Common::Point(-10, 25)); + _actor7.animate(ANIM_MODE_1, NULL); + _actor7.setStrip2(4); + _actor7._moveRate = 20; + _actor7.setAction(&_action3); + + _actor8.postInit(); + _actor8.fixPriority(26); + _actor8.setup(2750, 5, 1); + _actor8.setPosition(Common::Point(258, 33)); + _actor8.setAction(&_action4); + + _actor9.postInit(); + _actor9.fixPriority(26); + _actor9.setup(2750, 6, 1); + _actor9.setPosition(Common::Point(61, 38)); + _actor9.setAction(&_action5); + + _actor10.postInit(); + _actor10.fixPriority(26); + _actor10.setup(2750, 7, 1); + _actor10.setPosition(Common::Point(69, 37)); + _actor10.setAction(&_action6); + + _actor11.postInit(); + _actor11.fixPriority(26); + _actor11.setup(2750, 8, 1); + _actor11.setPosition(Common::Point(80, 35)); + _actor11.setAction(&_action7); + + _item2.setDetails(Rect(29, 50, 35, 56), 2750, 3, -1, 5, 1, NULL); + _item3.setDetails(Rect(47, 36, 54, 42), 2750, 3, -1, 5, 1, NULL); + _item4.setDetails(Rect(193, 21, 206, 34), 2750, 3, -1, 5, 1, NULL); + _item5.setDetails(Rect(301, 18, 315, 32), 2750, 3, -1, 5, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2700, 0, -1, 2, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + _actor1.postInit(); + _actor1.setup(2752, 5, 1); + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setPosition(Common::Point(101, 148)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._sceneManager._previousScene == 2700) { + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._player.setVisage(2752); + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + R2_GLOBALS._player.setPosition(Common::Point(81, 165)); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _field416 = 1204; + _sceneMode = 11; + _stripManager.start(_field416, this); + } else { + _sceneMode = 2750; + _field412 = 1; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2750, &R2_GLOBALS._player, NULL); + } + } else if (R2_GLOBALS._sceneManager._previousScene == 2800) { + _sceneMode = 2751; + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2751, &R2_GLOBALS._player, NULL); + } else { + _field412 = 1; + R2_GLOBALS._player.setPosition(Common::Point(90, 137)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} +void Scene2750::signal() { + switch (_sceneMode) { + case 10: + switch (_field414) { + case 1: + switch (_field412) { + case 2: { + _sceneMode = _field414; + _field412 = 1; + Common::Point pt(90, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _field412 = 2; + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2: { + _sceneMode = _field414; + _field412 = 2; + Common::Point pt(170, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + switch (_field412) { + case 1: { + _field412 = 2; + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _sceneMode = _field414; + _field412 = 3; + Common::Point pt(270, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2752: + switch (_field412) { + case 1: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2752, &R2_GLOBALS._player, NULL); + break; + case 2: { + _field412 = 1; + Common::Point pt(20, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _field412 = 2; + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2753: + switch (_field412) { + case 1: { + _field412 = 2; + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _field412 = 3; + Common::Point pt(300, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2753, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + default: + break; + } + break; + case 11: + // No break on purpose + case 2753: + g_globals->_sceneManager.changeScene(2800); + break; + case 2752: + g_globals->_sceneManager.changeScene(2700); + break; + default: + R2_GLOBALS._player.enableControl(R2_NEGATOR_GUN); + break; + } +} + +void Scene2750::process(Event &event) { + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { + if (_rect1.contains(event.mousePos)) { + if (!_rect1.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 1; + } + } else if (_rect2.contains(event.mousePos)) { + if (!_rect2.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 2; + } + } else if (_rect3.contains(event.mousePos)) { + if (!_rect3.contains(R2_GLOBALS._player._position)) { + event.handled = true; + _sceneMode = 10; + _field414 = 3; + } + } else { + event.handled = true; + R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); + } + + if (_sceneMode == 10) { + R2_GLOBALS._player.disableControl(); + switch (_field412) { + case 1: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + if (_field414 == 1) { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + } + } + Scene::process(event); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE |