TTIANIC: Added support methods for BellbotScript updateState

This commit is contained in:
Paul Gilbert 2016-07-27 23:04:26 -04:00
parent 875a9998c5
commit a185a99a86
4 changed files with 41 additions and 4 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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 */