aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-01 21:59:46 -0400
committerPaul Gilbert2016-07-15 19:18:54 -0400
commite2d3a0a32f62c6865397ca23984e15fbf6af5a3a (patch)
tree922e2e46549e8d75a1b9e4652e58f1721e13155d /engines/titanic/true_talk
parent4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2 (diff)
downloadscummvm-rg350-e2d3a0a32f62c6865397ca23984e15fbf6af5a3a.tar.gz
scummvm-rg350-e2d3a0a32f62c6865397ca23984e15fbf6af5a3a.tar.bz2
scummvm-rg350-e2d3a0a32f62c6865397ca23984e15fbf6af5a3a.zip
TITANIC: Adding setDial method
Diffstat (limited to 'engines/titanic/true_talk')
-rw-r--r--engines/titanic/true_talk/true_talk_manager.h10
-rw-r--r--engines/titanic/true_talk/tt_npc_script.cpp31
-rw-r--r--engines/titanic/true_talk/tt_npc_script.h23
3 files changed, 50 insertions, 14 deletions
diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h
index ef226f2364..3140e72724 100644
--- a/engines/titanic/true_talk/true_talk_manager.h
+++ b/engines/titanic/true_talk/true_talk_manager.h
@@ -110,11 +110,6 @@ private:
static bool proximityMethod1(int val);
/**
- * Return the game manager
- */
- CGameManager *getGameManager() const;
-
- /**
* Return the game state
*/
CGameState *getGameState() const;
@@ -192,6 +187,11 @@ public:
*/
void removeCompleted();
+ /**
+ * Return the game manager
+ */
+ CGameManager *getGameManager() const;
+
void update2();
/**
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp
index 2c8b8ba783..48135d0e63 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -21,6 +21,7 @@
*/
#include "common/textconsole.h"
+#include "titanic/pet_control/pet_control.h"
#include "titanic/true_talk/tt_npc_script.h"
#include "titanic/true_talk/true_talk_manager.h"
#include "titanic/titanic.h"
@@ -53,7 +54,8 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2,
_field6C(0), _field70(0), _field74(0), _field78(0),
_field7C(0), _field80(0), _field2CC(false) {
CTrueTalkManager::_v2 = 0;
- Common::fill(&_array[0], &_array[146], 0);
+ Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0);
+ Common::fill(&_array[0], &_array[136], 0);
if (!CTrueTalkManager::_v10) {
Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0);
@@ -243,15 +245,34 @@ int TTnpcScript::proc31() {
return 0;
}
-void TTnpcScript::proc32() {
+void TTnpcScript::proc32(int dialNum, int region) {
warning("TODO");
}
-void TTnpcScript::proc33(int v1, int v2) {
- warning("TODO");
+void TTnpcScript::setDial(int dialNum, int value) {
+ if (dialNum < DIALS_ARRAY_COUNT) {
+ int oldRegion = proc34(dialNum);
+
+ int newRegion = 1;
+ if (value < 50)
+ newRegion = 0;
+ else if (value > 150)
+ newRegion = 2;
+
+ if (oldRegion == newRegion)
+ proc32(dialNum, newRegion);
+
+ _dialValues[dialNum] = value;
+ }
+
+ if (g_vm->_trueTalkManager) {
+ CPetControl *petControl = g_vm->_trueTalkManager->getGameManager()->getPetControl();
+ if (petControl)
+ petControl->resetDials();
+ }
}
-int TTnpcScript::proc34() {
+int TTnpcScript::proc34(int dialNum) {
warning("TODO");
return 0;
}
diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h
index 3822b520c8..bb495425aa 100644
--- a/engines/titanic/true_talk/tt_npc_script.h
+++ b/engines/titanic/true_talk/tt_npc_script.h
@@ -28,6 +28,8 @@
namespace Titanic {
+#define DIALS_ARRAY_COUNT 10
+
class TTroomScript;
class TTsentence;
@@ -87,7 +89,8 @@ protected:
int _field78;
int _field7C;
int _field80;
- int _array[146];
+ int _dialValues[DIALS_ARRAY_COUNT];
+ int _array[136];
bool _field2CC;
protected:
/**
@@ -115,6 +118,13 @@ protected:
uint getRandomNumber(int max) const;
/**
+ * Gets a random number of 0 or 1
+ */
+ uint getRandomBit() const {
+ return getRandomNumber(2) - 1;
+ }
+
+ /**
* Returns a dialogue Id by script tag value Id
*/
uint getDialogueId(uint tagId);
@@ -164,9 +174,14 @@ public:
virtual void saveBody(SimpleFile *file);
virtual void loadBody(SimpleFile *file);
virtual int proc31();
- virtual void proc32();
- virtual void proc33(int v1, int v2);
- virtual int proc34();
+ virtual void proc32(int dialNum, int region);
+
+ /**
+ * Sets the value for an NPC's dial
+ */
+ virtual void setDial(int dialNum, int value);
+
+ virtual int proc34(int dialNum);
/**
* Get the NPC's dial level