diff options
author | Paul Gilbert | 2016-06-01 21:59:34 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:18:52 -0400 |
commit | 4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2 (patch) | |
tree | ea88a607b71d2989ac6ea0d606782b28d0faf41a /engines/titanic | |
parent | 01020dcd8ca0ab8d930a9c2f1452e50cc2721ed5 (diff) | |
download | scummvm-rg350-4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2.tar.gz scummvm-rg350-4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2.tar.bz2 scummvm-rg350-4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2.zip |
TITANIC: Further npc scripts chooseResponse methods
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/true_talk/barbot_script.cpp | 28 | ||||
-rw-r--r-- | engines/titanic/true_talk/barbot_script.h | 7 | ||||
-rw-r--r-- | engines/titanic/true_talk/doorbot_script.cpp | 71 | ||||
-rw-r--r-- | engines/titanic/true_talk/doorbot_script.h | 6 |
4 files changed, 110 insertions, 2 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index d47d2b5341..ed7e083897 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -25,13 +25,36 @@ namespace Titanic { +static const int STATE_ARRAY[7] = { + 0xCAB0, 0xCAB2, 0xCAB3, 0xCAB4, 0xCAB5, 0xCAB6, 0xCAB7 +}; + BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + _state = 0; load("Responses/Barbot"); } int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { + if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || + tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { + if (_state < 7) { + addResponse(STATE_ARRAY[_state++]); + } else { + proc14(51896); + set34(1); + _state = 0; + } + + applyResponse(); + return 2; + } + + if (tag == MKTAG('S', 'W', 'E', 'R')) { + + } + warning("TODO"); return SS_2; } @@ -107,4 +130,9 @@ uint BarbotScript::translateId(uint id) const { return 0; } +void BarbotScript::adjustDial(int dialNum, int amount) { + int level = CLIP(getDialLevel(dialNum) + amount, 0, 100); + setDial(dialNum, level); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 9f3860448e..4aaa5f5a40 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -28,6 +28,13 @@ namespace Titanic { class BarbotScript : public TTnpcScript { +private: + int _state; +private: + /** + * Adjust a given dial number by a given delta amount + */ + void adjustDial(int dialNum, int amount); public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 9c8c686c51..aec067e19e 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -22,18 +22,76 @@ #include "common/textconsole.h" #include "titanic/true_talk/doorbot_script.h" +#include "titanic/true_talk/tt_room_script.h" namespace Titanic { +static const int STATE_ARRAY[9] = { + 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 +}; + DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + Common::fill(&_array[0], &_array[148], 0); + _state = 0; load("Responses/Doorbot"); } int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return SS_2; + if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || + tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { + if (_state > 9) + _state = 0; + addResponse(STATE_ARRAY[_state]); + applyResponse(); + + if (STATE_ARRAY[_state] == 11826) + set34(1); + ++_state; + return 2; + } + + if (tag == MKTAG('C', 'H', 'S', 'E') || tag == MKTAG('C', 'M', 'N', 'T') || + tag == MKTAG('J', 'F', 'O', 'D')) + tag = MKTAG('F', 'O', 'O', 'D'); + + if (tag == MKTAG('F', 'O', 'O', 'D') && roomScript->_scriptId == 132) { + return setResponse(getDialogueId(220818)); + } + + if (tag == MKTAG('T', 'R', 'A', 'V')) { + return setResponse(11858 - getRandomBit()); + } else if (tag == MKTAG('C', 'S', 'P', 'Y')) { + return setResponse(10405, 3); + } else if (tag == MKTAG('S', 'C', 'I', 'T')) { + return setResponse(10410, 14); + } else if (tag == MKTAG('L', 'I', 'T', 'E')) { + return setResponse(10296, 17); + } else if (tag == MKTAG('D', 'O', 'R', '1')) { + return setResponse(getDialogueId(222034)); + } else if (tag == MKTAG('W', 'T', 'H', 'R')) { + return setResponse(getDialogueId(222126)); + } else if (tag == MKTAG('N', 'A', 'U', 'T')) { + return setResponse(getDialogueId(222259)); + } else if (tag == MKTAG('T', 'R', 'A', '2')) { + return setResponse(getRandomBit() ? 11860 : 11859); + } else if (tag == MKTAG('T', 'R', 'A', '3')) { + return setResponse(getRandomBit() ? 11859 : 11858); + } else if (tag == MKTAG('B', 'R', 'N', 'D')) { + switch (getRandomNumber(3)) { + case 1: + tag = MKTAG('B', 'R', 'N', '2'); + break; + case 2: + tag = MKTAG('B', 'R', 'N', '3'); + break; + default: + break; + } + } + + return TTnpcScript::chooseResponse(roomScript, sentence, tag); } void DoorbotScript::proc7(int v1, int v2) { @@ -107,4 +165,13 @@ uint DoorbotScript::translateId(uint id) const { return 0; } +int DoorbotScript::setResponse(int dialogueId, int v34) { + addResponse(dialogueId); + applyResponse(); + + if (v34 != -1) + set34(v34); + return 2; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index d00e5b19ef..5158eecb36 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -30,6 +30,12 @@ namespace Titanic { class DoorbotScript : public TTnpcScript { private: int _array[148]; + int _state; +private: + /** + * Sets a response + */ + int setResponse(int dialogueId, int v34 = -1); public: DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); |