From a3e5c990058e780c9eb92c2fc7b6f13caa0ca14a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Jul 2013 22:24:25 -0400 Subject: TSAGE: Fixes for R2R extended conversations --- engines/tsage/converse.cpp | 39 +++++++++++++++--------- engines/tsage/converse.h | 1 + engines/tsage/ringworld2/ringworld2_speakers.cpp | 6 ++-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 82feb314e6..7e6c1b30d5 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -724,14 +724,24 @@ void StripManager::synchronize(Serializer &s) { } void StripManager::remove() { + if (g_vm->getGameID() == GType_Ringworld2) { + for (int i = 0; i < _speakerList.size(); ++i) { + if (_activeSpeaker != _speakerList[i]) + _speakerList[i]->proc16(); + } + } + if (_textShown) { if (_activeSpeaker) _activeSpeaker->removeText(); _textShown = false; } - if (_activeSpeaker) + if (_activeSpeaker) { + if (g_vm->getGameID() == GType_Ringworld2) + static_cast(_activeSpeaker)->_speakerMode = 0xff; _activeSpeaker->remove(); + } if (_sceneNumber != g_globals->_sceneManager._scene->_screenNumber) { g_globals->_sceneManager._scene->_sceneBounds = _sceneBounds; @@ -776,9 +786,7 @@ void StripManager::signal() { Obj44 &obj44 = _obj44List[_obj44Index]; - if (g_vm->getGameID() != GType_Ringworld2) { - _field2E8 = obj44._id; - } else { + if (g_vm->getGameID() == GType_Ringworld2) { // Return to Ringworld specific handling if (obj44._field6) _field2E8 = obj44._field6; @@ -797,22 +805,27 @@ void StripManager::signal() { break; } } - + + _field2E8 = obj44._id; Common::StringArray choiceList; // Build up a list of script entries int idx; + bool delayFlag = false; if ((g_vm->getGameID() == GType_Ringworld2) && obj44._field16[0]) { // Special loading mode used in Return to Ringworld for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) { int f16Index = _lookupList[obj44._field16[0] - 1]; - Obj0A &entry = obj44._list[obj44._field16[f16Index]]; - if (!entry._id) - break; + int entryId = obj44._field16[f16Index]; - // Get the next one - choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); + Obj0A &entry = obj44._list[idx]; + if (entry._id == entryId) { + // Get the next one + choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); + delayFlag = true; + break; + } } } else { // Standard choices loading @@ -853,8 +866,6 @@ void StripManager::signal() { if (!obj44._list[listIdx + 1]._id) obj44._list[listIdx]._id = 0; } - - continue; } } } @@ -870,7 +881,7 @@ void StripManager::signal() { // Get the user to select a conversation option strIndex = _choiceDialog.execute(choiceList); - if ((choiceList.size() != 1) && !_field2E6) + if ((delayFlag || choiceList.size() != 1) && !_field2E6) _delayFrames = 1; else { Speaker *speakerP = getSpeaker((const char *)&_script[0] + obj44._speakerOffset); @@ -904,7 +915,7 @@ void StripManager::signal() { if (speaker) { speaker->_speakerMode = obj44._speakerMode; - if (choiceList[strIndex].empty()) + if (!choiceList[strIndex].empty()) speaker->proc15(); } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index af0b3b8808..00c1f44051 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -94,6 +94,7 @@ public: virtual void proc12(Action *action); virtual void setText(const Common::String &msg); virtual void removeText(); + virtual void proc16() {} void setTextPos(const Common::Point &pt) { _textPos = pt; } }; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index bff61bafc4..b8d593b90a 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -252,8 +252,8 @@ void VisualSpeaker::proc16() { _speakerMode = 0; _object1.remove(); - assert(_object2); - _object2->show(); + if (_object2) + _object2->show(); _object2 = NULL; _fieldF8 = 0; } @@ -1948,7 +1948,7 @@ void SpeakerSeeker300::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) { + if (R2_GLOBALS._player._characterIndex == 2) { _object2 = &R2_GLOBALS._player; } else { Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; -- cgit v1.2.3