diff options
author | strangerke | 2011-04-05 20:13:39 +0200 |
---|---|---|
committer | strangerke | 2011-04-05 20:13:39 +0200 |
commit | 2e86dd0e80fa7bc91c1ad86cfb2175352c0f5c5c (patch) | |
tree | 5287322e586fc0129d32af74eb86406fda54c6bb /engines | |
parent | 760c6bea3e5181e9062241d05e1efb8487f2512b (diff) | |
parent | 92aac3addc190f19c4fd063fb825651c9f31f725 (diff) | |
download | scummvm-rg350-2e86dd0e80fa7bc91c1ad86cfb2175352c0f5c5c.tar.gz scummvm-rg350-2e86dd0e80fa7bc91c1ad86cfb2175352c0f5c5c.tar.bz2 scummvm-rg350-2e86dd0e80fa7bc91c1ad86cfb2175352c0f5c5c.zip |
Merge branch 'tsage' of http://github.com/dreammaster/scummvm
Conflicts:
engines/tsage/ringworld_scenes10.cpp
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/core.cpp | 5 | ||||
-rw-r--r-- | engines/tsage/core.h | 5 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.cpp | 33 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.h | 8 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes1.cpp | 104 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes1.h | 6 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes10.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes6.cpp | 443 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes6.h | 74 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 43 | ||||
-rw-r--r-- | engines/tsage/scenes.h | 4 |
11 files changed, 691 insertions, 38 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 06df34ee20..cbe9fd37b2 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -412,6 +412,7 @@ void ObjectMover2::dispatch() { if (area > _maxArea) { // Setup again for the new destination setup(_destObject->_position); + ObjectMover::dispatch(); } else if (area >= _minArea) { // Keep dispatching ObjectMover::dispatch(); @@ -3498,7 +3499,7 @@ void SceneHandler::dispatch() { _globals->_scenePalette.signalListeners(); // Dispatch to any objects registered in the scene - _globals->_sceneObjects->recurse(SceneHandler::handleListener); + _globals->_sceneObjects->recurse(SceneHandler::dispatchObject); // If a scene is active, then dispatch to it if (_globals->_sceneManager._scene) @@ -3520,7 +3521,7 @@ void SceneHandler::dispatch() { _globals->_events.delay(_delayTicks); } -void SceneHandler::handleListener(EventHandler *obj) { +void SceneHandler::dispatchObject(EventHandler *obj) { obj->dispatch(); } diff --git a/engines/tsage/core.h b/engines/tsage/core.h index d55eacb911..a65cec06b9 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -712,12 +712,12 @@ public: class SceneObjectList: public SavedObject { private: void checkIntersection(Common::Array<SceneObject *> &ObjList, uint ObjIndex, int PaneNum); - void sortList(Common::Array<SceneObject *> &ObjList); List<SceneObject *> _objList; bool _listAltered; public: SceneObjectList() { _listAltered = false; } + void sortList(Common::Array<SceneObject *> &ObjList); virtual Common::String getClassName() { return "SceneObjectList"; } virtual void synchronise(Serialiser &s); @@ -904,6 +904,7 @@ class FloatSet { public: double _float1, _float2, _float3, _float4; + FloatSet() { _float1 = _float2 = _float3 = _float4 = 0; } void add(double v1, double v2, double v3); void proc1(double v); double sqrt(FloatSet &floatSet); @@ -943,7 +944,7 @@ public: virtual void process(Event &event); virtual void dispatch(); - static void handleListener(EventHandler *obj); + static void dispatchObject(EventHandler *obj); static void saveListener(Serialiser &ser); }; diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 9c1fcfa890..640a5aabf7 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -137,6 +137,8 @@ Scene *SceneFactory::createScene(int sceneNumber) { case 5100: return new Scene5100(); // Caverns - Throne-room case 5200: return new Scene5200(); + // Caverns - Pit + case 5300: return new Scene5300(); /* Scene group 8 */ // Scene 7000: Landing @@ -1122,4 +1124,35 @@ void SpeakerFLL::setText(const Common::String &msg) { Speaker::setText(msg); } +/*--------------------------------------------------------------------------*/ + +SpeakerBatR::SpeakerBatR() { + _speakerName = "BATR"; + _newSceneNumber = 5360; + _textPos = Common::Point(140, 40); + _colour1 = 3; +} + +void SpeakerBatR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(5361); + _object1.setStrip2(2); + _object1.setPriority2(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(137, 122)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(5361); + _object2.setStrip2(1); + _object2.setPriority2(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(137, 104)); + _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 281833fc38..fd3264e403 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -389,6 +389,14 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerBatR: public AnimatedSpeaker { +public: + SpeakerBatR(); + + virtual Common::String getClassName() { return "SpeakerBatR"; } + 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 23cbad9994..65a574c912 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -2846,7 +2846,7 @@ void Scene6100::Action3::signal() { break; case 1: _globals->_scenePalette.clearListeners(); - scene->_field_310 = 0; + scene->_fadePercent = 0; _globals->_scenePalette.refresh(); scene->loadScene(9997); scene->_object1.flag100(); @@ -2900,17 +2900,15 @@ void Scene6100::Action5::dispatch() { FloatSet floatSet = _globals->_floatSet; const double MULTIPLY_FACTOR = 0.01744; - // TODO: Method backs up 32 bytes at dseg:195Ah - - if (scene->_field_30A) { - scene->_field_30C = scene->_field_30A % 360; + if (scene->_turnAmount) { + scene->_angle = (scene->_turnAmount + scene->_angle) % 360; for (int objIndex = 1; objIndex <= 3; ++objIndex) { SceneObject *obj = &scene->_object1; if (objIndex == 2) obj = &scene->_object2; if (objIndex == 3) obj = &scene->_object3; - obj->_position.x += scene->_field_30A * 2; + obj->_position.x += scene->_turnAmount * 2; if (obj->_position.x >= 320) obj->_position.x -= 480; if (obj->_position.x < -160) @@ -2924,11 +2922,11 @@ void Scene6100::Action5::dispatch() { double v2, v3; v2 = scene->_field_30E; - v3 = scene->_field_30C * MULTIPLY_FACTOR; + v3 = (double)scene->_angle * MULTIPLY_FACTOR; scene->_object5._floats._float1 += sin(v3) * v2; v2 = scene->_field_30E; - v3 = scene->_field_30C * MULTIPLY_FACTOR; + v3 = scene->_angle * MULTIPLY_FACTOR; scene->_object5._floats._float2 += cos(v3) * v2; for (int idx = 0; idx < 4; ++idx) { @@ -2936,7 +2934,7 @@ void Scene6100::Action5::dispatch() { tempSet.add(scene->_object5._floats._float1, scene->_object5._floats._float2, scene->_object5._floats._float3); - tempSet.proc1(scene->_field_30C * MULTIPLY_FACTOR); + tempSet.proc1(scene->_angle * MULTIPLY_FACTOR); double sqrtVal = tempSet.sqrt(floatSet); if (sqrtVal != 0.0) { @@ -2947,7 +2945,7 @@ void Scene6100::Action5::dispatch() { scene->_objList[idx]->_position.x = static_cast<int>( (tempSet._float2 + 330.0) / 330.0 * tempSet._float1 - 160.0); - if (tempSet._float2 >= 0) { + if (tempSet._float2 < 0) { scene->_objList[idx]->_position.y = 300; if (idx != 3) { @@ -2957,7 +2955,7 @@ void Scene6100::Action5::dispatch() { _globals->_randomSource.getRandomNumber(999) + 750.0; scene->_objList[idx]->_floats.proc1( - -(scene->_field_30A * 10 + scene->_field_30C) * MULTIPLY_FACTOR); + -(scene->_turnAmount * 10 + scene->_angle) * MULTIPLY_FACTOR); scene->_objList[idx]->_floats.add(scene->_object5._floats._float1, scene->_object5._floats._float2, scene->_object5._floats._float3); @@ -2973,7 +2971,7 @@ void Scene6100::Action5::dispatch() { scene->_objList[idx]->_flags |= OBJFLAG_PANES; - if ((idx != 3) && (scene->_field_310 == 100) && + if ((idx != 3) && (scene->_fadePercent == 100) && (tempSet.sqrt(floatSet) < 150.0)) { switch (scene->_field_312++) { case 1: @@ -3002,7 +3000,7 @@ void Scene6100::Action5::dispatch() { } _globals->_scenePalette.clearListeners(); - scene->_field_310 = 0; + scene->_fadePercent = 0; } } } @@ -3012,7 +3010,7 @@ void Scene6100::Action6::signal() { switch (_actionIndex++) { case 0: { - scene->_field_30A = 0; + scene->_turnAmount = 0; Common::Point pt(scene->_object4._position.x, scene->_object4._position.y + 10); NpcMover *mover = new NpcMover(); scene->_object5.addMover(mover, &pt, NULL); @@ -3146,11 +3144,12 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { } _field_30E = 30; - _field_310 = 100; + _fadePercent = 100; _field_314 = 0; _field_312 = 0; - _field_30A = 0; - _field_30C = 0; + _turnAmount = 0; + _angle = 0; + _msgActive = false; setAction(&_action5); _globals->_scenePalette.addRotation(96, 143, -1); @@ -3161,15 +3160,78 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _globals->_soundHandler.startSound(231); } -void Scene6100::showMessage(const Common::String &msg, int colour, Action *action) { - static bool msgActive = false; +void Scene6100::remove() { + _globals->_player.disableControl(); + _globals->_scenePalette.clearListeners(); + Scene::remove(); +} + +void Scene6100::process(Event &event) { + Scene::process(event); + + if (event.eventType == EVENT_KEYPRESS) { + // Handle incremental turning speeds with arrow keys + if ((event.kbd.keycode == Common::KEYCODE_LEFT) || (event.kbd.keycode == Common::KEYCODE_KP4)) { + _turnAmount = MAX(_turnAmount - 1, -8); + } else if ((event.kbd.keycode == Common::KEYCODE_RIGHT) || (event.kbd.keycode == Common::KEYCODE_KP6)) { + _turnAmount = MIN(_turnAmount + 1, -8); + } + } + + if (_object5._action) + _object5._action->process(event); +} + +void Scene6100::dispatch() { + Scene::dispatch(); + + if (_object5._action) + _object5._action->dispatch(); - if (msgActive) { - msgActive = false; + // Handle mouse controlling the turning + int changeAmount = (_globals->_events._mousePos.x - 160) / -20; + _turnAmount += (changeAmount - _turnAmount) / 2; + + if (_fadePercent < 100) { + _fadePercent += 10; + if (_fadePercent >= 100) { + _globals->_scenePalette.addRotation(96, 143, -1); + _fadePercent = 100; + } + + byte adjustData[] = {0xff, 0xff, 0xff, 0}; + _globals->_scenePalette.fade(adjustData, false, _fadePercent); + } + + if (_action != &_action3) { + // Display the distance remaining to the target + int distance = _object5._floats.sqrt(_object4._floats); + Common::String s = Common::String::format("%06lu", distance); + + _sceneText.setPosition(Common::Point(24, 160)); + _sceneText._fontNumber = 0; + _sceneText._colour1 = 35; + _sceneText.setup(s); + } + + if (_field_314) { + if (_action == &_action5) { + double distance = _object5._floats.sqrt(_object4._floats); + + if ((distance >= 300.0) && (distance <= 500.0)) + setAction(&_action6); + } + } +} + +void Scene6100::showMessage(const Common::String &msg, int colour, Action *action) { + if (_msgActive) { + _msgActive = false; _speaker1.removeText(); } if (!msg.empty()) { + _msgActive = true; _speaker1._textPos.x = 20; _speaker1._textWidth = 280; _speaker1._colour1 = colour; diff --git a/engines/tsage/ringworld_scenes1.h b/engines/tsage/ringworld_scenes1.h index 01b7fcf5c1..95cf603728 100644 --- a/engines/tsage/ringworld_scenes1.h +++ b/engines/tsage/ringworld_scenes1.h @@ -538,11 +538,15 @@ public: SceneText _sceneText; SceneItem _item1; - int _field_30A, _field_30C, _field_30E, _field_310; + int _turnAmount, _angle, _field_30E, _fadePercent; int _field_312, _field_314; Object *_objList[4]; + bool _msgActive; virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void process(Event &event); + virtual void dispatch(); void showMessage(const Common::String &msg, int colour, Action *action); }; diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index 0db015c8d6..4985d3f78d 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -37,12 +37,10 @@ Scene2::Scene2() { } void Object9350::postInit(SceneObjectList *OwnerList) { - warning("Object9350::postInit - Weird cast to be verified"); - SceneObject::postInit((SceneObjectList*) &_globals->_sceneManager._sceneChangeListeners); + _globals->_sceneManager.postInit(&_globals->_sceneManager._altSceneObjects); } void Object9350::draw() { - warning("Scene9350::Object1::draw - TODO"); reposition(); Rect destRect = _bounds; destRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y); diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp index a630a9486c..a39f5d84b3 100644 --- a/engines/tsage/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld_scenes6.cpp @@ -1727,4 +1727,447 @@ void Scene5200::dispatch() { } } +/*-------------------------------------------------------------------------- + * Scene 5300 - Caverns - Pit + * + *--------------------------------------------------------------------------*/ + +void Scene5300::Action1::signal() { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->_player.disableControl(); + setDelay(3); + break; + case 1: + scene->_hotspot2._numFrames = 4; + scene->_hotspot2.animate(ANIM_MODE_8, 1, NULL); + setDelay(120); + break; + case 2: + scene->_hotspot2.animate(ANIM_MODE_NONE, NULL); + + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.setStrip2(-1); + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + ADD_MOVER(_globals->_player, 85, 170); + break; + case 3: + scene->_hotspot2.setPriority2(-1); + _globals->_player.checkAngle(&scene->_hotspot2); + setAction(&scene->_sequenceManager, this, 5305, &scene->_hotspot2, NULL); + break; + case 4: + scene->_stripManager.start(5316, this); + break; + case 5: + if (!_globals->getFlag(106) || !_globals->getFlag(107) || (_globals->_inventory._stasisBox._sceneNumber != 1)) { + _globals->_player.enableControl(); + remove(); + } else { + _globals->getFlag(60); + + if (_globals->getFlag(67)) { + scene->_sceneMode = 5310; + scene->setAction(&scene->_sequenceManager, scene, 5310, &_globals->_player, &scene->_hotspot2, NULL); + } else { + scene->_sceneMode = 5347; + scene->setAction(&scene->_sequenceManager, scene, 5347, NULL); + } + } + break; + } +} + +void Scene5300::Action2::signal() { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->_player.disableControl(); + setDelay(60); + break; + case 1: + _globals->setFlag(60); + scene->_stripManager.start(5328, this); + break; + case 2: + if (_globals->_inventory._stasisBox._sceneNumber == 1) { + _globals->_stripNum = 5303; + setDelay(5); + } else { + _globals->_stripNum = 5302; + scene->_stripManager.start(5329, this); + } + break; + case 3: + _globals->_sceneManager.changeScene(5100); + remove(); + break; + } +} + +void Scene5300::Action3::signal() { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (_actionIndex++) { + case 0: + _globals->_player.disableControl(); + setDelay(30); + break; + case 1: + scene->_stripManager.start(_globals->_stripNum, this); + break; + case 2: + _globals->_player.enableControl(); + remove(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene5300::Hotspot1::doAction(int action) { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5300, 24); + break; + case CURSOR_TALK: + _globals->_stripNum = 5312; + scene->setAction(&scene->_action3); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5300::Hotspot2::doAction(int action) { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5300, 23); + break; + case CURSOR_USE: + if (!_globals->getFlag(106)) { + _globals->_player.disableControl(); + scene->_sceneMode = 5302; + scene->setAction(&scene->_sequenceManager, scene, 5302, &_globals->_player, NULL); + } else { + SceneItem::display2(5300, _globals->getFlag(107) ? 25 : 20); + } + break; + case CURSOR_TALK: + if (!_globals->getFlag(106)) { + _globals->_player.disableControl(); + scene->_sceneMode = 5302; + scene->setAction(&scene->_sequenceManager, scene, 5302, &_globals->_player, NULL); + } else if (!_globals->getFlag(107)) { + SceneItem::display2(5300, 11); + } else { + _globals->_player.disableControl(); + + if (_globals->_inventory._stasisBox._sceneNumber != 1) { + scene->setAction(&scene->_sequenceManager, scene, 5316, NULL); + } else { + _globals->setFlag(60); + scene->_sceneMode = _globals->getFlag(67) ? 5315 : 5347; + scene->setAction(&scene->_sequenceManager, scene, 5315, this); + } + } + break; + case OBJECT_SCANNER: + SceneItem::display2(5300, _globals->getFlag(107) ? 10 : 9); + break; + case OBJECT_MEDKIT: + if (_globals->getFlag(106)) + SceneItem::display2(5300, 7); + else { + _globals->setFlag(106); + _globals->_player.disableControl(); + + scene->_sceneMode = 5303; + scene->setAction(&scene->_sequenceManager, scene, 5303, &_globals->_player, NULL); + } + break; + case OBJECT_VIAL: + if (_globals->getFlag(107)) { + SceneItem::display2(5300, 8); + } else { + _globals->_inventory._vial._sceneNumber = 5300; + _globals->setFlag(107); + _globals->_player.disableControl(); + scene->_sceneMode = 5304; + + scene->setAction(&scene->_sequenceManager, scene, 5304, &_globals->_player, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5300::Hotspot5::doAction(int action) { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5300, 27); + break; + case CURSOR_USE: + _globals->_inventory._bone._sceneNumber = 1; + _globals->_player.disableControl(); + + scene->_sceneMode = 5309; + scene->setAction(&scene->_sequenceManager, scene, 5309, &_globals->_player, this, NULL); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5300::Hotspot6::doAction(int action) { + Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber == 1)) + SceneItem::display2(5300, 4); + else + SceneItem::display2(5300, 26); + break; + case CURSOR_USE: + if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber != 5100)) { + _globals->_player.disableControl(); + scene->_sceneMode = 5301; + scene->setAction(&scene->_sequenceManager, scene, 5301, &_globals->_player, NULL); + } else { + _globals->_player.disableControl(); + scene->_sceneMode = 5307; + _globals->_inventory._vial._sceneNumber = 1; + + scene->setAction(&scene->_sequenceManager, scene, 5307, &scene->_hotspot1, &_globals->_player, + &scene->_hotspot4, NULL); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5300::Hotspot7::doAction(int action) { + switch (action) { + case CURSOR_LOOK: + if (_globals->getFlag(63)) + SceneItem::display2(5300, 2); + else { + _globals->setFlag(63); + SceneItem::display2(5300, 0); + SceneItem::display2(5300, 1); + } + break; + case CURSOR_USE: + if (_globals->getFlag(64)) + SceneItem::display2(5300, 15); + else { + _globals->setFlag(64); + SceneItem::display2(5300, 14); + } + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void Scene5300::Hotspot8::doAction(int action) { + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(5300, _globals->getFlag(65) ? 6 : 5); + break; + case CURSOR_USE: + SceneItem::display2(5300, 18); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene5300::Scene5300(): + _hotspot3(0, CURSOR_LOOK, 5300, 3, CURSOR_USE, 5300, 16, LIST_END) { +} + +void Scene5300::postInit(SceneObjectList *OwnerList) { + Scene::postInit(); + loadScene(5300); + setZoomPercents(0, 100, 199, 100); + + _stripManager.addSpeaker(&_speakerQR); + _stripManager.addSpeaker(&_speakerQL); + _stripManager.addSpeaker(&_speakerBatR); + _stripManager.addSpeaker(&_speakerSR); + _stripManager.addSpeaker(&_speakerSL); + _stripManager.addSpeaker(&_speakerQText); + _stripManager.addSpeaker(&_speakerBatText); + _stripManager.addSpeaker(&_speakerSText); + _stripManager.addSpeaker(&_speakerGameText); + + if (_globals->getFlag(106) && _globals->getFlag(107)) { + _hotspot2.postInit(); + _hotspot2.setVisage(2806); + _hotspot2.setObjectWrapper(new SceneObjectWrapper()); + _hotspot2.setPosition(Common::Point(63, 170)); + _hotspot2.animate(ANIM_MODE_1, NULL); + } else { + _hotspot2.postInit(); + _hotspot2.setVisage(5310); + _hotspot2.setPosition(Common::Point(63, 170)); + _hotspot2.animate(ANIM_MODE_1, NULL); + _hotspot2.setPriority2(98); + } + + _hotspot1.postInit(); + _hotspot1.setVisage(5362); + _hotspot1.setStrip2(3); + _hotspot1.setFrame2(5); + _hotspot1.setPosition(Common::Point(76, 48)); + + _hotspot4.postInit(); + _hotspot4.setVisage(5316); + _hotspot4.setStrip(2); + _hotspot4.setPosition(Common::Point(89, 65)); + _hotspot4.animate(ANIM_MODE_2, NULL); + _hotspot4.flag100(); + + if (_globals->getFlag(67)) { + _globals->_player.postInit(); + _globals->_player.setVisage(5316); + _globals->_player.setPosition(Common::Point(191, 27)); + _globals->_player.disableControl(); + + if (_globals->getFlag(107) && _globals->getFlag(106)) { + _hotspot2.postInit(); + _hotspot2.setObjectWrapper(new SceneObjectWrapper()); + _hotspot2.animate(ANIM_MODE_1, NULL); + + setAction(&_action2); + } else { + _globals->_player.setVisage(5315); + _globals->_player.setPosition(Common::Point(204, 86)); + _globals->_player.animate(ANIM_MODE_2, NULL); + _globals->_player.setStrip2(1); + _globals->_player._moveDiff.y = 12; + + _sceneMode = 5308; + setAction(&_sequenceManager, this, 5308, &_globals->_player, NULL); + } + } else { + _hotspot3.postInit(); + _hotspot3.setVisage(5301); + _hotspot3.setPosition(Common::Point(172, 32)); + _hotspot3.setPriority2(1); + _hotspot3.animate(ANIM_MODE_NONE, NULL); + + _globals->_player.postInit(); + _globals->_player.setVisage(5315); + _globals->_player.setPosition(Common::Point(204, 86)); + _globals->_player.animate(ANIM_MODE_2, NULL); + _globals->_player.setStrip2(1); + _globals->_player._moveDiff.y = 12; + _globals->_player.disableControl(); + + _sceneMode = 5306; + setAction(&_sequenceManager, this, 5306, &_globals->_player, &_hotspot3, NULL); + } + + _field1B0A = 1; + if (_globals->_inventory._bone._sceneNumber == 5300) { + _hotspot5.postInit(); + _hotspot5.setVisage(5301); + _hotspot5.setStrip(2); + _hotspot5.setPosition(Common::Point(190, 147)); + _globals->_sceneItems.push_back(&_hotspot5); + } + + _hotspot6.setBounds(Rect(74, 51, 114, 69)); + _hotspot7.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + _hotspot8._sceneRegionId = 8; + + _globals->_sceneItems.addItems(&_hotspot8, &_hotspot2, &_hotspot6, &_hotspot3, &_hotspot7, NULL); + _globals->_soundHandler.startSound(212); +} + +void Scene5300::signal() { + switch (_sceneMode) { + case 5301: + _globals->_stripNum = 5300; + _globals->_sceneManager.changeScene(5100); + break; + case 5302: + case 5308: + case 5316: + case 5347: + _globals->_player.setStrip2(-1); + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.enableControl(); + break; + case 5303: + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.enableControl(); + + if (_globals->getFlag(107)) + setAction(&_action1); + else + SceneItem::display2(5300, 28); + break; + case 5304: + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.enableControl(); + + if (_globals->getFlag(106)) + setAction(&_action1); + else + SceneItem::display2(5300, 28); + break; + case 5306: + _globals->clearFlag(67); + _globals->_player.setStrip2(-1); + + if ((_globals->_inventory._vial._sceneNumber == 1) || (_globals->_inventory._vial._sceneNumber == 5300)) + _stripManager.start(5303, this); + else + _stripManager.start(5302, this); + _sceneMode = 5302; + break; + case 5307: + _soundHandler.proc1(NULL); + break; + case 5309: + _hotspot5.remove(); + _globals->_player.enableControl(); + break; + case 5310: + _hotspot2.setPriority2(41); + _sceneMode = 5315; + + setAction(&_sequenceManager, this, 5315, &_hotspot2, NULL); + break; + case 5315: + _globals->_stripNum = 5315; + _globals->_sceneManager.changeScene(5100); + break; + } +} + + } // End of namespace tSage diff --git a/engines/tsage/ringworld_scenes6.h b/engines/tsage/ringworld_scenes6.h index f9d519f4ce..9ab446f712 100644 --- a/engines/tsage/ringworld_scenes6.h +++ b/engines/tsage/ringworld_scenes6.h @@ -253,6 +253,80 @@ public: virtual void dispatch(); }; +class Scene5300: 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(); + }; + + /* Hotspots */ + class Hotspot1: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot2: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot5: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot6: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot7: public SceneObject { + public: + virtual void doAction(int action); + }; + class Hotspot8: public SceneObject { + public: + virtual void doAction(int action); + }; +public: + SoundHandler _soundHandler; + SequenceManager _sequenceManager; + SpeakerQR _speakerQR; + SpeakerQL _speakerQL; + SpeakerQText _speakerQText; + SpeakerBatR _speakerBatR; + SpeakerBatText _speakerBatText; + SpeakerSR _speakerSR; + SpeakerSL _speakerSL; + SpeakerSText _speakerSText; + SpeakerGameText _speakerGameText; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Hotspot1 _hotspot1; + Hotspot2 _hotspot2; + DisplayHotspot _hotspot3; + SceneObject _hotspot4; + Hotspot5 _hotspot5; + Hotspot6 _hotspot6; + Hotspot7 _hotspot7; + Hotspot8 _hotspot8; + int _field1B0A; + + Scene5300(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void synchronise(Serialiser &s) { + Scene::synchronise(s); + s.syncAsSint16LE(_field1B0A); + } +}; + } // End of namespace tSage diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index de5fe1e5cb..ad6d1f9620 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -54,7 +54,7 @@ void SceneManager::checkScene() { _nextSceneNumber = -1; } - _globals->_sceneListeners.forEach(SceneHandler::handleListener); + _globals->_sceneListeners.forEach(SceneHandler::dispatchObject); } void SceneManager::sceneChange() { @@ -70,8 +70,13 @@ void SceneManager::sceneChange() { sceneObj->removeObject(); } - // Clear the scene change listeners - _globals->_sceneManager._sceneChangeListeners.clear(); + // Clear the secondary scene object list + io = _globals->_sceneManager._altSceneObjects.begin(); + while (io != _globals->_sceneManager._altSceneObjects.end()) { + SceneObject *sceneObj = *io; + ++io; + sceneObj->removeObject(); + } // Clear the hotspot list List<SceneItem *>::iterator ii = _globals->_sceneItems.begin(); @@ -204,7 +209,7 @@ void SceneManager::setBgOffset(const Common::Point &pt, int loadCount) { void SceneManager::listenerSynchronise(Serialiser &s) { s.validate("SceneManager"); - _sceneChangeListeners.synchronise(s); + _altSceneObjects.synchronise(s); s.syncAsSint32LE(_sceneNumber); if (s.isLoading()) { @@ -398,12 +403,36 @@ void Scene::refreshBackground(int xAmount, int yAmount) { } if (changedFlag) { - signalListeners(); + drawAltObjects(); } } -void Scene::signalListeners() { - // TODO: Figure out method +void Scene::drawAltObjects() { + Common::Array<SceneObject *> objList; + + // Initial loop to set the priority for entries in the list + for (List<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin(); + i != _globals->_sceneManager._altSceneObjects.end(); ++i) { + SceneObject *obj = *i; + objList.push_back(obj); + + // Handle updating object priority + if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) { + obj->_priority = MIN((int)obj->_position.y - 1, + (int)_globals->_sceneManager._scene->_backgroundBounds.bottom); + } + } + + // Sort the list by priority + _globals->_sceneManager._altSceneObjects.sortList(objList); + + // Drawing loop + for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) { + SceneObject *obj = objList[objIndex]; + + obj->reposition(); + obj->draw(); + } } void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent) { diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 85e7c7251e..9d969c906b 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -36,7 +36,7 @@ namespace tSage { class Scene: public StripCallback { private: - void signalListeners(); + void drawAltObjects(); public: int _field12; int _sceneNumber; @@ -87,7 +87,7 @@ public: Common::Point _sceneBgOffset; int _sceneLoadCount; Rect _scrollerRect; - List<EventHandler *> _sceneChangeListeners; + SceneObjectList _altSceneObjects; public: SceneManager(); virtual ~SceneManager(); |