diff options
Diffstat (limited to 'engines/titanic/true_talk/deskbot_script.cpp')
-rw-r--r-- | engines/titanic/true_talk/deskbot_script.cpp | 89 |
1 files changed, 51 insertions, 38 deletions
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 4df47e0af1..d38d53a296 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -29,6 +29,8 @@ namespace Titanic { int DeskbotScript::_oldId; +#define CURRENT_STATE 17 + 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) { @@ -73,7 +75,7 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen if (preprocess(roomScript, sentence) != 1) return 1; - CTrueTalkManager::setFlags(17, 0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); setState(0); updateCurrentDial(false); @@ -344,7 +346,7 @@ int DeskbotScript::updateState(uint oldId, uint newId, int index) { exit: _oldId = oldId; - setFlags17(newId, index); + setCurrentState(newId, index); return newId; } @@ -509,8 +511,8 @@ uint DeskbotScript::getStateDialogueId() const { } } -void DeskbotScript::setFlags17(uint newId, uint index) { - int newValue = getValue(17); +void DeskbotScript::setCurrentState(uint newId, uint index) { + int newValue = getValue(CURRENT_STATE); for (uint idx = 0; idx < _states.size(); ++idx) { const TTupdateState &us = _states[idx]; @@ -528,7 +530,7 @@ void DeskbotScript::setFlags17(uint newId, uint index) { } } - CTrueTalkManager::setFlags(17, newValue); + CTrueTalkManager::setFlags(CURRENT_STATE, newValue); } int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *sentence) { @@ -536,11 +538,11 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * return 1; bool stateFlag = true, applyFlag = false; - switch (getValue(17)) { + switch (getValue(CURRENT_STATE)) { case 1: - if (sentence->_field2C != 3 && sentence->_field2C != 4 - && sentence->_field2C != 6 && sentence->_field2C != 10 - && sentence->_field2C != 2) { + if (sentence->_category != 3 && sentence->_category != 4 + && sentence->_category != 6 && sentence->_category != 10 + && sentence->_category != 2) { addResponse(getDialogueId(240423)); applyFlag = true; } @@ -554,15 +556,15 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 3: - if (sentence->_field2C == 11 || sentence->_field2C == 13 - || sentence->_field2C == 3 || sentence->localWord("upgrade")) { + if (sentence->_category == 11 || sentence->_category == 13 + || sentence->_category == 3 || sentence->localWord("upgrade")) { addResponse(getDialogueId(240433)); applyFlag = true; } break; case 4: - addResponse(getDialogueId(sentence->_field2C == 11 || sentence->_field2C == 13 + addResponse(getDialogueId(sentence->_category == 11 || sentence->_category == 13 ? 240495 : 240494)); applyFlag = true; break; @@ -594,7 +596,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * stateFlag = true; } else if (sentence->localWord("name") || sentence->localWord("called") - || sentence->_field2C == 11) { + || sentence->_category == 11) { addResponse(getDialogueId(240448)); stateFlag = true; } else { @@ -605,7 +607,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 7: - if (sentence->_field2C == 11 || sentence->_field2C == 13 + if (sentence->_category == 11 || sentence->_category == 13 || (sentence->localWord("what") && sentence->localWord("wrong")) || sentence->localWord("clothes")) { addResponse(getDialogueId(240489)); @@ -616,7 +618,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 8: if (isDial1Low() && getValue(1) == 4) { - if (sentence->_field2C == 12 || sentence->_field2C == 13 + if (sentence->_category == 12 || sentence->_category == 13 || sentence->contains("do not")) { addResponse(getDialogueId(240447)); @@ -626,7 +628,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * CTrueTalkManager::triggerAction(19, 3); CTrueTalkManager::setFlags(22, 1); applyFlag = true; - } else if (sentence->_field2C == 11) { + } else if (sentence->_category == 11) { addResponse(getDialogueId(240746)); applyFlag = true; stateFlag = false; @@ -1089,7 +1091,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 74: case 75: - if (sentence->_field2C == 24) { + if (sentence->_category == 24) { addResponse(getDialogueId(240972)); applyFlag = true; } else if (sentence->localWord("good") || sentence->localWord("yes") @@ -1101,7 +1103,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 76: - if (sentence->_field2C == 6) { + if (sentence->_category == 6) { addResponse(getDialogueId(240767)); applyFlag = true; stateFlag = false; @@ -1109,21 +1111,25 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 77: - if (sentence->_field2C == 3) { + if (sentence->_category == 3) { addResponse(getDialogueId(241109)); applyFlag = true; stateFlag = false; } case 78: - if (sentence->_field2C == 11 || sentence->_field2C == 13) { + // "Do you have a reservation?" + if (sentence->_category == 11 || sentence->_category == 13) { + // Player said they have a reservation addResponse(getDialogueId(241262)); - } else if (sentence->_field2C == 12 || sentence->contains("do not")) { + } else if (sentence->_category == 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)); } @@ -1142,27 +1148,27 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 3: addAssignedRoom(); setState(0); - CTrueTalkManager::setFlags(17, 0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); return 2; default: addResponse(getDialogueId(241267)); break; } - add241716(); + addAskBreakfast(); applyFlag = true; stateFlag = false; break; case 81: - addResponse(getDialogueId(sentence->_field2C == 12 ? 240602 : 241337)); + addResponse(getDialogueId(sentence->_category == 12 ? 240602 : 241337)); applyResponse(); setState(0); - CTrueTalkManager::setFlags(17, 0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); return 2; case 82: - if (sentence->_field2C == 2) { + if (sentence->_category == 2) { addResponse(getDialogueId(241339)); applyFlag = true; } @@ -1181,7 +1187,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 84: - if (sentence->_field2C == 12 || sentence->contains("vegetarian") + if (sentence->_category == 12 || sentence->contains("vegetarian") || sentence->contains("vegitarian")) { addResponse(getDialogueId(241718)); addResponse(getDialogueId(241709)); @@ -1208,7 +1214,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 85: - if (sentence->_field2C == 12 || sentence->contains("bugle") + if (sentence->_category == 12 || sentence->contains("bugle") || sentence->contains("buggle") || sentence->contains("trumpet") || sentence->contains("saxophone") || sentence->contains("kazoo") || sentence->contains("blerontin 1") || sentence->contains("the 1") @@ -1229,7 +1235,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 86: - if (sentence->_field2C == 12 || sentence->_field2C == 11 || sentence->contains("view")) { + if (sentence->_category == 12 || sentence->_category == 11 || sentence->contains("view")) { addResponse(getDialogueId(241714)); addResponse(getDialogueId(241699)); } else { @@ -1352,19 +1358,25 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 92: case 93: - if (sentence->_field2C == 11 || sentence->_field2C == 13) { + // "Fish?" + if (sentence->_category == 11 || sentence->_category == 13) { + // Yes addResponse(getDialogueId(241077)); addResponse(getDialogueId(241706)); - } else if (sentence->_field2C == 12) { + } else if (sentence->_category == 12) { + // No addAssignedRoom(); setState(0); - CTrueTalkManager::setFlags(17, 0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); return 2; - } else if (g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine.c_str()) + } else if (g_vm->_trueTalkManager->_quotes.find(sentence->_initialLine.c_str()) == MKTAG('F', 'I', 'S', 'H')) { + // WORKAROUND: Original passed _normalizedLine, but "fish" is one of the common + // phrases replaced with with alternative text "completelyrandom" addResponse(getDialogueId(240877)); addResponse(getDialogueId(241706)); }else { + // All other responses if (getRandomNumber(100) < 80 && sentence2C(sentence)) addResponse(getDialogueId(241707)); @@ -1387,7 +1399,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * || sentence->contains("same room")) { addAssignedRoom(); setState(0); - CTrueTalkManager::setFlags(17, 0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); return 2; } else { if (getRandomNumber(100) < 80 && sentence2C(sentence)) @@ -1410,7 +1422,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 96: - if (sentence->_field2C == 2) { + if (sentence->_category == 2) { addResponse(getDialogueId(241350)); applyFlag = true; stateFlag = false; @@ -1433,7 +1445,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * applyResponse(); if (stateFlag) { setState(0); - CTrueTalkManager::setFlags(17, 0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); } return applyFlag ? 2 : 1; @@ -1480,7 +1492,7 @@ int DeskbotScript::checkCommonWords(const TTsentence *sentence) { return 0; } -void DeskbotScript::add241716() { +void DeskbotScript::addAskBreakfast() { addResponse(getDialogueId(241716)); } @@ -1497,6 +1509,7 @@ void DeskbotScript::addAssignedRoom() { addResponse(getDialogueId(241271 + floorNum)); addResponse(getDialogueId(241317 + roomNum)); addResponse(getDialogueId(241698)); + applyResponse(); } } // End of namespace Titanic |