[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.299,2.300 script_v100he.cpp,2.5,2.6 script_v6.cpp,1.414,1.415 script_v6he.cpp,2.131,2.132 script_v72he.cpp,2.161,2.162 script_v7he.cpp,2.103,2.104 script_v80he.cpp,2.54,2.55 scumm.cpp,1.251,1.252

Travis Howell kirben at users.sourceforge.net
Sat Oct 9 18:56:26 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21479/scumm

Modified Files:
	intern.h script_v100he.cpp script_v6.cpp script_v6he.cpp 
	script_v72he.cpp script_v7he.cpp script_v80he.cpp scumm.cpp 
Log Message:

Add some missing code for HE100.
Cleanup


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.299
retrieving revision 2.300
diff -u -d -r2.299 -r2.300
--- intern.h	10 Oct 2004 00:24:15 -0000	2.299
+++ intern.h	10 Oct 2004 01:52:35 -0000	2.300
@@ -612,7 +612,7 @@
 
 	Win32ResExtractor *_win32ResExtractor;
 
-	int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndLoop;
+	int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndFlags;
 
 public:
 	ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]);
@@ -909,6 +909,8 @@
 		const char *desc;
 	};
 
+	int _heResId, _heResType;
+
 	const OpcodeEntryV100he *_opcodesV100he;
 
 public:
@@ -938,6 +940,7 @@
 	void o100_quitPauseRestart();
 	void o100_cursorCommand();
 	void o100_wait();
+	void o100_getResourceSize();
 	void o100_unknown27();
 	void o100_getPaletteData();
 	void o100_unknown25();

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- script_v100he.cpp	10 Oct 2004 00:24:15 -0000	2.5
+++ script_v100he.cpp	10 Oct 2004 01:52:35 -0000	2.6
@@ -272,7 +272,7 @@
 		OPCODE(o72_getNumFreeArrays),
 		OPCODE(o72_getArrayDimSize),
 		OPCODE(o72_checkGlobQueue),
-		OPCODE(o72_getResourceSize),
+		OPCODE(o100_getResourceSize),
 		/* B8 */
 		OPCODE(o100_unknown27),
 		OPCODE(o6_invalid),
@@ -381,11 +381,11 @@
 	Actor *a;
 	int i, j, k;
 	int args[32];
-	byte b;
+	byte subOp;
 	byte string[256];
 
