SentenceTab unk4/unk3 are the sentence objects (think of: 'Use objectA with objectB' or 'Give objectA to objectB' etc.); added a little more V2 sentence hackery; added a FIXME regarding some strange sentence code (accessing objectB before it is set) in script.cpp

svn-id: r7562
This commit is contained in:
Max Horn 2003-05-16 02:16:59 +00:00
parent bfb68f513a
commit 7d08aea4cc
5 changed files with 27 additions and 21 deletions

View File

@ -532,8 +532,8 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion) {
const SaveLoadEntry sentenceTabEntries[] = {
MKLINE(SentenceTab, verb, sleUint8, VER_V8),
MKLINE(SentenceTab, unk2, sleUint8, VER_V8),
MKLINE(SentenceTab, unk4, sleUint16, VER_V8),
MKLINE(SentenceTab, unk3, sleUint16, VER_V8),
MKLINE(SentenceTab, objectA, sleUint16, VER_V8),
MKLINE(SentenceTab, objectB, sleUint16, VER_V8),
MKLINE(SentenceTab, freezeCount, sleUint8, VER_V8),
MKEND()
};

View File

@ -709,7 +709,7 @@ void Scumm::doSentence(int c, int b, int a) {
// Check if this doSentence request is identical to the previous one;
// if yes, ignore this invocation.
if (_sentenceNum && st->verb == c && st->unk4 == b && st->unk3 == a)
if (_sentenceNum && st->verb == c && st->objectA == b && st->objectB == a)
return;
_sentenceNum++;
@ -719,7 +719,8 @@ void Scumm::doSentence(int c, int b, int a) {
st = &_sentence[_sentenceNum++];
if (!(st->unk3 & 0xFF00))
// FIXME: this seems wrong, it accesses objectB before we ever set it!
if (!(st->objectB & 0xFF00))
st->unk2 = 0;
else
st->unk2 = 1;
@ -727,8 +728,8 @@ void Scumm::doSentence(int c, int b, int a) {
}
st->verb = c;
st->unk4 = b;
st->unk3 = a;
st->objectA = b;
st->objectB = a;
st->freezeCount = 0;
}
@ -755,12 +756,12 @@ void Scumm::checkAndRunSentenceScript() {
_sentenceNum--;
if (!(_features & GF_AFTER_V7))
if (_sentence[_sentenceNum].unk2 && _sentence[_sentenceNum].unk3 == _sentence[_sentenceNum].unk4)
if (_sentence[_sentenceNum].unk2 && _sentence[_sentenceNum].objectB == _sentence[_sentenceNum].objectA)
return;
_localParamList[0] = _sentence[_sentenceNum].verb;
_localParamList[1] = _sentence[_sentenceNum].unk4;
_localParamList[2] = _sentence[_sentenceNum].unk3;
_localParamList[1] = _sentence[_sentenceNum].objectA;
_localParamList[2] = _sentence[_sentenceNum].objectB;
_currentScript = 0xFF;
if (sentenceScript)
runScript(sentenceScript, 0, 0, _localParamList);

View File

@ -843,8 +843,8 @@ void Scumm_v2::o2_doSentence() {
st = &_sentence[_sentenceNum++];
st->verb = a;
st->unk4 = getVarOrDirectWord(0x40);
st->unk3 = getVarOrDirectWord(0x20);
st->objectA = getVarOrDirectWord(0x40);
st->objectB = getVarOrDirectWord(0x20);
st->freezeCount = 0;
// TODO
@ -852,19 +852,24 @@ void Scumm_v2::o2_doSentence() {
case 1:
// Execute the sentence
_sentenceNum--;
warning("TODO o2_doSentence(%d, %d, %d): execute", st->verb, st->unk4, st->unk3);
warning("TODO o2_doSentence(%d, %d, %d): execute", st->verb, st->objectA, st->objectB);
// FIXME / TODO: The following is hackish, and probably incomplete, but it works somewhat.
_scummVars[8] = st->verb;
_scummVars[9] = st->unk4;
_scummVars[10] = st->unk3;
runVerbCode(st->unk4, st->verb, 0, 0, NULL);
_scummVars[9] = st->objectA;
_scummVars[10] = st->objectB;
runVerbCode(st->objectA, st->verb, 0, 0, NULL);
break;
case 2:
// TODO - print the sentence
// Print the sentence
_sentenceNum--;
warning("TODO o2_doSentence(%d, %d, %d): print", st->verb, st->unk4, st->unk3);
warning("TODO o2_doSentence(%d, %d, %d): print", st->verb, st->objectA, st->objectB);
_scummVars[26] = st->verb;
_scummVars[27] = st->objectA;
_scummVars[28] = st->objectB;
o2_drawSentence();
break;
}
}

View File

@ -748,8 +748,8 @@ void Scumm_v5::o5_doSentence() {
st = &_sentence[_sentenceNum++];
st->verb = a;
st->unk4 = getVarOrDirectWord(0x40);
b = st->unk3 = getVarOrDirectWord(0x20);
st->objectA = getVarOrDirectWord(0x40);
b = st->objectB = getVarOrDirectWord(0x20);
if (b == 0) {
st->unk2 = 0;
} else {

View File

@ -207,8 +207,8 @@ struct ArrayHeader {
struct SentenceTab {
byte verb;
byte unk2;
uint16 unk4;
uint16 unk3;
uint16 objectA;
uint16 objectB;
uint8 freezeCount;
};