From 0f30caff932ddacd26ab71c8097ee2eb225633cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Sep 2016 07:54:44 -0400 Subject: TITANIC: Minor fix and cleanup for NPC talking startup --- engines/titanic/true_talk/script_handler.cpp | 21 ++++++++++----------- engines/titanic/true_talk/tt_npc_script.cpp | 9 ++++----- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 64e789a4b9..f434822870 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -60,19 +60,18 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp if (result == SCR_1) result = npcScript->notifyScript(roomScript, dialogueId); - if (result != SCR_3 && result != SCR_4) - return result; + if (dialogueId == 3 || dialogueId == 4) { + delete _concept1P; + delete _concept2P; + delete _concept3P; + delete _concept4P; + _concept1P = nullptr; + _concept2P = nullptr; + _concept3P = nullptr; + _concept4P = nullptr; + } ++_inputCtr; - delete _concept1P; - delete _concept2P; - delete _concept3P; - delete _concept4P; - _concept1P = nullptr; - _concept2P = nullptr; - _concept3P = nullptr; - _concept4P = nullptr; - return result; } diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 280894c05a..a3bed4400c 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -634,13 +634,12 @@ uint TTnpcScript::getDialogueId(uint tagId) { } } - uint oldTagId = tagId; tagId = getRangeValue(tagId); - if (tagId != oldTagId) + if (tagId != origId) tagId = getRangeValue(tagId); - oldTagId = getDialsBitset(); - uint newId = updateState(origId, tagId, oldTagId); + uint dialBits = getDialsBitset(); + uint newId = updateState(origId, tagId, dialBits); if (!newId) return 0; @@ -654,7 +653,7 @@ uint TTnpcScript::getDialogueId(uint tagId) { if (tableP->_id == newId) break; } - uint newVal = tableP->_values[oldTagId]; + uint newVal = tableP->_values[dialBits]; // First slot dialogue Ids idx = 0; -- cgit v1.2.3