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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Mar 18 22:15:40 CET 2007


Revision: 26232
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26232&view=rev
Author:   peres001
Date:     2007-03-18 14:15:39 -0700 (Sun, 18 Mar 2007)

Log Message:
-----------
Made loadStatic return a new StaticCnv instead of accepting a parameter. All disk functions now accept only a resource name as their parameter.

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

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-03-18 21:08:28 UTC (rev 26231)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-03-18 21:15:39 UTC (rev 26232)
@@ -340,7 +340,7 @@
 }
 
 
-void Disk::loadStatic(const char* name, StaticCnv* cnv) {
+StaticCnv* Disk::loadStatic(const char* name) {
 
 	char path[PATH_LEN];
 
@@ -351,6 +351,8 @@
 			errorFileNotFound(path);
 	}
 
+	StaticCnv* cnv = new StaticCnv;
+
 	_archive.skip(1);
 	cnv->_width = _archive.readByte();
 	cnv->_height = _archive.readByte();
@@ -366,7 +368,7 @@
 	decompressChunk(compressed, cnv->_data0, size);
 	free(compressed);
 
-	return;
+	return cnv;
 }
 
 Cnv* Disk::loadFrames(const char* name) {

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2007-03-18 21:08:28 UTC (rev 26231)
+++ scummvm/trunk/engines/parallaction/disk.h	2007-03-18 21:15:39 UTC (rev 26232)
@@ -110,7 +110,7 @@
 	StaticCnv* loadPointer();
 	StaticCnv* loadHead(const char* name);
 	Cnv* loadFont(const char* name);
-	void loadStatic(const char* name, StaticCnv* cnv);
+	StaticCnv* loadStatic(const char* name);
 	Cnv* loadFrames(const char* name);
 	void loadSlide(const char *filename);
 	void loadScenery(const char* background, const char* mask);

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-18 21:08:28 UTC (rev 26231)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-03-18 21:15:39 UTC (rev 26232)
@@ -533,12 +533,12 @@
 
 void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
 
-	byte *t = data->_cnv._data0;
+	byte *t = data->_cnv->_data0;
 	byte *s = _buffers[kBitBack] + x + y * SCREEN_WIDTH;
 	byte *d = data->_backup;
 
-	for (uint16 i = 0; i < data->_cnv._height ; i++) {
-		for (uint16 j = 0; j < data->_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++;
@@ -546,7 +546,7 @@
 			s++;
 		}
 
-		s += (SCREEN_WIDTH - data->_cnv._width);
+		s += (SCREEN_WIDTH - data->_cnv->_width);
 	}
 
 	return;

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-03-18 21:08:28 UTC (rev 26231)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-03-18 21:15:39 UTC (rev 26232)
@@ -165,7 +165,9 @@
 
 		case kZoneGet:
 			free(z->u.get->_backup);
-			_vm->_gfx->freeStaticCnv(&z->u.get->_cnv);
+			_vm->_gfx->freeStaticCnv(z->u.get->_cnv);
+			if (z->u.get->_cnv)
+				delete z->u.get->_cnv;
 			delete z->u.get;
 			break;
 
@@ -296,14 +298,13 @@
 
 		case kZoneGet: // get Zone init
 			if (!scumm_stricmp(_tokens[0], "file")) {
-				StaticCnv *vE4 = &u->get->_cnv;
 				strcpy(vC8, _tokens[1]);
-				_disk->loadStatic(vC8, vE4);
-				u->get->_backup = (byte*)malloc(vE4->_width*vE4->_height);
+				u->get->_cnv = _disk->loadStatic(vC8);
+				u->get->_backup = (byte*)malloc(u->get->_cnv->_width*u->get->_cnv->_height);
 
 				if ((z->_flags & kFlagsRemove) == 0) {
 					_gfx->backupGetBackground(u->get, z->_left, z->_top);
-					_gfx->flatBlitCnv(vE4, z->_left, z->_top, Gfx::kBitBack);
+					_gfx->flatBlitCnv(u->get->_cnv, z->_left, z->_top, Gfx::kBitBack);
 				}
 			}
 
@@ -392,9 +393,10 @@
 
 	char v68[PATH_LEN];
 	strcpy(v68, data->_filename);
-	_vm->_disk->loadStatic(v68, &data->_cnv);
-	_vm->_gfx->flatBlitCnv(&data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv._height)/2, Gfx::kBitFront);
-	_vm->_gfx->freeStaticCnv(&data->_cnv);
+	data->_cnv = _vm->_disk->loadStatic(v68);
+	_vm->_gfx->flatBlitCnv(data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv->_height)/2, Gfx::kBitFront);
+	_vm->_gfx->freeStaticCnv(data->_cnv);
+	delete data->_cnv;
 
 	int16 v6A = 0, v6C = 0;
 
@@ -514,8 +516,8 @@
 
 	static uint16 count = 0;
 
-	if (z->u.get->_cnv._width != 0) {
-		Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv._width, z->_top + z->u.get->_cnv._height);
+	if (z->u.get->_cnv) {
+		Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv->_width, z->_top + z->u.get->_cnv->_height);
 
 		_vm->_gfx->restoreZoneBackground(r, z->u.get->_backup);
 	}
@@ -534,13 +536,13 @@
 
 	Zone *z = (Zone*)parm;
 
-	if (&z->u.get->_cnv != NULL) {
-		if (z->u.get->_cnv._data0 != NULL) {
+	if (z->u.get->_cnv) {
+		if (z->u.get->_cnv->_data0 != NULL) {
 			_vm->_gfx->backupGetBackground(z->u.get, z->_left, z->_top);
 		}
 
-		_vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_left, z->_top, Gfx::kBitBack);
-		_vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_left, z->_top, Gfx::kBit2);
+		_vm->_gfx->flatBlitCnv(z->u.get->_cnv, z->_left, z->_top, Gfx::kBitBack);
+		_vm->_gfx->flatBlitCnv(z->u.get->_cnv, z->_left, z->_top, Gfx::kBit2);
 	}
 
 	j->_count++;

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-03-18 21:08:28 UTC (rev 26231)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-03-18 21:15:39 UTC (rev 26232)
@@ -91,7 +91,7 @@
 
 struct GetData {	// size = 24
 	uint32			_icon;
-	StaticCnv		_cnv;
+	StaticCnv		*_cnv;
 	byte		   *_backup;
 	uint16			field_14;		// unused
 	uint16			field_16;		// unused
@@ -99,6 +99,7 @@
 	GetData() {
 		_icon = 0;
 		_backup = NULL;
+		_cnv = NULL;
 	}
 };
 struct SpeakData {	// size = 36
@@ -111,7 +112,7 @@
 	}
 };
 struct ExamineData {	// size = 28
-	StaticCnv	_cnv;
+	StaticCnv	*_cnv;
 	uint16		_opBase;		   // unused
 	uint16		field_12;			// unused
 	char*		_description;
@@ -121,6 +122,7 @@
 		_opBase = 0;
 		_description = NULL;
 		_filename = NULL;
+		_cnv = NULL;
 	}
 };
 struct DoorData {	// size = 28


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