TITANIC: Added TTnpcScript getValue

This commit is contained in:
Paul Gilbert 2016-05-30 10:58:39 -04:00
parent 07c1b2b23d
commit 3ad600439b
4 changed files with 65 additions and 12 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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,