aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/true_talk/barbot_script.cpp16
-rw-r--r--engines/titanic/true_talk/barbot_script.h5
-rw-r--r--engines/titanic/true_talk/bellbot_script.cpp10
-rw-r--r--engines/titanic/true_talk/bellbot_script.h5
-rw-r--r--engines/titanic/true_talk/deskbot_script.cpp10
-rw-r--r--engines/titanic/true_talk/deskbot_script.h5
-rw-r--r--engines/titanic/true_talk/doorbot_script.cpp17
-rw-r--r--engines/titanic/true_talk/doorbot_script.h6
-rw-r--r--engines/titanic/true_talk/liftbot_script.cpp14
-rw-r--r--engines/titanic/true_talk/liftbot_script.h5
-rw-r--r--engines/titanic/true_talk/maitred_script.cpp9
-rw-r--r--engines/titanic/true_talk/maitred_script.h5
-rw-r--r--engines/titanic/true_talk/parrot_script.cpp10
-rw-r--r--engines/titanic/true_talk/parrot_script.h5
-rw-r--r--engines/titanic/true_talk/succubus_script.cpp10
-rw-r--r--engines/titanic/true_talk/succubus_script.h5
-rw-r--r--engines/titanic/true_talk/tt_npc_script.cpp40
-rw-r--r--engines/titanic/true_talk/tt_npc_script.h37
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp35
-rw-r--r--engines/titanic/true_talk/tt_sentence.h33
20 files changed, 199 insertions, 83 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp
index ebd35a775a..f768885088 100644
--- a/engines/titanic/true_talk/barbot_script.cpp
+++ b/engines/titanic/true_talk/barbot_script.cpp
@@ -22,6 +22,7 @@
#include "common/textconsole.h"
#include "titanic/true_talk/barbot_script.h"
+#include "titanic/true_talk/true_talk_manager.h"
namespace Titanic {
@@ -33,9 +34,22 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
_state = 0;
- _mappings.load("Mappings/Barbot", 8);
+
loadRanges("Ranges/Barbot");
loadResponses("Responses/Barbot");
+ setupSentences();
+}
+
+void BarbotScript::setupSentences() {
+ for (int idx = 28; idx < 35; ++idx)
+ CTrueTalkManager::setFlags(idx, 0);
+ setupDials(100, 100, 100);
+
+ if (!_field74)
+ _field74 = 2;
+
+ _mappings.load("Mappings/Barbot", 8);
+ _entries.load("Sentences/Barbot");
}
int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h
index c2f53dacf3..c5f7800de4 100644
--- a/engines/titanic/true_talk/barbot_script.h
+++ b/engines/titanic/true_talk/barbot_script.h
@@ -35,6 +35,11 @@ private:
* Adjust a given dial number by a given delta amount
*/
void adjustDial(int dialNum, int amount);
+
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
BarbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp
index 5acf01179b..78eab6ee1f 100644
--- a/engines/titanic/true_talk/bellbot_script.cpp
+++ b/engines/titanic/true_talk/bellbot_script.cpp
@@ -39,9 +39,17 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2,
_array[0] = 100;
_array[1] = 0;
- _mappings.load("Mappings/Bellbot", 1);
loadRanges("Ranges/Bellbot");
loadResponses("Responses/Bellbot", 4);
+ setupSentences();
+}
+
+void BellbotScript::setupSentences() {
+ _mappings.load("Mappings/Bellbot", 1);
+ _entries.load("Sentences/Bellbot");
+ _field2DC = 0;
+ _field68 = 0;
+ _entryCount = 0;
}
void BellbotScript::proc7(int v1, int v2) {
diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h
index 552f834094..cc70b27b8d 100644
--- a/engines/titanic/true_talk/bellbot_script.h
+++ b/engines/titanic/true_talk/bellbot_script.h
@@ -34,6 +34,11 @@ private:
int _field2D4;
int _field2D8;
int _field2DC;
+private:
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
BellbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2);
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp
index 8c526163cc..0b8c7e247d 100644
--- a/engines/titanic/true_talk/deskbot_script.cpp
+++ b/engines/titanic/true_talk/deskbot_script.cpp
@@ -40,9 +40,17 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2,
if (_field74 == 1)
_field74 = 0;
- _mappings.load("Mappings/Deskbot", 4);
loadRanges("Ranges/Deskbot");
loadResponses("Responses/Deskbot", 4);
+ setupSentences();
+}
+
+void DeskbotScript::setupSentences() {
+ _mappings.load("Mappings/Deskbot", 4);
+ _entries.load("Sentences/Deskbot");
+ _dialValues[0] = _dialValues[1] = 0;
+ _field68 = 0;
+ _entryCount = 0;
}
void DeskbotScript::proc7(int v1, int v2) {
diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h
index 144209a7e7..224496cc0f 100644
--- a/engines/titanic/true_talk/deskbot_script.h
+++ b/engines/titanic/true_talk/deskbot_script.h
@@ -29,6 +29,11 @@
namespace Titanic {
class DeskbotScript : public TTnpcScript {
+private:
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
DeskbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2);
diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index 92db168eb1..7e0181308f 100644
--- a/engines/titanic/true_talk/doorbot_script.cpp
+++ b/engines/titanic/true_talk/doorbot_script.cpp
@@ -23,6 +23,7 @@
#include "common/textconsole.h"
#include "titanic/true_talk/doorbot_script.h"
#include "titanic/true_talk/tt_room_script.h"
+#include "titanic/true_talk/true_talk_manager.h"
namespace Titanic {
@@ -33,11 +34,21 @@ static const int STATE_ARRAY[9] = {
DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
- Common::fill(&_array[0], &_array[148], 0);
- _state = 0;
- _mappings.load("Mappings/Doorbot", 4);
loadRanges("Ranges/Doorbot");
loadResponses("Responses/Doorbot");
+ setupSentences();
+}
+
+void DoorbotScript::setupSentences() {
+ for (int idx = 35; idx < 40; ++idx)
+ CTrueTalkManager::setFlags(idx, 0);
+ _state = 1;
+ _dialValues[0] = _dialValues[1] = 100;
+
+ _mappings.load("Mappings/Doorbot", 4);
+ _entries.load("Sentences/Doorbot");
+ _field68 = 0;
+ _entryCount = 0;
}
int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h
index 4c18f1fdf4..f7015e14dd 100644
--- a/engines/titanic/true_talk/doorbot_script.h
+++ b/engines/titanic/true_talk/doorbot_script.h
@@ -29,10 +29,14 @@ namespace Titanic {
class DoorbotScript : public TTnpcScript {
private:
- int _array[148];
int _state;
private:
/**
+ * Setup sentence data
+ */
+ void setupSentences();
+
+ /**
* Sets a response
*/
int setResponse(int dialogueId, int v34 = -1);
diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp
index a040160736..b96f485ea9 100644
--- a/engines/titanic/true_talk/liftbot_script.cpp
+++ b/engines/titanic/true_talk/liftbot_script.cpp
@@ -22,6 +22,7 @@
#include "common/textconsole.h"
#include "titanic/true_talk/liftbot_script.h"
+#include "titanic/true_talk/true_talk_manager.h"
namespace Titanic {
@@ -33,9 +34,20 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
_state = 0;
- _mappings.load("Mappings/Liftbot", 4);
+
loadRanges("Ranges/Liftbot");
loadResponses("Responses/Liftbot");
+ setupSentences();
+}
+
+void LiftbotScript::setupSentences() {
+ CTrueTalkManager::setFlags(27, 0);
+ setupDials(getRandomNumber(40) + 60, getRandomNumber(40) + 60, 0);
+
+ _mappings.load("Mappings/Liftbot", 4);
+ _entries.load("Sentences/Liftbot");
+ _field68 = 0;
+ _entryCount = 0;
}
int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h
index b4d739e41d..1db3163956 100644
--- a/engines/titanic/true_talk/liftbot_script.h
+++ b/engines/titanic/true_talk/liftbot_script.h
@@ -30,6 +30,11 @@ namespace Titanic {
class LiftbotScript : public TTnpcScript {
private:
int _state;
+private:
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
LiftbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp
index 6b7a124a18..2497fd83fb 100644
--- a/engines/titanic/true_talk/maitred_script.cpp
+++ b/engines/titanic/true_talk/maitred_script.cpp
@@ -38,9 +38,16 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2,
CTrueTalkManager::setFlags(15, 0);
CTrueTalkManager::setFlags(16, 0);
- _mappings.load("Mappings/MaitreD", 1);
loadRanges("Ranges/MaitreD");
loadResponses("Responses/MaitreD");
+ setupSentences();
+}
+
+void MaitreDScript::setupSentences() {
+ _mappings.load("Mappings/MaitreD", 1);
+ _entries.load("Sentences/MaitreD");
+ _field68 = 0;
+ _entryCount = 0;
}
int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h
index b6e2369e9f..0ebfabfe7f 100644
--- a/engines/titanic/true_talk/maitred_script.h
+++ b/engines/titanic/true_talk/maitred_script.h
@@ -28,6 +28,11 @@
namespace Titanic {
class MaitreDScript : public TTnpcScript {
+private:
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
MaitreDScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2);
diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp
index 5434b8b247..eb08d7ca0e 100644
--- a/engines/titanic/true_talk/parrot_script.cpp
+++ b/engines/titanic/true_talk/parrot_script.cpp
@@ -28,8 +28,16 @@ namespace Titanic {
ParrotScript::ParrotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
- _mappings.load("Mappings/Parrot", 1);
+
loadRanges("Ranges/Parrot");
+ setupSentences();
+}
+
+void ParrotScript::setupSentences() {
+ _mappings.load("Mappings/Parrot", 1);
+ _entries.load("Sentences/Parrot");
+ _field68 = 0;
+ _entryCount = 0;
}
int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h
index ad078af9a2..f5d9cb2828 100644
--- a/engines/titanic/true_talk/parrot_script.h
+++ b/engines/titanic/true_talk/parrot_script.h
@@ -28,6 +28,11 @@
namespace Titanic {
class ParrotScript : public TTnpcScript {
+private:
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
ParrotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp
index f0f2003556..1a2348499d 100644
--- a/engines/titanic/true_talk/succubus_script.cpp
+++ b/engines/titanic/true_talk/succubus_script.cpp
@@ -29,8 +29,16 @@ SuccUBusScript::SuccUBusScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7),
_field2D0(0) {
- _mappings.load("Mappings/SuccUBus", 1);
+
loadRanges("Ranges/SuccUBus");
+ setupSentences();
+}
+
+void SuccUBusScript::setupSentences() {
+ _mappings.load("Mappings/SuccUBus", 1);
+ _entries.load("Sentences/SuccUBus");
+ _field68 = 0;
+ _entryCount = 0;
}
int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h
index 77f338b771..fffdd80d89 100644
--- a/engines/titanic/true_talk/succubus_script.h
+++ b/engines/titanic/true_talk/succubus_script.h
@@ -30,6 +30,11 @@ namespace Titanic {
class SuccUBusScript : public TTnpcScript {
private:
int _field2D0;
+private:
+ /**
+ * Setup sentence data
+ */
+ void setupSentences();
public:
SuccUBusScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp
index e6b803a04c..e06184a0a0 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -55,6 +55,42 @@ TTscriptRange::TTscriptRange(uint id, const Common::Array<uint> &values,
/*------------------------------------------------------------------------*/
+
+bool TTsentenceEntry::load(Common::SeekableReadStream *s) {
+ if (s->pos() >= s->size())
+ return false;
+
+ _field0 = s->readUint32LE();
+ _field4 = s->readUint32LE();
+ _string8 = readStringFromStream(s);
+ _fieldC = s->readUint32LE();
+ _string10 = readStringFromStream(s);
+ _string14 = readStringFromStream(s);
+ _string18 = readStringFromStream(s);
+ _string1C = readStringFromStream(s);
+ _field20 = s->readUint32LE();
+ _string24 = readStringFromStream(s);
+ _field28 = s->readUint32LE();
+ _field2C = s->readUint32LE();
+ _field30 = s->readUint32LE();
+
+ return true;
+}
+
+/*------------------------------------------------------------------------*/
+
+void TTsentenceEntries::load(const CString &resName) {
+ TTsentenceEntry entry;
+ Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName);
+
+ while (entry.load(r))
+ push_back(entry);
+
+ delete r;
+}
+
+/*------------------------------------------------------------------------*/
+
TTscriptMapping::TTscriptMapping() : _id(0) {
Common::fill(&_values[0], &_values[8], 0);
}
@@ -90,7 +126,7 @@ TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2,
TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7),
- _entriesP(nullptr), _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0),
+ _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0),
_field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) {
CTrueTalkManager::_v2 = 0;
Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0);
@@ -183,7 +219,7 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence,
}
void TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) {
- processSentence(_entriesP, _entryCount, roomScript, sentence);
+ processSentence(&_entries, _entryCount, roomScript, sentence);
}
int TTnpcScript::proc8() const {
diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h
index 66cb3af1c3..3a4ac570b7 100644
--- a/engines/titanic/true_talk/tt_npc_script.h
+++ b/engines/titanic/true_talk/tt_npc_script.h
@@ -37,7 +37,6 @@ class CPetControl;
class TTroomScript;
class TTsentence;
struct TTsentenceEntry;
-class TTsentenceEntries;
struct TTnpcScriptResponse {
uint _tag;
@@ -62,6 +61,40 @@ struct TTscriptRange {
bool isSequential);
};
+
+struct TTsentenceEntry {
+ int _field0;
+ int _field4;
+ CString _string8;
+ int _fieldC;
+ CString _string10;
+ CString _string14;
+ CString _string18;
+ CString _string1C;
+ int _field20;
+ CString _string24;
+ int _field28;
+ int _field2C;
+ int _field30;
+
+ TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0),
+ _field20(0), _field28(0), _field2C(0), _field30(0) {}
+
+ /**
+ * Load an entry from the passed stream, and returns true
+ * if an entry was successfully loaded
+ */
+ bool load(Common::SeekableReadStream *s);
+};
+
+class TTsentenceEntries : public Common::Array<TTsentenceEntry> {
+public:
+ /**
+ * Load a list of entries from the specified resource
+ */
+ void load(const CString &resName);
+};
+
struct TTscriptMapping {
uint _id;
uint _values[8];
@@ -115,7 +148,7 @@ protected:
int _valuesPerResponse;
Common::Array<TTscriptRange> _ranges;
TTscriptMappings _mappings;
- const TTsentenceEntries *_entriesP;
+ TTsentenceEntries _entries;
int _entryCount;
int _field68;
int _field6C;
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 8347b424fb..b11912d5e1 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -39,41 +39,6 @@ TTsentenceConcept *TTsentenceConcept::addSibling() {
/*------------------------------------------------------------------------*/
-bool TTsentenceEntry::load(Common::SeekableReadStream *s) {
- if (s->pos() >= s->size())
- return false;
-
- _field0 = s->readUint32LE();
- _field4 = s->readUint32LE();
- _string8 = readStringFromStream(s);
- _fieldC = s->readUint32LE();
- _string10 = readStringFromStream(s);
- _string14 = readStringFromStream(s);
- _string18 = readStringFromStream(s);
- _string1C = readStringFromStream(s);
- _field20 = s->readUint32LE();
- _string24 = readStringFromStream(s);
- _field28 = s->readUint32LE();
- _field2C = s->readUint32LE();
- _field30 = s->readUint32LE();
-
- return true;
-}
-
-/*------------------------------------------------------------------------*/
-
-void TTsentenceEntries::load(const CString &resName) {
- TTsentenceEntry entry;
- Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName);
-
- while (entry.load(r))
- push_back(entry);
-
- delete r;
-}
-
-/*------------------------------------------------------------------------*/
-
TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner,
TTroomScript *roomScript, TTnpcScript *npcScript) :
_owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0),
diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h
index 349d0c3175..f26dd35ce7 100644
--- a/engines/titanic/true_talk/tt_sentence.h
+++ b/engines/titanic/true_talk/tt_sentence.h
@@ -46,39 +46,6 @@ public:
TTsentenceConcept *addSibling();
};
-struct TTsentenceEntry {
- int _field0;
- int _field4;
- CString _string8;
- int _fieldC;
- CString _string10;
- CString _string14;
- CString _string18;
- CString _string1C;
- int _field20;
- CString _string24;
- int _field28;
- int _field2C;
- int _field30;
-
- TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0),
- _field20(0), _field28(0), _field2C(0), _field30(0) {}
-
- /**
- * Load an entry from the passed stream, and returns true
- * if an entry was successfully loaded
- */
- bool load(Common::SeekableReadStream *s);
-};
-
-class TTsentenceEntries : public Common::Array<TTsentenceEntry> {
-public:
- /**
- * Load a list of entries from the specified resource
- */
- void load(const CString &resName);
-};
-
class TTsentence {
private:
CScriptHandler *_owner;