diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.h | 16 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 48 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.h | 5 |
4 files changed, 65 insertions, 12 deletions
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 76937dab4b..1c10953206 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -32,7 +32,7 @@ namespace Titanic { int CTrueTalkManager::_v1; int CTrueTalkManager::_v2; -int CTrueTalkManager::_passengerClass; +int CTrueTalkManager::_v3; bool CTrueTalkManager::_v4; bool CTrueTalkManager::_v5; int CTrueTalkManager::_v6; @@ -102,7 +102,7 @@ void CTrueTalkManager::loadStatics(SimpleFile *file) { int count = file->readNumber(); _v1 = file->readNumber(); _v2 = file->readNumber(); - _passengerClass = file->readNumber(); + _v3 = file->readNumber(); _v4 = file->readNumber() != 0; _v5 = file->readNumber() != 0; _v6 = file->readNumber(); @@ -126,7 +126,7 @@ void CTrueTalkManager::saveStatics(SimpleFile *file) { file->writeNumber(10); file->writeNumber(_v1); file->writeNumber(_v2); - file->writeNumber(_passengerClass); + file->writeNumber(_v3); file->writeNumber(_v4 ? 1 : 0); file->writeNumber(_v5 ? 1 : 0); file->writeNumber(_v6); @@ -150,7 +150,7 @@ void CTrueTalkManager::setFlags(int index, int val) { switch (index) { case 1: if (val >= 1 && val <= 3) - _passengerClass = val; + _v3 = val; break; case 2: diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 89b9cfd7db..ef226f2364 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -118,17 +118,10 @@ private: * Return the game state */ CGameState *getGameState() const; - - /** - * Get the player's passenger class - */ - int getPassengerClass() const; - - int getState14() const; public: static int _v1; static int _v2; - static int _passengerClass; + static int _v3; static bool _v4; static bool _v5; static int _v6; @@ -230,6 +223,13 @@ public: * Gets the script associated with a specific room */ TTroomScript *getRoomScript(int roomId) const; + + /** + * Get the player's passenger class + */ + int getPassengerClass() const; + + int getState14() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 2aa3b85726..7020794d1a 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -235,5 +235,53 @@ int TTnpcScript::getRoom54(int roomId) { return room ? room->_field54 : 0; } +int TTnpcScript::getValue(int testNum) { + switch (testNum) { + case 0: + return CTrueTalkManager::_v2; + + case 1: + if (g_vm->_trueTalkManager) + CTrueTalkManager::_v3 = g_vm->_trueTalkManager->getPassengerClass(); + return CTrueTalkManager::_v3; + + case 2: + return CTrueTalkManager::_v4; + + case 3: + return CTrueTalkManager::_v5 != 0; + + case 4: + if (g_vm->_trueTalkManager) { + switch (g_vm->_trueTalkManager->getState14()) { + case 1: + CTrueTalkManager::_v6 = 3; + break; + case 2: + CTrueTalkManager::_v6 = 0; + break; + case 3: + CTrueTalkManager::_v6 = 1; + break; + default: + CTrueTalkManager::_v6 = 2; + break; + } + } + return CTrueTalkManager::_v6; + + case 5: + return CTrueTalkManager::_v7; + + case 6: + return CTrueTalkManager::_v8 != 0; + + case 7: + return !!getRoom54(123); + + default: + return CTrueTalkManager::_v11[testNum]; + } +} } // 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 2c6c6a007f..833a958249 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -77,6 +77,11 @@ protected: void randomizeFlags(); static int getRoom54(int roomId); + + /** + * Perform test on various state values + */ + int getValue(int testNum); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, |