[Scummvm-cvs-logs] SF.net SVN: scummvm: [28539] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Aug 12 10:37:47 CEST 2007


Revision: 28539
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28539&view=rev
Author:   peres001
Date:     2007-08-12 01:37:46 -0700 (Sun, 12 Aug 2007)

Log Message:
-----------
Better support for large backgrounds.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-12 08:26:20 UTC (rev 28538)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-12 08:37:46 UTC (rev 28539)
@@ -322,7 +322,7 @@
 	for (uint16 i = 0; i < h; i++) {
 		memset(d, color, w);
 
-		d += _vm->_screenWidth;
+		d += _backgroundWidth;
 	}
 
 	return;
@@ -357,7 +357,7 @@
 	byte *d = (byte*)_buffers[buffer]->getBasePtr(dp.x, dp.y);
 
 	uint sPitch = r.width() - q.width();
-	uint dPitch = _vm->_screenWidth - q.width();
+	uint dPitch = _backgroundWidth - q.width();
 
 	for (uint16 i = q.top; i < q.bottom; i++) {
 		for (uint16 j = q.left; j < q.right; j++) {
@@ -387,7 +387,7 @@
 	byte *d = (byte*)_buffers[buffer]->getBasePtr(dp.x, dp.y);
 
 	uint sPitch = r.width() - q.width();
-	uint dPitch = _vm->_screenWidth - q.width();
+	uint dPitch = _backgroundWidth - q.width();
 
 	for (uint16 i = 0; i < q.height(); i++) {
 
@@ -493,7 +493,7 @@
 
 void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) {
 	byte *s = (byte*)_buffers[kBit2]->getBasePtr(x, y);
-	copyRect(data->_cnv->_width, data->_cnv->_height, data->_background, data->_cnv->_width, s, _vm->_screenWidth);
+	copyRect(data->_cnv->_width, data->_cnv->_height, data->_background, data->_cnv->_width, s,_backgroundWidth);
 	return;
 }
 
@@ -503,7 +503,7 @@
 	byte *s = (byte*)_buffers[kBitBack]->getBasePtr(x, y);
 	byte *d = data->_backup;
 
-	uint pitch = _vm->_screenWidth - data->_cnv->w;
+	uint pitch = _backgroundWidth - data->_cnv->w;
 
 	for (uint16 i = 0; i < data->_cnv->h ; i++) {
 		for (uint16 j = 0; j < data->_cnv->w ; j++) {
@@ -530,7 +530,7 @@
 	byte *d0 = (byte*)_buffers[kBitBack]->getBasePtr(r.left, r.top);
 	byte *d1 = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
 
-	uint pitch = _vm->_screenWidth - r.width();
+	uint pitch = _backgroundWidth - r.width();
 
 	for (uint16 i = 0; i < r.height() ; i++) {
 		for (uint16 j = 0; j < r.width() ; j++) {
@@ -678,16 +678,16 @@
 	if (left < 0) left = 0;
 	if (top < 0) top = 0;
 
-	if (left >= _vm->_screenWidth) return;
-	if (top >= _vm->_screenHeight) return;
+	if (left >= _backgroundWidth) return;
+	if (top >= _backgroundHeight) return;
 
-	if (left+width >= _vm->_screenWidth) width = _vm->_screenWidth - left;
-	if (top+height >= _vm->_screenHeight) height = _vm->_screenHeight - top;
+	if (left+width >= _backgroundWidth) width = _backgroundWidth - left;
+	if (top+height >= _backgroundHeight) height = _backgroundHeight - top;
 
 	Common::Rect q(width, height);
 	q.moveTo(left, top);
 
-	copyRect(kBitBack, q, (byte*)_buffers[kBit2]->getBasePtr(q.left, q.top), _vm->_screenWidth);
+	copyRect(kBitBack, q, (byte*)_buffers[kBit2]->getBasePtr(q.left, q.top), _backgroundWidth);
 
 	return;
 }
@@ -696,6 +696,9 @@
 void Gfx::setBackground(Graphics::Surface *surface) {
 	_buffers[kBit2] = surface;
 
+	_backgroundWidth = surface->w;
+	_backgroundHeight = surface->h;
+
 	_buffers[kBitFront]->create(surface->w, surface->h, 1);
 	_buffers[kBitBack]->create(surface->w, surface->h, 1);
 
@@ -720,14 +723,14 @@
 
 void Gfx::copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch) {
 	byte *d = (byte*)_buffers[dstbuffer]->getBasePtr(r.left, r.top);
-	copyRect(r.width(), r.height(), d, _vm->_screenWidth, src, pitch);
+	copyRect(r.width(), r.height(), d, _backgroundWidth, src, pitch);
 	return;
 }
 
 
 void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) {
 	byte *s = (byte*)_buffers[srcbuffer]->getBasePtr(r.left, r.top);
-	copyRect(r.width(), r.height(), dst, pitch, s, _vm->_screenWidth);
+	copyRect(r.width(), r.height(), dst, pitch, s, _backgroundWidth);
 	return;
 }
 
@@ -738,7 +741,7 @@
 
 void Gfx::zeroMaskValue(uint16 x, uint16 y, byte color) {
 
-	uint16 _ax = x + y * _vm->_screenWidth;
+	uint16 _ax = x + y * _backgroundWidth;
 	_depthMask->data[_ax >> 2] &= ~(3 << ((_ax & 3) << 1));
 
 	return;
@@ -778,6 +781,9 @@
 	g_system->initSize(_vm->_screenWidth, _vm->_screenHeight);
 	g_system->endGFXTransaction();
 
+	_backgroundWidth = _vm->_screenWidth;
+	_backgroundHeight = _vm->_screenHeight;
+
 	_buffers[kBitFront] = new Graphics::Surface;
 	_buffers[kBitFront]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
 	_buffers[kBitBack] = new Graphics::Surface;

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-08-12 08:26:20 UTC (rev 28538)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-08-12 08:37:46 UTC (rev 28539)
@@ -241,6 +241,9 @@
 	PaletteFxRange		_palettefx[6];
 	Palette				_palette;
 
+	uint 				_backgroundWidth;
+	uint 				_backgroundHeight;
+
 	uint				_screenX;		// scrolling position
 	uint				_screenY;
 


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