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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Dec 13 18:52:37 CET 2008


Revision: 35343
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35343&view=rev
Author:   peres001
Date:     2008-12-13 17:52:37 +0000 (Sat, 13 Dec 2008)

Log Message:
-----------
Some more restructuring of rendering code.

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

Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp	2008-12-13 17:31:48 UTC (rev 35342)
+++ scummvm/trunk/engines/parallaction/debug.cpp	2008-12-13 17:52:37 UTC (rev 35343)
@@ -191,8 +191,8 @@
 				"| name               |  x  |  y  |  z  | layer |  f  |  type  |  visi  |\n"
 				"+--------------------+-----+-----+-----+-------+-----+--------+--------+\n");
 
-	GfxObjList::iterator b = _vm->_gfx->_gfxobjList.begin();
-	GfxObjList::iterator e = _vm->_gfx->_gfxobjList.end();
+	GfxObjArray::iterator b = _vm->_gfx->_sceneObjects.begin();
+	GfxObjArray::iterator e = _vm->_gfx->_sceneObjects.end();
 
 	for ( ; b != e; b++) {
 		GfxObj *obj = *b;

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-12-13 17:31:48 UTC (rev 35342)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-12-13 17:52:37 UTC (rev 35343)
@@ -95,7 +95,7 @@
 	// animation Z is not set here, but controlled by game scripts and user interaction.
 	// it is always >=0 and <screen height
 	obj->transparentKey = 0;
-	_gfxobjList.push_back(obj);
+	_sceneObjects.push_back(obj);
 	return obj;
 }
 
@@ -107,7 +107,7 @@
 	obj->z = kGfxObjGetZ;	// this preset Z value ensures that get zones are drawn after doors but before animations
 	obj->type = kGfxObjTypeGet;
 	obj->transparentKey = 0;
-	_gfxobjList.push_back(obj);
+	_sceneObjects.push_back(obj);
 	return obj;
 }
 
@@ -120,20 +120,17 @@
 
 	obj->z = kGfxObjDoorZ;	// this preset Z value ensures that doors are drawn first
 	obj->transparentKey = 0;
-	_gfxobjList.push_back(obj);
+	_sceneObjects.push_back(obj);
 	return obj;
 }
 
 void Gfx::clearGfxObjects(uint filter) {
 
-	GfxObjList::iterator b = _gfxobjList.begin();
-	GfxObjList::iterator e = _gfxobjList.end();
-
-	for ( ; b != e; ) {
-		if (((*b)->_flags & filter) != 0) {
-			b = _gfxobjList.erase(b);
+	for (uint i = 0; i < _sceneObjects.size() ; ) {
+		if ((_sceneObjects[i]->_flags & filter) != 0) {
+			_sceneObjects.remove_at(i);
 		} else {
-			b++;
+			i++;
 		}
 	}
 
@@ -157,9 +154,9 @@
 	return a1->z < a2->z;
 }
 
-void Gfx::sortAnimations() {
-	GfxObjList::iterator first = _gfxobjList.begin();
-	GfxObjList::iterator last = _gfxobjList.end();
+void Gfx::sortScene() {
+	GfxObjArray::iterator first = _sceneObjects.begin();
+	GfxObjArray::iterator last = _sceneObjects.end();
 
 	Common::sort(first, last, compareZ);
 }
@@ -191,21 +188,6 @@
 }
 
 
-void Gfx::drawGfxObjects(Graphics::Surface &surf) {
-
-	sortAnimations();
-	// TODO: some zones don't appear because of wrong masking (3 or 0?)
-
-	GfxObjList::iterator b = _gfxobjList.begin();
-	GfxObjList::iterator e = _gfxobjList.end();
-
-	for (; b != e; b++) {
-		drawGfxObject(*b, surf);
-	}
-}
-
-
-
 void Gfx::drawText(Font *font, Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color) {
 	byte *dst = (byte*)surf->getBasePtr(x, y);
 	font->setColor(color);
@@ -410,53 +392,7 @@
 
 
 void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) {
-
-	Common::Point dp;
-	Common::Rect q(r);
-
-	Common::Rect clipper(surf->w, surf->h);
-
-	q.clip(clipper);
-	if (!q.isValidRect()) return;
-
-	dp.x = q.left;
-	dp.y = q.top;
-
-	q.translate(-r.left, -r.top);
-
-	byte *s = data + q.left + q.top * r.width();
-	byte *d = (byte*)surf->getBasePtr(dp.x, dp.y);
-
-	uint sPitch = r.width() - q.width();
-	uint dPitch = surf->w - q.width();
-
-
-	if (_varRenderMode == 2) {
-
-		for (uint16 i = 0; i < q.height(); i++) {
-
-			for (uint16 j = 0; j < q.width(); j++) {
-				if (*s != transparentColor) {
-					if (_backgroundInfo->mask.data && (z < LAYER_FOREGROUND)) {
-						byte v = _backgroundInfo->mask.getValue(dp.x + j, dp.y + i);
-						if (z >= v) *d = 5;
-					} else {
-						*d = 5;
-					}
-				}
-
-				s++;
-				d++;
-			}
-
-			s += sPitch;
-			d += dPitch;
-		}
-
-    } else {
-    	bltMaskScale(r, data, surf, z, scale, transparentColor);
-	}
-
+	bltMaskScale(r, data, surf, z, scale, transparentColor);
 }
 
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-12-13 17:31:48 UTC (rev 35342)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-12-13 17:52:37 UTC (rev 35343)
@@ -378,8 +378,6 @@
 		_varDrawPathZones = 0;
 		warning("Path zones are supported only in Big Red Adventure");
 	}
-
-	_varAnimRenderMode = getRenderMode("anim_render_mode");
 }
 
 int32 Gfx::getRenderMode(const char *type) {
@@ -491,11 +489,10 @@
 		unlockScreen();
 	}
 
