diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.h | 10 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.h | 10 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 31 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.h | 23 |
6 files changed, 65 insertions, 19 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 92ec3d6b03..85bac6a63e 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -524,4 +524,9 @@ int CPetControl::roomFn2(int val) { return _rooms.fn2(val); } +void CPetControl::resetDials(int flag) { + if (flag == 1) + _conversations.resetDials(_activeNPCName); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 1eedc0382f..cf1589ca62 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -299,6 +299,11 @@ public: */ void addRoom(int roomNum); int roomFn2(int val); + + /** + * Resets the dial display to reflect new values + */ + void resetDials(int flag = 1); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index b88ddfacd5..cefdf1b8f1 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -148,11 +148,6 @@ private: * Called when the dial for an NPC is being changed */ void npcDialChange(uint dialNum, int oldLevel, int newLevel); - - /** - * Reset the dials with those for a given NPC - */ - void resetDials(const CString &name); public: CPetConversations(); virtual ~CPetConversations() {} @@ -241,6 +236,11 @@ public: * Hide the text cursor */ virtual void hideCursor(); + + /** + * Reset the dials with those for a given NPC + */ + void resetDials(const CString &name); }; } // End of namespace Titanic 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 |