From c08ad39a9442d6f15bacb33b34597338121fa5b4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 22:36:29 -0400 Subject: TITANIC: Added DeskbotScript setFlags17 --- engines/titanic/true_talk/barbot_script.cpp | 19 ++++++++++--------- engines/titanic/true_talk/deskbot_script.cpp | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 10 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index f77b0b1b8a..1c652faf11 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -974,22 +974,23 @@ int BarbotScript::updateState(uint oldId, uint newId, int index) { return 251701 + _field7C ? 3 : 0; } - for (const TTupdateState3 *us = &_states[0]; us->_newId; ++us) { - if (us->_newId == newId) { - if ((us->_dialBits & 1) && !getDialRegion(0)) + for (uint idx = 0; idx < _states.size(); ++idx) { + const TTupdateState3 &us = _states[idx]; + if (us._newId == newId) { + if ((us._dialBits & 1) && !getDialRegion(0)) continue; - if ((us->_dialBits & 2) && getDialRegion(0)) + if ((us._dialBits & 2) && getDialRegion(0)) continue; - if ((us->_dialBits & 4) && !getDialRegion(1)) + if ((us._dialBits & 4) && !getDialRegion(1)) continue; - if ((us->_dialBits & 8) && getDialRegion(1)) + if ((us._dialBits & 8) && getDialRegion(1)) continue; - if ((us->_dialBits & 0x10) && !getDialRegion(2)) + if ((us._dialBits & 0x10) && !getDialRegion(2)) continue; - if ((us->_dialBits & 0x20) && getDialRegion(2)) + if ((us._dialBits & 0x20) && getDialRegion(2)) continue; - setState(us->_newValue); + setState(us._newValue); break; } } diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 219ac74a24..1e3eaae26a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -397,7 +397,25 @@ int DeskbotScript::getStateDialogueId() const { } void DeskbotScript::setFlags17(int newId, int index) { - // TODO + int newValue = getValue(17); + + for (uint idx = 0; idx < _states.size(); ++idx) { + const TTupdateState3 &us = _states[idx]; + if (newId == (idx == 0 ? 0 : us._newId)) { + uint bits = us._dialBits; + + if (!bits + || (index == 1 && (bits & 1) && (bits & 4)) + || (index == 0 && (bits & 2) && (bits & 4)) + || (index == 3 && (bits & 1) && (bits & 8)) + || (index == 2 && (bits & 2) && (bits & 8))) { + newValue = us._newValue; + break; + } + } + } + + CTrueTalkManager::setFlags(17, newValue); } } // End of namespace Titanic -- cgit v1.2.3