From c0de794584e1e4689db48eb1c94dc9d9aa7726c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 07:59:44 -0500 Subject: TITANIC: Added stubs for the different script classes --- engines/titanic/true_talk/doorbot_script.cpp | 103 +++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 engines/titanic/true_talk/doorbot_script.cpp (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp new file mode 100644 index 0000000000..4bca9a6491 --- /dev/null +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -0,0 +1,103 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/textconsole.h" +#include "titanic/true_talk/doorbot_script.h" + +namespace Titanic { + +int DoorbotScript::proc6() const { + warning("TODO"); + return 2; +} + +void DoorbotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int DoorbotScript::proc10() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc15() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc16() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc17() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc18() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc22() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc23() const { + warning("TODO"); + return 0; +} + +void DoorbotScript::proc24() { + warning("TODO"); +} + +int DoorbotScript::proc25() const { + warning("TODO"); + return 0; +} + +void DoorbotScript::proc26() { +} + +void DoorbotScript::proc32() { + warning("TODO"); +} + +int DoorbotScript::proc36() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc37() const { + warning("TODO"); + return 0; +} + +} // End of namespace Titanic -- cgit v1.2.3 From bc1585ccee0fe156a4f6d2e6e721c606ac6dd8a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 18:21:12 -0400 Subject: TITANIC: Change some script method return types --- engines/titanic/true_talk/doorbot_script.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 4bca9a6491..43b9e46335 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -44,17 +44,17 @@ int DoorbotScript::proc15() const { return 0; } -int DoorbotScript::proc16() const { +bool DoorbotScript::proc16() const { warning("TODO"); return 0; } -int DoorbotScript::proc17() const { +bool DoorbotScript::proc17() const { warning("TODO"); return 0; } -int DoorbotScript::proc18() const { +bool DoorbotScript::proc18() const { warning("TODO"); return 0; } -- cgit v1.2.3 From d84fb55a24e36b2d829b89534a166b802a4b1fd7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 May 2016 19:15:47 -0400 Subject: TITANIC: Adding TTnpcScript dialogue Id handling --- engines/titanic/true_talk/doorbot_script.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 43b9e46335..9d35f697f9 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -25,7 +25,7 @@ namespace Titanic { -int DoorbotScript::proc6() const { +int DoorbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -59,7 +59,7 @@ bool DoorbotScript::proc18() const { return 0; } -int DoorbotScript::proc21(int v) { +int DoorbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -74,8 +74,9 @@ int DoorbotScript::proc23() const { return 0; } -void DoorbotScript::proc24() { +const int *DoorbotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int DoorbotScript::proc25() const { @@ -90,12 +91,12 @@ void DoorbotScript::proc32() { warning("TODO"); } -int DoorbotScript::proc36() const { +int DoorbotScript::proc36(int id) const { warning("TODO"); return 0; } -int DoorbotScript::proc37() const { +uint DoorbotScript::translateId(uint id) const { warning("TODO"); return 0; } -- cgit v1.2.3 From ba5e13d479f3c8615e8c0984c58e86421499f1b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 31 May 2016 21:47:12 -0400 Subject: TITANIC: Set up loading of deskbot & bellbot script response lists --- engines/titanic/true_talk/doorbot_script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 9d35f697f9..d1638eeff3 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -25,9 +25,9 @@ namespace Titanic { -int DoorbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void DoorbotScript::proc7(int v1, int v2) { -- cgit v1.2.3 From 451ab9d452e4003c6b0304d4c4609cf442fb3f81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 06:52:35 -0400 Subject: TITANIC: Load response data for remaining NPC scripts --- engines/titanic/true_talk/doorbot_script.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index d1638eeff3..9c8c686c51 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -25,6 +25,12 @@ namespace Titanic { +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) { + load("Responses/Doorbot"); +} + int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); return SS_2; -- cgit v1.2.3 From 4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 21:59:34 -0400 Subject: TITANIC: Further npc scripts chooseResponse methods --- engines/titanic/true_talk/doorbot_script.cpp | 71 +++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') 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 -- cgit v1.2.3 From 3196e488f196a6c33f89eea389cf8d9a90d5f90d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 23:33:55 -0400 Subject: TITANIC: Finished TTnpcScript processSentence --- engines/titanic/true_talk/doorbot_script.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index aec067e19e..2b248ac601 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -128,7 +128,7 @@ int DoorbotScript::proc21(int v1, int v2, int v3) { return 0; } -int DoorbotScript::proc22() const { +int DoorbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -143,12 +143,12 @@ const int *DoorbotScript::getTablePtr(int id) { return nullptr; } -int DoorbotScript::proc25() const { +int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void DoorbotScript::proc26() { +void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void DoorbotScript::proc32() { -- cgit v1.2.3 From 9d92a5a6a468889e39b1b8d4f696fde3769da79c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jun 2016 21:51:53 -0400 Subject: TITANIC: Fleshing out usage of TTscriptArrayItem in TTnpcScript --- engines/titanic/true_talk/doorbot_script.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 2b248ac601..e65d744605 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -108,7 +108,8 @@ int DoorbotScript::proc15() const { return 0; } -bool DoorbotScript::proc16() const { +bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { warning("TODO"); return 0; } -- cgit v1.2.3 From 6792fd92b7101c9c85656ff914bafcb3e30a176a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 08:13:00 -0400 Subject: TITANIC: Renamings for script setupRanges --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index e65d744605..b76f7aca9d 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -114,7 +114,7 @@ bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DoorbotScript::proc17() const { +bool DoorbotScript::setupRanges() { warning("TODO"); return 0; } -- cgit v1.2.3 From c660bbf1416410dbb3a985300b8c037f7f30eab3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 08:52:02 -0400 Subject: TITANIC: Beginnings of loading NPC range data --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index b76f7aca9d..7d291b6e7d 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -35,7 +35,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { Common::fill(&_array[0], &_array[148], 0); _state = 0; - load("Responses/Doorbot"); + loadResponses("Responses/Doorbot"); } int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { -- cgit v1.2.3 From 02cd4557a40d10f50b76425c7df0a26cc46aa6a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 20:13:20 -0400 Subject: TITANIC: Remove unneeded NPC setupRanges methods --- engines/titanic/true_talk/doorbot_script.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7d291b6e7d..65fc194c11 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -35,6 +35,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { Common::fill(&_array[0], &_array[148], 0); _state = 0; + loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); } @@ -114,11 +115,6 @@ bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DoorbotScript::setupRanges() { - warning("TODO"); - return 0; -} - bool DoorbotScript::proc18() const { warning("TODO"); return 0; -- cgit v1.2.3 From bc8e37e17bb02c81467c36dd8c0b60d8e1f9eca1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 19:42:37 -0400 Subject: TITANIC: Load NPC mapping tables --- engines/titanic/true_talk/doorbot_script.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 65fc194c11..92db168eb1 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -35,6 +35,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { Common::fill(&_array[0], &_array[148], 0); _state = 0; + _mappings.load("Mappings/Doorbot", 4); loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); } -- cgit v1.2.3 From 67b19851d56cc507ce48994a1b92407e79f53056 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 22:01:55 -0400 Subject: TITANIC: Add loading of NPC sentence entry data --- engines/titanic/true_talk/doorbot_script.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 92db168eb1..7e0181308f 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/doorbot_script.h" #include "titanic/true_talk/tt_room_script.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { @@ -33,11 +34,21 @@ static const int STATE_ARRAY[9] = { 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; - _mappings.load("Mappings/Doorbot", 4); loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); + setupSentences(); +} + +void DoorbotScript::setupSentences() { + for (int idx = 35; idx < 40; ++idx) + CTrueTalkManager::setFlags(idx, 0); + _state = 1; + _dialValues[0] = _dialValues[1] = 100; + + _mappings.load("Mappings/Doorbot", 4); + _entries.load("Sentences/Doorbot"); + _field68 = 0; + _entryCount = 0; } int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { -- cgit v1.2.3 From 840557236c7f9f3e4e10b586781a36eb712b7de3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 10 Jun 2016 23:28:55 -0400 Subject: TITANIC: Add loading of NPC tag maps, TTnpcScript translateId method --- engines/titanic/true_talk/doorbot_script.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7e0181308f..bfa1ba9181 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -37,6 +37,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); setupSentences(); + _tagMappings.load("TagMap/Doorbot"); } void DoorbotScript::setupSentences() { @@ -169,11 +170,6 @@ int DoorbotScript::proc36(int id) const { return 0; } -uint DoorbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - int DoorbotScript::setResponse(int dialogueId, int v34) { addResponse(dialogueId); applyResponse(); -- cgit v1.2.3 From bf1657beb011749a17c531aec185b50ba6baf9fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 17:42:01 -0400 Subject: TITANIC: Changed NPC proc10 definitions to scriptChanged --- engines/titanic/true_talk/doorbot_script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index bfa1ba9181..427ed65afc 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -112,9 +112,9 @@ void DoorbotScript::proc7(int v1, int v2) { warning("TODO"); } -int DoorbotScript::proc10() const { +ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } int DoorbotScript::proc15() const { -- cgit v1.2.3 From 52f6394ae5e0ef37213f12dd430ac0e580ccd463 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 17:49:55 -0400 Subject: TITANIC: Changed NPC proc7 definitions to process --- engines/titanic/true_talk/doorbot_script.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 427ed65afc..65bf88c4b4 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -108,8 +108,9 @@ int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -void DoorbotScript::proc7(int v1, int v2) { - warning("TODO"); +int DoorbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { -- cgit v1.2.3 From a5e6d1e345872cfec5101912db50514b74cf4e38 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 21:21:12 -0400 Subject: TITANIC: Remove deprecated NPC methods for data now loaded from DAT file --- engines/titanic/true_talk/doorbot_script.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 65bf88c4b4..7689fc2c04 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -129,11 +129,6 @@ bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DoorbotScript::proc18() const { - warning("TODO"); - return 0; -} - int DoorbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; -- cgit v1.2.3 From 441d168d3782683acd4ec05535d2b73afb1c86f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Jun 2016 09:03:46 -0400 Subject: TITANIC: Replace NPC proc23 methods with a single getMapping --- engines/titanic/true_talk/doorbot_script.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7689fc2c04..0db75474eb 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -144,11 +144,6 @@ int DoorbotScript::proc23() const { return 0; } -const int *DoorbotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; -- cgit v1.2.3 From 3c547b6b354fc54a19dc88cc2470fb51093eb5bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:08:46 -0400 Subject: TITANIC: Load word lists for each NPC Script class --- engines/titanic/true_talk/doorbot_script.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 0db75474eb..4be25118ef 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -38,6 +38,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, loadResponses("Responses/Doorbot"); setupSentences(); _tagMappings.load("TagMap/Doorbot"); + _words.load("Words/Doorbot"); } void DoorbotScript::setupSentences() { -- cgit v1.2.3 From 539f13f5a4238a091dc4ff6bf1ddbe0bf2e201e3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:13:37 -0400 Subject: TITANIC: Remove deprecated code --- engines/titanic/true_talk/doorbot_script.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 4be25118ef..51647b98e0 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -119,11 +119,6 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int DoorbotScript::proc15() const { - warning("TODO"); - return 0; -} - bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const { warning("TODO"); -- cgit v1.2.3 From 2844574dc0f9e8c50e13cbebddd68db8c4dbc0bf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:29:59 -0400 Subject: TITANIC: Added NPC Script setDialRegion methods --- engines/titanic/true_talk/doorbot_script.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 51647b98e0..15ede3a727 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -148,8 +148,14 @@ int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsenten void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } -void DoorbotScript::proc32() { - warning("TODO"); +void DoorbotScript::setDialRegion(int dialNum, int region) { + TTnpcScript::setDialRegion(dialNum, region); + if (dialNum == 1 && region != 1) { + CTrueTalkManager::setFlags(37, dialNum); + } else { + addResponse(getDialogueId(221777)); + applyResponse(); + } } int DoorbotScript::proc36(int id) const { -- cgit v1.2.3 From 3efc9f5cdea40c1658466b1f0d6ea8235567b293 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 08:17:22 -0400 Subject: TITANIC: Added NPC scripts gitDialsBitsets methods --- engines/titanic/true_talk/doorbot_script.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 15ede3a727..ba84c9a7d7 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -135,9 +135,14 @@ int DoorbotScript::proc22(int id) const { return 0; } -int DoorbotScript::proc23() const { - warning("TODO"); - return 0; +uint DoorbotScript::getDialsBitset() const { + uint bits = 0; + if (!getDialRegion(1)) + bits = 1; + if (!getDialRegion(0)) + bits |= 2; + + return bits; } int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { -- cgit v1.2.3 From 9c763c978d9ba5b5115ca305429b7dea81091731 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 19:38:33 -0400 Subject: TITANIC: Added BarbotScript proc25 --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index ba84c9a7d7..5450bbe0df 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -145,7 +145,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int DoorbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } -- cgit v1.2.3 From fcb42d57150297725bd0f4aacb802fda78ec5695 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 21:01:36 -0400 Subject: TITANIC: Added Bellbot & Deskbot proc25 --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 5450bbe0df..0ed9a68d7a 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -145,7 +145,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } -- cgit v1.2.3 From 2faa3125c0978bbfceecc8913148f0f5eefb1a2e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 22:07:23 -0400 Subject: TITANIC: Added DoorbotScript proc25 --- engines/titanic/true_talk/doorbot_script.cpp | 208 +++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 0ed9a68d7a..04530f1491 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -31,6 +31,26 @@ static const int STATE_ARRAY[9] = { 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 }; +struct RoomDialogueId { + int _roomNum; + int _dialogueId; +}; +static const RoomDialogueId ROOM_DIALOGUES1[] = { + { 100, 10523 }, { 101, 10499 }, { 107, 10516 }, { 108, 10500 }, + { 109, 10490 }, { 110, 10504 }, { 111, 10506 }, { 112, 10498 }, + { 113, 10502 }, { 114, 10507 }, { 115, 10497 }, { 116, 10508 }, + { 117, 10505 }, { 118, 10505 }, { 122, 10516 }, { 123, 10383 }, + { 124, 10510 }, { 125, 10511 }, { 126, 10513 }, { 127, 10512 }, + { 128, 10495 }, { 129, 10496 }, { 130, 10491 }, { 131, 10493 }, + { 132, 10492 }, { 0, 0 } +}; +static const RoomDialogueId ROOM_DIALOGUES2[] = { + { 102, 221981 }, { 110, 221948 }, { 111, 221968 }, { 107, 222000 }, + { 101, 221935 }, { 112, 221924 }, { 113, 221942 }, { 116, 221977 }, + { 124, 221987 }, { 125, 221984 }, { 127, 221991 }, { 128, 221916 }, + { 129, 221919 }, { 131, 221912 }, { 132, 221908 }, { 0, 0 } +}; + 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) { @@ -146,6 +166,176 @@ uint DoorbotScript::getDialsBitset() const { } int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { + int id2, id = 0; + + switch (val1) { + case 2: + if (getValue(1) != 1) + return 1; + break; + case 3: + if (getValue(1) != 2) + return 1; + break; + case 4: + if (getValue(1) != 3) + return 1; + break; + case 5: + if (getValue(1) == 3) + return 1; + case 6: + if (getRoom54(132)) + return 1; + break; + case 9: + if (sentence->localWord("my") || sentence->contains("my")) + return true; + id2 = getRoomDialogueId1(roomScript); + if (id2) { + addResponse(id2); + applyResponse(); + return 2; + } + break; + case 11: + switch (getValue(1)) { + case 1: + id = 220837; + break; + case 2: + id = 220849; + break; + default: + id = 220858; + break; + } + break; + case 12: + if (getValue(4) != 1) + id = 221157; + break; + case 13: + if (getValue(4) != 2) + id = 221157; + break; + case 14: + if (getValue(4) != 3) + id = 221157; + break; + case 15: + if (getValue(4) != 0) + id = 221157; + break; + case 16: + if (!sentence->localWord("weather")) + return true; + switch (getRandomNumber(4)) { + case 1: + if (getValue(4) != 0) + id = 221354 - getRandomNumber(2) ? -489 : 0; + break; + case 2: + switch (getValue(4)) { + case 0: + id = 220851; + break; + case 1: + id = 221268; + break; + case 2: + id = 221270; + break; + default: + id = 220865; + } + break; + case 3: + id = 221280; + break; + default: + break; + } + break; + case 17: + if (get34()) + return 1; + set34(0); + break; + case 18: + if (roomScript->_scriptId == 100) { + CTrueTalkManager::triggerAction(3, 0); + return 2; + } + break; + case 19: + CTrueTalkManager::_v9 = 104; + CTrueTalkManager::triggerAction(4, 0); + break; + case 20: + CTrueTalkManager::triggerAction(28, 0); + break; + case 22: + CTrueTalkManager::triggerAction(29, 1); + break; + case 23: + CTrueTalkManager::triggerAction(29, 2); + break; + case 24: + CTrueTalkManager::triggerAction(29, 3); + break; + case 25: + CTrueTalkManager::triggerAction(29, 4); + break; + case 26: + if (!sentence->localWord("my") && !sentence->contains("my")) + return 1; + break; + case 27: + if (!sentence->localWord("earth") && !sentence->contains("earth")) + return 1; + break; + case 28: + id2 = getRoomDialogueId2(roomScript); + if (id2) { + addResponse(id2); + applyResponse(); + return 2; + } + break; + case 29: + if (sentence->localWord("another") || sentence->localWord("more") || + sentence->localWord("additional") || sentence->contains("another") || + sentence->contains("more") || sentence->contains("additional")) { + addResponse(getDialogueId(220058)); + applyResponse(); + return 2; + } + break; + case 30: + if (!sentence->localWord("because") && !sentence->contains("because")) + return 1; + break; + case 0x200: + if (getValue(4) != 1) + id = 221157; + break; + case 0x201: + if (getValue(4) != 2) + id = 221157; + break; + case 0x202: + if (getValue(4) != 3) + id = 221157; + break; + case 0x203: + if (getValue(4) != 0) + id = 221157; + break; + default: + break; + } + warning("TODO"); return 0; } @@ -177,4 +367,22 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { return 2; } +int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { + for (const RoomDialogueId *r = ROOM_DIALOGUES1; r->_roomNum; ++r) { + if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + return getDialogueId(r->_dialogueId); + } + + return 0; +} + +int DoorbotScript::getRoomDialogueId2(const TTroomScript *roomScript) { + for (const RoomDialogueId *r = ROOM_DIALOGUES2; r->_roomNum; ++r) { + if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + return getDialogueId(r->_dialogueId); + } + + return 0; +} + } // End of namespace Titanic -- cgit v1.2.3 From ebeea1bb232845b5a863bc73edc2aafd56da36fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 22:27:47 -0400 Subject: TITANIC: Added remainder of BarbotScript handleQuote --- engines/titanic/true_talk/doorbot_script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 04530f1491..8ae19666aa 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -139,8 +139,8 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { warning("TODO"); return 0; } -- cgit v1.2.3 From 89da2a88573f1acd8c311764a84f0054011f46c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 06:43:12 -0400 Subject: TITANIC: Moved handleQuote data arrays to datafile --- engines/titanic/true_talk/doorbot_script.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 8ae19666aa..a864141428 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -59,6 +59,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/Doorbot"); _words.load("Words/Doorbot"); + _quotes.load("Quotes/Doorbot"); } void DoorbotScript::setupSentences() { @@ -142,7 +143,8 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { warning("TODO"); - return 0; + + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } int DoorbotScript::proc21(int v1, int v2, int v3) { -- cgit v1.2.3 From 5bc347007c3168bf99fe4847d09904f5f236624b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 11:57:44 -0400 Subject: TITANIC: Finish DoorbotScript handleQuote --- engines/titanic/true_talk/doorbot_script.cpp | 105 ++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index a864141428..bd654fcc0e 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -142,7 +142,110 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { - warning("TODO"); + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'V', 'S', 'H'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'C', 'T', 'R'): + case MKTAG('A', 'C', 'T', 'S'): + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'A', 'R', 'U'): + case MKTAG('B', 'L', 'F', '1'): + case MKTAG('B', 'L', 'F', '2'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('B', 'O', 'Y', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('G', 'I', 'R', 'L'): + case MKTAG('H', 'E', 'R', 'O'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'D', 'V', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 'T'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('J', 'F', 'O', 'D'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'I', 'M'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('D', 'R', 'U', 'G'): + tagId = MKTAG('V', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + default: + break; + } return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -- cgit v1.2.3 From 8cc9142a92298dbf16f438dcf36d3e4d74e3d9f9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 19:41:07 -0400 Subject: TITANIC: Renaming for NPC state methods --- engines/titanic/true_talk/doorbot_script.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') 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; } -- cgit v1.2.3 From 52b6c92ac0ac843ef1c7e54ee187fb0a16f381eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 21:17:01 -0400 Subject: TITANIC: Add loading of updateState arrays --- engines/titanic/true_talk/doorbot_script.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 4f74b19463..700ad3a666 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -60,6 +60,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Doorbot"); _words.load("Words/Doorbot"); _quotes.load("Quotes/Doorbot"); + _states.load("States/Doorbot"); } void DoorbotScript::setupSentences() { @@ -77,14 +78,14 @@ void DoorbotScript::setupSentences() { int DoorbotScript::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 > 9) - _state = 0; - addResponse(STATE_ARRAY[_state]); + if (_stateIndex > 9) + _stateIndex = 0; + addResponse(STATE_ARRAY[_stateIndex]); applyResponse(); - if (STATE_ARRAY[_state] == 11826) + if (STATE_ARRAY[_stateIndex] == 11826) setState(1); - ++_state; + ++_stateIndex; return 2; } -- cgit v1.2.3 From c7bd63d8818bb064be19957c32a1ee4abe7c9515 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 22:05:16 -0400 Subject: TITANIC: Added BarbotScript updateState --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 700ad3a666..f644142793 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -251,7 +251,7 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int DoorbotScript::updateState(int oldId, int newId, int index) { +int DoorbotScript::updateState(uint oldId, uint newId, int index) { warning("TODO"); return 0; } -- cgit v1.2.3 From 186b4e095a7f91bf1d5a186c0da9b4a81a0ae525 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 23:23:27 -0400 Subject: TITANIC: Added DoorbotScript updateState --- engines/titanic/true_talk/doorbot_script.cpp | 68 +++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index f644142793..3dc1e7fa61 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -252,8 +252,72 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int DoorbotScript::updateState(uint oldId, uint newId, int index) { - warning("TODO"); - return 0; + getValue(38); + bool flag39 = getValue(39) != 0; + CTrueTalkManager::setFlags(38, 0); + CTrueTalkManager::setFlags(39, 0); + + if (newId > 220890) { + switch (newId) { + case 221064: + return getValue(1) == 2 ? newId : 221062; + case 221080: + return getValue(1) >= 2 ? newId : 221066; + case 221078: + case 221079: + return getValue(1) >= 3 ? newId : 221065; + case 221081: + return getValue(7) == 0 ? newId : 221070; + case 221251: + CTrueTalkManager::triggerAction(28, 0); + break; + default: + break; + } + } else if (newId >= 220883) { + CTrueTalkManager::setFlags(38, 1); + CTrueTalkManager::triggerAction(28, 0); + } else if (newId >= 220076) { + switch (newId) { + case 220078: + case 220080: + case 220081: + case 220082: + case 220083: + case 220084: + if (flag39) + return getRangeValue(221381); + break; + default: + break; + } + + CTrueTalkManager::setFlags(39, 1); + } else if (newId == 220075) { + if (flag39) + return getRangeValue(221381); + CTrueTalkManager::setFlags(39, 1); + } else if (newId == 220038) { + return 220038; + } + + for (uint idx = 0; idx < _states.size(); ++idx) { + TTupdateState3 &us = _states[idx]; + if (us._newId == newId) { + uint bits = us._dialBits; + + if (!bits + || (index == 0 && (bits == 5 || bits == 1)) + || (index == 1 && (bits == 6 || bits == 2)) + || (index == 2 && (bits == 9 || bits == 1)) + || (index == 3 && (bits == 10 || bits == 2))) { + setState(us._newValue); + break; + } + } + } + + return newId; } int DoorbotScript::proc22(int id) const { -- cgit v1.2.3 From 0243d5b677c758f7b88598326e84d3d1034bd166 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 21:57:35 -0400 Subject: TITANIC: Add NPC preResponse methods --- engines/titanic/true_talk/doorbot_script.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 3dc1e7fa61..d4c18cfc60 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -302,7 +302,7 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { } for (uint idx = 0; idx < _states.size(); ++idx) { - TTupdateState3 &us = _states[idx]; + TTupdateState &us = _states[idx]; if (us._newId == newId) { uint bits = us._dialBits; @@ -320,9 +320,14 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { return newId; } -int DoorbotScript::proc22(int id) const { - warning("TODO"); - return 0; +int DoorbotScript::preResponse(uint id) { + uint newId = 0; + if (getDialRegion(0) != 1 && getRandomNumber(100) > 60) { + addResponse(11195); + newId = 222193; + } + + return newId; } uint DoorbotScript::getDialsBitset() const { -- cgit v1.2.3 From eef9303027fd2ff8c71b111bb0a3bcda242098bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 22:07:49 -0400 Subject: TITANIC: Handle NPC postResponse methods --- engines/titanic/true_talk/doorbot_script.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index d4c18cfc60..050a5440a7 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -515,9 +515,6 @@ int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - void DoorbotScript::setDialRegion(int dialNum, int region) { TTnpcScript::setDialRegion(dialNum, region); if (dialNum == 1 && region != 1) { -- cgit v1.2.3 From 6aef21517f5f65f6421103e1b2d150f44a6f17c6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 22:27:07 -0400 Subject: TITANIC: Rename NPC scripts proc25 to doSentenceEntry --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 050a5440a7..8b837341b3 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -340,7 +340,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { int id2, id = 0; switch (val1) { -- cgit v1.2.3 From 1adebe83dc719699e0f32a238c5792a65847c76f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 12:15:28 -0400 Subject: TITANIC: Added NPC randomResponse methods, reworked NPC data --- engines/titanic/true_talk/doorbot_script.cpp | 38 +++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 8b837341b3..fa1078fe31 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -525,9 +525,41 @@ void DoorbotScript::setDialRegion(int dialNum, int region) { } } -int DoorbotScript::proc36(int id) const { - warning("TODO"); - return 0; +bool DoorbotScript::randomResponse(int index) { + static const int DIALOGUE_IDS[] = { + 220133, 220074, 220000, 220008, 220009, 220010, 220011, + 220012, 220013, 220014, 220015, 220016, 221053, 221054, + 221055, 221056, 221057, 221058, 221059, 221060, 221061, + 221173, 221174, 221175, 221176, 221177, 222415, 222416, + 221157, 221165, 221166, 221167, 221168, 221169, 221170, + 221171, 221172, 221158, 221159, 221356, 221364, 221365, + 221366, 221367, 221368, 221369, 221370, 221371, 221357, + 221358, 221359, 221360, 221252, 221019, 221355, 220952, + 220996, 220916, 220924, 220926, 220931, 220948, 220956, + 220965, 220967, 220968, 220980, 220981, 220982, 220983, + 220984, 220988, 220903, 221095, 222202, 222239, 221758, + 221759, 221762, 221763, 221766, 221767, 221768, 0 + }; + + int *dataP = _data.getSlot(index); + bool flag = false; + for (const int *idP = DIALOGUE_IDS; *idP && !flag; ++idP) { + flag = *idP == *dataP; + } + + if (flag || (getDialRegion(1) != 1 && getRandomNumber(100) > 33) + || getRandomNumber(8) <= index) + return false; + + if (getRandomNumber(100) > 40) { + deleteResponses(); + addResponse(getDialogueId(221242)); + applyResponse(); + } else { + setResponseFromArray(index, 221245); + } + + return true; } int DoorbotScript::setResponse(int dialogueId, int v34) { -- cgit v1.2.3 From c3ba0badd1183e1f201c78690663e521b625196b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 16:41:01 -0400 Subject: TITANIC: Added BellbotScript preprocess --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index fa1078fe31..a9f1689d4f 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -525,7 +525,7 @@ void DoorbotScript::setDialRegion(int dialNum, int region) { } } -bool DoorbotScript::randomResponse(int index) { +bool DoorbotScript::randomResponse(uint index) { static const int DIALOGUE_IDS[] = { 220133, 220074, 220000, 220008, 220009, 220010, 220011, 220012, 220013, 220014, 220015, 220016, 221053, 221054, -- cgit v1.2.3 From cf63ceeb3c8e0b32b08e01186fe741bd42653c7e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 21:34:41 -0400 Subject: TITANIC: Adding BellbotScript support methods --- engines/titanic/true_talk/doorbot_script.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index a9f1689d4f..5839b72ba2 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -31,10 +31,6 @@ static const int STATE_ARRAY[9] = { 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 }; -struct RoomDialogueId { - int _roomNum; - int _dialogueId; -}; static const RoomDialogueId ROOM_DIALOGUES1[] = { { 100, 10523 }, { 101, 10499 }, { 107, 10516 }, { 108, 10500 }, { 109, 10490 }, { 110, 10504 }, { 111, 10506 }, { 112, 10498 }, @@ -573,7 +569,7 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { for (const RoomDialogueId *r = ROOM_DIALOGUES1; r->_roomNum; ++r) { - if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + if (r->_roomNum == roomScript->_scriptId) return getDialogueId(r->_dialogueId); } @@ -582,7 +578,7 @@ int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { int DoorbotScript::getRoomDialogueId2(const TTroomScript *roomScript) { for (const RoomDialogueId *r = ROOM_DIALOGUES2; r->_roomNum; ++r) { - if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + if (r->_roomNum == roomScript->_scriptId) return getDialogueId(r->_dialogueId); } -- cgit v1.2.3 From 377f926a6bfba385c883ba14d96e247e6fcf88f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 23:52:09 -0400 Subject: TITANIC: Added BellbotScript scriptChanged --- engines/titanic/true_talk/doorbot_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 5839b72ba2..7319058c0a 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -132,7 +132,7 @@ int DoorbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 0; } -ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult DoorbotScript::scriptChanged(TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } -- cgit v1.2.3 From 07bf7304433174203cc1cecec23aee54718b3d76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 14:31:36 -0400 Subject: TITANIC: Adding lots of const prefixes --- engines/titanic/true_talk/doorbot_script.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7319058c0a..6a31f93111 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -71,7 +71,7 @@ void DoorbotScript::setupSentences() { _entryCount = 0; } -int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const 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 (_stateIndex > 9) @@ -127,17 +127,17 @@ int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -int DoorbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { // TODO return 0; } -ScriptChangedResult DoorbotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } -int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int DoorbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -336,7 +336,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { int id2, id = 0; switch (val1) { -- cgit v1.2.3 From 19f8a0965be832a71a101054748cf000adf16add Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 17:16:23 -0400 Subject: TITANIC: Added DoorbotScript process --- engines/titanic/true_talk/doorbot_script.cpp | 377 ++++++++++++++++++++++++++- 1 file changed, 373 insertions(+), 4 deletions(-) (limited to 'engines/titanic/true_talk/doorbot_script.cpp') diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 6a31f93111..230acf7910 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/doorbot_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -63,12 +64,20 @@ void DoorbotScript::setupSentences() { for (int idx = 35; idx < 40; ++idx) CTrueTalkManager::setFlags(idx, 0); _state = 1; + _field68 = 0; + _entryCount = 0; _dialValues[0] = _dialValues[1] = 100; _mappings.load("Mappings/Doorbot", 4); _entries.load("Sentences/Doorbot"); - _field68 = 0; - _entryCount = 0; + + static const int SENTENCE_NUMS[11] = { + 2, 100, 101, 102, 107, 110, 111, 124, 129, 131, 132 + }; + for (int idx = 0; idx < 11; ++idx) { + _sentences[idx] = TTsentenceEntries(); + _sentences[idx].load(CString::format("Sentences/Doorbot/%d", SENTENCE_NUMS[idx])); + } } int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { @@ -128,8 +137,368 @@ int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsenten } int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { - // TODO - return 0; + int currState; + + switch (roomScript->_scriptId) { + case 100: + case 101: + case 102: + case 103: + case 104: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 113: + case 116: + case 117: + case 118: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + break; + + default: + return 2; + } + + checkItems(nullptr, nullptr); + if (getState() == 0) { + if (CTrueTalkManager::_v2 > getValue(36)) { + if (getDialRegion(1) == 1 && getRandomBit()) { + setDialRegion(0, getDialRegion(1) ? 0 : 1); + } else { + setDialRegion(1, getDialRegion(1) ? 0 : 1); + } + CTrueTalkManager::setFlags(36, CTrueTalkManager::_v2 + 3 + getRandomNumber(5)); + + if (getValue(37)) { + CTrueTalkManager::setFlags(37, 0); + setState(0); + return setResponse(getDialogueId(221140)); + } + } + } + + if (getValue(35) == 0 && roomScript->_scriptId != 100 && sentence->localWord("parrot")) { + CTrueTalkManager::setFlags(35, 1); + setState(0); + return setResponse(getDialogueId(220113)); + } + + if (sentence->_field2C == 6 && sentence->contains("why not")) { + return setResponse(11871, 8); + } + + currState = getState(); + if (currState) { + int sentMode = sentence->_field2C; + bool al = sentMode == 11 || sentMode == 13; + bool bl = sentMode == 12; + + switch (currState) { + case 1: + if (al) + return setResponse(11828, 2); + if (bl) + return setResponse(11827, 0); + break; + + case 2: + if (al) + return setResponse(11827, 0); + break; + + case 3: + if (sentMode == 3) + return setResponse(10406, 0); + break; + + case 4: + if (al) + return setResponse(11332, 0); + if (bl) + return setResponse(11331, 0); + break; + + case 5: + return setResponse(11868, 0); + + case 6: + return setResponse(11872, 0); + + case 7: + return setResponse(11869, 0); + + case 8: + return setResponse(11870, 0); + + case 12: + if (al) + return setResponse(11894, 13); + if (bl) + return setResponse(11893, 13); + break; + + case 13: + return setResponse(11895, 12); + + case 15: + if (sentMode == 3 || sentMode == 6) + return setResponse(10257, 0); + break; + + case 16: { + TTtreeResult treeResult; + if (g_vm->_trueTalkManager->_quotesTree.search(sentence->_normalizedLine.c_str(), + TREE_3, &treeResult, 0, nullptr) != -1) + return setResponse(getDialogueId(221380), 0); + break; + } + + case 17: + return setResponse(getDialogueId(221126), 0); + + case 18: + if (al) + return setResponse(getDialogueId(221135), 0); + if (bl) + return setResponse(getDialogueId(221134), 0); + break; + + case 19: + if (al) { + if (addRandomResponse(true)) { + setState(10); + return 2; + } + } + if (bl) + return setResponse(getDialogueId(221966), 0); + break; + + case 20: + if (al) { + if (addRandomResponse(true)) { + setState(19); + return 2; + } + } + if (bl || sentMode == 7 || sentMode == 10) { + return setResponse(getDialogueId(221879), 0); + } + break; + + case 21: + if (bl) + return setResponse(10935, 0); + break; + + case 22: + if (al) { + if (getRandomBit()) { + return setResponse(11211, 23); + } else { + return setResponse(10127, 0); + } + } + if (bl) + return setResponse(10136, 0); + break; + + case 23: + return setResponse(10212, 0); + + case 24: + if (al) + return setResponse(11151, 0); + if (bl) + return setResponse(11150, 0); + break; + + case 25: + case 26: + if (bl) { + if (getRandomBit()) { + return setResponse(11211, 23); + } else { + return setResponse(10127, 0); + } + } + if (al) + return setResponse(10136, 0); + break; + + case 27: + if (al || sentence->localWord("did") || sentence->contains("did")) + return setResponse(221175, 28); + break; + + case 28: + if (al || sentence->localWord("did") || sentence->contains("did")) + return setResponse(getDialogueId(221176), 29); + break; + + case 29: + if (al || sentence->localWord("did") || sentence->contains("did")) + return setResponse(getDialogueId(221177), 30); + break; + + case 30: + return setResponse(getDialogueId(221178), 31); + + case 31: + if (sentMode == 3 || sentMode == 10) + return setResponse(10350, 0); + break; + + case 32: + return setResponse(10110, 0); + + case 33: + if (sentence->contains("sieve") || sentence->contains("colander") + || sentence->contains("vegetable") || sentence->contains("ground") + || sentence->contains("earth") || sentence->contains("garden") + || sentence->contains("cheese") || sentence->contains("strainer")) { + return setResponse(getDialogueId(221375), 0); + } else if (getRandomNumber(100) > 30) { + return setResponse(getDialogueId(221376), 33); + } else { + return setResponse(getDialogueId(221376), 0); + } + break; + + case 34: + if (sentence->localWord("bellbot")) + return setResponse(10094, 0); + if (sentence->localWord("bellbot")) + return setResponse(10349, 0); + if (sentence->localWord("deskbot") || sentence->localWord("titania")) + return setResponse(10148, 0); + if (sentence->localWord("barbot") || sentence->localWord("rowbot") + || sentence->localWord("liftbot") || sentence->localWord("maitredbot")) + return setResponse(10147, 0); + break; + + case 35: + return setResponse(10811, 36); + + case 36: + if (al) + return setResponse(10813, 37); + if (bl) + return setResponse(10812, 37); + break; + + case 37: + if (al) + return setResponse(10815, 37); + if (bl) + return setResponse(10814, 37); + break; + + case 38: + return setResponse(10848, 39); + + case 39: + return setResponse(10823, 40); + + case 40: + return setResponse(10832, 41); + + case 41: + addResponse(10833); + return setResponse(10835, 0); + + case 42: + if (sentence->localWord("please")) + return setResponse(10840, 43); + return setResponse(10844, 0); + + case 43: + case 45: + return setResponse(10844, 0); + + case 44: + if (sentence->localWord("thanks")) + return setResponse(10843, 45); + return setResponse(10844, 0); + + case 46: + if (al) + return setResponse(getDialogueId(222251), 0); + if (bl) + return setResponse(10713, 0); + break; + + } + } + + if (currState != 14) + setState(0); + + if (getDialRegion(1) != 1 && getRandomNumber(100) > 92) + return setResponse(getDialogueId(221043), 0); + + int result = 0; + switch (roomScript->_scriptId) { + case 100: + case 101: + case 102: + case 107: + case 110: + case 111: + case 124: + case 129: + case 131: + case 132: + result = processEntries(&_sentences[roomScript->_scriptId], 0, roomScript, sentence); + break; + default: + break; + } + if (result == 2) + return 2; + + if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2 + || processEntries(_defaultEntries, 0, roomScript, sentence) == 2 + || defaultProcess(roomScript, sentence)) + return 2; + + switch (sentence->_field2C) { + case 11: + if (getRandomNumber(100) > 90) + return setResponse(10839, 42); + return setResponse(222415, 0); + + case 12: + if (getRandomNumber(100) > 90) + return setResponse(10841, 44); + return setResponse(getDialogueId(222416), 0); + + case 13: + return setResponse(getDialogueId(222415), 0); + + default: + if (getRandomNumber(100) > 75 && getStateValue()) + return setResponse(getDialogueId(221095)); + + if (processEntries(&_sentences[2], 0, roomScript, sentence) != 2) + return setResponse(getDialogueId(220000)); + break; + } + + return 2; } ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { -- cgit v1.2.3