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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon May 29 05:46:02 CEST 2006


Revision: 22732
Author:   kirben
Date:     2006-05-29 05:45:11 -0700 (Mon, 29 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22732&view=rev

Log Message:
-----------
Fix Commodore 64 versions

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/actor.cpp
    scummvm/trunk/engines/scumm/base-costume.cpp
    scummvm/trunk/engines/scumm/boxes.cpp
    scummvm/trunk/engines/scumm/cursor.cpp
    scummvm/trunk/engines/scumm/gfx.cpp
    scummvm/trunk/engines/scumm/object.cpp
    scummvm/trunk/engines/scumm/palette.cpp
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/engines/scumm/resource_v2.cpp
    scummvm/trunk/engines/scumm/room.cpp
    scummvm/trunk/engines/scumm/saveload.cpp
    scummvm/trunk/engines/scumm/script.cpp
    scummvm/trunk/engines/scumm/script_v5.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/string.cpp
    scummvm/trunk/engines/scumm/verbs.cpp
Modified: scummvm/trunk/engines/scumm/actor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/actor.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/actor.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -831,14 +831,14 @@
 // an internal variable. Emulate this to prevent overwriting script vars...
 // Maniac NES (V1), however, DOES have a ScummVar for VAR_TALK_ACTOR
 int ScummEngine::getTalkingActor() {
-	if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES))
+	if (_game.id == GID_MANIAC && _game.version <= 1 && !(_game.platform == Common::kPlatformNES))
 		return _V1TalkingActor;
 	else
 		return VAR(VAR_TALK_ACTOR);
 }
 
 void ScummEngine::setTalkingActor(int value) {
-	if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES))
+	if (_game.id == GID_MANIAC && _game.version <= 1 && !(_game.platform == Common::kPlatformNES))
 		_V1TalkingActor = value;
 	else
 		VAR(VAR_TALK_ACTOR) = value;
@@ -1549,7 +1549,7 @@
 
 
 	// V1 zak uses palette[] as a dynamic costume color array.
