diff options
author | Paul Gilbert | 2016-06-02 23:33:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:19:12 -0400 |
commit | 3196e488f196a6c33f89eea389cf8d9a90d5f90d (patch) | |
tree | a68adfcf3632f9ac4d132818659466cf9b2019ff | |
parent | 6eb562a17a56ca415eb939f07d512d627b1907e9 (diff) | |
download | scummvm-rg350-3196e488f196a6c33f89eea389cf8d9a90d5f90d.tar.gz scummvm-rg350-3196e488f196a6c33f89eea389cf8d9a90d5f90d.tar.bz2 scummvm-rg350-3196e488f196a6c33f89eea389cf8d9a90d5f90d.zip |
TITANIC: Finished TTnpcScript processSentence
21 files changed, 98 insertions, 52 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index ddb06b156f..d6768fc359 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -132,7 +132,7 @@ int BarbotScript::proc21(int v1, int v2, int v3) { return 0; } -int BarbotScript::proc22() const { +int BarbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -147,12 +147,12 @@ const int *BarbotScript::getTablePtr(int id) { return nullptr; } -int BarbotScript::proc25() const { +int BarbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void BarbotScript::proc26() { +void BarbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void BarbotScript::proc32() { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 4aaa5f5a40..99dfac88ed 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -51,11 +51,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 7954b7f731..1da2726b17 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -76,7 +76,7 @@ int BellbotScript::proc21(int v1, int v2, int v3) { return 0; } -int BellbotScript::proc22() const { +int BellbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -91,12 +91,12 @@ const int *BellbotScript::getTablePtr(int id) { return nullptr; } -int BellbotScript::proc25() const { +int BellbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void BellbotScript::proc26() { +void BellbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } int BellbotScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 86e9165d01..3c23716892 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -45,11 +45,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; virtual uint translateId(uint id) const; }; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index fe4de23436..ce643f5f38 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -77,7 +77,7 @@ int DeskbotScript::proc21(int v1, int v2, int v3) { return 0; } -int DeskbotScript::proc22() const { +int DeskbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -92,12 +92,12 @@ const int *DeskbotScript::getTablePtr(int id) { return nullptr; } -int DeskbotScript::proc25() const { +int DeskbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void DeskbotScript::proc26() { +void DeskbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } int DeskbotScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 3dda552571..a5fb11e92e 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -40,11 +40,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; virtual uint translateId(uint id) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index aec067e19e..2b248ac601 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -128,7 +128,7 @@ int DoorbotScript::proc21(int v1, int v2, int v3) { return 0; } -int DoorbotScript::proc22() const { +int DoorbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -143,12 +143,12 @@ const int *DoorbotScript::getTablePtr(int id) { return nullptr; } -int DoorbotScript::proc25() const { +int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void DoorbotScript::proc26() { +void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void DoorbotScript::proc32() { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 5158eecb36..72e24db104 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -52,11 +52,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; virtual uint translateId(uint id) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 5ffd6fb8ea..3a64733f2f 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -104,7 +104,7 @@ int LiftbotScript::proc21(int v1, int v2, int v3) { return 0; } -int LiftbotScript::proc22() const { +int LiftbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -119,12 +119,12 @@ const int *LiftbotScript::getTablePtr(int id) { return nullptr; } -int LiftbotScript::proc25() const { +int LiftbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void LiftbotScript::proc26() { +void LiftbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void LiftbotScript::proc32() { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 04454c84d0..9e2a9ff3f8 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -47,11 +47,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual uint translateId(uint id) const; }; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index ed9cc5b56b..c417940eb7 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -82,7 +82,7 @@ int MaitreDScript::proc21(int v1, int v2, int v3) { return 0; } -int MaitreDScript::proc22() const { +int MaitreDScript::proc22(int id) const { warning("TODO"); return 0; } @@ -97,12 +97,12 @@ const int *MaitreDScript::getTablePtr(int id) { return nullptr; } -int MaitreDScript::proc25() const { +int MaitreDScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void MaitreDScript::proc26() { +void MaitreDScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } uint MaitreDScript::translateId(uint id) const { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index d638dee52b..389e3887ab 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -43,11 +43,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual uint translateId(uint id) const; }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 3e195a00c1..a889187ee2 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -64,12 +64,12 @@ const int *ParrotScript::getTablePtr(int id) { return nullptr; } -int ParrotScript::proc25() const { +int ParrotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void ParrotScript::proc26() { +void ParrotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index abf8042c37..3cf804d10d 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -44,8 +44,8 @@ public: virtual bool proc18() const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index c09cadd9b0..b52a02a8d5 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -92,12 +92,12 @@ const int *SuccUBusScript::getTablePtr(int id) { return nullptr; } -int SuccUBusScript::proc25() const { +int SuccUBusScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void SuccUBusScript::proc26() { +void SuccUBusScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 43249999a5..e9263dbf84 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -48,8 +48,8 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 01f51e1ce9..3301926231 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -132,6 +132,7 @@ public: void setFlag(bool val) { _flag = val; } void set1C(int val) { _field1C = val; } int get20() const { return _field20; } + int get34() const { return _field34; } bool checkWordId1() const; bool checkWordId2() const; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 6f3c102013..ff1d854388 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -178,7 +178,7 @@ int TTnpcScript::proc21(int v1, int v2, int v3) { return v1; } -int TTnpcScript::proc22() const { +int TTnpcScript::proc22(int id) const { return 0; } @@ -186,11 +186,11 @@ int TTnpcScript::proc23() const { return 0; } -int TTnpcScript::proc25() const { +int TTnpcScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { return 0; } -void TTnpcScript::proc26() { +void TTnpcScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void TTnpcScript::save(SimpleFile *file) { @@ -482,12 +482,49 @@ int TTnpcScript::processSentence(const TTsentenceEntries *entries, uint entryCou } if (flag) { - // TODO + if (entry._field2C) { + bool flag2 = true; + if (entry._field2C & 0x1000000) + flag2 = sentence->isConcept34(1); + + if (entry._field2C & 0x2000000) + flag2 = sentence->isConcept34(0) || sentence->isConcept34(4); + + if (!flag2) { + flag = false; + } else { + int result = proc25(entry._field2C & 0xFFFFFF, entry._field0, + roomScript, sentence); + if (result == 2) + return 2; + flag = !result; + } + } + + if (flag) { + int dialogueId = getDialogueId(entry._field0); + int id; + if (!dialogueId) + return 1; + else if (dialogueId == 4) + return 2; + addResponse(dialogueId); + + id = proc22(dialogueId); + if (id) + addResponse(getDialogueId(id)); + applyResponse(); + + if (entry._field30) + proc26(entry._field30, &entry, roomScript, sentence); + + return 2; + } } } } - warning("TODO"); + return 1; } } // 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 43e26b6e53..afd7680ac7 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -34,6 +34,7 @@ class CGameManager; class CPetControl; class TTroomScript; class TTsentence; +struct TTsentenceEntry; class TTsentenceEntries; struct TTnpcScriptResponse { @@ -185,11 +186,11 @@ public: virtual uint proc19(uint v); virtual void proc20(int v); virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id) = 0; - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); virtual void saveBody(SimpleFile *file); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index f41ddd1565..8347b424fb 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -291,4 +291,9 @@ int TTsentence::is1C(int val, const TTconceptNode *node) const { return node->_field1C == val; } +bool TTsentence::isConcept34(int slotIndex, TTconceptNode *node) { + TTconcept *concept = getFrameEntry(slotIndex, node); + return concept && concept->get34(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 66d64fcd6d..349d0c3175 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -148,6 +148,8 @@ public: int val, int val2, const TTconceptNode *node); bool fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode); bool fn4(int mode, int wordId, TTconceptNode *node); + + bool isConcept34(int slotIndex, TTconceptNode *node = nullptr); }; } // End of namespace Titanic |