diff options
-rw-r--r-- | engines/titanic/true_talk/barbot_script.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/barbot_script.h | 2 | ||||
-rw-r--r-- | engines/titanic/true_talk/bellbot_script.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/bellbot_script.h | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/deskbot_script.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/deskbot_script.h | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/doorbot_script.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/doorbot_script.h | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/liftbot_script.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/liftbot_script.h | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/maitred_script.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/maitred_script.h | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 20 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.h | 12 |
14 files changed, 38 insertions, 37 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index a864107e91..7cc1e0a698 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -49,6 +49,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Barbot"); loadResponses("Responses/Barbot"); setupSentences(); + _tagMappings.load("TagMap/Barbot"); } void BarbotScript::setupSentences() { @@ -255,11 +256,6 @@ int BarbotScript::proc36(int tagId) const { return 0; } -uint BarbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - void BarbotScript::adjustDial(int dialNum, int amount) { int level = CLIP(getDialLevel(dialNum) + amount, 0, 100); setDial(dialNum, level); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index d49cf59a54..4232102371 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -72,8 +72,6 @@ public: virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; - - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index ddb7e04b44..fa00718ed8 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -42,6 +42,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Bellbot"); loadResponses("Responses/Bellbot", 4); setupSentences(); + _tagMappings.load("TagMap/Bellbot"); } void BellbotScript::setupSentences() { @@ -110,9 +111,4 @@ int BellbotScript::proc36(int id) const { return 0; } -uint BellbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 1c027e733a..f13b1b2abe 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -58,7 +58,6 @@ public: virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 0b8c7e247d..c323c7c55e 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -43,6 +43,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Deskbot"); loadResponses("Responses/Deskbot", 4); setupSentences(); + _tagMappings.load("TagMap/Deskbot"); } void DeskbotScript::setupSentences() { @@ -111,11 +112,6 @@ int DeskbotScript::proc36(int id) const { return 0; } -uint DeskbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - void DeskbotScript::proc38() { warning("TODO"); } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 0012cf7bc1..b75abaa4d5 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -53,7 +53,6 @@ public: virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; - virtual uint translateId(uint id) const; virtual void proc38(); virtual void proc39(); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7e0181308f..bfa1ba9181 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -37,6 +37,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); setupSentences(); + _tagMappings.load("TagMap/Doorbot"); } void DoorbotScript::setupSentences() { @@ -169,11 +170,6 @@ int DoorbotScript::proc36(int id) const { return 0; } -uint DoorbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - int DoorbotScript::setResponse(int dialogueId, int v34) { addResponse(dialogueId); applyResponse(); diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 912e881792..ef14cf7e59 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -65,7 +65,6 @@ public: virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index b96f485ea9..cabfe41734 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -38,6 +38,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Liftbot"); loadResponses("Responses/Liftbot"); setupSentences(); + _tagMappings.load("TagMap/Liftbot"); } void LiftbotScript::setupSentences() { @@ -141,9 +142,4 @@ void LiftbotScript::proc32() { warning("TODO"); } -uint LiftbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index f3704e128b..39ff9bbc52 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -60,7 +60,6 @@ public: virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 2497fd83fb..b5d5e3abeb 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -41,6 +41,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, loadRanges("Ranges/MaitreD"); loadResponses("Responses/MaitreD"); setupSentences(); + _tagMappings.load("TagMap/MaitreD"); } void MaitreDScript::setupSentences() { @@ -110,9 +111,4 @@ int MaitreDScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsenten void MaitreDScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } -uint MaitreDScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index ea3aaee782..0c96434ed4 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -55,7 +55,6 @@ public: virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 070ecbb583..d7fc34f4e6 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -124,6 +124,21 @@ void TTscriptMappings::load(const char *name, int valuesPerMapping) { /*------------------------------------------------------------------------*/ +void TTtagMappings::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + uint src = r->readUint32LE(); + uint dest = r->readUint32LE(); + + push_back(TTtagMapping(src, dest)); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), @@ -489,6 +504,11 @@ int TTnpcScript::proc36(int id) const { } uint TTnpcScript::translateId(uint id) const { + for (uint idx = 0; idx < _tagMappings.size(); ++idx) { + if (_tagMappings[idx]._src == id) + return _tagMappings[idx]._dest; + } + return 0; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index be96cf9738..d2a53287c0 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -109,6 +109,17 @@ public: void load(const char *name, int valuesPerMapping); }; +struct TTtagMapping { + uint _src, _dest; + TTtagMapping() : _src(0), _dest(0) {} + TTtagMapping(uint src, uint dest) : _src(src), _dest(dest) {} +}; + +class TTtagMappings : public Common::Array<TTtagMapping> { +public: + void load(const char *name); +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -153,6 +164,7 @@ protected: Common::Array<TTscriptRange> _ranges; TTscriptMappings _mappings; TTsentenceEntries _entries; + TTtagMappings _tagMappings; int _entryCount; int _field68; int _field6C; |