aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/true_talk/barbot_script.cpp1
-rw-r--r--engines/titanic/true_talk/barbot_script.h1
-rw-r--r--engines/titanic/true_talk/bellbot_script.cpp6
-rw-r--r--engines/titanic/true_talk/bellbot_script.h2
-rw-r--r--engines/titanic/true_talk/deskbot_script.cpp1
-rw-r--r--engines/titanic/true_talk/deskbot_script.h1
-rw-r--r--engines/titanic/true_talk/doorbot_script.cpp11
-rw-r--r--engines/titanic/true_talk/doorbot_script.h3
-rw-r--r--engines/titanic/true_talk/liftbot_script.cpp11
-rw-r--r--engines/titanic/true_talk/liftbot_script.h3
-rw-r--r--engines/titanic/true_talk/maitred_script.cpp1
-rw-r--r--engines/titanic/true_talk/maitred_script.h2
-rw-r--r--engines/titanic/true_talk/script_support.cpp22
-rw-r--r--engines/titanic/true_talk/script_support.h22
14 files changed, 51 insertions, 36 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp
index 11197220fa..345e9a3f0e 100644
--- a/engines/titanic/true_talk/barbot_script.cpp
+++ b/engines/titanic/true_talk/barbot_script.cpp
@@ -51,6 +51,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2,
setupSentences();
_tagMappings.load("TagMap/Barbot");
_quotes.load("Quotes/Barbot");
+ _states.load("States/Barbot");
}
void BarbotScript::setupSentences() {
diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h
index dff72d579a..ba6c5e9000 100644
--- a/engines/titanic/true_talk/barbot_script.h
+++ b/engines/titanic/true_talk/barbot_script.h
@@ -32,6 +32,7 @@ private:
int _state;
int _arrIndex;
TTsentenceEntries _entries2;
+ TTupdateState3Array _states;
private:
/**
* Adjust a given dial number by a given delta amount
diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp
index 7748a9d222..3eb840f9ba 100644
--- a/engines/titanic/true_talk/bellbot_script.cpp
+++ b/engines/titanic/true_talk/bellbot_script.cpp
@@ -427,9 +427,9 @@ int BellbotScript::getStateDialogueId() const {
void BellbotScript::setValue23(uint id) {
uint val = 0;
for (uint idx = 0; idx < _states.size() && !val; ++idx) {
- TTmapEntry &me = _states[idx];
- if (me._src == id)
- val = me._dest;
+ TTupdateState2 &us = _states[idx];
+ if (us._src == id)
+ val = us._dest;
}
CTrueTalkManager::setFlags(23, val);
diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h
index 98dd2c90f0..ef11985fac 100644
--- a/engines/titanic/true_talk/bellbot_script.h
+++ b/engines/titanic/true_talk/bellbot_script.h
@@ -30,7 +30,7 @@ namespace Titanic {
class BellbotScript : public TTnpcScript {
private:
static int _oldId;
- TTmapEntries _states;
+ TTupdateState2Array _states;
int _array[150];
int _field2D0;
int _field2D4;
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp
index facc5fd79a..a10aef25fc 100644
--- a/engines/titanic/true_talk/deskbot_script.cpp
+++ b/engines/titanic/true_talk/deskbot_script.cpp
@@ -48,6 +48,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2,
_tagMappings.load("TagMap/Deskbot");
_words.load("Words/Deskbot");
_quotes.load("Quotes/Deskbot");
+ _states.load("States/Deskbot");
}
void DeskbotScript::setupSentences() {
diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h
index c1313a0762..628a7432b8 100644
--- a/engines/titanic/true_talk/deskbot_script.h
+++ b/engines/titanic/true_talk/deskbot_script.h
@@ -31,6 +31,7 @@ namespace Titanic {
class DeskbotScript : public TTnpcScript {
private:
static int _oldId;
+ TTupdateState3Array _states;
private:
/**
* Setup sentence data
diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index 4f74b19463..700ad3a666 100644
--- a/engines/titanic/true_talk/doorbot_script.cpp
+++ b/engines/titanic/true_talk/doorbot_script.cpp
@@ -60,6 +60,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2,
_tagMappings.load("TagMap/Doorbot");
_words.load("Words/Doorbot");
_quotes.load("Quotes/Doorbot");
+ _states.load("States/Doorbot");
}
void DoorbotScript::setupSentences() {
@@ -77,14 +78,14 @@ void DoorbotScript::setupSentences() {
int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') ||
tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) {
- if (_state > 9)
- _state = 0;
- addResponse(STATE_ARRAY[_state]);
+ if (_stateIndex > 9)
+ _stateIndex = 0;
+ addResponse(STATE_ARRAY[_stateIndex]);
applyResponse();
- if (STATE_ARRAY[_state] == 11826)
+ if (STATE_ARRAY[_stateIndex] == 11826)
setState(1);
- ++_state;
+ ++_stateIndex;
return 2;
}
diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h
index db81882af5..fa7d39020d 100644
--- a/engines/titanic/true_talk/doorbot_script.h
+++ b/engines/titanic/true_talk/doorbot_script.h
@@ -29,7 +29,8 @@ namespace Titanic {
class DoorbotScript : public TTnpcScript {
private:
- int _state;
+ TTupdateState3Array _states;
+ int _stateIndex;
private:
/**
* Setup sentence data
diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp
index 6e7d16a66b..04a5c15af8 100644
--- a/engines/titanic/true_talk/liftbot_script.cpp
+++ b/engines/titanic/true_talk/liftbot_script.cpp
@@ -26,6 +26,8 @@
namespace Titanic {
+int LiftbotScript::_stateIndex;
+
static const int STATE_ARRAY[7] = {
0x78BE, 0x78C0, 0x78C1, 0x78C2, 0x78C3, 0x78C4, 0x78C5
};
@@ -33,7 +35,7 @@ static const int STATE_ARRAY[7] = {
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;
+ _stateIndex = 0;
loadRanges("Ranges/Liftbot");
loadResponses("Responses/Liftbot");
@@ -41,6 +43,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2,
_tagMappings.load("TagMap/Liftbot");
_words.load("Words/Liftbot");
_quotes.load("Quotes/Liftbot");
+ _states.load("States/Liftbot");
}
void LiftbotScript::setupSentences() {
@@ -58,12 +61,12 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence
case MKTAG('D', 'N', 'A', '1'):
case MKTAG('H', 'H', 'G', 'Q'):
case MKTAG('A', 'N', 'S', 'W'):
- if (_state >= 7) {
+ if (_stateIndex >= 7) {
selectResponse(30918);
setState(2);
- _state = 0;
+ _stateIndex = 0;
} else {
- addResponse(STATE_ARRAY[_state++]);
+ addResponse(STATE_ARRAY[_stateIndex++]);
}
applyResponse();
diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h
index 3aa620db36..ec71e41233 100644
--- a/engines/titanic/true_talk/liftbot_script.h
+++ b/engines/titanic/true_talk/liftbot_script.h
@@ -29,7 +29,8 @@ namespace Titanic {
class LiftbotScript : public TTnpcScript {
private:
- int _state;
+ TTupdateState2Array _states;
+ static int _stateIndex;
private:
/**
* Setup sentence data
diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp
index d1d6424c18..089aff0788 100644
--- a/engines/titanic/true_talk/maitred_script.cpp
+++ b/engines/titanic/true_talk/maitred_script.cpp
@@ -43,6 +43,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2,
setupSentences();
_tagMappings.load("TagMap/MaitreD");
_quotes.load("Quotes/MaitreD");
+ _states.load("States/MaitreD");
}
void MaitreDScript::setupSentences() {
diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h
index 5937b7d740..a310b0ab83 100644
--- a/engines/titanic/true_talk/maitred_script.h
+++ b/engines/titanic/true_talk/maitred_script.h
@@ -29,6 +29,8 @@ namespace Titanic {
class MaitreDScript : public TTnpcScript {
private:
+ TTupdateState2Array _states;
+private:
/**
* Setup sentence data
*/
diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp
index 1a3d66ad4a..35777128ca 100644
--- a/engines/titanic/true_talk/script_support.cpp
+++ b/engines/titanic/true_talk/script_support.cpp
@@ -164,16 +164,15 @@ void TThandleQuoteEntries::load(const char *name) {
/*------------------------------------------------------------------------*/
-void TTupdateStateEntries::load(const char *name) {
+void TTupdateState2Array::load(const char *name) {
Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name);
while (r->pos() < r->size()) {
- TTupdateStateEntry ue;
- ue._newId = r->readUint32LE();
- ue._newValue = r->readUint32LE();
- ue._idMatch = r->readUint32LE();
+ TTupdateState2 us;
+ us._src = r->readUint32LE();
+ us._dest = r->readUint32LE();
- push_back(ue);
+ push_back(us);
}
delete r;
@@ -181,15 +180,16 @@ void TTupdateStateEntries::load(const char *name) {
/*------------------------------------------------------------------------*/
-void TTmapEntries::load(const char *name) {
+void TTupdateState3Array::load(const char *name) {
Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name);
while (r->pos() < r->size()) {
- TTmapEntry me;
- me._src = r->readUint32LE();
- me._dest = r->readUint32LE();
+ TTupdateState3 ue;
+ ue._newId = r->readUint32LE();
+ ue._newValue = r->readUint32LE();
+ ue._idMatch = r->readUint32LE();
- push_back(me);
+ push_back(ue);
}
delete r;
diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h
index ef71ff08e4..595105f9ce 100644
--- a/engines/titanic/true_talk/script_support.h
+++ b/engines/titanic/true_talk/script_support.h
@@ -142,25 +142,27 @@ public:
void load(const char *name);
};
-struct TTupdateStateEntry {
- uint _newId;
- uint _newValue;
- uint _idMatch;
+struct TTupdateState2 {
+ uint _src;
+ uint _dest;
+
+ TTupdateState2() : _src(0), _dest(0) {}
};
-class TTupdateStateEntries : public Common::Array<TTupdateStateEntry> {
+class TTupdateState2Array : public Common::Array<TTupdateState2> {
public:
void load(const char *name);
};
-struct TTmapEntry {
- uint _src;
- uint _dest;
+struct TTupdateState3 {
+ uint _newId;
+ uint _newValue;
+ uint _idMatch;
- TTmapEntry() : _src(0), _dest(0) {}
+ TTupdateState3() : _newId(0), _newValue(0), _idMatch(0) {}
};
-class TTmapEntries : public Common::Array<TTmapEntry> {
+class TTupdateState3Array : public Common::Array<TTupdateState3> {
public:
void load(const char *name);
};