[Scummvm-cvs-logs] scummvm master -> 320985b0c541b13af82c95cc0095ab2142285f84

dreammaster dreammaster at scummvm.org
Mon Aug 1 00:58:50 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
320985b0c5 TITANIC: Added DoorbotScript scriptChanged


Commit: 320985b0c541b13af82c95cc0095ab2142285f84
    https://github.com/scummvm/scummvm/commit/320985b0c541b13af82c95cc0095ab2142285f84
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-07-31T18:58:42-04:00

Commit Message:
TITANIC: Added DoorbotScript scriptChanged

Changed paths:
    engines/titanic/true_talk/doorbot_script.cpp
    engines/titanic/true_talk/doorbot_script.h



diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index 230acf7..c044c79 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) {
diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h
index 09bbd56..78ebcbf 100644
--- a/engines/titanic/true_talk/doorbot_script.h
+++ b/engines/titanic/true_talk/doorbot_script.h
@@ -34,6 +34,7 @@ private:
 	TTupdateStateArray _states;
 	SentenceEntriesMap _sentences;
 	int _stateIndex;
+	int _doorbotState;
 private:
 	/**
 	 * Setup sentence data






More information about the Scummvm-git-logs mailing list