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[] = { const SaveLoadEntry sentenceTabEntries[] = {
MKLINE(SentenceTab, verb, sleUint8, VER_V8), MKLINE(SentenceTab, verb, sleUint8, VER_V8),
MKLINE(SentenceTab, unk2, sleUint8, VER_V8), MKLINE(SentenceTab, unk2, sleUint8, VER_V8),
MKLINE(SentenceTab, unk4, sleUint16, VER_V8), MKLINE(SentenceTab, objectA, sleUint16, VER_V8),
MKLINE(SentenceTab, unk3, sleUint16, VER_V8), MKLINE(SentenceTab, objectB, sleUint16, VER_V8),
MKLINE(SentenceTab, freezeCount, sleUint8, VER_V8), MKLINE(SentenceTab, freezeCount, sleUint8, VER_V8),
MKEND() 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; // Check if this doSentence request is identical to the previous one;
// if yes, ignore this invocation. // 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; return;
_sentenceNum++; _sentenceNum++;
@ -719,7 +719,8 @@ void Scumm::doSentence(int c, int b, int a) {
st = &_sentence[_sentenceNum++]; 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; st->unk2 = 0;
else else
st->unk2 = 1; st->unk2 = 1;
@ -727,8 +728,8 @@ void Scumm::doSentence(int c, int b, int a) {
} }
st->verb = c; st->verb = c;
st->unk4 = b; st->objectA = b;
st->unk3 = a; st->objectB = a;
st->freezeCount = 0; st->freezeCount = 0;
} }
@ -755,12 +756,12 @@ void Scumm::checkAndRunSentenceScript() {
_sentenceNum--; _sentenceNum--;
if (!(_features & GF_AFTER_V7)) 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; return;
_localParamList[0] = _sentence[_sentenceNum].verb; _localParamList[0] = _sentence[_sentenceNum].verb;
_localParamList[1] = _sentence[_sentenceNum].unk4; _localParamList[1] = _sentence[_sentenceNum].objectA;
_localParamList[2] = _sentence[_sentenceNum].unk3; _localParamList[2] = _sentence[_sentenceNum].objectB;
_currentScript = 0xFF; _currentScript = 0xFF;
if (sentenceScript) if (sentenceScript)
runScript(sentenceScript, 0, 0, _localParamList); runScript(sentenceScript, 0, 0, _localParamList);

View file

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

View file

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

View file

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