diff options
author | Strangerke | 2016-12-04 15:28:04 -0800 |
---|---|---|
committer | Eugene Sandulenko | 2017-01-25 22:42:11 +0100 |
commit | 3b379c1834271f4b98ada9b6d0fb00bc27ff5e2f (patch) | |
tree | fb1c8d1c966a44a4d1f525558c31ee8aa8e38d6e /engines/cryo | |
parent | 0c18e81ff2a975ef1ab6464a1bef39450a2db850 (diff) | |
download | scummvm-rg350-3b379c1834271f4b98ada9b6d0fb00bc27ff5e2f.tar.gz scummvm-rg350-3b379c1834271f4b98ada9b6d0fb00bc27ff5e2f.tar.bz2 scummvm-rg350-3b379c1834271f4b98ada9b6d0fb00bc27ff5e2f.zip |
CRYO: Get rid of PLE32, start using MKTAG16
Diffstat (limited to 'engines/cryo')
-rw-r--r-- | engines/cryo/cryolib.h | 1 | ||||
-rw-r--r-- | engines/cryo/eden.cpp | 20 | ||||
-rw-r--r-- | engines/cryo/video.cpp | 18 |
3 files changed, 19 insertions, 20 deletions
diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h index 7986155cdf..bf1d9e2174 100644 --- a/engines/cryo/cryolib.h +++ b/engines/cryo/cryolib.h @@ -47,7 +47,6 @@ class CryoEngine; #define BE16(n) SW16(n) #define BE32(n) SW32(n) #endif -#define PLE32(p) ( (((byte*)(p))[3] << 24) | (((byte*)(p))[2] << 16) | (((byte*)(p))[1] << 8) | ((byte*)(p))[0] ) enum { fsFromStart = 1 diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 6f8d6bc3cf..9471b355ab 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4681,8 +4681,8 @@ void EdenGame::loadFile(uint16 num, void *buffer) { assert(num < bigfile_header->count); pakfile_t *file = &bigfile_header->files[num]; - int32 size = PLE32(&file->size); - int32 offs = PLE32(&file->offs); + int32 size = READ_LE_UINT32(&file->size); + int32 offs = READ_LE_UINT32(&file->offs); debug("* Loading resource %d (%s) at 0x%X, %d bytes", num, file->name, offs, size); h_bigfile.seek(offs, SEEK_SET); h_bigfile.read(buffer, size); @@ -4692,8 +4692,8 @@ void EdenGame::shnmfl(uint16 num) { unsigned int resNum = num - 1 + 485; assert(resNum < bigfile_header->count); pakfile_t *file = &bigfile_header->files[resNum]; - int size = PLE32(&file->size); - int offs = PLE32(&file->offs); + int size = READ_LE_UINT32(&file->size); + int offs = READ_LE_UINT32(&file->offs); debug("* Loading movie %d (%s) at 0x%X, %d bytes", num, file->name, (uint)offs, size); _hnmContext->_file->seek(offs, SEEK_SET); } @@ -4702,8 +4702,8 @@ int EdenGame::ssndfl(uint16 num) { unsigned int resNum = num - 1 + ((_vm->getPlatform() == Common::kPlatformDOS && _vm->isDemo()) ? 656 : 661); assert(resNum < bigfile_header->count); pakfile_t *file = &bigfile_header->files[resNum]; - int32 size = PLE32(&file->size); - int32 offs = PLE32(&file->offs); + int32 size = READ_LE_UINT32(&file->size); + int32 offs = READ_LE_UINT32(&file->offs); debug("* Loading sound %d (%s) at 0x%X, %d bytes", num, file->name, (uint)offs, size); if (_soundAllocated) { free(voiceSamplesBuffer); @@ -4836,7 +4836,7 @@ bool EdenGame::ReadDataSyncVOC(unsigned int num) { bool EdenGame::ReadDataSync(uint16 num) { if (_vm->getPlatform() == Common::kPlatformMacintosh) { - long pos = PLE32(gameLipsync + num * 4); + long pos = READ_LE_UINT32(gameLipsync + num * 4); long len = 1024; if (pos != -1) { loadpartoffile(1936, gameLipsync + 7260, pos, len); @@ -4850,7 +4850,7 @@ bool EdenGame::ReadDataSync(uint16 num) { void EdenGame::loadpartoffile(uint16 num, void *buffer, int32 pos, int32 len) { assert(num < bigfile_header->count); pakfile_t *file = &bigfile_header->files[num]; - int32 offs = PLE32(&file->offs); + int32 offs = READ_LE_UINT32(&file->offs); debug("* Loading partial resource %d (%s) at 0x%X(+0x%X), %d bytes", num, file->name, offs, pos, len); h_bigfile.seek(offs + pos, SEEK_SET); h_bigfile.read(buffer, len); @@ -6466,8 +6466,8 @@ void EdenGame::musicspy() { int EdenGame::loadmusicfile(int16 num) { pakfile_t *file = &bigfile_header->files[num + 435]; - int32 size = PLE32(&file->size); - int32 offs = PLE32(&file->offs); + int32 size = READ_LE_UINT32(&file->size); + int32 offs = READ_LE_UINT32(&file->offs); h_bigfile.seek(offs, SEEK_SET); int32 numread = size; if (numread > 0x140000) //TODO: const diff --git a/engines/cryo/video.cpp b/engines/cryo/video.cpp index 838a95b6b1..82fa70283b 100644 --- a/engines/cryo/video.cpp +++ b/engines/cryo/video.cpp @@ -371,7 +371,7 @@ void HnmPlayer::decompUBA(byte *output, byte *curr_buffer, byte *prev_buffer, by //HNM4 classic int twolinesabove = -(width * 2); for (;;) { - code = PLE32(input) & 0xFFFFFF; //input++; + code = READ_LE_UINT32(input) & 0xFFFFFF; //input++; count = code & 0x1F; if (count) { input += 3; @@ -431,7 +431,7 @@ void HnmPlayer::decompUBA(byte *output, byte *curr_buffer, byte *prev_buffer, by assert(0); //HNM4 hires for (;;) { - code = PLE32(input) & 0xFFFFFF; + code = READ_LE_UINT32(input) & 0xFFFFFF; input++; count = code & 0x3F; if (count) { @@ -472,9 +472,9 @@ bool HnmPlayer::nextElement(hnm_t *hnm) { return false; for (;;) { - int sz = PLE32(hnm->_dataPtr) & 0xFFFFFF; + int sz = READ_LE_UINT32(hnm->_dataPtr) & 0xFFFFFF; hnm->_dataPtr += 4; - int16 id = *(int16 *)hnm->_dataPtr; + int16 id = READ_LE_UINT16(hnm->_dataPtr); hnm->_dataPtr += 2; char h6 = *hnm->_dataPtr; hnm->_dataPtr += 1; @@ -482,11 +482,11 @@ bool HnmPlayer::nextElement(hnm_t *hnm) { hnm->_dataPtr += 1; hnm->_chunkId = id; switch (id) { - case BE16('PL'): + case MKTAG16('L', 'P'): changePalette(hnm); hnm->_dataPtr += sz - 8; break; - case BE16('IZ'): + case MKTAG16('Z', 'I'): hnm->_frameNum++; selectBuffers(hnm); decompLempelZiv(hnm->_dataPtr + 4, hnm->_newFrameBuffer); @@ -519,7 +519,7 @@ bool HnmPlayer::nextElement(hnm_t *hnm) { } return true; - case BE16('IU'): + case MKTAG16('U', 'I'): hnm->_frameNum++; selectBuffers(hnm); decompUBA(hnm->_newFrameBuffer, hnm->_newFrameBuffer, hnm->_oldFrameBuffer, hnm->_dataPtr, hnm->_header._width, h6); @@ -533,8 +533,8 @@ bool HnmPlayer::nextElement(hnm_t *hnm) { } return true; - case BE16('sd'): - case BE16('SD'): + case MKTAG16('d', 's'): + case MKTAG16('D', 'S'): if (_useSound) { if (!h6) { int sound_size = sz - 8; |