-	_varRenderMode = _varAnimRenderMode;
-
+	sortScene();
 	Graphics::Surface *surf = lockScreen();
-		// draws animations frames and screen items
-		drawGfxObjects(*surf);
+		// draws animations frames and other game items
+		drawList(*surf, _sceneObjects);
 
 		// special effects
 		applyHalfbriteEffect_NS(*surf);
@@ -803,8 +800,6 @@
 	registerVar("background_mode", 1);
 	_varBackgroundMode = 1;
 
-	registerVar("anim_render_mode", 1);
-
 	registerVar("draw_path_zones", 0);
 
 	if ((_gameType == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-12-13 17:31:48 UTC (rev 35342)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-12-13 17:52:37 UTC (rev 35343)
@@ -399,8 +399,6 @@
 	void release();
 };
 
-typedef Common::List<GfxObj*> GfxObjList;
-
 #define LAYER_FOREGROUND   3
 
 /*
@@ -481,6 +479,9 @@
 
 typedef Common::HashMap<Common::String, int32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> VarMap;
 
+typedef Common::Array<GfxObj*> GfxObjArray;
+
+
 class Gfx {
 
 protected:
@@ -490,14 +491,13 @@
 	Disk *_disk;
 	VarMap _vars;
 
-	GfxObjList _gfxobjList;
+	GfxObjArray _sceneObjects;
 	GfxObj* loadAnim(const char *name);
 	GfxObj* loadGet(const char *name);
 	GfxObj* loadDoor(const char *name);
-	void drawGfxObjects(Graphics::Surface &surf);
 	void showGfxObj(GfxObj* obj, bool visible);
 	void clearGfxObjects(uint filter);
-	void sortAnimations();
+	void sortScene();
 
 
 	// labels
@@ -573,7 +573,6 @@
 
 	// frame data stored in programmable variables
 	int32				_varBackgroundMode;	// 1 = normal, 2 = only mask
-	int32				_varAnimRenderMode;	// 1 = normal, 2 = flat
 	int32				_varRenderMode;
 	int32				_varDrawPathZones;	// 0 = don't draw, 1 = draw
 	Graphics::Surface 	_bitmapMask;
@@ -600,7 +599,6 @@
 	#define MAX_NUM_LABELS	20
 	#define NO_FLOATING_LABEL	1000
 
-	typedef Common::Array<GfxObj*> GfxObjArray;
 	GfxObjArray	_labels;
 	GfxObjArray _balloons;
 	GfxObjArray	_items;


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