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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Feb 25 08:23:54 CET 2007


Revision: 25846
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25846&view=rev
Author:   kirben
Date:     2007-02-24 23:23:52 -0800 (Sat, 24 Feb 2007)

Log Message:
-----------
Add support for using disks images for Apple II version of Maniac Mansion.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/actor.cpp
    scummvm/trunk/engines/scumm/file.cpp
    scummvm/trunk/engines/scumm/file.h
    scummvm/trunk/engines/scumm/gfx.cpp
    scummvm/trunk/engines/scumm/input.cpp
    scummvm/trunk/engines/scumm/palette.cpp
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/engines/scumm/resource_v2.cpp
    scummvm/trunk/engines/scumm/script_v2.cpp
    scummvm/trunk/engines/scumm/scumm.cpp

Modified: scummvm/trunk/engines/scumm/actor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/actor.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/actor.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -1742,7 +1742,7 @@
 	int i;
 
 	for (i = 1; i < _numActors; i++) {
-		if (_game.platform == Common::kPlatformC64) {
+		if (_game.version == 0) {
 			_actors[i]->_talkColor = c64MMActorTalkColor[i];
 		} else {
 			_actors[i]->_talkColor = v1MMActorTalkColor[i];

Modified: scummvm/trunk/engines/scumm/file.cpp
===================================================================
--- scummvm/trunk/engines/scumm/file.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/file.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -25,6 +25,8 @@
 #include "common/util.h"
 #include "common/md5.h"
 
+#include "scumm/scumm.h"
+
 using Common::File;
 
 namespace Scumm {
@@ -1481,13 +1483,14 @@
 };
 
 
-ScummC64File::ScummC64File(const char *disk1, const char *disk2, bool maniac) : _stream(0), _buf(0), _maniac(maniac) {
+ScummC64File::ScummC64File(const char *disk1, const char *disk2, GameSettings game) : _stream(0), _buf(0) {
 	_disk1 = disk1;
 	_disk2 = disk2;
+	_game = game;
 
 	_openedDisk = 0;
 
-	if (maniac) {
+	if (_game.id == GID_MANIAC) {
 		_numGlobalObjects = 256;
 		_numRooms = 55;
 		_numCostumes = 25;
@@ -1559,8 +1562,13 @@
 
 	// check signature
 	openDisk(1);
-	File::seek(0);
 
+	if (_game.platform == Common::kPlatformApple2GS) {
+		File::seek(142080);
+	} else {
+		File::seek(0);
+	}
+
 	signature = fileReadUint16LE();
 	if (signature != 0x0A31) {
 		error("ScummC64File::open(): signature not found in disk 1!");
@@ -1570,12 +1578,20 @@
 	extractIndex(0); // Fill in resource arrays
 
 	openDisk(2);
-	File::seek(0);
 
-	signature = fileReadUint16LE();
-	if (signature != 0x0132)
-		error("Error: signature not found in disk 2!\n");
+	if (_game.platform == Common::kPlatformApple2GS) {
+		File::seek(143104);
+		signature = fileReadUint16LE();
+		if (signature != 0x0032)
+			error("Error: signature not found in disk 2!\n");
+	} else {
+		File::seek(0);
+		signature = fileReadUint16LE();
+		if (signature != 0x0132)
+			error("Error: signature not found in disk 2!\n");
+	}
 
+
 	return true;
 }
 
@@ -1585,13 +1601,22 @@
 	uint16 reslen = 0;
 
 	openDisk(1);
-	File::seek(0);
 
+	if (_game.platform == Common::kPlatformApple2GS) {
+		File::seek(142080);
+	} else {
+		File::seek(0);
+	}
+
 	// skip signature
 	fileReadUint16LE();
 
 	// write expected signature
-	reslen += write_word(out, 0x0132);
+	if (_game.platform == Common::kPlatformApple2GS) {
+		reslen += write_word(out, 0x0132);
+	} else {
+		reslen += write_word(out, 0x0032);
+	}
 
 	// copy object flags
 	for (i = 0; i < _numGlobalObjects; i++)
@@ -1647,7 +1672,13 @@
 }
 
 uint16 ScummC64File::extractResource(Common::WriteStream *out, int res) {
-	const int SectorOffset[36] = {
+	const int AppleSectorOffset[36] = {
+		0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256,
+		272, 288, 304, 320, 336, 352, 368,
+		384, 400, 416, 432, 448, 464,
+		480, 496, 512, 528, 544, 560
+	};
+	const int C64SectorOffset[36] = {
 		0,
 		0, 21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, 294, 315, 336,
 		357, 376, 395, 414, 433, 452, 471,
@@ -1659,7 +1690,11 @@
 
 	openDisk(_roomDisks[res]);
 
-	File::seek((SectorOffset[_roomTracks[res]] + _roomSectors[res]) * 256);
+	if (_game.platform == Common::kPlatformApple2GS) {
+		File::seek((AppleSectorOffset[_roomTracks[res]] + _roomSectors[res]) * 256);
+	} else {
+		File::seek((C64SectorOffset[_roomTracks[res]] + _roomSectors[res]) * 256);
+	}
 
 	for (i = 0; i < _resourcesPerFile[res]; i++) {
 		uint16 len = fileReadUint16LE();

Modified: scummvm/trunk/engines/scumm/file.h
===================================================================
--- scummvm/trunk/engines/scumm/file.h	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/file.h	2007-02-25 07:23:52 UTC (rev 25846)
@@ -25,6 +25,8 @@
 
 #include "common/file.h"
 
+#include "scumm/plugin.h"
+
 namespace Scumm {
 
 class BaseScummFile : public Common::File {
@@ -116,7 +118,8 @@
 
 	byte *_buf;
 
-	bool _maniac;
+	GameSettings _game;
+
 	Common::String _disk1, _disk2;
 	int _openedDisk;
 
@@ -139,7 +142,7 @@
 	uint16 fileReadUint16LE();
 
 public:
-	ScummC64File(const char *disk1, const char *disk2, bool maniac);
+	ScummC64File(const char *disk1, const char *disk2, GameSettings game);
 	void setEnc(byte value);
 
 	bool open(const Common::String &filename, AccessMode mode = kFileReadMode);

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -1235,13 +1235,13 @@
 	_flashlight.isDrawn = true;
 }
 
-// C64 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses
+// V0 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses
 // an internal variable. Emulate this to prevent overwriting script vars...
 // And V6 games do not use the "lights" at all. There, the whole screen is
 // always visible, and actors are always colored, so we fake the correct
 // light value for it.
 int ScummEngine::getCurrentLights() const {
-	if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
+	if (_game.id == GID_MANIAC && _game.version == 0)
 		return _currentLights;
 	else if (_game.version >= 6)
 		return LIGHTMODE_room_lights_on | LIGHTMODE_actor_use_colors;

Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/input.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -440,7 +440,7 @@
 		confirmRestartDialog();
 	} else {
 
-		if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && lastKeyHit == 27) || 
+		if ((_game.version == 0 && lastKeyHit == 27) || 
 			(VAR_CUTSCENEEXIT_KEY != 0xFF && lastKeyHit == 314+VAR(VAR_CUTSCENEEXIT_KEY))) {
 			abortCutscene();
 		} else {

Modified: scummvm/trunk/engines/scumm/palette.cpp
===================================================================
--- scummvm/trunk/engines/scumm/palette.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/palette.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -33,8 +33,11 @@
 
 void ScummEngine::resetPalette() {
 	if (_game.version <= 1) {
-		if (_game.platform == Common::kPlatformC64) {
+		if (_game.platform == Common::kPlatformApple2GS) {
+			// TODO: unique palette?
 			setC64Palette();
+		} else if (_game.platform == Common::kPlatformC64) {
+			setC64Palette();
 		} else if (_game.platform == Common::kPlatformNES) {
 			setNESPalette();
 		} else {

Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -206,6 +206,7 @@
 // only a single unique variant. This is used to help the detector quickly
 // decide whether it has to worry about distinguishing multiple variants or not.
 static const GameSettings gameVariantsTable[] = {
+	{"maniac", "Apple II",     0, GID_MANIAC, 0, 0, MDT_PCSPK, 0, Common::kPlatformApple2GS},
 	{"maniac", "C64",     0, GID_MANIAC, 0, 0, MDT_PCSPK, 0, Common::kPlatformC64},
 	{"maniac", "V1",   "v1", GID_MANIAC, 1, 0, MDT_PCSPK, 0, Common::kPlatformPC},
 	{"maniac", "NES",     0, GID_MANIAC, 1, 0, MDT_NONE,  0, Common::kPlatformNES},
@@ -400,6 +401,7 @@
 	{ "maniac", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
 	{ "maniac", "%02d.MAN", kGenRoomNum, UNK_LANG, UNK, "Demo" },
 	{ "maniac", "maniac1.d64", kGenUnchanged, UNK_LANG, Common::kPlatformC64, "C64" },   // ... and maniac2.d64
+	{ "maniac", "maniac1.dsk", kGenUnchanged, UNK_LANG, Common::kPlatformApple2GS, "Apple II" },   // ... and maniac2.dsk
 	{ "maniac", "Maniac Mansion (E).prg", kGenUnchanged, Common::EN_GRB, Common::kPlatformNES, "NES" },
 	{ "maniac", "Maniac Mansion (F).prg", kGenUnchanged, Common::FR_FRA, Common::kPlatformNES, "NES" },
 	{ "maniac", "Maniac Mansion (SW).prg", kGenUnchanged, Common::SE_SWE, Common::kPlatformNES, "NES" },
@@ -1241,7 +1243,7 @@
 		return false;
 	}
 	
-	if (file == "maniac1.d64" || file == "zak1.d64") {
+	if (file == "maniac1.d64" || file == "maniac1.dsk" || file == "zak1.d64") {
 		// TODO
 	} else if (file == "00.LFL") {
 		// Used in V1, V2, V3 games.

Modified: scummvm/trunk/engines/scumm/resource_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource_v2.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/resource_v2.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -33,7 +33,7 @@
 	int i;
 
 	if (_game.id == GID_MANIAC) {
-		if (_game.platform == Common::kPlatformC64) {
+		if (_game.version == 0) {
 			_numGlobalObjects = 256;
 			_numRooms = 55;
 			_numCostumes = 25;

Modified: scummvm/trunk/engines/scumm/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v2.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/script_v2.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -1617,6 +1617,7 @@
 }
 
 void ScummEngine_v2::o2_switchCostumeSet() {
+	printf("o2_switchCostumeSet\n");
 	// NES version of maniac uses this to switch between the two
 	// groups of costumes it has
 	if (_game.platform == Common::kPlatformNES)

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2007-02-25 06:21:57 UTC (rev 25845)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2007-02-25 07:23:52 UTC (rev 25846)
@@ -981,6 +981,18 @@
 			
 			_filenamePattern.pattern = "%.2d.LFL";
 			_filenamePattern.genMethod = kGenRoomNum;
+		} else if (_game.platform == Common::kPlatformApple2GS) {
+			// Read data from Apple II disk images.
+			const char *tmpBuf1, *tmpBuf2;
+			assert(_game.id == GID_MANIAC);
+			tmpBuf1 = "maniac1.dsk";
+			tmpBuf2 = "maniac2.dsk";
+	
+			_fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game);
+			_containerFile = tmpBuf1;
+
+			_filenamePattern.pattern = "%.2d.LFL";
+			_filenamePattern.genMethod = kGenRoomNum;
 		} else if (_game.platform == Common::kPlatformC64) {
 			// Read data from C64 disk images.
 			const char *tmpBuf1, *tmpBuf2;
@@ -993,7 +1005,7 @@
 				tmpBuf2 = "zak2.d64";
 			}
 	
-			_fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game.id == GID_MANIAC);
+			_fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game);
 			_containerFile = tmpBuf1;
 
 			_filenamePattern.pattern = "%.2d.LFL";
@@ -1560,7 +1572,7 @@
 	// Init iMuse
 	if (_game.version >= 7) {
 		// Setup for digital iMuse is performed in another place
-	} else if (_game.platform == Common::kPlatformC64) {
+	} else if (_game.platform == Common::kPlatformApple2GS || _game.platform == Common::kPlatformC64) {
 		// TODO
 		_musicEngine = NULL;
 	} else if (_game.platform == Common::kPlatformNES) {


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