TITANIC: Implementing npc scripts chooseResponse methods

This commit is contained in:
Paul Gilbert 2016-06-01 07:27:13 -04:00
parent 451ab9d452
commit 58c8833d82
6 changed files with 81 additions and 9 deletions

View File

@ -25,16 +25,44 @@
namespace Titanic {
static const int STATE_ARRAY[7] = {
0x78BE, 0x78C0, 0x78C1, 0x78C2, 0x78C3, 0x78C4, 0x78C5
};
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) {
_state = 0;
load("Responses/Liftbot");
}
int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;
switch (tag) {
case MKTAG('D', 'N', 'A', '1'):
case MKTAG('H', 'H', 'G', 'Q'):
case MKTAG('A', 'N', 'S', 'W'):
if (_state >= 7) {
proc14(30918);
set34(2);
_state = 0;
} else {
addResponse(STATE_ARRAY[_state++]);
}
applyResponse();
return 2;
case MKTAG('O', 'R', 'D', '8'):
addResponse(30475);
addResponse(30467);
addResponse(30466);
addResponse(30474);
applyResponse();
return SS_2;
default:
return TTnpcScript::chooseResponse(roomScript, sentence, tag);
}
}
void LiftbotScript::proc7(int v1, int v2) {

View File

@ -28,6 +28,8 @@
namespace Titanic {
class LiftbotScript : public TTnpcScript {
private:
int _state;
public:
LiftbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);

View File

@ -42,8 +42,15 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2,
}
int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;
if (tag == MKTAG('F', 'O', 'O', 'D') || tag == MKTAG('F', 'I', 'S', 'H') ||
tag == MKTAG('C', 'H', 'S', 'E')) {
addResponse(getDialogueId(260388));
addResponse(getDialogueId(260659));
applyResponse();
return 2;
}
return TTnpcScript::chooseResponse(roomScript, sentence, tag);
}
void MaitreDScript::proc7(int v1, int v2) {

View File

@ -26,8 +26,13 @@
namespace Titanic {
int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;
if (tag == MKTAG('B', 'Y', 'Z', 'A')) {
addResponse(getDialogueId(280246));
applyResponse();
return 2;
} else {
return 1;
}
}
void ParrotScript::proc7(int v1, int v2) {

View File

@ -26,8 +26,36 @@
namespace Titanic {
int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) {
warning("TODO");
return SS_2;
uint dialogueId = tag;
switch (tag) {
case MKTAG('S', 'L', 'O', 'W'):
case MKTAG('T', 'H', 'R', 'T'):
dialogueId = 70021;
case MKTAG('S', 'U', 'C', '1'):
dialogueId = getDialogueId(230009);
break;
case MKTAG('S', 'U', 'C', '2'):
dialogueId = 70117;
break;
case MKTAG('S', 'W', 'E', 'R'):
dialogueId = getRandomNumber(100) > 40 ? 70103 : getDialogueId(230030);
break;
default:
break;
}
if (dialogueId) {
addResponse(dialogueId);
applyResponse();
return 2;
} else {
return 1;
}
}
void SuccUBusScript::proc7(int v1, int v2) {

View File

@ -71,6 +71,8 @@ protected:
void appendResponse2(int val1, int *val2, const TTstring &str) {
appendResponse(val1, val2, str);
}
void set34(int val) { _field34 = val; }
public:
int _id;
public: