aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
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/he
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/he')
-rw-r--r--engines/scumm/he/animation_he.cpp2
-rw-r--r--engines/scumm/he/cup_player_he.cpp40
-rw-r--r--engines/scumm/he/floodfill_he.cpp4
-rw-r--r--engines/scumm/he/palette_he.cpp6
-rw-r--r--engines/scumm/he/resource_he.cpp6
-rw-r--r--engines/scumm/he/script_v100he.cpp2
-rw-r--r--engines/scumm/he/script_v71he.cpp8
-rw-r--r--engines/scumm/he/script_v72he.cpp2
-rw-r--r--engines/scumm/he/sound_he.cpp38
-rw-r--r--engines/scumm/he/wiz_he.cpp74
10 files changed, 91 insertions, 91 deletions
diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp
index 7840b9df20..e3e25c161c 100644
--- a/engines/scumm/he/animation_he.cpp
+++ b/engines/scumm/he/animation_he.cpp
@@ -112,7 +112,7 @@ void MoviePlayer::handleNextFrame() {
if (_flags & 2) {
uint8 *dstPtr = _vm->getResourceAddress(rtImage, _wizResNum);
assert(dstPtr);
- uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
+ uint8 *dst = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dstPtr, 0, 0);
assert(dst);
copyFrameToBuffer(dst, kDstResource, 0, 0, _vm->_screenWidth * _vm->_bytesPerPixel);
} else if (_flags & 1) {
diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp
index 79bb47aafc..a16af73135 100644
--- a/engines/scumm/he/cup_player_he.cpp
+++ b/engines/scumm/he/cup_player_he.cpp
@@ -47,7 +47,7 @@ bool CUP_Player::open(const char *filename) {
if (_fileStream.open(filename)) {
uint32 tag = _fileStream.readUint32BE();
_fileStream.readUint32BE();
- if (tag == MKID_BE('BEAN')) {
+ if (tag == MKTAG('B','E','A','N')) {
_playbackRate = kDefaultPlaybackRate;
_width = kDefaultVideoWidth;
_height = kDefaultVideoHeight;
@@ -168,7 +168,7 @@ void CUP_Player::updateSfx() {
assert(sfxIndex >= 0 && sfxIndex < _sfxCount);
uint32 offset = READ_LE_UINT32(_sfxBuffer + sfxIndex * 4) - 8;
uint8 *soundData = _sfxBuffer + offset;
- if (READ_BE_UINT32(soundData) == MKID_BE('DATA')) {
+ if (READ_BE_UINT32(soundData) == MKTAG('D','A','T','A')) {
uint32 soundSize = READ_BE_UINT32(soundData + 4);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &sfxChannel->handle,
Audio::makeLoopingAudioStream(
@@ -208,19 +208,19 @@ bool CUP_Player::parseNextHeaderTag(Common::SeekableReadStream &dataStream) {
uint32 next = dataStream.pos() + size;
debug(1, "New header tag %s %d dataSize %d", tag2str(tag), size, _dataSize);
switch (tag) {
- case MKID_BE('HEAD'):
+ case MKTAG('H','E','A','D'):
handleHEAD(dataStream, size);
break;
- case MKID_BE('SFXB'):
+ case MKTAG('S','F','X','B'):
handleSFXB(dataStream, size);
break;
- case MKID_BE('RGBS'):
+ case MKTAG('R','G','B','S'):
handleRGBS(dataStream, size);
break;
- case MKID_BE('DATA'):
+ case MKTAG('D','A','T','A'):
_dataSize = size;
return false;
- case MKID_BE('GFXB'):
+ case MKTAG('G','F','X','B'):
// this is never triggered
default:
warning("Unhandled tag %s", tag2str(tag));
@@ -236,34 +236,34 @@ bool CUP_Player::parseNextBlockTag(Common::SeekableReadStream &dataStream) {
uint32 next = dataStream.pos() + size;
debug(1, "New block tag %s %d dataSize %d", tag2str(tag), size, _dataSize);
switch (tag) {
- case MKID_BE('FRAM'):
+ case MKTAG('F','R','A','M'):
handleFRAM(dataStream, size);
break;
- case MKID_BE('LZSS'):
+ case MKTAG('L','Z','S','S'):
if (handleLZSS(dataStream, size) && _outLzssBufSize != 0) {
Common::MemoryReadStream memoryStream(_outLzssBufData, _outLzssBufSize);
parseNextBlockTag(memoryStream);
}
break;
- case MKID_BE('RATE'):
+ case MKTAG('R','A','T','E'):
handleRATE(dataStream, size);
break;
- case MKID_BE('RGBS'):
+ case MKTAG('R','G','B','S'):
handleRGBS(dataStream, size);
break;
- case MKID_BE('SNDE'):
+ case MKTAG('S','N','D','E'):
handleSNDE(dataStream, size);
break;
- case MKID_BE('TOIL'):
+ case MKTAG('T','O','I','L'):
handleTOIL(dataStream, size);
break;
- case MKID_BE('SRLE'):
+ case MKTAG('S','R','L','E'):
handleSRLE(dataStream, size);
break;
- case MKID_BE('BLOK'):
+ case MKTAG('B','L','O','K'):
_dataSize -= size + 8;
return false;
- case MKID_BE('WRLE'):
+ case MKTAG('W','R','L','E'):
// this is never triggered
default:
warning("Unhandled tag %s", tag2str(tag));
@@ -283,10 +283,10 @@ void CUP_Player::handleSFXB(Common::SeekableReadStream &dataStream, uint32 dataS
if (dataSize > 16) { // WRAP and OFFS chunks
uint32 tag = dataStream.readUint32BE();
uint32 size = dataStream.readUint32BE();
- if (tag == MKID_BE('WRAP')) {
+ if (tag == MKTAG('W','R','A','P')) {
tag = dataStream.readUint32BE();
size = dataStream.readUint32BE();
- if (tag == MKID_BE('OFFS')) {
+ if (tag == MKTAG('O','F','F','S')) {
_sfxCount = (size - 8) / 4;
_sfxBuffer = (uint8 *)malloc(dataSize - 16);
if (_sfxBuffer) {
@@ -439,12 +439,12 @@ static void decodeLZSS(uint8 *dst, const uint8 *src1, const uint8 *src2, const u
bool CUP_Player::handleLZSS(Common::SeekableReadStream &dataStream, uint32 dataSize) {
uint32 tag = dataStream.readUint32BE();
uint32 size = dataStream.readUint32BE();
- if (tag == MKID_BE('LZHD')) {
+ if (tag == MKTAG('L','Z','H','D')) {
uint32 compressionType = dataStream.readUint32LE();
uint32 compressionSize = dataStream.readUint32LE();
tag = dataStream.readUint32BE();
size = dataStream.readUint32BE();
- if (tag == MKID_BE('DATA') && compressionType == 0x2000) {
+ if (tag == MKTAG('D','A','T','A') && compressionType == 0x2000) {
if (_inLzssBufSize < size - 16) {
free(_inLzssBufData);
_inLzssBufSize = size - 16;
diff --git a/engines/scumm/he/floodfill_he.cpp b/engines/scumm/he/floodfill_he.cpp
index 491b91c17e..026a848828 100644
--- a/engines/scumm/he/floodfill_he.cpp
+++ b/engines/scumm/he/floodfill_he.cpp
@@ -240,7 +240,7 @@ void Wiz::fillWizFlood(const WizParameters *params) {
if (params->processFlags & kWPFNewState) {
state = params->img.state;
}
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
@@ -258,7 +258,7 @@ void Wiz::fillWizFlood(const WizParameters *params) {
color = params->fillColor;
}
if (imageRect.contains(px, py)) {
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(wizd);
FloodFillState *ffs = new FloodFillState;
diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp
index b42d6e97e2..7f517c56ed 100644
--- a/engines/scumm/he/palette_he.cpp
+++ b/engines/scumm/he/palette_he.cpp
@@ -192,7 +192,7 @@ void ScummEngine_v90he::setHEPaletteFromCostume(int palSlot, int resId) {
assertRange(1, palSlot, _numPalettes, "palette");
const uint8 *data = getResourceAddress(rtCostume, resId);
assert(data);
- const uint8 *rgbs = findResourceData(MKID_BE('RGBS'), data);
+ const uint8 *rgbs = findResourceData(MKTAG('R','G','B','S'), data);
assert(rgbs);
setHEPaletteFromPtr(palSlot, rgbs);
}
@@ -202,7 +202,7 @@ void ScummEngine_v90he::setHEPaletteFromImage(int palSlot, int resId, int state)
assertRange(1, palSlot, _numPalettes, "palette");
uint8 *data = getResourceAddress(rtImage, resId);
assert(data);
- const uint8 *rgbs = findWrappedBlock(MKID_BE('RGBS'), data, state, 0);
+ const uint8 *rgbs = findWrappedBlock(MKTAG('R','G','B','S'), data, state, 0);
if (rgbs)
setHEPaletteFromPtr(palSlot, rgbs);
}
@@ -212,7 +212,7 @@ void ScummEngine_v90he::setHEPaletteFromRoom(int palSlot, int resId, int state)
assertRange(1, palSlot, _numPalettes, "palette");
const uint8 *data = getResourceAddress(rtRoom, resId);
assert(data);
- const uint8 *pals = findResourceData(MKID_BE('PALS'), data);
+ const uint8 *pals = findResourceData(MKTAG('P','A','L','S'), data);
assert(pals);
const uint8 *rgbs = findPalInPals(pals, state);
assert(rgbs);
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 9349e70eb9..ecb094f29b 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -332,7 +332,7 @@ int ScummEngine_v72he::getSoundResourceSize(int id) {
if (!ptr)
return 0;
- if (READ_BE_UINT32(ptr) == MKID_BE('RIFF')) {
+ if (READ_BE_UINT32(ptr) == MKTAG('R','I','F','F')) {
byte flags;
int rate;
@@ -344,11 +344,11 @@ int ScummEngine_v72he::getSoundResourceSize(int id) {
}
} else {
ptr += 8 + READ_BE_UINT32(ptr + 12);
- if (READ_BE_UINT32(ptr) == MKID_BE('SBNG')) {
+ if (READ_BE_UINT32(ptr) == MKTAG('S','B','N','G')) {
ptr += READ_BE_UINT32(ptr + 4);
}
- assert(READ_BE_UINT32(ptr) == MKID_BE('SDAT'));
+ assert(READ_BE_UINT32(ptr) == MKTAG('S','D','A','T'));
size = READ_BE_UINT32(ptr + 4) - 8;
}
}
diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp
index ca4a65ac74..69063a1837 100644
--- a/engines/scumm/he/script_v100he.cpp
+++ b/engines/scumm/he/script_v100he.cpp
@@ -2999,7 +2999,7 @@ void ScummEngine_v100he::decodeParseString(int m, int n) {
case 78:
{
byte *dataPtr = getResourceAddress(rtTalkie, pop());
- byte *text = findWrappedBlock(MKID_BE('TEXT'), dataPtr, 0, 0);
+ byte *text = findWrappedBlock(MKTAG('T','E','X','T'), dataPtr, 0, 0);
size = getResourceDataSize(text);
memcpy(name, text, size);
printString(m, name);
diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp
index 46a8868949..a800a7d85c 100644
--- a/engines/scumm/he/script_v71he.cpp
+++ b/engines/scumm/he/script_v71he.cpp
@@ -88,15 +88,15 @@ byte *ScummEngine_v71he::heFindResource(uint32 tag, byte *searchin) {
}
byte *ScummEngine_v71he::findWrappedBlock(uint32 tag, byte *ptr, int state, bool errorFlag) {
- if (READ_BE_UINT32(ptr) == MKID_BE('MULT')) {
+ if (READ_BE_UINT32(ptr) == MKTAG('M','U','L','T')) {
byte *offs, *wrap;
uint32 size;
- wrap = heFindResource(MKID_BE('WRAP'), ptr);
+ wrap = heFindResource(MKTAG('W','R','A','P'), ptr);
if (wrap == NULL)
return NULL;
- offs = heFindResourceData(MKID_BE('OFFS'), wrap);
+ offs = heFindResourceData(MKTAG('O','F','F','S'), wrap);
if (offs == NULL)
return NULL;
@@ -109,7 +109,7 @@ byte *ScummEngine_v71he::findWrappedBlock(uint32 tag, byte *ptr, int state, bool
if (offs)
return offs;
- offs = heFindResourceData(MKID_BE('DEFA'), ptr);
+ offs = heFindResourceData(MKTAG('D','E','F','A'), ptr);
if (offs == NULL)
return NULL;
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index 8aaf16e81b..17bd29d826 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -2039,7 +2039,7 @@ void ScummEngine_v72he::decodeParseString(int m, int n) {
case 0xE1:
{
byte *dataPtr = getResourceAddress(rtTalkie, pop());
- byte *text = findWrappedBlock(MKID_BE('TEXT'), dataPtr, 0, 0);
+ byte *text = findWrappedBlock(MKTAG('T','E','X','T'), dataPtr, 0, 0);
size = getResourceDataSize(text);
memcpy(name, text, size);
printString(m, name);
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 4770f28cbc..4fd7caebf5 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -499,11 +499,11 @@ byte *findSoundTag(uint32 tag, byte *ptr) {
byte *endPtr;
uint32 offset, size;
- if (READ_BE_UINT32(ptr) == MKID_BE('WSOU')) {
+ if (READ_BE_UINT32(ptr) == MKTAG('W','S','O','U')) {
ptr += 8;
}
- if (READ_BE_UINT32(ptr) != MKID_BE('RIFF'))
+ if (READ_BE_UINT32(ptr) != MKTAG('R','I','F','F'))
return NULL;
endPtr = (ptr + 12);
@@ -591,14 +591,14 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
}
// Support for sound in later HE games
- if (READ_BE_UINT32(ptr) == MKID_BE('RIFF') || READ_BE_UINT32(ptr) == MKID_BE('WSOU')) {
+ if (READ_BE_UINT32(ptr) == MKTAG('R','I','F','F') || READ_BE_UINT32(ptr) == MKTAG('W','S','O','U')) {
uint16 compType;
int blockAlign;
int codeOffs = -1;
priority = (soundID > _vm->_numSounds) ? 255 : *(ptr + 18);
- byte *sbngPtr = findSoundTag(MKID_BE('SBNG'), ptr);
+ byte *sbngPtr = findSoundTag(MKTAG('S','B','N','G'), ptr);
if (sbngPtr != NULL) {
codeOffs = sbngPtr - ptr + 8;
}
@@ -611,7 +611,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
return;
}
- if (READ_BE_UINT32(ptr) == MKID_BE('WSOU'))
+ if (READ_BE_UINT32(ptr) == MKTAG('W','S','O','U'))
ptr += 8;
size = READ_LE_UINT32(ptr + 4);
@@ -675,7 +675,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
Audio::makeLoopingAudioStream(stream, (heFlags & 1) ? 0 : 1), soundID);
}
// Support for sound in Humongous Entertainment games
- else if (READ_BE_UINT32(ptr) == MKID_BE('DIGI') || READ_BE_UINT32(ptr) == MKID_BE('TALK')) {
+ else if (READ_BE_UINT32(ptr) == MKTAG('D','I','G','I') || READ_BE_UINT32(ptr) == MKTAG('T','A','L','K')) {
byte *sndPtr = ptr;
int codeOffs = -1;
@@ -693,12 +693,12 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
return;
}
- if (READ_BE_UINT32(ptr) == MKID_BE('SBNG')) {
+ if (READ_BE_UINT32(ptr) == MKTAG('S','B','N','G')) {
codeOffs = ptr - sndPtr + 8;
ptr += READ_BE_UINT32(ptr + 4);
}
- assert(READ_BE_UINT32(ptr) == MKID_BE('SDAT'));
+ assert(READ_BE_UINT32(ptr) == MKTAG('S','D','A','T'));
size = READ_BE_UINT32(ptr + 4) - 8;
if (heOffset < 0 || heOffset > size) {
// Occurs when making fireworks in puttmoon
@@ -734,14 +734,14 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
Audio::makeLoopingAudioStream(stream, (heFlags & 1) ? 0 : 1), soundID);
}
// Support for PCM music in 3DO versions of Humongous Entertainment games
- else if (READ_BE_UINT32(ptr) == MKID_BE('MRAW')) {
+ else if (READ_BE_UINT32(ptr) == MKTAG('M','R','A','W')) {
priority = *(ptr + 18);
rate = READ_LE_UINT16(ptr + 22);
// Skip DIGI (8) and HSHD (24) blocks
ptr += 32;
- assert(READ_BE_UINT32(ptr) == MKID_BE('SDAT'));
+ assert(READ_BE_UINT32(ptr) == MKTAG('S','D','A','T'));
size = READ_BE_UINT32(ptr + 4) - 8;
byte *sound = (byte *)malloc(size);
@@ -753,7 +753,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
stream = Audio::makeRawStream(sound, size, rate, 0);
_mixer->playStream(Audio::Mixer::kMusicSoundType, NULL, stream, soundID);
}
- else if (READ_BE_UINT32(ptr) == MKID_BE('MIDI')) {
+ else if (READ_BE_UINT32(ptr) == MKTAG('M','I','D','I')) {
if (_vm->_imuse) {
// This is used in the DOS version of Fatty Bear's
// Birthday Surprise to change the note on the piano
@@ -833,9 +833,9 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
chan = i;
}
- if (!findSoundTag(MKID_BE('data'), snd1Ptr)) {
- sbng1Ptr = heFindResource(MKID_BE('SBNG'), snd1Ptr);
- sbng2Ptr = heFindResource(MKID_BE('SBNG'), snd2Ptr);
+ if (!findSoundTag(MKTAG('d','a','t','a'), snd1Ptr)) {
+ sbng1Ptr = heFindResource(MKTAG('S','B','N','G'), snd1Ptr);
+ sbng2Ptr = heFindResource(MKTAG('S','B','N','G'), snd2Ptr);
}
if (sbng1Ptr != NULL && sbng2Ptr != NULL) {
@@ -879,10 +879,10 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
}
}
- if (findSoundTag(MKID_BE('data'), snd1Ptr)) {
- sdat1Ptr = findSoundTag(MKID_BE('data'), snd1Ptr);
+ if (findSoundTag(MKTAG('d','a','t','a'), snd1Ptr)) {
+ sdat1Ptr = findSoundTag(MKTAG('d','a','t','a'), snd1Ptr);
assert(sdat1Ptr);
- sdat2Ptr = findSoundTag(MKID_BE('data'), snd2Ptr);
+ sdat2Ptr = findSoundTag(MKTAG('d','a','t','a'), snd2Ptr);
assert(sdat2Ptr);
if (!_sndDataSize)
@@ -890,9 +890,9 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
sdat2size = READ_LE_UINT32(sdat2Ptr + 4) - 8;
} else {
- sdat1Ptr = heFindResource(MKID_BE('SDAT'), snd1Ptr);
+ sdat1Ptr = heFindResource(MKTAG('S','D','A','T'), snd1Ptr);
assert(sdat1Ptr);
- sdat2Ptr = heFindResource(MKID_BE('SDAT'), snd2Ptr);
+ sdat2Ptr = heFindResource(MKTAG('S','D','A','T'), snd2Ptr);
assert(sdat2Ptr);
_sndDataSize = READ_BE_UINT32(sdat1Ptr + 4) - 8;
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 3d1aa5b048..16cbadd65b 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1445,21 +1445,21 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
if (shadow) {
dataPtr = _vm->getResourceAddress(rtImage, shadow);
assert(dataPtr);
- xmapPtr = _vm->findResourceData(MKID_BE('XMAP'), dataPtr);
+ xmapPtr = _vm->findResourceData(MKTAG('X','M','A','P'), dataPtr);
assert(xmapPtr);
}
dataPtr = _vm->getResourceAddress(rtImage, resNum);
assert(dataPtr);
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
uint32 comp = READ_LE_UINT32(wizh + 0x0);
uint32 width = READ_LE_UINT32(wizh + 0x4);
uint32 height = READ_LE_UINT32(wizh + 0x8);
debug(3, "wiz_header.comp = %d wiz_header.w = %d wiz_header.h = %d", comp, width, height);
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(wizd);
uint8 *mask = NULL;
@@ -1467,28 +1467,28 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
uint8 *maskPtr = _vm->getResourceAddress(rtImage, maskNum);
assert(maskPtr);
- wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), maskPtr, maskState, 0);
+ wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), maskPtr, maskState, 0);
assert(wizh);
assert(comp == 2 && READ_LE_UINT32(wizh + 0x0) == 1);
width = READ_LE_UINT32(wizh + 0x4);
height = READ_LE_UINT32(wizh + 0x8);
- mask = _vm->findWrappedBlock(MKID_BE('WIZD'), maskPtr, maskState, 0);
+ mask = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), maskPtr, maskState, 0);
assert(mask);
}
if (flags & kWIFHasPalette) {
- uint8 *pal = _vm->findWrappedBlock(MKID_BE('RGBS'), dataPtr, state, 0);
+ uint8 *pal = _vm->findWrappedBlock(MKTAG('R','G','B','S'), dataPtr, state, 0);
assert(pal);
_vm->setPaletteFromPtr(pal, 256);
}
uint8 *rmap = NULL;
if (flags & kWIFRemapPalette) {
- rmap = _vm->findWrappedBlock(MKID_BE('RMAP'), dataPtr, state, 0);
+ rmap = _vm->findWrappedBlock(MKTAG('R','M','A','P'), dataPtr, state, 0);
assert(rmap);
if (_vm->_game.heversion <= 80 || READ_BE_UINT32(rmap) != 0x01234567) {
- uint8 *rgbs = _vm->findWrappedBlock(MKID_BE('RGBS'), dataPtr, state, 0);
+ uint8 *rgbs = _vm->findWrappedBlock(MKTAG('R','G','B','S'), dataPtr, state, 0);
assert(rgbs);
_vm->remapHEPalette(rgbs, rmap + 4);
}
@@ -1526,7 +1526,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
if (dstResNum) {
uint8 *dstPtr = _vm->getResourceAddress(rtImage, dstResNum);
assert(dstPtr);
- dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
+ dst = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dstPtr, 0, 0);
assert(dst);
getWizImageDim(dstResNum, 0, cw, ch);
dstPitch = cw * _vm->_bytesPerPixel;
@@ -1567,7 +1567,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
int transColor = -1;
if (_vm->VAR_WIZ_TCOLOR != 0xFF) {
- uint8 *trns = _vm->findWrappedBlock(MKID_BE('TRNS'), dataPtr, state, 0);
+ uint8 *trns = _vm->findWrappedBlock(MKTAG('T','R','N','S'), dataPtr, state, 0);
transColor = (trns == NULL) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : -1;
}
@@ -1817,7 +1817,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int
assert(_vm->_bytesPerPixel == 1);
uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
assert(dataPtr);
- srcWizBuf = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ srcWizBuf = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(srcWizBuf);
freeBuffer = false;
}
@@ -1827,7 +1827,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int
} else {
uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
assert(dataPtr);
- srcWizBuf = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ srcWizBuf = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(srcWizBuf);
freeBuffer = false;
}
@@ -1842,7 +1842,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int
if (dstResNum) {
uint8 *dstPtr = _vm->getResourceAddress(rtImage, dstResNum);
assert(dstPtr);
- dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
+ dst = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dstPtr, 0, 0);
assert(dst);
getWizImageDim(dstResNum, 0, dstw, dsth);
dstpitch = dstw * _vm->_bytesPerPixel;
@@ -2185,7 +2185,7 @@ void Wiz::fillWizRect(const WizParameters *params) {
}
uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum);
if (dataPtr) {
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
@@ -2210,7 +2210,7 @@ void Wiz::fillWizRect(const WizParameters *params) {
}
if (areaRect.intersects(imageRect)) {
areaRect.clip(imageRect);
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(wizd);
int dx = areaRect.width();
int dy = areaRect.height();
@@ -2256,7 +2256,7 @@ void Wiz::fillWizLine(const WizParameters *params) {
}
uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum);
if (dataPtr) {
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
@@ -2274,7 +2274,7 @@ void Wiz::fillWizLine(const WizParameters *params) {
if (params->processFlags & kWPFFillColor) {
color = params->fillColor;
}
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(wizd);
int x1 = params->box2.left;
int y1 = params->box2.top;
@@ -2309,7 +2309,7 @@ void Wiz::fillWizPixel(const WizParameters *params) {
if (params->processFlags & kWPFNewState) {
state = params->img.state;
}
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
@@ -2327,7 +2327,7 @@ void Wiz::fillWizPixel(const WizParameters *params) {
color = params->fillColor;
}
if (imageRect.contains(px, py)) {
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), dataPtr, state, 0);
assert(wizd);
*(wizd + py * w + px) = color;
}
@@ -2342,7 +2342,7 @@ void Wiz::remapWizImagePal(const WizParameters *params) {
const uint8 *index = params->remapIndex;
uint8 *iwiz = _vm->getResourceAddress(rtImage, params->img.resNum);
assert(iwiz);
- uint8 *rmap = _vm->findWrappedBlock(MKID_BE('RMAP'), iwiz, st, 0);
+ uint8 *rmap = _vm->findWrappedBlock(MKTAG('R','M','A','P'), iwiz, st, 0);
assert(rmap);
WRITE_BE_UINT32(rmap, 0x01234567);
while (num--) {
@@ -2380,7 +2380,7 @@ void Wiz::processWizImage(const WizParameters *params) {
if (f) {
uint32 id = f->readUint32BE();
- if (id == MKID_BE('AWIZ') || id == MKID_BE('MULT')) {
+ if (id == MKTAG('A','W','I','Z') || id == MKTAG('M','U','L','T')) {
uint32 size = f->readUint32BE();
f->seek(0, SEEK_SET);
byte *p = _vm->_res->createResource(rtImage, params->img.resNum, size);
@@ -2510,7 +2510,7 @@ void Wiz::processWizImage(const WizParameters *params) {
void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
assert(dataPtr);
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
w = READ_LE_UINT32(wizh + 0x4);
h = READ_LE_UINT32(wizh + 0x8);
@@ -2519,7 +2519,7 @@ void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
void Wiz::getWizImageSpot(int resId, int state, int32 &x, int32 &y) {
uint8 *dataPtr = _vm->getResourceAddress(rtImage, resId);
assert(dataPtr);
- uint8 *spotPtr = _vm->findWrappedBlock(MKID_BE('SPOT'), dataPtr, state, 0);
+ uint8 *spotPtr = _vm->findWrappedBlock(MKTAG('S','P','O','T'), dataPtr, state, 0);
if (spotPtr) {
x = READ_LE_UINT32(spotPtr + 0);
y = READ_LE_UINT32(spotPtr + 4);
@@ -2537,17 +2537,17 @@ int Wiz::getWizImageData(int resNum, int state, int type) {
switch (type) {
case 0:
- wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), dataPtr, state, 0);
+ wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
assert(wizh);
return READ_LE_UINT32(wizh + 0x0);
case 1:
- return (_vm->findWrappedBlock(MKID_BE('RGBS'), dataPtr, state, 0) != NULL) ? 1 : 0;
+ return (_vm->findWrappedBlock(MKTAG('R','G','B','S'), dataPtr, state, 0) != NULL) ? 1 : 0;
case 2:
- return (_vm->findWrappedBlock(MKID_BE('RMAP'), dataPtr, state, 0) != NULL) ? 1 : 0;
+ return (_vm->findWrappedBlock(MKTAG('R','M','A','P'), dataPtr, state, 0) != NULL) ? 1 : 0;
case 3:
- return (_vm->findWrappedBlock(MKID_BE('TRNS'), dataPtr, state, 0) != NULL) ? 1 : 0;
+ return (_vm->findWrappedBlock(MKTAG('T','R','N','S'), dataPtr, state, 0) != NULL) ? 1 : 0;
case 4:
- return (_vm->findWrappedBlock(MKID_BE('XMAP'), dataPtr, state, 0) != NULL) ? 1 : 0;
+ return (_vm->findWrappedBlock(MKTAG('X','M','A','P'), dataPtr, state, 0) != NULL) ? 1 : 0;
default:
error("getWizImageData: Unknown type %d", type);
}
@@ -2556,14 +2556,14 @@ int Wiz::getWizImageData(int resNum, int state, int type) {
int Wiz::getWizImageStates(int resNum) {
const uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
assert(dataPtr);
- if (READ_BE_UINT32(dataPtr) == MKID_BE('MULT')) {
+ if (READ_BE_UINT32(dataPtr) == MKTAG('M','U','L','T')) {
const byte *offs, *wrap;
- wrap = _vm->findResource(MKID_BE('WRAP'), dataPtr);
+ wrap = _vm->findResource(MKTAG('W','R','A','P'), dataPtr);
if (wrap == NULL)
return 1;
- offs = _vm->findResourceData(MKID_BE('OFFS'), wrap);
+ offs = _vm->findResourceData(MKTAG('O','F','F','S'), wrap);
if (offs == NULL)
return 1;
@@ -2577,12 +2577,12 @@ int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags
int ret = 0;
uint8 *data = _vm->getResourceAddress(rtImage, resNum);
assert(data);
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), data, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), data, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
int h = READ_LE_UINT32(wizh + 0x8);
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), data, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), data, state, 0);
assert(wizd);
if (x >= 0 && x < w && y >= 0 && y < h) {
if (flags & kWIFFlipX) {
@@ -2627,12 +2627,12 @@ uint16 Wiz::getWizPixelColor(int resNum, int state, int x, int y) {
uint16 color = 0;
uint8 *data = _vm->getResourceAddress(rtImage, resNum);
assert(data);
- uint8 *wizh = _vm->findWrappedBlock(MKID_BE('WIZH'), data, state, 0);
+ uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), data, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
int w = READ_LE_UINT32(wizh + 0x4);
int h = READ_LE_UINT32(wizh + 0x8);
- uint8 *wizd = _vm->findWrappedBlock(MKID_BE('WIZD'), data, state, 0);
+ uint8 *wizd = _vm->findWrappedBlock(MKTAG('W','I','Z','D'), data, state, 0);
assert(wizd);
switch (c) {
case 0:
@@ -2671,13 +2671,13 @@ int ScummEngine_v90he::computeWizHistogram(int resNum, int state, int x, int y,
Common::Rect rCapt(x, y, w + 1, h + 1);
uint8 *data = getResourceAddress(rtImage, resNum);
assert(data);
- uint8 *wizh = findWrappedBlock(MKID_BE('WIZH'), data, state, 0);
+ uint8 *wizh = findWrappedBlock(MKTAG('W','I','Z','H'), data, state, 0);
assert(wizh);
int c = READ_LE_UINT32(wizh + 0x0);
w = READ_LE_UINT32(wizh + 0x4);
h = READ_LE_UINT32(wizh + 0x8);
Common::Rect rWiz(w, h);
- uint8 *wizd = findWrappedBlock(MKID_BE('WIZD'), data, state, 0);
+ uint8 *wizd = findWrappedBlock(MKTAG('W','I','Z','D'), data, state, 0);
assert(wizd);
if (rCapt.intersects(rWiz)) {
rCapt.clip(rWiz);