diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/resource.cpp | 12 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 5 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 8 |
3 files changed, 17 insertions, 8 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp index c23268775f..16aeb06f3e 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -392,7 +392,17 @@ void Scumm::readArrayFromIndexFile() while ((num = _fileHandle.readUint32LE()) != 0) { a = _fileHandle.readUint32LE(); b = _fileHandle.readUint32LE(); - defineArray(num, 5, a, b); + + // FIXME - seems the COMI scripts have a bug related to array 436. + // and visible in script 2015, room 20. Basically, the dimensions + // are swapped in the definition of the array, but its obvious + // that this must be a script bug simply by looking at the defintions + // of other arrays and how they are used. + // Talk to fingolfin if you have questions about this :-) + if (num == 436) + defineArray(num, 5, b, a); + else + defineArray(num, 5, a, b); } } else { while ((num = _fileHandle.readUint16LE()) != 0) { diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 4e2deaf68a..dafe22246d 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -406,7 +406,7 @@ int Scumm::readArray(int array, int idx, int base) // FIXME: comment this for the time being as it was causing ft to crash // in the minefeild - // assert(base >= 0 && base < ah->dim1_size * ah->dim2_size); + //assert(base >= 0 && base < ah->dim1_size * ah->dim2_size); if (ah->type == 4) { return ah->data[base]; @@ -424,12 +424,11 @@ void Scumm::writeArray(int array, int idx, int base, int value) return; base += idx * ah->dim1_size; - //assert(base >= 0 && base < ah->dim1_size * ah->dim2_size); + assert(base >= 0 && base < ah->dim1_size * ah->dim2_size); if (ah->type == 4) { ah->data[base] = value; } else if (_features & GF_AFTER_V8) { - // FIXME - this is just a guess, might be wrong ((uint32 *)ah->data)[base] = TO_LE_32(value); } else { ((uint16 *)ah->data)[base] = TO_LE_16(value); diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 3a8092183b..2bf668a240 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -704,13 +704,13 @@ void Scumm_v8::o8_arrayOps() break; case 0x15: // SO_ASSIGN_SCUMMVAR_LIST b = pop(); - c = pop(); + len = getStackList(list, sizeof(list) / sizeof(list[0])); d = readVar(array); if (d == 0) { - defineArray(array, 5, 0, b + c); + defineArray(array, 5, 0, b + len); } - while (c--) { - writeArray(array, 0, b + c, pop()); + while (--len >= 0) { + writeArray(array, 0, b + len, list[len]); } break; case 0x16: // SO_ASSIGN_2DIM_LIST |