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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Mar 12 20:58:11 CET 2007


Revision: 26107
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26107&view=rev
Author:   peres001
Date:     2007-03-12 12:58:10 -0700 (Mon, 12 Mar 2007)

Log Message:
-----------
The only uses for StaticCnv::_data2 were by Get and Door zones, so a new field has been added to those structure and _data2 has been deleted. Some graphic routines has been renamed to better reflect this change, too.

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

Modified: scummvm/trunk/engines/parallaction/defs.h
===================================================================
--- scummvm/trunk/engines/parallaction/defs.h	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/defs.h	2007-03-12 19:58:10 UTC (rev 26107)
@@ -67,7 +67,6 @@
 	uint16	_height;	//
 	byte*	_data0; 	// bitmap
 	byte*	_data1; 	// unused
-	byte*	_data2; 	// backup of underlying background
 };
 
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-12 19:58:10 UTC (rev 26107)
@@ -571,31 +571,29 @@
 	return;
 }
 
+void Graphics::backupDoorBackground(DoorData *data, int16 x, int16 y) {
 
-void Graphics::backupCnvBackground(StaticCnv *cnv, int16 x, int16 y) {
-
 	byte *s = _buffers[kBit2] + x + y * SCREEN_WIDTH;
-	byte *d = cnv->_data2;
+	byte *d = data->_background;
 
-	for (uint16 i = 0; i < cnv->_height ; i++) {
-		memcpy(d, s, cnv->_width);
+	for (uint16 i = 0; i < data->_cnv._height ; i++) {
+		memcpy(d, s, data->_cnv._width);
 
 		s += SCREEN_WIDTH;
-		d += cnv->_width;
+		d += data->_cnv._width;
 	}
 
 	return;
 }
 
+void Graphics::backupGetBackground(GetData *data, int16 x, int16 y) {
 
-void Graphics::backupCnvBackgroundTransparent(StaticCnv *cnv, int16 x, int16 y) {
-
-	byte *t = cnv->_data0;
+	byte *t = data->_cnv._data0;
 	byte *s = _buffers[kBitBack] + x + y * SCREEN_WIDTH;
-	byte *d = cnv->_data2;
+	byte *d = data->_backup;
 
-	for (uint16 i = 0; i < cnv->_height ; i++) {
-		for (uint16 j = 0; j < cnv->_width ; j++) {
+	for (uint16 i = 0; i < data->_cnv._height ; i++) {
+		for (uint16 j = 0; j < data->_cnv._width ; j++) {
 			*d = (*t) ? *s : 0;
 
 			d++;
@@ -603,25 +601,26 @@
 			s++;
 		}
 
-		s += (SCREEN_WIDTH - cnv->_width);
+		s += (SCREEN_WIDTH - data->_cnv._width);
 	}
 
 	return;
 }
 
-
-//	restores a cnv backup on the background
 //
+//	copies a rectangular bitmap on the background
 //
-void Graphics::restoreCnvBackground(StaticCnv *cnv, int16 x, int16 y) {
+void Graphics::restoreZoneBackground(byte *data, int16 x, int16 y, uint16 w, uint16 h) {
 
-	byte *temp = cnv->_data0;
-	cnv->_data0 = cnv->_data2;
+	StaticCnv cnv;
 
-	flatBlitCnv(cnv, x, y, kBitBack, cnv->_data1);
-	flatBlitCnv(cnv, x, y, kBit2, cnv->_data1);
+	cnv._data0 = data;
+	cnv._data1 = NULL;
+	cnv._width = w;
+	cnv._height = h;
 
-	cnv->_data0 = temp;
+	flatBlitCnv(&cnv, x, y, kBitBack, cnv._data1);
+	flatBlitCnv(&cnv, x, y, kBit2, cnv._data1);
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-03-12 19:58:10 UTC (rev 26107)
@@ -61,6 +61,9 @@
 
 class Parallaction;
 
+struct DoorData;
+struct GetData;
+
 class Graphics {
 
 public:
@@ -90,9 +93,9 @@
 	void makeCnvFromString(StaticCnv *cnv, char *text);
 	void freeCnv(Cnv *cnv);
 	void freeStaticCnv(StaticCnv *cnv);
-	void backupCnvBackground(StaticCnv *cnv, int16 x, int16 y);
-	void backupCnvBackgroundTransparent(StaticCnv *cnv, int16 x, int16 y);
-	void restoreCnvBackground(StaticCnv *cnv, int16 x, int16 y);
+	void backupDoorBackground(DoorData *data, int16 x, int16 y);
+	void backupGetBackground(GetData *data, int16 x, int16 y);
+	void restoreZoneBackground(byte *data, int16 x, int16 y, uint16 w, uint16 h);
 
 	// location
 	void setBackground(byte *background);

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-03-12 19:58:10 UTC (rev 26107)
@@ -236,7 +236,6 @@
 	_yourHead._height = 0;
 	_yourHead._data0 = NULL;
 	_yourHead._data1 = NULL;
-	_yourHead._data2 = NULL;
 
 	_yourself._zone.pos._position._x = 150;
 	_yourself._zone.pos._position._y = 100;

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2007-03-12 19:58:10 UTC (rev 26107)
@@ -392,7 +392,6 @@
 //	v14._height = _yourself._cnv._height;
 //	v14._data0 = _yourself._cnv._array[_yourself._frame];
 //	v14._data1 = _yourself._cnv.field_8[_yourself._frame];
-//	v14._data2 = &_yourself.field_54;
 
 	if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_yourself._cnv._width/2 + _si + 2, _yourself._cnv._height + _di) != 0)) {
 //		printf("walk right\n");

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-03-12 19:58:10 UTC (rev 26107)
@@ -169,7 +169,7 @@
 			break;
 
 		case kZoneGet:
-			free(z->u.get->_cnv._data2);
+			free(z->u.get->_backup);
 			_vm->_graphics->freeStaticCnv(&z->u.get->_cnv);
 			free(z->u.get);
 			break;
@@ -293,8 +293,8 @@
 //				_ax = (z->_flags & kFlagsClosed ? 0 : 1);
 //				vE0._data1 = doorcnv->field_8[_ax];
 
-				vE0._data2 = u->door->_background = (byte*)malloc(vE0._width*vE0._height);
-				_graphics->backupCnvBackground(&vE0, z->_limits._left, z->_limits._top);
+				u->door->_background = (byte*)malloc(vE0._width*vE0._height);
+				_graphics->backupDoorBackground(u->door, z->_limits._left, z->_limits._top);
 
 				_graphics->flatBlitCnv(&vE0, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE0._data1);
 			}
@@ -311,10 +311,10 @@
 				StaticCnv *vE4 = &u->get->_cnv;
 				strcpy(vC8, _tokens[1]);
 				_disk->loadStatic(vC8, vE4);
-				vE4->_data2 = (byte*)malloc(vE4->_width*vE4->_height);
+				u->get->_backup = (byte*)malloc(vE4->_width*vE4->_height);
 
 				if ((z->_flags & kFlagsRemove) == 0) {
-					_graphics->backupCnvBackgroundTransparent(vE4, z->_limits._left, z->_limits._top);
+					_graphics->backupGetBackground(u->get, z->_limits._left, z->_limits._top);
 					_graphics->flatBlitCnv(vE4, z->_limits._left, z->_limits._top, Graphics::kBitBack, vE4->_data1);
 				}
 			}
@@ -371,7 +371,6 @@
 	v3C._height = _yourTalk._height;
 	v3C._data0 = _yourTalk._array[0];
 	v3C._data1 = NULL; //_yourTalk.field_8[0];
-	v3C._data2 = NULL;
 
 	_vm->_graphics->setFont("comic");
 	_vm->_graphics->flatBlitCnv(&v3C, 190, 80, Graphics::kBitFront, v3C._data1);
@@ -485,13 +484,11 @@
 	StaticCnv v14;
 
 	if (v18) {
-		v14._data2 = z->u.door->_background;
-//		v4 = &z->u.door._background;
-
 		v14._width = v18->_width;
 		v14._height = v18->_height;
-		_vm->_graphics->restoreCnvBackground(&v14, z->_limits._left, z->_limits._top);
 
+		_vm->_graphics->restoreZoneBackground(z->u.door->_background, z->_limits._left, z->_limits._top, v18->_width, v18->_height);
+
 		uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1);
 
 		v14._data0 = v18->_array[_ax];
@@ -525,7 +522,7 @@
 	static uint16 count = 0;
 
 	if (z->u.get->_cnv._width != 0) {
-		_vm->_graphics->restoreCnvBackground(&z->u.get->_cnv, z->_limits._left, z->_limits._top);
+		_vm->_graphics->restoreZoneBackground(z->u.get->_backup, z->_limits._left, z->_limits._top, z->u.get->_cnv._width, z->u.get->_cnv._height);
 	}
 
 	count++;
@@ -544,7 +541,7 @@
 
 	if (&z->u.get->_cnv != NULL) {
 		if (z->u.get->_cnv._data0 != NULL) {
-			_vm->_graphics->backupCnvBackgroundTransparent(&z->u.get->_cnv, z->_limits._left, z->_limits._top);
+			_vm->_graphics->backupGetBackground(z->u.get, z->_limits._left, z->_limits._top);
 		}
 
 		_vm->_graphics->flatBlitCnv(&z->u.get->_cnv, z->_limits._left, z->_limits._top, Graphics::kBitBack, z->u.get->_cnv._data1);

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-03-12 19:53:36 UTC (rev 26106)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-03-12 19:58:10 UTC (rev 26107)
@@ -78,6 +78,7 @@
 struct GetData {	// size = 24
 	uint32			_icon;
 	StaticCnv		_cnv;
+	byte		   *_backup;
 	uint16			field_14;		// unused
 	uint16			field_16;		// unused
 };


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