From d48caed20410f2e0abbf6708870388d7b9e9ea56 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Sep 2017 20:36:07 -0400 Subject: TITANIC: Add Deskbot German specific logic --- engines/titanic/module.mk | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 15 ++++++- engines/titanic/true_talk/deskbot_script.h | 30 ++++++------- engines/titanic/true_talk/german/barbot_script.cpp | 2 +- .../titanic/true_talk/german/deskbot_script.cpp | 49 ++++++++++++++++++++++ engines/titanic/true_talk/german/deskbot_script.h | 10 +++++ 6 files changed, 89 insertions(+), 19 deletions(-) diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 395805933d..8c5cdd6446 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -484,7 +484,7 @@ MODULE_OBJS := \ support/text_cursor.o \ support/time_event_info.o \ support/video_surface.o \ - true_talk/german/deskbot_script.o \ + true_talk/german/barbot_script.o \ true_talk/german/bellbot_script.o \ true_talk/german/deskbot_script.o \ true_talk/german/doorbot_script.o \ diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 3f65db9375..06b78c921d 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/deskbot_script.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -85,7 +86,16 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen || sentence->localWord("winning") || sentence->contains("winning") || sentence->localWord("winner") || sentence->contains("winner") || sentence->contains("35279") || sentence->contains("3 5 2 7 9") - ) { + || (g_language == Common::DE_DEU && ( + sentence->contains("preisaus") || + sentence->contains("tombola") || + sentence->contains("lotterie") || + sentence->contains("gewonnen") || + sentence->contains("glueck") || + sentence->contains("das goldene los") || + sentence->contains("sechs richtige") + )) + ) { addResponse(getDialogueId(41773)); applyResponse(); return 2; @@ -93,7 +103,8 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen addResponse(getDialogueId(41771)); applyResponse(); return 2; - } else if (sentence->localWord("upgrade") || sentence->contains("upgrade")) { + } else if (sentence->localWord("upgrade") || sentence->contains("upgrade") + || sentence->localWord("secondclass")) { if (CTrueTalkManager::_currentNPC) { CGameObject *obj; if (CTrueTalkManager::_currentNPC->find("Magazine", &obj, FIND_PET)) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index ffb6b1063c..941136d45e 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -29,22 +29,12 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { -private: - static int _oldId; - TTupdateStateArray _states; - TTsentenceEntries _entries2; - TTsentenceEntries _entries3; private: /** * Setup sentence data */ void setupSentences(); - /** - * Adds dialogue for the player's assigned room - */ - uint addAssignedRoomDialogue(); - /** * Adds dialogue for the player's assigned room */ @@ -65,11 +55,6 @@ private: */ void setCurrentState(uint newId, uint index); - /** - * Does preprocessing for the sentence - */ - int preprocess(const TTroomScript *roomScript, const TTsentence *sentence); - /** * Scans the quotes tree */ @@ -89,6 +74,21 @@ private: * Adds a dialogue description for the player's assigned room */ void addAssignedRoom(); +protected: + static int _oldId; + TTupdateStateArray _states; + TTsentenceEntries _entries2; + TTsentenceEntries _entries3; +protected: + /** + * Does preprocessing for the sentence + */ + int preprocess(const TTroomScript *roomScript, const TTsentence *sentence); + + /** + * Adds dialogue for the player's assigned room + */ + uint addAssignedRoomDialogue(); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/german/barbot_script.cpp b/engines/titanic/true_talk/german/barbot_script.cpp index 616653d9cb..3a8177696a 100644 --- a/engines/titanic/true_talk/german/barbot_script.cpp +++ b/engines/titanic/true_talk/german/barbot_script.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/true_talk/german/deskbot_script.h" +#include "titanic/true_talk/german/barbot_script.h" namespace Titanic { namespace German { diff --git a/engines/titanic/true_talk/german/deskbot_script.cpp b/engines/titanic/true_talk/german/deskbot_script.cpp index 616653d9cb..c4d4d3703c 100644 --- a/engines/titanic/true_talk/german/deskbot_script.cpp +++ b/engines/titanic/true_talk/german/deskbot_script.cpp @@ -21,9 +21,58 @@ */ #include "titanic/true_talk/german/deskbot_script.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { namespace German { +int DeskbotScript::preResponse(uint id) { + int newId = 0; + if (getValue(1) >= 3 && (id == 41190 || id == 41429 || id == 41755 || id == 41757)) + newId = 241601; + + if (id == 42132) + CTrueTalkManager::triggerAction(20, 0); + + return newId; +} + +int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { + if (val1 != 4501) + return TTnpcScript::doSentenceEntry(val1, srcIdP, roomScript, sentence); + + int v = getValue(1); + int tagId = *srcIdP; + + switch (v) { + case 1: + tagId = 240336; + break; + + case 2: + tagId = addAssignedRoomDialogue(); + break; + + case 3: + if (tagId == 240431 || tagId == 240432) { + if (getValue(v) == 1) { + if (tagId == 240431) + tagId = 240432; + } else { + if (tagId == 240432) + tagId = 240431; + } + } + break; + + default: + break; + } + + addResponse(getDialogueId(tagId)); + applyResponse(); + return 2; +} + } // End of namespace German } // End of namespace Titanic diff --git a/engines/titanic/true_talk/german/deskbot_script.h b/engines/titanic/true_talk/german/deskbot_script.h index 1987fb7302..c3719c85d0 100644 --- a/engines/titanic/true_talk/german/deskbot_script.h +++ b/engines/titanic/true_talk/german/deskbot_script.h @@ -33,6 +33,16 @@ public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : ::Titanic::DeskbotScript(val1, charClass, v2, charName, v3, val2) {} + + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); + + /** + * Process a sentence fragment entry + */ + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); }; } // End of namespace German -- cgit v1.2.3