aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he/script_v90he.cpp
diff options
context:
space:
mode:
authorMax Horn2009-10-21 09:59:18 +0000
committerMax Horn2009-10-21 09:59:18 +0000
commit745be029b2ecf2c18c5462213aae699b37c0450a (patch)
treece40a45875cb9b369ab04ef432d884374f93aced /engines/scumm/he/script_v90he.cpp
parent0b965ac2d45de7ed37e69fe0eff0b58ad546297a (diff)
downloadscummvm-rg350-745be029b2ecf2c18c5462213aae699b37c0450a.tar.gz
scummvm-rg350-745be029b2ecf2c18c5462213aae699b37c0450a.tar.bz2
scummvm-rg350-745be029b2ecf2c18c5462213aae699b37c0450a.zip
SCUMM: Get rid of 'static int sortArrayOffset' by tweaking ScummEngine_v90he::sortArray
svn-id: r45302
Diffstat (limited to 'engines/scumm/he/script_v90he.cpp')
-rw-r--r--engines/scumm/he/script_v90he.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index e302af1144..cff34412bd 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -1948,41 +1948,39 @@ 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 + sortArrayOffset);
- int vb = *((const uint8 *)a + sortArrayOffset);
+ int va = *((const uint8 *)a);
+ int vb = *((const uint8 *)a);
return va - vb;
}
static int compareByteArrayReverse(const void *a, const void *b) {
- int va = *((const uint8 *)a + sortArrayOffset);
- int vb = *((const uint8 *)a + sortArrayOffset);
+ int va = *((const uint8 *)a);
+ int vb = *((const uint8 *)a);
return vb - va;
}
static int compareIntArray(const void *a, const void *b) {
- int va = (int16)READ_LE_UINT16((const uint8 *)a + sortArrayOffset * 2);
- int vb = (int16)READ_LE_UINT16((const uint8 *)b + sortArrayOffset * 2);
+ int va = (int16)READ_LE_UINT16((const uint8 *)a);
+ int vb = (int16)READ_LE_UINT16((const uint8 *)b);
return va - vb;
}
static int compareIntArrayReverse(const void *a, const void *b) {
- int va = (int16)READ_LE_UINT16((const uint8 *)a + sortArrayOffset * 2);
- int vb = (int16)READ_LE_UINT16((const uint8 *)b + sortArrayOffset * 2);
+ int va = (int16)READ_LE_UINT16((const uint8 *)a);
+ int vb = (int16)READ_LE_UINT16((const uint8 *)b);
return vb - va;
}
static int compareDwordArray(const void *a, const void *b) {
- int va = (int32)READ_LE_UINT32((const uint8 *)a + sortArrayOffset * 4);
- int vb = (int32)READ_LE_UINT32((const uint8 *)b + sortArrayOffset * 4);
+ int va = (int32)READ_LE_UINT32((const uint8 *)a);
+ int vb = (int32)READ_LE_UINT32((const uint8 *)b);
return va - vb;
}
static int compareDwordArrayReverse(const void *a, const void *b) {
- int va = (int32)READ_LE_UINT32((const uint8 *)a + sortArrayOffset * 4);
- int vb = (int32)READ_LE_UINT32((const uint8 *)b + sortArrayOffset * 4);
+ int va = (int32)READ_LE_UINT32((const uint8 *)a);
+ int vb = (int32)READ_LE_UINT32((const uint8 *)b);
return vb - va;
}
@@ -1996,8 +1994,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));
- sortArrayOffset = dim1start - FROM_LE_32(ah->dim1start);
+ const int offset = pitch * (dim2start - FROM_LE_32(ah->dim2start))
+ + dim1start - FROM_LE_32(ah->dim1start);
switch (FROM_LE_32(ah->type)) {
case kByteArray: