aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorTravis Howell2010-10-21 05:13:32 +0000
committerTravis Howell2010-10-21 05:13:32 +0000
commit01ea6f86bdc66412836e411dfa0c9f2f4b330907 (patch)
treefd12570285f30f10be7d19defe56a258fa60cdb7 /engines/scumm
parent8ae4926da21c17943fb9621a02a3913a82a2a8f3 (diff)
downloadscummvm-rg350-01ea6f86bdc66412836e411dfa0c9f2f4b330907.tar.gz
scummvm-rg350-01ea6f86bdc66412836e411dfa0c9f2f4b330907.tar.bz2
scummvm-rg350-01ea6f86bdc66412836e411dfa0c9f2f4b330907.zip
SCUMM: Revert revision 45302, which caused regressions when random team is selected in Backyard Football.
svn-id: r53662
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/he/script_v90he.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index 6acc16a804..ce621a8ec7 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -1948,39 +1948,41 @@ void ScummEngine_v90he::getArrayDim(int array, int *dim2start, int *dim2end, int
}
}
+static int sortArrayOffset;
+
static int compareByteArray(const void *a, const void *b) {
- int va = *((const uint8 *)a);
- int vb = *((const uint8 *)a);
+ int va = *((const uint8 *)a + sortArrayOffset);
+ int vb = *((const uint8 *)a + sortArrayOffset);
return va - vb;
}
static int compareByteArrayReverse(const void *a, const void *b) {
- int va = *((const uint8 *)a);
- int vb = *((const uint8 *)a);
+ int va = *((const uint8 *)a + sortArrayOffset);
+ int vb = *((const uint8 *)a + sortArrayOffset);
return vb - va;
}
static int compareIntArray(const void *a, const void *b) {
- int va = (int16)READ_LE_UINT16((const uint8 *)a);
- int vb = (int16)READ_LE_UINT16((const uint8 *)b);
+ int va = (int16)READ_LE_UINT16((const uint8 *)a + sortArrayOffset * 2);
+ int vb = (int16)READ_LE_UINT16((const uint8 *)b + sortArrayOffset * 2);
return va - vb;
}
static int compareIntArrayReverse(const void *a, const void *b) {
- int va = (int16)READ_LE_UINT16((const uint8 *)a);
- int vb = (int16)READ_LE_UINT16((const uint8 *)b);
+ int va = (int16)READ_LE_UINT16((const uint8 *)a + sortArrayOffset * 2);
+ int vb = (int16)READ_LE_UINT16((const uint8 *)b + sortArrayOffset * 2);
return vb - va;
}
static int compareDwordArray(const void *a, const void *b) {
- int va = (int32)READ_LE_UINT32((const uint8 *)a);
- int vb = (int32)READ_LE_UINT32((const uint8 *)b);
+ int va = (int32)READ_LE_UINT32((const uint8 *)a + sortArrayOffset * 4);
+ int vb = (int32)READ_LE_UINT32((const uint8 *)b + sortArrayOffset * 4);
return va - vb;
}
static int compareDwordArrayReverse(const void *a, const void *b) {
- int va = (int32)READ_LE_UINT32((const uint8 *)a);
- int vb = (int32)READ_LE_UINT32((const uint8 *)b);
+ int va = (int32)READ_LE_UINT32((const uint8 *)a + sortArrayOffset * 4);
+ int vb = (int32)READ_LE_UINT32((const uint8 *)b + sortArrayOffset * 4);
return vb - va;
}
@@ -1994,8 +1996,8 @@ void ScummEngine_v90he::sortArray(int array, int dim2start, int dim2end, int dim
const int num = dim2end - dim2start + 1;
const int pitch = FROM_LE_32(ah->dim1end) - FROM_LE_32(ah->dim1start) + 1;
- const int offset = pitch * (dim2start - FROM_LE_32(ah->dim2start))
- + dim1start - FROM_LE_32(ah->dim1start);
+ const int offset = pitch * (dim2start - FROM_LE_32(ah->dim2start));
+ sortArrayOffset = dim1start - FROM_LE_32(ah->dim1start);
switch (FROM_LE_32(ah->type)) {
case kByteArray: