[Scummvm-cvs-logs] SF.net SVN: scummvm:[45433] scummvm/trunk

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Tue Oct 27 10:17:10 CET 2009


Revision: 45433
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45433&view=rev
Author:   Kirben
Date:     2009-10-27 09:17:09 +0000 (Tue, 27 Oct 2009)

Log Message:
-----------
Add support for distaff images in PCE version of Loom.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/gfx.cpp
    scummvm/trunk/engines/scumm/gfx.h
    scummvm/trunk/engines/scumm/scumm-md5.h
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/vars.cpp
    scummvm/trunk/engines/scumm/verbs.cpp
    scummvm/trunk/tools/scumm-md5.txt

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2009-10-27 09:17:09 UTC (rev 45433)
@@ -210,6 +210,7 @@
 	_vertStripNextInc = 0;
 	_zbufferDisabled = false;
 	_objectMode = false;
+	_distaff = false;
 }
 
 Gdi::~Gdi() {
@@ -224,7 +225,8 @@
 }
 
 GdiPCEngine::~GdiPCEngine() {
-	free(_PCE.tiles);
+	free(_PCE.roomTiles);
+	free(_PCE.staffTiles);
 	free(_PCE.masks);
 }
 
@@ -271,6 +273,13 @@
 	decodePCEngineGfx(roomptr);
 }
 
