diff options
author | Max Horn | 2011-04-12 16:53:15 +0200 |
---|---|---|
committer | Max Horn | 2011-04-12 16:53:15 +0200 |
commit | 0ce2ca4e006a70d787481040fa844c85aac43222 (patch) | |
tree | 25fb61d7e7165ec2570ecf14a4af52e9bdb6b176 | |
parent | a8b3501252c46c3fc4fd129fa0a945eb87f47d0a (diff) | |
download | scummvm-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.
95 files changed, 801 insertions, 817 deletions
diff --git a/audio/mods/module.cpp b/audio/mods/module.cpp index 0da6923b5d..3dad3794f9 100644 --- a/audio/mods/module.cpp +++ b/audio/mods/module.cpp @@ -113,7 +113,7 @@ const int16 Module::periods[16][60] = { 108 , 101 , 96 , 90 , 85 , 80 , 76 , 72 , 68 , 64 , 60 , 57 }}; const uint32 Module::signatures[] = { - MKID_BE('M.K.'), MKID_BE('M!K!'), MKID_BE('FLT4') + MKTAG('M','.','K','.'), MKTAG('M','!','K','!'), MKTAG('F','L','T','4') }; bool Module::load(Common::SeekableReadStream &st, int offs) { diff --git a/audio/mods/rjp1.cpp b/audio/mods/rjp1.cpp index 7423abb668..957bbb933a 100644 --- a/audio/mods/rjp1.cpp +++ b/audio/mods/rjp1.cpp @@ -138,7 +138,7 @@ Rjp1::~Rjp1() { } bool Rjp1::load(Common::SeekableReadStream *songData, Common::SeekableReadStream *instrumentsData) { - if (songData->readUint32BE() == MKID_BE('RJP1') && songData->readUint32BE() == MKID_BE('SMOD')) { + if (songData->readUint32BE() == MKTAG('R','J','P','1') && songData->readUint32BE() == MKTAG('S','M','O','D')) { for (int i = 0; i < 7; ++i) { uint32 size = songData->readUint32BE(); _vars.songData[i] = (uint8 *)malloc(size); @@ -167,7 +167,7 @@ bool Rjp1::load(Common::SeekableReadStream *songData, Common::SeekableReadStream } } - if (instrumentsData->readUint32BE() == MKID_BE('RJP1')) { + if (instrumentsData->readUint32BE() == MKTAG('R','J','P','1')) { uint32 size = instrumentsData->size() - 4; _vars.instData = (int8 *)malloc(size); if (!_vars.instData) diff --git a/common/endian.h b/common/endian.h index 32f92fd02c..02b986d10b 100644 --- a/common/endian.h +++ b/common/endian.h @@ -141,27 +141,13 @@ /** * A wrapper macro used around four character constants, like 'DATA', to - * ensure portability. Typical usage: MKID_BE('DATA'). + * ensure portability. Typical usage: MKTAG('D','A','T','A'). * * Why is this necessary? The C/C++ standard does not define the endianess to * be used for character constants. Hence if one uses multi-byte character * constants, a potential portability problem opens up. - * - * Fortunately, a semi-standard has been established: On almost all systems - * and compilers, multi-byte character constants are encoded using the big - * endian convention (probably in analogy to the encoding of string constants). - * Still some systems differ. This is why we provide the MKID_BE macro. If - * you wrap your four character constants with it, the result will always be - * BE encoded, even on systems which differ from the default BE encoding. - * - * For the latter systems we provide the INVERSE_MKID override. */ -#if defined(INVERSE_MKID) -#define MKID_BE(a) SWAP_CONSTANT_32(a) - -#else -# define MKID_BE(a) ((uint32)(a)) -#endif +#define MKTAG(a0,a1,a2,a3) ((a0) | ((a1) << 8) | ((a2) << 16) | ((a3) << 24)) // Functions for reading/writing native Integers, // this transparently handles the need for alignment @@ -331,8 +317,6 @@ #elif defined(SCUMM_BIG_ENDIAN) - #define MKID_BE(a) ((uint32)(a)) - #define READ_BE_UINT16(a) READ_UINT16(a) #define READ_BE_UINT32(a) READ_UINT32(a) diff --git a/common/iff_container.h b/common/iff_container.h index 16d4826238..01fc8017a9 100644 --- a/common/iff_container.h +++ b/common/iff_container.h @@ -35,111 +35,111 @@ namespace Common { typedef uint32 IFF_ID; -#define ID_FORM MKID_BE('FORM') +#define ID_FORM MKTAG('F','O','R','M') /* EA IFF 85 group identifier */ -#define ID_CAT MKID_BE('CAT ') +#define ID_CAT MKTAG('C','A','T',' ') /* EA IFF 85 group identifier */ -#define ID_LIST MKID_BE('LIST') +#define ID_LIST MKTAG('L','I','S','T') /* EA IFF 85 group identifier */ -#define ID_PROP MKID_BE('PROP') +#define ID_PROP MKTAG('P','R','O','P') /* EA IFF 85 group identifier */ -#define ID_END MKID_BE('END ') +#define ID_END MKTAG('E','N','D',' ') /* unofficial END-of-FORM identifier (see Amiga RKM Devices Ed.3 page 376) */ -#define ID_ILBM MKID_BE('ILBM') +#define ID_ILBM MKTAG('I','L','B','M') /* EA IFF 85 raster bitmap form */ -#define ID_DEEP MKID_BE('DEEP') +#define ID_DEEP MKTAG('D','E','E','P') /* Chunky pixel image files (Used in TV Paint) */ -#define ID_RGB8 MKID_BE('RGB8') +#define ID_RGB8 MKTAG('R','G','B','8') /* RGB image forms, Turbo Silver (Impulse) */ -#define ID_RGBN MKID_BE('RGBN') +#define ID_RGBN MKTAG('R','G','B','N') /* RGB image forms, Turbo Silver (Impulse) */ -#define ID_PBM MKID_BE('PBM ') +#define ID_PBM MKTAG('P','B','M',' ') /* 256-color chunky format (DPaint 2 ?) */ -#define ID_ACBM MKID_BE('ACBM') +#define ID_ACBM MKTAG('A','C','B','M') /* Amiga Contiguous Bitmap (AmigaBasic) */ -#define ID_8SVX MKID_BE('8SVX') +#define ID_8SVX MKTAG('8','S','V','X') /* Amiga 8 bits voice */ /* generic */ -#define ID_FVER MKID_BE('FVER') +#define ID_FVER MKTAG('F','V','E','R') /* AmigaOS version string */ -#define ID_JUNK MKID_BE('JUNK') +#define ID_JUNK MKTAG('J','U','N','K') /* always ignore this chunk */ -#define ID_ANNO MKID_BE('ANNO') +#define ID_ANNO MKTAG('A','N','N','O') /* EA IFF 85 Generic Annotation chunk */ -#define ID_AUTH MKID_BE('AUTH') +#define ID_AUTH MKTAG('A','U','T','H') /* EA IFF 85 Generic Author chunk */ -#define ID_CHRS MKID_BE('CHRS') +#define ID_CHRS MKTAG('C','H','R','S') /* EA IFF 85 Generic character string chunk */ -#define ID_NAME MKID_BE('NAME') +#define ID_NAME MKTAG('N','A','M','E') /* EA IFF 85 Generic Name of art, music, etc. chunk */ -#define ID_TEXT MKID_BE('TEXT') +#define ID_TEXT MKTAG('T','E','X','T') /* EA IFF 85 Generic unformatted ASCII text chunk */ -#define ID_copy MKID_BE('(c) ') +#define ID_copy MKTAG('(','c',')',' ') /* EA IFF 85 Generic Copyright text chunk */ /* ILBM chunks */ -#define ID_BMHD MKID_BE('BMHD') +#define ID_BMHD MKTAG('B','M','H','D') /* ILBM BitmapHeader */ -#define ID_CMAP MKID_BE('CMAP') +#define ID_CMAP MKTAG('C','M','A','P') /* ILBM 8bit RGB colormap */ -#define ID_GRAB MKID_BE('GRAB') +#define ID_GRAB MKTAG('G','R','A','B') /* ILBM "hotspot" coordiantes */ -#define ID_DEST MKID_BE('DEST') +#define ID_DEST MKTAG('D','E','S','T') /* ILBM destination image info */ -#define ID_SPRT MKID_BE('SPRT') +#define ID_SPRT MKTAG('S','P','R','T') /* ILBM sprite identifier */ -#define ID_CAMG MKID_BE('CAMG') +#define ID_CAMG MKTAG('C','A','M','G') /* Amiga viewportmodes */ -#define ID_BODY MKID_BE('BODY') +#define ID_BODY MKTAG('B','O','D','Y') /* ILBM image data */ -#define ID_CRNG MKID_BE('CRNG') +#define ID_CRNG MKTAG('C','R','N','G') /* color cycling */ -#define ID_CCRT MKID_BE('CCRT') +#define ID_CCRT MKTAG('C','C','R','T') /* color cycling */ -#define ID_CLUT MKID_BE('CLUT') +#define ID_CLUT MKTAG('C','L','U','T') /* Color Lookup Table chunk */ -#define ID_DPI MKID_BE('DPI ') +#define ID_DPI MKTAG('D','P','I',' ') /* Dots per inch chunk */ -#define ID_DPPV MKID_BE('DPPV') +#define ID_DPPV MKTAG('D','P','P','V') /* DPaint perspective chunk (EA) */ -#define ID_DRNG MKID_BE('DRNG') +#define ID_DRNG MKTAG('D','R','N','G') /* DPaint IV enhanced color cycle chunk (EA) */ -#define ID_EPSF MKID_BE('EPSF') +#define ID_EPSF MKTAG('E','P','S','F') /* Encapsulated Postscript chunk */ -#define ID_CMYK MKID_BE('CMYK') +#define ID_CMYK MKTAG('C','M','Y','K') /* Cyan, Magenta, Yellow, & Black color map (Soft-Logik) */ -#define ID_CNAM MKID_BE('CNAM') +#define ID_CNAM MKTAG('C','N','A','M') /* Color naming chunk (Soft-Logik) */ -#define ID_PCHG MKID_BE('PCHG') +#define ID_PCHG MKTAG('P','C','H','G') /* Line by line palette control information (Sebastiano Vigna) */ -#define ID_PRVW MKID_BE('PRVW') +#define ID_PRVW MKTAG('P','R','V','W') /* A mini duplicate ILBM used for preview (Gary Bonham) */ -#define ID_XBMI MKID_BE('XBMI') +#define ID_XBMI MKTAG('X','B','M','I') /* eXtended BitMap Information (Soft-Logik) */ -#define ID_CTBL MKID_BE('CTBL') +#define ID_CTBL MKTAG('C','T','B','L') /* Newtek Dynamic Ham color chunk */ -#define ID_DYCP MKID_BE('DYCP') +#define ID_DYCP MKTAG('D','Y','C','P') /* Newtek Dynamic Ham chunk */ -#define ID_SHAM MKID_BE('SHAM') +#define ID_SHAM MKTAG('S','H','A','M') /* Sliced HAM color chunk */ -#define ID_ABIT MKID_BE('ABIT') +#define ID_ABIT MKTAG('A','B','I','T') /* ACBM body chunk */ -#define ID_DCOL MKID_BE('DCOL') +#define ID_DCOL MKTAG('D','C','O','L') /* unofficial direct color */ -#define ID_DPPS MKID_BE('DPPS') +#define ID_DPPS MKTAG('D','P','P','S') /* ? */ -#define ID_TINY MKID_BE('TINY') +#define ID_TINY MKTAG('T','I','N','Y') /* ? */ -#define ID_DPPV MKID_BE('DPPV') +#define ID_DPPV MKTAG('D','P','P','V') /* ? */ /* 8SVX chunks */ -#define ID_VHDR MKID_BE('VHDR') +#define ID_VHDR MKTAG('V','H','D','R') /* 8SVX Voice8Header */ diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp index 24e51f1c9e..844127b0e1 100644 --- a/common/winexe_ne.cpp +++ b/common/winexe_ne.cpp @@ -95,7 +95,7 @@ bool NEResources::loadFromCompressedEXE(const String &fileName) { return false; // First part of the signature - if (file.readUint32BE() != MKID_BE('SZDD')) + if (file.readUint32BE() != MKTAG('S','Z','D','D')) return false; // Second part of the signature diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp index 456093f5b4..17db004bfc 100644 --- a/common/winexe_pe.cpp +++ b/common/winexe_pe.cpp @@ -78,7 +78,7 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream) { stream->seek(peOffset); - if (stream->readUint32BE() != MKID_BE('PE\0\0')) + if (stream->readUint32BE() != MKTAG('P','E',0,0)) return false; stream->skip(2); diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 6e9a996756..0a53f0c4f4 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -218,7 +218,7 @@ bool AgiMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD } SaveStateList AgiMetaEngine::listSaves(const char *target) const { - const uint32 AGIflag = MKID_BE('AGI:'); + const uint32 AGIflag = MKTAG('A','G','I',':'); Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray filenames; char saveDesc[31]; @@ -257,7 +257,7 @@ void AgiMetaEngine::removeSaveState(const char *target, int slot) const { } SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - const uint32 AGIflag = MKID_BE('AGI:'); + const uint32 AGIflag = MKTAG('A','G','I',':'); char fileName[MAXPATHLEN]; sprintf(fileName, "%s.%03d", target, slot); diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index ea041a93c7..10ca797587 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -1003,7 +1003,7 @@ bool Mickey::loadGame() { if (_vm->getSelection(kSelAnyKey) == 0) return false; } else { - if (infile->readUint32BE() != MKID_BE('MICK')) { + if (infile->readUint32BE() != MKTAG('M','I','C','K')) { warning("Mickey::loadGame wrong save game format"); return false; } @@ -1120,7 +1120,7 @@ void Mickey::saveGame() { if (_vm->getSelection(kSelAnyKey) == 0) return; } else { - outfile->writeUint32BE(MKID_BE('MICK')); // header + outfile->writeUint32BE(MKTAG('M','I','C','K')); // header outfile->writeByte(MSA_SAVEGAME_VERSION); outfile->writeByte(_game.iRoom); diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 643cbd86a9..e97c144872 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -1159,7 +1159,7 @@ void Winnie::saveGame() { if (!(outfile = _vm->getSaveFileMan()->openForSaving(szFile))) return; - outfile->writeUint32BE(MKID_BE('WINN')); // header + outfile->writeUint32BE(MKTAG('W','I','N','N')); // header outfile->writeByte(WTP_SAVEGAME_VERSION); outfile->writeByte(_game.fSound); @@ -1195,7 +1195,7 @@ void Winnie::loadGame() { if (!(infile = _vm->getSaveFileMan()->openForLoading(szFile))) return; - if (infile->readUint32BE() == MKID_BE('WINN')) { + if (infile->readUint32BE() == MKTAG('W','I','N','N')) { saveVersion = infile->readByte(); if (saveVersion != WTP_SAVEGAME_VERSION) warning("Old save game version (%d, current version is %d). Will try and read anyway, but don't be surprised if bad things happen", saveVersion, WTP_SAVEGAME_VERSION); diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 94df063609..9194cc642c 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -53,7 +53,7 @@ namespace Agi { -static const uint32 AGIflag = MKID_BE('AGI:'); +static const uint32 AGIflag = MKTAG('A','G','I',':'); int AgiEngine::saveGame(const char *fileName, const char *description) { char gameIDstring[8] = "gameIDX"; diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 10d3d7f1ff..acdc0084c4 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -301,7 +301,7 @@ void MoviePlayerDXA::stopVideo() { void MoviePlayerDXA::startSound() { uint32 offset, size; - if (getSoundTag() == MKID_BE('WAVE')) { + if (getSoundTag() == MKTAG('W','A','V','E')) { size = _fileStream->readUint32BE(); if (_sequenceNum) { diff --git a/engines/cine/saveload.h b/engines/cine/saveload.h index a6e0e3f1ab..f88338ed82 100644 --- a/engines/cine/saveload.h +++ b/engines/cine/saveload.h @@ -71,14 +71,14 @@ enum CineSaveGameFormat { }; /** Identifier for the temporary Operation Stealth savegame format. */ -static const uint32 TEMP_OS_FORMAT_ID = MKID_BE('TEMP'); +static const uint32 TEMP_OS_FORMAT_ID = MKTAG('T','E','M','P'); /** The current version number of Operation Stealth's savegame format. */ static const uint32 CURRENT_OS_SAVE_VER = 1; /** Chunk header used by the temporary Operation Stealth savegame format. */ struct ChunkHeader { - uint32 id; ///< Identifier (e.g. MKID_BE('TEMP')) + uint32 id; ///< Identifier (e.g. MKTAG('T','E','M','P')) uint32 version; ///< Version number uint32 size; ///< Size of the chunk after this header in bytes }; diff --git a/engines/gob/save/savefile.h b/engines/gob/save/savefile.h index eeee03847a..22eb79f4bf 100644 --- a/engines/gob/save/savefile.h +++ b/engines/gob/save/savefile.h @@ -48,8 +48,8 @@ class SaveHeader { public: /** The size of the header. */ static const int kSize = 20; - static const uint32 kID1 = MKID_BE('\0SCV'); - static const uint32 kID2 = MKID_BE('MGOB'); + static const uint32 kID1 = MKTAG(0,'S','C','V'); + static const uint32 kID2 = MKTAG('M','G','O','B'); SaveHeader(uint32 type = 0, uint32 version = 0, uint32 size = 0); @@ -106,7 +106,7 @@ protected: class SavePartMem : public SavePart { public: static const uint32 kVersion = 1; - static const uint32 kID = MKID_BE('PMEM'); + static const uint32 kID = MKTAG('P','M','E','M'); SavePartMem(uint32 size); ~SavePartMem(); @@ -128,7 +128,7 @@ private: class SavePartVars : public SavePart { public: static const uint32 kVersion = 1; - static const uint32 kID = MKID_BE('VARS'); + static const uint32 kID = MKTAG('V','A','R','S'); SavePartVars(GobEngine *vm, uint32 size); ~SavePartVars(); @@ -155,7 +155,7 @@ private: class SavePartSprite : public SavePart { public: static const uint32 kVersion = 2; - static const uint32 kID = MKID_BE('SPRT'); + static const uint32 kID = MKTAG('S','P','R','T'); SavePartSprite(uint32 width, uint32 height, bool trueColor = false); ~SavePartSprite(); @@ -193,7 +193,7 @@ private: class SavePartInfo : public SavePart { public: static const uint32 kVersion = 1; - static const uint32 kID = MKID_BE('INFO'); + static const uint32 kID = MKTAG('I','N','F','O'); /** * The constructor. @@ -235,7 +235,7 @@ private: class SaveContainer { public: static const uint32 kVersion = 1; - static const uint32 kID = MKID_BE('CONT'); + static const uint32 kID = MKTAG('C','O','N','T'); /** * The constructor. diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp index 6a87af8daf..db4134ccb0 100644 --- a/engines/groovie/cursor.cpp +++ b/engines/groovie/cursor.cpp @@ -404,7 +404,7 @@ GrvCursorMan_v2::GrvCursorMan_v2(OSystem *system) : // Verify the signature uint32 tmp32 = iconsFile.readUint32BE(); uint16 tmp16 = iconsFile.readUint16LE(); - if (tmp32 != MKID_BE('icon') || tmp16 != 1) + if (tmp32 != MKTAG('i','c','o','n') || tmp16 != 1) error("Groovie::Cursor: icons.ph signature failed: %s %d", tag2str(tmp32), tmp16); diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 7529f95bcf..45f9800211 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -684,7 +684,7 @@ bool MusicPlayerMac::load(uint32 fileref, bool loop) { debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); // First try for compressed MIDI - Common::SeekableReadStream *file = _vm->_macResFork->getResource(MKID_BE('cmid'), fileref & 0x3FF); + Common::SeekableReadStream *file = _vm->_macResFork->getResource(MKTAG('c','m','i','d'), fileref & 0x3FF); if (file) { // Found the resource, decompress it @@ -693,7 +693,7 @@ bool MusicPlayerMac::load(uint32 fileref, bool loop) { file = tmp; } else { // Otherwise, it's uncompressed - file = _vm->_macResFork->getResource(MKID_BE('Midi'), fileref & 0x3FF); + file = _vm->_macResFork->getResource(MKTAG('M','i','d','i'), fileref & 0x3FF); if (!file) error("Groovie::Music: Couldn't find resource 0x%04X", fileref); } diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index f26cb8fb26..1dc084f14d 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -356,7 +356,7 @@ Common::Archive *ResLoaderPak::load(Common::ArchiveMemberPtr memberFile, Common: const uint32 magic = stream.readUint32BE(); - if (magic != MKID_BE('SCVM')) + if (magic != MKTAG('S','C','V','M')) error("LINKLIST file does not contain 'SCVM' header"); const uint32 links = stream.readUint32BE(); diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index cd5ef52b92..44579c3377 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -47,13 +47,13 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab header.flags = 0; header.thumbnail = 0; - if (type == MKID_BE('KYRA') || type == MKID_BE('ARYK')) { // old Kyra1 header ID + if (type == MKTAG('K','Y','R','A') || type == MKTAG('A','R','Y','K')) { // old Kyra1 header ID header.gameID = GI_KYRA1; header.oldHeader = true; - } else if (type == MKID_BE('HOFS')) { // old Kyra2 header ID + } else if (type == MKTAG('H','O','F','S')) { // old Kyra2 header ID header.gameID = GI_KYRA2; header.oldHeader = true; - } else if (type == MKID_BE('WWSV')) { + } else if (type == MKTAG('W','W','S','V')) { header.gameID = in->readByte(); } else { // try checking for original save header @@ -71,12 +71,12 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab type = in->readUint32BE(); header.version = in->readUint16LE(); - if (type == MKID_BE('MBL3') && header.version == 100) { + if (type == MKTAG('M','B','L','3') && header.version == 100) { saveOk = true; header.description = descriptionBuffer; header.gameID = GI_KYRA2; break; - } else if (type == MKID_BE('MBL4') && header.version == 102) { + } else if (type == MKTAG('M','B','L','4') && header.version == 102) { saveOk = true; header.description = descriptionBuffer; header.gameID = GI_KYRA3; @@ -94,7 +94,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab } header.version = in->readUint32BE(); - if (header.version > CURRENT_SAVE_VERSION || (header.oldHeader && header.version > 8) || (type == MKID_BE('ARYK') && header.version > 3)) + if (header.version > CURRENT_SAVE_VERSION || (header.oldHeader && header.version > 8) || (type == MKTAG('A','R','Y','K') && header.version > 3)) return kRSHEInvalidVersion; // Versions prior to 9 are using a fixed length description field @@ -190,7 +190,7 @@ Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, con } // Savegame version - out->writeUint32BE(MKID_BE('WWSV')); + out->writeUint32BE(MKTAG('W','W','S','V')); out->writeByte(_flags.gameID); out->writeUint32BE(CURRENT_SAVE_VERSION); out->write(saveName, strlen(saveName)+1); diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp index 0343cbfeae..956bf39b5a 100644 --- a/engines/kyra/script.cpp +++ b/engines/kyra/script.cpp @@ -68,14 +68,14 @@ EMCInterpreter::EMCInterpreter(KyraEngine_v1 *vm) : _vm(vm), _scriptData(0), _fi bool EMCInterpreter::callback(Common::IFFChunk &chunk) { switch (chunk._type) { - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): _scriptData->text = new byte[chunk._size]; assert(_scriptData->text); if (chunk._stream->read(_scriptData->text, chunk._size) != chunk._size) error("Couldn't read TEXT chunk from file '%s'", _filename); break; - case MKID_BE('ORDR'): + case MKTAG('O','R','D','R'): _scriptData->ordr = new uint16[chunk._size >> 1]; assert(_scriptData->ordr); if (chunk._stream->read(_scriptData->ordr, chunk._size) != chunk._size) @@ -85,7 +85,7 @@ bool EMCInterpreter::callback(Common::IFFChunk &chunk) { _scriptData->ordr[i] = READ_BE_UINT16(&_scriptData->ordr[i]); break; - case MKID_BE('DATA'): + case MKTAG('D','A','T','A'): _scriptData->data = new uint16[chunk._size >> 1]; assert(_scriptData->data); if (chunk._stream->read(_scriptData->data, chunk._size) != chunk._size) diff --git a/engines/kyra/script.h b/engines/kyra/script.h index 68620829bb..faa80a3f21 100644 --- a/engines/kyra/script.h +++ b/engines/kyra/script.h @@ -84,9 +84,9 @@ public: // Both lead to some problems in our IFF parser, either reading after the end // of file or producing a "Chunk overread" error message. To work around this // we need to adjust the size field properly. - if (_formType == MKID_BE('EMC2')) + if (_formType == MKTAG('E','M','C','2')) _formChunk.size -= 8; - else if (_formType == MKID_BE('AVFS')) + else if (_formType == MKTAG('A','V','F','S')) _formChunk.size += 4; } }; diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 28f18a1f79..1e978caf15 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -115,14 +115,14 @@ TIMInterpreter::~TIMInterpreter() { bool TIMInterpreter::callback(Common::IFFChunk &chunk) { switch (chunk._type) { - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): _tim->text = new byte[chunk._size]; assert(_tim->text); if (chunk._stream->read(_tim->text, chunk._size) != chunk._size) error("Couldn't read TEXT chunk from file '%s'", _filename); break; - case MKID_BE('AVTL'): + case MKTAG('A','V','T','L'): _avtlChunkSize = chunk._size >> 1; _tim->avtl = new uint16[_avtlChunkSize]; assert(_tim->avtl); diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 382ec2429d..b3371793de 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -204,7 +204,7 @@ bool VQAMovie::open(const char *filename) { if (!_file) return false; - if (_file->readUint32BE() != MKID_BE('FORM')) { + if (_file->readUint32BE() != MKTAG('F','O','R','M')) { warning("VQAMovie::open: Cannot find `FORM' tag"); return false; } @@ -212,7 +212,7 @@ bool VQAMovie::open(const char *filename) { // For now, we ignore the size of the FORM chunk. _file->readUint32BE(); - if (_file->readUint32BE() != MKID_BE('WVQA')) { + if (_file->readUint32BE() != MKTAG('W','V','Q','A')) { warning("WQAMovie::open: Cannot find `WVQA' tag"); return false; } @@ -228,7 +228,7 @@ bool VQAMovie::open(const char *filename) { uint32 size = _file->readUint32BE(); switch (tag) { - case MKID_BE('VQHD'): // VQA header + case MKTAG('V','Q','H','D'): // VQA header _header.version = _file->readUint16LE(); _header.flags = _file->readUint16LE(); _header.numFrames = _file->readUint16LE(); @@ -304,7 +304,7 @@ bool VQAMovie::open(const char *filename) { foundHeader = true; break; - case MKID_BE('FINF'): // Frame info + case MKTAG('F','I','N','F'): // Frame info if (!foundHeader) { warning("VQAMovie::open: Found `FINF' before `VQHD'"); return false; @@ -343,7 +343,7 @@ bool VQAMovie::open(const char *filename) { if (_file->eos()) break; - if (scanTag == MKID_BE('VQFR')) { + if (scanTag == MKTAG('V','Q','F','R')) { _frameInfo[0] = (_file->pos() - 8) | 0x80000000; break; } @@ -421,7 +421,7 @@ void VQAMovie::displayFrame(uint frameNum) { int32 end; switch (tag) { - case MKID_BE('SND0'): // Uncompressed sound + case MKTAG('S','N','D','0'): // Uncompressed sound foundSound = true; inbuf = (byte *)malloc(size); _file->read(inbuf, size); @@ -429,7 +429,7 @@ void VQAMovie::displayFrame(uint frameNum) { _stream->queueBuffer(inbuf, size, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); break; - case MKID_BE('SND1'): // Compressed sound, almost like AUD + case MKTAG('S','N','D','1'): // Compressed sound, almost like AUD foundSound = true; outsize = _file->readUint16LE(); insize = _file->readUint16LE(); @@ -449,13 +449,13 @@ void VQAMovie::displayFrame(uint frameNum) { } break; - case MKID_BE('SND2'): // Compressed sound + case MKTAG('S','N','D','2'): // Compressed sound foundSound = true; warning("VQAMovie::displayFrame: `SND2' is not implemented"); _file->seek(size, SEEK_CUR); break; - case MKID_BE('VQFR'): + case MKTAG('V','Q','F','R'): foundFrame = true; end = _file->pos() + size - 8; @@ -464,49 +464,49 @@ void VQAMovie::displayFrame(uint frameNum) { size = _file->readUint32BE(); switch (tag) { - case MKID_BE('CBF0'): // Full codebook + case MKTAG('C','B','F','0'): // Full codebook _file->read(_codeBook, size); break; - case MKID_BE('CBFZ'): // Full codebook + case MKTAG('C','B','F','Z'): // Full codebook inbuf = (byte *)allocBuffer(0, size); _file->read(inbuf, size); Screen::decodeFrame4(inbuf, _codeBook, _codeBookSize); break; - case MKID_BE('CBP0'): // Partial codebook + case MKTAG('C','B','P','0'): // Partial codebook _compressedCodeBook = false; _file->read(_partialCodeBook + _partialCodeBookSize, size); _partialCodeBookSize += size; _numPartialCodeBooks++; break; - case MKID_BE('CBPZ'): // Partial codebook + case MKTAG('C','B','P','Z'): // Partial codebook _compressedCodeBook = true; _file->read(_partialCodeBook + _partialCodeBookSize, size); _partialCodeBookSize += size; _numPartialCodeBooks++; break; - case MKID_BE('CPL0'): // Palette + case MKTAG('C','P','L','0'): // Palette assert(size <= 3 * 256); _file->read(_screen->getPalette(0).getData(), size); break; - case MKID_BE('CPLZ'): // Palette + case MKTAG('C','P','L','Z'): // Palette inbuf = (byte *)allocBuffer(0, size); _file->read(inbuf, size); Screen::decodeFrame4(inbuf, _screen->getPalette(0).getData(), 768); break; - case MKID_BE('VPT0'): // Frame data + case MKTAG('V','P','T','0'): // Frame data assert(size / 2 <= _numVectorPointers); for (i = 0; i < size / 2; i++) _vectorPointers[i] = _file->readUint16LE(); break; - case MKID_BE('VPTZ'): // Frame data + case MKTAG('V','P','T','Z'): // Frame data inbuf = (byte *)allocBuffer(0, size); outbuf = (byte *)allocBuffer(1, 2 * _numVectorPointers); @@ -613,13 +613,13 @@ void VQAMovie::play() { } switch (tag) { - case MKID_BE('SND0'): // Uncompressed sound + case MKTAG('S','N','D','0'): // Uncompressed sound inbuf = (byte *)malloc(size); _file->read(inbuf, size); _stream->queueBuffer(inbuf, size, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); break; - case MKID_BE('SND1'): // Compressed sound + case MKTAG('S','N','D','1'): // Compressed sound outsize = _file->readUint16LE(); insize = _file->readUint16LE(); @@ -636,12 +636,12 @@ void VQAMovie::play() { } break; - case MKID_BE('SND2'): // Compressed sound + case MKTAG('S','N','D','2'): // Compressed sound warning("VQAMovie::play: `SND2' is not implemented"); _file->seek(size, SEEK_CUR); break; - case MKID_BE('CMDS'): // Unused tag, always empty in kyra3 + case MKTAG('C','M','D','S'): // Unused tag, always empty in kyra3 _file->seek(size, SEEK_CUR); break; diff --git a/engines/m4/assets.h b/engines/m4/assets.h index 3ae7fb2e22..940646b5f2 100644 --- a/engines/m4/assets.h +++ b/engines/m4/assets.h @@ -33,16 +33,16 @@ namespace M4 { // Sequence chunks -#define CHUNK_SCEN MKID_BE('SCEN') -#define CHUNK_MACH MKID_BE('MACH') -#define CHUNK_SEQU MKID_BE('SEQU') -#define CHUNK_DATA MKID_BE('DATA') -#define CHUNK_CELS MKID_BE('CELS') +#define CHUNK_SCEN MKTAG('S','C','E','N') +#define CHUNK_MACH MKTAG('M','A','C','H') +#define CHUNK_SEQU MKTAG('S','E','Q','U') +#define CHUNK_DATA MKTAG('D','A','T','A') +#define CHUNK_CELS MKTAG('C','E','L','S') // Sprite chunks -#define HEAD_M4SS MKID_BE('M4SS') //'M4SS' -#define CELS__PAL MKID_BE(' PAL') //' PAL' -#define CELS___SS MKID_BE(' SS') //' SS' +#define HEAD_M4SS MKTAG('M','4','S','S') //'M4SS' +#define CELS__PAL MKTAG(' ','P','A','L') //' PAL' +#define CELS___SS MKTAG(' ',' ','S','S') //' SS' #define SPRITE_SET_CHAR_INFO 4 diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 70c30d28f2..2d1b8e7e4f 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -45,35 +45,35 @@ namespace M4 { // Conversation chunks // Header -#define HEAD_CONV MKID_BE('CONV') // conversation -#define CHUNK_DECL MKID_BE('DECL') // declaration -#define CHUNK_NODE MKID_BE('NODE') // node -#define CHUNK_LNOD MKID_BE('LNOD') // linear node -#define CHUNK_ETRY MKID_BE('ETRY') // entry -#define CHUNK_TEXT MKID_BE('TEXT') // text -#define CHUNK_MESG MKID_BE('MESG') // message +#define HEAD_CONV MKTAG('C','O','N','V') // conversation +#define CHUNK_DECL MKTAG('D','E','C','L') // declaration +#define CHUNK_NODE MKTAG('N','O','D','E') // node +#define CHUNK_LNOD MKTAG('L','N','O','D') // linear node +#define CHUNK_ETRY MKTAG('E','T','R','Y') // entry +#define CHUNK_TEXT MKTAG('T','E','X','T') // text +#define CHUNK_MESG MKTAG('M','E','S','G') // message // Conversation chunks - entry related (unconditional) -#define CHUNK_RPLY MKID_BE('RPLY') // reply -#define CHUNK_HIDE MKID_BE('HIDE') // hide entry -#define CHUNK_UHID MKID_BE('UHID') // unhide entry -#define CHUNK_DSTR MKID_BE('DSTR') // destroy entry +#define CHUNK_RPLY MKTAG('R','P','L','Y') // reply +#define CHUNK_HIDE MKTAG('H','I','D','E') // hide entry +#define CHUNK_UHID MKTAG('U','H','I','D') // unhide entry +#define CHUNK_DSTR MKTAG('D','S','T','R') // destroy entry // Conversation chunks - entry related (conditional) -#define CHUNK_CRPL MKID_BE('CRPL') // reply -#define CHUNK_CHDE MKID_BE('CHDE') // hide entry -#define CHUNK_CUHD MKID_BE('CUHD') // unhide entry -#define CHUNK_CDST MKID_BE('DDTS') // destroy entry +#define CHUNK_CRPL MKTAG('C','R','P','L') // reply +#define CHUNK_CHDE MKTAG('C','H','D','E') // hide entry +#define CHUNK_CUHD MKTAG('C','U','H','D') // unhide entry +#define CHUNK_CDST MKTAG('D','D','T','S') // destroy entry // Conversation chunks - branching and logic (unconditional) -#define CHUNK_ASGN MKID_BE('ASGN') // assign -#define CHUNK_GOTO MKID_BE('GOTO') // goto chunk -#define CHUNK_EXIT MKID_BE('EXIT') // exit/return from goto +#define CHUNK_ASGN MKTAG('A','S','G','N') // assign +#define CHUNK_GOTO MKTAG('G','O','T','O') // goto chunk +#define CHUNK_EXIT MKTAG('E','X','I','T') // exit/return from goto // Conversation chunks - branching and logic (conditional) -#define CHUNK_CASN MKID_BE('CASN') // assign -#define CHUNK_CCGO MKID_BE('CCGO') // goto chunk -#define CHUNK_CEGO MKID_BE('CEGO') // exit/return from goto +#define CHUNK_CASN MKTAG('C','A','S','N') // assign +#define CHUNK_CCGO MKTAG('C','C','G','O') // goto chunk +#define CHUNK_CEGO MKTAG('C','E','G','O') // exit/return from goto // Others -#define CHUNK_FALL MKID_BE('FALL') // fallthrough -#define CHUNK_WRPL MKID_BE('WRPL') // weighted reply chunk -#define CHUNK_WPRL MKID_BE('WPRL') // weighted preply chunk +#define CHUNK_FALL MKTAG('F','A','L','L') // fallthrough +#define CHUNK_WRPL MKTAG('W','R','P','L') // weighted reply chunk +#define CHUNK_WPRL MKTAG('W','P','R','L') // weighted preply chunk ConversationView::ConversationView(MadsM4Engine *vm): View(vm, Common::Rect(0, diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp index cba32c2225..3ed419675d 100644 --- a/engines/m4/font.cpp +++ b/engines/m4/font.cpp @@ -81,7 +81,7 @@ Font::Font(MadsM4Engine *vm, const char *filename) : _vm(vm) { void Font::setFontM4(const char *filename) { Common::SeekableReadStream *fontFile = _vm->res()->openFile(filename); - if (fontFile->readUint32LE() != MKID_BE('FONT')) { + if (fontFile->readUint32LE() != MKTAG('F','O','N','T')) { debugCN(kDebugGraphics, "Font::Font: FONT tag expected\n"); return; } @@ -92,7 +92,7 @@ void Font::setFontM4(const char *filename) { //debugCN(kDebugGraphics, "Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize); - if (fontFile->readUint32LE() != MKID_BE('WIDT')) { + if (fontFile->readUint32LE() != MKTAG('W','I','D','T')) { debugCN(kDebugGraphics, "Font::Font: WIDT tag expected\n"); return; } @@ -100,7 +100,7 @@ void Font::setFontM4(const char *filename) { _charWidths = new uint8[256]; fontFile->read(_charWidths, 256); - if (fontFile->readUint32LE() != MKID_BE('OFFS')) { + if (fontFile->readUint32LE() != MKTAG('O','F','F','S')) { debugCN(kDebugGraphics, "Font::Font: OFFS tag expected\n"); return; } @@ -110,7 +110,7 @@ void Font::setFontM4(const char *filename) { for (int i = 0; i < 256; i++) _charOffs[i] = fontFile->readUint16LE(); - if (fontFile->readUint32LE() != MKID_BE('PIXS')) { + if (fontFile->readUint32LE() != MKTAG('P','I','X','S')) { debugCN(kDebugGraphics, "Font::Font: PIXS tag expected\n"); return; } diff --git a/engines/made/database.cpp b/engines/made/database.cpp index 2aa378edf5..8d06aa0085 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -659,7 +659,7 @@ bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String } uint32 header = in->readUint32BE(); - if (header != MKID_BE('SGAM')) { + if (header != MKTAG('S','G','A','M')) { warning("Save game header missing"); delete in; return false; @@ -696,7 +696,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in return 6; } strncpy(desc, description, 64); - out->writeUint32BE(MKID_BE('SGAM')); + out->writeUint32BE(MKTAG('S','G','A','M')); out->writeUint32LE(size); out->writeUint16LE(version); out->write(desc, 64); @@ -715,7 +715,7 @@ int16 GameDatabaseV3::loadgame(const char *filename, int16 version) { } uint32 header = in->readUint32BE(); - if (header != MKID_BE('SGAM')) { + if (header != MKTAG('S','G','A','M')) { warning("Save game header missing"); delete in; return 1; diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index 87640f2b67..e37bd87a7e 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -50,14 +50,14 @@ bool PmvPlayer::play(const char *filename) { uint32 chunkType, chunkSize, prevChunkSize = 0; readChunk(chunkType, chunkSize); // "MOVE" - if (chunkType != MKID_BE('MOVE')) { + if (chunkType != MKTAG('M','O','V','E')) { warning("Unexpected PMV video header, expected 'MOVE'"); delete _fd; return false; } readChunk(chunkType, chunkSize); // "MHED" - if (chunkType != MKID_BE('MHED')) { + if (chunkType != MKTAG('M','H','E','D')) { warning("Unexpected PMV video header, expected 'MHED'"); delete _fd; return false; @@ -111,7 +111,7 @@ bool PmvPlayer::play(const char *filename) { int32 frameTime = _vm->_system->getMillis(); readChunk(chunkType, chunkSize); - if (chunkType != MKID_BE('MFRM')) { + if (chunkType != MKTAG('M','F','R','M')) { warning("Unknown chunk type"); } diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index f8582aec40..e556e4ab38 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -57,7 +57,7 @@ PictureResource::~PictureResource() { } void PictureResource::load(byte *source, int size) { - if (READ_BE_UINT32(source) == MKID_BE('Flex')) { + if (READ_BE_UINT32(source) == MKTAG('F','l','e','x')) { loadChunked(source, size); } else { loadRaw(source, size); @@ -126,13 +126,13 @@ void PictureResource::loadChunked(byte *source, int size) { debug(0, "chunkType = %08X; chunkSize = %d", chunkType, chunkSize); - if (chunkType == MKID_BE('Rect')) { + if (chunkType == MKTAG('R','e','c','t')) { debug(0, "Rect"); sourceS->skip(4); height = sourceS->readUint16BE(); width = sourceS->readUint16BE(); debug(0, "width = %d; height = %d", width, height); - } else if (chunkType == MKID_BE('fMap')) { + } else if (chunkType == MKTAG('f','M','a','p')) { debug(0, "fMap"); lineSize = sourceS->readUint16BE(); sourceS->skip(11); @@ -140,21 +140,21 @@ void PictureResource::loadChunked(byte *source, int size) { cmdOffs = sourceS->pos(); sourceS->skip(chunkSize - 14); debug(0, "lineSize = %d; cmdFlags = %d; cmdOffs = %04X", lineSize, cmdFlags, cmdOffs); - } else if (chunkType == MKID_BE('fLCo')) { + } else if (chunkType == MKTAG('f','L','C','o')) { debug(0, "fLCo"); sourceS->skip(9); pixelFlags = sourceS->readByte(); pixelOffs = sourceS->pos(); sourceS->skip(chunkSize - 10); debug(0, "pixelFlags = %d; pixelOffs = %04X", pixelFlags, pixelOffs); - } else if (chunkType == MKID_BE('fPix')) { + } else if (chunkType == MKTAG('f','P','i','x')) { debug(0, "fPix"); sourceS->skip(9); maskFlags = sourceS->readByte(); maskOffs = sourceS->pos(); sourceS->skip(chunkSize - 10); debug(0, "maskFlags = %d; maskOffs = %04X", maskFlags, maskOffs); - } else if (chunkType == MKID_BE('fGCo')) { + } else if (chunkType == MKTAG('f','G','C','o')) { debug(0, "fGCo"); _hasPalette = true; _paletteColorCount = chunkSize / 3; diff --git a/engines/made/resource.h b/engines/made/resource.h index 5d5664b4c7..ade6a23029 100644 --- a/engines/made/resource.h +++ b/engines/made/resource.h @@ -49,16 +49,16 @@ const int kMaxResourceCacheSize = 400 * 1024; enum ResourceType { - kResARCH = MKID_BE('ARCH'), - kResFREE = MKID_BE('FREE'), - kResOMNI = MKID_BE('OMNI'), - kResFLEX = MKID_BE('FLEX'), - kResSNDS = MKID_BE('SNDS'), - kResANIM = MKID_BE('ANIM'), - kResMENU = MKID_BE('MENU'), - kResFONT = MKID_BE('FONT'), - kResXMID = MKID_BE('XMID'), - kResMIDI = MKID_BE('MIDI') + kResARCH = MKTAG('A','R','C','H'), + kResFREE = MKTAG('F','R','E','E'), + kResOMNI = MKTAG('O','M','N','I'), + kResFLEX = MKTAG('F','L','E','X'), + kResSNDS = MKTAG('S','N','D','S'), + kResANIM = MKTAG('A','N','I','M'), + kResMENU = MKTAG('M','E','N','U'), + kResFONT = MKTAG('F','O','N','T'), + kResXMID = MKTAG('X','M','I','D'), + kResMIDI = MKTAG('M','I','D','I') }; struct ResourceSlot; diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 6dce147513..ee67c9f23c 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -563,7 +563,7 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { // deriven. debugN("\n\nDumping scripts for %s\'s card %d!\n", argv[1], (uint16)atoi(argv[3])); debugN("==================================\n\n"); - Common::SeekableReadStream *cardStream = _vm->getResource(MKID_BE('CARD'), (uint16)atoi(argv[3])); + Common::SeekableReadStream *cardStream = _vm->getResource(MKTAG('C','A','R','D'), (uint16)atoi(argv[3])); cardStream->seek(4); RivenScriptList scriptList = _vm->_scriptMan->readScripts(cardStream, false); for (uint32 i = 0; i < scriptList.size(); i++) { @@ -576,7 +576,7 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { debugN("\n\nDumping scripts for %s\'s card %d hotspots!\n", argv[1], (uint16)atoi(argv[3])); debugN("===========================================\n\n"); - Common::SeekableReadStream *hsptStream = _vm->getResource(MKID_BE('HSPT'), (uint16)atoi(argv[3])); + Common::SeekableReadStream *hsptStream = _vm->getResource(MKTAG('H','S','P','T'), (uint16)atoi(argv[3])); uint16 hotspotCount = hsptStream->readUint16BE(); diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 9233a8497c..b4969f990a 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -221,7 +221,7 @@ void MacCursorManager::setCursor(uint16 id) { } // Try a color cursor first - Common::SeekableReadStream *stream = _resFork->getResource(MKID_BE('crsr'), id); + Common::SeekableReadStream *stream = _resFork->getResource(MKTAG('c','r','s','r'), id); if (stream) { byte *cursor, *palette; @@ -239,7 +239,7 @@ void MacCursorManager::setCursor(uint16 id) { } // Fall back to b&w cursors - stream = _resFork->getResource(MKID_BE('CURS'), id); + stream = _resFork->getResource(MKTAG('C','U','R','S'), id); if (stream) { setMacXorCursor(stream); diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h index 18e8f80fb2..07c727951c 100644 --- a/engines/mohawk/resource.h +++ b/engines/mohawk/resource.h @@ -34,102 +34,102 @@ namespace Mohawk { // Main FourCC's -#define ID_MHWK MKID_BE('MHWK') // Main FourCC -#define ID_RSRC MKID_BE('RSRC') // Resource Directory Tag +#define ID_MHWK MKTAG('M','H','W','K') // Main FourCC +#define ID_RSRC MKTAG('R','S','R','C') // Resource Directory Tag // Myst Resource FourCC's -#define ID_CLRC MKID_BE('CLRC') // Cursor Hotspots -#define ID_EXIT MKID_BE('EXIT') // Card Exit Scripts -#define ID_HINT MKID_BE('HINT') // Cursor Hints -#define ID_INIT MKID_BE('INIT') // Card Entrance Scripts -#define ID_MSND MKID_BE('MSND') // Standard Mohawk Sound -#define ID_RLST MKID_BE('RLST') // Resource List, Specifies HotSpots -#define ID_RSFL MKID_BE('RSFL') // ??? (system.dat only) -#define ID_VIEW MKID_BE('VIEW') // Card Details -#define ID_WDIB MKID_BE('WDIB') // LZ-Compressed Windows Bitmap +#define ID_CLRC MKTAG('C','L','R','C') // Cursor Hotspots +#define ID_EXIT MKTAG('E','X','I','T') // Card Exit Scripts +#define ID_HINT MKTAG('H','I','N','T') // Cursor Hints +#define ID_INIT MKTAG('I','N','I','T') // Card Entrance Scripts +#define ID_MSND MKTAG('M','S','N','D') // Standard Mohawk Sound +#define ID_RLST MKTAG('R','L','S','T') // Resource List, Specifies HotSpots +#define ID_RSFL MKTAG('R','S','F','L') // ??? (system.dat only) +#define ID_VIEW MKTAG('V','I','E','W') // Card Details +#define ID_WDIB MKTAG('W','D','I','B') // LZ-Compressed Windows Bitmap // Myst Masterpiece Edition Resource FourCC's (In addition to Myst FourCC's) -#define ID_HELP MKID_BE('HELP') // Help Chunk -#define ID_MJMP MKID_BE('MJMP') // MSND Jumps (To reduce MSND duplication) -#define ID_PICT MKID_BE('PICT') // JPEG/PICT/WDIB Image +#define ID_HELP MKTAG('H','E','L','P') // Help Chunk +#define ID_MJMP MKTAG('M','J','M','P') // MSND Jumps (To reduce MSND duplication) +#define ID_PICT MKTAG('P','I','C','T') // JPEG/PICT/WDIB Image // Riven Resource FourCC's -#define ID_BLST MKID_BE('BLST') // Card Hotspot Enabling Lists -#define ID_CARD MKID_BE('CARD') // Card Scripts -#define ID_FLST MKID_BE('FLST') // Card SFXE Lists -#define ID_HSPT MKID_BE('HSPT') // Card Hotspots -#define ID_MLST MKID_BE('MLST') // Card Movie Lists -#define ID_NAME MKID_BE('NAME') // Object Names -#define ID_PLST MKID_BE('PLST') // Card Picture Lists -#define ID_RMAP MKID_BE('RMAP') // Card Codes -#define ID_SFXE MKID_BE('SFXE') // Water Effect Animations -#define ID_SLST MKID_BE('SLST') // Card Ambient Sound Lists -#define ID_TMOV MKID_BE('tMOV') // QuickTime Movie +#define ID_BLST MKTAG('B','L','S','T') // Card Hotspot Enabling Lists +#define ID_CARD MKTAG('C','A','R','D') // Card Scripts +#define ID_FLST MKTAG('F','L','S','T') // Card SFXE Lists +#define ID_HSPT MKTAG('H','S','P','T') // Card Hotspots +#define ID_MLST MKTAG('M','L','S','T') // Card Movie Lists +#define ID_NAME MKTAG('N','A','M','E') // Object Names +#define ID_PLST MKTAG('P','L','S','T') // Card Picture Lists +#define ID_RMAP MKTAG('R','M','A','P') // Card Codes +#define ID_SFXE MKTAG('S','F','X','E') // Water Effect Animations +#define ID_SLST MKTAG('S','L','S','T') // Card Ambient Sound Lists +#define ID_TMOV MKTAG('t','M','O','V') // QuickTime Movie // Riven Saved Game FourCC's -#define ID_VARS MKID_BE('VARS') // Variable Values -#define ID_VERS MKID_BE('VERS') // Version Info -#define ID_ZIPS MKID_BE('ZIPS') // Zip Mode Status +#define ID_VARS MKTAG('V','A','R','S') // Variable Values +#define ID_VERS MKTAG('V','E','R','S') // Version Info +#define ID_ZIPS MKTAG('Z','I','P','S') // Zip Mode Status // Zoombini Resource FourCC's -#define ID_SND MKID_BE('\0SND') // Standard Mohawk Sound -#define ID_CURS MKID_BE('CURS') // Cursor -#define ID_SCRB MKID_BE('SCRB') // Feature Script -#define ID_SCRS MKID_BE('SCRS') // Snoid Script -#define ID_NODE MKID_BE('NODE') // Walk Node -#define ID_PATH MKID_BE('PATH') // Walk Path -#define ID_SHPL MKID_BE('SHPL') // Shape List +#define ID_SND MKTAG( 0 ,'S','N','D') // Standard Mohawk Sound +#define ID_CURS MKTAG('C','U','R','S') // Cursor +#define ID_SCRB MKTAG('S','C','R','B') // Feature Script +#define ID_SCRS MKTAG('S','C','R','S') // Snoid Script +#define ID_NODE MKTAG('N','O','D','E') // Walk Node +#define ID_PATH MKTAG('P','A','T','H') // Walk Path +#define ID_SHPL MKTAG('S','H','P','L') // Shape List // Living Books Resource FourCC's -#define ID_TCUR MKID_BE('tCUR') // Cursor -#define ID_BITL MKID_BE('BITL') // Book Item List -#define ID_CTBL MKID_BE('CTBL') // Color Table -#define ID_SCRP MKID_BE('SCRP') // Script -#define ID_SPR MKID_BE('SPR#') // Sprite? -#define ID_VRSN MKID_BE('VRSN') // Version -#define ID_ANI MKID_BE('ANI ') // Animation -#define ID_SHP MKID_BE('SHP#') // Shape -#define ID_WAV MKID_BE('WAV ') // Old Sound Resource -#define ID_BMAP MKID_BE('BMAP') // Old Mohawk Bitmap -#define ID_BCOD MKID_BE('BCOD') // Book Code +#define ID_TCUR MKTAG('t','C','U','R') // Cursor +#define ID_BITL MKTAG('B','I','T','L') // Book Item List +#define ID_CTBL MKTAG('C','T','B','L') // Color Table +#define ID_SCRP MKTAG('S','C','R','P') // Script +#define ID_SPR MKTAG('S','P','R','#') // Sprite? +#define ID_VRSN MKTAG('V','R','S','N') // Version +#define ID_ANI MKTAG('A','N','I',' ') // Animation +#define ID_SHP MKTAG('S','H','P','#') // Shape +#define ID_WAV MKTAG('W','A','V',' ') // Old Sound Resource +#define ID_BMAP MKTAG('B','M','A','P') // Old Mohawk Bitmap +#define ID_BCOD MKTAG('B','C','O','D') // Book Code // JamesMath Resource FourCC's -#define ID_TANM MKID_BE('tANM') // Animation? -#define ID_TMFO MKID_BE('tMFO') // ??? +#define ID_TANM MKTAG('t','A','N','M') // Animation? +#define ID_TMFO MKTAG('t','M','F','O') // ??? // CSTime Resource FourCC's -#define ID_CINF MKID_BE('CINF') // Case Info -#define ID_CONV MKID_BE('CONV') // Conversation -#define ID_HOTS MKID_BE('HOTS') // Hotspot -#define ID_INVO MKID_BE('INVO') // Inventory Object -#define ID_QARS MKID_BE('QARS') // Question and Responses -#define ID_SCEN MKID_BE('SCEN') // Scene -#define ID_STRI MKID_BE('STRI') // String Entry? +#define ID_CINF MKTAG('C','I','N','F') // Case Info +#define ID_CONV MKTAG('C','O','N','V') // Conversation +#define ID_HOTS MKTAG('H','O','T','S') // Hotspot +#define ID_INVO MKTAG('I','N','V','O') // Inventory Object +#define ID_QARS MKTAG('Q','A','R','S') // Question and Responses +#define ID_SCEN MKTAG('S','C','E','N') // Scene +#define ID_STRI MKTAG('S','T','R','I') // String Entry? // Mohawk Wave Tags -#define ID_WAVE MKID_BE('WAVE') // Game Sound (Third Tag) -#define ID_ADPC MKID_BE('ADPC') // Game Sound Chunk -#define ID_DATA MKID_BE('Data') // Game Sound Chunk -#define ID_CUE MKID_BE('Cue#') // Game Sound Chunk +#define ID_WAVE MKTAG('W','A','V','E') // Game Sound (Third Tag) +#define ID_ADPC MKTAG('A','D','P','C') // Game Sound Chunk +#define ID_DATA MKTAG('D','a','t','a') // Game Sound Chunk +#define ID_CUE MKTAG('C','u','e','#') // Game Sound Chunk // Mohawk MIDI Tags -#define ID_MIDI MKID_BE('MIDI') // Game Sound (Third Tag), instead of WAVE -#define ID_PRG MKID_BE('Prg#') // MIDI Patch +#define ID_MIDI MKTAG('M','I','D','I') // Game Sound (Third Tag), instead of WAVE +#define ID_PRG MKTAG('P','r','g','#') // MIDI Patch // Common Resource FourCC's -#define ID_TBMP MKID_BE('tBMP') // Standard Mohawk Bitmap -#define ID_TWAV MKID_BE('tWAV') // Standard Mohawk Sound -#define ID_TPAL MKID_BE('tPAL') // Standard Mohawk Palette -#define ID_TCNT MKID_BE('tCNT') // Shape Count (CSWorld, CSAmtrak, JamesMath) -#define ID_TSCR MKID_BE('tSCR') // Script (CSWorld, CSAmtrak, Treehouse) -#define ID_STRL MKID_BE('STRL') // String List (Zoombini, CSWorld, CSAmtrak) -#define ID_TBMH MKID_BE('tBMH') // Standard Mohawk Bitmap -#define ID_TMID MKID_BE('tMID') // Standard Mohawk MIDI -#define ID_REGS MKID_BE('REGS') // Registration Data - Shape Offsets (Zoombini, Treehouse) -#define ID_BYTS MKID_BE('BYTS') // Byte Array? (Used as Database Entry in CSWorld, CSAmtrak) -#define ID_INTS MKID_BE('INTS') // uint16 Array? (CSWorld, CSAmtrak) -#define ID_BBOX MKID_BE('BBOX') // Boxes? (CSWorld, CSAmtrak) -#define ID_SYSX MKID_BE('SYSX') // MIDI Sysex +#define ID_TBMP MKTAG('t','B','M','P') // Standard Mohawk Bitmap +#define ID_TWAV MKTAG('t','W','A','V') // Standard Mohawk Sound +#define ID_TPAL MKTAG('t','P','A','L') // Standard Mohawk Palette +#define ID_TCNT MKTAG('t','C','N','T') // Shape Count (CSWorld, CSAmtrak, JamesMath) +#define ID_TSCR MKTAG('t','S','C','R') // Script (CSWorld, CSAmtrak, Treehouse) +#define ID_STRL MKTAG('S','T','R','L') // String List (Zoombini, CSWorld, CSAmtrak) +#define ID_TBMH MKTAG('t','B','M','H') // Standard Mohawk Bitmap +#define ID_TMID MKTAG('t','M','I','D') // Standard Mohawk MIDI +#define ID_REGS MKTAG('R','E','G','S') // Registration Data - Shape Offsets (Zoombini, Treehouse) +#define ID_BYTS MKTAG('B','Y','T','S') // Byte Array? (Used as Database Entry in CSWorld, CSAmtrak) +#define ID_INTS MKTAG('I','N','T','S') // uint16 Array? (CSWorld, CSAmtrak) +#define ID_BBOX MKTAG('B','B','O','X') // Boxes? (CSWorld, CSAmtrak) +#define ID_SYSX MKTAG('S','Y','S','X') // MIDI Sysex struct FileTable { uint32 offset; diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 98770b9a6d..133b7bef6c 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -91,7 +91,7 @@ NSArchive::NSArchive(Common::SeekableReadStream *stream, Common::Platform platfo if (features & GF_DEMO) { isSmallArchive = stream->size() == SIZEOF_SMALL_ARCHIVE; } else if (features & GF_LANG_MULT) { - isSmallArchive = (stream->readUint32BE() != MKID_BE('NDOS')); + isSmallArchive = (stream->readUint32BE() != MKTAG('N','D','O','S')); } } @@ -801,7 +801,7 @@ void AmigaDisk_ns::unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 b uint16 planeSize = bytesPerPlane * height; for (uint32 i = 0; i < numFrames; i++) { - if (READ_BE_UINT32(src) == MKID_BE('DLTA')) { + if (READ_BE_UINT32(src) == MKTAG('D','L','T','A')) { uint size = READ_BE_UINT32(src + 4); diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp index 7b16df52bf..b130b27a89 100644 --- a/engines/queen/display.cpp +++ b/engines/queen/display.cpp @@ -843,19 +843,19 @@ void Display::decodeLBM(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dst uint32 size = READ_BE_UINT32(src + 4); src += 8; switch (type) { - case MKID_BE('BMHD'): { + case MKTAG('B','M','H','D'): { *w = READ_BE_UINT16(src + 0); *h = READ_BE_UINT16(src + 2); planeCount = src[8]; planePitch = ((*w + 15) >> 4) * 2; } break; - case MKID_BE('CMAP'): { + case MKTAG('C','M','A','P'): { assert(palStart <= palEnd && palEnd <= size / 3); memcpy(pal, src + palStart * 3, (palEnd - palStart) * 3); } break; - case MKID_BE('BODY'): { + case MKTAG('B','O','D','Y'): { uint32 planarSize = (*h) * planeCount * planePitch; uint8 *planarBuf = new uint8[planarSize]; uint8 *dstPlanar = planarBuf; diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 692e38179a..519f028cda 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -403,7 +403,7 @@ Common::InSaveFile *QueenEngine::readGameStateHeader(int slot, GameStateHeader * char name[20]; makeGameStateName(slot, name); Common::InSaveFile *file = _saveFileMan->openForLoading(name); - if (file && file->readUint32BE() == MKID_BE('SCVM')) { + if (file && file->readUint32BE() == MKTAG('S','C','V','M')) { gsh->version = file->readUint32BE(); gsh->flags = file->readUint32BE(); gsh->dataSize = file->readUint32BE(); diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp index a70d1f1613..e8519ee68b 100644 --- a/engines/queen/resource.cpp +++ b/engines/queen/resource.cpp @@ -132,7 +132,7 @@ void Resource::loadTextFile(const char *filename, Common::StringArray &stringLis bool Resource::detectVersion(DetectedGameVersion *ver, Common::File *f) { memset(ver, 0, sizeof(DetectedGameVersion)); - if (f->readUint32BE() == MKID_BE('QTBL')) { + if (f->readUint32BE() == MKTAG('Q','T','B','L')) { f->read(ver->str, 6); f->skip(2); ver->compression = f->readByte(); @@ -269,7 +269,7 @@ void Resource::seekResourceFile(int num, uint32 offset) { void Resource::readTableFile(uint8 version, uint32 offset) { Common::File tableFile; tableFile.open(_tableFilename); - if (tableFile.isOpen() && tableFile.readUint32BE() == MKID_BE('QTBL')) { + if (tableFile.isOpen() && tableFile.readUint32BE() == MKTAG('Q','T','B','L')) { uint32 tableVersion = tableFile.readUint32BE(); if (version > tableVersion) { error("The game you are trying to play requires version %d of queen.tbl, " diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index f8c06bff8c..b1bcc99295 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -264,7 +264,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s if (version < 4) warning("This savegame is not endian-safe. There may be problems"); - if (type != MKID_BE('SAGA')) { + if (type != MKTAG('S','A','G','A')) { error("SagaEngine::load wrong save game format"); } diff --git a/engines/saga/resource_hrs.cpp b/engines/saga/resource_hrs.cpp index 2ec2099c8d..21cf0ef4c1 100644 --- a/engines/saga/resource_hrs.cpp +++ b/engines/saga/resource_hrs.cpp @@ -62,7 +62,7 @@ bool ResourceContext_HRS::loadResV2(uint32 contextSize) { readElement(_file, origin); // Check if the file is valid - if (origin.id != MKID_BE('HRES')) { // header + if (origin.id != MKTAG('H','R','E','S')) { // header return false; } diff --git a/engines/saga/resource_rsc.cpp b/engines/saga/resource_rsc.cpp index 42c4dc05e8..089757ca27 100644 --- a/engines/saga/resource_rsc.cpp +++ b/engines/saga/resource_rsc.cpp @@ -30,7 +30,7 @@ namespace Saga { -#define ID_MIDI MKID_BE('Midi') +#define ID_MIDI MKTAG('M','i','d','i') bool ResourceContext_RSC::loadMacMIDI() { // Sanity check diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp index c5388d6878..9edb79fa7c 100644 --- a/engines/saga/saveload.cpp +++ b/engines/saga/saveload.cpp @@ -151,7 +151,7 @@ void SagaEngine::fillSaveList() { _saveHeader.version = in->readUint32LE(); in->read(_saveHeader.name, sizeof(_saveHeader.name)); - if (_saveHeader.type != MKID_BE('SAGA')) { + if (_saveHeader.type != MKTAG('S','A','G','A')) { warning("SagaEngine::load wrong save %s format", name); i++; continue; @@ -175,7 +175,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) { return; } - _saveHeader.type = MKID_BE('SAGA'); + _saveHeader.type = MKTAG('S','A','G','A'); _saveHeader.size = 0; _saveHeader.version = CURRENT_SAGA_VER; // Note that IHNM has a smaller save title size than ITE @@ -287,7 +287,7 @@ void SagaEngine::load(const char *fileName) { if (_saveHeader.version < 4) warning("This savegame is not endian-safe. There may be problems"); - if (_saveHeader.type != MKID_BE('SAGA')) { + if (_saveHeader.type != MKTAG('S','A','G','A')) { error("SagaEngine::load wrong save game format"); } diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp index 3ae2f19e1b..bd1d6e5d84 100644 --- a/engines/saga/script.cpp +++ b/engines/saga/script.cpp @@ -160,7 +160,7 @@ SAGA2Script::SAGA2Script(SagaEngine *vm) : Script(vm) { } // Script export segment (lookup table) - uint32 saga2ExportSegId = MKID_BE('_EXP'); + uint32 saga2ExportSegId = MKTAG('_','E','X','P'); int32 entryNum = _scriptContext->getEntryNum(saga2ExportSegId); if (entryNum < 0) error("Unable to locate the script's export segment"); @@ -176,7 +176,7 @@ SAGA2Script::SAGA2Script(SagaEngine *vm) : Script(vm) { // Script data segment /* - uint32 saga2DataSegId = MKID_BE('__DA'); + uint32 saga2DataSegId = MKTAG('_','_','D','A'); entryNum = _scriptContext->getEntryNum(saga2DataSegId); if (entryNum < 0) error("Unable to locate the script's data segment"); diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 5a6b1859cd..0433479a09 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -903,7 +903,7 @@ void GfxPalette::loadMacIconBarPalette() { if (!g_sci->hasMacIconBar()) return; - Common::SeekableReadStream *clutStream = g_sci->getMacExecutable()->getResource(MKID_BE('clut'), 150); + Common::SeekableReadStream *clutStream = g_sci->getMacExecutable()->getResource(MKTAG('c','l','u','t'), 150); if (!clutStream) error("Could not find clut 150 for the Mac icon bar"); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 61df02acf9..4caa77b0ae 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1488,7 +1488,7 @@ void ResourceManager::readResourcePatchesBase36() { Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(name); uint32 tag = stream->readUint32BE(); - if (tag == MKID_BE('RIFF') || tag == MKID_BE('FORM')) { + if (tag == MKTAG('R','I','F','F') || tag == MKTAG('F','O','R','M')) { delete stream; processWavePatch(resource36, name); continue; @@ -1497,7 +1497,7 @@ void ResourceManager::readResourcePatchesBase36() { // Check for SOL as well tag = (tag << 16) | stream->readUint16BE(); - if (tag != MKID_BE('SOL\0')) { + if (tag != MKTAG('S','O','L',0)) { delete stream; continue; } @@ -1746,25 +1746,25 @@ struct MacResTag { }; static const MacResTag macResTagMap[] = { - { MKID_BE('V56 '), kResourceTypeView }, - { MKID_BE('P56 '), kResourceTypePic }, - { MKID_BE('SCR '), kResourceTypeScript }, - { MKID_BE('TEX '), kResourceTypeText }, - { MKID_BE('SND '), kResourceTypeSound }, - { MKID_BE('VOC '), kResourceTypeVocab }, - { MKID_BE('FON '), kResourceTypeFont }, - { MKID_BE('CURS'), kResourceTypeCursor }, - { MKID_BE('crsr'), kResourceTypeCursor }, - { MKID_BE('Pat '), kResourceTypePatch }, - { MKID_BE('PAL '), kResourceTypePalette }, - { MKID_BE('snd '), kResourceTypeAudio }, - { MKID_BE('MSG '), kResourceTypeMessage }, - { MKID_BE('HEP '), kResourceTypeHeap }, - { MKID_BE('IBIN'), kResourceTypeMacIconBarPictN }, - { MKID_BE('IBIS'), kResourceTypeMacIconBarPictS }, - { MKID_BE('PICT'), kResourceTypeMacPict }, - { MKID_BE('SYN '), kResourceTypeSync }, - { MKID_BE('SYNC'), kResourceTypeSync } + { MKTAG('V','5','6',' '), kResourceTypeView }, + { MKTAG('P','5','6',' '), kResourceTypePic }, + { MKTAG('S','C','R',' '), kResourceTypeScript }, + { MKTAG('T','E','X',' '), kResourceTypeText }, + { MKTAG('S','N','D',' '), kResourceTypeSound }, + { MKTAG('V','O','C',' '), kResourceTypeVocab }, + { MKTAG('F','O','N',' '), kResourceTypeFont }, + { MKTAG('C','U','R','S'), kResourceTypeCursor }, + { MKTAG('c','r','s','r'), kResourceTypeCursor }, + { MKTAG('P','a','t',' '), kResourceTypePatch }, + { MKTAG('P','A','L',' '), kResourceTypePalette }, + { MKTAG('s','n','d',' '), kResourceTypeAudio }, + { MKTAG('M','S','G',' '), kResourceTypeMessage }, + { MKTAG('H','E','P',' '), kResourceTypeHeap }, + { MKTAG('I','B','I','N'), kResourceTypeMacIconBarPictN }, + { MKTAG('I','B','I','S'), kResourceTypeMacIconBarPictS }, + { MKTAG('P','I','C','T'), kResourceTypeMacPict }, + { MKTAG('S','Y','N',' '), kResourceTypeSync }, + { MKTAG('S','Y','N','C'), kResourceTypeSync } }; static Common::Array<uint32> resTypeToMacTags(ResourceType type) { diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 386bfb37f5..6e74553f56 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -53,9 +53,9 @@ AudioVolumeResourceSource::AudioVolumeResourceSource(ResourceManager *resMan, co fileStream->seek(0, SEEK_SET); uint32 compressionType = fileStream->readUint32BE(); switch (compressionType) { - case MKID_BE('MP3 '): - case MKID_BE('OGG '): - case MKID_BE('FLAC'): + case MKTAG('M','P','3',' '): + case MKTAG('O','G','G',' '): + case MKTAG('F','L','A','C'): // Detected a compressed audio volume _audioCompressionType = compressionType; // Now read the whole offset mapping table for later usage @@ -91,7 +91,7 @@ bool Resource::loadFromWaveFile(Common::SeekableReadStream *file) { bool Resource::loadFromAudioVolumeSCI11(Common::SeekableReadStream *file) { // Check for WAVE files here uint32 riffTag = file->readUint32BE(); - if (riffTag == MKID_BE('RIFF')) { + if (riffTag == MKTAG('R','I','F','F')) { _headerSize = 0; size = file->readUint32LE() + 8; file->seek(-8, SEEK_CUR); diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 73f471b247..53311b4252 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -195,7 +195,7 @@ static bool readSOLHeader(Common::SeekableReadStream *audioStream, int headerSiz uint32 tag = audioStream->readUint32BE(); - if (tag != MKID_BE('SOL\0')) { + if (tag != MKTAG('S','O','L',0)) { warning("No 'SOL' FourCC found"); return false; } @@ -290,17 +290,17 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 Common::SeekableReadStream *compressedStream = new Common::MemoryReadStream(compressedData, audioRes->size, DisposeAfterUse::YES); switch (audioCompressionType) { - case MKID_BE('MP3 '): + case MKTAG('M','P','3',' '): #ifdef USE_MAD audioSeekStream = Audio::makeMP3Stream(compressedStream, DisposeAfterUse::YES); #endif break; - case MKID_BE('OGG '): + case MKTAG('O','G','G',' '): #ifdef USE_VORBIS audioSeekStream = Audio::makeVorbisStream(compressedStream, DisposeAfterUse::YES); #endif break; - case MKID_BE('FLAC'): + case MKTAG('F','L','A','C'): #ifdef USE_FLAC audioSeekStream = Audio::makeFLACStream(compressedStream, DisposeAfterUse::YES); #endif @@ -319,7 +319,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 Common::MemoryReadStream dataStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); data = readSOLAudio(&dataStream, size, audioFlags, flags); } - } else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKID_BE('RIFF')) { + } else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKTAG('R','I','F','F')) { // WAVE detected Common::SeekableReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); @@ -331,7 +331,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 waveStream->seek(0, SEEK_SET); audioStream = Audio::makeWAVStream(waveStream, DisposeAfterUse::YES); - } else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKID_BE('FORM')) { + } else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKTAG('F','O','R','M')) { // AIFF detected Common::SeekableReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 39db47b102..13581c4b45 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1853,8 +1853,8 @@ void Actor::animateLimb(int limb, int f) { byte *akos = _vm->getResourceAddress(rtCostume, _costume); assert(akos); - aksq = _vm->findResourceData(MKID_BE('AKSQ'), akos); - akfo = _vm->findResourceData(MKID_BE('AKFO'), akos); + aksq = _vm->findResourceData(MKTAG('A','K','S','Q'), akos); + akfo = _vm->findResourceData(MKTAG('A','K','F','O'), akos); size = _vm->getResourceDataSize(akfo) / 2; @@ -2374,7 +2374,7 @@ void Actor::remapActorPaletteColor(int color, int new_color) { return; } - akpl = _vm->findResourceData(MKID_BE('AKPL'), akos); + akpl = _vm->findResourceData(MKTAG('A','K','P','L'), akos); if (!akpl) { debugC(DEBUG_ACTORS, "Actor::remapActorPaletteColor: Can't remap actor %d, costume %d doesn't contain an AKPL block", _number, _costume); return; @@ -2409,7 +2409,7 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold) return; } - akpl = _vm->findResourceData(MKID_BE('AKPL'), akos); + akpl = _vm->findResourceData(MKTAG('A','K','P','L'), akos); if (!akpl) { debugC(DEBUG_ACTORS, "Actor::remapActorPalette: Can't remap actor %d, costume %d doesn't contain an AKPL block", _number, _costume); return; @@ -2418,7 +2418,7 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold) // Get the number palette entries akpl_size = _vm->getResourceDataSize(akpl); - rgbs = _vm->findResourceData(MKID_BE('RGBS'), akos); + rgbs = _vm->findResourceData(MKTAG('R','G','B','S'), akos); if (!rgbs) { debugC(DEBUG_ACTORS, "Actor::remapActorPalette: Can't remap actor %d costume %d doesn't contain an RGB block", _number, _costume); @@ -2535,19 +2535,19 @@ void ScummEngine_v71he::postProcessAuxQueue() { if (_game.heversion >= 72) dy -= a->getElevation(); - const uint8 *akax = findResource(MKID_BE('AKAX'), cost); + const uint8 *akax = findResource(MKTAG('A','K','A','X'), cost); assert(akax); const uint8 *auxd = findPalInPals(akax, ae->subIndex) - _resourceHeaderSize; assert(auxd); - const uint8 *frel = findResourceData(MKID_BE('FREL'), auxd); + const uint8 *frel = findResourceData(MKTAG('F','R','E','L'), auxd); if (frel) { error("unhandled FREL block"); } - const uint8 *disp = findResourceData(MKID_BE('DISP'), auxd); + const uint8 *disp = findResourceData(MKTAG('D','I','S','P'), auxd); if (disp) { error("unhandled DISP block"); } - const uint8 *axfd = findResourceData(MKID_BE('AXFD'), auxd); + const uint8 *axfd = findResourceData(MKTAG('A','X','F','D'), auxd); assert(axfd); uint16 comp = READ_LE_UINT16(axfd); @@ -2567,7 +2567,7 @@ void ScummEngine_v71he::postProcessAuxQueue() { error("unimplemented compression type %d", comp); } } - const uint8 *axur = findResourceData(MKID_BE('AXUR'), auxd); + const uint8 *axur = findResourceData(MKTAG('A','X','U','R'), auxd); if (axur) { uint16 n = READ_LE_UINT16(axur); axur += 2; while (n--) { @@ -2579,7 +2579,7 @@ void ScummEngine_v71he::postProcessAuxQueue() { axur += 8; } } - const uint8 *axer = findResourceData(MKID_BE('AXER'), auxd); + const uint8 *axer = findResourceData(MKTAG('A','X','E','R'), auxd); if (axer) { a->_auxBlock.visible = true; a->_auxBlock.r.left = (int16)READ_LE_UINT16(axer + 0) + dx; diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 354a1d4491..8acbb8058e 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -146,7 +146,7 @@ void AkosCostumeLoader::loadCostume(int id) { bool AkosCostumeLoader::hasManyDirections() { const AkosHeader *akhd; - akhd = (const AkosHeader *)_vm->findResourceData(MKID_BE('AKHD'), _akos); + akhd = (const AkosHeader *)_vm->findResourceData(MKTAG('A','K','H','D'), _akos); return (akhd->flags & 2) != 0; } @@ -170,12 +170,12 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { else anim = newDirToOldDir(a->getFacing()) + frame * 4; - akhd = (const AkosHeader *)_vm->findResourceData(MKID_BE('AKHD'), _akos); + akhd = (const AkosHeader *)_vm->findResourceData(MKTAG('A','K','H','D'), _akos); if (anim >= READ_LE_UINT16(&akhd->num_anims)) return; - r = _vm->findResourceData(MKID_BE('AKCH'), _akos); + r = _vm->findResourceData(MKTAG('A','K','C','H'), _akos); assert(r); offs = READ_LE_UINT16(r + anim * sizeof(uint16)); @@ -183,8 +183,8 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { return; r += offs; - const uint8 *akstPtr = _vm->findResourceData(MKID_BE('AKST'), _akos); - const uint8 *aksfPtr = _vm->findResourceData(MKID_BE('AKSF'), _akos); + const uint8 *akstPtr = _vm->findResourceData(MKTAG('A','K','S','T'), _akos); + const uint8 *aksfPtr = _vm->findResourceData(MKTAG('A','K','S','F'), _akos); i = 0; mask = READ_LE_UINT16(r); r += 2; @@ -341,21 +341,21 @@ void AkosRenderer::setCostume(int costume, int shadow) { const byte *akos = _vm->getResourceAddress(rtCostume, costume); assert(akos); - akhd = (const AkosHeader *) _vm->findResourceData(MKID_BE('AKHD'), akos); - akof = (const AkosOffset *) _vm->findResourceData(MKID_BE('AKOF'), akos); - akci = _vm->findResourceData(MKID_BE('AKCI'), akos); - aksq = _vm->findResourceData(MKID_BE('AKSQ'), akos); - akcd = _vm->findResourceData(MKID_BE('AKCD'), akos); - akpl = _vm->findResourceData(MKID_BE('AKPL'), akos); + akhd = (const AkosHeader *) _vm->findResourceData(MKTAG('A','K','H','D'), akos); + akof = (const AkosOffset *) _vm->findResourceData(MKTAG('A','K','O','F'), akos); + akci = _vm->findResourceData(MKTAG('A','K','C','I'), akos); + aksq = _vm->findResourceData(MKTAG('A','K','S','Q'), akos); + akcd = _vm->findResourceData(MKTAG('A','K','C','D'), akos); + akpl = _vm->findResourceData(MKTAG('A','K','P','L'), akos); _codec = READ_LE_UINT16(&akhd->codec); - akct = _vm->findResourceData(MKID_BE('AKCT'), akos); - rgbs = _vm->findResourceData(MKID_BE('RGBS'), akos); + akct = _vm->findResourceData(MKTAG('A','K','C','T'), akos); + rgbs = _vm->findResourceData(MKTAG('R','G','B','S'), akos); xmap = 0; if (shadow) { const uint8 *xmapPtr = _vm->getResourceAddress(rtImage, shadow); assert(xmapPtr); - xmap = _vm->findResourceData(MKID_BE('XMAP'), xmapPtr); + xmap = _vm->findResourceData(MKTAG('X','M','A','P'), xmapPtr); assert(xmap); } } @@ -1384,8 +1384,8 @@ bool ScummEngine_v6::akos_increaseAnims(const byte *akos, Actor *a) { uint size; bool result; - aksq = findResourceData(MKID_BE('AKSQ'), akos); - akfo = findResourceData(MKID_BE('AKFO'), akos); + aksq = findResourceData(MKTAG('A','K','S','Q'), akos); + akfo = findResourceData(MKTAG('A','K','F','O'), akos); size = getResourceDataSize(akfo) / 2; diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index f49635d10f..bb3c4bcc02 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -240,7 +240,7 @@ void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { room = getObjectRoom(img); findObjectInRoom(&foir, foCodeHeader | foImageHeader | foCheckAlreadyLoaded, img, room); - imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), foir.obim); + imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), foir.obim); if (_game.version == 8) { setCursorHotspot(READ_LE_UINT32(&imhd->v8.hotspot[0].x), @@ -270,7 +270,7 @@ void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { if (size > sizeof(_grabbedCursor)) error("setCursorFromImg: Cursor image too large"); - bomp = findResource(MKID_BE('BOMP'), dataptr); + bomp = findResource(MKTAG('B','O','M','P'), dataptr); } if (bomp != NULL) diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 0db77a1b7d..a6a97ec426 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -283,7 +283,7 @@ void Gdi::loadTiles(byte *roomptr) { #ifdef USE_RGB_COLOR void GdiPCEngine::loadTiles(byte *roomptr) { - decodePCEngineTileData(_vm->findResourceData(MKID_BE('TILE'), roomptr)); + decodePCEngineTileData(_vm->findResourceData(MKTAG('T','I','L','E'), roomptr)); } #endif @@ -858,7 +858,7 @@ void ScummEngine::initBGBuffers(int height) { _gdi->_numZBuffer = 2; } else if (_game.features & GF_SMALL_HEADER) { int off; - ptr = findResourceData(MKID_BE('SMAP'), room); + ptr = findResourceData(MKTAG('S','M','A','P'), room); _gdi->_numZBuffer = 0; if (_game.features & GF_16COLOR) @@ -873,13 +873,13 @@ void ScummEngine::initBGBuffers(int height) { } } else if (_game.version == 8) { // in V8 there is no RMIH and num z buffers is in RMHD - ptr = findResource(MKID_BE('RMHD'), room); + ptr = findResource(MKTAG('R','M','H','D'), room); _gdi->_numZBuffer = READ_LE_UINT32(ptr + 24) + 1; } else if (_game.heversion >= 70) { - ptr = findResource(MKID_BE('RMIH'), room); + ptr = findResource(MKTAG('R','M','I','H'), room); _gdi->_numZBuffer = READ_LE_UINT16(ptr + 8) + 1; } else { - ptr = findResource(MKID_BE('RMIH'), findResource(MKID_BE('RMIM'), room)); + ptr = findResource(MKTAG('R','M','I','H'), findResource(MKTAG('R','M','I','M'), room)); _gdi->_numZBuffer = READ_LE_UINT16(ptr + 8) + 1; } assert(_gdi->_numZBuffer >= 1 && _gdi->_numZBuffer <= 8); @@ -1647,9 +1647,9 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) if ((_vm->_game.features & GF_SMALL_HEADER) || _vm->_game.version == 8) zplane_list[0] = ptr; else if (bmapImage) - zplane_list[0] = _vm->findResource(MKID_BE('BMAP'), ptr); + zplane_list[0] = _vm->findResource(MKTAG('B','M','A','P'), ptr); else - zplane_list[0] = _vm->findResource(MKID_BE('SMAP'), ptr); + zplane_list[0] = _vm->findResource(MKTAG('S','M','A','P'), ptr); if (_zbufferDisabled) numzbuf = 0; @@ -1692,11 +1692,11 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) } } else { const uint32 zplane_tags[] = { - MKID_BE('ZP00'), - MKID_BE('ZP01'), - MKID_BE('ZP02'), - MKID_BE('ZP03'), - MKID_BE('ZP04') + MKTAG('Z','P','0','0'), + MKTAG('Z','P','0','1'), + MKTAG('Z','P','0','2'), + MKTAG('Z','P','0','3'), + MKTAG('Z','P','0','4') }; for (i = 1; i < numzbuf; i++) { @@ -1733,7 +1733,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const // Skip to the BSTR->WRAP->OFFS chunk smap_ptr = ptr + 24; } else { - smap_ptr = _vm->findResource(MKID_BE('SMAP'), ptr); + smap_ptr = _vm->findResource(MKTAG('S','M','A','P'), ptr); assert(smap_ptr); } @@ -1741,7 +1741,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const const byte *tmsk_ptr = NULL; if (_vm->_game.heversion >= 72) { - tmsk_ptr = _vm->findResource(MKID_BE('TMSK'), ptr); + tmsk_ptr = _vm->findResource(MKTAG('T','M','S','K'), ptr); } if (y + height > vs->h) { @@ -2011,7 +2011,7 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) { byte *mask_ptr; const byte *zplane_list[9]; - const byte *bmap_ptr = _vm->findResourceData(MKID_BE('BMAP'), ptr); + const byte *bmap_ptr = _vm->findResourceData(MKTAG('B','M','A','P'), ptr); assert(bmap_ptr); byte code = *bmap_ptr++; @@ -2091,7 +2091,7 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) { } void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, int w, int h) { - const byte *bmap_ptr = _vm->findResourceData(MKID_BE('BMAP'), ptr); + const byte *bmap_ptr = _vm->findResourceData(MKTAG('B','M','A','P'), ptr); assert(bmap_ptr); byte code = *bmap_ptr++; @@ -2828,10 +2828,10 @@ void GdiPCEngine::decodeStrip(const byte *ptr, uint16 *tiles, byte *colors, uint void GdiPCEngine::decodePCEngineGfx(const byte *room) { uint16* stripOffsets; - decodePCEngineTileData(_vm->findResourceData(MKID_BE('TILE'), room)); - decodePCEngineMaskData(_vm->findResourceData(MKID_BE('ZP00'), room)); + decodePCEngineTileData(_vm->findResourceData(MKTAG('T','I','L','E'), room)); + decodePCEngineMaskData(_vm->findResourceData(MKTAG('Z','P','0','0'), room)); - const byte* smap_ptr = _vm->findResourceData(MKID_BE('IM00'), room); + const byte* smap_ptr = _vm->findResourceData(MKTAG('I','M','0','0'), room); smap_ptr++; // roomID int numStrips = *smap_ptr++; int numRows = *smap_ptr++; 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); diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 6c626cdf4e..07fd99c809 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -150,22 +150,22 @@ bool IMuseInternal::isMT32(int sound) { tag = READ_BE_UINT32(ptr + 4); switch (tag) { - case MKID_BE('ADL '): - case MKID_BE('ASFX'): // Special AD class for old AdLib sound effects - case MKID_BE('SPK '): + case MKTAG('A','D','L',' '): + case MKTAG('A','S','F','X'): // Special AD class for old AdLib sound effects + case MKTAG('S','P','K',' '): return false; - case MKID_BE('AMI '): - case MKID_BE('ROL '): + case MKTAG('A','M','I',' '): + case MKTAG('R','O','L',' '): return true; - case MKID_BE('MAC '): // Occurs in the Mac version of FOA and MI2 + case MKTAG('M','A','C',' '): // Occurs in the Mac version of FOA and MI2 return true; - case MKID_BE('GMD '): + case MKTAG('G','M','D',' '): return false; - case MKID_BE('MIDI'): // Occurs in Sam & Max + case MKTAG('M','I','D','I'): // Occurs in Sam & Max // HE games use Roland music if (ptr[12] == 'H' && ptr[13] == 'S') return true; @@ -197,20 +197,20 @@ bool IMuseInternal::isMIDI(int sound) { tag = READ_BE_UINT32(ptr + 4); switch (tag) { - case MKID_BE('ADL '): - case MKID_BE('ASFX'): // Special AD class for old AdLib sound effects - case MKID_BE('SPK '): + case MKTAG('A','D','L',' '): + case MKTAG('A','S','F','X'): // Special AD class for old AdLib sound effects + case MKTAG('S','P','K',' '): return false; - case MKID_BE('AMI '): - case MKID_BE('ROL '): + case MKTAG('A','M','I',' '): + case MKTAG('R','O','L',' '): return true; - case MKID_BE('MAC '): // Occurs in the Mac version of FOA and MI2 + case MKTAG('M','A','C',' '): // Occurs in the Mac version of FOA and MI2 return true; - case MKID_BE('GMD '): - case MKID_BE('MIDI'): // Occurs in Sam & Max + case MKTAG('G','M','D',' '): + case MKTAG('M','I','D','I'): // Occurs in Sam & Max return true; } diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index f10f17f3d8..1e526aa6d1 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -92,7 +92,7 @@ int BundleDirCache::matchFile(const char *filename) { error("BundleDirCache::matchFileFile() Can't find free slot for file bundle dir cache"); tag = file.readUint32BE(); - if (tag == MKID_BE('LB23')) + if (tag == MKTAG('L','B','2','3')) _budleDirCache[freeSlot].isCompressed = true; offset = file.readUint32BE(); @@ -112,7 +112,7 @@ int BundleDirCache::matchFile(const char *filename) { int32 z = 0; int32 z2; - if (tag == MKID_BE('LB23')) { + if (tag == MKTAG('L','B','2','3')) { file.read(_budleDirCache[freeSlot].bundleTable[i].filename, 24); } else { for (z2 = 0; z2 < 8; z2++) @@ -224,7 +224,7 @@ bool BundleMgr::loadCompTable(int32 index) { assert(_numCompItems > 0); _file->seek(8, SEEK_CUR); - if (tag != MKID_BE('COMP')) { + if (tag != MKTAG('C','O','M','P')) { error("BundleMgr::loadCompTable() Compressed sound %d (%s:%d) invalid (%s)", index, _file->getName(), _bundleTable[index].offset, tag2str(tag)); return false; } diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 00074a951a..3fcfc62810 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -65,32 +65,32 @@ void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, i do { tag = READ_BE_UINT32(ptr); ptr += 4; switch (tag) { - case MKID_BE('STOP'): - case MKID_BE('FRMT'): - case MKID_BE('DATA'): + case MKTAG('S','T','O','P'): + case MKTAG('F','R','M','T'): + case MKTAG('D','A','T','A'): size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): if (!scumm_stricmp((const char *)(ptr + 8), "exit")) numMarkers++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('REGN'): + case MKTAG('R','E','G','N'): numRegions++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('JUMP'): + case MKTAG('J','U','M','P'): numJumps++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('SYNC'): + case MKTAG('S','Y','N','C'): numSyncs++; size = READ_BE_UINT32(ptr); ptr += size + 4; break; default: error("ImuseDigiSndMgr::countElements() Unknown sfx header '%s'", tag2str(tag)); } - } while (tag != MKID_BE('DATA')); + } while (tag != MKTAG('D','A','T','A')); } void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, SoundDesc *sound, int32 offset, int32 size) { @@ -98,7 +98,7 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, Sou file->seek(offset, SEEK_SET); uint32 tag = file->readUint32BE(); - assert(tag == MKID_BE('RMAP')); + assert(tag == MKTAG('R','M','A','P')); int32 version = file->readUint32BE(); if (version != 3) { if (version == 2) { @@ -153,7 +153,7 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::SeekableReadStream *file, Sou } void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { - if (READ_BE_UINT32(ptr) == MKID_BE('Crea')) { + if (READ_BE_UINT32(ptr) == MKTAG('C','r','e','a')) { bool quit = false; int len; @@ -222,7 +222,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { } offset += len; } - } else if (READ_BE_UINT32(ptr) == MKID_BE('iMUS')) { + } else if (READ_BE_UINT32(ptr) == MKTAG('i','M','U','S')) { uint32 tag; int32 size = 0; byte *s_ptr = ptr; @@ -250,13 +250,13 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { do { tag = READ_BE_UINT32(ptr); ptr += 4; switch (tag) { - case MKID_BE('FRMT'): + case MKTAG('F','R','M','T'): ptr += 12; sound->bits = READ_BE_UINT32(ptr); ptr += 4; sound->freq = READ_BE_UINT32(ptr); ptr += 4; sound->channels = READ_BE_UINT32(ptr); ptr += 4; break; - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): if (!scumm_stricmp((const char *)(ptr + 8), "exit")) { sound->marker[curIndexMarker].pos = READ_BE_UINT32(ptr + 4); sound->marker[curIndexMarker].length = strlen((const char *)(ptr + 8)) + 1; @@ -267,16 +267,16 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { } size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('STOP'): + case MKTAG('S','T','O','P'): size = READ_BE_UINT32(ptr); ptr += size + 4; break; - case MKID_BE('REGN'): + case MKTAG('R','E','G','N'): ptr += 4; sound->region[curIndexRegion].offset = READ_BE_UINT32(ptr); ptr += 4; sound->region[curIndexRegion].length = READ_BE_UINT32(ptr); ptr += 4; curIndexRegion++; break; - case MKID_BE('JUMP'): + case MKTAG('J','U','M','P'): ptr += 4; sound->jump[curIndexJump].offset = READ_BE_UINT32(ptr); ptr += 4; sound->jump[curIndexJump].dest = READ_BE_UINT32(ptr); ptr += 4; @@ -284,7 +284,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { sound->jump[curIndexJump].fadeDelay = READ_BE_UINT32(ptr); ptr += 4; curIndexJump++; break; - case MKID_BE('SYNC'): + case MKTAG('S','Y','N','C'): size = READ_BE_UINT32(ptr); ptr += 4; sound->sync[curIndexSync].size = size; sound->sync[curIndexSync].ptr = new byte[size]; @@ -293,13 +293,13 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { curIndexSync++; ptr += size; break; - case MKID_BE('DATA'): + case MKTAG('D','A','T','A'): ptr += 4; break; default: error("ImuseDigiSndMgr::prepareSound(%d/%s) Unknown sfx header '%s'", sound->soundId, sound->name, tag2str(tag)); } - } while (tag != MKID_BE('DATA')); + } while (tag != MKTAG('D','A','T','A')); sound->offsetData = ptr - s_ptr; } else { error("ImuseDigiSndMgr::prepareSound(): Unknown sound format"); diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp index f2e50382b3..a82c0ae408 100644 --- a/engines/scumm/insane/insane.cpp +++ b/engines/scumm/insane/insane.cpp @@ -1413,7 +1413,7 @@ int32 Insane::smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 _smush_setupsan1 = setupsan1; /* skip FLUP marker */ - if (READ_BE_UINT32(fluPtr) == MKID_BE('FLUP')) + if (READ_BE_UINT32(fluPtr) == MKTAG('F','L','U','P')) tmp += 8; _smush_setupsan2 = setupsan2; diff --git a/engines/scumm/nut_renderer.cpp b/engines/scumm/nut_renderer.cpp index d56017c6f5..7f250e45e0 100644 --- a/engines/scumm/nut_renderer.cpp +++ b/engines/scumm/nut_renderer.cpp @@ -95,7 +95,7 @@ void NutRenderer::loadFont(const char *filename) { } uint32 tag = file.readUint32BE(); - if (tag != MKID_BE('ANIM')) { + if (tag != MKTAG('A','N','I','M')) { error("NutRenderer::loadFont() there is no ANIM chunk in font header"); } @@ -104,7 +104,7 @@ void NutRenderer::loadFont(const char *filename) { file.read(dataSrc, length); file.close(); - if (READ_BE_UINT32(dataSrc) != MKID_BE('AHDR')) { + if (READ_BE_UINT32(dataSrc) != MKTAG('A','H','D','R')) { error("NutRenderer::loadFont() there is no AHDR chunk in font header"); } @@ -142,12 +142,12 @@ void NutRenderer::loadFont(const char *filename) { offset = 0; for (l = 0; l < _numChars; l++) { offset += READ_BE_UINT32(dataSrc + offset + 4) + 8; - if (READ_BE_UINT32(dataSrc + offset) != MKID_BE('FRME')) { + if (READ_BE_UINT32(dataSrc + offset) != MKTAG('F','R','M','E')) { error("NutRenderer::loadFont(%s) there is no FRME chunk %d (offset %x)", filename, l, offset); break; } offset += 8; - if (READ_BE_UINT32(dataSrc + offset) != MKID_BE('FOBJ')) { + if (READ_BE_UINT32(dataSrc + offset) != MKTAG('F','O','B','J')) { error("NutRenderer::loadFont(%s) there is no FOBJ chunk in FRME chunk %d (offset %x)", filename, l, offset); break; } diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index c44043ca81..c2547f74f4 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -416,7 +416,7 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) { debug(0, "getObjectXYPos: Can't find object %d", object); return; } - imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), ptr); + imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), ptr); assert(imhd); if (_game.version == 8) { switch (FROM_LE_32(imhd->v8.version)) { @@ -655,7 +655,7 @@ void ScummEngine::drawObject(int obj, int arg) { flags |= Gdi::dbDrawMaskOnAll; #ifdef ENABLE_HE - if (_game.heversion >= 70 && findResource(MKID_BE('SMAP'), ptr) == NULL) + if (_game.heversion >= 70 && findResource(MKTAG('S','M','A','P'), ptr) == NULL) _gdi->drawBMAPObject(ptr, &_virtscr[kMainVirtScreen], obj, od.x_pos, od.y_pos, od.width, od.height); else #endif @@ -762,12 +762,12 @@ void ScummEngine::resetRoomObjects() { for (i = 0; i < _numObjectsInRoom; i++) { od = &_objs[findLocalObjectSlot()]; - ptr = obcds.findNext(MKID_BE('OBCD')); + ptr = obcds.findNext(MKTAG('O','B','C','D')); if (ptr == NULL) error("Room %d missing object code block(s)", _roomResource); od->OBCDoffset = ptr - rootptr; - cdhd = (const CodeHeader *)findResourceData(MKID_BE('CDHD'), ptr); + cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), ptr); if (_game.version >= 7) od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); @@ -779,7 +779,7 @@ void ScummEngine::resetRoomObjects() { if (_dumpScripts) { char buf[32]; sprintf(buf, "roomobj-%d-", _roomResource); - ptr = findResource(MKID_BE('VERB'), ptr); + ptr = findResource(MKTAG('V','E','R','B'), ptr); dumpResource(buf, od->obj_nr, ptr); } @@ -788,7 +788,7 @@ void ScummEngine::resetRoomObjects() { searchptr = room; ResourceIterator obims(room, false); for (i = 0; i < _numObjectsInRoom; i++) { - ptr = obims.findNext(MKID_BE('OBIM')); + ptr = obims.findNext(MKTAG('O','B','I','M')); if (ptr == NULL) error("Room %d missing image blocks(s)", _roomResource); @@ -870,7 +870,7 @@ void ScummEngine_v4::resetRoomObjects() { for (i = 0; i < _numObjectsInRoom; i++) { od = &_objs[findLocalObjectSlot()]; - ptr = obcds.findNext(MKID_BE('OBCD')); + ptr = obcds.findNext(MKTAG('O','B','C','D')); if (ptr == NULL) error("Room %d missing object code block(s)", _roomResource); @@ -887,7 +887,7 @@ void ScummEngine_v4::resetRoomObjects() { for (i = 0; i < _numObjectsInRoom; i++) { // In the PC Engine version of Loom, there aren't image blocks // for all objects. - ptr = obims.findNext(MKID_BE('OBIM')); + ptr = obims.findNext(MKTAG('O','B','I','M')); if (ptr == NULL) break; @@ -991,11 +991,11 @@ void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte * searchptr = room; } - cdhd = (const CodeHeader *)findResourceData(MKID_BE('CDHD'), searchptr + od->OBCDoffset); + cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), searchptr + od->OBCDoffset); if (cdhd == NULL) error("Room %d missing CDHD blocks(s)", _roomResource); if (od->OBIMoffset) - imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), room + od->OBIMoffset); + imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), room + od->OBIMoffset); od->flags = Gdi::dbAllowMaskOr; @@ -1194,7 +1194,7 @@ const byte *ScummEngine::getObjOrActorName(int obj) { return (objptr + offset); } - return findResourceData(MKID_BE('OBNA'), objptr); + return findResourceData(MKTAG('O','B','N','A'), objptr); } void ScummEngine::setObjectName(int obj) { @@ -1278,7 +1278,7 @@ const byte *ScummEngine::getOBIMFromObjectData(const ObjectData &od) { if (od.fl_object_index) { ptr = getResourceAddress(rtFlObject, od.fl_object_index); - ptr = findResource(MKID_BE('OBIM'), ptr); + ptr = findResource(MKTAG('O','B','I','M'), ptr); } else { ptr = getResourceAddress(rtRoom, _roomResource); if (ptr) @@ -1288,23 +1288,23 @@ const byte *ScummEngine::getOBIMFromObjectData(const ObjectData &od) { } static const uint32 IMxx_tags[] = { - MKID_BE('IM00'), - MKID_BE('IM01'), - MKID_BE('IM02'), - MKID_BE('IM03'), - MKID_BE('IM04'), - MKID_BE('IM05'), - MKID_BE('IM06'), - MKID_BE('IM07'), - MKID_BE('IM08'), - MKID_BE('IM09'), - MKID_BE('IM0A'), - MKID_BE('IM0B'), - MKID_BE('IM0C'), - MKID_BE('IM0D'), - MKID_BE('IM0E'), - MKID_BE('IM0F'), - MKID_BE('IM10') + MKTAG('I','M','0','0'), + MKTAG('I','M','0','1'), + MKTAG('I','M','0','2'), + MKTAG('I','M','0','3'), + MKTAG('I','M','0','4'), + MKTAG('I','M','0','5'), + MKTAG('I','M','0','6'), + MKTAG('I','M','0','7'), + MKTAG('I','M','0','8'), + MKTAG('I','M','0','9'), + MKTAG('I','M','0','A'), + MKTAG('I','M','0','B'), + MKTAG('I','M','0','C'), + MKTAG('I','M','0','D'), + MKTAG('I','M','0','E'), + MKTAG('I','M','0','F'), + MKTAG('I','M','1','0') }; const byte *ScummEngine::getObjectImage(const byte *ptr, int state) { @@ -1317,15 +1317,15 @@ const byte *ScummEngine::getObjectImage(const byte *ptr, int state) { // The OBIM contains an IMAG, which in turn contains a WRAP, which contains // an OFFS chunk and multiple BOMP/SMAP chunks. To find the right BOMP/SMAP, // we use the offsets in the OFFS chunk, - ptr = findResource(MKID_BE('IMAG'), ptr); + ptr = findResource(MKTAG('I','M','A','G'), ptr); if (!ptr) return 0; - ptr = findResource(MKID_BE('WRAP'), ptr); + ptr = findResource(MKTAG('W','R','A','P'), ptr); if (!ptr) return 0; - ptr = findResource(MKID_BE('OFFS'), ptr); + ptr = findResource(MKTAG('O','F','F','S'), ptr); if (!ptr) return 0; @@ -1348,7 +1348,7 @@ int ScummEngine::getObjectImageCount(int object) { return 0; ptr = getOBIMFromObjectData(_objs[objnum]); - imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), ptr); + imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), ptr); if (!imhd) return 0; @@ -1365,7 +1365,7 @@ int ScummEngine::getObjectImageCount(int object) { int ScummEngine_v8::getObjectIdFromOBIM(const byte *obim) { // In V8, IMHD has no obj_id, but rather a name string. We map the name // back to an object id using a table derived from the DOBJ resource. - const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), obim); + const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), obim); ObjectNameId *found = (ObjectNameId *)bsearch(imhd->v8.name, _objectIDMap, _objectIDMapSize, sizeof(ObjectNameId), (int (*)(const void*, const void*))strcmp); assert(found); @@ -1373,7 +1373,7 @@ int ScummEngine_v8::getObjectIdFromOBIM(const byte *obim) { } int ScummEngine_v7::getObjectIdFromOBIM(const byte *obim) { - const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), obim); + const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), obim); return READ_LE_UINT16(&imhd->v7.obj_id); } #endif @@ -1382,7 +1382,7 @@ int ScummEngine::getObjectIdFromOBIM(const byte *obim) { if (_game.features & GF_SMALL_HEADER) return READ_LE_UINT16(obim + 6); - const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), obim); + const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), obim); return READ_LE_UINT16(&imhd->old.obj_id); } @@ -1400,7 +1400,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, if (findWhat & foCodeHeader) { fo->obcd = obcdptr = getOBCDFromObject(id); assert(obcdptr); - fo->cdhd = (const CodeHeader *)findResourceData(MKID_BE('CDHD'), obcdptr); + fo->cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), obcdptr); } if (findWhat & foImageHeader) { fo->obim = obimptr = getOBIMFromObjectData(_objs[id2]); @@ -1416,7 +1416,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, if (_game.features & GF_OLD_BUNDLE) { numobj = roomptr[20]; } else { - const RoomHeader *roomhdr = (const RoomHeader *)findResourceData(MKID_BE('RMHD'), roomptr); + const RoomHeader *roomhdr = (const RoomHeader *)findResourceData(MKTAG('R','M','H','D'), roomptr); if (_game.version == 8) numobj = READ_LE_UINT32(&(roomhdr->v8.numObjects)); @@ -1467,10 +1467,10 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, assert(searchptr); ResourceIterator obcds(searchptr, (_game.features & GF_SMALL_HEADER) != 0); for (i = 0; i < numobj; i++) { - obcdptr = obcds.findNext(MKID_BE('OBCD')); + obcdptr = obcds.findNext(MKTAG('O','B','C','D')); if (obcdptr == NULL) error("findObjectInRoom: Not enough code blocks in room %d", room); - cdhd = (const CodeHeader *)findResourceData(MKID_BE('CDHD'), obcdptr); + cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), obcdptr); if (_game.features & GF_SMALL_HEADER) id2 = READ_LE_UINT16(obcdptr + 6); @@ -1495,7 +1495,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, if (findWhat & foImageHeader) { ResourceIterator obims(roomptr, (_game.features & GF_SMALL_HEADER) != 0); for (i = 0; i < numobj; i++) { - obimptr = obims.findNext(MKID_BE('OBIM')); + obimptr = obims.findNext(MKTAG('O','B','I','M')); if (obimptr == NULL) error("findObjectInRoom: Not enough image blocks in room %d", room); obim_id = getObjectIdFromOBIM(obimptr); @@ -1699,7 +1699,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { if (!img) img = getObjectImage(ptr, 1); // Backward compatibility with samnmax blast objects assert(img); - bomp = findResourceData(MKID_BE('BOMP'), img); + bomp = findResourceData(MKTAG('B','O','M','P'), img); } if (!bomp) @@ -1843,7 +1843,7 @@ void ScummEngine::loadFlObject(uint object, uint room) { char buf[32]; const byte *ptr = foir.obcd; sprintf(buf, "roomobj-%d-", room); - ptr = findResource(MKID_BE('VERB'), ptr); + ptr = findResource(MKTAG('V','E','R','B'), ptr); dumpResource(buf, object, ptr); } @@ -1869,7 +1869,7 @@ void ScummEngine::loadFlObject(uint object, uint room) { assert(flob); // Copy object code + object image to floating object - WRITE_UINT32(flob, MKID_BE('FLOB')); + WRITE_UINT32(flob, MKTAG('F','L','O','B')); WRITE_BE_UINT32(flob + 4, flob_size); memcpy(flob + 8, foir.obcd, obcd_size); memcpy(flob + 8 + obcd_size, foir.obim, obim_size); diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 18784151b7..e81212fec8 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -1029,7 +1029,7 @@ void ScummEngine::setCurrentPalette(int palindex) { void ScummEngine::setRoomPalette(int palindex, int room) { const byte *roomptr = getResourceAddress(rtRoom, room); assert(roomptr); - const byte *pals = findResource(MKID_BE('PALS'), roomptr); + const byte *pals = findResource(MKTAG('P','A','L','S'), roomptr); assert(pals); const byte *rgbs = findPalInPals(pals, palindex); assert(rgbs); @@ -1040,11 +1040,11 @@ const byte *ScummEngine::findPalInPals(const byte *pal, int idx) { const byte *offs; uint32 size; - pal = findResource(MKID_BE('WRAP'), pal); + pal = findResource(MKTAG('W','R','A','P'), pal); if (pal == NULL) return NULL; - offs = findResourceData(MKID_BE('OFFS'), pal); + offs = findResourceData(MKTAG('O','F','F','S'), pal); if (offs == NULL) return NULL; diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/player_towns.cpp index 06f97fd671..8922ff1730 100644 --- a/engines/scumm/player_towns.cpp +++ b/engines/scumm/player_towns.cpp @@ -622,7 +622,7 @@ int Player_Towns_v2::getSoundStatus(int sound) const { void Player_Towns_v2::startSound(int sound) { uint8 *ptr = _vm->getResourceAddress(rtSound, sound); - if (READ_BE_UINT32(ptr) == MKID_BE('TOWS')) { + if (READ_BE_UINT32(ptr) == MKTAG('T','O','W','S')) { _soundOverride[sound].type = 7; uint8 velo = _soundOverride[sound].velo ? _soundOverride[sound].velo - 1: (ptr[10] + ptr[11] + 1) >> 1; uint8 pan = _soundOverride[sound].pan ? _soundOverride[sound].pan - 1 : 64; @@ -630,7 +630,7 @@ void Player_Towns_v2::startSound(int sound) { _soundOverride[sound].velo = _soundOverride[sound].pan = 0; playPcmTrack(sound, ptr + 8, velo, pan, ptr[52], pri); - } else if (READ_BE_UINT32(ptr) == MKID_BE('SBL ')) { + } else if (READ_BE_UINT32(ptr) == MKTAG('S','B','L',' ')) { _soundOverride[sound].type = 5; playVocTrack(ptr + 27); @@ -680,7 +680,7 @@ int32 Player_Towns_v2::doCommand(int numargs, int args[]) { case 258: if (_soundOverride[args[1]].type == 0) { ptr = _vm->getResourceAddress(rtSound, args[1]); - if (READ_BE_UINT32(ptr) == MKID_BE('TOWS')) + if (READ_BE_UINT32(ptr) == MKTAG('T','O','W','S')) _soundOverride[args[1]].type = 7; } if (_soundOverride[args[1]].type == 7) { @@ -692,7 +692,7 @@ int32 Player_Towns_v2::doCommand(int numargs, int args[]) { case 259: if (_soundOverride[args[1]].type == 0) { ptr = _vm->getResourceAddress(rtSound, args[1]); - if (READ_BE_UINT32(ptr) == MKID_BE('TOWS')) + if (READ_BE_UINT32(ptr) == MKTAG('T','O','W','S')) _soundOverride[args[1]].type = 7; } if (_soundOverride[args[1]].type == 7) { 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); diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 58b6cdb105..06fa0f2c39 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -264,7 +264,7 @@ void ScummEngine::setupRoomSubBlocks() { // // Determine the room dimensions (width/height) // - rmhd = (const RoomHeader *)findResourceData(MKID_BE('RMHD'), roomptr); + rmhd = (const RoomHeader *)findResourceData(MKTAG('R','M','H','D'), roomptr); if (_game.version == 8) { _roomWidth = READ_LE_UINT32(&(rmhd->v8.width)); @@ -286,18 +286,18 @@ void ScummEngine::setupRoomSubBlocks() { if (_game.version == 8) { _IM00_offs = getObjectImage(roomptr, 1) - roomptr; } else if (_game.features & GF_SMALL_HEADER) { - _IM00_offs = findResourceData(MKID_BE('IM00'), roomptr) - roomptr; + _IM00_offs = findResourceData(MKTAG('I','M','0','0'), roomptr) - roomptr; } else if (_game.heversion >= 70) { byte *roomImagePtr = getResourceAddress(rtRoomImage, _roomResource); - _IM00_offs = findResource(MKID_BE('IM00'), roomImagePtr) - roomImagePtr; + _IM00_offs = findResource(MKTAG('I','M','0','0'), roomImagePtr) - roomImagePtr; } else { - _IM00_offs = findResource(MKID_BE('IM00'), findResource(MKID_BE('RMIM'), roomptr)) - roomptr; + _IM00_offs = findResource(MKTAG('I','M','0','0'), findResource(MKTAG('R','M','I','M'), roomptr)) - roomptr; } // // Look for an exit script // - ptr = findResourceData(MKID_BE('EXCD'), roomResPtr); + ptr = findResourceData(MKTAG('E','X','C','D'), roomResPtr); if (ptr) _EXCD_offs = ptr - roomResPtr; if (_dumpScripts && _EXCD_offs) @@ -306,7 +306,7 @@ void ScummEngine::setupRoomSubBlocks() { // // Look for an entry script // - ptr = findResourceData(MKID_BE('ENCD'), roomResPtr); + ptr = findResourceData(MKTAG('E','N','C','D'), roomResPtr); if (ptr) _ENCD_offs = ptr - roomResPtr; if (_dumpScripts && _ENCD_offs) @@ -326,7 +326,7 @@ void ScummEngine::setupRoomSubBlocks() { if (_game.features & GF_SMALL_HEADER) { ResourceIterator localScriptIterator(searchptr, true); - while ((ptr = localScriptIterator.findNext(MKID_BE('LSCR'))) != NULL) { + while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != NULL) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ id = ptr[0]; @@ -341,7 +341,7 @@ void ScummEngine::setupRoomSubBlocks() { } } else if (_game.heversion >= 90) { ResourceIterator localScriptIterator2(searchptr, false); - while ((ptr = localScriptIterator2.findNext(MKID_BE('LSC2'))) != NULL) { + while ((ptr = localScriptIterator2.findNext(MKTAG('L','S','C','2'))) != NULL) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ @@ -359,7 +359,7 @@ void ScummEngine::setupRoomSubBlocks() { } ResourceIterator localScriptIterator(searchptr, false); - while ((ptr = localScriptIterator.findNext(MKID_BE('LSCR'))) != NULL) { + while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != NULL) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ @@ -376,7 +376,7 @@ void ScummEngine::setupRoomSubBlocks() { } else { ResourceIterator localScriptIterator(searchptr, false); - while ((ptr = localScriptIterator.findNext(MKID_BE('LSCR'))) != NULL) { + while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != NULL) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ @@ -403,18 +403,18 @@ void ScummEngine::setupRoomSubBlocks() { } // Locate the EGA palette (currently unused). - ptr = findResourceData(MKID_BE('EPAL'), roomptr); + ptr = findResourceData(MKTAG('E','P','A','L'), roomptr); if (ptr) _EPAL_offs = ptr - roomptr; // Locate the standard room palette (for V3-V5 games). - ptr = findResourceData(MKID_BE('CLUT'), roomptr); + ptr = findResourceData(MKTAG('C','L','U','T'), roomptr); if (ptr) _CLUT_offs = ptr - roomptr; // Locate the standard room palettes (for V6+ games). if (_game.version >= 6) { - ptr = findResource(MKID_BE('PALS'), roomptr); + ptr = findResource(MKTAG('P','A','L','S'), roomptr); if (ptr) { _PALS_offs = ptr - roomptr; } @@ -425,7 +425,7 @@ void ScummEngine::setupRoomSubBlocks() { if (_game.version == 8) trans = (byte)READ_LE_UINT32(&(rmhd->v8.transparency)); else { - ptr = findResourceData(MKID_BE('TRNS'), roomptr); + ptr = findResourceData(MKTAG('T','R','N','S'), roomptr); if (ptr) trans = ptr[0]; else @@ -434,7 +434,7 @@ void ScummEngine::setupRoomSubBlocks() { // Actor Palette in HE 70 games if (_game.heversion == 70) { - ptr = findResourceData(MKID_BE('REMP'), roomptr); + ptr = findResourceData(MKTAG('R','E','M','P'), roomptr); if (ptr) { for (i = 0; i < 256; i++) _HEV7ActorPalette[i] = *ptr++; @@ -485,7 +485,7 @@ void ScummEngine::resetRoomSubBlocks() { _res->nukeResource(rtMatrix, 1); _res->nukeResource(rtMatrix, 2); if (_game.features & GF_SMALL_HEADER) { - ptr = findResourceData(MKID_BE('BOXD'), roomptr); + ptr = findResourceData(MKTAG('B','O','X','D'), roomptr); if (ptr) { byte numOfBoxes = *ptr; int size; @@ -506,21 +506,21 @@ void ScummEngine::resetRoomSubBlocks() { } } else { - ptr = findResourceData(MKID_BE('BOXD'), roomptr); + ptr = findResourceData(MKTAG('B','O','X','D'), roomptr); if (ptr) { int size = getResourceDataSize(ptr); _res->createResource(rtMatrix, 2, size); roomptr = getResourceAddress(rtRoom, _roomResource); - ptr = findResourceData(MKID_BE('BOXD'), roomptr); + ptr = findResourceData(MKTAG('B','O','X','D'), roomptr); memcpy(getResourceAddress(rtMatrix, 2), ptr, size); } - ptr = findResourceData(MKID_BE('BOXM'), roomptr); + ptr = findResourceData(MKTAG('B','O','X','M'), roomptr); if (ptr) { int size = getResourceDataSize(ptr); _res->createResource(rtMatrix, 1, size); roomptr = getResourceAddress(rtRoom, _roomResource); - ptr = findResourceData(MKID_BE('BOXM'), roomptr); + ptr = findResourceData(MKTAG('B','O','X','M'), roomptr); memcpy(getResourceAddress(rtMatrix, 1), ptr, size); } } @@ -531,7 +531,7 @@ void ScummEngine::resetRoomSubBlocks() { for (i = 1; i < _res->num[rtScaleTable]; i++) _res->nukeResource(rtScaleTable, i); - ptr = findResourceData(MKID_BE('SCAL'), roomptr); + ptr = findResourceData(MKTAG('S','C','A','L'), roomptr); if (ptr) { int s1, s2, y1, y2; if (_game.version == 8) { @@ -558,7 +558,7 @@ void ScummEngine::resetRoomSubBlocks() { // Color cycling // HE 7.0 games load resources but don't use them. if (_game.version >= 4 && _game.heversion <= 62) { - ptr = findResourceData(MKID_BE('CYCL'), roomptr); + ptr = findResourceData(MKTAG('C','Y','C','L'), roomptr); if (ptr) { initCycl(ptr); } @@ -567,7 +567,7 @@ void ScummEngine::resetRoomSubBlocks() { #ifdef ENABLE_HE // Polygons in HE 80+ games if (_game.heversion >= 80) { - ptr = findResourceData(MKID_BE('POLD'), roomptr); + ptr = findResourceData(MKTAG('P','O','L','D'), roomptr); if (ptr) { ((ScummEngine_v71he *)this)->_wiz->polygonLoad(ptr); } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index fb34255683..3bfe51a77b 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -154,7 +154,7 @@ void ScummEngine::requestLoad(int slot) { } static bool saveSaveGameHeader(Common::OutSaveFile *out, SaveGameHeader &hdr) { - hdr.type = MKID_BE('SCVM'); + hdr.type = MKTAG('S','C','V','M'); hdr.size = 0; hdr.ver = CURRENT_VER; @@ -308,7 +308,7 @@ static bool loadSaveGameHeader(Common::SeekableReadStream *in, SaveGameHeader &h hdr.size = in->readUint32LE(); hdr.ver = in->readUint32LE(); in->read(hdr.name, sizeof(hdr.name)); - return !in->err() && hdr.type == MKID_BE('SCVM'); + return !in->err() && hdr.type == MKTAG('S','C','V','M'); } bool ScummEngine::loadState(int slot, bool compat) { @@ -746,7 +746,7 @@ bool ScummEngine::loadInfos(Common::SeekableReadStream *file, SaveStateMetaInfos SaveInfoSection section; section.type = file->readUint32BE(); - if (section.type != MKID_BE('INFO')) { + if (section.type != MKTAG('I','N','F','O')) { return false; } @@ -793,7 +793,7 @@ bool ScummEngine::loadInfos(Common::SeekableReadStream *file, SaveStateMetaInfos void ScummEngine::saveInfos(Common::WriteStream* file) { SaveInfoSection section; - section.type = MKID_BE('INFO'); + section.type = MKTAG('I','N','F','O'); section.version = INFOSECTION_VERSION; section.size = SaveInfoSectionSize; diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index c6c1f5f58f..9e02f126cd 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -174,7 +174,7 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) { else if (_game.features & GF_SMALL_HEADER) verbptr = objptr + 19; else - verbptr = findResource(MKID_BE('VERB'), objptr); + verbptr = findResource(MKTAG('V','E','R','B'), objptr); assert(verbptr); @@ -921,7 +921,7 @@ void ScummEngine::runExitScript() { // be limiting ourselves to strictly reading the size from the header? if (_game.id == GID_INDY3 && !(_game.features & GF_OLD_BUNDLE)) { byte *roomptr = getResourceAddress(rtRoom, _roomResource); - const byte *excd = findResourceData(MKID_BE('EXCD'), roomptr) - _resourceHeaderSize; + const byte *excd = findResourceData(MKTAG('E','X','C','D'), roomptr) - _resourceHeaderSize; if (!excd || (getResourceDataSize(excd) < 1)) { debug(2, "Exit-%d is empty", _roomResource); return; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index abe397ba7e..b2df1d0baa 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -3014,7 +3014,7 @@ void ScummEngine_v6::o6_setBoxSet() { ResourceIterator boxds(room, false); for (i = 0; i < arg; i++) - boxd = boxds.findNext(MKID_BE('BOXD')); + boxd = boxds.findNext(MKTAG('B','O','X','D')); if (!boxd) error("ScummEngine_v6::o6_setBoxSet: Can't find dboxes for set %d", arg); @@ -3027,7 +3027,7 @@ void ScummEngine_v6::o6_setBoxSet() { ResourceIterator boxms(room, false); for (i = 0; i < arg; i++) - boxm = boxms.findNext(MKID_BE('BOXM')); + boxm = boxms.findNext(MKTAG('B','O','X','M')); if (!boxm) error("ScummEngine_v6::o6_setBoxSet: Can't find mboxes for set %d", arg); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 7b98c86506..5aea36ef66 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1577,7 +1577,7 @@ void ScummEngine_v3::resetScumm() { // Load tile set and palette for the distaff byte *roomptr = getResourceAddress(rtRoom, 90); assert(roomptr); - const byte *palPtr = findResourceData(MKID_BE('CLUT'), roomptr); + const byte *palPtr = findResourceData(MKTAG('C','L','U','T'), roomptr); assert(palPtr - 4); setPCEPaletteFromPtr(palPtr); _gdi->_distaff = true; diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index a838fdba56..5af3c9ee8e 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -64,7 +64,7 @@ bool ImuseChannel::appendData(Common::SeekableReadStream &b, int32 size) { assert(size > 8); uint32 imus_type = b.readUint32BE(); /*uint32 imus_size =*/ b.readUint32BE(); - if (imus_type != MKID_BE('iMUS')) + if (imus_type != MKTAG('i','M','U','S')) error("Invalid Chunk for imuse_channel"); size -= 8; _tbufferSize = size; @@ -115,7 +115,7 @@ bool ImuseChannel::handleMap(byte *data) { size -= 8; switch (subType) { - case MKID_BE('FRMT'): + case MKTAG('F','R','M','T'): if (subSize != 20) error("invalid size for FRMT Chunk"); //uint32 imuse_start = READ_BE_UINT32(data); @@ -125,14 +125,14 @@ bool ImuseChannel::handleMap(byte *data) { _channels = READ_BE_UINT32(data+16); assert(_channels == 1 || _channels == 2); break; - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): // Ignore this break; - case MKID_BE('REGN'): + case MKTAG('R','E','G','N'): if (subSize != 8) error("invalid size for REGN Chunk"); break; - case MKID_BE('STOP'): + case MKTAG('S','T','O','P'): if (subSize != 4) error("invalid size for STOP Chunk"); break; @@ -201,13 +201,13 @@ bool ImuseChannel::handleSubTags(int32 &offset) { uint32 size = READ_BE_UINT32(_tbuffer + offset + 4); uint32 available_size = _tbufferSize - offset; switch (type) { - case MKID_BE('MAP '): + case MKTAG('M','A','P',' '): _inData = false; if (available_size >= (size + 8)) { handleMap((byte *)_tbuffer + offset); } break; - case MKID_BE('DATA'): + case MKTAG('D','A','T','A'): _inData = true; _dataSize = size; offset += 8; diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp index 94df70633f..04ed955224 100644 --- a/engines/scumm/smush/saud_channel.cpp +++ b/engines/scumm/smush/saud_channel.cpp @@ -50,7 +50,7 @@ bool SaudChannel::handleSubTags(int32 &offset) { uint32 available_size = _tbufferSize - offset; switch (type) { - case MKID_BE('STRK'): + case MKTAG('S','T','R','K'): _inData = false; if (available_size >= (size + 8)) { int32 subSize = READ_BE_UINT32((byte *)_tbuffer + offset + 4); @@ -60,14 +60,14 @@ bool SaudChannel::handleSubTags(int32 &offset) { } else return false; break; - case MKID_BE('SMRK'): + case MKTAG('S','M','R','K'): _inData = false; if (available_size >= (size + 8)) _markReached = true; else return false; break; - case MKID_BE('SHDR'): + case MKTAG('S','H','D','R'): _inData = false; if (available_size >= (size + 8)) { int32 subSize = READ_BE_UINT32((byte *)_tbuffer + offset + 4); @@ -76,7 +76,7 @@ bool SaudChannel::handleSubTags(int32 &offset) { } else return false; break; - case MKID_BE('SDAT'): + case MKTAG('S','D','A','T'): _inData = true; _dataSize = size; offset += 8; @@ -123,7 +123,7 @@ bool SaudChannel::appendData(Common::SeekableReadStream &b, int32 size) { assert(size > 8); uint32 saud_type = b.readUint32BE(); /*uint32 saud_size =*/ b.readUint32BE(); - if (saud_type != MKID_BE('SAUD')) + if (saud_type != MKTAG('S','A','U','D')) error("Invalid Chunk for SaudChannel : %X", saud_type); size -= 8; _dataSize = -2; diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index fe2b9d99ff..0e4f588593 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -190,7 +190,7 @@ static StringResource *getStrings(ScummEngine *vm, const char *file, bool is_enc theFile.read(filebuffer, length); filebuffer[length] = 0; - if (is_encoded && READ_BE_UINT32(filebuffer) == MKID_BE('ETRS')) { + if (is_encoded && READ_BE_UINT32(filebuffer) == MKTAG('E','T','R','S')) { assert(length > ETRS_HEADER_LENGTH); length -= ETRS_HEADER_LENGTH; for (int i = 0; i < length; ++i) { @@ -507,7 +507,7 @@ void SmushPlayer::handleTextResource(uint32 subType, int32 subSize, Common::Seek const char *str; char *string = NULL, *string2 = NULL; - if (subType == MKID_BE('TEXT')) { + if (subType == MKTAG('T','E','X','T')) { string = (char *)malloc(subSize - 16); str = string; b.read(string, subSize - 16); @@ -845,40 +845,40 @@ void SmushPlayer::handleFrame(int32 frameSize, Common::SeekableReadStream &b) { const int32 subSize = b.readUint32BE(); const int32 subOffset = b.pos(); switch (subType) { - case MKID_BE('NPAL'): + case MKTAG('N','P','A','L'): handleNewPalette(subSize, b); break; - case MKID_BE('FOBJ'): + case MKTAG('F','O','B','J'): handleFrameObject(subSize, b); break; #ifdef USE_ZLIB - case MKID_BE('ZFOB'): + case MKTAG('Z','F','O','B'): handleZlibFrameObject(subSize, b); break; #endif - case MKID_BE('PSAD'): + case MKTAG('P','S','A','D'): if (!_compressedFileMode) handleSoundFrame(subSize, b); break; - case MKID_BE('TRES'): + case MKTAG('T','R','E','S'): handleTextResource(subType, subSize, b); break; - case MKID_BE('XPAL'): + case MKTAG('X','P','A','L'): handleDeltaPalette(subSize, b); break; - case MKID_BE('IACT'): + case MKTAG('I','A','C','T'): handleIACT(subSize, b); break; - case MKID_BE('STOR'): + case MKTAG('S','T','O','R'): handleStore(subSize, b); break; - case MKID_BE('FTCH'): + case MKTAG('F','T','C','H'): handleFetch(subSize, b); break; - case MKID_BE('SKIP'): + case MKTAG('S','K','I','P'): _vm->_insane->procSKIP(subSize, b); break; - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): handleTextResource(subType, subSize, b); break; default: @@ -990,7 +990,7 @@ void SmushPlayer::parseNextFrame() { const uint32 subType = _base->readUint32BE(); const int32 subSize = _base->readUint32BE(); const int32 subOffset = _base->pos(); - assert(subType == MKID_BE('AHDR')); + assert(subType == MKTAG('A','H','D','R')); handleAnimHeader(subSize, *_base); _base->seek(subOffset + subSize, SEEK_SET); @@ -1029,10 +1029,10 @@ void SmushPlayer::parseNextFrame() { debug(3, "Chunk: %s at %x", tag2str(subType), subOffset); switch (subType) { - case MKID_BE('AHDR'): // FT INSANE may seek file to the beginning + case MKTAG('A','H','D','R'): // FT INSANE may seek file to the beginning handleAnimHeader(subSize, *_base); break; - case MKID_BE('FRME'): + case MKTAG('F','R','M','E'): handleFrame(subSize, *_base); break; default: diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 0051319151..54f35c1969 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -206,7 +206,7 @@ void Sound::playSound(int soundID) { // Support for SFX in Monkey Island 1, Mac version // This is rather hackish right now, but works OK. SFX are not sounding // 100% correct, though, not sure right now what is causing this. - else if (READ_BE_UINT32(ptr) == MKID_BE('Mac1')) { + else if (READ_BE_UINT32(ptr) == MKTAG('M','a','c','1')) { // Read info from the header size = READ_BE_UINT32(ptr+0x60); rate = READ_BE_UINT16(ptr+0x64); @@ -245,7 +245,7 @@ void Sound::playSound(int soundID) { _mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID); } // Support for sampled sound effects in Monkey Island 1 and 2 - else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKID_BE('SBL ')) { + else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','B','L',' ')) { debugC(DEBUG_SOUND, "Using SBL sound effect"); // SBL resources essentially contain VOC sound data. @@ -316,7 +316,7 @@ void Sound::playSound(int soundID) { stream = Audio::makeRawStream(sound, size, rate, Audio::FLAG_UNSIGNED); _mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID); } - else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKID_BE('SOUN')) { + else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','O','U','N')) { if (_vm->_game.version != 3) ptr += 2; @@ -415,7 +415,7 @@ void Sound::playSound(int soundID) { // Rather it seems that starting a new music is supposed to // automatically stop the old song. if (_vm->_imuse) { - if (READ_BE_UINT32(ptr) != MKID_BE('ASFX')) + if (READ_BE_UINT32(ptr) != MKTAG('A','S','F','X')) _vm->_imuse->stopAllSounds(); } } @@ -1090,15 +1090,15 @@ int ScummEngine::readSoundResource(int idx) { debugC(DEBUG_RESOURCE, " basetag: %s, total_size=%d", tag2str(basetag), total_size); switch (basetag) { - case MKID_BE('MIDI'): - case MKID_BE('iMUS'): + case MKTAG('M','I','D','I'): + case MKTAG('i','M','U','S'): if (_musicType != MDT_PCSPK && _musicType != MDT_PCJR) { _fileHandle->seek(-8, SEEK_CUR); _fileHandle->read(_res->createResource(rtSound, idx, total_size + 8), total_size + 8); return 1; } break; - case MKID_BE('SOU '): + case MKTAG('S','O','U',' '): best_pri = -1; while (pos < total_size) { tag = _fileHandle->readUint32BE(); @@ -1108,32 +1108,32 @@ int ScummEngine::readSoundResource(int idx) { pri = -1; switch (tag) { - case MKID_BE('TOWS'): + case MKTAG('T','O','W','S'): pri = 16; break; - case MKID_BE('SBL '): + case MKTAG('S','B','L',' '): pri = 15; break; - case MKID_BE('ADL '): + case MKTAG('A','D','L',' '): pri = 1; if (_musicType == MDT_ADLIB) pri = 10; break; - case MKID_BE('AMI '): + case MKTAG('A','M','I',' '): pri = 3; break; - case MKID_BE('ROL '): + case MKTAG('R','O','L',' '): pri = 3; if (_native_mt32) pri = 5; break; - case MKID_BE('GMD '): + case MKTAG('G','M','D',' '): pri = 4; break; - case MKID_BE('MAC '): // Occurs in Mac MI2, FOA + case MKTAG('M','A','C',' '): // Occurs in Mac MI2, FOA pri = 2; break; - case MKID_BE('SPK '): + case MKTAG('S','P','K',' '): pri = -1; // if (_musicType == MDT_PCSPK || _musicType == MDT_PCJR) // pri = 11; @@ -1163,7 +1163,7 @@ int ScummEngine::readSoundResource(int idx) { return 1; } break; - case MKID_BE('Mac0'): + case MKTAG('M','a','c','0'): _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE() - 8; ptr = (byte *)calloc(total_size, 1); @@ -1173,11 +1173,11 @@ int ScummEngine::readSoundResource(int idx) { free(ptr); return 1; - case MKID_BE('Mac1'): - case MKID_BE('RIFF'): - case MKID_BE('TALK'): - case MKID_BE('DIGI'): - case MKID_BE('Crea'): + case MKTAG('M','a','c','1'): + case MKTAG('R','I','F','F'): + case MKTAG('T','A','L','K'): + case MKTAG('D','I','G','I'): + case MKTAG('C','r','e','a'): case 0x460e200d: // WORKAROUND bug # 1311447 _fileHandle->seek(-12, SEEK_CUR); total_size = _fileHandle->readUint32BE(); @@ -1186,7 +1186,7 @@ int ScummEngine::readSoundResource(int idx) { //dumpResource("sound-", idx, ptr); return 1; - case MKID_BE('HSHD'): + case MKTAG('H','S','H','D'): // HE sound type without SOUN header _fileHandle->seek(-16, SEEK_CUR); total_size = max_total_size + 8; @@ -1195,7 +1195,7 @@ int ScummEngine::readSoundResource(int idx) { //dumpResource("sound-", idx, ptr); return 1; - case MKID_BE('FMUS'): { + case MKTAG('F','M','U','S'): { // Used in 3DO version of puttputt joins the parade and probably others // Specifies a separate file to be used for music from what I gather. int tmpsize; @@ -1406,20 +1406,20 @@ static byte *writeVLQ(byte *ptr, int value) { static byte Mac0ToGMInstrument(uint32 type, int &transpose) { transpose = 0; switch (type) { - case MKID_BE('MARI'): return 12; - case MKID_BE('PLUC'): return 45; - case MKID_BE('HARM'): return 22; - case MKID_BE('PIPE'): return 19; - case MKID_BE('TROM'): transpose = -12; return 57; - case MKID_BE('STRI'): return 48; - case MKID_BE('HORN'): return 60; - case MKID_BE('VIBE'): return 11; - case MKID_BE('SHAK'): return 77; - case MKID_BE('PANP'): return 75; - case MKID_BE('WHIS'): return 76; - case MKID_BE('ORGA'): return 17; - case MKID_BE('BONG'): return 115; - case MKID_BE('BASS'): transpose = -24; return 35; + case MKTAG('M','A','R','I'): return 12; + case MKTAG('P','L','U','C'): return 45; + case MKTAG('H','A','R','M'): return 22; + case MKTAG('P','I','P','E'): return 19; + case MKTAG('T','R','O','M'): transpose = -12; return 57; + case MKTAG('S','T','R','I'): return 48; + case MKTAG('H','O','R','N'): return 60; + case MKTAG('V','I','B','E'): return 11; + case MKTAG('S','H','A','K'): return 77; + case MKTAG('P','A','N','P'): return 75; + case MKTAG('W','H','I','S'): return 76; + case MKTAG('O','R','G','A'): return 17; + case MKTAG('B','O','N','G'): return 115; + case MKTAG('B','A','S','S'): transpose = -24; return 35; default: error("Unknown Mac0 instrument %s found", tag2str(type)); } @@ -1504,13 +1504,13 @@ static void convertMac0Resource(ResourceManager *res, int idx, byte *src_ptr, in // Parse the three channels for (i = 0; i < 3; i++) { - assert(READ_BE_UINT32(src_ptr) == MKID_BE('Chan')); + assert(READ_BE_UINT32(src_ptr) == MKTAG('C','h','a','n')); len = READ_BE_UINT32(src_ptr + 4); track_len[i] = len - 24; track_instr[i] = Mac0ToGMInstrument(READ_BE_UINT32(src_ptr + 8), track_transpose[i]); track_data[i] = src_ptr + 12; src_ptr += len; - looped = (READ_BE_UINT32(src_ptr - 8) == MKID_BE('Loop')); + looped = (READ_BE_UINT32(src_ptr - 8) == MKTAG('L','o','o','p')); // For each note event, we need up to 6 bytes for the // Note On (3 VLQ, 3 event), and 6 bytes for the Note diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index e8f75dd901..6d5eb3fad7 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -1499,7 +1499,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { } imptr = getObjectImage(obim, 1); } else { - const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKID_BE('IMHD'), obim); + const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), obim); if (_game.version >= 7) { imgw = READ_LE_UINT16(&imhd->v7.width) / 8; imgh = READ_LE_UINT16(&imhd->v7.height) / 8; diff --git a/engines/sword1/control.h b/engines/sword1/control.h index a6ccb09a04..2e5bfc7197 100644 --- a/engines/sword1/control.h +++ b/engines/sword1/control.h @@ -44,7 +44,7 @@ class Mouse; class Music; class Sound; -#define SAVEGAME_HEADER MKID_BE('BS_1') +#define SAVEGAME_HEADER MKTAG('B','S','_','1') #define SAVEGAME_VERSION 2 #define MAX_BUTTONS 16 diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp index 24fd5b502f..1906fcb7fd 100644 --- a/engines/sword1/screen.cpp +++ b/engines/sword1/screen.cpp @@ -899,7 +899,7 @@ uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXr uint8 *fullres_buffer = (uint8 *)malloc(bakXres * (yresInTiles + 1) * 32); memset(fullres_buffer, 0, bakXres * (yresInTiles + 1) * 32); - bool isCompressed = (READ_LE_UINT32(psxBackground) == MKID_BE('COMP')); + bool isCompressed = (READ_LE_UINT32(psxBackground) == MKTAG('C','O','M','P')); totTiles -= xresInTiles; psxBackground += 4; //We skip the id tag diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 5fc2820986..a76d26eade 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -530,17 +530,17 @@ void SoundManager::openSampleFiles() { // Detect format of soundfile by looking at 1st sample-index switch (TO_BE_32(_sampleIndex[0])) { - case MKID_BE('MP3 '): + case MKTAG('M','P','3',' '): debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected MP3 sound-data"); _soundMode = kMP3Mode; break; - case MKID_BE('OGG '): + case MKTAG('O','G','G',' '): debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected OGG sound-data"); _soundMode = kVorbisMode; break; - case MKID_BE('FLAC'): + case MKTAG('F','L','A','C'): debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected FLAC sound-data"); _soundMode = kFLACMode; break; diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp index 376b1db621..0242ace7e3 100644 --- a/engines/toon/script.cpp +++ b/engines/toon/script.cpp @@ -70,7 +70,7 @@ EMCInterpreter::~EMCInterpreter() { bool EMCInterpreter::callback(Common::IFFChunk &chunk) { switch (chunk._type) { - case MKID_BE('TEXT'): + case MKTAG('T','E','X','T'): delete[] _scriptData->text; _scriptData->text = new byte[chunk._size]; assert(_scriptData->text); @@ -78,7 +78,7 @@ bool EMCInterpreter::callback(Common::IFFChunk &chunk) { error("Couldn't read TEXT chunk from file '%s'", _filename); break; - case MKID_BE('ORDR'): + case MKTAG('O','R','D','R'): delete[] _scriptData->ordr; _scriptData->ordr = new uint16[chunk._size >> 1]; assert(_scriptData->ordr); @@ -89,7 +89,7 @@ bool EMCInterpreter::callback(Common::IFFChunk &chunk) { _scriptData->ordr[i] = READ_BE_UINT16(&_scriptData->ordr[i]); break; - case MKID_BE('DATA'): + case MKTAG('D','A','T','A'): delete[] _scriptData->data; _scriptData->data = new uint16[chunk._size >> 1]; assert(_scriptData->data); diff --git a/engines/toon/script.h b/engines/toon/script.h index 2a74f9084f..b6d28e1171 100644 --- a/engines/toon/script.h +++ b/engines/toon/script.h @@ -87,9 +87,9 @@ public: // Both lead to some problems in our IFF parser, either reading after the end // of file or producing a "Chunk overread" error message. To work around this // we need to adjust the size field properly. - if (_formType == MKID_BE('EMC2')) + if (_formType == MKTAG('E','M','C','2')) _formChunk.size -= 8; - else if (_formType == MKID_BE('AVFS')) + else if (_formType == MKTAG('A','V','F','S')) _formChunk.size += 4; } }; diff --git a/graphics/dither.cpp b/graphics/dither.cpp index 6a37679b0a..5f423d1c7a 100644 --- a/graphics/dither.cpp +++ b/graphics/dither.cpp @@ -174,7 +174,7 @@ bool PaletteLUT::save(Common::WriteStream &stream) { while (_got < _dim1) buildNext(); - stream.writeUint32BE(MKID_BE('PLUT')); // Magic + stream.writeUint32BE(MKTAG('P','L','U','T')); // Magic stream.writeUint32BE(kVersion); stream.writeByte(_depth1); if (stream.write(_realPal, 768) != 768) @@ -200,7 +200,7 @@ bool PaletteLUT::load(Common::SeekableReadStream &stream) { return false; // Magic - if (stream.readUint32BE() != MKID_BE('PLUT')) + if (stream.readUint32BE() != MKTAG('P','L','U','T')) return false; if (stream.readUint32BE() != kVersion) diff --git a/graphics/jpeg.cpp b/graphics/jpeg.cpp index 5ddd675273..169c3b5f1b 100644 --- a/graphics/jpeg.cpp +++ b/graphics/jpeg.cpp @@ -226,7 +226,7 @@ bool JPEG::read(Common::SeekableReadStream *stream) { bool JPEG::readJFIF() { uint16 length = _stream->readUint16BE(); uint32 tag = _stream->readUint32BE(); - if (tag != MKID_BE('JFIF')) { + if (tag != MKTAG('J','F','I','F')) { warning("JPEG::readJFIF() tag mismatch"); return false; } diff --git a/graphics/png.cpp b/graphics/png.cpp index 5292ea0100..eb066efa57 100644 --- a/graphics/png.cpp +++ b/graphics/png.cpp @@ -67,12 +67,12 @@ namespace Graphics { enum PNGChunks { // == Critical chunks ===================================================== - kChunkIHDR = MKID_BE('IHDR'), // Image header - kChunkIDAT = MKID_BE('IDAT'), // Image data - kChunkPLTE = MKID_BE('PLTE'), // Palette - kChunkIEND = MKID_BE('IEND'), // Image trailer + kChunkIHDR = MKTAG('I','H','D','R'), // Image header + kChunkIDAT = MKTAG('I','D','A','T'), // Image data + kChunkPLTE = MKTAG('P','L','T','E'), // Palette + kChunkIEND = MKTAG('I','E','N','D'), // Image trailer // == Ancillary chunks ==================================================== - kChunktRNS = MKID_BE('tRNS') // Transparency + kChunktRNS = MKTAG('t','R','N','S') // Transparency // All of the other ancillary chunks are ignored. They're added here for // reference only. // cHRM - Primary chromacities and white point diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index bb9f33aa26..c581f9b265 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -362,7 +362,7 @@ bool FontSjisSVM::loadData() { uint32 magic1 = data->readUint32BE(); uint32 magic2 = data->readUint32BE(); - if (magic1 != MKID_BE('SCVM') || magic2 != MKID_BE('SJIS')) { + if (magic1 != MKTAG('S','C','V','M') || magic2 != MKTAG('S','J','I','S')) { delete data; return false; } diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index b245cfc5fa..8688096c3d 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -49,7 +49,7 @@ bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool ou // We also accept the bad 'BMHT' header here, for the sake of compatibility // with some older savegames which were written incorrectly due to a bug in // ScummVM which wrote the thumb header type incorrectly on LE systems. - if (header.type != MKID_BE('THMB') && header.type != MKID_BE('BMHT')) { + if (header.type != MKTAG('T','H','M','B') && header.type != MKTAG('B','M','H','T')) { if (outputWarnings) warning("couldn't find thumbnail header type"); return false; @@ -145,7 +145,7 @@ bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) { } ThumbnailHeader header; - header.type = MKID_BE('THMB'); + header.type = MKTAG('T','H','M','B'); header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel; header.version = THMB_VERSION; header.width = thumb.w; diff --git a/video/avi_decoder.h b/video/avi_decoder.h index c2551454db..33189910c7 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -37,35 +37,35 @@ namespace Video { // IDs used throughout the AVI files // that will be handled by this player -#define ID_RIFF MKID_BE('RIFF') -#define ID_AVI MKID_BE('AVI ') -#define ID_LIST MKID_BE('LIST') -#define ID_HDRL MKID_BE('hdrl') -#define ID_AVIH MKID_BE('avih') -#define ID_STRL MKID_BE('strl') -#define ID_STRH MKID_BE('strh') -#define ID_VIDS MKID_BE('vids') -#define ID_AUDS MKID_BE('auds') -#define ID_MIDS MKID_BE('mids') -#define ID_TXTS MKID_BE('txts') -#define ID_JUNK MKID_BE('JUNK') -#define ID_STRF MKID_BE('strf') -#define ID_MOVI MKID_BE('movi') -#define ID_REC MKID_BE('rec ') -#define ID_VEDT MKID_BE('vedt') -#define ID_IDX1 MKID_BE('idx1') -#define ID_STRD MKID_BE('strd') -#define ID_00AM MKID_BE('00AM') -//#define ID_INFO MKID_BE('INFO') +#define ID_RIFF MKTAG('R','I','F','F') +#define ID_AVI MKTAG('A','V','I',' ') +#define ID_LIST MKTAG('L','I','S','T') +#define ID_HDRL MKTAG('h','d','r','l') +#define ID_AVIH MKTAG('a','v','i','h') +#define ID_STRL MKTAG('s','t','r','l') +#define ID_STRH MKTAG('s','t','r','h') +#define ID_VIDS MKTAG('v','i','d','s') +#define ID_AUDS MKTAG('a','u','d','s') +#define ID_MIDS MKTAG('m','i','d','s') +#define ID_TXTS MKTAG('t','x','t','s') +#define ID_JUNK MKTAG('J','U','N','K') +#define ID_STRF MKTAG('s','t','r','f') +#define ID_MOVI MKTAG('m','o','v','i') +#define ID_REC MKTAG('r','e','c',' ') +#define ID_VEDT MKTAG('v','e','d','t') +#define ID_IDX1 MKTAG('i','d','x','1') +#define ID_STRD MKTAG('s','t','r','d') +#define ID_00AM MKTAG('0','0','A','M') +//#define ID_INFO MKTAG('I','N','F','O') // Codec tags -#define ID_RLE MKID_BE('RLE ') -#define ID_CRAM MKID_BE('CRAM') -#define ID_MSVC MKID_BE('msvc') -#define ID_WHAM MKID_BE('WHAM') -#define ID_CVID MKID_BE('cvid') -#define ID_IV32 MKID_BE('iv32') -#define ID_DUCK MKID_BE('DUCK') +#define ID_RLE MKTAG('R','L','E',' ') +#define ID_CRAM MKTAG('C','R','A','M') +#define ID_MSVC MKTAG('m','s','v','c') +#define ID_WHAM MKTAG('W','H','A','M') +#define ID_CVID MKTAG('c','v','i','d') +#define ID_IV32 MKTAG('i','v','3','2') +#define ID_DUCK MKTAG('D','U','C','K') struct BITMAPINFOHEADER { uint32 size; diff --git a/video/codecs/cdtoons.cpp b/video/codecs/cdtoons.cpp index eaa8f53602..bdca5f9c80 100644 --- a/video/codecs/cdtoons.cpp +++ b/video/codecs/cdtoons.cpp @@ -170,7 +170,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea nextPos += size; switch (tag) { - case MKID_BE('Diff'): + case MKTAG('D','i','f','f'): { debugN(5, "CDToons: Diff\n"); uint16 count = stream->readUint16BE(); @@ -206,7 +206,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea } } break; - case MKID_BE('XFrm'): + case MKTAG('X','F','r','m'): { debugN(5, "CDToons: XFrm\n"); if (!(flags & 0x10)) @@ -229,7 +229,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea dirtyRect2XFrm.left, dirtyRect2XFrm.top, dirtyRect2XFrm.right, dirtyRect2XFrm.bottom); } break; - case MKID_BE('Mrks'): + case MKTAG('M','r','k','s'): debugN(5, "CDToons: Mrks\n"); if (!(flags & 0x2)) error("CDToons: useless Mrks?"); @@ -237,14 +237,14 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea // TODO warning("CDToons: encountered Mrks, not implemented yet"); break; - case MKID_BE('Scal'): + case MKTAG('S','c','a','l'): // TODO warning("CDToons: encountered Scal, not implemented yet"); break; - case MKID_BE('WrMp'): + case MKTAG('W','r','M','p'): warning("CDToons: encountered WrMp, ignoring"); break; - case MKID_BE('FrtR'): + case MKTAG('F','r','t','R'): { debugN(5, "CDToons: FrtR\n"); if (!(flags & 0x40)) @@ -259,7 +259,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea } } break; - case MKID_BE('BckR'): + case MKTAG('B','c','k','R'): { debugN(5, "CDToons: BckR\n"); if (!(flags & 0x20)) diff --git a/video/codecs/indeo3.cpp b/video/codecs/indeo3.cpp index d9dde1e8e5..e7f470bd3a 100644 --- a/video/codecs/indeo3.cpp +++ b/video/codecs/indeo3.cpp @@ -85,7 +85,7 @@ bool Indeo3Decoder::isIndeo3(Common::SeekableReadStream &stream) { return false; // These 4 uint32s XOR'd need to spell "FRMH" - if ((id0 ^ id1 ^ id2 ^ id3) != MKID_BE('FRMH')) + if ((id0 ^ id1 ^ id2 ^ id3) != MKTAG('F','R','M','H')) return false; return true; diff --git a/video/codecs/qdm2.cpp b/video/codecs/qdm2.cpp index 762f56b3d7..61e59c8aba 100644 --- a/video/codecs/qdm2.cpp +++ b/video/codecs/qdm2.cpp @@ -1769,14 +1769,14 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadS tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraTag: %d", tmp); - if (tmp != MKID_BE('frma')) + if (tmp != MKTAG('f','r','m','a')) warning("QDM2Stream::QDM2Stream() extraTag mismatch"); tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraType: %d", tmp); - if (tmp == MKID_BE('QDMC')) + if (tmp == MKTAG('Q','D','M','C')) warning("QDM2Stream::QDM2Stream() QDMC stream type not supported"); - else if (tmp != MKID_BE('QDM2')) + else if (tmp != MKTAG('Q','D','M','2')) error("QDM2Stream::QDM2Stream() Unsupported stream type"); tmp_s = extraData->readSint32BE(); @@ -1786,7 +1786,7 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadS tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraTag2: %d", tmp); - if (tmp != MKID_BE('QDCA')) + if (tmp != MKTAG('Q','D','C','A')) warning("QDM2Stream::QDM2Stream() extraTag2 mismatch"); if (extraData->readUint32BE() != 1) @@ -1818,7 +1818,7 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadS tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraTag3: %d", tmp); - if (tmp != MKID_BE('QDCP')) + if (tmp != MKTAG('Q','D','C','P')) warning("QDM2Stream::QDM2Stream() extraTag3 mismatch"); if ((float)extraData->readUint32BE() != 1.0) diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index b2d64bfb3c..a755d18bb0 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -36,7 +36,7 @@ #include "audio/decoders/raw.h" #include "common/memstream.h" -static const uint32 kVideoCodecIndeo3 = MKID_BE('iv32'); +static const uint32 kVideoCodecIndeo3 = MKTAG('i','v','3','2'); namespace Video { diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp index 62c2622437..a64b8f6fee 100644 --- a/video/dxa_decoder.cpp +++ b/video/dxa_decoder.cpp @@ -73,7 +73,7 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) { _fileStream = stream; uint32 tag = _fileStream->readUint32BE(); - assert(tag == MKID_BE('DEXA')); + assert(tag == MKTAG('D','E','X','A')); uint8 flags = _fileStream->readByte(); _frameCount = _fileStream->readUint16BE(); @@ -136,7 +136,7 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) { switch (tag) { case 0: // No more tags break; - case MKID_BE('MAXD'): + case MKTAG('M','A','X','D'): assert(size == 4); _decompBufferSize = _fileStream->readUint32BE(); break; @@ -479,13 +479,13 @@ void DXADecoder::decode13(int size) { const Graphics::Surface *DXADecoder::decodeNextFrame() { uint32 tag = _fileStream->readUint32BE(); - if (tag == MKID_BE('CMAP')) { + if (tag == MKTAG('C','M','A','P')) { _fileStream->read(_palette, 256 * 3); _dirtyPalette = true; } tag = _fileStream->readUint32BE(); - if (tag == MKID_BE('FRAM')) { + if (tag == MKTAG('F','R','A','M')) { byte type = _fileStream->readByte(); uint32 size = _fileStream->readUint32BE(); if ((_inBuffer == NULL) || (_inBufferSize < size)) { diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp index a277d6bbde..826b7bfcaf 100644 --- a/video/qt_decoder.cpp +++ b/video/qt_decoder.cpp @@ -267,28 +267,28 @@ void QuickTimeDecoder::seekToTime(Audio::Timestamp time) { } Codec *QuickTimeDecoder::createCodec(uint32 codecTag, byte bitsPerPixel) { - if (codecTag == MKID_BE('cvid')) { + if (codecTag == MKTAG('c','v','i','d')) { // Cinepak: As used by most Myst and all Riven videos as well as some Myst ME videos. "The Chief" videos also use this. return new CinepakDecoder(bitsPerPixel); - } else if (codecTag == MKID_BE('rpza')) { + } else if (codecTag == MKTAG('r','p','z','a')) { // Apple Video ("Road Pizza"): Used by some Myst videos. return new RPZADecoder(getWidth(), getHeight()); - } else if (codecTag == MKID_BE('rle ')) { + } else if (codecTag == MKTAG('r','l','e',' ')) { // QuickTime RLE: Used by some Myst ME videos. return new QTRLEDecoder(getWidth(), getHeight(), bitsPerPixel); - } else if (codecTag == MKID_BE('smc ')) { + } else if (codecTag == MKTAG('s','m','c',' ')) { // Apple SMC: Used by some Myst videos. return new SMCDecoder(getWidth(), getHeight()); - } else if (codecTag == MKID_BE('SVQ1')) { + } else if (codecTag == MKTAG('S','V','Q','1')) { // Sorenson Video 1: Used by some Myst ME videos. warning("Sorenson Video 1 not yet supported"); - } else if (codecTag == MKID_BE('SVQ3')) { + } else if (codecTag == MKTAG('S','V','Q','3')) { // Sorenson Video 3: Used by some Myst ME videos. warning("Sorenson Video 3 not yet supported"); - } else if (codecTag == MKID_BE('jpeg')) { + } else if (codecTag == MKTAG('j','p','e','g')) { // Motion JPEG: Used by some Myst ME 10th Anniversary videos. return new JPEGDecoder(); - } else if (codecTag == MKID_BE('QkBk')) { + } else if (codecTag == MKTAG('Q','k','B','k')) { // CDToons: Used by most of the Broderbund games. return new CDToonsDecoder(getWidth(), getHeight()); } else { @@ -424,10 +424,10 @@ bool QuickTimeDecoder::loadFile(const Common::String &filename) { if (_resFork->hasResFork()) { // Search for a 'moov' resource - Common::MacResIDArray idArray = _resFork->getResIDArray(MKID_BE('moov')); + Common::MacResIDArray idArray = _resFork->getResIDArray(MKTAG('m','o','o','v')); if (!idArray.empty()) - _fd = _resFork->getResource(MKID_BE('moov'), idArray[0]); + _fd = _resFork->getResource(MKTAG('m','o','o','v'), idArray[0]); if (_fd) { atom.size = _fd->size(); @@ -507,7 +507,7 @@ void QuickTimeDecoder::init() { _curAudioChunk = 0; // Make sure the bits per sample transfers to the sample size - if (entry->codecTag == MKID_BE('raw ') || entry->codecTag == MKID_BE('twos')) + if (entry->codecTag == MKTAG('r','a','w',' ') || entry->codecTag == MKTAG('t','w','o','s')) _streams[_audioStreamIndex]->sample_size = (entry->bitsPerSample / 8) * entry->channels; startAudio(); @@ -533,31 +533,31 @@ void QuickTimeDecoder::init() { void QuickTimeDecoder::initParseTable() { static const ParseTable p[] = { - { &QuickTimeDecoder::readDefault, MKID_BE('dinf') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('dref') }, - { &QuickTimeDecoder::readDefault, MKID_BE('edts') }, - { &QuickTimeDecoder::readELST, MKID_BE('elst') }, - { &QuickTimeDecoder::readHDLR, MKID_BE('hdlr') }, - { &QuickTimeDecoder::readDefault, MKID_BE('mdat') }, - { &QuickTimeDecoder::readMDHD, MKID_BE('mdhd') }, - { &QuickTimeDecoder::readDefault, MKID_BE('mdia') }, - { &QuickTimeDecoder::readDefault, MKID_BE('minf') }, - { &QuickTimeDecoder::readMOOV, MKID_BE('moov') }, - { &QuickTimeDecoder::readMVHD, MKID_BE('mvhd') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('smhd') }, - { &QuickTimeDecoder::readDefault, MKID_BE('stbl') }, - { &QuickTimeDecoder::readSTCO, MKID_BE('stco') }, - { &QuickTimeDecoder::readSTSC, MKID_BE('stsc') }, - { &QuickTimeDecoder::readSTSD, MKID_BE('stsd') }, - { &QuickTimeDecoder::readSTSS, MKID_BE('stss') }, - { &QuickTimeDecoder::readSTSZ, MKID_BE('stsz') }, - { &QuickTimeDecoder::readSTTS, MKID_BE('stts') }, - { &QuickTimeDecoder::readTKHD, MKID_BE('tkhd') }, - { &QuickTimeDecoder::readTRAK, MKID_BE('trak') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('udta') }, - { &QuickTimeDecoder::readLeaf, MKID_BE('vmhd') }, - { &QuickTimeDecoder::readCMOV, MKID_BE('cmov') }, - { &QuickTimeDecoder::readWAVE, MKID_BE('wave') }, + { &QuickTimeDecoder::readDefault, MKTAG('d','i','n','f') }, + { &QuickTimeDecoder::readLeaf, MKTAG('d','r','e','f') }, + { &QuickTimeDecoder::readDefault, MKTAG('e','d','t','s') }, + { &QuickTimeDecoder::readELST, MKTAG('e','l','s','t') }, + { &QuickTimeDecoder::readHDLR, MKTAG('h','d','l','r') }, + { &QuickTimeDecoder::readDefault, MKTAG('m','d','a','t') }, + { &QuickTimeDecoder::readMDHD, MKTAG('m','d','h','d') }, + { &QuickTimeDecoder::readDefault, MKTAG('m','d','i','a') }, + { &QuickTimeDecoder::readDefault, MKTAG('m','i','n','f') }, + { &QuickTimeDecoder::readMOOV, MKTAG('m','o','o','v') }, + { &QuickTimeDecoder::readMVHD, MKTAG('m','v','h','d') }, + { &QuickTimeDecoder::readLeaf, MKTAG('s','m','h','d') }, + { &QuickTimeDecoder::readDefault, MKTAG('s','t','b','l') }, + { &QuickTimeDecoder::readSTCO, MKTAG('s','t','c','o') }, + { &QuickTimeDecoder::readSTSC, MKTAG('s','t','s','c') }, + { &QuickTimeDecoder::readSTSD, MKTAG('s','t','s','d') }, + { &QuickTimeDecoder::readSTSS, MKTAG('s','t','s','s') }, + { &QuickTimeDecoder::readSTSZ, MKTAG('s','t','s','z') }, + { &QuickTimeDecoder::readSTTS, MKTAG('s','t','t','s') }, + { &QuickTimeDecoder::readTKHD, MKTAG('t','k','h','d') }, + { &QuickTimeDecoder::readTRAK, MKTAG('t','r','a','k') }, + { &QuickTimeDecoder::readLeaf, MKTAG('u','d','t','a') }, + { &QuickTimeDecoder::readLeaf, MKTAG('v','m','h','d') }, + { &QuickTimeDecoder::readCMOV, MKTAG('c','m','o','v') }, + { &QuickTimeDecoder::readWAVE, MKTAG('w','a','v','e') }, { 0, 0 } }; @@ -581,7 +581,7 @@ int QuickTimeDecoder::readDefault(MOVatom atom) { // Some QuickTime videos with resource forks have mdat chunks // that are of size 0. Adjust it so it's the correct size. - if (a.type == MKID_BE('mdat') && a.size == 0) + if (a.type == MKTAG('m','d','a','t') && a.size == 0) a.size = _fd->size(); } @@ -654,16 +654,16 @@ int QuickTimeDecoder::readCMOV(MOVatom atom) { #ifdef USE_ZLIB // Read in the dcom atom _fd->readUint32BE(); - if (_fd->readUint32BE() != MKID_BE('dcom')) + if (_fd->readUint32BE() != MKTAG('d','c','o','m')) return -1; - if (_fd->readUint32BE() != MKID_BE('zlib')) { + if (_fd->readUint32BE() != MKTAG('z','l','i','b')) { warning("Unknown cmov compression type"); return -1; } // Read in the cmvd atom uint32 compressedSize = _fd->readUint32BE() - 12; - if (_fd->readUint32BE() != MKID_BE('cmvd')) + if (_fd->readUint32BE() != MKTAG('c','m','v','d')) return -1; uint32 uncompressedSize = _fd->readUint32BE(); @@ -688,7 +688,7 @@ int QuickTimeDecoder::readCMOV(MOVatom atom) { _fd = new Common::MemoryReadStream(uncompressedData, uncompressedSize, DisposeAfterUse::YES); // Read the contents of the uncompressed data - MOVatom a = { MKID_BE('moov'), 0, uncompressedSize }; + MOVatom a = { MKTAG('m','o','o','v'), 0, uncompressedSize }; int err = readDefault(a); // Assign the file handle back to the original handle @@ -857,16 +857,16 @@ int QuickTimeDecoder::readHDLR(MOVatom atom) { debug(0, "ctype= %s (0x%08lx)", tag2str(ctype), (long)ctype); debug(0, "stype= %s", tag2str(type)); - if(ctype == MKID_BE('mhlr')) // MOV + if(ctype == MKTAG('m','h','l','r')) // MOV debug(0, "MOV detected"); else if(ctype == 0) { warning("MP4 streams are not supported"); return -1; } - if (type == MKID_BE('vide')) + if (type == MKTAG('v','i','d','e')) st->codec_type = CODEC_TYPE_VIDEO; - else if (type == MKID_BE('soun')) + else if (type == MKTAG('s','o','u','n')) st->codec_type = CODEC_TYPE_AUDIO; _fd->readUint32BE(); // component manufacture @@ -1058,7 +1058,7 @@ int QuickTimeDecoder::readSTSD(MOVatom atom) { // Version 0 videos (such as the Riven ones) don't have this set, // but we need it later on. Add it in here. - if (format == MKID_BE('ima4')) { + if (format == MKTAG('i','m','a','4')) { entry->samplesPerFrame = 64; entry->bytesPerFrame = 34 * entry->channels; } @@ -1231,7 +1231,7 @@ int QuickTimeDecoder::readWAVE(MOVatom atom) { if (atom.size > (1 << 30)) return -1; - if (st->stsdEntries[0].codecTag == MKID_BE('QDM2')) // Read extradata for QDM2 + if (st->stsdEntries[0].codecTag == MKTAG('Q','D','M','2')) // Read extradata for QDM2 st->extradata = _fd->readStream(atom.size - 8); else if (atom.size > 8) return readDefault(atom); @@ -1318,11 +1318,11 @@ Common::SeekableReadStream *QuickTimeDecoder::getNextFramePacket(uint32 &descId) bool QuickTimeDecoder::checkAudioCodecSupport(uint32 tag) { // Check if the codec is a supported codec - if (tag == MKID_BE('twos') || tag == MKID_BE('raw ') || tag == MKID_BE('ima4')) + if (tag == MKTAG('t','w','o','s') || tag == MKTAG('r','a','w',' ') || tag == MKTAG('i','m','a','4')) return true; #ifdef VIDEO_CODECS_QDM2_H - if (tag == MKID_BE('QDM2')) + if (tag == MKTAG('Q','D','M','2')) return true; #endif @@ -1337,10 +1337,10 @@ Audio::AudioStream *QuickTimeDecoder::createAudioStream(Common::SeekableReadStre STSDEntry *entry = &_streams[_audioStreamIndex]->stsdEntries[0]; - if (entry->codecTag == MKID_BE('twos') || entry->codecTag == MKID_BE('raw ')) { + if (entry->codecTag == MKTAG('t','w','o','s') || entry->codecTag == MKTAG('r','a','w',' ')) { // Fortunately, most of the audio used in Myst videos is raw... uint16 flags = 0; - if (entry->codecTag == MKID_BE('raw ')) + if (entry->codecTag == MKTAG('r','a','w',' ')) flags |= Audio::FLAG_UNSIGNED; if (entry->channels == 2) flags |= Audio::FLAG_STEREO; @@ -1351,11 +1351,11 @@ Audio::AudioStream *QuickTimeDecoder::createAudioStream(Common::SeekableReadStre stream->read(data, dataSize); delete stream; return Audio::makeRawStream(data, dataSize, entry->sampleRate, flags); - } else if (entry->codecTag == MKID_BE('ima4')) { + } else if (entry->codecTag == MKTAG('i','m','a','4')) { // Riven uses this codec (as do some Myst ME videos) return Audio::makeADPCMStream(stream, DisposeAfterUse::YES, stream->size(), Audio::kADPCMApple, entry->sampleRate, entry->channels, 34); #ifdef VIDEO_CODECS_QDM2_H - } else if (entry->codecTag == MKID_BE('QDM2')) { + } else if (entry->codecTag == MKTAG('Q','D','M','2')) { // Several Myst ME videos use this codec return makeQDM2Stream(stream, _streams[_audioStreamIndex]->extradata); #endif diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index a9f2eeeb5b..760d0045d9 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -379,13 +379,13 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) { _header.signature = _fileStream->readUint32BE(); // No BINK support available - if (_header.signature == MKID_BE('BIKi')) { + if (_header.signature == MKTAG('B','I','K','i')) { delete _fileStream; _fileStream = 0; return false; } - assert(_header.signature == MKID_BE('SMK2') || _header.signature == MKID_BE('SMK4')); + assert(_header.signature == MKTAG('S','M','K','2') || _header.signature == MKTAG('S','M','K','4')); uint32 width = _fileStream->readUint32LE(); uint32 height = _fileStream->readUint32LE(); @@ -615,7 +615,7 @@ const Graphics::Surface *SmackerDecoder::decodeNextFrame() { break; case SMK_BLOCK_FULL: // Smacker v2 has one mode, Smacker v4 has three - if (_header.signature == MKID_BE('SMK2')) { + if (_header.signature == MKTAG('S','M','K','2')) { mode = 0; } else { // 00 - mode 0 |