From 738bdf94aa216aacee378aa574eb869af67e9089 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Nov 2016 09:46:57 -0400 Subject: TITANIC: Fix showing replies with multiple response fragments --- engines/titanic/true_talk/deskbot_script.cpp | 10 +++++++--- engines/titanic/true_talk/deskbot_script.h | 4 ++-- engines/titanic/true_talk/tt_response.cpp | 6 ++++++ engines/titanic/true_talk/tt_response.h | 6 ++++++ engines/titanic/true_talk/tt_script_base.cpp | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 4df47e0af1..9fd0662def 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -1116,14 +1116,18 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * } case 78: + // "Do you have a reservation?" if (sentence->_field2C == 11 || sentence->_field2C == 13) { + // Player said they have a reservation addResponse(getDialogueId(241262)); } else if (sentence->_field2C == 12 || sentence->contains("do not")) { + // Player said they don't have a reservation setDialRegion(0, 0); setDialRegion(1, 0); addResponse(getDialogueId(241268)); - add241716(); + addAskBreakfast(); } else { + // Player didn't say yes or no addResponse(getDialogueId(240745)); } @@ -1149,7 +1153,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; } - add241716(); + addAskBreakfast(); applyFlag = true; stateFlag = false; break; @@ -1480,7 +1484,7 @@ int DeskbotScript::checkCommonWords(const TTsentence *sentence) { return 0; } -void DeskbotScript::add241716() { +void DeskbotScript::addAskBreakfast() { addResponse(getDialogueId(241716)); } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index f5978553ce..1d00abb655 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -81,9 +81,9 @@ private: int checkCommonWords(const TTsentence *sentence); /** - * Adds response dialogue 241716 + * Adds a dialogue for asking the player what kind of breakfast they'd like */ - void add241716(); + void addAskBreakfast(); /** * Adds a dialogue description for the player's assigned room diff --git a/engines/titanic/true_talk/tt_response.cpp b/engines/titanic/true_talk/tt_response.cpp index 1c784ad320..3cb8d2c9ec 100644 --- a/engines/titanic/true_talk/tt_response.cpp +++ b/engines/titanic/true_talk/tt_response.cpp @@ -49,6 +49,12 @@ TTresponse::~TTresponse() { } } +TTresponse *TTresponse::appendResponse(int id) { + TTresponse *resp = new TTresponse(id, 3); + _nextP = resp; + return resp; +} + TTresponse *TTresponse::copyChain() const { TTresponse *returnResponseP = new TTresponse(this); diff --git a/engines/titanic/true_talk/tt_response.h b/engines/titanic/true_talk/tt_response.h index d39d18c193..950e1cd23e 100644 --- a/engines/titanic/true_talk/tt_response.h +++ b/engines/titanic/true_talk/tt_response.h @@ -41,6 +41,12 @@ public: TTresponse(const TTresponse *src); virtual ~TTresponse(); + /** + * Creates a new response and adds it as the current + * response's next response + */ + TTresponse *appendResponse(int id); + /** * Makes a copy of the chain of responses */ diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 2f58ad1400..1fa1ce3315 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -129,7 +129,7 @@ void TTscriptBase::appendResponse(int index, int *maxP, int id) { if (id && (!maxP || index <= *maxP)) { if (_respTailP) { // Prior fragments already exist, so append to end of chain - _respTailP = new TTresponse(_respTailP); + _respTailP = _respTailP->appendResponse(id); } else { // Currently no tail _respTailP = new TTresponse(id, 3); -- cgit v1.2.3