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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Dec 24 15:20:54 CET 2007


Revision: 29974
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29974&view=rev
Author:   fingolfin
Date:     2007-12-24 06:20:53 -0800 (Mon, 24 Dec 2007)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/resource.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/sound.cpp

Modified: scummvm/trunk/engines/scumm/resource.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource.cpp	2007-12-24 10:11:41 UTC (rev 29973)
+++ scummvm/trunk/engines/scumm/resource.cpp	2007-12-24 14:20:53 UTC (rev 29974)
@@ -632,7 +632,7 @@
 
 	if (type == rtCharset && (_game.features & GF_SMALL_HEADER)) {
 		loadCharset(idx);
-		return (1);
+		return 1;
 	}
 
 	roomNr = getResourceRoomNr(type, idx);
@@ -662,7 +662,7 @@
 
 	if (_game.features & GF_OLD_BUNDLE) {
 		if ((_game.version == 3) && !(_game.platform == Common::kPlatformAmiga) && (type == rtSound)) {
-			return readSoundResourceSmallHeader(type, idx);
+			return readSoundResourceSmallHeader(idx);
 		} else {
 			size = _fileHandle->readUint16LE();
 			_fileHandle->seek(-2, SEEK_CUR);
@@ -674,11 +674,11 @@
 		tag = _fileHandle->readUint16LE();
 		_fileHandle->seek(-6, SEEK_CUR);
 		if ((type == rtSound) && !(_game.platform == Common::kPlatformAmiga) && !(_game.platform == Common::kPlatformFMTowns)) {
-			return readSoundResourceSmallHeader(type, idx);
+			return readSoundResourceSmallHeader(idx);
 		}
 	} else {
 		if (type == rtSound) {
-			return readSoundResource(type, idx);
+			return readSoundResource(idx);
 		}
 
 		tag = _fileHandle->readUint32BE();

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2007-12-24 10:11:41 UTC (rev 29973)
+++ scummvm/trunk/engines/scumm/scumm.h	2007-12-24 14:20:53 UTC (rev 29974)
@@ -759,8 +759,8 @@
 	int getResourceRoomNr(int type, int index);
 
 protected:
-	int readSoundResource(int type, int index);
-	int readSoundResourceSmallHeader(int type, int index);
+	int readSoundResource(int index);
+	int readSoundResourceSmallHeader(int index);
 	bool isResourceInUse(int type, int i) const;
 
 	virtual void setupRoomSubBlocks();

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2007-12-24 10:11:41 UTC (rev 29973)
+++ scummvm/trunk/engines/scumm/sound.cpp	2007-12-24 14:20:53 UTC (rev 29974)
@@ -1072,7 +1072,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 idx, byte *src_ptr, int size);
 
 
 /*
@@ -1082,7 +1082,7 @@
  * could stand a thorough cleanup!
  */
 
-int ScummEngine::readSoundResource(int type, int idx) {
+int ScummEngine::readSoundResource(int idx) {
 	uint32 pos, total_size, size, tag, basetag, max_total_size;
 	int pri, best_pri;
 	uint32 best_size = 0, best_offs = 0;
@@ -1104,7 +1104,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(rtSound, idx, total_size + 8), total_size + 8);
 			return 1;
 		}
 		break;
@@ -1167,7 +1167,7 @@
 
 		if (best_pri != -1) {
 			_fileHandle->seek(best_offs - 8, SEEK_SET);
-			ptr = _res->createResource(type, idx, best_size);
+			ptr = _res->createResource(rtSound, idx, best_size);
 			_fileHandle->read(ptr, best_size);
 			//dumpResource("sound-", idx, ptr);
 			return 1;
@@ -1179,7 +1179,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, idx, ptr, total_size);
 		free(ptr);
 		return 1;
 
@@ -1191,7 +1191,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(rtSound, idx, total_size);
 		_fileHandle->read(ptr, total_size - 8);
 		//dumpResource("sound-", idx, ptr);
 		return 1;
@@ -1200,7 +1200,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(rtSound, idx, total_size);
 		_fileHandle->read(ptr, total_size);
 		//dumpResource("sound-", idx, ptr);
 		return 1;
@@ -1232,14 +1232,14 @@
 
 		if (!dmuFile.open(buffer)) {
 			error("Can't open music file %s", buffer);
-			_res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET;
+			_res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET;
 			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(rtSound, idx, total_size), total_size);
 		dmuFile.close();
 		}
 		return 1;
@@ -1249,14 +1249,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(rtSound, 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] = (uint32)RES_INVALID_OFFSET;
+	_res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET;
 	return 0;
 }
 
@@ -1435,7 +1435,7 @@
 	}
 }
 
-static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *src_ptr, int size) {
+static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, int size) {
 	/*
 	From Markus Magnuson (superqult) we got this information:
 	Mac0
@@ -1488,7 +1488,7 @@
 	*/
 
 #if 0
-	byte *ptr = _res->createResource(type, idx, size);
+	byte *ptr = _res->createResource(rtSound, idx, size);
 	memcpy(ptr, src_ptr, size);
 #else
 	const int ppqn = 480;
@@ -1530,7 +1530,7 @@
 	assert(*src_ptr == 0x09);
 
 	// Create sound resource
-	start_ptr = res->createResource(type, idx, total_size);
+	start_ptr = res->createResource(rtSound, idx, total_size);
 
 	// Insert MIDI header
 	ptr = writeMIDIHeader(start_ptr, "GMD ", ppqn, total_size);
@@ -1626,8 +1626,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 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.
 	const int ppqn = 480;
@@ -1637,7 +1636,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(rtSound, idx, total_size);
 
 	src_ptr += 2;
 	size -= 2;
@@ -2010,7 +2009,7 @@
 }
 
 
-int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
+int ScummEngine::readSoundResourceSmallHeader(int idx) {
 	uint32 pos, total_size, size, tag;
 	uint32 ad_size = 0, ad_offs = 0;
 	uint32 ro_size = 0, ro_offs = 0;
@@ -2029,7 +2028,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(rtSound, idx, ro_size + 2);
 		memcpy(ptr, "RO", 2); ptr += 2;
 		memcpy(ptr, src_ptr, ro_size - 4); ptr += ro_size - 4;
 		return 1;
@@ -2101,24 +2100,24 @@
 		}
 		ptr = (byte *) calloc(ad_size, 1);
 		_fileHandle->read(ptr, ad_size);
-		convertADResource(_res, _game, type, idx, ptr, ad_size);
+		convertADResource(_res, _game, 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(rtSound, 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(rtSound, 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(rtSound, idx, ro_size - 4), ro_size - 4);
 		return 1;
 	}
-	_res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET;
+	_res->roomoffs[rtSound][idx] = (uint32)RES_INVALID_OFFSET;
 	return 0;
 }
 


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