diff options
author | Paul Gilbert | 2016-07-28 19:00:22 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-28 19:00:22 -0400 |
commit | 7a2a705a7a2aeba7ca7d96b0e561b6d4a56fc4a5 (patch) | |
tree | 9992f16d7e942d55667f641a11983c162b32f4ac /engines/titanic | |
parent | a185a99a86b44f0a05580b9dc3da308b7666b8bf (diff) | |
download | scummvm-rg350-7a2a705a7a2aeba7ca7d96b0e561b6d4a56fc4a5.tar.gz scummvm-rg350-7a2a705a7a2aeba7ca7d96b0e561b6d4a56fc4a5.tar.bz2 scummvm-rg350-7a2a705a7a2aeba7ca7d96b0e561b6d4a56fc4a5.zip |
TITANIC: Added DeskbotScript updateState
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/true_talk/deskbot_script.cpp | 118 | ||||
-rw-r--r-- | engines/titanic/true_talk/deskbot_script.h | 22 | ||||
-rw-r--r-- | engines/titanic/true_talk/script_support.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/script_support.h | 6 |
4 files changed, 144 insertions, 8 deletions
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index e1c596bf6b..facc5fd79a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -26,6 +26,8 @@ namespace Titanic { +int DeskbotScript::_oldId; + 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) { @@ -181,8 +183,71 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int DeskbotScript::updateState(int oldId, int newId, int index) { - warning("TODO"); - return 0; + if (isDial1Medium() || getValue(1) < 4) + CTrueTalkManager::setFlags(22, 1); + + if (newId == 240420 || newId == 240947 || newId == 241261) { + if (getValue(22) && (newId == 240947 || newId == 241261)) + newId = getRangeValue(241184); + } + + if (newId == 240832) + setDialRegion(1, 0); + + if (oldId == 241183) { + if (getValue(1) == 2) + newId = getRangeValue(241182); + else if (getValue(1) == 1) + newId = getRangeValue(241181); + } + + if (newId == 240931 && getValue(1) <= 2) { + newId = 240924; + } else if (newId == 240924 && getValue(1) > 2) { + newId = 240931; + } + + if (newId == 240830 && getValue(1) == 1) { + newId = 240801; + } else if (newId == 240801 && getValue(1) > 1) { + newId = 240830; + } + + if (oldId >= 241217 && oldId <= 241259) { + addResponse(getDialogueId(241202)); + addResponse(getDialogueId(241200)); + newId = getRangeValue(241199); + } + + if (newId == 241354) + newId = addAssignedRoomDialogue2(); + if (newId == 241353) + newId = getStateDialogueId(); + if (newId == 240464 && getValue(1) != 1) + newId = 240462; + + if (newId == 241635 && isDial1Medium()) { + addResponse(getDialogueId(241556)); + newId = getRangeValue(241632); + } + + if (getValue(20) && (oldId == 240569 || oldId == 240576)) + newId = 240460; + if (!getValue(20)) { + if (newId != 240460) + goto exit; + CTrueTalkManager::setFlags(20, 1); + } + if (newId == 240460 && _oldId != 240569) { + CTrueTalkManager::setFlags(20, 0); + newId = 240455; + } + +exit: + _oldId = oldId; + setFlags17(newId, index); + + return newId; } int DeskbotScript::proc22(int id) const { @@ -285,4 +350,53 @@ int DeskbotScript::addAssignedRoomDialogue() { } } +int DeskbotScript::addAssignedRoomDialogue2() { + addResponse(getDialogueId(241355)); + int roomNum = 0, floorNum = 0, elevatorNum = 0; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241356)); + addResponse(getDialogueId(241313 + elevatorNum)); + + return 241357; +} + +void DeskbotScript::addAssignedRoomDialogue3() { + addResponse(getDialogueId(241513)); + addResponse(getDialogueId(241510)); + + CTrueTalkManager::setFlags(1, 2); + setDialRegion(0, 0); + setDialRegion(1, 0); + CTrueTalkManager::triggerAction(19, 2); + CTrueTalkManager::setFlags(3, 0); + + int roomNum = 1, floorNum = 1, elevatorNum = 1; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241511)); + addResponse(getDialogueId(241313 + elevatorNum)); + addResponse(getDialogueId(241512)); + applyResponse(); +} + +int DeskbotScript::getStateDialogueId() const { + switch (getValue(1)) { + case 1: + return 241503; + case 2: + return 241504; + default: + return 241505; + } +} + +void DeskbotScript::setFlags17(int newId, int index) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 1481cdd54c..c1313a0762 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -30,6 +30,8 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { private: + static int _oldId; +private: /** * Setup sentence data */ @@ -39,6 +41,26 @@ private: * Adds dialogue for the player's assigned room */ int addAssignedRoomDialogue(); + + /** + * Adds dialogue for the player's assigned room + */ + int addAssignedRoomDialogue2(); + + /** + * Adds dialogue for the player's assigned room + */ + void addAssignedRoomDialogue3(); + + /** + * Gets a dialogue Id based on the NPC's state + */ + int getStateDialogueId() const; + + /** + * Sets state data in flags 17 + */ + void setFlags17(int newId, int index); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 17820abf0d..1a3d66ad4a 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -169,9 +169,9 @@ void TTupdateStateEntries::load(const char *name) { while (r->pos() < r->size()) { TTupdateStateEntry ue; - ue._v1 = r->readUint32LE(); - ue._v2 = r->readUint32LE(); - ue._v3 = r->readUint32LE(); + ue._newId = r->readUint32LE(); + ue._newValue = r->readUint32LE(); + ue._idMatch = r->readUint32LE(); push_back(ue); } diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 7bc9bb8dfa..ef71ff08e4 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -143,9 +143,9 @@ public: }; struct TTupdateStateEntry { - uint _v1; - uint _v2; - uint _v3; + uint _newId; + uint _newValue; + uint _idMatch; }; class TTupdateStateEntries : public Common::Array<TTupdateStateEntry> { |