-	if (_vm->_game.version == 1)
+	if (_vm->_game.version <= 1)
 		return;
 
 	if (_vm->_game.features & GF_NEW_COSTUMES) {

Modified: scummvm/trunk/engines/scumm/base-costume.cpp
===================================================================
--- scummvm/trunk/engines/scumm/base-costume.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/base-costume.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -43,7 +43,7 @@
 
 	_numStrips = numStrips;
 
-	if (_vm->_game.version == 1) {
+	if (_vm->_game.version <= 1) {
 		_xmove = 0;
 		_ymove = 0;
 	} else if (_vm->_game.features & GF_OLD_BUNDLE) {

Modified: scummvm/trunk/engines/scumm/boxes.cpp
===================================================================
--- scummvm/trunk/engines/scumm/boxes.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/boxes.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -110,7 +110,7 @@
 
 	if (_game.version == 8)
 		return (byte) FROM_LE_32(ptr->v8.mask);
-	else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
+	else if (_game.version == 0)
 		return ptr->c64.mask;
 	else if (_game.version <= 2)
 		return ptr->v2.mask;
@@ -144,7 +144,7 @@
 		return 0;
 	if (_game.version == 8)
 		return (byte) FROM_LE_32(ptr->v8.flags);
-	else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
+	else if (_game.version == 0)
 		return 0;
 	else if (_game.version <= 2)
 		return ptr->v2.flags;
@@ -406,7 +406,7 @@
 	    box--;
 
 	checkRange(ptr[0] - 1, 0, box, "Illegal box %d");
-	if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
+	if (_game.version == 0)
 		return (Box *)(ptr + box * SIZEOF_BOX_C64 + 1);
 	else if (_game.version <= 2)
 		return (Box *)(ptr + box * SIZEOF_BOX_V2 + 1);
@@ -516,7 +516,7 @@
 			SWAP(box->ul, box->ur);
 			SWAP(box->ll, box->lr);
 		}
-	} else if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
+	} else if (_game.version == 0) {
 		box->ul.x = bp->c64.x1 * 8;
 		box->ul.y = bp->c64.y1 * 2;
 		box->ur.x = bp->c64.x2 * 8;
@@ -745,7 +745,7 @@
 
 	boxm = getBoxMatrixBaseAddr();
 
-	if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
+	if (_game.version == 0) {
 		// Skip up to the matrix data for box 'from'
 		for (i = 0; i < from; i++) {
 			while (*boxm != 0xFF)

Modified: scummvm/trunk/engines/scumm/cursor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/cursor.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/cursor.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -367,7 +367,7 @@
 
 	memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor));
 
-	if (_game.version == 1)
+	if (_game.version <= 1)
 		color = default_v1_cursor_colors[idx];
 	else
 		color = default_cursor_colors[idx];

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -222,7 +222,7 @@
 }
 
 void Gdi::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) {
-	if (_vm->_game.version == 1) {
+	if (_vm->_game.version <= 1) {
 		if (_vm->_game.platform == Common::kPlatformNES) {
 			decodeNESGfx(roomptr);
 		} else {
@@ -1404,7 +1404,7 @@
 
 	_objectMode = (flag & dbObjectMode) == dbObjectMode;
 	
-	if (_objectMode && _vm->_game.version == 1) {
+	if (_objectMode && _vm->_game.version <= 1) {
 		if (_vm->_game.platform == Common::kPlatformNES) {
 			decodeNESObject(ptr, x, y, width, height);
 		} else {
@@ -1484,7 +1484,7 @@
 		else
 			dstPtr = (byte *)vs->pixels + y * vs->pitch + (x + k) * 8;
 
-		if (_vm->_game.version == 1) {
+		if (_vm->_game.version <= 1) {
 			if (_vm->_game.platform == Common::kPlatformNES) {
 				mask_ptr = getMaskBuffer(x + k, y, 1);
 				drawStripNES(dstPtr, mask_ptr, vs->pitch, stripnr, y, height);
@@ -1535,7 +1535,7 @@
 		if (_vm->_game.version == 8 || _vm->_game.heversion >= 60)
 			transpStrip = true;
 
-		if (_vm->_game.version == 1) {
+		if (_vm->_game.version <= 1) {
 			mask_ptr = getMaskBuffer(x + k, y, 1);
 			if (_vm->_game.platform == Common::kPlatformNES) {
 				drawStripNESMask(mask_ptr, stripnr, y, height);

Modified: scummvm/trunk/engines/scumm/object.cpp
===================================================================
--- scummvm/trunk/engines/scumm/object.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/object.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -338,7 +338,7 @@
 		if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable))
 			continue;
 
-		if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
+		if (_game.version == 0) {
 			if (_objs[i].flags == 0 && _objs[i].state & 0x2)
 				continue;
 		} else {
@@ -642,7 +642,7 @@
 	for (i = 0; i < _numObjectsInRoom; i++) {
 		od = &_objs[findLocalObjectSlot()];
 
-		if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && READ_LE_UINT16(ptr) == defaultPtr)
+		if (_game.version == 0 && READ_LE_UINT16(ptr) == defaultPtr)
 			od->OBIMoffset = 0;
 		else
 			od->OBIMoffset = READ_LE_UINT16(ptr);
@@ -994,7 +994,7 @@
 	byte *objptr;
 	int i;
 
-	if (obj < _numActors && !(_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC))
+	if (obj < _numActors && _game.version >= 1)
 		return derefActor(obj, "getObjOrActorName")->getActorName();
 
 	for (i = 0; i < _numNewNames; i++) {
@@ -1011,7 +1011,7 @@
 	if (_game.features & GF_SMALL_HEADER) {
 		byte offset = 0;
 
-		if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC)
+		if (_game.version == 0)
 			offset = *(objptr + 13);
 		else if (_game.version <= 2)
 			offset = *(objptr + 14);
@@ -1098,7 +1098,7 @@
 	const byte *ptr;
 
 	// For objects without image in C64 version of Maniac Mansion
-	if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && od.OBIMoffset == 0)
+	if (_game.version == 0 && od.OBIMoffset == 0)
 		return NULL;
 
 	if (od.fl_object_index) {

Modified: scummvm/trunk/engines/scumm/palette.cpp
===================================================================
--- scummvm/trunk/engines/scumm/palette.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/palette.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -32,7 +32,7 @@
 namespace Scumm {
 
 void ScummEngine::resetPalette() {
-	if (_game.version == 1) {
+	if (_game.version <= 1) {
 		if (_game.platform == Common::kPlatformC64) {
 			setC64Palette();
 		} else if (_game.platform == Common::kPlatformNES) {

Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -1077,7 +1077,9 @@
 		return false;
 	}
 	
-	if (file == "00.LFL") {
+	if (file == "maniac1.d64" || file == "zak1.d64") {
+		// TODO
+	} else if (file == "00.LFL" || file == "maniac1.d64" || file == "zak1.d64") {
 		// Used in V1, V2, V3 games.
 		if (g->version > 3)
 			return false;

Modified: scummvm/trunk/engines/scumm/resource_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource_v2.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/resource_v2.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -191,7 +191,10 @@
 			break;
 		case 0x132:
 			printf("C64 V1 game detected\n");
-			assert(_game.version == 1);
+			if (_game.id == GID_MANIAC)
+				assert(_game.version == 0);
+			else
+				assert(_game.version == 1);
 			readClassicIndexFile();
 			break;
 		default:

Modified: scummvm/trunk/engines/scumm/room.cpp
===================================================================
--- scummvm/trunk/engines/scumm/room.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/room.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -197,7 +197,7 @@
 
 	_egoPositioned = false;
 	runEntryScript();
-	if ((_game.version <= 2) && !(_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)) {
+	if (_game.version >= 1 && _game.version <= 2) {
 		runScript(5, 0, 0, 0);
 	} else if (_game.version >= 5 && _game.version <= 6) {
 		if (a && !_egoPositioned) {
@@ -582,7 +582,7 @@
 	//
 	rmhd = (const RoomHeader *)(roomptr + 4);
 
-	if (_game.version == 1) {
+	if (_game.version <= 1) {
 		if (_game.platform == Common::kPlatformNES) {
 			_roomWidth = READ_LE_UINT16(&(rmhd->old.width)) * 8;
 			_roomHeight = READ_LE_UINT16(&(rmhd->old.height)) * 8;
@@ -605,7 +605,7 @@
 	//
 	// Find the room image data
 	//
-	if (_game.version == 1) {
+	if (_game.version <= 1) {
 		_IM00_offs = 0;
 	} else {
 		_IM00_offs = READ_LE_UINT16(roomptr + 0x0A);
@@ -708,7 +708,7 @@
 		error("Room %d: data not found (" __FILE__  ":%d)", _roomResource, __LINE__);
 
 	// Reset room color for V1 zak
-	if (_game.version == 1)
+	if (_game.version <= 1)
 		_roomPalette[0] = 0;
 
 	//
@@ -725,7 +725,7 @@
 		byte numOfBoxes = 0;
 		int size;
 
-		if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
+		if (_game.version == 0) {
 			// Count number of boxes
 			while (*ptr != 0xFF) {
 				numOfBoxes++;
@@ -750,7 +750,7 @@
 		}
 
 		ptr += size;
-		if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
+		if (_game.version == 0) {
 			const byte *tmp = ptr;
 			size = 0;
 

Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/saveload.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -334,7 +334,7 @@
 	// Reset the palette.
 	resetPalette();
 
-	if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version == 1)
+	if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version <= 1)
 		resetV1ActorTalkColor();
 
 	// Load the static room data

Modified: scummvm/trunk/engines/scumm/script.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/script.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -156,7 +156,7 @@
 	objptr = getOBCDFromObject(obj);
 	assert(objptr);
 
-	if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC)
+	if (_game.version == 0)
 		verbptr = objptr + 14;
 	else if (_game.version <= 2)
 		verbptr = objptr + 15;

Modified: scummvm/trunk/engines/scumm/script_v5.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v5.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/script_v5.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -1110,7 +1110,7 @@
 	byte slot = (a & 0x1F) + 1;
 	byte result = 0;
 
-	if ((_game.id == GID_MANIAC) && (_game.version == 1)) {
+	if ((_game.id == GID_MANIAC) && (_game.version <= 1)) {
 		// Convert older load/save screen
 		// 1 Load
 		// 2 Save

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -608,7 +608,7 @@
 	}
 
 	// Do some render mode restirctions
-	if (_game.version == 1)
+	if (_game.version <= 1)
 		_renderMode = Common::kRenderDefault;
 
 	switch (_renderMode) {
@@ -1107,7 +1107,7 @@
 	if (_game.features & GF_NEW_COSTUMES) {
 		_costumeRenderer = new AkosRenderer(this);
 		_costumeLoader = new AkosCostumeLoader(this);
-	} else if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
+	} else if (_game.version == 0) {
 		_costumeRenderer = new C64CostumeRenderer(this);
 		_costumeLoader = new C64CostumeLoader(this);
 	} else if (_game.platform == Common::kPlatformNES) {
@@ -1125,11 +1125,10 @@
 	_tempMusic = 0;
 	debug(9, "resetScumm");
 
-	if ((_game.id == GID_MANIAC) && (_game.version == 1) && !(_game.platform == Common::kPlatformNES)) {
-		if (_game.platform == Common::kPlatformC64)
-			initScreens(8, 144);
-		else
-			initScreens(16, 152);
+	if (_game.version == 0) {
+		initScreens(8, 144);
+	} else if ((_game.id == GID_MANIAC) && (_game.version <= 1) && !(_game.platform == Common::kPlatformNES)) {
+		initScreens(16, 152);
 	} else if (_game.version >= 7 || _game.heversion >= 71) {
 		initScreens(0, _screenHeight);
 	} else {
@@ -1166,11 +1165,11 @@
 		_actors[i].initActor(1);
 
 		// this is from IDB
-		if ((_game.version == 1) || (_game.id == GID_MANIAC && (_game.features & GF_DEMO)))
+		if ((_game.version <= 1) || (_game.id == GID_MANIAC && (_game.features & GF_DEMO)))
 			_actors[i].setActorCostume(i);
 	}
 
-	if (_game.id == GID_MANIAC && _game.version == 1) {
+	if (_game.id == GID_MANIAC && _game.version <= 1) {
 		resetV1ActorTalkColor();
 	} else if (_game.id == GID_MANIAC && _game.version == 2 && (_game.features & GF_DEMO)) {
 		// HACK Some palette changes needed for demo script
@@ -1818,9 +1817,16 @@
 	if (_game.version <= 7)
 		VAR(VAR_HAVE_MSG) = _haveMsg;
 
-	if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
-		// TODO
-	} else if (_game.version <= 2) {
+	if (_game.version >= 3) {
+		VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x;
+		VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y;
+		VAR(VAR_MOUSE_X) = _mouse.x;
+		VAR(VAR_MOUSE_Y) = _mouse.y;
+		if (VAR_DEBUGMODE != 0xFF) {
+			// This is NOT for the Mac version of Indy3/Loom
+			VAR(VAR_DEBUGMODE) = _debugMode;
+		}
+	} else if (_game.version >= 1) {
 		VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x / 8;
 		VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y / 2;
 
@@ -1830,15 +1836,6 @@
 			if (VAR(VAR_VIRT_MOUSE_X) < 0)
 				VAR(VAR_VIRT_MOUSE_X) = 0;
 		}
-	} else {
-		VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x;
-		VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y;
-		VAR(VAR_MOUSE_X) = _mouse.x;
-		VAR(VAR_MOUSE_Y) = _mouse.y;
-		if (VAR_DEBUGMODE != 0xFF) {
-			// This is NOT for the Mac version of Indy3/Loom
-			VAR(VAR_DEBUGMODE) = _debugMode;
-		}
 	}
 }
 

Modified: scummvm/trunk/engines/scumm/string.cpp
===================================================================
--- scummvm/trunk/engines/scumm/string.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/string.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -553,7 +553,7 @@
 				_charset->_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
 			}
 
-			if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
+			if (_game.version == 0) {
 				break;
 			} else if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) {
 				_charset->_nextTop += _string[0].height;

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2006-05-29 08:12:07 UTC (rev 22731)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2006-05-29 12:45:11 UTC (rev 22732)
@@ -332,7 +332,7 @@
 	object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
 
 	if (object > 0) {
-		if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
+		if (_game.version == 0) {
 			if (_activeInventory != object) {
 				_activeInventory = object;
 			} else if (_activeVerb != 3 && _activeVerb != 13) {


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