[Scummvm-cvs-logs] CVS: scummvm/scumm floodfill_he.cpp,2.1.2.5,2.1.2.6 resource.cpp,1.339.2.10,1.339.2.11 resource.h,1.17.2.2,1.17.2.3 script_v100he.cpp,2.173.2.7,2.173.2.8 script_v7he.cpp,2.166.2.8,2.166.2.9 scumm.h,1.647.2.15,1.647.2.16 wiz_he.cpp,2.96.2.7,2.96.2.8 wiz_he.h,2.30.2.5,2.30.2.6

kirben kirben at users.sourceforge.net
Thu Jan 26 16:35:08 CET 2006


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24695/scumm

Modified Files:
      Tag: branch-0-8-0
	floodfill_he.cpp resource.cpp resource.h script_v100he.cpp 
	script_v7he.cpp scumm.h wiz_he.cpp wiz_he.h 
Log Message:

Make resource management of modified wizImages closer to original games.
Fixes many errors in Backyard Sports titles.


Index: floodfill_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/floodfill_he.cpp,v
retrieving revision 2.1.2.5
retrieving revision 2.1.2.6
diff -u -d -r2.1.2.5 -r2.1.2.6
--- floodfill_he.cpp	26 Jan 2006 10:45:45 -0000	2.1.2.5
+++ floodfill_he.cpp	27 Jan 2006 00:34:42 -0000	2.1.2.6
@@ -22,9 +22,10 @@
 
 #include "common/stdafx.h"
 
+#include "scumm/floodfill_he.h"
 #include "scumm/intern.h"
+#include "scumm/resource.h"
 #include "scumm/scumm.h"
-#include "scumm/floodfill_he.h"
 
 namespace Scumm {
 	
@@ -285,6 +286,7 @@
 			}
 		}
 	}
+	_vm->res.setModified(rtImage, params->img.resNum);
 }
 
 } // End of namespace Scumm

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.339.2.10
retrieving revision 1.339.2.11
diff -u -d -r1.339.2.10 -r1.339.2.11
--- resource.cpp	26 Jan 2006 11:04:47 -0000	1.339.2.10
+++ resource.cpp	27 Jan 2006 00:34:42 -0000	1.339.2.11
@@ -615,6 +615,7 @@
 	res.name[id] = name;
 	res.address[id] = (byte **)calloc(num, sizeof(void *));
 	res.flags[id] = (byte *)calloc(num, sizeof(byte));
+	res.status[id] = (byte *)calloc(num, sizeof(byte));
 
 	if (mode) {
 		res.roomno[id] = (byte *)calloc(num, sizeof(byte));
@@ -985,6 +986,8 @@
 		return _sound->isSoundInUse(i);
 	case rtCharset:
 		return _charset->getCurID() == i;
+	case rtImage:
+		return res.isModified(type, i) != 0;
 	case rtSpoolBuffer:
 		return _sound->isSoundRunning(10000 + i) != 0;
 	default:
@@ -992,6 +995,24 @@
 	}
 }
 
+void ResourceManager::setModified(int type, int i) {
+	if (!validateResource("Modified", type, i))
+		return;
+	status[type][i] |= RS_MODIFIED;
+}
+
+void ResourceManager::setUnModified(int type, int i) {
+	if (!validateResource("Modified", type, i))
+		return;
+	status[type][i] &= ~RS_MODIFIED;
+}
+
+bool ResourceManager::isModified(int type, int i) const {
+	if (!validateResource("isModified", type, i))
+		return false;
+	return (status[type][i] & RS_MODIFIED) != 0;
+}
+
 void ResourceManager::expireResources(uint32 size) {
 	int i, j;
 	byte flag;
@@ -1044,6 +1065,7 @@
 		}
 		free(address[i]);
 		free(flags[i]);
