diff options
| author | Paweł Kołodziejski | 2003-06-06 05:27:45 +0000 | 
|---|---|---|
| committer | Paweł Kołodziejski | 2003-06-06 05:27:45 +0000 | 
| commit | 00288b07f8463b61a39ab57eec415f149c333fb1 (patch) | |
| tree | 5b039b07d2e7ca15a027b801e774716f727145e3 | |
| parent | 1f846b55dce6c66b169d033dc0d8ab4a46616c37 (diff) | |
| download | scummvm-rg350-00288b07f8463b61a39ab57eec415f149c333fb1.tar.gz scummvm-rg350-00288b07f8463b61a39ab57eec415f149c333fb1.tar.bz2 scummvm-rg350-00288b07f8463b61a39ab57eec415f149c333fb1.zip  | |
fixed almost object drawing for v1 games, (ugly hack for drawBitmap)
svn-id: r8345
| -rw-r--r-- | scumm/gfx.cpp | 26 | ||||
| -rw-r--r-- | scumm/gfx.h | 6 | ||||
| -rw-r--r-- | scumm/object.cpp | 4 | ||||
| -rw-r--r-- | scumm/scummvm.cpp | 3 | ||||
| -rw-r--r-- | scumm/verbs.cpp | 3 | 
5 files changed, 37 insertions, 5 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index f35d423c7e..4be47d05f1 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -776,6 +776,9 @@ void Scumm::redrawBGStrip(int start, int num) {  	for (int i = 0; i < num; i++)  		setGfxUsageBit(s + i, USAGE_BIT_DIRTY); +	if (_features & GF_AFTER_V1) { +		gdi._C64ObjectMode = false; +	}  	gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs,  	               &virtscr[0], s, 0, _roomWidth, virtscr[0].height, s, num, 0, _roomStrips);  } @@ -1123,7 +1126,10 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi  			bgbak_ptr = backbuff_ptr;  		if (_vm->_features & GF_AFTER_V1) { -			drawStripC64Background(bgbak_ptr, stripnr, height); +			if (_C64ObjectMode) +				drawStripC64Object(bgbak_ptr, stripnr, width, height); +			else +				drawStripC64Background(bgbak_ptr, stripnr, height);  		} else if (!(_vm->_features & GF_AFTER_V2)) {  			if (_vm->_features & GF_16COLOR) {  				decodeStripEGA(bgbak_ptr, smap_ptr + READ_LE_UINT16(smap_ptr + stripnr * 2 + 2), height); @@ -1343,6 +1349,22 @@ void Gdi::drawStripC64Background(byte *dst, int stripnr, int height) {  	}  } +void Gdi::drawStripC64Object(byte *dst, int stripnr, int width, int height) { +	int y, i, j; +	height >>= 3; +	width >>= 3; +	for (y = 0; y < height; y++) { +		_C64Colors[3] = (_C64ObjectMap[y * width + stripnr] & 7); +		for (i = 0; i < 8; i++) { +			for (j = 7; j >= 0; j--) { +				byte c = _C64CharMap[_C64ObjectMap[y * width + stripnr] * 8 + i] >> (j & 6); +				dst[7 - j] = _C64Colors[c & 3]; +			} +			dst += _vm->_screenWidth; +		} +	} +} +  void Gdi::drawStripC64Mask(byte *dst, int stripnr, int height) {  	int y, i, j;  	height >>= 3; @@ -1357,7 +1379,7 @@ void Gdi::drawStripC64Mask(byte *dst, int stripnr, int height) {  	}  } -void Gdi::decodeC64Gfx(byte *src, byte *dst, int size) { +void Gdi::decodeC64Gfx(const byte *src, byte *dst, int size) {  	int x, z;  	byte color, run, common[4]; diff --git a/scumm/gfx.h b/scumm/gfx.h index f10ef8f613..c388134ebf 100644 --- a/scumm/gfx.h +++ b/scumm/gfx.h @@ -122,13 +122,15 @@ protected:  	bool _zbufferDisabled; -	byte _C64Colors[4], _C64CharMap[256 * 8], _C64PicMap[4096], _C64ColorMap[4096]; +	byte _C64Colors[4], _C64CharMap[2048], _C64ObjectMap[2048], _C64PicMap[4096], _C64ColorMap[4096];  	byte _C64MaskMap[4096], _C64MaskChar[4096]; +	bool _C64ObjectMode;  	/* Bitmap decompressors */  	bool decompressBitmap(byte *bgbak_ptr, const byte *src, int numLinesToProcess);  	void decodeStripEGA(byte *dst, const byte *src, int height); -	void decodeC64Gfx(byte *src, byte *dst, int size); +	void decodeC64Gfx(const byte *src, byte *dst, int size); +	void drawStripC64Object(byte *dst, int stripnr, int width, int height);  	void drawStripC64Background(byte *dst, int stripnr, int height);  	void drawStripC64Mask(byte *dst, int stripnr, int height);  	void unkDecodeA(byte *dst, const byte *src, int height); diff --git a/scumm/object.cpp b/scumm/object.cpp index a47026188c..e820ea1367 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -444,6 +444,10 @@ void Scumm::drawObject(int obj, int arg) {  		byte flags = Gdi::dbAllowMaskOr;  		// Sam & Max needs this to fix object-layering problems with  		// the inventory and conversation icons. +		if (_features & GF_AFTER_V1) { +			gdi._C64ObjectMode = true; +			gdi.decodeC64Gfx(ptr, gdi._C64ObjectMap, width * (height >> 3)); +		}  		if ((_features & GF_AFTER_V7 || _gameId == GID_SAMNMAX) && getClass(od->obj_nr, kObjectClassIgnoreBoxes))  			flags |= Gdi::dbDrawMaskOnAll;  		gdi.drawBitmap(ptr, &virtscr[0], x, ypos, width << 3, height, x - xpos, numstrip, flags); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index a7123dcfd7..9de8fe8edf 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1426,11 +1426,12 @@ void Scumm::initRoomSubBlocks() {  		for(i = 0; i < 4; i++){  			gdi._C64Colors[i] = roomptr[6 + i];  		} -		gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), gdi._C64CharMap, 256 * 8); +		gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), gdi._C64CharMap, 2048);  		gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), gdi._C64PicMap, roomptr[4] * roomptr[5]);  		gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), gdi._C64ColorMap, roomptr[4] * roomptr[5]);  		gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), gdi._C64MaskMap, roomptr[4] * roomptr[5]);  		gdi.decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 18), gdi._C64MaskChar, READ_LE_UINT16(roomptr + 18)); +		gdi._C64ObjectMode = true;  	} else if (_features & GF_OLD_BUNDLE) {  		_IM00_offs = READ_LE_UINT16(roomptr + 0x0A);  		if (_features & GF_AFTER_V2) diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 5ffa1b46c0..b9db501b88 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -453,6 +453,9 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) {  			error("No image for verb %d", verb);  	}  	assert(imptr); +	if (_features & GF_AFTER_V1) { +		gdi._C64ObjectMode = true; +	}  	for (i = 0; i < imgw; i++) {  		tmp = xstrip + i;  		if (tmp < gdi._numStrips)  | 
