diff options
author | Paul Gilbert | 2016-07-27 19:41:07 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-27 19:41:07 -0400 |
commit | 8cc9142a92298dbf16f438dcf36d3e4d74e3d9f9 (patch) | |
tree | 4b387022e1236501b7cbb53bbd50274b224ebb5c /engines | |
parent | 2457340315e73617b6a9a1a37e28628aacfde45c (diff) | |
download | scummvm-rg350-8cc9142a92298dbf16f438dcf36d3e4d74e3d9f9.tar.gz scummvm-rg350-8cc9142a92298dbf16f438dcf36d3e4d74e3d9f9.tar.bz2 scummvm-rg350-8cc9142a92298dbf16f438dcf36d3e4d74e3d9f9.zip |
TITANIC: Renaming for NPC state methods
Diffstat (limited to 'engines')
22 files changed, 88 insertions, 49 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 7a20ee44ad..11197220fa 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -74,7 +74,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, addResponse(STATE_ARRAY[_state++]); } else { selectResponse(51896); - set34(1); + setState(1); _state = 0; } @@ -202,8 +202,8 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { CTrueTalkManager::setFlags(33, getValue(33) - 1); CTrueTalkManager::setFlags(34, getValue(34) - 1); - int val34 = get34(); - set34(0); + int val34 = getState(); + setState(0); int val2C = sentence->_field2C; bool flag = val2C == 11 || val2C == 13; @@ -533,7 +533,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { case 59: if (flag) { if (addRandomResponse(true)) { - set34(59); + setState(59); return 2; } } else if (flag2) { @@ -542,7 +542,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { break; case 60: if (flag && addRandomResponse(true)) { - set34(59); + setState(59); return 2; } else if (flag2 || val2C == 7 || val2C == 10) { return applySentenceIds(getDialogueId(251712)); @@ -613,7 +613,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { done: // Adjust primary dial - set34(0); + setState(0); if (sentence->get58() != 5) { adjustDial(0, sentence->get58() * 4 - 20); } else if (getDialLevel(0, false) > 65) { @@ -809,7 +809,7 @@ ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint i addResponse(getDialogueId(250577)); applyResponse(); } else { - set34(57); + setState(57); } break; @@ -964,7 +964,7 @@ int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int BarbotScript::proc21(int v1, int v2, int v3) { +int BarbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } @@ -987,7 +987,7 @@ uint BarbotScript::getDialsBitset() const { } int BarbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { - int v34 = get34(); + int v34 = getState(); uint id = 0; if (v34 > 0x200) { @@ -1150,13 +1150,13 @@ int BarbotScript::applySentenceIds(int dialogueId, int v34) { applyResponse(); if (v34 != -1) { - set34(v34); + setState(v34); } else { for (uint idx = 0; idx < _mappings.size(); ++idx) { const TTscriptMapping &m = _mappings[idx]; for (int vidx = 0; vidx < _mappings._valuesPerMapping; ++idx) { if (m._values[vidx] == (uint)dialogueId) { - proc21(m._id, m._id, vidx); + updateState(m._id, m._id, vidx); break; } } @@ -1171,7 +1171,7 @@ int BarbotScript::setResponse(int dialogueId, int state) { applyResponse(); if (state != -1) - set34(state); + setState(state); return 2; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 977d0a1d6b..dff72d579a 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -73,7 +73,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 988efa940b..573015c943 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -182,7 +182,7 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int BellbotScript::proc21(int v1, int v2, int v3) { +int BellbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 704bce815e..235076832f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -58,7 +58,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index a95e4dffb7..e1c596bf6b 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -180,7 +180,7 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } -int DeskbotScript::proc21(int v1, int v2, int v3) { +int DeskbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index efe71de7e2..1481cdd54c 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -56,7 +56,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index bd654fcc0e..4f74b19463 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -83,7 +83,7 @@ int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence applyResponse(); if (STATE_ARRAY[_state] == 11826) - set34(1); + setState(1); ++_state; return 2; } @@ -250,7 +250,7 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int DoorbotScript::proc21(int v1, int v2, int v3) { +int DoorbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } @@ -363,9 +363,9 @@ int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, } break; case 17: - if (get34()) + if (getState()) return 1; - set34(0); + setState(0); break; case 18: if (roomScript->_scriptId == 100) { @@ -468,7 +468,7 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { applyResponse(); if (v34 != -1) - set34(v34); + setState(v34); return 2; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 3d2fdfdc26..db81882af5 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -72,7 +72,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 30016ac1ac..6e7d16a66b 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -60,7 +60,7 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence case MKTAG('A', 'N', 'S', 'W'): if (_state >= 7) { selectResponse(30918); - set34(2); + setState(2); _state = 0; } else { addResponse(STATE_ARRAY[_state++]); @@ -208,7 +208,7 @@ int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int LiftbotScript::proc21(int v1, int v2, int v3) { +int LiftbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } @@ -244,7 +244,7 @@ int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, 0, 210849, 210850, 210851, 210852, 210838, 210839, 210840, 210841, 0 }; - get34(); + getState(); int stateVal; switch (val1) { @@ -362,7 +362,7 @@ int LiftbotScript::addDialogueAndState(int id, int state) { applyResponse(); if (state != 1) - set34(state); + setState(state); return 2; } @@ -400,14 +400,14 @@ int LiftbotScript::addResponse1(int index, bool flag, int id) { if (index >= 2 && index <= 19 && stateVal > 1) { addResponse(getDialogueId(210203)); applyResponse(); - set34(7); + setState(7); return true; } if (index >= 20 && index <= 27 && stateVal > 2) { addResponse(getDialogueId(210210)); applyResponse(); - set34(8); + setState(8); return true; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index ba917f41c2..3aa620db36 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -69,7 +69,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 86862a7037..d1d6424c18 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -184,7 +184,7 @@ int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int MaitreDScript::proc21(int v1, int v2, int v3) { +int MaitreDScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 178979c614..5937b7d740 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -55,7 +55,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 23ecf35290..51e88ec3ea 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -88,7 +88,7 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip int canProcess = 0; if (result) { - sentence->set34(result); + sentence->setState(result); if (roomScript->canRespond(npcScript, sentence, result)) { canProcess = npcScript->chooseResponse(roomScript, sentence, result); } diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 876cd163bb..b1e4351ee5 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -84,7 +84,7 @@ ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int SuccUBusScript::proc21(int v1, int v2, int v3) { +int SuccUBusScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 9e393b84b2..ba8bc610bf 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -54,7 +54,11 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 3301926231..88afb6f28b 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -132,7 +132,7 @@ public: void setFlag(bool val) { _flag = val; } void set1C(int val) { _field1C = val; } int get20() const { return _field20; } - int get34() const { return _field34; } + int getState() const { return _field34; } bool checkWordId1() const; bool checkWordId2() const; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 3e8564c46c..1c133bd7c8 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -372,8 +372,8 @@ void TTnpcScript::resetRange(int id) { range->_priorIndex = 0; } -int TTnpcScript::proc21(int v1, int v2, int v3) { - return v2; +int TTnpcScript::updateState(int oldId, int newId, int index) { + return newId; } int TTnpcScript::proc22(int id) const { @@ -638,7 +638,7 @@ uint TTnpcScript::getDialogueId(uint tagId) { tagId = getRangeValue(tagId); oldTagId = getDialsBitset(); - uint newId = proc21(origId, tagId, oldTagId); + uint newId = updateState(origId, tagId, oldTagId); if (!newId) return 0; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 819de77311..1353dcdfe8 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -256,7 +256,11 @@ public: */ virtual void resetRange(int id); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index c6a197a8a4..e96f877810 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -26,12 +26,12 @@ namespace Titanic { -TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, +TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int state, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), _status(0), _nodesP(nullptr), _id(0), _hist1P(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), - _field30(0), _field34(0), _hist2P(nullptr), _field3C(0), + _field30(0), _state(0), _hist2P(nullptr), _field3C(0), _respHeadP(nullptr), _respTailP(nullptr), _oldResponseP(nullptr) { if (!isValid()) { if (!v7 || !getStatus()) { @@ -41,7 +41,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, _field28 = v5; _field2C = v6; _field30 = v7; - _field34 = v2; + _state = state; } else { _status = 5; } @@ -79,7 +79,7 @@ void TTscriptBase::reset() { _field28 = -1; _field2C = -1; _field30 = 0; - _field34 = 0; + _state = 0; _hist2P = nullptr; _field3C = 0; _respHeadP = nullptr; diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index e94bab3277..3060602d1b 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -48,7 +48,7 @@ protected: int _field28; int _field2C; int _field30; - int _field34; + int _state; TThist *_hist2P; int _field3C; TTresponse *_respHeadP; @@ -72,8 +72,15 @@ protected: appendResponse(val1, val2, str); } - void set34(int val) { _field34 = val; } - int get34() const { return _field34; } + /** + * Set the script state + */ + void setState(int state) { _state = state; } + + /** + * Get the current state + */ + int getState() const { return _state; } public: int _id; public: diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 56ccc5ab04..467f6a188a 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -258,7 +258,7 @@ int TTsentence::is1C(int val, const TTconceptNode *node) const { bool TTsentence::isConcept34(int slotIndex, TTconceptNode *node) { TTconcept *concept = getFrameEntry(slotIndex, node); - return concept && concept->get34(); + return concept && concept->getState(); } bool TTsentence::localWord(const char *str) const { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 2e40dd7e93..2900a4d4b3 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -74,7 +74,7 @@ public: TTsentence(const TTsentence *src); ~TTsentence(); - void set34(int v) { _field34 = v; } + void setState(int v) { _field34 = v; } void set38(int v) { _field38 = v; } bool check2C() const { return _field2C > 1 && _field2C <= 10; } int concept18(TTconceptNode *conceptNode) { |