diff options
author | Paul Gilbert | 2016-06-11 21:10:01 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:23:25 -0400 |
commit | 314a8f25ab8ea8600962af8c82356a728ff3b977 (patch) | |
tree | 665a38b5d6afd4f6e661353d3e108044867a1d80 /engines/titanic | |
parent | 52f6394ae5e0ef37213f12dd430ac0e580ccd463 (diff) | |
download | scummvm-rg350-314a8f25ab8ea8600962af8c82356a728ff3b977.tar.gz scummvm-rg350-314a8f25ab8ea8600962af8c82356a728ff3b977.tar.bz2 scummvm-rg350-314a8f25ab8ea8600962af8c82356a728ff3b977.zip |
TITANIC: Added ParrotScript scriptChanged
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/game_object.h | 10 | ||||
-rw-r--r-- | engines/titanic/true_talk/parrot_script.cpp | 51 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.h | 7 |
3 files changed, 59 insertions, 9 deletions
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 22c62a809d..24a8ac2f81 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -229,11 +229,6 @@ protected: CGameObject *findRoomObject(const CString &name) const; /** - * Finds an item in various system areas - */ - Found find(const CString &name, CGameObject **item, int findAreas); - - /** * Scan the specified room for an item by name */ static CGameObject *findUnder(CTreeItem *parent, const CString &name); @@ -461,6 +456,11 @@ public: int getPriorClass() const; int getSurface45() const; + + /** + * Finds an item in various system areas + */ + Found find(const CString &name, CGameObject **item, int findAreas); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index cafb220910..e0c7a9b6d4 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/parrot_script.h" +#include "titanic/titanic.h" namespace Titanic { @@ -51,13 +52,55 @@ int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) { - // TODO - return 0; + if (processEntries(roomScript, sentence) == 2) { + int tagId = g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine); + if (!tagId || chooseResponse(roomScript, sentence, tagId) != 2) { + addResponse(getDialogueId(sentence->check2C() ? 280248 : 280235)); + applyResponse(); + } + } + + return 2; } ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint id) { - warning("TODO"); - return SCR_1; + if (id >= 280000 && id <= 280276) { + if (id == 280258) { + if (CTrueTalkManager::_currentNPC) { + CGameObject *chicken; + if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET)) + id = 280147 - getRandomBit(); + } + + id = getDialogueId(id); + } else { + if ((id == 280146 || id == 280147) && CTrueTalkManager::_currentNPC) { + CGameObject *chicken; + if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET)) + id = 280142; + } + + addResponse(getDialogueId(id)); + if (id == 280192) + addResponse(getDialogueId(280222)); + applyResponse(); + } + } + + if (id >= 80000 && id <= 80244) { + if ((id == 80155 || id == 80156) && CTrueTalkManager::_currentNPC) { + CGameObject *chicken; + if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET)) + id = 80151; + } + + addResponse(id); + if (id == 80201) + addResponse(getDialogueId(280222)); + applyResponse(); + } + + return (id == 3) ? SCR_2 : SCR_1; } bool ParrotScript::proc18() const { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 261bc57d7b..b12c35d67a 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -241,6 +241,13 @@ protected: */ int processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); + /** + * Scans through a list of sentence entries for a matching standardized response + */ + int processEntries(TTroomScript *roomScript, TTsentence *sentence) { + return processEntries(&_entries, _entryCount, roomScript, sentence); + } + bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence); void checkItems(TTroomScript *roomScript, TTsentence *sentence); |