diff options
author | Paul Gilbert | 2016-06-10 23:28:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:23:10 -0400 |
commit | 840557236c7f9f3e4e10b586781a36eb712b7de3 (patch) | |
tree | fffcad6a8a069dc959e4c680eee2224f389aca69 /engines/titanic/true_talk/tt_npc_script.cpp | |
parent | ab55958319e285781e086ad2edc28297fce65a3d (diff) | |
download | scummvm-rg350-840557236c7f9f3e4e10b586781a36eb712b7de3.tar.gz scummvm-rg350-840557236c7f9f3e4e10b586781a36eb712b7de3.tar.bz2 scummvm-rg350-840557236c7f9f3e4e10b586781a36eb712b7de3.zip |
TITANIC: Add loading of NPC tag maps, TTnpcScript translateId method
Diffstat (limited to 'engines/titanic/true_talk/tt_npc_script.cpp')
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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; } |