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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jan 12 14:14:11 CET 2009


Revision: 35835
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35835&view=rev
Author:   peres001
Date:     2009-01-12 13:14:09 +0000 (Mon, 12 Jan 2009)

Log Message:
-----------
Fixed regression from revision 35765. Mask and path patches were destroyed before getting a chance to be used.

Revision Links:
--------------
    http://scummvm.svn.sourceforge.net/scummvm/?rev=35765&view=rev

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

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2009-01-12 07:21:34 UTC (rev 35834)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2009-01-12 13:14:09 UTC (rev 35835)
@@ -156,7 +156,7 @@
 	clearGfxObjects(kGfxObjCharacter);
 }
 
-void Gfx::loadGfxObjMask(const char *name, GfxObj *obj) {
+void BackgroundInfo::loadGfxObjMask(const char *name, GfxObj *obj) {
 	Common::Rect rect;
 	obj->getRect(0, rect);
 
@@ -164,11 +164,11 @@
 	buf->create(rect.width(), rect.height());
 	_vm->_disk->loadMask(name, *buf);
 
-	obj->_maskId = _backgroundInfo->addMaskPatch(buf);
+	obj->_maskId = addMaskPatch(buf);
 	obj->_hasMask = true;
 }
 
-void Gfx::loadGfxObjPath(const char *name, GfxObj *obj) {
+void BackgroundInfo::loadGfxObjPath(const char *name, GfxObj *obj) {
 	Common::Rect rect;
 	obj->getRect(0, rect);
 
@@ -176,7 +176,7 @@
 	buf->create(rect.width(), rect.height());
 	_vm->_disk->loadPath(name, *buf);
 
-	obj->_pathId = _backgroundInfo->addPathPatch(buf);
+	obj->_pathId = addPathPatch(buf);
 	obj->_hasPath = true;
 }
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2009-01-12 07:21:34 UTC (rev 35834)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2009-01-12 13:14:09 UTC (rev 35835)
@@ -843,9 +843,9 @@
 
 void BackgroundInfo::clearMaskData() {
 	// free mask data
-	MaskPatchMap::iterator it = _maskPatches.begin();
+	MaskPatches::iterator it = _maskPatches.begin();
 	for ( ; it != _maskPatches.end(); it++) {
-		delete (*it)._value;
+		delete *it;
 	}
 	_maskPatches.clear();
 	delete _mask;
@@ -865,20 +865,20 @@
 	}
 }
 
-int BackgroundInfo::addMaskPatch(MaskBuffer *patch) {
-	int id = _maskPatches.size();
-	_maskPatches.setVal(id, patch);
+uint BackgroundInfo::addMaskPatch(MaskBuffer *patch) {
+	uint id = _maskPatches.size();
+	_maskPatches.push_back(patch);
 	return id;
 }
 
-void BackgroundInfo::toggleMaskPatch(int id, int x, int y, bool apply) {
+void BackgroundInfo::toggleMaskPatch(uint id, int x, int y, bool apply) {
 	if (!hasMask()) {
 		return;
 	}
-	if (!_maskPatches.contains(id)) {
+	if (id >= _maskPatches.size()) {
 		return;
 	}
-	MaskBuffer *patch = _maskPatches.getVal(id);
+	MaskBuffer *patch = _maskPatches[id];
 	if (apply) {
 		_mask->bltOr(x, y, *patch, 0, 0, patch->w, patch->h);
 	} else {
@@ -904,9 +904,9 @@
 
 void BackgroundInfo::clearPathData() {
 	// free mask data
-	PathPatchMap::iterator it = _pathPatches.begin();
+	PathPatches::iterator it = _pathPatches.begin();
 	for ( ; it != _pathPatches.end(); it++) {
-		delete (*it)._value;
+		delete *it;
 	}
 	_pathPatches.clear();
 	delete _path;
@@ -926,20 +926,20 @@
 	}
 }
 
-int BackgroundInfo::addPathPatch(PathBuffer *patch) {
-	int id = _pathPatches.size();
-	_pathPatches.setVal(id, patch);
+uint BackgroundInfo::addPathPatch(PathBuffer *patch) {
+	uint id = _pathPatches.size();
+	_pathPatches.push_back(patch);
 	return id;
 }
 
-void BackgroundInfo::togglePathPatch(int id, int x, int y, bool apply) {
+void BackgroundInfo::togglePathPatch(uint id, int x, int y, bool apply) {
 	if (!hasPath()) {
 		return;
 	}
-	if (!_pathPatches.contains(id)) {
+	if (id >= _pathPatches.size()) {
 		return;
 	}
-	PathBuffer *patch = _pathPatches.getVal(id);
+	PathBuffer *patch = _pathPatches[id];
 	if (apply) {
 		_path->bltOr(x, y, *patch, 0, 0, patch->w, patch->h);
 	} else {

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2009-01-12 07:21:34 UTC (rev 35834)
+++ scummvm/trunk/engines/parallaction/graphics.h	2009-01-12 13:14:09 UTC (rev 35835)
@@ -345,13 +345,13 @@
 */
 struct BackgroundInfo {
 protected:
-	typedef Common::HashMap<int, MaskBuffer*> MaskPatchMap;
-	MaskPatchMap _maskPatches;
+	typedef Common::Array<MaskBuffer*> MaskPatches;
+	MaskPatches 	_maskPatches;
 	MaskBuffer		_maskBackup;
 	void clearMaskData();
 
-	typedef Common::HashMap<int, PathBuffer*> PathPatchMap;
-	PathPatchMap 	_pathPatches;
+	typedef Common::Array<PathBuffer*> PathPatches;
+	PathPatches 	_pathPatches;
 	PathBuffer		_pathBackup;
 	void clearPathData();
 
@@ -377,16 +377,18 @@
 
 	// mask management
 	bool hasMask();
-	int addMaskPatch(MaskBuffer *patch);
-	void toggleMaskPatch(int id, int x, int y, bool apply);
+	uint addMaskPatch(MaskBuffer *patch);
+	void toggleMaskPatch(uint id, int x, int y, bool apply);
 	uint16 getMaskLayer(uint16 z) const;
 	void finalizeMask();
+	void loadGfxObjMask(const char *name, GfxObj *obj);
 
 	// path management
 	bool hasPath();
-	int addPathPatch(PathBuffer *patch);
-	void togglePathPatch(int id, int x, int y, bool apply);
+	uint addPathPatch(PathBuffer *patch);
+	void togglePathPatch(uint id, int x, int y, bool apply);
 	void finalizePath();
+	void loadGfxObjPath(const char *name, GfxObj *obj);
 };
 
 
@@ -437,8 +439,6 @@
 	void freeLocationObjects();
 	void showGfxObj(GfxObj* obj, bool visible);
 	void clearGfxObjects(uint filter);
-	void loadGfxObjMask(const char *name, GfxObj *obj);
-	void loadGfxObjPath(const char *name, GfxObj *obj);
 	void sortScene();
     void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor);
 	void unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor);

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2009-01-12 07:21:34 UTC (rev 35834)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2009-01-12 13:14:09 UTC (rev 35835)
@@ -788,11 +788,11 @@
 		}
 
 		if (!scumm_stricmp(_tokens[0], "mask")) {
-			_vm->_gfx->loadGfxObjMask(_tokens[1], data->gfxobj);
+			ctxt.info->loadGfxObjMask(_tokens[1], data->gfxobj);
 		}
 
 		if (!scumm_stricmp(_tokens[0], "path")) {
-			_vm->_gfx->loadGfxObjPath(_tokens[1], data->gfxobj);
+			ctxt.info->loadGfxObjPath(_tokens[1], data->gfxobj);
 		}
 
 		if (!scumm_stricmp(_tokens[0], "icon")) {


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