diff options
author | Paul Gilbert | 2016-07-25 21:01:36 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-25 21:01:36 -0400 |
commit | fcb42d57150297725bd0f4aacb802fda78ec5695 (patch) | |
tree | a15ccf1123eb210d174cf8e0d8b055d4fc5a649c /engines/titanic | |
parent | 9c763c978d9ba5b5115ca305429b7dea81091731 (diff) | |
download | scummvm-rg350-fcb42d57150297725bd0f4aacb802fda78ec5695.tar.gz scummvm-rg350-fcb42d57150297725bd0f4aacb802fda78ec5695.tar.bz2 scummvm-rg350-fcb42d57150297725bd0f4aacb802fda78ec5695.zip |
TITANIC: Added Bellbot & Deskbot proc25
Diffstat (limited to 'engines/titanic')
19 files changed, 200 insertions, 22 deletions
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 5e77b15230..362fc11f6e 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -524,7 +524,7 @@ public: /** * Returns the elevator number for the player's currently assigned room */ - int getRoomsElevatorNum1() const { + int getAssignedElevatorNum() const { return _rooms.getAssignedElevatorNum(); } diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index d3e25eacaf..93fa50eda9 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -868,7 +868,7 @@ uint BarbotScript::getDialsBitset() const { return bits; } -int BarbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int BarbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { int v34 = get34(); uint id = 0; @@ -965,7 +965,7 @@ int BarbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TT return 2; } else { if (getDialRegion(1) == 1) { - if (*val2 != 251650) + if (*srcIdP != 251650) id = 251651; } else { addResponse(getDialRegion(0) != 0 ? 51444 : 51530); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 4ce9be6b0a..90f4d951a6 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -76,7 +76,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 66719be0b7..72ea5a471e 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/bellbot_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/core/node_item.h" namespace Titanic { @@ -90,8 +91,87 @@ int BellbotScript::proc23() const { return 0; } -int BellbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { - warning("TODO"); +int BellbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { + switch (val1) { + case 1: + addResponse(getDialogueId(*srcIdP)); + applyResponse(); + return 2; + + case 2: + addResponse(getDialogueId(*srcIdP)); + addResponse(getDialogueId(getRandomNumber(2) == 1 ? 200192 : 200157)); + addResponse(getDialogueId(200176)); + applyResponse(); + return 2; + + case 21: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + if (!sentence->localWord("broken") && !sentence->contains("broken") && + CTrueTalkManager::_currentNPC) { + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName == "5" || nodeName == "6" || nodeName == "7") { + CTrueTalkManager::triggerAction(29, 2); + selectResponse(201571); + applyResponse(); + return 2; + } + } + } + + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); + applyResponse(); + return 2; + + case 22: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + if (!sentence->localWord("broken") && !sentence->contains("broken") && + CTrueTalkManager::_currentNPC) { + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName == "5" || nodeName == "6" || nodeName != "7") { + CTrueTalkManager::triggerAction(29, 2); + selectResponse(201571); + applyResponse(); + return 2; + } + } + } + + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); + applyResponse(); + return 2; + + case 23: + case 24: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + CTrueTalkManager::triggerAction(29, val1 == 23 ? 3 : 4); + break; + + default: + break; + } + return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index dbe3d6272c..e990e322e5 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -62,7 +62,7 @@ public: virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index b50f4ad99e..20431b34a9 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -86,8 +86,48 @@ int DeskbotScript::proc23() const { return 0; } -int DeskbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { - warning("TODO"); +int DeskbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { + uint id; + + switch (val1) { + case 1: + id = *srcIdP; + if (id == 240431 || id == 240432) { + switch (getValue(1)) { + case 1: + id = 240336; + break; + case 2: + id = addAssignedRoomDialogue(); + break; + case 3: + if (getValue(3) == 1) { + if (id == 240431) + id = 240432; + } + else { + if (id == 240432) + id = 240431; + } + default: + break; + } + + addResponse(getDialogueId(id)); + applyResponse(); + return 2; + } + break; + + case 2: + if (getValue(1) == 1) + return true; + break; + + default: + break; + } + return 0; } @@ -115,4 +155,25 @@ bool DeskbotScript::isDial1Low() const { return getDialRegion(1) == 0; } +int DeskbotScript::addAssignedRoomDialogue() { + if (isDial1Medium()) { + addResponse(getDialogueId(240407)); + addResponse(getDialogueId(241510)); + CTrueTalkManager::setFlags(1, 1); + CTrueTalkManager::triggerAction(19, 1); + + int roomNum, floorNum, elevatorNum; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241511)); + addResponse(getDialogueId(241313 + elevatorNum)); + + return 241512; + } else { + return 240567; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 2348a2b59e..2cc8145684 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -34,6 +34,11 @@ private: * Setup sentence data */ void setupSentences(); + + /** + * Adds dialogue for the player's assigned room + */ + int addAssignedRoomDialogue(); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); @@ -54,7 +59,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 5450bbe0df..0ed9a68d7a 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -145,7 +145,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 25d66acd7d..233a247556 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -70,7 +70,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index fe45624b48..123eb7f3c6 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -125,7 +125,7 @@ uint LiftbotScript::getDialsBitset() const { } -int LiftbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 8fec92ebf4..db85a85541 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -67,7 +67,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index dc96e8f168..a59583c993 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -94,7 +94,7 @@ int MaitreDScript::proc23() const { return 0; } -int MaitreDScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int MaitreDScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 4b6d967ee4..91732cddc1 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -58,7 +58,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index d69f6b7807..01d998d9e8 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -107,7 +107,7 @@ int ParrotScript::proc23() const { return 0; } -int ParrotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int ParrotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 2da5897e4b..e832f7cfe7 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -53,7 +53,7 @@ public: virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 346c75e1ff..876cd163bb 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -94,7 +94,7 @@ int SuccUBusScript::proc23() const { return 0; } -int SuccUBusScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int SuccUBusScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 1ff07d48a1..9e393b84b2 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -56,7 +56,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 6199f1123e..7a2ab856d8 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -450,7 +450,7 @@ const TTscriptMapping *TTnpcScript::getMapping(int index) { return nullptr; } -int TTnpcScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } @@ -1017,4 +1017,31 @@ bool TTnpcScript::sentence2C(TTsentence *sentence) { return sentence->_field2C >= 2 && sentence->_field2C <= 7; } +void TTnpcScript::getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) const { + if (roomNum) + *roomNum = 5; + if (floorNum) + *floorNum = 40; + if (elevatorNum) + *elevatorNum = 3; + + CGameManager *gameManager = g_vm->_trueTalkManager->getGameManager(); + CPetControl *petControl = getPetControl(gameManager); + if (petControl) { + if (roomNum) + *roomNum = petControl->getAssignedRoomNum(); + if (floorNum) + *floorNum = petControl->getAssignedFloorNum(); + if (elevatorNum) + *elevatorNum = petControl->getAssignedElevatorNum(); + } + + if (floorNum) + *floorNum = CLIP(*floorNum, 1, 42); + if (roomNum) + *roomNum = CLIP(*roomNum, 1, 18); + if (elevatorNum) + *elevatorNum = CLIP(*elevatorNum, 1, 4); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 346ed694ee..5b992f0675 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -285,6 +285,11 @@ protected: * Gets the True Talk state value */ bool getStateValue() const; + + /** + * Gets the assigned room's room, floor, and elevator number + */ + void getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) const; public: static void init(); static void deinit(); @@ -356,7 +361,7 @@ public: virtual uint getDialsBitset() const { return 0; } virtual const TTscriptMapping *getMapping(int index); - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); |