aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-11 21:10:01 -0400
committerPaul Gilbert2016-07-15 19:23:25 -0400
commit314a8f25ab8ea8600962af8c82356a728ff3b977 (patch)
tree665a38b5d6afd4f6e661353d3e108044867a1d80 /engines/titanic/true_talk
parent52f6394ae5e0ef37213f12dd430ac0e580ccd463 (diff)
downloadscummvm-rg350-314a8f25ab8ea8600962af8c82356a728ff3b977.tar.gz
scummvm-rg350-314a8f25ab8ea8600962af8c82356a728ff3b977.tar.bz2
scummvm-rg350-314a8f25ab8ea8600962af8c82356a728ff3b977.zip
TITANIC: Added ParrotScript scriptChanged
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/parrot_script.cpp51
-rw-r--r--engines/titanic/true_talk/tt_npc_script.h7
2 files changed, 54 insertions, 4 deletions
diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp
index cafb220910..e0c7a9b6d4 100644
--- a/engines/titanic/true_talk/parrot_script.cpp
+++ b/engines/titanic/true_talk/parrot_script.cpp
@@ -22,6 +22,7 @@
#include "common/textconsole.h"
#include "titanic/true_talk/parrot_script.h"
+#include "titanic/titanic.h"
namespace Titanic {
@@ -51,13 +52,55 @@ int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence,
}
int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) {
- // TODO
- return 0;
+ if (processEntries(roomScript, sentence) == 2) {
+ int tagId = g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine);
+ if (!tagId || chooseResponse(roomScript, sentence, tagId) != 2) {
+ addResponse(getDialogueId(sentence->check2C() ? 280248 : 280235));
+ applyResponse();
+ }
+ }
+
+ return 2;
}
ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint id) {
- warning("TODO");
- return SCR_1;
+ if (id >= 280000 && id <= 280276) {
+ if (id == 280258) {
+ if (CTrueTalkManager::_currentNPC) {
+ CGameObject *chicken;
+ if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET))
+ id = 280147 - getRandomBit();
+ }
+
+ id = getDialogueId(id);
+ } else {
+ if ((id == 280146 || id == 280147) && CTrueTalkManager::_currentNPC) {
+ CGameObject *chicken;
+ if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET))
+ id = 280142;
+ }
+
+ addResponse(getDialogueId(id));
+ if (id == 280192)
+ addResponse(getDialogueId(280222));
+ applyResponse();
+ }
+ }
+
+ if (id >= 80000 && id <= 80244) {
+ if ((id == 80155 || id == 80156) && CTrueTalkManager::_currentNPC) {
+ CGameObject *chicken;
+ if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET))
+ id = 80151;
+ }
+
+ addResponse(id);
+ if (id == 80201)
+ addResponse(getDialogueId(280222));
+ applyResponse();
+ }
+
+ return (id == 3) ? SCR_2 : SCR_1;
}
bool ParrotScript::proc18() const {
diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h
index 261bc57d7b..b12c35d67a 100644
--- a/engines/titanic/true_talk/tt_npc_script.h
+++ b/engines/titanic/true_talk/tt_npc_script.h
@@ -241,6 +241,13 @@ protected:
*/
int processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence);
+ /**
+ * Scans through a list of sentence entries for a matching standardized response
+ */
+ int processEntries(TTroomScript *roomScript, TTsentence *sentence) {
+ return processEntries(&_entries, _entryCount, roomScript, sentence);
+ }
+
bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence);
void checkItems(TTroomScript *roomScript, TTsentence *sentence);