From 6723bed162d3c64fd274146d83009744b3701a69 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 Oct 2017 21:07:00 -0400 Subject: TITANIC: DE: Fixes to vocabs, strings, and font in titanic.dat --- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 7 +-- engines/titanic/support/files_manager.cpp | 2 +- engines/titanic/support/strings.h | 2 + engines/titanic/true_talk/barbot_script.cpp | 32 ++++++------- engines/titanic/true_talk/barbot_script.h | 7 ++- engines/titanic/true_talk/bellbot_script.cpp | 28 +++++------ engines/titanic/true_talk/bellbot_script.h | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 29 ++++++------ engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 28 +++++------ engines/titanic/true_talk/doorbot_script.h | 7 ++- engines/titanic/true_talk/liftbot_script.cpp | 28 +++++------ engines/titanic/true_talk/liftbot_script.h | 2 +- engines/titanic/true_talk/maitred_script.cpp | 29 ++++++------ engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/script_support.cpp | 7 ++- engines/titanic/true_talk/script_support.h | 10 ++-- engines/titanic/true_talk/tt_npc_script.cpp | 59 ++++++++++-------------- engines/titanic/true_talk/tt_npc_script.h | 7 ++- 19 files changed, 148 insertions(+), 142 deletions(-) (limited to 'engines') diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index af73cb803c..02f6860d31 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -28,6 +28,7 @@ #include "titanic/support/screen_manager.h" #include "titanic/support/simple_file.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -161,12 +162,12 @@ void CPetRoomsGlyph::getTooltip(CTextControl *text) { // Get the room description CString roomStr = roomFlags.getRoomDesc(); - if (roomStr == "The Elevator") { + if (roomStr == TRANSLATE("The Elevator", "Der Aufzug")) { int elevNum = owner->getElevatorNum(); - roomStr = CString::format("Elevator %d", elevNum); + roomStr = CString::format(g_vm->_strings[ELEVATOR_NUM].c_str(), elevNum); } - roomStr += " (shift-click edits)"; + roomStr += g_vm->_strings[SHIFT_CLICK_TO_EDIT]; text->setText(prefix + roomStr); } diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index fbfb7e0f61..ce4d0d049f 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -50,7 +50,7 @@ bool CFilesManager::loadResourceIndex() { return false; } - if (_version != 3) { + if (_version != 4) { g_vm->GUIError("titanic.dat is out of date"); return false; } diff --git a/engines/titanic/support/strings.h b/engines/titanic/support/strings.h index b7a775cc99..1213285b99 100644 --- a/engines/titanic/support/strings.h +++ b/engines/titanic/support/strings.h @@ -168,6 +168,8 @@ enum StringId { PREVIOUSLY_ASSIGNED_ROOM, SAVED_CHEVRON, CURRENT_LOCATION, + ELEVATOR_NUM, + SHIFT_CLICK_TO_EDIT, A_HOT, A_COLD, LOAD_THE_GAME, diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 430330a35a..7c16f31e50 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -872,8 +872,8 @@ ScriptChangedResult BarbotScript::scriptChanged(const TTroomScript *roomScript, } int BarbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { - switch (tagId) { + uint tag1, uint tag2, uint remainder) { + switch (tag2) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): case MKTAG('A', 'R', 'T', 'Y'): @@ -894,7 +894,7 @@ int BarbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence * case MKTAG('T', 'E', 'A', 'M'): case MKTAG('T', 'U', 'S', 'H'): case MKTAG('W', 'W', 'E', 'B'): - tagId = MKTAG('E', 'N', 'T', 'N'); + tag2 = MKTAG('E', 'N', 'T', 'N'); break; case MKTAG('A', 'U', 'T', 'H'): case MKTAG('B', 'A', 'R', 'K'): @@ -923,61 +923,61 @@ int BarbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence * case MKTAG('T', 'D', 'V', 'P'): case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): - tagId = MKTAG('P', 'R', 'S', 'N'); + tag2 = 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'); + tag2 = MKTAG('F', 'O', 'O', 'D'); break; case MKTAG('C', 'R', 'M', 'N'): case MKTAG('C', 'S', 'P', 'Y'): case MKTAG('U', 'B', 'A', 'D'): - tagId = MKTAG('V', 'B', 'A', 'D'); + tag2 = 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', 'C'): case MKTAG('P', 'L', 'A', 'N'): - tagId = MKTAG('P', 'L', 'A', 'C'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = MKTAG('R', 'U', 'D', 'E'); break; case MKTAG('P', 'H', 'I', 'L'): case MKTAG('R', 'C', 'K', 'T'): case MKTAG('S', 'C', 'I', 'E'): - tagId = MKTAG('S', 'C', 'I', 'E'); + tag2 = MKTAG('S', 'C', 'I', 'E'); break; case MKTAG('T', 'R', 'A', '2'): case MKTAG('T', 'R', 'A', '3'): - tagId = MKTAG('T', 'R', 'A', 'V'); + tag2 = MKTAG('T', 'R', 'A', 'V'); break; default: break; } - if (val == 36) { + if (tag1 == 36) { switch (getValue(1)) { case 1: return setResponse(getDialogueId(220837), -1); @@ -987,11 +987,11 @@ int BarbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence * default: return setResponse(getDialogueId(220858), -1); } - } else if (val == 61 && getValue(1) > 2) { + } else if (tag1 == 61 && getValue(1) > 2) { return setResponse(getDialogueId(222301), -1); } - return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); + return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder); } int BarbotScript::updateState(uint oldId, uint newId, int index) { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index a8c92b2927..1aea21f744 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -73,7 +73,12 @@ public: virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); + + /** + * Returns true if the NPC's dial region affects quote responses + */ + virtual bool isQuoteDialled() const { return true; } /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 84d5c59713..4d0bd2fa63 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -483,8 +483,8 @@ ScriptChangedResult BellbotScript::scriptChanged(const TTroomScript *roomScript, } int BellbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { - switch (tagId) { + uint tag1, uint tag2, uint remainder) { + switch (tag2) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): case MKTAG('A', 'R', 'T', 'Y'): @@ -505,7 +505,7 @@ int BellbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'E', 'A', 'M'): case MKTAG('T', 'V', 'S', 'H'): case MKTAG('W', 'W', 'E', 'B'): - tagId = MKTAG('E', 'N', 'T', 'N'); + tag2 = MKTAG('E', 'N', 'T', 'N'); break; case MKTAG('A', 'C', 'T', 'R'): case MKTAG('A', 'C', 'T', 'S'): @@ -538,59 +538,59 @@ int BellbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'O', 'U', 'P'): case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): - tagId = MKTAG('P', 'R', 'S', 'N'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = MKTAG('R', 'U', 'D', 'E'); break; case MKTAG('P', 'H', 'I', 'L'): case MKTAG('R', 'C', 'K', 'T'): - tagId = MKTAG('S', 'C', 'I', 'E'); + tag2 = MKTAG('S', 'C', 'I', 'E'); break; case MKTAG('T', 'R', 'A', '2'): case MKTAG('T', 'R', 'A', '3'): - tagId = MKTAG('T', 'R', 'A', 'V'); + tag2 = MKTAG('T', 'R', 'A', 'V'); break; default: break; } - return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); + return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder); } int BellbotScript::updateState(uint oldId, uint newId, int index) { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 7edb182301..17f22ac241 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -98,7 +98,7 @@ public: virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 123dc3c8a7..3988002f07 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -181,8 +181,8 @@ ScriptChangedResult DeskbotScript::scriptChanged(const TTroomScript *roomScript, } int DeskbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { - switch (tagId) { + uint tag1, uint tag2, uint remainder) { + switch (tag2) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): case MKTAG('A', 'R', 'T', 'Y'): @@ -202,7 +202,7 @@ int DeskbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('S', 'P', 'R', 'T'): case MKTAG('T', 'E', 'A', 'M'): case MKTAG('T', 'V', 'S', 'H'): - tagId = MKTAG('E', 'N', 'T', 'N'); + tag2 = MKTAG('E', 'N', 'T', 'N'); break; case MKTAG('A', 'C', 'T', 'R'): case MKTAG('A', 'C', 'T', 'S'): @@ -238,60 +238,59 @@ int DeskbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): case MKTAG('W', 'W', 'E', 'B'): - tagId = MKTAG('P', 'R', 'S', 'N'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = MKTAG('R', 'U', 'D', 'E'); break; case MKTAG('P', 'H', 'I', 'L'): case MKTAG('R', 'C', 'K', 'T'): - tagId = MKTAG('S', 'C', 'I', 'E'); + tag2 = MKTAG('S', 'C', 'I', 'E'); break; case MKTAG('T', 'R', 'A', '2'): case MKTAG('T', 'R', 'A', '3'): - tagId = MKTAG('T', 'R', 'A', 'V'); + tag2 = MKTAG('T', 'R', 'A', 'V'); break; default: break; } - return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); - + return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder); } int DeskbotScript::updateState(uint oldId, uint newId, int index) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 941136d45e..ff07809b08 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -104,7 +104,7 @@ public: virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 0e07f2ade8..aa0b533727 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -609,8 +609,8 @@ ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, } int DoorbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { - switch (tagId) { + uint tag1, uint tag2, uint remainder) { + switch (tag2) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): case MKTAG('A', 'R', 'T', 'Y'): @@ -631,7 +631,7 @@ int DoorbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'E', 'A', 'M'): case MKTAG('T', 'V', 'S', 'H'): case MKTAG('W', 'W', 'E', 'B'): - tagId = MKTAG('E', 'N', 'T', 'N'); + tag2 = MKTAG('E', 'N', 'T', 'N'); break; case MKTAG('A', 'C', 'T', 'R'): case MKTAG('A', 'C', 'T', 'S'): @@ -663,59 +663,59 @@ int DoorbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'D', 'V', 'P'): case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): - tagId = MKTAG('P', 'R', 'S', 'N'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = MKTAG('R', 'U', 'D', 'E'); break; case MKTAG('P', 'H', 'I', 'L'): case MKTAG('R', 'C', 'K', 'T'): - tagId = MKTAG('S', 'C', 'I', 'E'); + tag2 = MKTAG('S', 'C', 'I', 'E'); break; case MKTAG('T', 'R', 'A', '2'): case MKTAG('T', 'R', 'A', '3'): - tagId = MKTAG('T', 'R', 'A', 'V'); + tag2 = MKTAG('T', 'R', 'A', 'V'); break; default: break; } - return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); + return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder); } int DoorbotScript::updateState(uint oldId, uint newId, int index) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 536e9d42ca..50d01dfc57 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -76,7 +76,12 @@ public: virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); + + /** + * Returns true if the NPC's dial region affects quote responses + */ + virtual bool isQuoteDialled() const { return true; } /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 757b640c76..6dfa8d88db 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -215,8 +215,8 @@ ScriptChangedResult LiftbotScript::scriptChanged(const TTroomScript *roomScript, } int LiftbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { - switch (tagId) { + uint tag1, uint tag2, uint remainder) { + switch (tag2) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): case MKTAG('A', 'R', 'T', 'Y'): @@ -237,7 +237,7 @@ int LiftbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'E', 'A', 'M'): case MKTAG('T', 'V', 'S', 'H'): case MKTAG('W', 'W', 'E', 'B'): - tagId = MKTAG('E', 'N', 'T', 'N'); + tag2 = MKTAG('E', 'N', 'T', 'N'); break; case MKTAG('A', 'C', 'T', 'R'): case MKTAG('A', 'C', 'T', 'S'): @@ -272,57 +272,57 @@ int LiftbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'D', 'V', 'P'): case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): - tagId = MKTAG('P', 'R', 'S', 'N'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = MKTAG('R', 'U', 'D', 'E'); break; case MKTAG('P', 'H', 'I', 'L'): case MKTAG('R', 'C', 'K', 'T'): - tagId = MKTAG('S', 'C', 'I', 'E'); + tag2 = MKTAG('S', 'C', 'I', 'E'); break; case MKTAG('T', 'R', 'A', '2'): case MKTAG('T', 'R', 'A', '3'): - tagId = MKTAG('T', 'R', 'A', 'V'); + tag2 = MKTAG('T', 'R', 'A', 'V'); break; } - return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); + return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder); } int LiftbotScript::updateState(uint oldId, uint newId, int index) { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 0a9cdfd6f0..b0efa34416 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -76,7 +76,7 @@ public: virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 1033db29e0..7fbf755f73 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -381,8 +381,8 @@ ScriptChangedResult MaitreDScript::scriptChanged(const TTroomScript *roomScript, } int MaitreDScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { - switch (tagId) { + uint tag1, uint tag2, uint remainder) { + switch (tag2) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): case MKTAG('A', 'R', 'T', 'Y'): @@ -403,7 +403,7 @@ int MaitreDScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'E', 'A', 'M'): case MKTAG('T', 'V', 'S', 'H'): case MKTAG('W', 'W', 'E', 'B'): - tagId = MKTAG('E', 'N', 'T', 'N'); + tag2 = MKTAG('E', 'N', 'T', 'N'); break; case MKTAG('A', 'C', 'T', 'R'): case MKTAG('A', 'C', 'T', 'S'): @@ -437,57 +437,56 @@ int MaitreDScript::handleQuote(const TTroomScript *roomScript, const TTsentence case MKTAG('T', 'D', 'V', 'P'): case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): - tagId = MKTAG('P', 'R', 'S', 'N'); + tag2 = 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('L', 'I', 'Q', 'D'): - tagId = MKTAG('F', 'O', 'O', 'D'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = 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'); + tag2 = MKTAG('R', 'U', 'D', 'E'); break; case MKTAG('P', 'H', 'I', 'L'): case MKTAG('R', 'C', 'K', 'T'): - tagId = MKTAG('S', 'C', 'I', 'E'); + tag2 = MKTAG('S', 'C', 'I', 'E'); break; case MKTAG('T', 'R', 'A', '2'): case MKTAG('T', 'R', 'A', '3'): - tagId = MKTAG('T', 'R', 'A', 'V'); + tag2 = MKTAG('T', 'R', 'A', 'V'); break; - } - return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); + return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder); } int MaitreDScript::updateState(uint oldId, uint newId, int index) { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index bbeee403e7..c34444f5c2 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -83,7 +83,7 @@ public: virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index bba708fb78..fd1d40b12e 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -146,16 +146,15 @@ void TTwordEntries::load(const char *name) { void TThandleQuoteEntries::load(const char *name) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); - _tag1 = r->readUint32LE(); - _tag2 = r->readUint32LE(); _rangeStart = r->readUint32LE(); _rangeEnd = r->readUint32LE(); + _incr = r->readUint32LE(); while (r->pos() < r->size()) { TThandleQuoteEntry qe; + qe._tag1 = r->readUint32LE(); + qe._tag2= r->readUint32LE(); qe._index = r->readUint32LE(); - qe._tagId = r->readUint32LE(); - qe._dialogueId = r->readUint32LE(); push_back(qe); } diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 3c5b919ccf..25ec713624 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -134,19 +134,19 @@ public: }; struct TThandleQuoteEntry { + uint _tag1; + uint _tag2; uint _index; - uint _tagId; - uint _dialogueId; - TThandleQuoteEntry() : _index(0), _tagId(0), _dialogueId(0) {} + TThandleQuoteEntry() : _tag1(0), _tag2(0), _index(0) {} }; class TThandleQuoteEntries : public Common::Array { public: - uint _tag1, _tag2; uint _rangeStart, _rangeEnd; + uint _incr; public: - TThandleQuoteEntries() : _tag1(0), _tag2(0), _rangeStart(0), _rangeEnd(0) {} + TThandleQuoteEntries() : _rangeStart(0), _rangeEnd(0), _incr(0) {} void load(const char *name); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index c9d1beb353..5e31659f81 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -282,51 +282,43 @@ bool TTnpcScript::handleWord(uint id) const { } int TTnpcScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder) { + uint tag1, uint tag2, uint remainder) { if (_quotes.empty()) return 1; - - int loopCounter = 0; - for (uint idx = 0; idx < _quotes.size() && loopCounter < 2; ++idx) { + for (uint idx = 3; idx < _quotes.size(); ++idx) { const TThandleQuoteEntry *qe = &_quotes[idx]; - if (!qe->_index) { - // End of list; start at beginning again - ++loopCounter; - idx = 0; - qe = &_quotes[0]; - } - - if (qe->_index == val && ( - (tagId == 0 && loopCounter == 2) || - (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || - (qe->_tagId == tagId) - )) { - uint foundTagId = qe->_tagId; - if (foundTagId > 0 && foundTagId < 100) { - if (!tagId) - foundTagId >>= 1; - if (getRandomNumber(100) < foundTagId) + if (qe->_tag1 == tag1 && + (qe->_tag2 == tag2 || qe->_tag2 < MKTAG('A', 'A', 'A', 'A'))) { + uint threshold = qe->_tag2; + if (threshold > 0 && threshold < 100) { + if (!tag2) + threshold >>= 1; + if (getRandomNumber(100) < threshold) return 1; } - uint dialogueId = qe->_dialogueId; + uint dialogueId = qe->_index; if (dialogueId >= _quotes._rangeStart && dialogueId <= _quotes._rangeEnd) { dialogueId -= _quotes._rangeStart; - if (dialogueId > 3) - error("Invalid dialogue index in BarbotScript"); - - const int RANDOM_LIMITS[4] = { 30, 50, 70, 60 }; - int rangeLimit = RANDOM_LIMITS[dialogueId]; - int dialRegion = getDialRegion(0); - - if (dialRegion != 1) { - rangeLimit = MAX(rangeLimit - 20, 20); + if (dialogueId >= _quotes.size()) + error("Invalid dialogue index in bot script"); + TThandleQuoteEntry "e = _quotes[dialogueId]; + + int rangeLimit; + if (isQuoteDialled()) { + // Barbot and Doorbot response is affected by dial region + int dialRegion = getDialRegion(0); + if (dialRegion != 1) { + rangeLimit = MAX((int)quote._tag1 - 20, 20); + } + } else { + rangeLimit = quote._index; } - dialogueId = (((int)remainder + 25) % 100) >= rangeLimit - ? _quotes._tag1 : _quotes._tag2; + dialogueId = ((remainder + _quotes._incr) % 100) >= (uint)rangeLimit + ? quote._tag2 : quote._tag1; } addResponse(getDialogueId(dialogueId)); @@ -336,7 +328,6 @@ int TTnpcScript::handleQuote(const TTroomScript *roomScript, const TTsentence *s } return 1; - } uint TTnpcScript::getRangeValue(uint id) { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index c2f001f8cc..6a152ccde1 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -269,7 +269,12 @@ public: virtual bool handleWord(uint id) const; virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, - uint val, uint tagId, uint remainder); + uint tag1, uint tag2, uint remainder); + + /** + * Returns true if the NPC's dial region affects quote responses + */ + virtual bool isQuoteDialled() const { return false; } /** * Given an Id for a previously registered set of random number values, -- cgit v1.2.3