[Scummvm-cvs-logs] SF.net SVN: scummvm: [30021] scummvm/trunk/engines/scumm

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Fri Dec 28 01:08:24 CET 2007


Revision: 30021
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30021&view=rev
Author:   Kirben
Date:     2007-12-27 16:08:23 -0800 (Thu, 27 Dec 2007)

Log Message:
-----------
Move more HE code to HE71, to reduce code size, when using DISABLE_HE option.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/intern_he.h
    scummvm/trunk/engines/scumm/he/script_v100he.cpp
    scummvm/trunk/engines/scumm/he/script_v70he.cpp
    scummvm/trunk/engines/scumm/he/script_v71he.cpp
    scummvm/trunk/engines/scumm/he/script_v72he.cpp
    scummvm/trunk/engines/scumm/he/script_v80he.cpp
    scummvm/trunk/engines/scumm/he/script_v90he.cpp
    scummvm/trunk/engines/scumm/scumm.cpp

Modified: scummvm/trunk/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/intern_he.h	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/intern_he.h	2007-12-28 00:08:23 UTC (rev 30021)
@@ -128,8 +128,6 @@
 
 	int32 _heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags, _heSndSoundFreq;
 
-	bool _skipProcessActors;
-
 	int _numStoredFlObjects;
 	ObjectData *_storedFlObjects;
 
@@ -137,10 +135,6 @@
 	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 @@
 	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 @@
 	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 @@
 
 	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 @@
 
 	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();
 

Modified: scummvm/trunk/engines/scumm/he/script_v100he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v100he.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/script_v100he.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -262,7 +262,7 @@
 		OPCODE(o72_findAllObjects),
 		/* AC */
 		OPCODE(o90_findAllObjectsWithClassOf),
-		OPCODE(o70_findBox),
+		OPCODE(o71_findBox),
 		OPCODE(o6_findInventory),
 		OPCODE(o72_findObject),
 		/* B0 */
@@ -326,17 +326,17 @@
 		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),

Modified: scummvm/trunk/engines/scumm/he/script_v70he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v70he.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/script_v70he.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -340,20 +340,20 @@
 		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 @@
 	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_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 @@
 	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_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];

Modified: scummvm/trunk/engines/scumm/he/script_v71he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v71he.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/script_v71he.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -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 @@
 		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 @@
 	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_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;

Modified: scummvm/trunk/engines/scumm/he/script_v72he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v72he.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/script_v72he.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -344,20 +344,20 @@
 		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 @@
 	*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;
 

Modified: scummvm/trunk/engines/scumm/he/script_v80he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v80he.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/script_v80he.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -341,20 +341,20 @@
 		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),

Modified: scummvm/trunk/engines/scumm/he/script_v90he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v90he.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/he/script_v90he.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -340,20 +340,20 @@
 		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),

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2007-12-27 23:41:15 UTC (rev 30020)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2007-12-28 00:08:23 UTC (rev 30021)
@@ -742,8 +742,6 @@
 	_heSndFlags = 0;
 	_heSndSoundFreq = 0;
 
-	_skipProcessActors = 0;
-
 	_numStoredFlObjects = 0;
 	_storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData));
 
@@ -768,6 +766,8 @@
 	memset(_auxEntries, 0, sizeof(_auxEntries));
 
 	_wiz = new Wiz(this);
+
+	_skipProcessActors = 0;
 }
 
 ScummEngine_v71he::~ScummEngine_v71he() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list