-	b = fetchScriptByte();
-	if (b == 129) {
+	subOp = fetchScriptByte();
+	if (subOp == 129) {
 		_curActor = pop();
 		return;
 	}
@@ -394,7 +394,7 @@
 	if (!a)
 		return;
 
-	switch (b) {
+	switch (subOp) {
 	case 3:
 		pop();
 		pop();
@@ -574,7 +574,7 @@
 		a->_walkFrame = pop();
 		break;
 	default:
-		error("o100_actorOps: default case %d", b);
+		error("o100_actorOps: default case %d", subOp);
 	}
 }
 
@@ -890,43 +890,59 @@
 
 void ScummEngine_v100he::o100_resourceRoutines() {
 	// Incomplete
-	int resid, op;
-	op = fetchScriptByte();
+	int obj, room;
 
-	switch (op) {
+	byte subOp = fetchScriptByte();
+
+	switch (subOp) {
 	case 14:
-		// charset
-		resid = pop();
+		_heResType = rtCharset;
+		_heResId = pop();
 		break;
 	case 25:
-		// costume
-		resid = pop();
+		_heResType = rtCostume;
+		_heResId = pop();
 		break;
 	case 34:
-		// flobject
-		resid = pop();
+		_heResType = rtFlObject;
+		_heResId = pop();
 		break;
 	case 40:
-		// image
-		resid = pop();
+		_heResType = rtImage;
+		_heResId = pop();
+		break;
+	case 47:
+		if (_heResType == rtFlObject) {
+			obj = _heResId;
+			room= getObjectRoom(obj);
+			loadFlObject(obj, room);
+		} else if (_heResType == rtCharset) {
+			loadCharset(_heResId);
+		}
 		break;
 	case 62:
-		// room
-		resid = pop();
+		_heResType = rtRoom;
+		_heResId = pop();
 		break;
 	case 66:
-		// script
-		resid = pop();
+		_heResType = rtScript;
+		_heResId = pop();
 		break;
 	case 72:
-		// sound
-		resid = pop();
+		_heResType = rtSound;
+		_heResId = pop();
 		break;
 	case 128:
-		// lock
+		// lock?
+		break;
+	case 133:
+		if (_heResType == rtCharset)
+			nukeCharset(_heResId);
+		else
+			nukeResource(_heResType, _heResId);
 		break;
 	default:
-		debug(1,"o100_resourceRoutines: default case %d", op);
+		debug(1,"o100_resourceRoutines: default case %d", subOp);
 	}
 }
 
@@ -947,6 +963,15 @@
 		_wizParams.img.y1 = pop();
 		_wizParams.img.x1 = pop();
 		break;
+	case 11:
+		_wizParams.processFlags |= 0x300;
+		_wizParams.processMode = 2;
+		_wizParams.box.bottom = pop();
+		_wizParams.box.right = pop();
+		_wizParams.box.top = pop();
+		_wizParams.box.left = pop();
+		_wizParams.unk_148 = pop();
+		break;
 	case 29:
 		_wizParams.processMode = 1;
 		break;
@@ -1180,29 +1205,28 @@
 }
 
 void ScummEngine_v100he::o100_startSound() {
-	byte op;
-	op = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 
-	switch (op) {
+	switch (subOp) {
 	case 6:
-		_heSndLoop |= 16;
+		_heSndFlags |= 16;
 		pop();
 		break;
 	case 92:
 		_sound->addSoundToQueue(_heSndSoundId, _heSndOffset);
 		break;
 	case 128:
-		_heSndLoop |= 2;
+		_heSndFlags |= 2;
 		break;
 	case 129:
 		_heSndChannel = pop();
 		break;
 	case 130:
-		_heSndLoop |= 40;
+		_heSndFlags |= 40;
 		pop();
 		break;
 	case 131:
-		_heSndLoop |= 4;
+		_heSndFlags |= 4;
 		break;
 	case 132:
 	case 134:
@@ -1212,18 +1236,18 @@
 		_heSndChannel = VAR(VAR_MUSIC_CHANNEL);
 		break;
 	case 133:
-		_heSndLoop |= 80;
+		_heSndFlags |= 80;
 		pop();
 		break;
 	case 135:
-		_heSndLoop |= 4;
+		_heSndFlags |= 4;
 		break;
 	case 136:
-		_heSndLoop |= 20;
+		_heSndFlags |= 20;
 		pop();
 		break;
 	default:
-		error("o100_startSound invalid case %d", op);
+		error("o100_startSound invalid case %d", subOp);
 	}
 }
 
@@ -1449,6 +1473,43 @@
 	o6_breakHere();
 }
 
+void ScummEngine_v100he::o100_getResourceSize() {
+	int size = 0, type;
+
+	int idx = pop();
+	byte subOp = fetchScriptByte();
+
+	switch (subOp) {
+	case 25:
+		type = rtCostume;
+		break;
+	case 40:
+		type = rtImage;
+		break;
+	case 62:
+		type = rtRoomImage;
+		break;
+	case 66:
+		type = rtScript;
+		break;
+	case 72:
+		if (idx > _numSounds) {
+			// TODO Music resource size
+			push(100);
+			return;
+		}
+		type = rtSound;
+		break;
+	default:
+		error("o100_getResourceSize: default type %d", subOp);
+	}
+
+	const byte *ptr = getResourceAddress(type, idx);
+	if (ptr)
+		size = READ_BE_UINT32(ptr + 4) - 8;
+	push(size);
+}
+
 void ScummEngine_v100he::o100_unknown27() {
 	byte subOp = fetchScriptByte();
 	switch (subOp) {

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.414
retrieving revision 1.415
diff -u -d -r1.414 -r1.415
--- script_v6.cpp	8 Oct 2004 06:52:08 -0000	1.414
+++ script_v6.cpp	10 Oct 2004 01:52:35 -0000	1.415
@@ -1765,10 +1765,10 @@
 	Actor *a;
 	int i, j, k;
 	int args[8];
-	byte b;
+	byte subOp;
 
-	b = fetchScriptByte();
-	if (b == 197) {
+	subOp = fetchScriptByte();
+	if (subOp == 197) {
 		_curActor = pop();
 		return;
 	}
@@ -1777,7 +1777,7 @@
 	if (!a)
 		return;
 
-	switch (b) {
+	switch (subOp) {
 	case 76:		// SO_COSTUME
 		a->setActorCostume(pop());
 		break;
@@ -1911,7 +1911,7 @@
 		a->talkScript = pop();
 		break;
 	default:
-		error("o6_actorOps: default case %d", b);
+		error("o6_actorOps: default case %d", subOp);
 	}
 }
 

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.131
retrieving revision 2.132
diff -u -d -r2.131 -r2.132
--- script_v6he.cpp	4 Oct 2004 04:04:36 -0000	2.131
+++ script_v6he.cpp	10 Oct 2004 01:52:35 -0000	2.132
@@ -595,10 +595,10 @@
 	Actor *a;
 	int i, j, k;
 	int args[8];
-	byte b;
+	byte subOp;
 
-	b = fetchScriptByte();
-	if (b == 197) {
+	subOp = fetchScriptByte();
+	if (subOp == 197) {
 		_curActor = pop();
 		return;
 	}
@@ -607,7 +607,7 @@
 	if (!a)
 		return;
 
-	switch (b) {
+	switch (subOp) {
 	case 30:
 		// _heversion >= 70
 		_actorClipOverride.bottom = pop();
@@ -762,7 +762,7 @@
 		break;
 		}
 	default:
-		error("o60_actorOps: default case %d", b);
+		error("o60_actorOps: default case %d", subOp);
 	}
 }
 

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.161
retrieving revision 2.162
diff -u -d -r2.161 -r2.162
--- script_v72he.cpp	9 Oct 2004 14:46:44 -0000	2.161
+++ script_v72he.cpp	10 Oct 2004 01:52:35 -0000	2.162
@@ -846,7 +846,7 @@
 }
 
 void ScummEngine_v72he::o72_drawObject() {
-	int subOp = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 	int state = 0, y = -1, x = -1;
 
 	switch (subOp) {
@@ -895,7 +895,7 @@
 }
 
 void ScummEngine_v72he::o72_getArrayDimSize() {
-	int subOp = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 	int32 val1, val2;
 	ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(fetchScriptWord()));
 	if (!ah) {
@@ -1047,11 +1047,11 @@
 	Actor *a;
 	int i, j, k;
 	int args[32];
-	byte b;
+	byte subOp;
 	byte string[256];
 
-	b = fetchScriptByte();
-	if (b == 197) {
+	subOp = fetchScriptByte();
+	if (subOp == 197) {
 		_curActor = pop();
 		return;
 	}
@@ -1060,7 +1060,7 @@
 	if (!a)
 		return;
 
-	switch (b) {
+	switch (subOp) {
 	case 21: // HE 80+
 		k = getStackList(args, ARRAYSIZE(args));
 		for (i = 0; i < k; ++i) {
@@ -1245,7 +1245,7 @@
 		break;
 		}
 	default:
-		error("o72_actorOps: default case %d", b);
+		error("o72_actorOps: default case %d", subOp);
 	}
 }
 
@@ -1995,7 +1995,7 @@
 void ScummEngine_v72he::o72_readFile() {
 	int slot, val;
 	int32 size;
-	int subOp = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 
 	switch (subOp) {
 	case 4:
@@ -2037,7 +2037,7 @@
 void ScummEngine_v72he::o72_writeFile() {
 	int16 resID = pop();
 	int slot = pop();
-	int subOp = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 
 	switch (subOp) {
 	case 4:
@@ -2092,12 +2092,10 @@
 
 void ScummEngine_v72he::o72_getPixel() {
 	byte area;
+
 	int x = pop();
 	int y = pop();
-	int subOp = fetchScriptByte();
-
-	if (subOp != 218 && subOp != 219)
-		return;
+	byte subOp = fetchScriptByte();
 
 	VirtScreen *vs = findVirtScreen(y);
 	if (vs == NULL || x > _screenWidth - 1 || x < 0) {
@@ -2105,10 +2103,16 @@
 		return;
 	}
 
-	if (subOp == 218)
+	switch (subOp) {
+	case 218:
 		area = *vs->getBackPixels(x, y - vs->topline);
-	else
+		break;
+	case 219:
 		area = *vs->getPixels(x, y - vs->topline);
+		break;
+	default:
+		error("o72_getPixel: default case %d", subOp);
+	}
 	push(area);
 }
 
@@ -2155,12 +2159,12 @@
 }
 
 void ScummEngine_v72he::o72_redimArray() {
-	int subcode, newX, newY;
+	int newX, newY;
 	newY = pop();
 	newX = pop();
 
-	subcode = fetchScriptByte();
-	switch (subcode) {
+	byte subOp = fetchScriptByte();
+	switch (subOp) {
 	case 5:
 		redimArray(fetchScriptWord(), 0, newX, 0, newY, kIntArray);
 		break;
@@ -2171,7 +2175,7 @@
 		redimArray(fetchScriptWord(), 0, newX, 0, newY, kDwordArray);
 		break;
 	default:
-		error("o72_redimArray: default type %d", subcode);
+		error("o72_redimArray: default type %d", subOp);
 	}
 }
 
@@ -2321,7 +2325,7 @@
 }
 
 void ScummEngine_v72he::o72_checkGlobQueue() {
-	int subOp = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 	int idx = pop();
 
 	debug(1,"o72_checkGlobQueue stub (%d, %d)", subOp, idx);

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.103
retrieving revision 2.104
diff -u -d -r2.103 -r2.104
--- script_v7he.cpp	9 Oct 2004 16:10:53 -0000	2.103
+++ script_v7he.cpp	10 Oct 2004 01:52:35 -0000	2.104
@@ -405,21 +405,20 @@
 }
 
 void ScummEngine_v70he::o70_startSound() {
-	byte op;
-	op = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 
-	switch (op) {
+	switch (subOp) {
 	case 9:
-		_heSndLoop |= 4;
+		_heSndFlags |= 4;
 		break;
 	case 23:
 		debug(1,"o70_startSound: case 29 (%d, %d, %d)", pop(), pop(), pop());
 		break;
 	case 56:
-		_heSndLoop |= 2;
+		_heSndFlags |= 2;
 		break;
 	case 164:
-		_heSndLoop |= 2;
+		_heSndFlags |= 2;
 		break;
 	case 224:
 		_heSndSoundFreq = pop();
@@ -441,18 +440,18 @@
 		break;
 
 	case 245:
-		_heSndLoop |= 1;
+		_heSndFlags |= 1;
 		break;
 
 	case 255:
-		// _sound->addSoundToQueue(_heSndSoundId, _heSndOffset, _heSndChannel, _heSndLoop);
+		// _sound->addSoundToQueue(_heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags);
 		_sound->addSoundToQueue(_heSndSoundId, _heSndOffset);
-		debug(2, "o70_startSound stub (%d, %d, %d, %d)", _heSndSoundId, _heSndOffset, _heSndChannel, _heSndLoop);
-		_heSndLoop = 0;
+		debug(2, "o70_startSound stub (%d, %d, %d, %d)", _heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags);
+		_heSndFlags = 0;
 		break;
 
 	default:
-		error("o70_startSound invalid case %d", op);
+		error("o70_startSound invalid case %d", subOp);
 	}
 }
 
@@ -618,7 +617,7 @@
 	byte subOp = fetchScriptByte();
 	int par1;
 
-	switch (subOp & 0xff) {
+	switch (subOp) {
 	case 22: // HE80+
 		clearDrawObjectQueue();
 		break;
@@ -909,13 +908,13 @@
 }
 
 void ScummEngine_v70he::o70_polygonOps() {
-	byte b;
-	b = fetchScriptByte();
 	int vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y;
 	int id;
 	int fromId, toId;
 
-	switch (b) {
+	byte subOp = fetchScriptByte();
+
+	switch (subOp) {
 	case 68: // HE 100
 	case 69: // HE 100
 	case 246:
@@ -930,7 +929,7 @@
 		vert1x = pop();
 		id = pop();
 
-		polygonStore(id, (b == 69 || b == 248), vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, 
+		polygonStore(id, (subOp == 69 || subOp == 248), vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, 
 					 vert4x, vert4y);
 		break;
 	case 28: // HE 100
@@ -940,6 +939,8 @@
 
 		polygonErase(fromId, toId);
 		break;
+	default:
+		error("o70_polygonOps: default case %d", subOp);
 	}
 }
 

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.54
retrieving revision 2.55
diff -u -d -r2.54 -r2.55
--- script_v80he.cpp	9 Oct 2004 14:46:44 -0000	2.54
+++ script_v80he.cpp	10 Oct 2004 01:52:35 -0000	2.55
@@ -500,7 +500,7 @@
 void ScummEngine_v80he::o80_cursorCommand() {
 	int a, i;
 	int args[16];
-	int subOp = fetchScriptByte();
+	byte subOp = fetchScriptByte();
 
 	switch (subOp) {
 	case 0x13: // Loads cursors from another resource

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.251
retrieving revision 1.252
diff -u -d -r1.251 -r1.252
--- scumm.cpp	9 Oct 2004 14:37:39 -0000	1.251
+++ scumm.cpp	10 Oct 2004 01:52:35 -0000	1.252
@@ -1011,7 +1011,7 @@
 	_heSndSoundId = 0;
 	_heSndOffset = 0;
 	_heSndChannel = 0;
-	_heSndLoop = 0;
+	_heSndFlags = 0;
 	_heSndSoundFreq = 0;
 }
 





More information about the Scummvm-git-logs mailing list