aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2007-12-28 00:08:23 +0000
committerTravis Howell2007-12-28 00:08:23 +0000
commit9b0db4be37d023798dc321eec417f863a4774901 (patch)
tree4afd8298a969f398c1955c97bced0fa8e3017367
parentb90740d2037726becc3c4398443d47d55b5f4d8f (diff)
downloadscummvm-rg350-9b0db4be37d023798dc321eec417f863a4774901.tar.gz
scummvm-rg350-9b0db4be37d023798dc321eec417f863a4774901.tar.bz2
scummvm-rg350-9b0db4be37d023798dc321eec417f863a4774901.zip
Move more HE code to HE71, to reduce code size, when using DISABLE_HE option.
svn-id: r30021
-rw-r--r--engines/scumm/he/intern_he.h39
-rw-r--r--engines/scumm/he/script_v100he.cpp16
-rw-r--r--engines/scumm/he/script_v70he.cpp241
-rw-r--r--engines/scumm/he/script_v71he.cpp314
-rw-r--r--engines/scumm/he/script_v72he.cpp85
-rw-r--r--engines/scumm/he/script_v80he.cpp16
-rw-r--r--engines/scumm/he/script_v90he.cpp16
-rw-r--r--engines/scumm/scumm.cpp4
8 files changed, 364 insertions, 367 deletions
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index 5e79b04357..9b51aec05a 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -128,8 +128,6 @@ protected:
int32 _heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags, _heSndSoundFreq;
- bool _skipProcessActors;
-
int _numStoredFlObjects;
ObjectData *_storedFlObjects;
@@ -137,10 +135,6 @@ public:
ScummEngine_v70he(OSystem *syst, const DetectorResult &dr);
~ScummEngine_v70he();
- byte *heFindResourceData(uint32 tag, byte *ptr);
- byte *heFindResource(uint32 tag, byte *ptr);
- byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError);
-
void restoreBackgroundHE(Common::Rect rect, int dirtybit = 0);
protected:
@@ -166,11 +160,6 @@ protected:
void storeFlObject(int slot);
void restoreFlObjects();
- int getStringCharWidth(byte chr);
- virtual int setupStringArray(int size);
- void appendSubstring(int dst, int src, int len2, int len);
- void adjustRect(Common::Rect &rect);
-
virtual void setCursorFromImg(uint img, uint room, uint imgindex);
virtual void setDefaultCursor();
@@ -180,19 +169,11 @@ protected:
void o70_getActorRoom();
void o70_resourceRoutines();
void o70_systemOps();
- void o70_copyString();
- void o70_getStringWidth();
void o70_getStringLen();
- void o70_appendString();
- void o70_concatString();
- void o70_compareString();
void o70_isResourceLoaded();
void o70_readINI();
void o70_writeINI();
- void o70_getStringLenForWidth();
- void o70_getCharIndexInString();
void o70_createDirectory();
- void o70_findBox();
void o70_setSystemMessage();
byte VAR_NUM_SOUND_CHANNELS;
@@ -210,10 +191,15 @@ protected:
const OpcodeEntryv71he *_opcodesv71he;
+ bool _skipProcessActors;
public:
ScummEngine_v71he(OSystem *syst, const DetectorResult &dr);
~ScummEngine_v71he();
+ byte *heFindResourceData(uint32 tag, byte *ptr);
+ byte *heFindResource(uint32 tag, byte *ptr);
+ byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError);
+
Wiz *_wiz;
protected:
@@ -231,8 +217,21 @@ protected:
virtual void clearDrawQueues();
- /* HE version 70 script opcodes */
+ int getStringCharWidth(byte chr);
+ virtual int setupStringArray(int size);
+ void appendSubstring(int dst, int src, int len2, int len);
+ void adjustRect(Common::Rect &rect);
+
+ /* HE version 71 script opcodes */
void o71_kernelSetFunctions();
+ void o71_copyString();
+ void o71_getStringWidth();
+ void o71_appendString();
+ void o71_concatString();
+ void o71_compareString();
+ void o71_getStringLenForWidth();
+ void o71_getCharIndexInString();
+ void o71_findBox();
void o71_polygonOps();
void o71_polygonHit();
diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp
index 32b83f19ba..f651e87bde 100644
--- a/engines/scumm/he/script_v100he.cpp
+++ b/engines/scumm/he/script_v100he.cpp
@@ -262,7 +262,7 @@ void ScummEngine_v100he::setupOpcodes() {
OPCODE(o72_findAllObjects),
/* AC */
OPCODE(o90_findAllObjectsWithClassOf),
- OPCODE(o70_findBox),
+ OPCODE(o71_findBox),
OPCODE(o6_findInventory),
OPCODE(o72_findObject),
/* B0 */
@@ -326,17 +326,17 @@ void ScummEngine_v100he::setupOpcodes() {
OPCODE(o6_startScriptQuick2),
OPCODE(o6_getState),
/* E0 */
- OPCODE(o70_compareString),
- OPCODE(o70_copyString),
- OPCODE(o70_appendString),
- OPCODE(o70_concatString),
+ OPCODE(o71_compareString),
+ OPCODE(o71_copyString),
+ OPCODE(o71_appendString),
+ OPCODE(o71_concatString),
/* E4 */
OPCODE(o70_getStringLen),
- OPCODE(o70_getStringLenForWidth),
+ OPCODE(o71_getStringLenForWidth),
OPCODE(o80_stringToInt),
- OPCODE(o70_getCharIndexInString),
+ OPCODE(o71_getCharIndexInString),
/* E8 */
- OPCODE(o70_getStringWidth),
+ OPCODE(o71_getStringWidth),
OPCODE(o60_readFilePos),
OPCODE(o72_getTimer),
OPCODE(o6_getVerbEntrypoint),
diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp
index 4f3c95f5a6..3f22c16648 100644
--- a/engines/scumm/he/script_v70he.cpp
+++ b/engines/scumm/he/script_v70he.cpp
@@ -340,20 +340,20 @@ void ScummEngine_v70he::setupOpcodes() {
OPCODE(o60_redimArray),
OPCODE(o60_readFilePos),
/* EC */
- OPCODE(o70_copyString),
- OPCODE(o70_getStringWidth),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
OPCODE(o70_getStringLen),
- OPCODE(o70_appendString),
+ OPCODE(o6_invalid),
/* F0 */
- OPCODE(o70_concatString),
- OPCODE(o70_compareString),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
OPCODE(o70_isResourceLoaded),
OPCODE(o70_readINI),
/* F4 */
OPCODE(o70_writeINI),
- OPCODE(o70_getStringLenForWidth),
- OPCODE(o70_getCharIndexInString),
- OPCODE(o70_findBox),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
/* F8 */
OPCODE(o6_invalid),
OPCODE(o70_createDirectory),
@@ -378,64 +378,6 @@ const char *ScummEngine_v70he::getOpcodeDesc(byte i) {
return _opcodesv70he[i].desc;
}
-int ScummEngine_v70he::getStringCharWidth(byte chr) {
- int charset = _string[0]._default.charset;
-
- byte *ptr = getResourceAddress(rtCharset, charset);
- assert(ptr);
- ptr += 29;
-
- int spacing = 0;
-
- int offs = READ_LE_UINT32(ptr + chr * 4 + 4);
- if (offs) {
- spacing = ptr[offs] + (signed char)ptr[offs + 2];
- }
-
- return spacing;
-}
-
-int ScummEngine_v70he::setupStringArray(int size) {
- writeVar(0, 0);
- defineArray(0, kStringArray, 0, size + 1);
- writeArray(0, 0, 0, 0);
- return readVar(0);
-}
-
-void ScummEngine_v70he::appendSubstring(int dst, int src, int srcOffs, int len) {
- int dstOffs, value;
- int i = 0;
-
- if (len == -1) {
- len = resStrLen(getStringAddress(src));
- srcOffs = 0;
- }
-
- dstOffs = resStrLen(getStringAddress(dst));
-
- len -= srcOffs;
- len++;
-
- while (i < len) {
- writeVar(0, src);
- value = readArray(0, 0, srcOffs + i);
- writeVar(0, dst);
- writeArray(0, 0, dstOffs + i, value);
- i++;
- }
-
- writeArray(0, 0, dstOffs + i, 0);
-}
-
-void ScummEngine_v70he::adjustRect(Common::Rect &rect) {
- // Scripts can set all rect positions to -1
- if (rect.right != -1)
- rect.right += 1;
-
- if (rect.bottom != -1)
- rect.bottom += 1;
-}
-
void ScummEngine_v70he::o70_startSound() {
int var, value;
@@ -728,43 +670,6 @@ void ScummEngine_v70he::o70_systemOps() {
}
}
-void ScummEngine_v70he::o70_copyString() {
- int dst, size;
- int src = pop();
-
- size = resStrLen(getStringAddress(src)) + 1;
- dst = setupStringArray(size);
-
- appendSubstring(dst, src, -1, -1);
-
- push(dst);
-}
-
-void ScummEngine_v70he::o70_getStringWidth() {
- int array, pos, len;
- int chr, width = 0;
-
- len = pop();
- pos = pop();
- array = pop();
-
- if (len == -1) {
- pos = 0;
- len = resStrLen(getStringAddress(array));
- }
-
- writeVar(0, array);
- while (pos <= len) {
- chr = readArray(0, 0, pos);
- if (chr == 0)
- break;
- width += getStringCharWidth(chr);
- pos++;
- }
-
- push(width);
-}
-
void ScummEngine_v70he::o70_getStringLen() {
int id, len;
byte *addr;
@@ -779,65 +684,6 @@ void ScummEngine_v70he::o70_getStringLen() {
push(len);
}
-void ScummEngine_v70he::o70_appendString() {
- int dst, size;
-
- int len = pop();
- int srcOffs = pop();
- int src = pop();
-
- size = len - srcOffs + 2;
- dst = setupStringArray(size);
-
- appendSubstring(dst, src, srcOffs, len);
-
- push(dst);
-}
-
-void ScummEngine_v70he::o70_concatString() {
- int dst, size;
-
- int src2 = pop();
- int src1 = pop();
-
- size = resStrLen(getStringAddress(src1));
- size += resStrLen(getStringAddress(src2)) + 1;
- dst = setupStringArray(size);
-
- appendSubstring(dst, src1, 0, -1);
- appendSubstring(dst, src2, 0, -1);
-
- push(dst);
-}
-
-void ScummEngine_v70he::o70_compareString() {
- int result;
-
- int array1 = pop();
- int array2 = pop();
-
- byte *string1 = getStringAddress(array1);
- if (!string1)
- error("o70_compareString: Reference to zeroed array pointer (%d)", array1);
-
- byte *string2 = getStringAddress(array2);
- if (!string2)
- error("o70_compareString: Reference to zeroed array pointer (%d)", array2);
-
- while (*string1 == *string2) {
- if (*string2 == 0) {
- push(0);
- return;
- }
-
- string1++;
- string2++;
- }
-
- result = (*string1 > *string2) ? -1 : 1;
- push(result);
-}
-
void ScummEngine_v70he::o70_isResourceLoaded() {
// Reports percentage of resource loaded by queue
int type;
@@ -934,77 +780,6 @@ void ScummEngine_v70he::o70_writeINI() {
}
}
-void ScummEngine_v70he::o70_getStringLenForWidth() {
- int chr, max;
- int array, len, pos, width = 0;
-
- max = pop();
- pos = pop();
- array = pop();
-
- len = resStrLen(getStringAddress(array));
-
- writeVar(0, array);
- while (pos <= len) {
- chr = readArray(0, 0, pos);
- width += getStringCharWidth(chr);
- if (width >= max) {
- push(pos);
- return;
- }
- pos++;
- }
-
- push(len);
-}
-
-void ScummEngine_v70he::o70_getCharIndexInString() {
- int array, end, len, pos, value;
-
- value = pop();
- end = pop();
- pos = pop();
- array = pop();
-
- if (end >= 0) {
- len = resStrLen(getStringAddress(array));
- if (len < end)
- end = len;
- } else {
- end = 0;
- }
-
- if (pos < 0)
- pos = 0;
-
- writeVar(0, array);
- if (end > pos) {
- while (end >= pos) {
- if (readArray(0, 0, pos) == value) {
- push(pos);
- return;
- }
- pos++;
- }
- } else {
- while (end <= pos) {
- if (readArray(0, 0, pos) == value) {
- push(pos);
- return;
- }
- pos--;
- }
- }
-
- push(-1);
-}
-
-void ScummEngine_v70he::o70_findBox() {
- int y = pop();
- int x = pop();
- push(getSpecialBox(x, y));
-}
-
void ScummEngine_v70he::o70_createDirectory() {
int len;
byte directoryName[100];
diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp
index 5ed4e6c6f2..8b2823aa8c 100644
--- a/engines/scumm/he/script_v71he.cpp
+++ b/engines/scumm/he/script_v71he.cpp
@@ -25,12 +25,10 @@
-#include "common/config-manager.h"
-#include "common/system.h"
-
#include "scumm/actor.h"
#include "scumm/he/intern_he.h"
#include "scumm/scumm.h"
+#include "scumm/util.h"
namespace Scumm {
@@ -334,20 +332,20 @@ void ScummEngine_v71he::setupOpcodes() {
OPCODE(o60_redimArray),
OPCODE(o60_readFilePos),
/* EC */
- OPCODE(o70_copyString),
- OPCODE(o70_getStringWidth),
+ OPCODE(o71_copyString),
+ OPCODE(o71_getStringWidth),
OPCODE(o70_getStringLen),
- OPCODE(o70_appendString),
+ OPCODE(o71_appendString),
/* F0 */
- OPCODE(o70_concatString),
- OPCODE(o70_compareString),
+ OPCODE(o71_concatString),
+ OPCODE(o71_compareString),
OPCODE(o70_isResourceLoaded),
OPCODE(o70_readINI),
/* F4 */
OPCODE(o70_writeINI),
- OPCODE(o70_getStringLenForWidth),
- OPCODE(o70_getCharIndexInString),
- OPCODE(o70_findBox),
+ OPCODE(o71_getStringLenForWidth),
+ OPCODE(o71_getCharIndexInString),
+ OPCODE(o71_findBox),
/* F8 */
OPCODE(o6_invalid),
OPCODE(o70_createDirectory),
@@ -372,6 +370,133 @@ const char *ScummEngine_v71he::getOpcodeDesc(byte i) {
return _opcodesv71he[i].desc;
}
+byte *ScummEngine_v71he::heFindResourceData(uint32 tag, byte *ptr) {
+ ptr = heFindResource(tag, ptr);
+
+ if (ptr == NULL)
+ return NULL;
+ return ptr + _resourceHeaderSize;
+}
+
+byte *ScummEngine_v71he::heFindResource(uint32 tag, byte *searchin) {
+ uint32 curpos, totalsize, size;
+
+ debugC(DEBUG_RESOURCE, "heFindResource(%s, %lx)", tag2str(tag), searchin);
+
+ assert(searchin);
+ searchin += 4;
+ _resourceLastSearchSize = totalsize = READ_BE_UINT32(searchin);
+ curpos = 8;
+ searchin += 4;
+
+ while (curpos < totalsize) {
+ if (READ_BE_UINT32(searchin) == tag) {
+ return searchin;
+ }
+
+ size = READ_BE_UINT32(searchin + 4);
+ if ((int32)size <= 0) {
+ error("(%s) Not found in %d... illegal block len %d", tag2str(tag), 0, size);
+ return NULL;
+ }
+
+ curpos += size;
+ searchin += size;
+ }
+
+ return NULL;
+}
+
+byte *ScummEngine_v71he::findWrappedBlock(uint32 tag, byte *ptr, int state, bool errorFlag) {
+ if (READ_BE_UINT32(ptr) == MKID_BE('MULT')) {
+ byte *offs, *wrap;
+ uint32 size;
+
+ wrap = heFindResource(MKID_BE('WRAP'), ptr);
+ if (wrap == NULL)
+ return NULL;
+
+ offs = heFindResourceData(MKID_BE('OFFS'), wrap);
+ if (offs == NULL)
+ return NULL;
+
+ size = getResourceDataSize(offs) / 4;
+ assert((uint32)state <= (uint32)size);
+
+
+ offs += READ_LE_UINT32(offs + state * sizeof(uint32));
+ offs = heFindResourceData(tag, offs - 8);
+ if (offs)
+ return offs;
+
+ offs = heFindResourceData(MKID_BE('DEFA'), ptr);
+ if (offs == NULL)
+ return NULL;
+
+ return heFindResourceData(tag, offs - 8);
+ } else {
+ return heFindResourceData(tag, ptr);
+ }
+}
+
+int ScummEngine_v71he::getStringCharWidth(byte chr) {
+ int charset = _string[0]._default.charset;
+
+ byte *ptr = getResourceAddress(rtCharset, charset);
+ assert(ptr);
+ ptr += 29;
+
+ int spacing = 0;
+
+ int offs = READ_LE_UINT32(ptr + chr * 4 + 4);
+ if (offs) {
+ spacing = ptr[offs] + (signed char)ptr[offs + 2];
+ }
+
+ return spacing;
+}
+
+int ScummEngine_v71he::setupStringArray(int size) {
+ writeVar(0, 0);
+ defineArray(0, kStringArray, 0, size + 1);
+ writeArray(0, 0, 0, 0);
+ return readVar(0);
+}
+
+void ScummEngine_v71he::appendSubstring(int dst, int src, int srcOffs, int len) {
+ int dstOffs, value;
+ int i = 0;
+
+ if (len == -1) {
+ len = resStrLen(getStringAddress(src));
+ srcOffs = 0;
+ }
+
+ dstOffs = resStrLen(getStringAddress(dst));
+
+ len -= srcOffs;
+ len++;
+
+ while (i < len) {
+ writeVar(0, src);
+ value = readArray(0, 0, srcOffs + i);
+ writeVar(0, dst);
+ writeArray(0, 0, dstOffs + i, value);
+ i++;
+ }
+
+ writeArray(0, 0, dstOffs + i, 0);
+}
+
+void ScummEngine_v71he::adjustRect(Common::Rect &rect) {
+ // Scripts can set all rect positions to -1
+ if (rect.right != -1)
+ rect.right += 1;
+
+ if (rect.bottom != -1)
+ rect.bottom += 1;
+}
+
void ScummEngine_v71he::o71_kernelSetFunctions() {
int args[29];
int num;
@@ -434,6 +559,173 @@ void ScummEngine_v71he::o71_kernelSetFunctions() {
}
}
+void ScummEngine_v71he::o71_copyString() {
+ int dst, size;
+ int src = pop();
+
+ size = resStrLen(getStringAddress(src)) + 1;
+ dst = setupStringArray(size);
+
+ appendSubstring(dst, src, -1, -1);
+
+ push(dst);
+}
+
+void ScummEngine_v71he::o71_getStringWidth() {
+ int array, pos, len;
+ int chr, width = 0;
+
+ len = pop();
+ pos = pop();
+ array = pop();
+
+ if (len == -1) {
+ pos = 0;
+ len = resStrLen(getStringAddress(array));
+ }
+
+ writeVar(0, array);
+ while (pos <= len) {
+ chr = readArray(0, 0, pos);
+ if (chr == 0)
+ break;
+ width += getStringCharWidth(chr);
+ pos++;
+ }
+
+ push(width);
+}
+
+void ScummEngine_v71he::o71_appendString() {
+ int dst, size;
+
+ int len = pop();
+ int srcOffs = pop();
+ int src = pop();
+
+ size = len - srcOffs + 2;
+ dst = setupStringArray(size);
+
+ appendSubstring(dst, src, srcOffs, len);
+
+ push(dst);
+}
+
+void ScummEngine_v71he::o71_concatString() {
+ int dst, size;
+
+ int src2 = pop();
+ int src1 = pop();
+
+ size = resStrLen(getStringAddress(src1));
+ size += resStrLen(getStringAddress(src2)) + 1;
+ dst = setupStringArray(size);
+
+ appendSubstring(dst, src1, 0, -1);
+ appendSubstring(dst, src2, 0, -1);
+
+ push(dst);
+}
+
+void ScummEngine_v71he::o71_compareString() {
+ int result;
+
+ int array1 = pop();
+ int array2 = pop();
+
+ byte *string1 = getStringAddress(array1);
+ if (!string1)
+ error("o71_compareString: Reference to zeroed array pointer (%d)", array1);
+
+ byte *string2 = getStringAddress(array2);
+ if (!string2)
+ error("o71_compareString: Reference to zeroed array pointer (%d)", array2);
+
+ while (*string1 == *string2) {
+ if (*string2 == 0) {
+ push(0);
+ return;
+ }
+
+ string1++;
+ string2++;
+ }
+
+ result = (*string1 > *string2) ? -1 : 1;
+ push(result);
+}
+
+void ScummEngine_v71he::o71_getStringLenForWidth() {
+ int chr, max;
+ int array, len, pos, width = 0;
+
+ max = pop();
+ pos = pop();
+ array = pop();
+
+ len = resStrLen(getStringAddress(array));
+
+ writeVar(0, array);
+ while (pos <= len) {
+ chr = readArray(0, 0, pos);
+ width += getStringCharWidth(chr);
+ if (width >= max) {
+ push(pos);
+ return;
+ }
+ pos++;
+ }
+
+ push(len);
+}
+
+void ScummEngine_v71he::o71_getCharIndexInString() {
+ int array, end, len, pos, value;
+
+ value = pop();
+ end = pop();
+ pos = pop();
+ array = pop();
+
+ if (end >= 0) {
+ len = resStrLen(getStringAddress(array));
+ if (len < end)
+ end = len;
+ } else {
+ end = 0;
+ }
+
+ if (pos < 0)
+ pos = 0;
+
+ writeVar(0, array);
+ if (end > pos) {
+ while (end >= pos) {
+ if (readArray(0, 0, pos) == value) {
+ push(pos);
+ return;
+ }
+ pos++;
+ }
+ } else {
+ while (end <= pos) {
+ if (readArray(0, 0, pos) == value) {
+ push(pos);
+ return;
+ }
+ pos--;
+ }
+ }
+
+ push(-1);
+}
+
+void ScummEngine_v71he::o71_findBox() {
+ int y = pop();
+ int x = pop();
+ push(getSpecialBox(x, y));
+}
+
void ScummEngine_v71he::o71_polygonOps() {
int vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y;
int id, fromId, toId;
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index ba7d4b9d0a..1ac5c80ab7 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -344,20 +344,20 @@ void ScummEngine_v72he::setupOpcodes() {
OPCODE(o72_redimArray),
OPCODE(o60_readFilePos),
/* EC */
- OPCODE(o70_copyString),
- OPCODE(o70_getStringWidth),
+ OPCODE(o71_copyString),
+ OPCODE(o71_getStringWidth),
OPCODE(o70_getStringLen),
- OPCODE(o70_appendString),
+ OPCODE(o71_appendString),
/* F0 */
- OPCODE(o70_concatString),
- OPCODE(o70_compareString),
+ OPCODE(o71_concatString),
+ OPCODE(o71_compareString),
OPCODE(o70_isResourceLoaded),
OPCODE(o72_readINI),
/* F4 */
OPCODE(o72_writeINI),
- OPCODE(o70_getStringLenForWidth),
- OPCODE(o70_getCharIndexInString),
- OPCODE(o70_findBox),
+ OPCODE(o71_getStringLenForWidth),
+ OPCODE(o71_getCharIndexInString),
+ OPCODE(o71_findBox),
/* F8 */
OPCODE(o72_getResourceSize),
OPCODE(o72_createDirectory),
@@ -629,75 +629,6 @@ void ScummEngine_v72he::decodeScriptString(byte *dst, bool scriptString) {
*dst = 0;
}
-byte *ScummEngine_v70he::heFindResourceData(uint32 tag, byte *ptr) {
- ptr = heFindResource(tag, ptr);
-
- if (ptr == NULL)
- return NULL;
- return ptr + _resourceHeaderSize;
-}
-
-byte *ScummEngine_v70he::heFindResource(uint32 tag, byte *searchin) {
- uint32 curpos, totalsize, size;
-
- debugC(DEBUG_RESOURCE, "heFindResource(%s, %lx)", tag2str(tag), searchin);
-
- assert(searchin);
- searchin += 4;
- _resourceLastSearchSize = totalsize = READ_BE_UINT32(searchin);
- curpos = 8;
- searchin += 4;
-
- while (curpos < totalsize) {
- if (READ_BE_UINT32(searchin) == tag) {
- return searchin;
- }
-
- size = READ_BE_UINT32(searchin + 4);
- if ((int32)size <= 0) {
- error("(%s) Not found in %d... illegal block len %d", tag2str(tag), 0, size);
- return NULL;
- }
-
- curpos += size;
- searchin += size;
- }
-
- return NULL;
-}
-
-byte *ScummEngine_v70he::findWrappedBlock(uint32 tag, byte *ptr, int state, bool errorFlag) {
- if (READ_BE_UINT32(ptr) == MKID_BE('MULT')) {
- byte *offs, *wrap;
- uint32 size;
-
- wrap = heFindResource(MKID_BE('WRAP'), ptr);
- if (wrap == NULL)
- return NULL;
-
- offs = heFindResourceData(MKID_BE('OFFS'), wrap);
- if (offs == NULL)
- return NULL;
-
- size = getResourceDataSize(offs) / 4;
- assert((uint32)state <= (uint32)size);
-
-
- offs += READ_LE_UINT32(offs + state * sizeof(uint32));
- offs = heFindResourceData(tag, offs - 8);
- if (offs)
- return offs;
-
- offs = heFindResourceData(MKID_BE('DEFA'), ptr);
- if (offs == NULL)
- return NULL;
-
- return heFindResourceData(tag, offs - 8);
- } else {
- return heFindResourceData(tag, ptr);
- }
-}
-
int ScummEngine_v72he::findObject(int x, int y, int num, int *args) {
int b, cls, i, result;
diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp
index cd31e88eb7..393e1d3a8f 100644
--- a/engines/scumm/he/script_v80he.cpp
+++ b/engines/scumm/he/script_v80he.cpp
@@ -341,20 +341,20 @@ void ScummEngine_v80he::setupOpcodes() {
OPCODE(o72_redimArray),
OPCODE(o60_readFilePos),
/* EC */
- OPCODE(o70_copyString),
- OPCODE(o70_getStringWidth),
+ OPCODE(o71_copyString),
+ OPCODE(o71_getStringWidth),
OPCODE(o70_getStringLen),
- OPCODE(o70_appendString),
+ OPCODE(o71_appendString),
/* F0 */
- OPCODE(o70_concatString),
- OPCODE(o70_compareString),
+ OPCODE(o71_concatString),
+ OPCODE(o71_compareString),
OPCODE(o70_isResourceLoaded),
OPCODE(o72_readINI),
/* F4 */
OPCODE(o72_writeINI),
- OPCODE(o70_getStringLenForWidth),
- OPCODE(o70_getCharIndexInString),
- OPCODE(o70_findBox),
+ OPCODE(o71_getStringLenForWidth),
+ OPCODE(o71_getCharIndexInString),
+ OPCODE(o71_findBox),
/* F8 */
OPCODE(o72_getResourceSize),
OPCODE(o72_createDirectory),
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index daabb1795e..76be1a98b9 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -340,20 +340,20 @@ void ScummEngine_v90he::setupOpcodes() {
OPCODE(o72_redimArray),
OPCODE(o60_readFilePos),
/* EC */
- OPCODE(o70_copyString),
- OPCODE(o70_getStringWidth),
+ OPCODE(o71_copyString),
+ OPCODE(o71_getStringWidth),
OPCODE(o70_getStringLen),
- OPCODE(o70_appendString),
+ OPCODE(o71_appendString),
/* F0 */
- OPCODE(o70_concatString),
- OPCODE(o70_compareString),
+ OPCODE(o71_concatString),
+ OPCODE(o71_compareString),
OPCODE(o70_isResourceLoaded),
OPCODE(o72_readINI),
/* F4 */
OPCODE(o72_writeINI),
- OPCODE(o70_getStringLenForWidth),
- OPCODE(o70_getCharIndexInString),
- OPCODE(o70_findBox),
+ OPCODE(o71_getStringLenForWidth),
+ OPCODE(o71_getCharIndexInString),
+ OPCODE(o71_findBox),
/* F8 */
OPCODE(o72_getResourceSize),
OPCODE(o72_createDirectory),
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 18b170dacb..a40137e7cc 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -742,8 +742,6 @@ ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr)
_heSndFlags = 0;
_heSndSoundFreq = 0;
- _skipProcessActors = 0;
-
_numStoredFlObjects = 0;
_storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData));
@@ -768,6 +766,8 @@ ScummEngine_v71he::ScummEngine_v71he(OSystem *syst, const DetectorResult &dr)
memset(_auxEntries, 0, sizeof(_auxEntries));
_wiz = new Wiz(this);
+
+ _skipProcessActors = 0;
}
ScummEngine_v71he::~ScummEngine_v71he() {