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 --- devtools/create_titanic/create_titanic_dat.cpp | 103 +++++++++++++---------- devtools/create_titanic/script_quotes.cpp | 55 +++++++----- devtools/create_titanic/script_quotes.h | 7 +- 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 +- 22 files changed, 242 insertions(+), 213 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 9519e4182a..285b3fe976 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -56,7 +56,7 @@ * ASCIIZ - name of the resource */ -#define VERSION_NUMBER 3 +#define VERSION_NUMBER 4 #define HEADER_SIZE 0x1700 Common::File inputFile, outputFile; @@ -615,7 +615,7 @@ static const BedheadEntry OFF_RESTING_D_WRONG[1] = { { "Any", "Any", "Any", "ClosedWrong", 59, 70 } }; -static const char *const STRINGS_EN[151] = { +static const char *const STRINGS_EN[153] = { "", "You are standing outside the Pellerator.", "I'm sorry, you cannot enter this pellerator at present as a bot is in the way.", @@ -760,6 +760,8 @@ static const char *const STRINGS_EN[151] = { "A previously assigned room: ", "Saved Chevron: ", "Current location: ", + "Elevator %d", + " (shift-click edits)", "A hot", "A cold", "Load the game.", @@ -774,20 +776,20 @@ static const char *const STRINGS_EN[151] = { "Speech volume" }; -static const char *const STRINGS_DE[197] = { +static const char *const STRINGS_DE[199] = { "", "Sie befinden sich vor dem Pellerator.", "Wir bedauern, da ein Bot den Weg versperrt, ist Ihnen der " "Zutritt zum Pellerator Ihnen gegenwSrtig verwehrt.", - "Wir bedauern, Zutritt zu diesem Pellerator ist nicht m\0xF6" - "glich, da die T\0xFC" "r zugefroren ist.", + "Wir bedauern, Zutritt zu diesem Pellerator ist nicht m\xF6" + "glich, da die T\xFC" "r zugefroren ist.", "Der Sukk-U-Bus befindet sich gegenwSrtig im Standby-oder \"AUS\"-Betrieb.", "Zur Zeit gibt es nichts zuzustellen.", "Gegenw\xE4rtig befindet sich nichts im Ablagekorb.", - "Der Sukk-U-Bus ist ein Einzel-St\0xFC" "ck-Liefergerst.", + "Der Sukk-U-Bus ist ein Einzel-St\xFC" "ck-Liefergerst.", "Nur ein H\xFChnchen pro Passagier. Wir bedanken uns f\xFC" "r Ihr Verst\xE4ndnis.", - "H\0xFChner werden nur in Eine-Einheit-Pro-Person-Rationen zugeteilt.", + "H\xFChner werden nur in Eine-Einheit-Pro-Person-Rationen zugeteilt.", "Sie sind in die Erste Klasse h\xF6hergestuft worden. Genie\xDF" "en Sie es in vollen Z\xFCgen.", "Sie sind in die Zweite Klasse h\xF6hergestuft worden. Genie\xDF" @@ -935,6 +937,8 @@ static const char *const STRINGS_DE[197] = { "Dein zuvor zugewiesenes Zimmer: ", "Gespeichertes Abzeichen: ", "Derzeitige Position: ", + "Aufzug %d", + " (Chevrons verändern mit Umschalt-Taste+Klicken)", "Eine hei\xDF""e", "Eine kalte", "Laden Sie das Spiel.", @@ -951,28 +955,28 @@ static const char *const STRINGS_DE[197] = { "Sommer", "Herbst", "Winter", - "Fr\0xFC" "nhling", + "Fr\xFC" "nhling", "Sn'ood", "J'af'ah", "Bitta", - "Fr\0xAA" "ic", - "Pflanzen bitte nicht ber\0xFC" "nhren.", - "!\0xBC" "ta'\0xAD" "ta! !T\0xAA" "z n\0xAA" " sappibundli t\0xAA" - "cn\0xAA" "z!", + "Fr\xAA" "ic", + "Pflanzen bitte nicht ber\xFC" "nhren.", + "!\xBC" "ta'\xAD" "ta! !T\xAA" "z n\xAA" " sappibundli t\xAA" + "cn\xAA" "z!", "Stop", "!Hanaz!", "VorwSrts", "!Panaz!", - "T\0xAA" "z k'b\0xAA" "z", + "T\xAA" "z k'b\xAA" "z", "Ein wenig herumkurven", - "Otundo a\0x92" " doom\0xAA" "n n\0x92" "sanza", + "Otundo a\x92" " doom\xAA" "n n\x92" "sanza", "Sinnlose Drehung des Steuerrads", - "!0xBC" "ta\0x92\0xAD" "ta! T\0xAA""z vidsta\0x92" "jaha i\0xAC" - "in\0x92" "qu\0xAA" " m\0xAA" "n\0xAA" "z", - "Sternenpanorama des Reiseziels hier einf\0xFC" "ngen.", + "!0xBC" "ta\x92\xAD" "ta! T\xAA""z vidsta\x92" "jaha i\xAC" + "in\x92" "qu\xAA" " m\xAA" "n\xAA" "z", + "Sternenpanorama des Reiseziels hier einf\xFC" "ngen.", - "V'lo\0xAC", + "V'lo\xAC", "Geschwindigkeit", "Pan", "Ein", @@ -983,29 +987,29 @@ static const char *const STRINGS_DE[197] = { "Pido", "Schnell", - "\0xBC" "lu\0xAD" " q\0xB0 scu'b\0xAA" "rri", - "H\0xFC" "hnchen a la sauce tomate", - "\0xBC" "lu\0xAD" " q\0xB0 scu'jajaja", + "\xBC" "lu\xAD" " q\xB0 scu'b\xAA" "rri", + "H\xFC" "hnchen a la sauce tomate", + "\xBC" "lu\xAD" " q\xB0 scu'jajaja", "H0xFC" "hnchen a la sauce moutarde", - "\0xBC" "lu0xAD q\0xB0 scu'\0xAD" "lu\0xAD", - "H\0xFC" "hnchen a la sauce 'Vogel'", - "\0xBC" "lu\0xAD" " sanza scu, n\0xAA n\0xAA n\0xAA", - "H\0xFC" "hnchen bar jeglicher sauce", + "\xBC" "lu0xAD q\xB0 scu'\xAD" "lu\xAD", + "H\xFC" "hnchen a la sauce 'Vogel'", + "\xBC" "lu\xAD" " sanza scu, n\xAA n\xAA n\xAA", + "H\xFC" "hnchen bar jeglicher sauce", - "!\0xB2" "la! !\0xB2" "la! !!!Sizzlo ab\0x92\0xAA\0xAA" "o s\0xAA" - "nza cr\0xAA" "dibo!!! N\0xAA" "nto p\0xAA" "rificio i\0xAC" "ind\0xAA", + "!\xB2" "la! !\xB2" "la! !!!Sizzlo ab\x92\xAA\xAA" "o s\xAA" + "nza cr\xAA" "dibo!!! N\xAA" "nto p\xAA" "rificio i\xAC" "ind\xAA", "Achtung, Lebensgefahr. Unglaublich hohe Voltzahl!!! Innen keine " - "artungsbed\0xFC" "rftigen Teile vorhanden.", - "!!!Birin\0xAC" "i sp\0xAA" "culato t\0xAA" "z n\0xAA n\0xAA n\0xAA" - " ouvraditiniz! J\0x92" "in n\0xAA n\0xAA upraximus stifibilimus" - " j\0x92" "in sigorto funct", - "Sie hStten die erste Kontrollt\0xFC" "r nicht \0xF6" - "ffnen sollen! Dies ist nicht nur ungeheuer gef\0xE4" - "hrlich, Sie verlieren auch jegliche Garantie-Anspr\0xFC" "che.", - "!T\0xAA" "z n\0xAA bleabaz t\0xAA" "z n\0xAA j\0x92" "abaz! Coco?", - "Und sagen Sie hinterher blo\0xFC nicht, niemand hStte Sie gewarnt.", - "Pin\0xAA" "z-pin\0xAA" "z stot \0xAF" "r\0xB0 jibbli", - "Dr\0xFC" "cken Sie den Knopf um die Bombe zu entschSrfen." + "artungsbed\xFC" "rftigen Teile vorhanden.", + "!!!Birin\xAC" "i sp\xAA" "culato t\xAA" "z n\xAA n\xAA n\xAA" + " ouvraditiniz! J\x92" "in n\xAA n\xAA upraximus stifibilimus" + " j\x92" "in sigorto funct", + "Sie hStten die erste Kontrollt\xFC" "r nicht \xF6" + "ffnen sollen! Dies ist nicht nur ungeheuer gef\xE4" + "hrlich, Sie verlieren auch jegliche Garantie-Anspr\xFC" "che.", + "!T\xAA" "z n\xAA bleabaz t\xAA" "z n\xAA j\x92" "abaz! Coco?", + "Und sagen Sie hinterher blo\xFC nicht, niemand hStte Sie gewarnt.", + "Pin\xAA" "z-pin\xAA" "z stot \xAF" "r\xB0 jibbli", + "Dr\xFC" "cken Sie den Knopf um die Bombe zu entschSrfen." }; static const char *const MUSIC_DATA[4] = { @@ -1142,6 +1146,9 @@ void writeResource(const char *resName, const char *sectionStr, uint32 resId, bo void writeResource(const char *sectionStr, uint32 resId, bool isEnglish = true) { char nameBuffer[256]; sprintf(nameBuffer, "%s/%u", sectionStr, resId); + if (!isEnglish) + strcat(nameBuffer, "/DE"); + writeResource(nameBuffer, sectionStr, resId, isEnglish); } @@ -1556,11 +1563,6 @@ void writeData() { writeResource("TEXT/STVOCAB", "TEXT", "STVOCAB.TXT"); writeResource("TEXT/JRQUOTES", "TEXT", "JRQUOTES.TXT"); writeResource("TEXT", 155); - if (!resGer.empty()) { - writeResource("TEXT/STVOCAB/DE", "TEXT", "STVOCABDE.TXT", false); - writeResource("TEXT/JRQUOTES/DE", "TEXT", "JRQUOTESDE.TXT", false); - writeResource("TEXT/155/DE", "TEXT", 155, false); - } writeResource("STARFIELD", 132); writeStarfieldPoints(); @@ -1571,8 +1573,8 @@ void writeData() { writeStringArray("TEXT/ITEM_NAMES", ITEM_NAMES, 46); writeStringArray("TEXT/ITEM_IDS", ITEM_IDS, 40); writeStringArray("TEXT/ROOM_NAMES", ROOM_NAMES, 34); - writeStringArray("TEXT/STRINGS", STRINGS_EN, 151); - writeStringArray("TEXT/STRINGS/DE", STRINGS_DE, 197); + writeStringArray("TEXT/STRINGS", STRINGS_EN, 153); + writeStringArray("TEXT/STRINGS/DE", STRINGS_DE, 199); const int TEXT_PHRASES[3] = { 0x61D3C8, 0x618340, 0x61B1E0 }; const int TEXT_REPLACEMENTS1[3] = { 0x61D9B0, 0x61C788, 0x61B7C8 }; const int TEXT_REPLACEMENTS2[3] = { 0x61DD20, 0x61CAF8, 0x61BB38 }; @@ -1695,7 +1697,7 @@ void writeData() { writeResponseTree(); writeNumbers(); - writeAllScriptQuotesEN(); + writeAllScriptQuotes(); writeAllScriptResponses(); writeAllScriptRanges(); @@ -1709,6 +1711,10 @@ void writeData() { } void writeGermanData() { + writeResource("TEXT/STVOCAB/DE", "TEXT", "STVOCABDE.TXT", false); + writeResource("TEXT/JRQUOTES/DE", "TEXT", "JRQUOTESDE.TXT", false); + writeResource("TEXT/155/DE", "TEXT", 155, false); + writeStringArray("TEXT/PHRASES/DE", 0x23EEC8 + GERMAN_DIFF, 178); writeStringArray("TEXT/REPLACEMENTS1/DE", 0x23F198 + GERMAN_DIFF, 1362); writeStringArray("TEXT/REPLACEMENTS2/DE", 0x2406E8 + GERMAN_DIFF, 816); @@ -1753,6 +1759,11 @@ void writeGermanData() { writeSentenceEntries("Sentences/SuccUBus/DE", 0x637CD8); writeMissiveOMatMessagesDE(); + + writeResource("STFONT", 149, false); + writeResource("STFONT", 151, false); + writeResource("STFONT", 152, false); + writeResource("STFONT", 153, false); } void createScriptMap() { diff --git a/devtools/create_titanic/script_quotes.cpp b/devtools/create_titanic/script_quotes.cpp index a84bfe2c93..2a8b16c59f 100644 --- a/devtools/create_titanic/script_quotes.cpp +++ b/devtools/create_titanic/script_quotes.cpp @@ -33,6 +33,9 @@ #include "script_quotes.h" static const ScriptQuote BARBOT_QUOTES[] = { + { 0x0003d722, 0x0003d372, 0x0000001e }, + { 0x0003d722, 0x0003d372, 0x00000032 }, + { 0x0003d722, 0x0003d372, 0x00000046 }, { 0x00000008, 0x00000000, 0x0003D372 }, { 0x00000007, 0x00000000, 0x0003D72B }, { 0x00000004, 0x00000000, 0x0003D722 }, @@ -82,6 +85,10 @@ static const ScriptQuote BARBOT_QUOTES[] = { }; static const ScriptQuote BELLBOT_QUOTES[] = { + { 0x000313d6, 0x000313d7, 0x0000001e }, + { 0x000313d6, 0x000313d7, 0x00000032 }, + { 0x000313d6, 0x000313d7, 0x00000046 }, + { 0x000313a1, 0x000313ae, 0x0000003c }, { 0x00000008, 0x00000000, 0x00031116 }, { 0x00000007, 0x00000000, 0x00031447 }, { 0x00000006, 0x00000000, 0x000310F9 }, @@ -163,6 +170,10 @@ static const ScriptQuote BELLBOT_QUOTES[] = { }; static const ScriptQuote DESKBOT_QUOTES[] = { + { 0x0003ae0e, 0x0003ae27, 0x0000001e }, + { 0x0003ae0e, 0x0003ae27, 0x00000032 }, + { 0x0003ae0e, 0x0003ae27, 0x00000046 }, + { 0x0003abe1, 0x0003ae4c, 0x0000003c }, { 0x00000008, 0x00000000, 0x0003ACD0 }, { 0x00000007, 0x00000000, 0x0003ACDC }, { 0x00000006, 0x00000000, 0x0003ABF9 }, @@ -241,6 +252,10 @@ static const ScriptQuote DESKBOT_QUOTES[] = { }; static const ScriptQuote DOORBOT_QUOTES[] = { + { 0x000360bf, 0x000360c0, 0x0000001e }, + { 0x000360bf, 0x000360c0, 0x00000032 }, + { 0x000360bf, 0x000360c0, 0x00000046 }, + { 0x000360c1, 0x000360c2, 0x0000003c }, { 0x00000008, 0x00000000, 0x00035F14 }, { 0x00000007, 0x00000000, 0x00035F6F }, { 0x00000004, 0x00000000, 0x000360BF }, @@ -316,6 +331,10 @@ static const ScriptQuote DOORBOT_QUOTES[] = { }; static const ScriptQuote LIFTBOT_QUOTES[] = { + { 0x00033694, 0x00033695, 0x0000001e }, + { 0x00033694, 0x00033695, 0x00000032 }, + { 0x00033694, 0x00033695, 0x00000046 }, + { 0x00033696, 0x00033697, 0x0000003c }, { 0x00000008, 0x00000000, 0x00033655 }, { 0x00000007, 0x00000000, 0x000335A0 }, { 0x00000006, 0x00000000, 0x0003368B }, @@ -379,6 +398,10 @@ static const ScriptQuote LIFTBOT_QUOTES[] = { }; static const ScriptQuote MAITRED_QUOTES[] = { + { 0x0003f833, 0x0003f847, 0x0000001e }, + { 0x0003f833, 0x0003f847, 0x00000032 }, + { 0x0003f833, 0x0003f847, 0x00000046 }, + { 0x0003f94f, 0x0003f936, 0x0000003c }, { 0x00000008, 0x00000000, 0x0003F967 }, { 0x00000007, 0x00000000, 0x0003F995 }, { 0x00000006, 0x00000000, 0x0003F833 }, @@ -429,17 +452,16 @@ static const ScriptQuote MAITRED_QUOTES[] = { }; void writeScriptQuotes(const char *name, const ScriptQuote *quotes, - uint tag1, uint tag2, uint rangeStart, uint rangeEnd) { + uint rangeStart, uint rangeEnd, uint incr) { outputFile.seek(dataOffset); - outputFile.writeLong(tag1); - outputFile.writeLong(tag2); outputFile.writeLong(rangeStart); outputFile.writeLong(rangeEnd); + outputFile.writeLong(incr); for (; quotes->_index; ++quotes) { + outputFile.writeLong(quotes->_tag1); + outputFile.writeLong(quotes->_tag2); outputFile.writeLong(quotes->_index); - outputFile.writeLong(quotes->_tagId); - outputFile.writeLong(quotes->_dialogueId); } uint size = outputFile.size() - dataOffset; @@ -447,20 +469,11 @@ void writeScriptQuotes(const char *name, const ScriptQuote *quotes, dataOffset += size; } -void writeAllScriptQuotesEN() { - writeScriptQuotes("Quotes/Barbot", BARBOT_QUOTES, 221376, 221375, 0, 999); - writeScriptQuotes("Quotes/Bellbot", BELLBOT_QUOTES, 201687, 201686, 270000, 270500); - writeScriptQuotes("Quotes/Deskbot", DESKBOT_QUOTES, 241191, 241166, 270000, 270500); - writeScriptQuotes("Quotes/Doorbot", DOORBOT_QUOTES, 221376, 221375, 0, 999); - writeScriptQuotes("Quotes/Liftbot", LIFTBOT_QUOTES, 210581, 210580, 0, 999); - writeScriptQuotes("Quotes/MaitreD", MAITRED_QUOTES, 260167, 260147, 270000, 270500); -} - -void writeAllScriptQuotesDE() { - writeScriptQuotes("Quotes/Barbot/DE", BARBOT_QUOTES, 251682, 250738, 0, 999); - writeScriptQuotes("Quotes/Bellbot", BELLBOT_QUOTES, 201686, 201687, 270000, 270500); - writeScriptQuotes("Quotes/Deskbot", DESKBOT_QUOTES, 241166, 241191, 270000, 270500); - writeScriptQuotes("Quotes/Doorbot", DOORBOT_QUOTES, 221375, 221376, 0, 999); - writeScriptQuotes("Quotes/Liftbot", LIFTBOT_QUOTES, 210580, 210581, 0, 999); - writeScriptQuotes("Quotes/MaitreD", MAITRED_QUOTES, 260147, 260167, 270000, 270500); +void writeAllScriptQuotes() { + writeScriptQuotes("Quotes/Barbot", BARBOT_QUOTES, 0, 999, 90); + writeScriptQuotes("Quotes/Bellbot", BELLBOT_QUOTES, 270000, 270500, 25); + writeScriptQuotes("Quotes/Deskbot", DESKBOT_QUOTES, 270000, 270500, 25); + writeScriptQuotes("Quotes/Doorbot", DOORBOT_QUOTES, 0, 999, 25); + writeScriptQuotes("Quotes/Liftbot", LIFTBOT_QUOTES, 0, 999, 57); + writeScriptQuotes("Quotes/MaitreD", MAITRED_QUOTES, 270000, 270500, 25); } diff --git a/devtools/create_titanic/script_quotes.h b/devtools/create_titanic/script_quotes.h index e282ec5181..053ca64993 100644 --- a/devtools/create_titanic/script_quotes.h +++ b/devtools/create_titanic/script_quotes.h @@ -26,13 +26,12 @@ #include "common/scummsys.h" struct ScriptQuote { + uint _tag1; + uint _tag2; uint _index; - uint _tagId; - uint _dialogueId; }; -extern void writeAllScriptQuotesEN(); -extern void writeAllScriptQuotesDE(); +extern void writeAllScriptQuotes(); extern void writeEntryHeader(const char *name, uint offset, uint size); extern uint dataOffset; 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