Skip to content

Commit

Permalink
TITANIC: Fix showing replies with multiple response fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Nov 5, 2016
1 parent 4e92712 commit 738bdf9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
10 changes: 7 additions & 3 deletions engines/titanic/true_talk/deskbot_script.cpp
Expand Up @@ -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));
}

Expand All @@ -1149,7 +1153,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
break;
}

add241716();
addAskBreakfast();
applyFlag = true;
stateFlag = false;
break;
Expand Down Expand Up @@ -1480,7 +1484,7 @@ int DeskbotScript::checkCommonWords(const TTsentence *sentence) {
return 0;
}

void DeskbotScript::add241716() {
void DeskbotScript::addAskBreakfast() {
addResponse(getDialogueId(241716));
}

Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/true_talk/deskbot_script.h
Expand Up @@ -81,9 +81,9 @@ class DeskbotScript : public TTnpcScript {
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
Expand Down
6 changes: 6 additions & 0 deletions engines/titanic/true_talk/tt_response.cpp
Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions engines/titanic/true_talk/tt_response.h
Expand Up @@ -41,6 +41,12 @@ class TTresponse {
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
*/
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/true_talk/tt_script_base.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 738bdf9

Please sign in to comment.