TITANIC: Load response data for remaining NPC scripts

This commit is contained in:
Paul Gilbert 2016-06-01 06:52:35 -04:00
parent ba5e13d479
commit 451ab9d452
11 changed files with 32 additions and 15 deletions

View File

@ -25,6 +25,12 @@
namespace Titanic {
BarbotScript::BarbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
load("Responses/Barbot");
}
int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;

View File

@ -30,8 +30,7 @@ namespace Titanic {
class BarbotScript : public TTnpcScript {
public:
BarbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {}
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
/**
* Chooses and adds a conversation response based on a specified tag Id.

View File

@ -39,7 +39,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2,
_array[0] = 100;
_array[1] = 0;
load("Responses/Bellbot");
load("Responses/Bellbot", 4);
}
void BellbotScript::proc7(int v1, int v2) {

View File

@ -40,7 +40,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2,
if (_field74 == 1)
_field74 = 0;
load("Responses/Deskbot");
load("Responses/Deskbot", 4);
}
void DeskbotScript::proc7(int v1, int v2) {

View File

@ -25,6 +25,12 @@
namespace Titanic {
DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
load("Responses/Doorbot");
}
int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;

View File

@ -32,8 +32,7 @@ private:
int _array[148];
public:
DoorbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {}
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
/**
* Chooses and adds a conversation response based on a specified tag Id.

View File

@ -25,6 +25,13 @@
namespace Titanic {
LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
load("Responses/Liftbot");
}
int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;

View File

@ -30,8 +30,7 @@ namespace Titanic {
class LiftbotScript : public TTnpcScript {
public:
LiftbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {}
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
/**
* Chooses and adds a conversation response based on a specified tag Id.

View File

@ -27,8 +27,8 @@
namespace Titanic {
MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) {
const char *charName, int v3, int val2) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) {
CTrueTalkManager::setFlags(9, 1);
CTrueTalkManager::setFlags(10, 0);
CTrueTalkManager::setFlags(11, 0);
@ -37,6 +37,8 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2,
CTrueTalkManager::setFlags(14, 0);
CTrueTalkManager::setFlags(15, 0);
CTrueTalkManager::setFlags(16, 0);
load("Responses/MaitreD");
}
int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {

View File

@ -63,13 +63,13 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2,
resetFlags();
}
void TTnpcScript::load(const char *name) {
void TTnpcScript::load(const char *name, int valuesPerTag) {
Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name);
while (r->pos() < r->size()) {
TTnpcScriptResponse sr;
sr._tag = r->readUint32LE();
for (int idx = 0; idx < 4; ++idx)
for (int idx = 0; idx < valuesPerTag; ++idx)
sr._values[idx] = r->readUint32LE();
_responses.push_back(sr);

View File

@ -73,11 +73,10 @@ public:
};
class TTnpcScript : public TTnpcScriptBase {
private:
Common::Array<TTnpcScriptResponse> _responses;
private:
int translateByArray(int id);
protected:
Common::Array<TTnpcScriptResponse> _responses;
byte *_subPtr;
int _field60;
int _field64;
@ -94,7 +93,7 @@ protected:
/**
* Loads response data for the NPC from the given resource
*/
void load(const char *name);
void load(const char *name, int valuesPerTag = 1);
/**
* Reset script flags