[Scummvm-cvs-logs] SF.net SVN: scummvm: [23922] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Sep 17 22:37:27 CEST 2006


Revision: 23922
          http://svn.sourceforge.net/scummvm/?rev=23922&view=rev
Author:   fingolfin
Date:     2006-09-17 13:36:48 -0700 (Sun, 17 Sep 2006)

Log Message:
-----------
Renamed ScummEngine::res to _res and allocate the ResourceManager on the heap (i.e. _res is a pointer now)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/akos.cpp
    scummvm/trunk/engines/scumm/boxes.cpp
    scummvm/trunk/engines/scumm/debugger.cpp
    scummvm/trunk/engines/scumm/gfx.cpp
    scummvm/trunk/engines/scumm/he/floodfill_he.cpp
    scummvm/trunk/engines/scumm/he/resource_he.cpp
    scummvm/trunk/engines/scumm/he/script_v100he.cpp
    scummvm/trunk/engines/scumm/he/script_v70he.cpp
    scummvm/trunk/engines/scumm/he/script_v72he.cpp
    scummvm/trunk/engines/scumm/he/sound_he.cpp
    scummvm/trunk/engines/scumm/he/wiz_he.cpp
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
    scummvm/trunk/engines/scumm/input.cpp
    scummvm/trunk/engines/scumm/insane/insane.cpp
    scummvm/trunk/engines/scumm/object.cpp
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/engines/scumm/resource.cpp
    scummvm/trunk/engines/scumm/resource_v2.cpp
    scummvm/trunk/engines/scumm/resource_v3.cpp
    scummvm/trunk/engines/scumm/resource_v4.cpp
    scummvm/trunk/engines/scumm/room.cpp
    scummvm/trunk/engines/scumm/saveload.cpp
    scummvm/trunk/engines/scumm/script.cpp
    scummvm/trunk/engines/scumm/script_c64.cpp
    scummvm/trunk/engines/scumm/script_v2.cpp
    scummvm/trunk/engines/scumm/script_v5.cpp
    scummvm/trunk/engines/scumm/script_v6.cpp
    scummvm/trunk/engines/scumm/script_v8.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/sound.cpp
    scummvm/trunk/engines/scumm/string.cpp
    scummvm/trunk/engines/scumm/verbs.cpp

Modified: scummvm/trunk/engines/scumm/akos.cpp
===================================================================
--- scummvm/trunk/engines/scumm/akos.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/akos.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -777,7 +777,7 @@
 	// So I had to put copy of it back here as it was before 1.227 revision
 	// of this file.
 	v1.scaletable = (_vm->_game.heversion >= 61) ? smallCostumeScaleTableAKOS : bigCostumeScaleTable;
-	if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->res.isResourceLoaded(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) {
+	if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->_res->isResourceLoaded(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) {
 		v1.scaletable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE);
 	}
 

Modified: scummvm/trunk/engines/scumm/boxes.cpp
===================================================================
--- scummvm/trunk/engines/scumm/boxes.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/boxes.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -1039,7 +1039,7 @@
 	// the boxes 7,8,9,10,11 the shortest way is to go via box 15.
 	// See also getPathToDestBox.
 
-	byte *matrixStart = res.createResource(rtMatrix, 1, BOX_MATRIX_SIZE);
+	byte *matrixStart = _res->createResource(rtMatrix, 1, BOX_MATRIX_SIZE);
 	const byte *matrixEnd = matrixStart + BOX_MATRIX_SIZE;
 
 	#define addToMatrix(b)	do { *matrixStart++ = (b); assert(matrixStart < matrixEnd); } while (0)

Modified: scummvm/trunk/engines/scumm/debugger.cpp
===================================================================
--- scummvm/trunk/engines/scumm/debugger.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/debugger.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -325,7 +325,7 @@
 			file.seek(-8, SEEK_CUR);
 		}
 
-		file.read(_vm->res.createResource(rtScript, resnum, size), size);
+		file.read(_vm->_res->createResource(rtScript, resnum, size), size);
 
 	} else
 		DebugPrintf("Unknown importres type '%s'\n", argv[1]);
@@ -395,8 +395,8 @@
 		DebugPrintf("Actor[%d]._elevation = %d\n", actnum, a->getElevation());
 		_vm->_fullRedraw = true;
 	} else if (!strcmp(argv[2], "costume")) {
-		if (value >= _vm->res.num[rtCostume])
-			DebugPrintf("Costume not changed as %d exceeds max of %d\n", value, _vm->res.num[rtCostume]);
+		if (value >= _vm->_res->num[rtCostume])
+			DebugPrintf("Costume not changed as %d exceeds max of %d\n", value, _vm->_res->num[rtCostume]);
 		else {
 			a->setActorCostume(value);
 			_vm->_fullRedraw = true;

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -258,8 +258,8 @@
 	int adj = 0;
 
 	for (i = 0; i < 3; i++) {
-		res.nukeResource(rtBuffer, i + 1);
-		res.nukeResource(rtBuffer, i + 5);
+		_res->nukeResource(rtBuffer, i + 1);
+		_res->nukeResource(rtBuffer, i + 5);
 	}
 
 	if (!getResourceAddress(rtBuffer, 4)) {
@@ -338,12 +338,12 @@
 		}
 	}
 
-	res.createResource(rtBuffer, slot + 1, size);
+	_res->createResource(rtBuffer, slot + 1, size);
 	vs->pixels = getResourceAddress(rtBuffer, slot + 1);
 	memset(vs->pixels, 0, size);	// reset background
 
 	if (twobufs) {
-		vs->backBuf = res.createResource(rtBuffer, slot + 5, size);
+		vs->backBuf = _res->createResource(rtBuffer, slot + 5, size);
 	}
 
 	if (slot != 3) {
@@ -744,7 +744,7 @@
 
 
 	size = itemsize * _gdi->_numZBuffer;
-	memset(res.createResource(rtBuffer, 9, size), 0, size);
+	memset(_res->createResource(rtBuffer, 9, size), 0, size);
 
 	for (i = 0; i < (int)ARRAYSIZE(_gdi->_imgBufOffs); i++) {
 		if (i < _gdi->_numZBuffer)

Modified: scummvm/trunk/engines/scumm/he/floodfill_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/floodfill_he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/floodfill_he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -287,7 +287,7 @@
 			}
 		}
 	}
-	_vm->res.setModified(rtImage, params->img.resNum);
+	_vm->_res->setModified(rtImage, params->img.resNum);
 }
 
 } // End of namespace Scumm

Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -733,7 +733,7 @@
 
 /* list_resources:
  *   Return an array of WinResource's in the current
- *   resource level specified by res.
+ *   resource level specified by _res->
  */
 Win32ResExtractor::WinResource *Win32ResExtractor::list_resources(WinLibrary *fi, WinResource *res, int *count) {
 	if (res != NULL && !res->is_directory)
@@ -1630,7 +1630,7 @@
 	num = READ_LE_UINT16(_heV7RoomOffsets);
 	ptr = _heV7RoomOffsets + 2;
 	for (i = 0; i < num; i++) {
-		res.roomoffs[rtRoom][i] = READ_LE_UINT32(ptr);
+		_res->roomoffs[rtRoom][i] = READ_LE_UINT32(ptr);
 		ptr += 4;
 	}
 }

Modified: scummvm/trunk/engines/scumm/he/script_v100he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v100he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/script_v100he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -1122,16 +1122,16 @@
 			objidx = getObjectIndex(_heResId);
 			if (objidx == -1)
 				break;
-			res.lock(rtFlObject, _objs[objidx].fl_object_index);
+			_res->lock(rtFlObject, _objs[objidx].fl_object_index);
 		} else {
-			res.lock(_heResType, _heResId);
+			_res->lock(_heResType, _heResId);
 		}
 		break;
 	case 133:
 		if (_heResType == rtCharset)
 			nukeCharset(_heResId);
 		else
-			res.nukeResource(_heResType, _heResId);
+			_res->nukeResource(_heResType, _heResId);
 		break;
 	case 134:
 	case 135:
@@ -1151,9 +1151,9 @@
 			objidx = getObjectIndex(_heResId);
 			if (objidx == -1)
 				break;
-			res.unlock(rtFlObject, _objs[objidx].fl_object_index);
+			_res->unlock(rtFlObject, _objs[objidx].fl_object_index);
 		} else {
-			res.unlock(_heResType, _heResId);
+			_res->unlock(_heResType, _heResId);
 		}
 		break;
 	default:

Modified: scummvm/trunk/engines/scumm/he/script_v70he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v70he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/script_v70he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -541,62 +541,62 @@
 		break;
 	case 104:		// SO_NUKE_SCRIPT
 		resid = pop();
-		res.nukeResource(rtScript, resid);
+		_res->nukeResource(rtScript, resid);
 		break;
 	case 105:		// SO_NUKE_SOUND
 		resid = pop();
-		res.nukeResource(rtSound, resid);
+		_res->nukeResource(rtSound, resid);
 		break;
 	case 106:		// SO_NUKE_COSTUME
 		resid = pop();
-		res.nukeResource(rtCostume, resid);
+		_res->nukeResource(rtCostume, resid);
 		break;
 	case 107:		// SO_NUKE_ROOM
 		resid = pop();
-		res.nukeResource(rtRoom, resid);
-		res.nukeResource(rtRoomImage, resid);
+		_res->nukeResource(rtRoom, resid);
+		_res->nukeResource(rtRoomImage, resid);
 		break;
 	case 108:		// SO_LOCK_SCRIPT
 		resid = pop();
 		if (resid >= _numGlobalScripts)
 			break;
-		res.lock(rtScript, resid);
+		_res->lock(rtScript, resid);
 		break;
 	case 109:		// SO_LOCK_SOUND
 		resid = pop();
-		res.lock(rtSound, resid);
+		_res->lock(rtSound, resid);
 		break;
 	case 110:		// SO_LOCK_COSTUME
 		resid = pop();
-		res.lock(rtCostume, resid);
+		_res->lock(rtCostume, resid);
 		break;
 	case 111:		// SO_LOCK_ROOM
 		resid = pop();
 		if (_game.heversion <= 71 && resid > 0x7F)
 			resid = _resourceMapper[resid & 0x7F];
-		res.lock(rtRoom, resid);
-		res.lock(rtRoomImage, resid);
+		_res->lock(rtRoom, resid);
+		_res->lock(rtRoomImage, resid);
 		break;
 	case 112:		// SO_UNLOCK_SCRIPT
 		resid = pop();
 		if (resid >= _numGlobalScripts)
 			break;
-		res.unlock(rtScript, resid);
+		_res->unlock(rtScript, resid);
 		break;
 	case 113:		// SO_UNLOCK_SOUND
 		resid = pop();
-		res.unlock(rtSound, resid);
+		_res->unlock(rtSound, resid);
 		break;
 	case 114:		// SO_UNLOCK_COSTUME
 		resid = pop();
