diff options
-rw-r--r-- | engines/titanic/true_talk/bellbot_script.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/true_talk/bellbot_script.h | 3 | ||||
-rw-r--r-- | engines/titanic/true_talk/script_support.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/true_talk/script_support.h | 12 |
4 files changed, 41 insertions, 4 deletions
diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 87bdb9373d..7748a9d222 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -50,6 +50,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Bellbot"); _words.load("Words/Bellbot"); _quotes.load("Quotes/Bellbot"); + _states.load("States/Bellbot"); } void BellbotScript::setupSentences() { @@ -294,7 +295,7 @@ int BellbotScript::updateState(int oldId, int newId, int index) { } } - setValue25(newId); + setValue23(newId); return newId; } @@ -423,8 +424,15 @@ int BellbotScript::getStateDialogueId() const { } } -void BellbotScript::setValue25(int id) { - // TODO +void BellbotScript::setValue23(uint id) { + uint val = 0; + for (uint idx = 0; idx < _states.size() && !val; ++idx) { + TTmapEntry &me = _states[idx]; + if (me._src == id) + val = me._dest; + } + + CTrueTalkManager::setFlags(23, val); } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index e3cea8bc54..98dd2c90f0 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -30,6 +30,7 @@ namespace Titanic { class BellbotScript : public TTnpcScript { private: static int _oldId; + TTmapEntries _states; int _array[150]; int _field2D0; int _field2D4; @@ -54,7 +55,7 @@ private: /** * Sets the state value 25 based on the passed Id */ - void setValue25(int id); + void setValue23(uint id); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 3a7c33ead4..17820abf0d 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -179,4 +179,20 @@ void TTupdateStateEntries::load(const char *name) { delete r; } +/*------------------------------------------------------------------------*/ + +void TTmapEntries::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTmapEntry me; + me._src = r->readUint32LE(); + me._dest = r->readUint32LE(); + + push_back(me); + } + + delete r; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 915b9ebb11..7bc9bb8dfa 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -153,6 +153,18 @@ public: void load(const char *name); }; +struct TTmapEntry { + uint _src; + uint _dest; + + TTmapEntry() : _src(0), _dest(0) {} +}; + +class TTmapEntries : public Common::Array<TTmapEntry> { +public: + void load(const char *name); +}; + } // End of namespace Titanic #endif /* TITANIC_TT_NPC_SCRIPT_H */ |