Correct bug in array loading from index.

A few changes/corrections for HE 7.2

svn-id: r14724
This commit is contained in:
Travis Howell 2004-08-24 05:04:14 +00:00
parent deeadc97fa
commit 07eb3f50f9
3 changed files with 27 additions and 18 deletions

View File

@ -983,6 +983,14 @@ int ScummEngine::readSoundResource(int type, int idx) {
free(ptr);
return 1;
} else if (basetag == MKID('Mac1')) {
_fileHandle.seek(-12, SEEK_CUR);
total_size = _fileHandle.readUint32BE();
_fileHandle.read(createResource(type, idx, total_size), total_size - 8);
return 1;
} else if (basetag == MKID('TALK')) {
debugC(DEBUG_SOUND, "Found base tag TALK in sound %d, size %d", idx, total_size);
debugC(DEBUG_SOUND, "It was at position %d", _fileHandle.pos());
_fileHandle.seek(-12, SEEK_CUR);
total_size = _fileHandle.readUint32BE();
_fileHandle.read(createResource(type, idx, total_size), total_size - 8);

View File

@ -505,9 +505,8 @@ ArrayHeader *ScummEngine_v6::getArray(int array) {
int ScummEngine_v6::readArray(int array, int idx, int base) {
ArrayHeader *ah = getArray(array);
if (ah == NULL || ah->data == NULL) {
if (ah == NULL || ah->data == NULL)
error("readArray: invalid array %d (%d)", array, readVar(array));
}
// WORKAROUND bug #645711. This is clearly a script bug, as this script
// excerpt shows nicely:
@ -565,7 +564,10 @@ void ScummEngine_v6::readArrayFromIndexFile() {
a = _fileHandle.readUint16LE();
b = _fileHandle.readUint16LE();
c = _fileHandle.readUint16LE();
defineArray(num, c, a, b);
if (c == 1)
defineArray(num, kBitArray, a, b);
else
defineArray(num, kIntArray, a, b);
}
}

View File

@ -551,6 +551,9 @@ void ScummEngine_v72he::o72_dimArray() {
case 4: // SO_BYTE_ARRAY
data = kByteArray;
break;
case 6:
error("New array type");
break;
case 7: // SO_STRING_ARRAY
data = kStringArray;
break;
@ -568,20 +571,23 @@ void ScummEngine_v72he::o72_dimArray() {
void ScummEngine_v72he::o72_dim2dimArray() {
int a, b, data;
int type = fetchScriptByte();
switch (type - 2) {
case 0: // SO_INT_ARRAY
data = kIntArray;
break;
case 1: // SO_BIT_ARRAY
switch (type) {
case 2: // SO_BIT_ARRAY
data = kBitArray;
break;
case 2: // SO_NIBBLE_ARRAY
case 3: // SO_NIBBLE_ARRAY
data = kNibbleArray;
break;
case 3: // SO_BYTE_ARRAY
case 4: // SO_BYTE_ARRAY
data = kByteArray;
break;
case 4: // SO_STRING_ARRAY
case 5: // SO_INT_ARRAY
data = kIntArray;
break;
case 6:
error("New array type");
break;
case 7: // SO_STRING_ARRAY
data = kStringArray;
break;
default:
@ -645,20 +651,13 @@ void ScummEngine_v72he::o72_readINI() {
void ScummEngine_v72he::o72_unknownF4() {
byte b;
int len;
b = fetchScriptByte();
switch (b) {
case 6:
pop();
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
break;
case 7:
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
break;
}
warning("o72_unknownF4 stub");