+		free(status[i]);
 		free(roomno[i]);
 		free(roomoffs[i]);
 

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.h,v
retrieving revision 1.17.2.2
retrieving revision 1.17.2.3
diff -u -d -r1.17.2.2 -r1.17.2.3
--- resource.h	18 Jan 2006 18:07:32 -0000	1.17.2.2
+++ resource.h	27 Jan 2006 00:34:42 -0000	1.17.2.3
@@ -33,7 +33,9 @@
 enum {
 	RF_LOCK = 0x80,
 	RF_USAGE = 0x7F,
-	RF_USAGE_MAX = RF_USAGE
+	RF_USAGE_MAX = RF_USAGE,
+
+ 	RS_MODIFIED = 0x10
 };
 
 

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.173.2.7
retrieving revision 2.173.2.8
diff -u -d -r2.173.2.7 -r2.173.2.8
--- script_v100he.cpp	26 Jan 2006 10:45:45 -0000	2.173.2.7
+++ script_v100he.cpp	27 Jan 2006 00:34:42 -0000	2.173.2.8
@@ -1117,10 +1117,12 @@
 		}
 		break;
 	case 133:
-		if (_heResType == rtCharset)
+		if (_heResType == rtCharset) {
 			nukeCharset(_heResId);
-		else
+		} else {
+			res.setUnModified(_heResType, _heResId);
 			res.nukeResource(_heResType, _heResId);
+		}
 		break;
 	case 134:
 	case 135:

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.166.2.8
retrieving revision 2.166.2.9
diff -u -d -r2.166.2.8 -r2.166.2.9
--- script_v7he.cpp	26 Jan 2006 10:45:45 -0000	2.166.2.8
+++ script_v7he.cpp	27 Jan 2006 00:34:42 -0000	2.166.2.9
@@ -631,6 +631,7 @@
 		break;
 	case 192:
 		resid = pop();
+		res.setUnModified(rtImage, resid);
 		res.nukeResource(rtImage, resid);
 		break;
 	case 201:

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.647.2.15
retrieving revision 1.647.2.16
diff -u -d -r1.647.2.15 -r1.647.2.16
--- scumm.h	20 Jan 2006 23:03:18 -0000	1.647.2.15
+++ scumm.h	27 Jan 2006 00:34:42 -0000	1.647.2.16
@@ -328,6 +328,7 @@
 	const char *name[rtNumTypes];
 	byte **address[rtNumTypes];
 	byte *flags[rtNumTypes];
+ 	byte *status[rtNumTypes];
 	byte *roomno[rtNumTypes];
 	uint32 *roomoffs[rtNumTypes];
 	uint32 *globsize[rtNumTypes];
@@ -350,6 +351,10 @@
 	void lock(int type, int i);
 	void unlock(int type, int i);
 
+	void setModified(int type, int i);
+	void setUnModified(int type, int i);
+	bool isModified(int type, int i) const;
+
 	void setResourceCounter(int type, int index, byte flag);
 	void increaseResourceCounter();
 

Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.96.2.7
retrieving revision 2.96.2.8
diff -u -d -r2.96.2.7 -r2.96.2.8
--- wiz_he.cpp	26 Jan 2006 10:45:45 -0000	2.96.2.7
+++ wiz_he.cpp	27 Jan 2006 00:34:42 -0000	2.96.2.8
@@ -911,6 +911,7 @@
 			break;
 		}
 	}
+	_vm->res.setModified(rtImage, resNum);
 }
 
 void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
@@ -1427,18 +1428,7 @@
 		dstResNum = params->dstResNum;
 	}
 	if (params->processFlags & kWPFRemapPalette) {
-		int st = (params->processFlags & kWPFNewState) ? params->img.state : 0;
-		int num = params->remapNum;
-		const uint8 *index = params->remapIndex;
-		uint8 *iwiz = _vm->getResourceAddress(rtImage, params->img.resNum);
-		assert(iwiz);
-		uint8 *rmap = _vm->findWrappedBlock(MKID('RMAP'), iwiz, st, 0) ;
-		assert(rmap);
-		WRITE_BE_UINT32(rmap, 0x01234567);
-		while (num--) {
-			uint8 idx = *index++;
-			rmap[4 + idx] = params->remapColor[idx];
-		}
+		remapWizImagePal(params);
 		flags |= kWIFRemapPalette;
 	}
 
