aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk/doorbot_script.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-31 18:58:42 -0400
committerPaul Gilbert2016-07-31 18:58:42 -0400
commit320985b0c541b13af82c95cc0095ab2142285f84 (patch)
tree95b984c52b0820d822f2d4424bdff78a34904458 /engines/titanic/true_talk/doorbot_script.cpp
parent605d915d904184a842e15db8a6f7a1460d704db7 (diff)
downloadscummvm-rg350-320985b0c541b13af82c95cc0095ab2142285f84.tar.gz
scummvm-rg350-320985b0c541b13af82c95cc0095ab2142285f84.tar.bz2
scummvm-rg350-320985b0c541b13af82c95cc0095ab2142285f84.zip
TITANIC: Added DoorbotScript scriptChanged
Diffstat (limited to 'engines/titanic/true_talk/doorbot_script.cpp')
-rw-r--r--engines/titanic/true_talk/doorbot_script.cpp66
1 files changed, 61 insertions, 5 deletions
diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index 230acf7910..c044c79954 100644
--- a/engines/titanic/true_talk/doorbot_script.cpp
+++ b/engines/titanic/true_talk/doorbot_script.cpp
@@ -63,7 +63,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2,
void DoorbotScript::setupSentences() {
for (int idx = 35; idx < 40; ++idx)
CTrueTalkManager::setFlags(idx, 0);
- _state = 1;
+ _doorbotState = 1;
_field68 = 0;
_entryCount = 0;
_dialValues[0] = _dialValues[1] = 100;
@@ -502,8 +502,59 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen
}
ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, uint id) {
- warning("TODO");
- return SCR_1;
+ if (id == 3) {
+ if (roomScript != nullptr && roomScript->_scriptId != 100) {
+ if (CTrueTalkManager::_v9 == 101) {
+ addResponse(getDialogueId(220873));
+ applyResponse();
+ } else {
+ bool flag = false;
+ if (CTrueTalkManager::_currentNPC) {
+ CGameObject *obj;
+ if (CTrueTalkManager::_currentNPC->find("Magazine", &obj, FIND_PET)) {
+ setResponse(getDialogueId(222248), 46);
+ flag = true;
+ }
+ }
+
+ if (!flag) {
+ if (getRandomNumber(100) > 80 && getStateValue()) {
+ addResponse(getDialogueId(221095));
+ applyResponse();
+ flag = true;
+ }
+
+ if (!flag && (_doorbotState || !fn10(true))) {
+ addResponse(getDialogueId(220074));
+ applyResponse();
+ }
+ }
+ }
+ }
+
+ _doorbotState = 0;
+ resetFlags();
+ CTrueTalkManager::_v9 = 0;
+ } else if (id == 4) {
+ setState(0);
+ if (getValue(38) == 0) {
+ addResponse(getDialogueId(220883));
+ applyResponse();
+ }
+
+ CTrueTalkManager::setFlags(38, 0);
+ CTrueTalkManager::setFlags(39, 0);
+ }
+
+ if (id >= 220000 && id <= 222418) {
+ addResponse(getDialogueId(id));
+ applyResponse();
+ } else if (id >= 10000 && id <= 11986) {
+ addResponse(id);
+ applyResponse();
+ }
+
+ return SCR_2;
}
int DoorbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence,
@@ -876,8 +927,13 @@ int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri
break;
}
- warning("TODO");
- return 0;
+ if (id) {
+ addResponse(getDialogueId(id));
+ applyResponse();
+ return 2;
+ } else {
+ return 0;
+ }
}
void DoorbotScript::setDialRegion(int dialNum, int region) {