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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Jun 29 11:56:45 CEST 2008


Revision: 32834
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32834&view=rev
Author:   peres001
Date:     2008-06-29 02:56:44 -0700 (Sun, 29 Jun 2008)

Log Message:
-----------
Merged the three render lists (for animations, doors and objects) into a single one.

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

Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp	2008-06-29 09:30:32 UTC (rev 32833)
+++ scummvm/trunk/engines/parallaction/debug.cpp	2008-06-29 09:56:44 UTC (rev 32834)
@@ -191,14 +191,12 @@
 				"| name               |  x  |  y  |  z  |  f  |  type  |  flag  |\n"
 				"+--------------------+-----+-----+-----+-----+--------+--------+\n");
 
-	for (uint i = 0; i < 3; i++) {
-		GfxObjList::iterator b = _vm->_gfx->_gfxobjList[i].begin();
-		GfxObjList::iterator e = _vm->_gfx->_gfxobjList[i].end();
+	GfxObjList::iterator b = _vm->_gfx->_gfxobjList.begin();
+	GfxObjList::iterator e = _vm->_gfx->_gfxobjList.end();
 
-		for ( ; b != e; b++) {
-			GfxObj *obj = *b;
-			DebugPrintf("|%-20s|%5i|%5i|%5i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->frame, objType[obj->type], 6 );
-		}
+	for ( ; b != e; b++) {
+		GfxObj *obj = *b;
+		DebugPrintf("|%-20s|%5i|%5i|%5i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->frame, objType[obj->type], 6 );
 	}
 
 	DebugPrintf("+--------------------+-----+-----+-----+-----+--------+--------+\n");

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-06-29 09:30:32 UTC (rev 32833)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-06-29 09:56:44 UTC (rev 32834)
@@ -89,6 +89,8 @@
 	GfxObj *obj = _disk->loadFrames(name);
 	assert(obj);
 
+	// animation Z is not set here, but controlled by game scripts and user interaction.
+	// it is always >=0 and <screen height
 	obj->type = kGfxObjTypeAnim;
 	return obj;
 }
@@ -98,6 +100,7 @@
 	GfxObj *obj = _disk->loadStatic(name);
 	assert(obj);
 
+	obj->z = kGfxObjGetZ;	// this preset Z value ensures that get zones are drawn after doors but before animations
 	obj->type = kGfxObjTypeGet;
 	return obj;
 }
@@ -106,14 +109,13 @@
 	GfxObj *obj = _disk->loadFrames(name);
 	assert(obj);
 
+	obj->z = kGfxObjDoorZ;	// this preset Z value ensures that doors are drawn first
 	obj->type = kGfxObjTypeDoor;
 	return obj;
 }
 
 void Gfx::clearGfxObjects() {
-	_gfxobjList[0].clear();
-	_gfxobjList[1].clear();
-	_gfxobjList[2].clear();
+	_gfxobjList.clear();
 }
 
 void Gfx::showGfxObj(GfxObj* obj, bool visible) {
@@ -123,25 +125,25 @@
 
 	if (visible) {
 		obj->setFlags(kGfxObjVisible);
-		_gfxobjList[obj->type].push_back(obj);
+		_gfxobjList.push_back(obj);
 	} else {
 		obj->clearFlags(kGfxObjVisible);
-		_gfxobjList[obj->type].remove(obj);
+		_gfxobjList.remove(obj);
 	}
 
 }
 
 
 
-bool compareAnimationZ(const GfxObj* a1, const GfxObj* a2) {
+bool compareZ(const GfxObj* a1, const GfxObj* a2) {
 	return a1->z < a2->z;
 }
 
 void Gfx::sortAnimations() {
-	GfxObjList::iterator first = _gfxobjList[kGfxObjTypeAnim].begin();
-	GfxObjList::iterator last = _gfxobjList[kGfxObjTypeAnim].end();
+	GfxObjList::iterator first = _gfxobjList.begin();
+	GfxObjList::iterator last = _gfxobjList.end();
 
-	Common::sort(first, last, compareAnimationZ);
+	Common::sort(first, last, compareZ);
 }
 
 void Gfx::drawGfxObjects(Graphics::Surface &surf) {
@@ -154,22 +156,19 @@
 	// TODO: Dr.Ki is not visible inside the club
 
 
-	for (uint i = 0; i < 3; i++) {
+	GfxObjList::iterator b = _gfxobjList.begin();
+	GfxObjList::iterator e = _gfxobjList.end();
 
-		GfxObjList::iterator b = _gfxobjList[i].begin();
-		GfxObjList::iterator e = _gfxobjList[i].end();
-
-		for (; b != e; b++) {
-			GfxObj *obj = *b;
-			if (obj->isVisible()) {
-				obj->getRect(obj->frame, rect);
-				rect.translate(obj->x - _varScrollX, obj->y);
-				data = obj->getData(obj->frame);
-				if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
-					blt(rect, data, &surf, obj->layer, 0);
-				} else {
-					unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, 0);
-				}
+	for (; b != e; b++) {
+		GfxObj *obj = *b;
+		if (obj->isVisible()) {
+			obj->getRect(obj->frame, rect);
+			rect.translate(obj->x - _varScrollX, obj->y);
+			data = obj->getData(obj->frame);
+			if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
+				blt(rect, data, &surf, obj->layer, 0);
+			} else {
+				unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, 0);
 			}
 		}
 	}

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-06-29 09:30:32 UTC (rev 32833)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-06-29 09:56:44 UTC (rev 32834)
@@ -360,6 +360,11 @@
 	kGfxObjTypeAnim = 2
 };
 
+enum {
+	kGfxObjDoorZ = -200,
+	kGfxObjGetZ = -100
+};
+
 class GfxObj {
 	char *_name;
 	Frames *_frames;
@@ -369,7 +374,10 @@
 
 public:
 	int16 x, y;
-	uint16 z;
+
+	int32 z;
+
+
 	uint type;
 	uint frame;
 	uint layer;
@@ -461,7 +469,7 @@
 	Disk *_disk;
 	VarMap _vars;
 
-	GfxObjList _gfxobjList[3];
+	GfxObjList _gfxobjList;
 	GfxObj* loadAnim(const char *name);
 	GfxObj* loadGet(const char *name);
 	GfxObj* loadDoor(const char *name);


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