diff options
author | Paul Gilbert | 2013-07-25 21:57:42 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-07-25 21:57:42 -0400 |
commit | bfcebeac7d755a0e6700448604b7a51f3b8ec672 (patch) | |
tree | 91c5f8295e2243a2496bea523225740da27e1b08 /engines | |
parent | e19656464c779558a8bc201cb97b924edcf91ea1 (diff) | |
download | scummvm-rg350-bfcebeac7d755a0e6700448604b7a51f3b8ec672.tar.gz scummvm-rg350-bfcebeac7d755a0e6700448604b7a51f3b8ec672.tar.bz2 scummvm-rg350-bfcebeac7d755a0e6700448604b7a51f3b8ec672.zip |
TSAGE: Added new R2R conversation decoding logic
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/converse.cpp | 70 | ||||
-rw-r--r-- | engines/tsage/converse.h | 3 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 16 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 8 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.h | 2 |
6 files changed, 75 insertions, 28 deletions
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index bae0249eaa..8fc25f9a6d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -416,7 +416,7 @@ SequenceManager *SequenceManager::globalManager() { ConversationChoiceDialog::ConversationChoiceDialog() { _stdColor = 23; _highlightColor = g_globals->_scenePalette._colors.background; - _fontNumber = 1; + _fontNumber = (g_vm->getGameID() == GType_Ringworld2) ? 3 : 1; _savedFgColor = _savedFontNumber = 0; _selectedIndex = 0; } @@ -513,7 +513,11 @@ void ConversationChoiceDialog::draw() { // Fill in the contents of the entire dialog _gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - drawFrame(); + + if (g_vm->getGameID() == GType_Ringworld2) + GfxElement::drawFrame(); + else + drawFrame(); _gfxManager._bounds = tempRect; _gfxManager._font._colors.foreground = _stdColor; @@ -551,8 +555,8 @@ void Obj44::load(const byte *dataP) { _callbackId[idx] = s.readSint16LE(); if (g_vm->getGameID() == GType_Ringworld2) { - _field16 = s.readSint16LE(); - s.skip(20); + for (int i = 0; i < 11; ++i) + _field16[i] = s.readSint16LE(); } else { s.skip(4); } @@ -580,7 +584,9 @@ void Obj44::synchronize(Serializer &s) { s.syncAsSint16LE(_lookupIndex); s.syncAsSint16LE(_field6); s.syncAsSint16LE(_speakerMode); - s.syncAsSint16LE(_field16); + + for (int i = 0; i < 11; ++i) + s.syncAsSint16LE(_field16[i]); } } @@ -787,25 +793,65 @@ void StripManager::signal() { // Build up a list of script entries int idx; - if (g_vm->getGameID() == GType_Ringworld2 && obj44._field16) { + 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 objIndex = _lookupList[obj44._field16 - 1]; - - if (!obj44._list[objIndex]._id) + int f16Index = _lookupList[obj44._field16[0] - 1]; + Obj0A &entry = obj44._list[obj44._field16[f16Index]]; + if (!entry._id) break; // Get the next one - choiceList.push_back((const char *)&_script[0] + obj44._list[objIndex]._scriptOffset); + choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); } } else { // Standard choices loading - for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) { + for (idx = 0; idx < OBJ0A_LIST_SIZE; ++idx) { if (!obj44._list[idx]._id) break; // Get the next one - choiceList.push_back((const char *)&_script[0] + obj44._list[idx]._scriptOffset); + const char *choiceStr = (const char *)&_script[0] + obj44._list[idx]._scriptOffset; + + if (!*choiceStr) { + // Choice is empty + assert(g_vm->getGameID() == GType_Ringworld2); + + if (obj44._list[1]._id) { + // it's a reference to another list slot + int listId = obj44._list[idx]._id; + + int obj44Idx = 0; + while (_obj44List[obj44Idx]._id != listId) + ++obj44Idx; + + if (_obj44List[obj44Idx]._field16[0]) { + int f16Index = _lookupList[_obj44List[obj44Idx]._field16[0] - 1]; + listId = _obj44List[obj44Idx]._field16[f16Index]; + + if (_lookupList[_obj44List[obj44Idx]._field16[0] - 1]) { + int listIdx = 0; + while (_obj44List[obj44Idx]._list[listIdx]._id != listId) + ++listIdx; + + choiceStr = (const char *)&_script[0] + _obj44List[obj44Idx]._list[listIdx]._scriptOffset; + } else { + for (int listIdx = 0; listIdx < OBJ0A_LIST_SIZE; ++listIdx) { + obj44._list[listIdx]._id = obj44._list[listIdx + 1]._id; + obj44._list[listIdx]._scriptOffset = obj44._list[listIdx + 1]._scriptOffset; + + if (!obj44._list[listIdx + 1]._id) + obj44._list[listIdx]._id = 0; + } + + continue; + } + } + } + } + + // Add entry to the list + choiceList.push_back(choiceStr); } } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index accd2d49cd..66e9982762 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -190,7 +190,8 @@ public: // Return to Ringworld specific field int _mode; int _lookupValue, _lookupIndex, _field6; - int _speakerMode, _field16; + int _speakerMode; + int _field16[11]; public: void load(const byte *dataP); virtual void synchronize(Serializer &s); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 70749f6883..ac6ba523f6 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2115,11 +2115,11 @@ void AnimationPlayerExt::synchronize(Serializer &s) { /*--------------------------------------------------------------------------*/ -ModalDialog::ModalDialog() { +ModalWindow::ModalWindow() { _field20 = 0; } -void ModalDialog::remove() { +void ModalWindow::remove() { R2_GLOBALS._sceneItems.remove(&_object1); _object1.remove(); @@ -2128,13 +2128,13 @@ void ModalDialog::remove() { --R2_GLOBALS._insetUp; } -void ModalDialog::synchronize(Serializer &s) { +void ModalWindow::synchronize(Serializer &s) { SceneArea::synchronize(s); s.syncAsByte(_field20); } -void ModalDialog::process(Event &event) { +void ModalWindow::process(Event &event) { if (_field20 != R2_GLOBALS._insetUp) return; @@ -2157,7 +2157,7 @@ void ModalDialog::process(Event &event) { } } -void ModalDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { +void ModalWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; _object1.postInit(); @@ -2170,7 +2170,7 @@ void ModalDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, _field20 = R2_GLOBALS._insetUp; } -void ModalDialog::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { +void ModalWindow::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { _object1.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -2426,7 +2426,7 @@ void ScannerDialog::remove() { _obj6.remove(); _obj7.remove(); - ModalDialog::remove(); + ModalWindow::remove(); } void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { @@ -2435,7 +2435,7 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX R2_GLOBALS._player.addMover(NULL); R2_GLOBALS._events.setCursor(CURSOR_USE); - ModalDialog::proc12(visage, stripFrameNum, frameNum, posX, posY); + ModalWindow::proc12(visage, stripFrameNum, frameNum, posX, posY); proc13(100, -1, -1, -1); _talkButton.setup(1); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 42ca071e33..2cf48f3cf3 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -446,22 +446,22 @@ public: virtual void synchronize(Serializer &s); }; -class ModalDialog: public SceneArea { +class ModalWindow: public SceneArea { public: SceneActor _object1; byte _field20; public: - ModalDialog(); + ModalWindow(); virtual void remove(); virtual void synchronize(Serializer &s); - virtual Common::String getClassName() { return "ModalDialog"; } + virtual Common::String getClassName() { return "ModalWindow"; } virtual void process(Event &event); virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; -class ScannerDialog: public ModalDialog { +class ScannerDialog: public ModalWindow { class Button: public SceneActor { private: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index ef53ddf302..840172335f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2597,8 +2597,8 @@ void Scene250::synchronize(Serializer &s) { } void Scene250::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(250); + SceneExt::postInit(); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.setVisage(10); @@ -3050,7 +3050,7 @@ bool Scene300::Seeker::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - if (R2_GLOBALS.getFlag(44)) { + if (!R2_GLOBALS.getFlag(44)) { if (!R2_GLOBALS.getFlag(38)) { R2_GLOBALS._sound1.play(69); scene->_stripId = 181; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index a2865a4b94..0da6b3f93d 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -120,7 +120,7 @@ public: class Scene1200 : public SceneExt { enum CrawlDirection { CRAWL_EAST = 1, CRAWL_WEST = 2, CRAWL_SOUTH = 3, CRAWL_NORTH = 4 }; - class LaserPanel: public ModalDialog { + class LaserPanel: public ModalWindow { public: class Jumper : public SceneActorExt { public: |