@@ -1542,6 +1532,7 @@
 		WRITE_BE_UINT32(res_data, 'WIZD'); res_data += 4;
 		WRITE_BE_UINT32(res_data, 8 + img_w * img_h); res_data += 4;
 	}
+	_vm->res.setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::fillWizRect(const WizParameters *params) {
@@ -1586,6 +1577,7 @@
 			}
 		}
 	}
+	_vm->res.setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::fillWizLine(const WizParameters *params) {
@@ -1677,6 +1669,7 @@
 			}
 		}
 	}
+	_vm->res.setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::fillWizPixel(const WizParameters *params) {
@@ -1713,6 +1706,23 @@
 			}
 		}
 	}
+	_vm->res.setModified(rtImage, params->img.resNum);
+}
+
+void Wiz::remapWizImagePal(const WizParameters *params) {
+	int st = (params->processFlags & kWPFNewState) ? params->img.state : 0;
+	int num = params->remapNum;
+	const uint8 *index = params->remapIndex;
+	uint8 *iwiz = _vm->getResourceAddress(rtImage, params->img.resNum);
+	assert(iwiz);
+	uint8 *rmap = _vm->findWrappedBlock(MKID('RMAP'), iwiz, st, 0) ;
+	assert(rmap);
+	WRITE_BE_UINT32(rmap, 0x01234567);
+	while (num--) {
+		uint8 idx = *index++;
+		rmap[4 + idx] = params->remapColor[idx];
+	}
+	_vm->res.setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::processWizImage(const WizParameters *params) {
@@ -1753,7 +1763,7 @@
 						_vm->VAR(_vm->VAR_GAME_LOADED) = -2;
 						_vm->VAR(119) = -2;
 					} else {
-						_vm->res.lock(rtImage, params->img.resNum);
+						_vm->res.setModified(rtImage, params->img.resNum);
 						_vm->VAR(_vm->VAR_GAME_LOADED) = 0;
 						_vm->VAR(119) = 0;
 					}
@@ -1810,24 +1820,14 @@
 		break;
 	case 6:
 		if (params->processFlags & kWPFRemapPalette) {
-			int state = (params->processFlags & kWPFNewState) ? params->img.state : 0;
-			int num = params->remapNum;
-			const uint8 *index = params->remapIndex;
-			uint8 *iwiz = _vm->getResourceAddress(rtImage, params->img.resNum);
-			assert(iwiz);
-			uint8 *rmap = _vm->findWrappedBlock(MKID('RMAP'), iwiz, state, 0) ;
-			assert(rmap);
-			WRITE_BE_UINT32(rmap, 0x01234567);
-			while (num--) {
-				uint8 idx = *index++;
-				rmap[4 + idx] = params->remapColor[idx];
-			}
+			remapWizImagePal(params);
 		}
 		break;
 	// HE 99+
 	case 7:
 		// Used in PuttsFunShop/SamsFunShop/soccer2004
 		// TODO: Capture polygon
+		_vm->res.setModified(rtImage, params->img.resNum);
 		break;
 	case 8:
 		createWizEmptyImage(params);
@@ -1863,6 +1863,7 @@
 	case 17:
 		// Used in to draw circles in FreddisFunShop/PuttsFunShop/SamsFunShop
 		// TODO: Ellipse
+		_vm->res.setModified(rtImage, params->img.resNum);
 		break;
 	default:
 		error("Unhandled processWizImage mode %d", params->processMode);

Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.30.2.5
retrieving revision 2.30.2.6
diff -u -d -r2.30.2.5 -r2.30.2.6
--- wiz_he.h	26 Jan 2006 10:45:45 -0000	2.30.2.5
+++ wiz_he.h	27 Jan 2006 00:34:42 -0000	2.30.2.6
@@ -166,6 +166,7 @@
 	void fillWizLine(const WizParameters *params);
 	void fillWizPixel(const WizParameters *params);
 	void fillWizFlood(const WizParameters *params);
+	void remapWizImagePal(const WizParameters *params);
 
 	void getWizImageDim(int resNum, int state, int32 &w, int32 &h);
 	int getWizImageStates(int resnum);





More information about the Scummvm-git-logs mailing list