aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/resource.cpp
diff options
context:
space:
mode:
authorMax Horn2011-04-12 16:53:15 +0200
committerMax Horn2011-04-12 16:53:15 +0200
commit0ce2ca4e006a70d787481040fa844c85aac43222 (patch)
tree25fb61d7e7165ec2570ecf14a4af52e9bdb6b176 /engines/scumm/resource.cpp
parenta8b3501252c46c3fc4fd129fa0a945eb87f47d0a (diff)
downloadscummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.tar.gz
scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.tar.bz2
scummvm-rg350-0ce2ca4e006a70d787481040fa844c85aac43222.zip
COMMON: Replace MKID_BE by MKTAG
MKID_BE relied on unspecified behavior of the C++ compiler, and as such was always a bit unsafe. The new MKTAG macro is slightly less elegant, but does no longer depend on the behavior of the compiler. Inspired by FFmpeg, which has an almost identical macro.
Diffstat (limited to 'engines/scumm/resource.cpp')
-rw-r--r--engines/scumm/resource.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 5bc643a5d1..c872a83d14 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -259,26 +259,26 @@ void ScummEngine::readIndexFile() {
if (_fileHandle->eos() || _fileHandle->err())
break;
switch (blocktype) {
- case MKID_BE('DOBJ'):
+ case MKTAG('D','O','B','J'):
_numGlobalObjects = _fileHandle->readUint16LE();
itemsize -= 2;
break;
- case MKID_BE('DROO'):
+ case MKTAG('D','R','O','O'):
_numRooms = _fileHandle->readUint16LE();
itemsize -= 2;
break;
- case MKID_BE('DSCR'):
+ case MKTAG('D','S','C','R'):
_numScripts = _fileHandle->readUint16LE();
itemsize -= 2;
break;
- case MKID_BE('DCOS'):
+ case MKTAG('D','C','O','S'):
_numCostumes = _fileHandle->readUint16LE();
itemsize -= 2;
break;
- case MKID_BE('DSOU'):
+ case MKTAG('D','S','O','U'):
_numSounds = _fileHandle->readUint16LE();
itemsize -= 2;
break;
@@ -351,7 +351,7 @@ void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) {
int num;
char *ptr;
switch (blocktype) {
- case MKID_BE('ANAM'): // Used by: The Dig, FT
+ case MKTAG('A','N','A','M'): // Used by: The Dig, FT
debug(9, "found ANAM block, reading audio names");
num = _fileHandle->readUint16LE();
ptr = (char*)malloc(num * 9);
@@ -359,7 +359,7 @@ void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) {
_imuseDigital->setAudioNames(num, ptr);
break;
- case MKID_BE('DRSC'): // Used by: COMI
+ case MKTAG('D','R','S','C'): // Used by: COMI
readResTypeList(rtRoomScripts);
break;
@@ -372,37 +372,37 @@ void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) {
void ScummEngine_v70he::readIndexBlock(uint32 blocktype, uint32 itemsize) {
int i;
switch (blocktype) {
- case MKID_BE('DIRI'):
+ case MKTAG('D','I','R','I'):
readResTypeList(rtRoomImage);
break;
- case MKID_BE('DIRM'):
+ case MKTAG('D','I','R','M'):
readResTypeList(rtImage);
break;
- case MKID_BE('DIRT'):
+ case MKTAG('D','I','R','T'):
readResTypeList(rtTalkie);
break;
- case MKID_BE('DLFL'):
+ case MKTAG('D','L','F','L'):
i = _fileHandle->readUint16LE();
_fileHandle->seek(-2, SEEK_CUR);
_heV7RoomOffsets = (byte *)calloc(2 + (i * 4), 1);
_fileHandle->read(_heV7RoomOffsets, (2 + (i * 4)) );
break;
- case MKID_BE('DISK'):
+ case MKTAG('D','I','S','K'):
i = _fileHandle->readUint16LE();
_heV7DiskOffsets = (byte *)calloc(i, 1);
_fileHandle->read(_heV7DiskOffsets, i);
break;
- case MKID_BE('SVER'):
+ case MKTAG('S','V','E','R'):
// Index version number
_fileHandle->seek(itemsize - 8, SEEK_CUR);
break;
- case MKID_BE('INIB'):
+ case MKTAG('I','N','I','B'):
_fileHandle->seek(itemsize - 8, SEEK_CUR);
debug(2, "INIB index block not yet handled, skipping");
break;
@@ -415,17 +415,17 @@ void ScummEngine_v70he::readIndexBlock(uint32 blocktype, uint32 itemsize) {
void ScummEngine::readIndexBlock(uint32 blocktype, uint32 itemsize) {
int i;
switch (blocktype) {
- case MKID_BE('DCHR'):
- case MKID_BE('DIRF'):
+ case MKTAG('D','C','H','R'):
+ case MKTAG('D','I','R','F'):
readResTypeList(rtCharset);
break;
- case MKID_BE('DOBJ'):
+ case MKTAG('D','O','B','J'):
debug(9, "found DOBJ block, reading object table");
readGlobalObjects();
break;
- case MKID_BE('RNAM'):
+ case MKTAG('R','N','A','M'):
// Names of rooms. Maybe we should put them into a table, for use by the debugger?
if (_game.heversion >= 80) {
for (int room; (room = _fileHandle->readUint16LE()); ) {
@@ -449,32 +449,32 @@ void ScummEngine::readIndexBlock(uint32 blocktype, uint32 itemsize) {
}
break;
- case MKID_BE('DROO'):
- case MKID_BE('DIRR'):
+ case MKTAG('D','R','O','O'):
+ case MKTAG('D','I','R','R'):
readResTypeList(rtRoom);
break;
- case MKID_BE('DSCR'):
- case MKID_BE('DIRS'):
+ case MKTAG('D','S','C','R'):
+ case MKTAG('D','I','R','S'):
readResTypeList(rtScript);
break;
- case MKID_BE('DCOS'):
- case MKID_BE('DIRC'):
+ case MKTAG('D','C','O','S'):
+ case MKTAG('D','I','R','C'):
readResTypeList(rtCostume);
break;
- case MKID_BE('MAXS'):
+ case MKTAG('M','A','X','S'):
readMAXS(itemsize);
allocateArrays();
break;
- case MKID_BE('DIRN'):
- case MKID_BE('DSOU'):
+ case MKTAG('D','I','R','N'):
+ case MKTAG('D','S','O','U'):
readResTypeList(rtSound);
break;
- case MKID_BE('AARY'):
+ case MKTAG('A','A','R','Y'):
readArrayFromIndexFile();
break;
@@ -1287,14 +1287,14 @@ void ScummEngine::allocateArrays() {
_arraySlot = (byte *)calloc(_numArray, 1);
}
- _res->allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKID_BE('AKOS') : MKID_BE('COST'),
+ _res->allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKTAG('A','K','O','S') : MKTAG('C','O','S','T'),
_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(rtRoom, MKTAG('R','O','O','M'), _numRooms, "room", 1);
+ _res->allocResTypeData(rtRoomImage, MKTAG('R','M','I','M'), _numRooms, "room image", 1);
+ _res->allocResTypeData(rtRoomScripts, MKTAG('R','M','S','C'), _numRooms, "room script", 1);
+ _res->allocResTypeData(rtSound, MKTAG('S','O','U','N'), _numSounds, "sound", 2);
+ _res->allocResTypeData(rtScript, MKTAG('S','C','R','P'), _numScripts, "script", 1);
+ _res->allocResTypeData(rtCharset, MKTAG('C','H','A','R'), _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);
@@ -1304,8 +1304,8 @@ void ScummEngine::allocateArrays() {
_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(rtImage, MKTAG('A','W','I','Z'), _numImages, "images", 1);
+ _res->allocResTypeData(rtTalkie, MKTAG('T','L','K','E'), _numTalkies, "talkie", 1);
}
void ScummEngine_v70he::allocateArrays() {
@@ -1464,35 +1464,35 @@ const byte *findResourceSmall(uint32 tag, const byte *searchin) {
uint16 newTag2Old(uint32 newTag) {
switch (newTag) {
- case (MKID_BE('RMHD')):
+ case (MKTAG('R','M','H','D')):
return (0x4448); // HD
- case (MKID_BE('IM00')):
+ case (MKTAG('I','M','0','0')):
return (0x4D42); // BM
- case (MKID_BE('EXCD')):
+ case (MKTAG('E','X','C','D')):
return (0x5845); // EX
- case (MKID_BE('ENCD')):
+ case (MKTAG('E','N','C','D')):
return (0x4E45); // EN
- case (MKID_BE('SCAL')):
+ case (MKTAG('S','C','A','L')):
return (0x4153); // SA
- case (MKID_BE('LSCR')):
+ case (MKTAG('L','S','C','R')):
return (0x534C); // LS
- case (MKID_BE('OBCD')):
+ case (MKTAG('O','B','C','D')):
return (0x434F); // OC
- case (MKID_BE('OBIM')):
+ case (MKTAG('O','B','I','M')):
return (0x494F); // OI
- case (MKID_BE('SMAP')):
+ case (MKTAG('S','M','A','P')):
return (0x4D42); // BM
- case (MKID_BE('CLUT')):
+ case (MKTAG('C','L','U','T')):
return (0x4150); // PA
- case (MKID_BE('BOXD')):
+ case (MKTAG('B','O','X','D')):
return (0x5842); // BX
- case (MKID_BE('CYCL')):
+ case (MKTAG('C','Y','C','L')):
return (0x4343); // CC
- case (MKID_BE('EPAL')):
+ case (MKTAG('E','P','A','L')):
return (0x5053); // SP
- case (MKID_BE('TILE')):
+ case (MKTAG('T','I','L','E')):
return (0x4C54); // TL
- case (MKID_BE('ZP00')):
+ case (MKTAG('Z','P','0','0')):
return (0x505A); // ZP
default:
return (0);