TITANIC: Fleshing out TTparser considerRequests

This commit is contained in:
Paul Gilbert 2016-05-28 11:03:04 -04:00
parent 8a31189121
commit 23cd7fd299
8 changed files with 110 additions and 10 deletions

View File

@ -78,7 +78,7 @@ public:
public:
TTconcept();
TTconcept(TTscriptBase *script, ScriptType scriptType);
TTconcept(TTword *word, ScriptType scriptType);
TTconcept(TTword *word, ScriptType scriptType = ST_UNKNOWN_SCRIPT);
TTconcept(TTconcept &src);
~TTconcept();

View File

@ -26,7 +26,7 @@ namespace Titanic {
bool TTmajorWord::_staticFlag;
TTmajorWord::TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3) :
TTmajorWord::TTmajorWord(const TTstring &str, WordClass wordClass, int val2, int val3) :
TTword(str, wordClass, val2), _field2C(val3) {
}

View File

@ -38,7 +38,7 @@ protected:
*/
int saveData(SimpleFile *file, int val) const;
public:
TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3);
TTmajorWord(const TTstring &str, WordClass wordClass, int val2, int val3);
TTmajorWord(const TTmajorWord *src);
/**

View File

@ -24,6 +24,7 @@
#include "titanic/true_talk/script_handler.h"
#include "titanic/true_talk/tt_action.h"
#include "titanic/true_talk/tt_concept.h"
#include "titanic/true_talk/tt_picture.h"
#include "titanic/true_talk/tt_sentence.h"
#include "titanic/true_talk/tt_word.h"
#include "titanic/titanic.h"
@ -732,11 +733,9 @@ int TTparser::considerRequests(TTword *word) {
int status = 0;
bool flag = false;
bool modifierFlag = false;
int seekFlag = 0;
while (word) {
//int ecx = 906;
//int edx = 12;
if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) {
addNode(7);
addNode(5);
@ -894,6 +893,29 @@ int TTparser::considerRequests(TTword *word) {
break;
case SEEK_NEW_FRAME:
if (word->_wordClass == WC_ACTION && word->_id != 104 && word->_id != 107) {
if (concept && (_sentenceConcept->_concept5P || _sentenceConcept->_concept2P)) {
TTsentenceConcept *oldNode = _sentenceConcept;
oldNode->_field1C = 2;
_sentenceConcept = oldNode->addSibling();
concept = nullptr;
_sentenceConcept->_concept1P = oldNode->_concept1P;
_sentenceConcept->_concept5P = oldNode->_concept5P;
_sentenceConcept->_concept2P = oldNode->_concept2P;
if (seekFlag) {
seekFlag = 0;
_sentenceConcept->_field18 = oldNode->_field18;
oldNode->_field18 = seekFlag;
}
}
flag = true;
}
break;
case SEEK_STATE_OBJECT:
if (!_sentenceConcept->_concept5P) {
addToConceptList(word);
@ -938,6 +960,84 @@ int TTparser::considerRequests(TTword *word) {
break;
case WORD_TYPE_IS_SENTENCE_TYPE:
if (_sentence->_field2C == 1 || _sentence->_field2C == 10) {
for (TTword *wordP = _currentWordP; wordP; wordP = wordP->_nextP) {
if (wordP->_id == 906) {
_sentence->_field2C = 12;
flag = true;
break;
}
}
TTpicture *newPictP;
TTconcept *newConceptP;
switch (word->_id) {
case 108:
_sentence->_field2C = 8;
break;
case 113:
if (!_sentenceConcept->_concept3P)
_sentence->_field2C = 22;
break;
case 304:
_sentence->_field2C = 25;
break;
case 305:
_sentence->_field2C = 24;
break;
case 306:
_sentence->_field2C = 7;
break;
case 501:
_sentence->_field2C = 9;
break;
case 900:
_sentence->_field2C = 5;
break;
case 901:
_sentence->_field2C = 4;
break;
case 904:
_sentence->_field2C = 6;
break;
case 905:
_sentence->_field2C = 11;
break;
case 906:
_sentence->_field2C = 12;
break;
case 907:
_sentence->_field2C = 13;
break;
case 908:
_sentence->_field2C = 2;
if (!_sentenceConcept->_concept0P) {
newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0);
newConceptP = new TTconcept(newPictP);
_sentenceConcept->_concept0P = newConceptP;
delete newPictP;
addNode(4);
}
break;
case 909:
_sentence->_field2C = 3;
newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0);
newConceptP = new TTconcept(newPictP);
_sentenceConcept->_concept2P = newConceptP;
delete newPictP;
addNode(4);
break;
default:
break;
}
}
flag = true;
break;
case COMPLEX_VERB:
// TODO
break;

View File

@ -26,7 +26,7 @@ namespace Titanic {
bool TTpicture::_staticFlag;
TTpicture::TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6) :
TTpicture::TTpicture(const TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6) :
TTmajorWord(str, wordClass, val2, val4), _tag(val3), _field30(val5), _field3C(val6),
_field38(0) {
}

View File

@ -36,7 +36,7 @@ protected:
int _field38;
int _field3C;
public:
TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6);
TTpicture(const TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6);
TTpicture(const TTpicture *src);
/**

View File

@ -26,7 +26,7 @@
namespace Titanic {
TTword::TTword(TTstring &str, WordClass wordClass, int id) : _text(str),
TTword::TTword(const TTstring &str, WordClass wordClass, int id) : _text(str),
_wordClass(wordClass), _id(id), _tag(0), _field24(0),
_field28(0), _synP(nullptr), _nextP(nullptr) {
_status = str.getStatus() == SS_VALID ? SS_VALID : SS_5;

View File

@ -64,7 +64,7 @@ public:
int _id;
uint _tag;
public:
TTword(TTstring &str, WordClass wordClass, int val2);
TTword(const TTstring &str, WordClass wordClass, int val2);
TTword(const TTword *src);
~TTword();