+void Gdi::loadTiles(byte *roomptr) {
+}
+
+void GdiPCEngine::loadTiles(byte *roomptr) {
+	decodePCEngineTileData(_vm->findResourceData(MKID_BE('TILE'), roomptr));
+}
+
 void GdiV1::roomChanged(byte *roomptr) {
 	for (int i = 0; i < 4; i++){
 		_C64.colors[i] = roomptr[6 + i];
@@ -2801,11 +2810,16 @@
 
 	readOffsetTable(ptr, &tileOffsets, &_PCE.numTiles);
 	
-	free(_PCE.tiles);
-	_PCE.tiles = (byte*)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
+	if (_distaff) {
+		free(_PCE.staffTiles);
+		_PCE.staffTiles = (byte*)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
+	} else {
+		free(_PCE.roomTiles);
+		_PCE.roomTiles = (byte*)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
+	}
 
 	for (int i = 0; i < _PCE.numTiles; ++i) {
-		tile = &_PCE.tiles[i * 64];
+		tile = (_distaff) ? &_PCE.staffTiles[i * 64] : &_PCE.roomTiles[i * 64];
 		tilePtr = ptr + tileOffsets[i];
 
 		int index = 0;
@@ -2880,7 +2894,7 @@
 
 	for (int y = 0; y < height; y++) {
 		tileIdx = (_objectMode ? _PCE.nametableObj : _PCE.nametable)[stripnr * height + y];
-		tile = &_PCE.tiles[tileIdx * 64];
+		tile = (_distaff) ? &_PCE.staffTiles[tileIdx * 64] : &_PCE.roomTiles[tileIdx * 64];
 		paletteIdx = (_objectMode ? _PCE.colortableObj : _PCE.colortable)[stripnr * height + y];
 		paletteOffset = paletteIdx * 16;
 		for (int row = 0; row < 8; row++) {

Modified: scummvm/trunk/engines/scumm/gfx.h
===================================================================
--- scummvm/trunk/engines/scumm/gfx.h	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/engines/scumm/gfx.h	2009-10-27 09:17:09 UTC (rev 45433)
@@ -193,6 +193,9 @@
 	bool _objectMode;
 
 public:
+	/** Flag which is true when loading objects or titles for distaff, in PCEngine version of Loom. */
+	bool _distaff;
+
 	int _numZBuffer;
 	int _imgBufOffs[8];
 	int32 _numStrips;
@@ -243,6 +246,7 @@
 
 	virtual void init();
 	virtual void roomChanged(byte *roomptr);
+	virtual void loadTiles(byte *roomptr);
 	void setTransparentColor(byte transparentColor) { _transparentColor = transparentColor; }
 
 	void drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
@@ -310,8 +314,8 @@
 		int maskIDSize;
 		int numTiles;
 		int numMasks;
-		byte* tiles;
-		byte* masks;
+		byte *roomTiles, *staffTiles;
+		byte *masks;
 	} _PCE;
 
 protected:
@@ -340,6 +344,7 @@
 	GdiPCEngine(ScummEngine *vm);
 	~GdiPCEngine();
 
+	virtual void loadTiles(byte *roomptr);
 	virtual void roomChanged(byte *roomptr);
 };
 

Modified: scummvm/trunk/engines/scumm/scumm-md5.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm-md5.h	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/engines/scumm/scumm-md5.h	2009-10-27 09:17:09 UTC (rev 45433)
@@ -1,5 +1,5 @@
 /*
-  This file was generated by the md5table tool on Thu Oct 22 01:22:29 2009
+  This file was generated by the md5table tool on Tue Oct 27 08:40:31 2009
   DO NOT EDIT MANUALLY!
  */
 
@@ -337,7 +337,6 @@
 	{ "7f45ddd6dbfbf8f80c0c0efea4c295bc", "maniac", "V1", "V1", 1972, Common::EN_ANY, Common::kPlatformPC },
 	{ "7f945525abcd48015adf1632637a44a1", "pajama", "", "Demo", -1, Common::FR_FRA, Common::kPlatformUnknown },
 	{ "7fc6cdb46b4c9d384c52327f4bca6416", "football", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown },
-	{ "80ee753bd2c0e99394e207ef9d0eff31", "loom", "PC-Engine", "", -1, Common::EN_ANY, Common::kPlatformPCEngine },
 	{ "810a9da887aefa597b0cf3c77d262897", "BluesABCTime", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown },
 	{ "81bbfa181184cb494e7a81dcfa94fbd9", "maniac", "NES", "", 262144, Common::FR_FRA, Common::kPlatformNES },
 	{ "822807c3cd3b43a925cab2767ca6b453", "BluesTreasureHunt", "", "Disc 1", -1, Common::EN_ANY, Common::kPlatformUnknown },
@@ -485,6 +484,7 @@
 	{ "c3df37df9d3b481b45f75283a9907c47", "loom", "EGA", "EGA", -1, Common::IT_ITA, Common::kPlatformPC },
 	{ "c4787c3e8b5e2dfda90850ee800af00f", "zak", "V2", "V2", -1, Common::FR_FRA, Common::kPlatformPC },
 	{ "c4a7f7398ac9ae588940f9912ea5fd8f", "maniac", "C64", "", -1, Common::DE_DEU, Common::kPlatformC64 },
+	{ "c4aa4f972813334a1068f8c755004c0a", "loom", "PC-Engine", "", -1, Common::EN_ANY, Common::kPlatformPCEngine },
 	{ "c4ffae9fac495475d6bc3343ccc8faf9", "Soccer2004", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown },
 	{ "c5cc7cba02a2fbd539c4439e775b0536", "puttzoo", "HE 99", "Updated", 43470, Common::DE_DEU, Common::kPlatformWindows },
 	{ "c5d10e190d4b4d59114b824f2fdbd00e", "loom", "FM-TOWNS", "", -1, Common::EN_ANY, Common::kPlatformFMTowns },

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2009-10-27 09:17:09 UTC (rev 45433)
@@ -1486,9 +1486,21 @@
 void ScummEngine_v3::resetScumm() {
 	ScummEngine_v4::resetScumm();
 
-	_16BitPalette = (uint16 *)malloc(512);
-	memset(_16BitPalette, 0, 512);
 
+	if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) {
+		_16BitPalette = (uint16 *)calloc(512, sizeof(uint16));
+
+		// Load tile set and palette for the distaff
+		byte *roomptr = getResourceAddress(rtRoom, 90);
+		assert(roomptr);
+		const byte *palPtr = findResourceData(MKID_BE('CLUT'), roomptr);
+		assert(palPtr - 4);
+		setPCEPaletteFromPtr(palPtr);
+		_gdi->_distaff = true;
+		_gdi->loadTiles(roomptr);
+		_gdi->_distaff = false;
+	}
+
 	delete _savePreparedSavegame;
 	_savePreparedSavegame = NULL;
 }

Modified: scummvm/trunk/engines/scumm/vars.cpp
===================================================================
--- scummvm/trunk/engines/scumm/vars.cpp	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/engines/scumm/vars.cpp	2009-10-27 09:17:09 UTC (rev 45433)
@@ -82,6 +82,10 @@
 	VAR_SOUNDCARD = 48;
 	VAR_VIDEOMODE = 49;
 
+	if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) {
+		VAR_MAINMENU_KEY = 50;
+	}
+
 	if (_game.version >= 4) {
 		VAR_SCROLL_SCRIPT = 27;
 		VAR_DEBUGMODE = 39;

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2009-10-27 09:17:09 UTC (rev 45433)
@@ -1331,8 +1331,8 @@
 }
 
 void ScummEngine::drawVerbBitmap(int verb, int x, int y) {
+	VerbSlot *vst = &_verbs[verb];
 	VirtScreen *vs;
-	VerbSlot *vst;
 	bool twobufs;
 	const byte *imptr = 0;
 	int ydiff, xstrip;
@@ -1381,12 +1381,16 @@
 		imptr = getObjectImage(obim, 1);
 	}
 	assert(imptr);
+
+	if (_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine) {
+		_gdi->_distaff = (vst->verbid != 54);
+	}
+
 	for (i = 0; i < imgw; i++) {
 		tmp = xstrip + i;
 		_gdi->drawBitmap(imptr, vs, tmp, ydiff, imgw * 8, imgh * 8, i, 1, Gdi::dbAllowMaskOr | Gdi::dbObjectMode);
 	}
 
-	vst = &_verbs[verb];
 	vst->curRect.right = vst->curRect.left + imgw * 8;
 	vst->curRect.bottom = vst->curRect.top + imgh * 8;
 	vst->oldRect = vst->curRect;

Modified: scummvm/trunk/tools/scumm-md5.txt
===================================================================
--- scummvm/trunk/tools/scumm-md5.txt	2009-10-27 08:48:45 UTC (rev 45432)
+++ scummvm/trunk/tools/scumm-md5.txt	2009-10-27 09:17:09 UTC (rev 45433)
@@ -178,7 +178,7 @@
 	c5d10e190d4b4d59114b824f2fdbd00e	-1	en	FM-TOWNS	FM-TOWNS	-	-	dhewg, Andrea Petrucci
 	31b8fda4c8c7413fa6b39997e776eba4	-1	jp	FM-TOWNS	FM-TOWNS	-	-	khalek, Andrea Petrucci
 
-	80ee753bd2c0e99394e207ef9d0eff31	-1	en	PC-Engine	PC-Engine	-	-	Kirben
+	c4aa4f972813334a1068f8c755004c0a	-1	en	PC-Engine	PC-Engine	-	-	Kirben
 	431ae44609321acc46e6f064dec962a5	-1	jp	PC-Engine	PC-Engine	-	-	clone2727
 
 	5a35e36fd777e9c37a49c5b2faca52f9	6108	en	DOS	EGA	EGA Demo	non-interactive	Fingolfin


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