From 8320a556d4f2d90aede5a8a8a4ae13bd213927dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Jul 2013 10:35:56 -0400 Subject: TSAGE: Added R2R conversation dialog text and removal code --- engines/tsage/converse.cpp | 41 +++++++++++++++++++++++++++++++++++------ engines/tsage/converse.h | 1 + 2 files changed, 36 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 8fc25f9a6d..76ccb70441 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -429,10 +429,12 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { // Set up the list of choices int yp = 0; + int xp = (g_vm->getGameID() == GType_Ringworld2) ? 40 : 25; + for (uint idx = 0; idx < choiceList.size(); ++idx) { Rect tempRect; _gfxManager._font.getStringBounds(choiceList[idx].c_str(), tempRect, 265); - tempRect.moveTo(25, yp + 10); + tempRect.moveTo(xp, yp + 10); _choiceList.push_back(ChoiceEntry(choiceList[idx], tempRect)); yp += tempRect.height() + 5; @@ -537,6 +539,18 @@ void ConversationChoiceDialog::draw() { _gfxManager.deactivate(); } +void ConversationChoiceDialog::remove() { + if (_savedArea) { + // Restore the area the dialog covered + Rect tempRect = _bounds; + tempRect.collapse(-10, -10); + g_globals->_gfxManagerInstance.copyFrom(*_savedArea, tempRect.left, tempRect.top); + + delete _savedArea; + _savedArea = NULL; + } +} + /*--------------------------------------------------------------------------*/ void Obj44::load(const byte *dataP) { @@ -891,13 +905,26 @@ void StripManager::signal() { if (g_vm->getGameID() == GType_Ringworld2) { Ringworld2::VisualSpeaker *speaker = static_cast(_activeSpeaker); - speaker->_speakerMode = obj44._speakerMode; - if (_obj44List.size() > 0) + + if (speaker) { + speaker->_speakerMode = obj44._speakerMode; + if (choiceList[strIndex].empty()) + speaker->proc15(); + } + + if (!choiceList[strIndex].empty()) { + _textShown = true; + _activeSpeaker->setText(choiceList[strIndex]); + } else if (!obj44._speakerMode) { + _delayFrames = 1; + } else { + _delayFrames = 0; speaker->proc15(); + } + } else { + _textShown = true; + _activeSpeaker->setText(choiceList[strIndex]); } - - _textShown = true; - _activeSpeaker->setText(choiceList[strIndex]); } _obj44Index = getNewIndex(obj44._list[strIndex]._id); @@ -965,6 +992,8 @@ Speaker *StripManager::getSpeaker(const char *speakerName) { int StripManager::getNewIndex(int id) { if (id == 10000) return id; + if ((g_vm->getGameID() == GType_Ringworld2) && (id < 0)) + return id; for (uint idx = 0; idx < _obj44List.size(); ++idx) { if (_obj44List[idx]._id == id) { diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 66e9982762..7f30e963ec 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -164,6 +164,7 @@ public: int execute(const Common::StringArray &choiceList); virtual void draw(); + virtual void remove(); }; class Obj0A : public Serialisable { -- cgit v1.2.3