-		res.unlock(rtCostume, resid);
+		_res->unlock(rtCostume, resid);
 		break;
 	case 115:		// SO_UNLOCK_ROOM
 		resid = pop();
 		if (_game.heversion <= 71 && resid > 0x7F)
 			resid = _resourceMapper[resid & 0x7F];
-		res.unlock(rtRoom, resid);
-		res.unlock(rtRoomImage, resid);
+		_res->unlock(rtRoom, resid);
+		_res->unlock(rtRoomImage, resid);
 		break;
 	case 116:
 		break;
@@ -635,11 +635,11 @@
 		break;
 	case 159:
 		resid = pop();
-		res.unlock(rtImage, resid);
+		_res->unlock(rtImage, resid);
 		break;
 	case 192:
 		resid = pop();
-		res.nukeResource(rtImage, resid);
+		_res->nukeResource(rtImage, resid);
 		break;
 	case 201:
 		resid = pop();
@@ -647,7 +647,7 @@
 		break;
 	case 202:
 		resid = pop();
-		res.lock(rtImage, resid);
+		_res->lock(rtImage, resid);
 		break;
 	case 203:
 		resid = pop();
@@ -658,14 +658,14 @@
 		objidx = getObjectIndex(resid);
 		if (objidx == -1)
 			break;
-		res.lock(rtFlObject, _objs[objidx].fl_object_index);
+		_res->lock(rtFlObject, _objs[objidx].fl_object_index);
 		break;
 	case 235:
 		resid = pop();
 		objidx = getObjectIndex(resid);
 		if (objidx == -1)
 			break;
-		res.unlock(rtFlObject, _objs[objidx].fl_object_index);
+		_res->unlock(rtFlObject, _objs[objidx].fl_object_index);
 		break;
 	case 239:
 		// Used in airport

Modified: scummvm/trunk/engines/scumm/he/script_v72he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v72he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/script_v72he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -419,7 +419,7 @@
 	size *= dim1end - dim1start + 1;
 	size >>= 3;
 
-	ah = (ArrayHeader *)res.createResource(rtString, id, size + sizeof(ArrayHeader));
+	ah = (ArrayHeader *)_res->createResource(rtString, id, size + sizeof(ArrayHeader));
 
 	ah->type = TO_LE_32(type);
 	ah->dim1start = TO_LE_32(dim1start);
@@ -962,7 +962,7 @@
 }
 
 void ScummEngine_v72he::o72_getNumFreeArrays() {
-	byte **addr = res.address[rtString];
+	byte **addr = _res->address[rtString];
 	int i, num = 0;
 
 	for (i = 1; i < _numArray; i++) {

Modified: scummvm/trunk/engines/scumm/he/sound_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/sound_he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/sound_he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -528,7 +528,7 @@
 		musicFile.seek(music_offs, SEEK_SET);
 
 		_vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
-		spoolPtr = _vm->res.createResource(rtSpoolBuffer, heChannel, size);
+		spoolPtr = _vm->_res->createResource(rtSpoolBuffer, heChannel, size);
 		assert(spoolPtr);
 		musicFile.read(spoolPtr, size);
 		musicFile.close();
@@ -686,13 +686,13 @@
 	}
 
 	_sfxMode |= 2;
-	_vm->res.nukeResource(rtSound, 1);
+	_vm->_res->nukeResource(rtSound, 1);
 
 	_sfxFile->seek(offset + 4, SEEK_SET);
 	 size = _sfxFile->readUint32BE();
 	_sfxFile->seek(offset, SEEK_SET);
 
-	_vm->res.createResource(rtSound, 1, size);
+	_vm->_res->createResource(rtSound, 1, size);
 	ptr = _vm->getResourceAddress(rtSound, 1);
 	_sfxFile->read(ptr, size);
 

Modified: scummvm/trunk/engines/scumm/he/wiz_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/wiz_he.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/he/wiz_he.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -1025,7 +1025,7 @@
 		dataSize = (dataSize + 1) & ~1;
 		int wizSize = headerSize + dataSize;
 		// write header
-		uint8 *wizImg = _vm->res.createResource(rtImage, resNum, dataSize + headerSize);
+		uint8 *wizImg = _vm->_res->createResource(rtImage, resNum, dataSize + headerSize);
 		WRITE_BE_UINT32(wizImg + 0x00, 'AWIZ');
 		WRITE_BE_UINT32(wizImg + 0x04, wizSize);
 		WRITE_BE_UINT32(wizImg + 0x08, 'WIZH');
@@ -1063,7 +1063,7 @@
 			break;
 		}
 	}
-	_vm->res.setModified(rtImage, resNum);
+	_vm->_res->setModified(rtImage, resNum);
 }
 
 void Wiz::displayWizImage(WizImage *pwi) {
@@ -1637,7 +1637,7 @@
 	} else {
 		palPtr = _vm->_currentPalette;
 	}
-	uint8 *res_data = _vm->res.createResource(rtImage, resNum, res_size);
+	uint8 *res_data = _vm->_res->createResource(rtImage, resNum, res_size);
 	if (!res_data) {
 		_vm->VAR(119) = -1;
 	} else {
@@ -1671,7 +1671,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, resNum);
+	_vm->_res->setModified(rtImage, resNum);
 }
 
 void Wiz::fillWizRect(const WizParameters *params) {
@@ -1716,7 +1716,7 @@
 			}
 		}
 	}
-	_vm->res.setModified(rtImage, params->img.resNum);
+	_vm->_res->setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::fillWizLine(const WizParameters *params) {
@@ -1808,7 +1808,7 @@
 			}
 		}
 	}
-	_vm->res.setModified(rtImage, params->img.resNum);
+	_vm->_res->setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::fillWizPixel(const WizParameters *params) {
@@ -1845,7 +1845,7 @@
 			}
 		}
 	}
-	_vm->res.setModified(rtImage, params->img.resNum);
+	_vm->_res->setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::remapWizImagePal(const WizParameters *params) {
@@ -1861,7 +1861,7 @@
 		uint8 idx = *index++;
 		rmap[4 + idx] = params->remapColor[idx];
 	}
