aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk/deskbot_script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/true_talk/deskbot_script.cpp')
-rw-r--r--engines/titanic/true_talk/deskbot_script.cpp124
1 files changed, 122 insertions, 2 deletions
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp
index a1d205514a..8e92007402 100644
--- a/engines/titanic/true_talk/deskbot_script.cpp
+++ b/engines/titanic/true_talk/deskbot_script.cpp
@@ -26,6 +26,84 @@
namespace Titanic {
+static const TThandleQuoteEntry QUOTES[] = {
+ { 0x00000008, 0x00000000, 0x0003ACD0 },
+ { 0x00000007, 0x00000000, 0x0003ACDC },
+ { 0x00000006, 0x00000000, 0x0003ABF9 },
+ { 0x00000005, 0x00000000, 0x0003AD04 },
+ { 0x00000001, 0x56424144, 0x0003AE27 },
+ { 0x00000001, 0x52554445, 0x0003AE27 },
+ { 0x00000001, 0x5052534E, 0x00041EB3 },
+ { 0x00000001, 0x464F4F44, 0x00041EB3 },
+ { 0x00000001, 0x00000032, 0x00041EB1 },
+ { 0x00000002, 0x56424144, 0x0003AE27 },
+ { 0x00000002, 0x52554445, 0x0003AE27 },
+ { 0x00000002, 0x5052534E, 0x00041EB3 },
+ { 0x00000002, 0x464F4F44, 0x00041EB3 },
+ { 0x00000002, 0x00000032, 0x00041EB1 },
+ { 0x00000003, 0x56424144, 0x0003AE0E },
+ { 0x00000003, 0x52554445, 0x0003AE0E },
+ { 0x00000003, 0x5052534E, 0x00041EB3 },
+ { 0x00000003, 0x464F4F44, 0x00041EB3 },
+ { 0x00000003, 0x00000032, 0x00041EB1 },
+ { 0x00000010, 0x54524156, 0x0003ACFE },
+ { 0x00000010, 0x0000003C, 0x00041EB0 },
+ { 0x00000011, 0x00000000, 0x0003ABF9 },
+ { 0x00000015, 0x00000032, 0x0003AC70 },
+ { 0x00000012, 0x00000042, 0x0003AC7E },
+ { 0x00000013, 0x00000021, 0x0003AC70 },
+ { 0x0000001D, 0x00000021, 0x0003AC09 },
+ { 0x00000014, 0x00000042, 0x0003AE07 },
+ { 0x0000001B, 0x00000000, 0x00041EB2 },
+ { 0x0000001E, 0x00000000, 0x0003ACC1 },
+ { 0x0000001F, 0x00000000, 0x0003AC3E },
+ { 0x0000000C, 0x00000000, 0x0003AE4C },
+ { 0x0000000D, 0x00000000, 0x0003AE4C },
+ { 0x0000000E, 0x00000000, 0x0003AE4B },
+ { 0x0000000F, 0x00000000, 0x0003AE4B },
+ { 0x00000020, 0x00000019, 0x0003AE24 },
+ { 0x00000021, 0x0000000F, 0x0003AE10 },
+ { 0x0000001C, 0x00000032, 0x00041EB0 },
+ { 0x00000023, 0x00000000, 0x0003AC46 },
+ { 0x00000024, 0x00000000, 0x0003AE1F },
+ { 0x00000025, 0x00000000, 0x0003AE14 },
+ { 0x00000026, 0x00000000, 0x0003AC7B },
+ { 0x00000030, 0x00000000, 0x0003AE3D },
+ { 0x00000027, 0x424F5953, 0x0003AE5D },
+ { 0x00000027, 0x4749524C, 0x0003AE5E },
+ { 0x00000027, 0x00000000, 0x0003AE5C },
+ { 0x00000028, 0x00000000, 0x0003AE5B },
+ { 0x00000029, 0x00000000, 0x0003AE58 },
+ { 0x0000002A, 0x00000000, 0x0003AE59 },
+ { 0x0000002B, 0x00000000, 0x0003AE5A },
+ { 0x0000002C, 0x00000000, 0x0003AE57 },
+ { 0x0000002D, 0x00000000, 0x0003AE5C },
+ { 0x0000002E, 0x424F5953, 0x0003AE5A },
+ { 0x0000002E, 0x4749524C, 0x0003AE5A },
+ { 0x0000002E, 0x00000000, 0x0003AE5A },
+ { 0x00000032, 0x00000000, 0x0003AE0E },
+ { 0x00000033, 0x00000000, 0x0003AE27 },
+ { 0x00000034, 0x00000000, 0x0003AE24 },
+ { 0x00000035, 0x00000000, 0x0003AE3E },
+ { 0x00000037, 0x00000000, 0x0003AE26 },
+ { 0x00000038, 0x00000000, 0x0003AEC0 },
+ { 0x00000039, 0x00000000, 0x0003AEC1 },
+ { 0x0000003A, 0x00000000, 0x0003AC7F },
+ { 0x0000003B, 0x00000000, 0x0003ADD5 },
+ { 0x0000003C, 0x00000000, 0x0003AEC5 },
+ { 0x0000003D, 0x00000000, 0x0003AEC9 },
+ { 0x0000003F, 0x00000000, 0x0003ABC5 },
+ { 0x0000003E, 0x00000000, 0x0003ABC5 },
+ { 0x00000040, 0x00000000, 0x0003AFB0 },
+ { 0x00000041, 0x00000000, 0x0003AFDC },
+ { 0x00000042, 0x00000000, 0x0003AFB5 },
+ { 0x00000043, 0x00000000, 0x0003AFDD },
+ { 0x00000044, 0x00000000, 0x0003AFDD },
+ { 0x00000045, 0x0000000A, 0x0003AC7E },
+ { 0x00000046, 0x00000000, 0x0003AF6E },
+ { 0x00000000, 0x00000000, 0x00000000 }
+};
+
DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) {
@@ -175,8 +253,50 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
break;
}
- warning("TODO");
- return 0;
+ int loopCounter = 0;
+ for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) {
+ if (!qe->_index) {
+ // End of list; start at beginning again
+ ++loopCounter;
+ qe = QUOTES;
+ }
+
+ 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)
+ return 1;
+ }
+
+ uint dialogueId = qe->_dialogueId;
+ if (dialogueId >= 270000 && dialogueId <= 275000) {
+ dialogueId -= 270000;
+ if (dialogueId >= 3)
+ error("Invalid dialogue index in BarbotScript");
+ const int RANDOM_LIMITS[3] = { 30, 50, 70 };
+ int rangeLimit = RANDOM_LIMITS[dialogueId];
+ int dialRegion = getDialRegion(0);
+
+ if (dialRegion != 1) {
+ rangeLimit = MAX(rangeLimit - 20, 20);
+ }
+
+ dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 241191 : 241166;
+ }
+
+ addResponse(getDialogueId(dialogueId));
+ applyResponse();
+ return 2;
+ }
+ }
+
+ return 1;
}
int DeskbotScript::proc21(int v1, int v2, int v3) {