aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/true_talk/barbot_script.cpp33
-rw-r--r--engines/titanic/true_talk/barbot_script.h2
-rw-r--r--engines/titanic/true_talk/bellbot_script.cpp4
-rw-r--r--engines/titanic/true_talk/bellbot_script.h4
-rw-r--r--engines/titanic/true_talk/deskbot_script.cpp2
-rw-r--r--engines/titanic/true_talk/deskbot_script.h2
-rw-r--r--engines/titanic/true_talk/doorbot_script.cpp2
-rw-r--r--engines/titanic/true_talk/doorbot_script.h2
-rw-r--r--engines/titanic/true_talk/liftbot_script.cpp2
-rw-r--r--engines/titanic/true_talk/liftbot_script.h2
-rw-r--r--engines/titanic/true_talk/maitred_script.cpp2
-rw-r--r--engines/titanic/true_talk/maitred_script.h2
-rw-r--r--engines/titanic/true_talk/script_support.cpp2
-rw-r--r--engines/titanic/true_talk/script_support.h4
-rw-r--r--engines/titanic/true_talk/succubus_script.cpp2
-rw-r--r--engines/titanic/true_talk/succubus_script.h2
-rw-r--r--engines/titanic/true_talk/tt_npc_script.cpp2
-rw-r--r--engines/titanic/true_talk/tt_npc_script.h2
18 files changed, 50 insertions, 23 deletions
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp
index 345e9a3f0e..f77b0b1b8a 100644
--- a/engines/titanic/true_talk/barbot_script.cpp
+++ b/engines/titanic/true_talk/barbot_script.cpp
@@ -965,9 +965,36 @@ int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
-int BarbotScript::updateState(int oldId, int newId, int index) {
- warning("TODO");
- return 0;
+int BarbotScript::updateState(uint oldId, uint newId, int index) {
+ if (newId == 250538) {
+ CTrueTalkManager::triggerAction(28, 0);
+ return 250538;
+ }
+ if (newId == 251704) {
+ return 251701 + _field7C ? 3 : 0;
+ }
+
+ for (const TTupdateState3 *us = &_states[0]; us->_newId; ++us) {
+ if (us->_newId == newId) {
+ if ((us->_dialBits & 1) && !getDialRegion(0))
+ continue;
+ if ((us->_dialBits & 2) && getDialRegion(0))
+ continue;
+ if ((us->_dialBits & 4) && !getDialRegion(1))
+ continue;
+ if ((us->_dialBits & 8) && getDialRegion(1))
+ continue;
+ if ((us->_dialBits & 0x10) && !getDialRegion(2))
+ continue;
+ if ((us->_dialBits & 0x20) && getDialRegion(2))
+ continue;
+
+ setState(us->_newValue);
+ break;
+ }
+ }
+
+ return newId;
}
int BarbotScript::proc22(int id) const {
diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h
index ba6c5e9000..c8b2962667 100644
--- a/engines/titanic/true_talk/barbot_script.h
+++ b/engines/titanic/true_talk/barbot_script.h
@@ -77,7 +77,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;
diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp
index 3eb840f9ba..1a9a607e6b 100644
--- a/engines/titanic/true_talk/bellbot_script.cpp
+++ b/engines/titanic/true_talk/bellbot_script.cpp
@@ -29,7 +29,7 @@
namespace Titanic {
-int BellbotScript::_oldId;
+uint BellbotScript::_oldId;
BellbotScript::BellbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2) :
@@ -187,7 +187,7 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
-int BellbotScript::updateState(int oldId, int newId, int index) {
+int BellbotScript::updateState(uint oldId, uint newId, int index) {
if (!getValue(25)) {
newId = 202043 - getValue(1) <= 2 ? 994 : 0;
CTrueTalkManager::setFlags(25, 1);
diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h
index ef11985fac..798eecb99d 100644
--- a/engines/titanic/true_talk/bellbot_script.h
+++ b/engines/titanic/true_talk/bellbot_script.h
@@ -29,7 +29,7 @@ namespace Titanic {
class BellbotScript : public TTnpcScript {
private:
- static int _oldId;
+ static uint _oldId;
TTupdateState2Array _states;
int _array[150];
int _field2D0;
@@ -78,7 +78,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;
virtual int proc23() const;
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp
index a10aef25fc..219ac74a24 100644
--- a/engines/titanic/true_talk/deskbot_script.cpp
+++ b/engines/titanic/true_talk/deskbot_script.cpp
@@ -183,7 +183,7 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
}
-int DeskbotScript::updateState(int oldId, int newId, int index) {
+int DeskbotScript::updateState(uint oldId, uint newId, int index) {
if (isDial1Medium() || getValue(1) < 4)
CTrueTalkManager::setFlags(22, 1);
diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h
index 628a7432b8..be12b52509 100644
--- a/engines/titanic/true_talk/deskbot_script.h
+++ b/engines/titanic/true_talk/deskbot_script.h
@@ -82,7 +82,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;
virtual int proc23() const;
diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index 700ad3a666..f644142793 100644
--- a/engines/titanic/true_talk/doorbot_script.cpp
+++ b/engines/titanic/true_talk/doorbot_script.cpp
@@ -251,7 +251,7 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
-int DoorbotScript::updateState(int oldId, int newId, int index) {
+int DoorbotScript::updateState(uint oldId, uint newId, int index) {
warning("TODO");
return 0;
}
diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h
index fa7d39020d..15463d5326 100644
--- a/engines/titanic/true_talk/doorbot_script.h
+++ b/engines/titanic/true_talk/doorbot_script.h
@@ -76,7 +76,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;
diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp
index 04a5c15af8..2308ea1beb 100644
--- a/engines/titanic/true_talk/liftbot_script.cpp
+++ b/engines/titanic/true_talk/liftbot_script.cpp
@@ -211,7 +211,7 @@ int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
-int LiftbotScript::updateState(int oldId, int newId, int index) {
+int LiftbotScript::updateState(uint oldId, uint newId, int index) {
warning("TODO");
return 0;
}
diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h
index ec71e41233..ee8dbc14f5 100644
--- a/engines/titanic/true_talk/liftbot_script.h
+++ b/engines/titanic/true_talk/liftbot_script.h
@@ -73,7 +73,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;
diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp
index 089aff0788..abf0bc934f 100644
--- a/engines/titanic/true_talk/maitred_script.cpp
+++ b/engines/titanic/true_talk/maitred_script.cpp
@@ -185,7 +185,7 @@ int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence,
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
-int MaitreDScript::updateState(int oldId, int newId, int index) {
+int MaitreDScript::updateState(uint oldId, uint newId, int index) {
warning("TODO");
return 0;
}
diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h
index a310b0ab83..ad43438705 100644
--- a/engines/titanic/true_talk/maitred_script.h
+++ b/engines/titanic/true_talk/maitred_script.h
@@ -60,7 +60,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;
virtual int proc23() const;
diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp
index 35777128ca..af5ef05283 100644
--- a/engines/titanic/true_talk/script_support.cpp
+++ b/engines/titanic/true_talk/script_support.cpp
@@ -187,7 +187,7 @@ void TTupdateState3Array::load(const char *name) {
TTupdateState3 ue;
ue._newId = r->readUint32LE();
ue._newValue = r->readUint32LE();
- ue._idMatch = r->readUint32LE();
+ ue._dialBits = r->readUint32LE();
push_back(ue);
}
diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h
index 595105f9ce..6a60563202 100644
--- a/engines/titanic/true_talk/script_support.h
+++ b/engines/titanic/true_talk/script_support.h
@@ -157,9 +157,9 @@ public:
struct TTupdateState3 {
uint _newId;
uint _newValue;
- uint _idMatch;
+ uint _dialBits;
- TTupdateState3() : _newId(0), _newValue(0), _idMatch(0) {}
+ TTupdateState3() : _newId(0), _newValue(0), _dialBits(0) {}
};
class TTupdateState3Array : public Common::Array<TTupdateState3> {
diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp
index b1e4351ee5..a6e1f7fccc 100644
--- a/engines/titanic/true_talk/succubus_script.cpp
+++ b/engines/titanic/true_talk/succubus_script.cpp
@@ -84,7 +84,7 @@ ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint
return SCR_1;
}
-int SuccUBusScript::updateState(int oldId, int newId, int index) {
+int SuccUBusScript::updateState(uint oldId, uint newId, int index) {
warning("TODO");
return 0;
}
diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h
index ba8bc610bf..560272bdd9 100644
--- a/engines/titanic/true_talk/succubus_script.h
+++ b/engines/titanic/true_talk/succubus_script.h
@@ -57,7 +57,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc23() const;
virtual int proc25(int val1, const int *srcIdP, 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 f21111134e..18ade0cba6 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -372,7 +372,7 @@ void TTnpcScript::resetRange(int id) {
range->_priorIndex = 0;
}
-int TTnpcScript::updateState(int oldId, int newId, int index) {
+int TTnpcScript::updateState(uint oldId, uint newId, int index) {
return newId;
}
diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h
index 833262deb8..eb53dc9bb2 100644
--- a/engines/titanic/true_talk/tt_npc_script.h
+++ b/engines/titanic/true_talk/tt_npc_script.h
@@ -259,7 +259,7 @@ public:
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
- virtual int updateState(int oldId, int newId, int index);
+ virtual int updateState(uint oldId, uint newId, int index);
virtual int proc22(int id) const;