From 6558eb78c351aa852c02071ef1c73b5b9ff7259f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 22:30:30 -0400 Subject: TITANIC: More NPC Script support methods --- engines/titanic/true_talk/tt_npc_script.cpp | 20 ++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 6 ++++++ 2 files changed, 26 insertions(+) (limited to 'engines/titanic') diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 70be472d79..d7e3bc167e 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -22,6 +22,7 @@ #include "common/algorithm.h" #include "common/textconsole.h" +#include "titanic/messages/messages.h" #include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_sentence.h" @@ -972,4 +973,23 @@ bool TTnpcScript::fn10(bool flag) { return false; } +bool TTnpcScript::getStateValue() const { + if (!CTrueTalkManager::_currentNPC) + return false; + + CGameObject *bomb; + if (CTrueTalkManager::_currentNPC->find("Bomb", &bomb, FIND_GLOBAL) && bomb) { + CTrueTalkGetStateValueMsg stateMsg(10, -1000); + stateMsg.execute(bomb); + if (stateMsg._stateVal) + return true; + } + + return false; +} + +bool TTnpcScript::sentence2C(TTsentence *sentence) { + return sentence->_field2C >= 2 && sentence->_field2C <= 7; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 2bd4e6dae3..ab4379bf60 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -266,6 +266,12 @@ protected: bool fn10(bool flag); + static bool sentence2C(TTsentence *sentence); + + /** + * Gets the True Talk state value + */ + bool getStateValue() const; public: static void init(); static void deinit(); -- cgit v1.2.3