From cc35c422cb8f152c393627cf3268ee6327c7eb15 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Aug 2013 20:42:13 -0400 Subject: TSAGE: Fixes for speaking to Seeker and donning suit in R2R landing bay --- engines/tsage/core.cpp | 9 ++- engines/tsage/ringworld2/ringworld2_logic.cpp | 5 +- engines/tsage/ringworld2/ringworld2_logic.h | 6 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 46 ++++++------- engines/tsage/ringworld2/ringworld2_scenes0.h | 4 +- engines/tsage/ringworld2/ringworld2_speakers.cpp | 87 +++++++++++++++++++++++- engines/tsage/ringworld2/ringworld2_speakers.h | 2 + 7 files changed, 122 insertions(+), 37 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index b5ec0edbaf..b632aa8e27 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2111,8 +2111,13 @@ int SceneObject::getFrameCount() { void SceneObject::animEnded() { _animateMode = ANIM_MODE_NONE; - if (_endAction) - _endAction->signal(); + if (_endAction) { + Action *endAction = _endAction; + if (g_vm->getGameID() == GType_Ringworld2) + _endAction = NULL; + + endAction->signal(); + } } int SceneObject::changeFrame() { diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index a409a30a86..7104e1f80c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1325,7 +1325,7 @@ GfxSurface SceneActor::getFrame() { /*--------------------------------------------------------------------------*/ -SceneArea::SceneArea(): EventHandler() { +SceneArea::SceneArea(): SceneItem() { _enabled = true; _insideArea = false; _savedCursorNum = CURSOR_NONE; @@ -1429,8 +1429,7 @@ void SceneExit::process(Event &event) { /*--------------------------------------------------------------------------*/ void SceneAreaObject::remove() { - // TODO: This needs to be investigated.. SceneArea doesn't derive from SceneItem?? -// R2_GLOBALS._sceneItems.remove(this); + R2_GLOBALS._sceneItems.remove(this); _object1.remove(); SceneArea::remove(); --R2_GLOBALS._insetUp; diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 1b4b7fca1f..62a596146b 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -42,9 +42,8 @@ public: static Scene *createScene(int sceneNumber); }; -class SceneArea: public EventHandler { +class SceneArea: public SceneItem { public: - Rect _bounds; bool _enabled; bool _insideArea; CursorType _cursorNum; @@ -54,9 +53,12 @@ public: SceneArea(); void setDetails(const Rect &bounds, CursorType cursor); + virtual Common::String getClassName() { return "SceneArea"; } virtual void synchronize(Serializer &s); virtual void remove(); virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event) { return false; } + virtual void doAction(int action) {} }; class SceneExit: public SceneArea { diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 1221e73f5f..10a40388cf 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -4844,17 +4844,18 @@ bool Scene500::ControlPanel::startAction(CursorType action, Event &event) { /*--------------------------------------------------------------------------*/ -bool Scene500::Object2::startAction(CursorType action, Event &event) { +bool Scene500::Seeker::startAction(CursorType action, Event &event) { Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; if (action == CURSOR_TALK) { R2_GLOBALS._player.disableControl(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { scene->_stripNumber = R2_GLOBALS.getFlag(26) ? 1101 : 1103; } else { scene->_stripNumber = R2_GLOBALS.getFlag(26) ? 1102 : 1105; } + scene->_sceneMode = 524; scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); return true; } else { @@ -4873,20 +4874,20 @@ bool Scene500::Suit::startAction(CursorType action, Event &event) { case CURSOR_USE: if (R2_GLOBALS._player._characterIndex == R2_QUINN) { if ((_strip != 3) && (_strip != 7)) - SceneItem::display2(500, _strip); + SceneItem::display2(500, _strip + 25); else if (R2_GLOBALS.getFlag(26)) { R2_GLOBALS._player.disableControl(); scene->_stripNumber = 1103; scene->_sceneMode = 524; - scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 512, &R2_GLOBALS._player, NULL); } else if (!R2_GLOBALS.getFlag(28)) SceneItem::display2(500, 41); - else if (!R2_GLOBALS.getFlag(40)) + else if (!R2_GLOBALS.getFlag(25)) SceneItem::display2(500, 40); else { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 512; - scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, &scene->_suit, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 512, &R2_GLOBALS._player, &scene->_suit, NULL); R2_GLOBALS.setFlag(26); } } else { @@ -4912,12 +4913,7 @@ bool Scene500::Suit::startAction(CursorType action, Event &event) { return true; default: - if (action < R2_LAST_INVENT) { - SceneItem::display2(500, action); - return true; - } else { - return SceneActor::startAction(action, event); - } + return SceneActor::startAction(action, event); } } @@ -4985,7 +4981,7 @@ bool Scene500::AirLock::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = (R2_GLOBALS._player._characterIndex == R2_QUINN) ? 521 : 522; scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, - &scene->_object2, &scene->_airLock, NULL); + &scene->_seeker, &scene->_airLock, NULL); return true; } else { return SceneActor::startAction(action, event); @@ -5222,23 +5218,23 @@ void Scene500::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._walkRegions.disableRegion(1); - _object2.postInit(); - _object2._effect = 1; - _object2.setup(1505, 1, 1); - _object2._moveDiff.x = 5; - _object2.setPosition(Common::Point(42, 151)); - _object2.setDetails(500, 34, 35, 36, 1, (SceneItem *)NULL); + _seeker.postInit(); + _seeker._effect = 1; + _seeker.setup(1505, 1, 1); + _seeker._moveDiff.x = 5; + _seeker.setPosition(Common::Point(42, 151)); + _seeker.setDetails(500, 34, 35, 36, 1, (SceneItem *)NULL); } else if (R2_GLOBALS._player._characterScene[R2_QUINN] == 500) { - _object2.postInit(); - _object2._effect = 1; - _object2.setup(R2_GLOBALS.getFlag(26) ? 1500 : 10, 1, 1); - _object2.setPosition(Common::Point(42, 151)); + _seeker.postInit(); + _seeker._effect = 1; + _seeker.setup(R2_GLOBALS.getFlag(26) ? 1500 : 10, 1, 1); + _seeker.setPosition(Common::Point(42, 151)); R2_GLOBALS._walkRegions.disableRegion(1); R2_GLOBALS._walkRegions.disableRegion(2); R2_GLOBALS._walkRegions.disableRegion(3); - _object2.setDetails(500, 37, 38, -1, 1, (SceneItem *)NULL); + _seeker.setDetails(500, 37, 38, -1, 1, (SceneItem *)NULL); } } @@ -5397,7 +5393,7 @@ void Scene500::signal() { R2_GLOBALS._sceneManager.changeScene(700); break; case 501: - if (R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500) { + if (R2_GLOBALS._player._characterScene[R2_SEEKER] == 500) { _stripNumber = 1100; _sceneMode = 523; setAction(&_sequenceManager1, this, 523, &R2_GLOBALS._player, NULL); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index a3eaf56d16..273c9841fe 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -555,7 +555,7 @@ class Scene500: public SceneExt { }; /* Objects */ - class Object2: public SceneActor { + class Seeker: public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; @@ -602,7 +602,7 @@ public: SceneHotspot _background, _item2; ControlPanel _controlPanel; SceneActor _object1; - Object2 _object2; + Seeker _seeker; Suit _suit; Doorway _doorway; OxygenTanks _tanks1, _tanks2; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 8d91787272..a0b0bd4ddb 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -204,13 +204,12 @@ void VisualSpeaker::setText(const Common::String &msg) { _sceneText._textMode = _textMode; _sceneText.setup(s); - //_sceneText.clone(); - _sceneText.setPosition(_textPos); _sceneText.fixPriority(256); // If subtitles are turned off, don't show the text - if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) { + if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && + !(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) { _sceneText.hide(); } @@ -1173,6 +1172,51 @@ SpeakerQuinn::SpeakerQuinn(): VisualSpeaker() { _numFrames = 0; } +void SpeakerQuinn::proc15() { + int v = _speakerMode; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { + _object2 = &R2_GLOBALS._player; + } else { + assert(R2_GLOBALS._sceneManager._sceneNumber == 500); + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_seeker; + } + + _object2->hide(); + + _object1.postInit(); + _object1._effect = _object2->_effect; + _object1._shade = _object2->_shade; + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + + switch (_object2->_visage) { + case 10: + _object1.setup(4021, (v == 1) ? 5 : 7, 1); + break; + + case 1500: + _object1.setup(4021, (v == 1) ? 1 : 3, 1); + break; + + default: + break; + } + + _object1.animate(ANIM_MODE_5, this); + } +} + void SpeakerQuinn300::proc15() { int v = _speakerMode; @@ -1944,6 +1988,43 @@ SpeakerSeeker::SpeakerSeeker(): VisualSpeaker() { _numFrames = 0; } +void SpeakerSeeker::proc15() { + int v = _speakerMode; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { + _object2 = &R2_GLOBALS._player; + } else { + assert(R2_GLOBALS._sceneManager._sceneNumber == 500); + Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_seeker; + } + + _object2->hide(); + _object1.postInit(); + + _object1._effect = _object2->_effect; + _object1._shade = _object2->_shade; + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + + if (v == 1) + _object1.setup(4041, 3, 1); + else + _object1.setup(4041, 1, 1); + + _object1.animate(ANIM_MODE_5, this); + } +} + void SpeakerSeeker300::proc15() { int v = _speakerMode; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 532e02576c..73e6dcf750 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -274,6 +274,7 @@ class SpeakerQuinn : public VisualSpeaker { public: SpeakerQuinn(); virtual Common::String getClassName() { return "SpeakerQuinn"; } + virtual void proc15(); }; class SpeakerQuinn300 : public SpeakerQuinn { @@ -412,6 +413,7 @@ class SpeakerSeeker : public VisualSpeaker { public: SpeakerSeeker(); virtual Common::String getClassName() { return "SpeakerSeeker"; } + virtual void proc15(); }; class SpeakerSeeker300 : public SpeakerSeeker { -- cgit v1.2.3