-	_vm->res.setModified(rtImage, params->img.resNum);
+	_vm->_res->setModified(rtImage, params->img.resNum);
 }
 
 void Wiz::processWizImage(const WizParameters *params) {
@@ -1890,14 +1890,14 @@
 				if (id == MKID_BE('AWIZ') || id == MKID_BE('MULT')) {
 					uint32 size = f.readUint32BE();
 					f.seek(0, SEEK_SET);
-					byte *p = _vm->res.createResource(rtImage, params->img.resNum, size);
+					byte *p = _vm->_res->createResource(rtImage, params->img.resNum, size);
 					if (f.read(p, size) != size) {
-						_vm->res.nukeResource(rtImage, params->img.resNum);
+						_vm->_res->nukeResource(rtImage, params->img.resNum);
 						error("i/o error when reading '%s'", filename);
 						_vm->VAR(_vm->VAR_GAME_LOADED) = -2;
 						_vm->VAR(119) = -2;
 					} else {
-						_vm->res.setModified(rtImage, params->img.resNum);
+						_vm->_res->setModified(rtImage, params->img.resNum);
 						_vm->VAR(_vm->VAR_GAME_LOADED) = 0;
 						_vm->VAR(119) = 0;
 					}
@@ -1955,7 +1955,7 @@
 	case 7:
 		// Used in PuttsFunShop/SamsFunShop/soccer2004
 		// TODO: Capture polygon
-		_vm->res.setModified(rtImage, params->img.resNum);
+		_vm->_res->setModified(rtImage, params->img.resNum);
 		break;
 	case 8: {
 			int img_w = 640;
@@ -2006,7 +2006,7 @@
 	case 17:
 		// Used in to draw circles in FreddisFunShop/PuttsFunShop/SamsFunShop
 		// TODO: Ellipse
-		_vm->res.setModified(rtImage, params->img.resNum);
+		_vm->_res->setModified(rtImage, params->img.resNum);
 		break;
 	default:
 		error("Unhandled processWizImage mode %d", params->processMode);

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -356,7 +356,7 @@
 		assert(soundName[0] == 0);	// Paranoia check
 
 		_vm->ensureResourceLoaded(rtSound, soundId);
-		_vm->res.lock(rtSound, soundId);
+		_vm->_res->lock(rtSound, soundId);
 		ptr = _vm->getResourceAddress(rtSound, soundId);
 		if (ptr == NULL) {
 			closeSound(sound);
@@ -430,7 +430,7 @@
 				found = true;
 		}
 		if (!found)
-			_vm->res.unlock(rtSound, soundHandle->soundId);
+			_vm->_res->unlock(rtSound, soundHandle->soundId);
 	}
 
 	if (soundHandle->compressedStream)

Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/input.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -79,7 +79,7 @@
 				else if (event.kbd.keycode == 'd')
 					_debugger->attach();
 				else if (event.kbd.keycode == 's')
-					res.resourceStats();
+					_res->resourceStats();
 				else
 					_keyPressed = event.kbd.ascii;	// Normal key press, pass on to the game.
 			} else if (event.kbd.flags & OSystem::KBD_ALT) {

Modified: scummvm/trunk/engines/scumm/insane/insane.cpp
===================================================================
--- scummvm/trunk/engines/scumm/insane/insane.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/insane/insane.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -1148,7 +1148,7 @@
 	if (phase == 2)
 		_vm->ensureResourceLoaded(rtSound, resid);
 
-	_vm->res.setResourceCounter(rtSound, resid, 1);
+	_vm->_res->setResourceCounter(rtSound, resid, 1);
 
 	if (phase == 1) {
 		_objArray2Idx2++;
@@ -1170,7 +1170,7 @@
 		return 0;
 
 	_vm->ensureResourceLoaded(rtCostume, resid);
-	_vm->res.setResourceCounter(rtCostume, resid, 1);
+	_vm->_res->setResourceCounter(rtCostume, resid, 1);
 
 	// smlayer_lock(rtCostume, resid); // FIXME
 

Modified: scummvm/trunk/engines/scumm/object.cpp
===================================================================
--- scummvm/trunk/engines/scumm/object.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/object.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -500,8 +500,8 @@
 				_objs[i].obj_nr = 0;
 			} else {
 				// Nuke all unlocked flObjects
-				if (!res.isLocked(rtFlObject, _objs[i].fl_object_index)) {
-					res.nukeResource(rtFlObject, _objs[i].fl_object_index);
+				if (!_res->isLocked(rtFlObject, _objs[i].fl_object_index)) {
+					_res->nukeResource(rtFlObject, _objs[i].fl_object_index);
 					_objs[i].obj_nr = 0;
 					_objs[i].fl_object_index = 0;
 				} else if (_game.heversion >= 70) {
@@ -933,7 +933,7 @@
 			if (_objs[i].obj_nr == obj) {
 				if (!_objs[i].fl_object_index)
 					return;
-				res.nukeResource(rtFlObject, _objs[i].fl_object_index);
+				_res->nukeResource(rtFlObject, _objs[i].fl_object_index);
 				_objs[i].obj_nr = 0;
 				_objs[i].fl_object_index = 0;
 			}
@@ -945,7 +945,7 @@
 		if (_inventory[i] == obj) {
 			j = whereIsObject(obj);
 			if (j == WIO_INVENTORY) {
-				res.nukeResource(rtInventory, i);
+				_res->nukeResource(rtInventory, i);
 				_inventory[i] = 0;
 			}
 			a = _inventory;
@@ -953,8 +953,8 @@
 				if (!a[0] && a[1]) {
 					a[0] = a[1];
 					a[1] = 0;
-					res.address[rtInventory][i] = res.address[rtInventory][i + 1];
-					res.address[rtInventory][i + 1] = NULL;
+					_res->address[rtInventory][i] = _res->address[rtInventory][i + 1];
+					_res->address[rtInventory][i + 1] = NULL;
 				}
 			}
 			return;
@@ -1029,7 +1029,7 @@
 
 	for (i = 0; i < _numNewNames; i++) {
 		if (_newNames[i] == obj) {
-			res.nukeResource(rtObjectName, i);
+			_res->nukeResource(rtObjectName, i);
 			_newNames[i] = 0;
 			break;
 		}
@@ -1234,7 +1234,7 @@
 
 	slot = getInventorySlot();
 	_inventory[slot] = obj;
-	dst = res.createResource(rtInventory, slot, size);
+	dst = _res->createResource(rtInventory, slot, size);
 	assert(dst);
 	memcpy(dst, ptr, size);
 
@@ -1562,7 +1562,7 @@
 
 	for (i = (_numLocalObjects-1), od = _objs; --i >= 0; od++)
 		if (od->fl_object_index && od->obj_nr >= min && od->obj_nr <= max) {
-			res.nukeResource(rtFlObject, od->fl_object_index);
+			_res->nukeResource(rtFlObject, od->fl_object_index);
 			od->obj_nr = 0;
 			od->fl_object_index = 0;
 		}
@@ -1729,7 +1729,7 @@
 int ScummEngine::findFlObjectSlot() {
 	int i;
 	for (i = 1; i < _numFlObject; i++) {
-		if (res.address[rtFlObject][i] == NULL)
+		if (_res->address[rtFlObject][i] == NULL)
 			return i;
 	}
 	error("findFlObjectSlot: Out of FLObject slots");
@@ -1782,16 +1782,16 @@
 
 	// Lock room/roomScripts for the given room. They contains the OBCD/OBIM
 	// data, and a call to createResource might expire them, hence we lock them.
-	isRoomLocked = res.isLocked(rtRoom, room);
-	isRoomScriptsLocked = res.isLocked(rtRoomScripts, room);
+	isRoomLocked = _res->isLocked(rtRoom, room);
+	isRoomScriptsLocked = _res->isLocked(rtRoomScripts, room);
 	if (!isRoomLocked)
-		res.lock(rtRoom, room);
+		_res->lock(rtRoom, room);
 	if (_game.version == 8 && !isRoomScriptsLocked)
-		res.lock(rtRoomScripts, room);
+		_res->lock(rtRoomScripts, room);
 
 	// Allocate slot & memory for floating object
 	slot = findFlObjectSlot();
-	flob = res.createResource(rtFlObject, slot, flob_size);
+	flob = _res->createResource(rtFlObject, slot, flob_size);
 	assert(flob);
 
 	// Copy object code + object image to floating object
@@ -1803,9 +1803,9 @@
 
 	// Unlock room/roomScripts
 	if (!isRoomLocked)
-		res.unlock(rtRoom, room);
+		_res->unlock(rtRoom, room);
 	if (_game.version == 8 && !isRoomScriptsLocked)
-		res.unlock(rtRoomScripts, room);
+		_res->unlock(rtRoomScripts, room);
 
 	// Setup local object flags
 	resetRoomObject(od, flob, flob);

Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -821,7 +821,7 @@
 }
 
 Common::String ScummEngine::generateFilename(const int room) const {
-	const int diskNumber = (room > 0) ? res.roomno[rtRoom][room] : 0;
+	const int diskNumber = (room > 0) ? _res->roomno[rtRoom][room] : 0;
 	char buf[128];
 
 	if (_game.version == 4) {

Modified: scummvm/trunk/engines/scumm/resource.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/resource.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -85,8 +85,8 @@
 	// Load the disk numer / room offs (special case for room 0 exists because
 	// room 0 contains the data which is used to create the roomno / roomoffs
 	// tables -- hence obviously we mustn't use those when loading room 0.
-	const uint32 diskNumber = room ? res.roomno[rtRoom][room] : 0;
-	const uint32 room_offs = room ? res.roomoffs[rtRoom][room] : 0;
+	const uint32 diskNumber = room ? _res->roomno[rtRoom][room] : 0;
+	const uint32 room_offs = room ? _res->roomoffs[rtRoom][room] : 0;
 
 	// FIXME: Since room_offs is const, clearly the following loop either
 	// is never entered, or loops forever (if it wasn't for the return/error
@@ -96,7 +96,7 @@
 	while (room_offs != 0xFFFFFFFF) {
 
 		if (room_offs != 0 && room != 0 && _game.heversion < 98) {
-			_fileOffset = res.roomoffs[rtRoom][room];
+			_fileOffset = _res->roomoffs[rtRoom][room];
 			return;
 		}
 		
@@ -124,7 +124,7 @@
 				return;
 			deleteRoomOffsets();
 			readRoomsOffsets();
-			_fileOffset = res.roomoffs[rtRoom][room];
+			_fileOffset = _res->roomoffs[rtRoom][room];
 
 			if (_fileOffset != 8)
 				return;
@@ -159,8 +159,8 @@
 /** Delete the currently loaded room offsets. */
 void ScummEngine::deleteRoomOffsets() {
 	for (int i = 0; i < _numRooms; i++) {
-		if (res.roomoffs[rtRoom][i] != 0xFFFFFFFF)
-			res.roomoffs[rtRoom][i] = 0;
+		if (_res->roomoffs[rtRoom][i] != 0xFFFFFFFF)
+			_res->roomoffs[rtRoom][i] = 0;
 	}
 }
 
@@ -179,8 +179,8 @@
 	num = _fileHandle->readByte();
 	while (num--) {
 		room = _fileHandle->readByte();
-		if (res.roomoffs[rtRoom][room] != 0xFFFFFFFF) {
-			res.roomoffs[rtRoom][room] = _fileHandle->readUint32LE();
+		if (_res->roomoffs[rtRoom][room] != 0xFFFFFFFF) {
+			_res->roomoffs[rtRoom][room] = _fileHandle->readUint32LE();
 		} else {
 			_fileHandle->readUint32LE();
 		}
@@ -508,29 +508,29 @@
 	else
 		num = _fileHandle->readUint16LE();
 
-	if (num != res.num[id]) {
+	if (num != _res->num[id]) {
 		error("Invalid number of %ss (%d) in directory", name, num);
 	}
 
 	if (_game.features & GF_SMALL_HEADER) {
 		for (i = 0; i < num; i++) {
-			res.roomno[id][i] = _fileHandle->readByte();
-			res.roomoffs[id][i] = _fileHandle->readUint32LE();
+			_res->roomno[id][i] = _fileHandle->readByte();
+			_res->roomoffs[id][i] = _fileHandle->readUint32LE();
 		}
 	} else {
 		for (i = 0; i < num; i++) {
-			res.roomno[id][i] = _fileHandle->readByte();
+			_res->roomno[id][i] = _fileHandle->readByte();
 		}
 		for (i = 0; i < num; i++) {
-			res.roomoffs[id][i] = _fileHandle->readUint32LE();
+			_res->roomoffs[id][i] = _fileHandle->readUint32LE();
 
 			if (id == rtRoom && _game.heversion >= 70)
-				_heV7RoomIntOffsets[i] = res.roomoffs[id][i];
+				_heV7RoomIntOffsets[i] = _res->roomoffs[id][i];
 		}
 
 		if (_game.heversion >= 70) {
 			for (i = 0; i < num; i++) {
-				res.globsize[id][i] = _fileHandle->readUint32LE();
+				_res->globsize[id][i] = _fileHandle->readUint32LE();
 			}
 		}
 	}
@@ -590,7 +590,7 @@
 
 void ScummEngine::nukeCharset(int i) {
 	assertRange(1, i, _numCharsets - 1, "charset");
-	res.nukeResource(rtCharset, i);
+	_res->nukeResource(rtCharset, i);
 }
 
 void ScummEngine::ensureResourceLoaded(int type, int i) {
@@ -616,8 +616,8 @@
 	if (type != rtCharset && i == 0)
 		return;
 
-	if (i <= res.num[type])
-		addr = res.address[type][i];
+	if (i <= _res->num[type])
+		addr = _res->address[type][i];
 
 	if (addr)
 		return;
@@ -642,8 +642,8 @@
 
 	roomNr = getResourceRoomNr(type, idx);
 
-	if (idx >= res.num[type])
-		error("%s %d undefined %d %d", res.name[type], idx, res.num[type], roomNr);
+	if (idx >= _res->num[type])
+		error("%s %d undefined %d %d", _res->name[type], idx, _res->num[type], roomNr);
 
 	if (roomNr == 0)
 		roomNr = _roomResource;
@@ -656,7 +656,7 @@
 		else
 			fileOffs = 0;
 	} else {
-		fileOffs = res.roomoffs[type][idx];
+		fileOffs = _res->roomoffs[type][idx];
 		if (fileOffs == 0xFFFFFFFF)
 			return 0;
 	}
@@ -688,16 +688,16 @@
 
 		tag = _fileHandle->readUint32BE();
 
-		if (tag != res.tags[type] && _game.heversion < 70) {
+		if (tag != _res->tags[type] && _game.heversion < 70) {
 			error("%s %d not in room %d at %d+%d in file %s",
-					res.name[type], idx, roomNr,
+					_res->name[type], idx, roomNr,
 					_fileOffset, fileOffs, _fileHandle->name());
 		}
 
 		size = _fileHandle->readUint32BE();
 		_fileHandle->seek(-8, SEEK_CUR);
 	}
-	_fileHandle->read(res.createResource(type, idx, size), size);
+	_fileHandle->read(_res->createResource(type, idx, size), size);
 
 	// dump the resource if requested
 	if (_dumpScripts && type == rtScript) {
@@ -708,7 +708,7 @@
 		return 1;
 	}
 
-	res.nukeResource(type, idx);
+	_res->nukeResource(type, idx);
 
 	error("Cannot read resource");
 }
@@ -716,7 +716,7 @@
 int ScummEngine::getResourceRoomNr(int type, int idx) {
 	if (type == rtRoom && _game.heversion < 70)
 		return idx;
-	return res.roomno[type][idx];
+	return _res->roomno[type][idx];
 }
 
 int ScummEngine::getResourceSize(int type, int idx) {
@@ -734,24 +734,24 @@
 	if (_game.heversion >= 80 && type == rtString)
 		idx &= ~0x33539000;
 
-	if (!res.validateResource("getResourceAddress", type, idx))
+	if (!_res->validateResource("getResourceAddress", type, idx))
 		return NULL;
 
-	if (!res.address[type]) {
-		debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d), res.address[type] == NULL", resTypeFromId(type), idx);
+	if (!_res->address[type]) {
+		debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d), _res->address[type] == NULL", resTypeFromId(type), idx);
 		return NULL;
 	}
 
-	if (res.mode[type] && !res.address[type][idx]) {
+	if (_res->mode[type] && !_res->address[type][idx]) {
 		ensureResourceLoaded(type, idx);
 	}
 
-	if (!(ptr = (byte *)res.address[type][idx])) {
+	if (!(ptr = (byte *)_res->address[type][idx])) {
 		debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == NULL", resTypeFromId(type), idx);
 		return NULL;
 	}
 
-	res.setResourceCounter(type, idx, 1);
+	_res->setResourceCounter(type, idx, 1);
 
 	debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == %p", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader));
 	return ptr + sizeof(MemBlkHeader);
@@ -805,7 +805,7 @@
 	byte *ptr;
 
 	CHECK_HEAP
-	debugC(DEBUG_RESOURCE, "res.createResource(%s,%d,%d)", resTypeFromId(type), idx, size);
+	debugC(DEBUG_RESOURCE, "_res->createResource(%s,%d,%d)", resTypeFromId(type), idx, size);
 
 	if (!validateResource("allocating", type, idx))
 		return NULL;
@@ -926,7 +926,7 @@
 }
 
 bool ScummEngine::isResourceInUse(int type, int i) const {
-	if (!res.validateResource("isResourceInUse", type, i))
+	if (!_res->validateResource("isResourceInUse", type, i))
 		return false;
 	switch (type) {
 	case rtRoom:
@@ -944,7 +944,7 @@
 	case rtCharset:
 		return _charset->getCurID() == i;
 	case rtImage:
-		return res.isModified(type, i) != 0;
+		return _res->isModified(type, i) != 0;
 	case rtSpoolBuffer:
 		return _sound->isSoundRunning(10000 + i) != 0;
 	default:
@@ -1028,14 +1028,14 @@
 	byte *alloced;
 	int i, len;
 
-	res.nukeResource(type, resindex);
+	_res->nukeResource(type, resindex);
 
 	len = resStrLen(source) + 1;
 
 	if (len <= 0)
 		return;
 
-	alloced = res.createResource(type, resindex, len);
+	alloced = _res->createResource(type, resindex, len);
 
 	if (!source) {
 		alloced[0] = fetchScriptByte();
@@ -1292,28 +1292,28 @@
 		_storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData));
 	}
 
-	res.allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKID_BE('AKOS') : MKID_BE('COST'),
+	_res->allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKID_BE('AKOS') : MKID_BE('COST'),
 								_numCostumes, "costume", 1);
-	res.allocResTypeData(rtRoom, MKID_BE('ROOM'), _numRooms, "room", 1);
-	res.allocResTypeData(rtRoomImage, MKID_BE('RMIM'), _numRooms, "room image", 1);
-	res.allocResTypeData(rtRoomScripts, MKID_BE('RMSC'), _numRooms, "room script", 1);
-	res.allocResTypeData(rtSound, MKID_BE('SOUN'), _numSounds, "sound", 2);
-	res.allocResTypeData(rtScript, MKID_BE('SCRP'), _numScripts, "script", 1);
-	res.allocResTypeData(rtCharset, MKID_BE('CHAR'), _numCharsets, "charset", 1);
-	res.allocResTypeData(rtObjectName, 0, _numNewNames, "new name", 0);
-	res.allocResTypeData(rtInventory, 0, _numInventory, "inventory", 0);
-	res.allocResTypeData(rtTemp, 0, 10, "temp", 0);
-	res.allocResTypeData(rtScaleTable, 0, 5, "scale table", 0);
-	res.allocResTypeData(rtActorName, 0, _numActors, "actor name", 0);
-	res.allocResTypeData(rtVerb, 0, _numVerbs, "verb", 0);
-	res.allocResTypeData(rtString, 0, _numArray, "array", 0);
-	res.allocResTypeData(rtFlObject, 0, _numFlObject, "flobject", 0);
-	res.allocResTypeData(rtMatrix, 0, 10, "boxes", 0);
-	res.allocResTypeData(rtImage, MKID_BE('AWIZ'), _numImages, "images", 1);
-	res.allocResTypeData(rtTalkie, MKID_BE('TLKE'), _numTalkies, "talkie", 1);
+	_res->allocResTypeData(rtRoom, MKID_BE('ROOM'), _numRooms, "room", 1);
+	_res->allocResTypeData(rtRoomImage, MKID_BE('RMIM'), _numRooms, "room image", 1);
+	_res->allocResTypeData(rtRoomScripts, MKID_BE('RMSC'), _numRooms, "room script", 1);
+	_res->allocResTypeData(rtSound, MKID_BE('SOUN'), _numSounds, "sound", 2);
+	_res->allocResTypeData(rtScript, MKID_BE('SCRP'), _numScripts, "script", 1);
+	_res->allocResTypeData(rtCharset, MKID_BE('CHAR'), _numCharsets, "charset", 1);
+	_res->allocResTypeData(rtObjectName, 0, _numNewNames, "new name", 0);
+	_res->allocResTypeData(rtInventory, 0, _numInventory, "inventory", 0);
+	_res->allocResTypeData(rtTemp, 0, 10, "temp", 0);
+	_res->allocResTypeData(rtScaleTable, 0, 5, "scale table", 0);
+	_res->allocResTypeData(rtActorName, 0, _numActors, "actor name", 0);
+	_res->allocResTypeData(rtVerb, 0, _numVerbs, "verb", 0);
+	_res->allocResTypeData(rtString, 0, _numArray, "array", 0);
+	_res->allocResTypeData(rtFlObject, 0, _numFlObject, "flobject", 0);
+	_res->allocResTypeData(rtMatrix, 0, 10, "boxes", 0);
+	_res->allocResTypeData(rtImage, MKID_BE('AWIZ'), _numImages, "images", 1);
+	_res->allocResTypeData(rtTalkie, MKID_BE('TLKE'), _numTalkies, "talkie", 1);
 
 	if (_game.heversion >= 70) {
-		res.allocResTypeData(rtSpoolBuffer, 0, 9, "spool buffer", 1);
+		_res->allocResTypeData(rtSpoolBuffer, 0, 9, "spool buffer", 1);
 		_heV7RoomIntOffsets = (uint32 *)calloc(_numRooms, sizeof(uint32));
 	}
 }

Modified: scummvm/trunk/engines/scumm/resource_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource_v2.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/resource_v2.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -87,40 +87,40 @@
 	}
 
 	for (i = 0; i < _numRooms; i++) {
-		res.roomno[rtRoom][i] = i;
+		_res->roomno[rtRoom][i] = i;
 	}
 	_fileHandle->seek(_numRooms, SEEK_CUR);
 	for (i = 0; i < _numRooms; i++) {
-		res.roomoffs[rtRoom][i] = _fileHandle->readUint16LE();
-		if (res.roomoffs[rtRoom][i] == 0xFFFF)
-			res.roomoffs[rtRoom][i] = 0xFFFFFFFF;
+		_res->roomoffs[rtRoom][i] = _fileHandle->readUint16LE();
+		if (_res->roomoffs[rtRoom][i] == 0xFFFF)
+			_res->roomoffs[rtRoom][i] = 0xFFFFFFFF;
 	}
 
 	for (i = 0; i < _numCostumes; i++) {
-		res.roomno[rtCostume][i] = _fileHandle->readByte();
+		_res->roomno[rtCostume][i] = _fileHandle->readByte();
 	}
 	for (i = 0; i < _numCostumes; i++) {
-		res.roomoffs[rtCostume][i] = _fileHandle->readUint16LE();
-		if (res.roomoffs[rtCostume][i] == 0xFFFF)
-			res.roomoffs[rtCostume][i] = 0xFFFFFFFF;
+		_res->roomoffs[rtCostume][i] = _fileHandle->readUint16LE();
+		if (_res->roomoffs[rtCostume][i] == 0xFFFF)
+			_res->roomoffs[rtCostume][i] = 0xFFFFFFFF;
 	}
 
 	for (i = 0; i < _numScripts; i++) {
-		res.roomno[rtScript][i] = _fileHandle->readByte();
+		_res->roomno[rtScript][i] = _fileHandle->readByte();
 	}
 	for (i = 0; i < _numScripts; i++) {
-		res.roomoffs[rtScript][i] = _fileHandle->readUint16LE();
-		if (res.roomoffs[rtScript][i] == 0xFFFF)
-			res.roomoffs[rtScript][i] = 0xFFFFFFFF;
+		_res->roomoffs[rtScript][i] = _fileHandle->readUint16LE();
+		if (_res->roomoffs[rtScript][i] == 0xFFFF)
+			_res->roomoffs[rtScript][i] = 0xFFFFFFFF;
 	}
 
 	for (i = 0; i < _numSounds; i++) {
-		res.roomno[rtSound][i] = _fileHandle->readByte();
+		_res->roomno[rtSound][i] = _fileHandle->readByte();
 	}
 	for (i = 0; i < _numSounds; i++) {
-		res.roomoffs[rtSound][i] = _fileHandle->readUint16LE();
-		if (res.roomoffs[rtSound][i] == 0xFFFF)
-			res.roomoffs[rtSound][i] = 0xFFFFFFFF;
+		_res->roomoffs[rtSound][i] = _fileHandle->readUint16LE();
+		if (_res->roomoffs[rtSound][i] == 0xFFFF)
+			_res->roomoffs[rtSound][i] = 0xFFFFFFFF;
 	}
 }
 

Modified: scummvm/trunk/engines/scumm/resource_v3.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource_v3.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/resource_v3.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -45,16 +45,16 @@
 
 	if (id == rtRoom) {
 		for (i = 0; i < num; i++)
-			res.roomno[id][i] = i;
+			_res->roomno[id][i] = i;
 		_fileHandle->seek(num, SEEK_CUR);
 	} else {
 		for (i = 0; i < num; i++)
-			res.roomno[id][i] = _fileHandle->readByte();
+			_res->roomno[id][i] = _fileHandle->readByte();
 	}
 	for (i = 0; i < num; i++) {
-		res.roomoffs[id][i] = _fileHandle->readUint16LE();
-		if (res.roomoffs[id][i] == 0xFFFF)
-			res.roomoffs[id][i] = 0xFFFFFFFF;
+		_res->roomoffs[id][i] = _fileHandle->readUint16LE();
+		if (_res->roomoffs[id][i] == 0xFFFF)
+			_res->roomoffs[id][i] = 0xFFFFFFFF;
 	}
 }
 
@@ -116,7 +116,7 @@
 	}
 
 	size = file.readUint16LE();
-	file.read(res.createResource(rtCharset, no, size), size);
+	file.read(_res->createResource(rtCharset, no, size), size);
 }
 
 } // End of namespace Scumm

Modified: scummvm/trunk/engines/scumm/resource_v4.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource_v4.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/resource_v4.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -149,7 +149,7 @@
 	}
 
 	size = file.readUint32LE() + 11;
-	file.read(res.createResource(rtCharset, no, size), size);
+	file.read(_res->createResource(rtCharset, no, size), size);
 }
 
 void ScummEngine_v4::readMAXS(int blockSize) {

Modified: scummvm/trunk/engines/scumm/room.cpp
===================================================================
--- scummvm/trunk/engines/scumm/room.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/room.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -118,7 +118,7 @@
 	VAR(VAR_ROOM) = room;
 	_fullRedraw = true;
 
-	res.increaseResourceCounter();
+	_res->increaseResourceCounter();
 
 	_currentRoom = room;
 	VAR(VAR_ROOM) = room;
@@ -464,8 +464,8 @@
 	//
 	memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
 
-	res.nukeResource(rtMatrix, 1);
-	res.nukeResource(rtMatrix, 2);
+	_res->nukeResource(rtMatrix, 1);
+	_res->nukeResource(rtMatrix, 2);
 	if (_game.features & GF_SMALL_HEADER) {
 		ptr = findResourceData(MKID_BE('BOXD'), roomptr);
 		if (ptr) {
@@ -476,13 +476,13 @@
 			else
 				size = numOfBoxes * SIZEOF_BOX + 1;
 
-			res.createResource(rtMatrix, 2, size);
+			_res->createResource(rtMatrix, 2, size);
 			memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
 			ptr += size;
 
 			size = getResourceDataSize(ptr - size - _resourceHeaderSize) - size;
 			if (size > 0) {					// do this :)
-				res.createResource(rtMatrix, 1, size);
+				_res->createResource(rtMatrix, 1, size);
 				memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
 			}
 
@@ -491,7 +491,7 @@
 		ptr = findResourceData(MKID_BE('BOXD'), roomptr);
 		if (ptr) {
 			int size = getResourceDataSize(ptr);
-			res.createResource(rtMatrix, 2, size);
+			_res->createResource(rtMatrix, 2, size);
 			roomptr = getResourceAddress(rtRoom, _roomResource);
 			ptr = findResourceData(MKID_BE('BOXD'), roomptr);
 			memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
@@ -500,7 +500,7 @@
 		ptr = findResourceData(MKID_BE('BOXM'), roomptr);
 		if (ptr) {
 			int size = getResourceDataSize(ptr);
-			res.createResource(rtMatrix, 1, size);
+			_res->createResource(rtMatrix, 1, size);
 			roomptr = getResourceAddress(rtRoom, _roomResource);
 			ptr = findResourceData(MKID_BE('BOXM'), roomptr);
 			memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
@@ -510,14 +510,14 @@
 	//
 	// Load scale data
 	//
-	for (i = 1; i < res.num[rtScaleTable]; i++)
-		res.nukeResource(rtScaleTable, i);
+	for (i = 1; i < _res->num[rtScaleTable]; i++)
+		_res->nukeResource(rtScaleTable, i);
 
 	ptr = findResourceData(MKID_BE('SCAL'), roomptr);
 	if (ptr) {
 		int s1, s2, y1, y2;
 		if (_game.version == 8) {
-			for (i = 1; i < res.num[rtScaleTable]; i++, ptr += 16) {
+			for (i = 1; i < _res->num[rtScaleTable]; i++, ptr += 16) {
 				s1 = READ_LE_UINT32(ptr);
 				y1 = READ_LE_UINT32(ptr + 4);
 				s2 = READ_LE_UINT32(ptr + 8);
@@ -525,7 +525,7 @@
 				setScaleSlot(i, 0, y1, s1, 0, y2, s2);
 			}
 		} else {
-			for (i = 1; i < res.num[rtScaleTable]; i++, ptr += 8) {
+			for (i = 1; i < _res->num[rtScaleTable]; i++, ptr += 8) {
 				s1 = READ_LE_UINT16(ptr);
 				y1 = READ_LE_UINT16(ptr + 2);
 				s2 = READ_LE_UINT16(ptr + 4);
@@ -714,8 +714,8 @@
 	//
 	// Load box data
 	//
-	res.nukeResource(rtMatrix, 1);
-	res.nukeResource(rtMatrix, 2);
+	_res->nukeResource(rtMatrix, 1);
+	_res->nukeResource(rtMatrix, 2);
 
 	if (_game.version <= 2)
 		ptr = roomptr + *(roomptr + 0x15);
@@ -735,7 +735,7 @@
 			ptr = roomptr + *(roomptr + 0x15);
 			size = numOfBoxes * SIZEOF_BOX_C64 + 1;
 
-			res.createResource(rtMatrix, 2, size + 1);
+			_res->createResource(rtMatrix, 2, size + 1);
 			getResourceAddress(rtMatrix, 2)[0] = numOfBoxes;
 			memcpy(getResourceAddress(rtMatrix, 2) + 1, ptr, size);
 		} else {
@@ -745,7 +745,7 @@
 			else
 				size = numOfBoxes * SIZEOF_BOX_V3 + 1;
 
-			res.createResource(rtMatrix, 2, size);
+			_res->createResource(rtMatrix, 2, size);
 			memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
 		}
 
@@ -771,7 +771,7 @@
 		}
 
 		if (size > 0) {					// do this :)
-			res.createResource(rtMatrix, 1, size);
+			_res->createResource(rtMatrix, 1, size);
 			memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
 		}
 
@@ -780,8 +780,8 @@
 	//
 	// No scale data in old bundle games
 	//
-	for (i = 1; i < res.num[rtScaleTable]; i++)
-		res.nukeResource(rtScaleTable, i);
+	for (i = 1; i < _res->num[rtScaleTable]; i++)
+		_res->nukeResource(rtScaleTable, i);
 
 }
 

Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/saveload.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -247,8 +247,8 @@
 	// Nuke all resources
 	for (i = rtFirst; i <= rtLast; i++)
 		if (i != rtTemp && i != rtBuffer && (i != rtSound || _saveSound || !compat))
-			for (j = 0; j < res.num[i]; j++) {
-				res.nukeResource(i, j);
+			for (j = 0; j < _res->num[i]; j++) {
+				_res->nukeResource(i, j);
 			}
 
 	resetScummVars();
@@ -320,7 +320,7 @@
 	// loading such an old save game, try to upgrade the old to new format.
 	if (hdr.ver < VER(22)) {
 		// Convert all rtScaleTable resources to matching scale items
-		for (i = 1; i < res.num[rtScaleTable]; i++) {
+		for (i = 1; i < _res->num[rtScaleTable]; i++) {
 			convertScaleTableToScaleSlot(i);
 		}
 	}
@@ -1002,11 +1002,11 @@
 		// number of script resources, savegames won't break.
 		if (s->isSaving()) {
 			for (type = rtFirst; type <= rtLast; type++) {
-				if (res.mode[type] != 1 && type != rtTemp && type != rtBuffer) {
+				if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) {
 					s->saveUint16(type);	// Save the res type...
-					for (idx = 0; idx < res.num[type]; idx++) {
+					for (idx = 0; idx < _res->num[type]; idx++) {
 						// Only save resources which actually exist...
-						if (res.address[type][idx]) {
+						if (_res->address[type][idx]) {
 							s->saveUint16(idx);	// Save the index of the resource
 							saveResource(s, type, idx);
 						}
@@ -1018,7 +1018,7 @@
 		} else {
 			while ((type = s->loadUint16()) != 0xFFFF) {
 				while ((idx = s->loadUint16()) != 0xFFFF) {
-					assert(0 <= idx && idx < res.num[type]);
+					assert(0 <= idx && idx < _res->num[type]);
 					loadResource(s, type, idx);
 				}
 			}
@@ -1028,13 +1028,13 @@
 		// with index 0, and breaks whenever we change the limit on a given
 		// resource type.
  		for (type = rtFirst; type <= rtLast; type++)
- 			if (res.mode[type] != 1 && type != rtTemp && type != rtBuffer) {
+ 			if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) {
  				// For V1-V5 games, there used to be no object name resources.
  				// At some point this changed. But since old savegames rely on
  				// unchanged resource counts, we have to hard code the following check
  				if (_game.version < 6 && type == rtObjectName)
  					continue;
- 				for (idx = 1; idx < res.num[type]; idx++)
+ 				for (idx = 1; idx < _res->num[type]; idx++)
  					saveLoadResource(s, type, idx);
  			}
 	}
@@ -1115,8 +1115,8 @@
 	//
 	if (s->isSaving()) {
 		for (i = rtFirst; i <= rtLast; i++)
-			for (j = 1; j < res.num[i]; j++) {
-				if (res.isLocked(i, j)) {
+			for (j = 1; j < _res->num[i]; j++) {
+				if (_res->isLocked(i, j)) {
 					s->saveByte(i);
 					s->saveUint16(j);
 				}
@@ -1125,7 +1125,7 @@
 	} else {
 		while ((i = s->loadByte()) != 0xFF) {
 			j = s->loadUint16();
-			res.lock(i, j);
+			_res->lock(i, j);
 		}
 	}
 
@@ -1307,9 +1307,9 @@
 	byte *ptr;
 	uint32 size;
 
-	if (!res.mode[type]) {
+	if (!_res->mode[type]) {
 		if (ser->isSaving()) {
-			ptr = res.address[type][idx];
+			ptr = _res->address[type][idx];
 			if (ptr == NULL) {
 				ser->saveUint32(0);
 				return;
@@ -1329,7 +1329,7 @@
 		} else {
 			size = ser->loadUint32();
 			if (size) {
-				res.createResource(type, idx, size);
+				_res->createResource(type, idx, size);
 				ser->loadBytes(getResourceAddress(type, idx), size);
 				if (type == rtInventory) {
 					_inventory[idx] = ser->loadUint16();
@@ -1346,10 +1346,10 @@
 				}
 			}
 		}
-	} else if (res.mode[type] == 2 && ser->getVersion() >= VER(23)) {
+	} else if (_res->mode[type] == 2 && ser->getVersion() >= VER(23)) {
 		// Save/load only a list of resource numbers that need reloaded.
 		if (ser->isSaving()) {
-			ser->saveUint16(res.address[type][idx] ? 1 : 0);
+			ser->saveUint16(_res->address[type][idx] ? 1 : 0);
 		} else {
 			if (ser->loadUint16())
 				ensureResourceLoaded(type, idx);
@@ -1358,10 +1358,10 @@
 }
 
 void ScummEngine::saveResource(Serializer *ser, int type, int idx) {
-	assert(res.address[type][idx]);
+	assert(_res->address[type][idx]);
 
-	if (res.mode[type] == 0) {
-		byte *ptr = res.address[type][idx];
+	if (_res->mode[type] == 0) {
+		byte *ptr = _res->address[type][idx];
 		uint32 size = ((MemBlkHeader *)ptr)->size;
 
 		ser->saveUint32(size);
@@ -1381,12 +1381,12 @@
 		((type == rtSound && idx == 1) || (type == rtSpoolBuffer))) {
 		uint32 size = ser->loadUint32();
 		assert(size);
-		res.createResource(type, idx, size);
+		_res->createResource(type, idx, size);
 		ser->loadBytes(getResourceAddress(type, idx), size);
-	} else if (res.mode[type] == 0) {
+	} else if (_res->mode[type] == 0) {
 		uint32 size = ser->loadUint32();
 		assert(size);
-		res.createResource(type, idx, size);
+		_res->createResource(type, idx, size);
 		ser->loadBytes(getResourceAddress(type, idx), size);
 
 		if (type == rtInventory) {
@@ -1395,7 +1395,7 @@
 		if (type == rtObjectName) {
 			_newNames[idx] = ser->loadUint16();
 		}
-	} else if (res.mode[type] == 2) {
+	} else if (_res->mode[type] == 2) {
 		// HE Games use sound resource 1 for speech
 		if (_game.heversion >= 60 && idx == 1)
 			return;

Modified: scummvm/trunk/engines/scumm/script.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/script.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -371,7 +371,7 @@
 
 	for (i = 1; i < _numArray; i++) {
 		if (_arraySlot[i] == scriptSlot) {
-			res.nukeResource(rtString, i);
+			_res->nukeResource(rtString, i);
 			_arraySlot[i] = 0;
 		}
 	}
@@ -393,26 +393,26 @@
 				break;
 		_scriptOrgPointer = getResourceAddress(rtInventory, idx);
 		assert(idx < _numInventory);
-		_lastCodePtr = &res.address[rtInventory][idx];
+		_lastCodePtr = &_res->address[rtInventory][idx];
 		break;
 
 	case WIO_LOCAL:
 	case WIO_ROOM:								/* room script */
 		if (_game.version == 8) {
 			_scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource);
-			assert(_roomResource < res.num[rtRoomScripts]);
-			_lastCodePtr = &res.address[rtRoomScripts][_roomResource];
+			assert(_roomResource < _res->num[rtRoomScripts]);
+			_lastCodePtr = &_res->address[rtRoomScripts][_roomResource];
 		} else {
 			_scriptOrgPointer = getResourceAddress(rtRoom, _roomResource);
 			assert(_roomResource < _numRooms);
-			_lastCodePtr = &res.address[rtRoom][_roomResource];
+			_lastCodePtr = &_res->address[rtRoom][_roomResource];
 		}
 		break;
 
 	case WIO_GLOBAL:							/* global script */
 		_scriptOrgPointer = getResourceAddress(rtScript, ss->number);
 		assert(ss->number < _numScripts);
-		_lastCodePtr = &res.address[rtScript][ss->number];
+		_lastCodePtr = &_res->address[rtScript][ss->number];
 		break;
 
 	case WIO_FLOBJECT:						/* flobject script */
@@ -421,7 +421,7 @@
 		idx = _objs[idx].fl_object_index;
 		_scriptOrgPointer = getResourceAddress(rtFlObject, idx);
 		assert(idx < _numFlObject);
-		_lastCodePtr = &res.address[rtFlObject][idx];
+		_lastCodePtr = &_res->address[rtFlObject][idx];
 		break;
 	default:
 		error("Bad type while getting base address");
@@ -1024,7 +1024,7 @@
 						continue;
 
 					_newNames[i] = 0;
-					res.nukeResource(rtObjectName, i);
+					_res->nukeResource(rtObjectName, i);
 				}
 			}
 		}
@@ -1128,7 +1128,7 @@
 			// For now we assume that if there are more than 460 scripts, then
 			// the pair 29/104 is used, else the pair 28/103.
 			
-			if (res.num[rtScript] > 460) {
+			if (_res->num[rtScript] > 460) {
 				if (sentenceScript == 104)
 					sentenceScript = 29;
 			} else {

Modified: scummvm/trunk/engines/scumm/script_c64.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_c64.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/script_c64.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -594,12 +594,12 @@
 
 void ScummEngine_c64::o_lockSound() {
 	int resid = fetchScriptByte();
-	res.lock(rtSound, resid);
+	_res->lock(rtSound, resid);
 }
 
 void ScummEngine_c64::o_unlockSound() {
 	int resid = fetchScriptByte();
-	res.unlock(rtSound, resid);
+	_res->unlock(rtSound, resid);
 }
 
 void ScummEngine_c64::o_loadCostume() {
@@ -609,12 +609,12 @@
 
 void ScummEngine_c64::o_lockCostume() {
 	int resid = fetchScriptByte();
-	res.lock(rtCostume, resid);
+	_res->lock(rtCostume, resid);
 }
 
 void ScummEngine_c64::o_unlockCostume() {
 	int resid = fetchScriptByte();
-	res.unlock(rtCostume, resid);
+	_res->unlock(rtCostume, resid);
 }
 
 void ScummEngine_c64::o_loadScript() {
@@ -624,12 +624,12 @@
 
 void ScummEngine_c64::o_lockScript() {
 	int resid = fetchScriptByte();
-	res.lock(rtScript, resid);
+	_res->lock(rtScript, resid);
 }
 
 void ScummEngine_c64::o_unlockScript() {
 	int resid = fetchScriptByte();
-	res.unlock(rtScript, resid);
+	_res->unlock(rtScript, resid);
 }
 
 void ScummEngine_c64::o_loadRoom() {
@@ -670,12 +670,12 @@
 
 void ScummEngine_c64::o_lockRoom() {
 	int resid = fetchScriptByte();
-	res.lock(rtRoom, resid);
+	_res->lock(rtRoom, resid);
 }
 
 void ScummEngine_c64::o_unlockRoom() {
 	int resid = fetchScriptByte();
-	res.unlock(rtRoom, resid);
+	_res->unlock(rtRoom, resid);
 }
 
 void ScummEngine_c64::o_cursorCommand() {

Modified: scummvm/trunk/engines/scumm/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v2.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/script_v2.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -787,9 +787,9 @@
 		ensureResourceLoaded(type, resid);
 	} else {
 		if (opcode & 1)
-			res.lock(type, resid);
+			_res->lock(type, resid);
 		else
-			res.unlock(type, resid);
+			_res->unlock(type, resid);
 	}
 }
 

Modified: scummvm/trunk/engines/scumm/script_v5.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v5.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/script_v5.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -1690,7 +1690,7 @@
 				resid = _resourceMapper[resid & 0x7F];
 
 			if (_currentRoom != resid) {
-				res.setResourceCounter(rtRoom, resid, 1);
+				_res->setResourceCounter(rtRoom, resid, 1);
 			}
 		} else
 			ensureResourceLoaded(rtRoom, resid);
@@ -1703,40 +1703,40 @@
 		if (_game.id == GID_ZAK && (_game.platform == Common::kPlatformFMTowns))
 			error("o5_resourceRoutines %d should not occur in Zak256", op);
 		else
-			res.setResourceCounter(resType[op-5], resid, 0x7F);
+			_res->setResourceCounter(resType[op-5], resid, 0x7F);
 		break;
 	case 9:			// SO_LOCK_SCRIPT
 		if (resid >= _numGlobalScripts)
 			break;
-		res.lock(rtScript, resid);
+		_res->lock(rtScript, resid);
 		break;
 	case 10:		// SO_LOCK_SOUND
-		res.lock(rtSound, resid);
+		_res->lock(rtSound, resid);
 		break;
 	case 11:		// SO_LOCK_COSTUME
-		res.lock(rtCostume, resid);
+		_res->lock(rtCostume, resid);
 		break;
 	case 12:		// SO_LOCK_ROOM
 		if (resid > 0x7F)
 			resid = _resourceMapper[resid & 0x7F];
-		res.lock(rtRoom, resid);
+		_res->lock(rtRoom, resid);
 		break;
 
 	case 13:		// SO_UNLOCK_SCRIPT
 		if (resid >= _numGlobalScripts)
 			break;
-		res.unlock(rtScript, resid);
+		_res->unlock(rtScript, resid);
 		break;
 	case 14:		// SO_UNLOCK_SOUND
-		res.unlock(rtSound, resid);
+		_res->unlock(rtSound, resid);
 		break;
 	case 15:		// SO_UNLOCK_COSTUME
-		res.unlock(rtCostume, resid);
+		_res->unlock(rtCostume, resid);
 		break;
 	case 16:		// SO_UNLOCK_ROOM
 		if (resid > 0x7F)
 			resid = _resourceMapper[resid & 0x7F];
-		res.unlock(rtRoom, resid);
+		_res->unlock(rtRoom, resid);
 		break;
 
 	case 17:		// SO_CLEAR_HEAP
@@ -2286,7 +2286,7 @@
 	case 2:											/* copystring */
 		a = getVarOrDirectByte(PARAM_1);
 		b = getVarOrDirectByte(PARAM_2);
-		res.nukeResource(rtString, a);
+		_res->nukeResource(rtString, a);
 		ptr = getResourceAddress(rtString, b);
 		if (ptr)
 			loadPtrToResource(rtString, a, ptr);
@@ -2314,9 +2314,9 @@
 	case 5:											/* create empty string */
 		a = getVarOrDirectByte(PARAM_1);
 		b = getVarOrDirectByte(PARAM_2);
-		res.nukeResource(rtString, a);
+		_res->nukeResource(rtString, a);
 		if (b) {
-			ptr = res.createResource(rtString, a, b);
+			ptr = _res->createResource(rtString, a, b);
 			if (ptr) {
 				for (i = 0; i < b; i++)
 					ptr[i] = 0;
@@ -2359,7 +2359,7 @@
 		case 2:		// SO_VERB_NAME
 			loadPtrToResource(rtVerb, slot, NULL);
 			if (slot == 0)
-				res.nukeResource(rtVerb, slot);
+				_res->nukeResource(rtVerb, slot);
 			vs->type = kTextVerbType;
 			vs->imgindex = 0;
 			break;
@@ -2479,12 +2479,12 @@
 		case 20:	// SO_VERB_NAME_STR
 			ptr = getResourceAddress(rtString, getVarOrDirectWord(PARAM_1));
 			if (!ptr)
-				res.nukeResource(rtVerb, slot);
+				_res->nukeResource(rtVerb, slot);
 			else {
 				loadPtrToResource(rtVerb, slot, ptr);
 			}
 			if (slot == 0)
-				res.nukeResource(rtVerb, slot);
+				_res->nukeResource(rtVerb, slot);
 			vs->type = kTextVerbType;
 			vs->imgindex = 0;
 			break;

Modified: scummvm/trunk/engines/scumm/script_v6.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v6.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/script_v6.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -448,7 +448,7 @@
 	size *= dim2 + 1;
 	size *= dim1 + 1;
 
-	ah = (ArrayHeader *)res.createResource(rtString, id, size + sizeof(ArrayHeader));
+	ah = (ArrayHeader *)_res->createResource(rtString, id, size + sizeof(ArrayHeader));
 
 	ah->type = TO_LE_16(type);
 	ah->dim1 = TO_LE_16(dim1 + 1);
@@ -466,7 +466,7 @@
 		data &= ~0x33539000;
 
 	if (data)
-		res.nukeResource(rtString, data);
+		_res->nukeResource(rtString, data);
 	if (_game.heversion >= 60)
 		_arraySlot[data] = 0;
 
@@ -474,7 +474,7 @@
 }
 
 int ScummEngine_v6::findFreeArrayId() {
-	byte **addr = res.address[rtString];
+	byte **addr = _res->address[rtString];
 	int i;
 
 	for (i = 1; i < _numArray; i++) {
@@ -1566,59 +1566,59 @@
 		if (_game.version >= 7)
 			if (resid >= _numGlobalScripts)
 				break;
-		res.setResourceCounter(rtScript, resid, 0x7F);
+		_res->setResourceCounter(rtScript, resid, 0x7F);
 		break;
 	case 105:		// SO_NUKE_SOUND
 		resid = pop();
-		res.setResourceCounter(rtSound, resid, 0x7F);
+		_res->setResourceCounter(rtSound, resid, 0x7F);
 		break;
 	case 106:		// SO_NUKE_COSTUME
 		resid = pop();
-		res.setResourceCounter(rtCostume, resid, 0x7F);
+		_res->setResourceCounter(rtCostume, resid, 0x7F);
 		break;
 	case 107:		// SO_NUKE_ROOM
 		resid = pop();
-		res.setResourceCounter(rtRoom, resid, 0x7F);
+		_res->setResourceCounter(rtRoom, resid, 0x7F);
 		break;
 	case 108:		// SO_LOCK_SCRIPT
 		resid = pop();
 		if (resid >= _numGlobalScripts)
 			break;
-		res.lock(rtScript, resid);
+		_res->lock(rtScript, resid);
 		break;
 	case 109:		// SO_LOCK_SOUND
 		resid = pop();
-		res.lock(rtSound, resid);
+		_res->lock(rtSound, resid);
 		break;
 	case 110:		// SO_LOCK_COSTUME
 		resid = pop();
-		res.lock(rtCostume, resid);
+		_res->lock(rtCostume, resid);
 		break;
 	case 111:		// SO_LOCK_ROOM
 		resid = pop();
 		if (resid > 0x7F)
 			resid = _resourceMapper[resid & 0x7F];
-		res.lock(rtRoom, resid);
+		_res->lock(rtRoom, resid);
 		break;
 	case 112:		// SO_UNLOCK_SCRIPT
 		resid = pop();
 		if (resid >= _numGlobalScripts)
 			break;
-		res.unlock(rtScript, resid);
+		_res->unlock(rtScript, resid);
 		break;
 	case 113:		// SO_UNLOCK_SOUND
 		resid = pop();
-		res.unlock(rtSound, resid);
+		_res->unlock(rtSound, resid);
 		break;
 	case 114:		// SO_UNLOCK_COSTUME
 		resid = pop();
-		res.unlock(rtCostume, resid);
+		_res->unlock(rtCostume, resid);
 		break;
 	case 115:		// SO_UNLOCK_ROOM
 		resid = pop();
 		if (resid > 0x7F)
 			resid = _resourceMapper[resid & 0x7F];
-		res.unlock(rtRoom, resid);
+		_res->unlock(rtRoom, resid);
 		break;
 	case 116:		// SO_CLEAR_HEAP
 		/* this is actually a scumm message */
@@ -3035,7 +3035,7 @@
 		error("ScummEngine_v6::o6_setBoxSet: Can't find dboxes for set %d", arg);
 
 	dboxSize = READ_BE_UINT32(boxd + 4) - 8;
-	byte *matrix = res.createResource(rtMatrix, 2, dboxSize);
+	byte *matrix = _res->createResource(rtMatrix, 2, dboxSize);
 
 	assert(matrix);
 	memcpy(matrix, boxd + 8, dboxSize);
@@ -3048,7 +3048,7 @@
 		error("ScummEngine_v6::o6_setBoxSet: Can't find mboxes for set %d", arg);
 
 	mboxSize = READ_BE_UINT32(boxm + 4) - 8;
-	matrix = res.createResource(rtMatrix, 1, mboxSize);
+	matrix = _res->createResource(rtMatrix, 1, mboxSize);
 
 	assert(matrix);
 	memcpy(matrix, boxm + 8, mboxSize);

Modified: scummvm/trunk/engines/scumm/script_v8.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v8.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/script_v8.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -775,40 +775,40 @@
 		break;
 
 	case 0x42:		// SO_HEAP_LOCK_COSTUME Lock costume in heap
-		res.lock(rtCostume, resid);
+		_res->lock(rtCostume, resid);
 		break;
 	case 0x43:		// SO_HEAP_LOCK_ROOM Lock room in heap
-		res.lock(rtRoom, resid);
+		_res->lock(rtRoom, resid);
 		break;
 	case 0x44:		// SO_HEAP_LOCK_SCRIPT Lock script in heap
-		res.lock(rtScript, resid);
+		_res->lock(rtScript, resid);
 		break;
 	case 0x45:		// SO_HEAP_LOCK_SOUND Lock sound in heap
-		res.lock(rtSound, resid);
+		_res->lock(rtSound, resid);
 		break;
 	case 0x46:		// SO_HEAP_UNLOCK_COSTUME Unlock costume
-		res.unlock(rtCostume, resid);
+		_res->unlock(rtCostume, resid);
 		break;
 	case 0x47:		// SO_HEAP_UNLOCK_ROOM Unlock room
-		res.unlock(rtRoom, resid);
+		_res->unlock(rtRoom, resid);
 		break;
 	case 0x48:		// SO_HEAP_UNLOCK_SCRIPT Unlock script
-		res.unlock(rtScript, resid);
+		_res->unlock(rtScript, resid);
 		break;
 	case 0x49:		// SO_HEAP_UNLOCK_SOUND Unlock sound
-		res.unlock(rtSound, resid);
+		_res->unlock(rtSound, resid);
 		break;
 	case 0x4A:		// SO_HEAP_NUKE_COSTUME Remove costume from heap
-		res.setResourceCounter(rtCostume, resid, 0x7F);
+		_res->setResourceCounter(rtCostume, resid, 0x7F);
 		break;
 	case 0x4B:		// SO_HEAP_NUKE_ROOM Remove room from heap
-		res.setResourceCounter(rtRoom, resid, 0x7F);
+		_res->setResourceCounter(rtRoom, resid, 0x7F);
 		break;
 	case 0x4C:		// SO_HEAP_NUKE_SCRIPT Remove script from heap
-		res.setResourceCounter(rtScript, resid, 0x7F);
+		_res->setResourceCounter(rtScript, resid, 0x7F);
 		break;
 	case 0x4D:		// SO_HEAP_NUKE_SOUND Remove sound from heap
-		res.setResourceCounter(rtSound, resid, 0x7F);
+		_res->setResourceCounter(rtSound, resid, 0x7F);
 		break;
 	default:
 		error("o8_resourceRoutines: default case 0x%x", subOp);
@@ -1193,13 +1193,13 @@
 	case 11: {	// lockObject
 		int objidx = getObjectIndex(args[1]);
 		assert(objidx != -1);
-		res.lock(rtFlObject, _objs[objidx].fl_object_index);
+		_res->lock(rtFlObject, _objs[objidx].fl_object_index);
 		break;
 	}
 	case 12: {	// unlockObject
 		int objidx = getObjectIndex(args[1]);
 		assert(objidx != -1);
-		res.unlock(rtFlObject, _objs[objidx].fl_object_index);
+		_res->unlock(rtFlObject, _objs[objidx].fl_object_index);
 		break;
 	}
 	case 13:	// remapCostume

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -84,11 +84,10 @@
 	  _language(dr.language),
 	  _debugger(0),
 	  _currentScript(0xFF), // Let debug() work on init stage
-	  res(this),
 	  _pauseDialog(0), _mainMenuDialog(0), _versionDialog(0) {
 
 	_gdi = new Gdi(this);
-	//_res = new ResourceManager(this);
+	_res = new ResourceManager(this);
 
 	// Copy MD5 checksum
 	memcpy(_gameMD5, dr.md5sum, 16);
@@ -705,6 +704,7 @@
 
 	delete _debugger;
 	
+	delete _res;
 	delete _gdi;
 }
 
@@ -971,7 +971,7 @@
 	resetScummVars();
 
 	if (_imuse) {
-		_imuse->setBase(res.address[rtSound]);
+		_imuse->setBase(_res->address[rtSound]);
 	}
 
 	if (_game.version >= 5)
@@ -1027,7 +1027,7 @@
 		requestLoad(ConfMan.getInt("save_slot"));
 	}
 
-	res.allocResTypeData(rtBuffer, 0, 10, "buffer", 0);
+	_res->allocResTypeData(rtBuffer, 0, 10, "buffer", 0);
 
 	setupScummVars();
 
@@ -1079,7 +1079,7 @@
 		maxHeapThreshold = 550000;
 	}
 #endif
-	res.setHeapThreshold(400000, maxHeapThreshold);
+	_res->setHeapThreshold(400000, maxHeapThreshold);
 
 #if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
 	Graphics::initfonts();
@@ -1306,7 +1306,7 @@
 	// The boot script sets the characters of string 21, 
 	// before creating the string.resource.
 	if (_game.id == GID_LOOM) {
-		res.createResource(rtString, 21, 12);
+		_res->createResource(rtString, 21, 12);
 	}
 }
 
@@ -1766,7 +1766,7 @@
 
 	camera._last = camera._cur;
 
-	res.increaseExpireCounter();
+	_res->increaseExpireCounter();
 
 	animateCursor();
 
@@ -2013,7 +2013,7 @@
 	resetScummVars();
 
 	if (_imuse) {
-		_imuse->setBase(res.address[rtSound]);
+		_imuse->setBase(_res->address[rtSound]);
 	}
 
 	// Reinit sound engine

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-09-17 20:36:48 UTC (rev 23922)
@@ -446,7 +446,7 @@
 	Gdi *_gdi;
 
 	/** Central resource data. */
-	ResourceManager res;
+	ResourceManager *_res;
 
 	// Misc utility functions
 	uint32 _debugFlags;	// Used by the debugger

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/sound.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -689,7 +689,7 @@
 	if (isSoundInQueue(sound))
 		return 1;
 
-	if (sound > _vm->_numSounds || !_vm->res.isResourceLoaded(rtSound, sound))
+	if (sound > _vm->_numSounds || !_vm->_res->isResourceLoaded(rtSound, sound))
 		return 0;
 
 	if (_vm->_musicEngine)
@@ -722,7 +722,7 @@
 	if (isSoundInQueue(sound))
 		return true;
 
-	if (!_vm->res.isResourceLoaded(rtSound, sound))
+	if (!_vm->_res->isResourceLoaded(rtSound, sound))
 		return false;
 
 	if (_vm->_imuse)
@@ -1062,7 +1062,7 @@
 #pragma mark --- Sound resource handling ---
 #pragma mark -
 
-static void convertMac0Resource(ResourceManager &res, int type, int idx, byte *src_ptr, int size);
+static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *src_ptr, int size);
 
 
 /*
@@ -1094,7 +1094,7 @@
 	case MKID_BE('iMUS'):
 		if (_musicType != MDT_PCSPK) {
 			_fileHandle->seek(-8, SEEK_CUR);
-			_fileHandle->read(res.createResource(type, idx, total_size + 8), total_size + 8);
+			_fileHandle->read(_res->createResource(type, idx, total_size + 8), total_size + 8);
 			return 1;
 		}
 		break;
@@ -1157,7 +1157,7 @@
 
 		if (best_pri != -1) {
 			_fileHandle->seek(best_offs - 8, SEEK_SET);
-			ptr = res.createResource(type, idx, best_size);
+			ptr = _res->createResource(type, idx, best_size);
 			_fileHandle->read(ptr, best_size);
 			//dumpResource("sound-", idx, ptr);
 			return 1;
@@ -1169,7 +1169,7 @@
 		ptr = (byte *)calloc(total_size, 1);
 		_fileHandle->read(ptr, total_size);
 		//dumpResource("sound-", idx, ptr);
-		convertMac0Resource(res, type, idx, ptr, total_size);
+		convertMac0Resource(_res, type, idx, ptr, total_size);
 		free(ptr);
 		return 1;
 
@@ -1181,7 +1181,7 @@
 	case 0x460e200d:	// WORKAROUND bug # 1311447
 		_fileHandle->seek(-12, SEEK_CUR);
 		total_size = _fileHandle->readUint32BE();
-		ptr = res.createResource(type, idx, total_size);
+		ptr = _res->createResource(type, idx, total_size);
 		_fileHandle->read(ptr, total_size - 8);
 		//dumpResource("sound-", idx, ptr);
 		return 1;
@@ -1190,7 +1190,7 @@
 		// HE sound type without SOUN header
 		_fileHandle->seek(-16, SEEK_CUR);
 		total_size = max_total_size + 8;
-		ptr = res.createResource(type, idx, total_size);
+		ptr = _res->createResource(type, idx, total_size);
 		_fileHandle->read(ptr, total_size);
 		//dumpResource("sound-", idx, ptr);
 		return 1;
@@ -1220,14 +1220,14 @@
 		debugC(DEBUG_SOUND, "FMUS file %s", buffer);
 		if (dmuFile.open(buffer) == false) {
 			error("Can't open music file %s*", buffer);
-			res.roomoffs[type][idx] = 0xFFFFFFFF;
+			_res->roomoffs[type][idx] = 0xFFFFFFFF;
 			return 0;
 		}
 		dmuFile.seek(4, SEEK_SET);
 		total_size = dmuFile.readUint32BE();
 		debugC(DEBUG_SOUND, "dmu file size %d", total_size);
 		dmuFile.seek(-8, SEEK_CUR);
-		dmuFile.read(res.createResource(type, idx, total_size), total_size);
+		dmuFile.read(_res->createResource(type, idx, total_size), total_size);
 		dmuFile.close();
 		}
 		return 1;
@@ -1237,14 +1237,14 @@
 			_fileHandle->seek(-12, SEEK_CUR);
 			total_size = _fileHandle->readUint32BE();
 			_fileHandle->seek(-8, SEEK_CUR);
-			ptr = res.createResource(type, idx, total_size);
+			ptr = _res->createResource(type, idx, total_size);
 			_fileHandle->read(ptr, total_size);
 			//dumpResource("sound-", idx, ptr);
 			return 1;
 		}
 		error("Unrecognized base tag 0x%08x in sound %d", basetag, idx);
 	}
-	res.roomoffs[type][idx] = 0xFFFFFFFF;
+	_res->roomoffs[type][idx] = 0xFFFFFFFF;
 	return 0;
 }
 
@@ -1423,7 +1423,7 @@
 	}
 }
 
-static void convertMac0Resource(ResourceManager &res, int type, int idx, byte *src_ptr, int size) {
+static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *src_ptr, int size) {
 	/*
 	From Markus Magnuson (superqult) we got this information:
 	Mac0
@@ -1476,7 +1476,7 @@
 	*/
 
 #if 0
-	byte *ptr = res.createResource(type, idx, size);
+	byte *ptr = _res->createResource(type, idx, size);
 	memcpy(ptr, src_ptr, size);
 #else
 	const int ppqn = 480;
@@ -1518,7 +1518,7 @@
 	assert(*src_ptr == 0x09);
 
 	// Create sound resource
-	start_ptr = res.createResource(type, idx, total_size);
+	start_ptr = res->createResource(type, idx, total_size);
 
 	// Insert MIDI header
 	ptr = writeMIDIHeader(start_ptr, "GMD ", ppqn, total_size);
@@ -1614,7 +1614,7 @@
 #endif
 }
 
-static void convertADResource(ResourceManager &res, const GameSettings& game, int type, int idx, byte *src_ptr, int size) {
+static void convertADResource(ResourceManager *res, const GameSettings& game, int type, int idx, byte *src_ptr, int size) {
 
 	// We will ignore the PPQN in the original resource, because
 	// it's invalid anyway. We use a constant PPQN of 480.
@@ -1625,7 +1625,7 @@
 	int total_size = kMIDIHeaderSize + 7 + 8 * sizeof(ADLIB_INSTR_MIDI_HACK) + size;
 	total_size += 24;	// Up to 24 additional bytes are needed for the jump sysex
 
-	ptr = res.createResource(type, idx, total_size);
+	ptr = res->createResource(type, idx, total_size);
 
 	src_ptr += 2;
 	size -= 2;
@@ -2019,7 +2019,7 @@
 		_fileHandle->seek(ro_offs + 4, SEEK_SET);
 		_fileHandle->read(src_ptr, ro_size -4);
 
-		ptr = res.createResource(type, idx, ro_size + 2);
+		ptr = _res->createResource(type, idx, ro_size + 2);
 		memcpy(ptr, "RO", 2); ptr += 2;
 		memcpy(ptr, src_ptr, ro_size - 4); ptr += ro_size - 4;
 		return 1;
@@ -2091,24 +2091,24 @@
 		}
 		ptr = (byte *) calloc(ad_size, 1);
 		_fileHandle->read(ptr, ad_size);
-		convertADResource(res, _game, type, idx, ptr, ad_size);
+		convertADResource(_res, _game, type, idx, ptr, ad_size);
 		free(ptr);
 		return 1;
 	} else if ((_musicType == MDT_PCSPK) && wa_offs != 0) {
 		if (_game.features & GF_OLD_BUNDLE) {
 			_fileHandle->seek(wa_offs, SEEK_SET);
-			_fileHandle->read(res.createResource(type, idx, wa_size), wa_size);
+			_fileHandle->read(_res->createResource(type, idx, wa_size), wa_size);
 		} else {
 			_fileHandle->seek(wa_offs - 6, SEEK_SET);
-			_fileHandle->read(res.createResource(type, idx, wa_size + 6), wa_size + 6);
+			_fileHandle->read(_res->createResource(type, idx, wa_size + 6), wa_size + 6);
 		}
 		return 1;
 	} else if (ro_offs != 0) {
 		_fileHandle->seek(ro_offs - 2, SEEK_SET);
-		_fileHandle->read(res.createResource(type, idx, ro_size - 4), ro_size - 4);
+		_fileHandle->read(_res->createResource(type, idx, ro_size - 4), ro_size - 4);
 		return 1;
 	}
-	res.roomoffs[type][idx] = 0xFFFFFFFF;
+	_res->roomoffs[type][idx] = 0xFFFFFFFF;
 	return 0;
 }
 

Modified: scummvm/trunk/engines/scumm/string.cpp
===================================================================
--- scummvm/trunk/engines/scumm/string.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/string.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -1022,7 +1022,7 @@
 
 void ScummEngine::initCharset(int charsetno) {
 	if (_game.id == GID_FT) {
-		if (!res.isResourceLoaded(rtCharset, charsetno))
+		if (!_res->isResourceLoaded(rtCharset, charsetno))
 			loadCharset(charsetno);
 	} else {
 		if (!getResourceAddress(rtCharset, charsetno))

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2006-09-17 20:22:47 UTC (rev 23921)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2006-09-17 20:36:48 UTC (rev 23922)
@@ -882,7 +882,7 @@
 	vs->verbid = 0;
 	vs->curmode = 0;
 
-	res.nukeResource(rtVerb, slot);
+	_res->nukeResource(rtVerb, slot);
 
 	if (_game.version <= 6 && vs->saveid == 0) {
 		drawVerb(slot, 0);
@@ -910,7 +910,7 @@
 			if (_objs[i].obj_nr == object) {
 				findObjectInRoom(&foir, foImageHeader, object, room);
 				size = READ_LE_UINT16(foir.obim);
-				byte *ptr = res.createResource(rtVerb, verb, size + 2);
+				byte *ptr = _res->createResource(rtVerb, verb, size + 2);
 				obcdptr = getResourceAddress(rtRoom, room) + getOBCDOffs(object);
 				ptr[0] = *(obcdptr + 9);	// Width
 				ptr[1] = *(obcdptr + 15);	// Height
@@ -929,7 +929,7 @@
 				size = READ_LE_UINT32(foir.obim);
 				obcdptr = getResourceAddress(rtRoom, room) + getOBCDOffs(object);
 				size2 = READ_LE_UINT32(obcdptr);
-				res.createResource(rtVerb, verb, size + size2);
+				_res->createResource(rtVerb, verb, size + size2);
 				obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim;
 				obcdptr = getResourceAddress(rtRoom, room) + getOBCDOffs(object);
 				memcpy(getResourceAddress(rtVerb, verb), obimptr, size);
@@ -940,7 +940,7 @@
 	} else {
 		findObjectInRoom(&foir, foImageHeader, object, room);
 		size = READ_BE_UINT32(foir.obim + 4);
-		res.createResource(rtVerb, verb, size);
+		_res->createResource(rtVerb, verb, size);
 		obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim;
 		memcpy(getResourceAddress(rtVerb, verb), obimptr, size);
 	}


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