From 138263ec035bc7a38fe49aa7296adfaa6d0bf6e1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 24 Dec 2007 14:20:53 +0000 Subject: cleanup svn-id: r29974 --- engines/scumm/resource.cpp | 8 ++++---- engines/scumm/scumm.h | 4 ++-- engines/scumm/sound.cpp | 47 +++++++++++++++++++++++----------------------- 3 files changed, 29 insertions(+), 30 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 4042ade9b4..698cdd61ed 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -632,7 +632,7 @@ int ScummEngine::loadResource(int type, int idx) { if (type == rtCharset && (_game.features & GF_SMALL_HEADER)) { loadCharset(idx); - return (1); + return 1; } roomNr = getResourceRoomNr(type, idx); @@ -662,7 +662,7 @@ int ScummEngine::loadResource(int type, int idx) { 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 @@ int ScummEngine::loadResource(int type, int idx) { 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(); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index f76a7c05e7..8fb5914435 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -759,8 +759,8 @@ public: 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(); diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 6e68c8405f..ed67829cdd 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -1072,7 +1072,7 @@ void Sound::saveLoadWithSerializer(Serializer *ser) { #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 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s * 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 @@ int ScummEngine::readSoundResource(int type, int idx) { 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 @@ int ScummEngine::readSoundResource(int type, int idx) { 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 @@ int ScummEngine::readSoundResource(int type, int idx) { 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 @@ int ScummEngine::readSoundResource(int type, int idx) { 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 @@ int ScummEngine::readSoundResource(int type, int idx) { // 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 @@ int ScummEngine::readSoundResource(int type, int idx) { 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 @@ int ScummEngine::readSoundResource(int type, int idx) { _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 byte Mac0ToGMInstrument(uint32 type, int &transpose) { } } -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 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s */ #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 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s 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 @@ static void convertMac0Resource(ResourceManager *res, int type, int idx, byte *s #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 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in 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 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in } -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 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { _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 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { } 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; } -- cgit v1.2.3