aboutsummaryrefslogtreecommitdiff
path: root/engines/cryo
diff options
context:
space:
mode:
authorCameron Cawley2019-11-08 20:24:57 +0000
committerFilippos Karapetis2019-11-09 01:08:14 +0200
commitb2452d6ffde98777353b2e2d9fcfd2de66d5a28b (patch)
treeef3d6ad8440c1817f0e9d56d33dd9aefac4479d2 /engines/cryo
parent8ac0012fdde8fe0c380ecbff649bc32cff7a2a28 (diff)
downloadscummvm-rg350-b2452d6ffde98777353b2e2d9fcfd2de66d5a28b.tar.gz
scummvm-rg350-b2452d6ffde98777353b2e2d9fcfd2de66d5a28b.tar.bz2
scummvm-rg350-b2452d6ffde98777353b2e2d9fcfd2de66d5a28b.zip
CRYO: Use byteswap functions from common/endian.h
Diffstat (limited to 'engines/cryo')
-rw-r--r--engines/cryo/cryolib.h16
-rw-r--r--engines/cryo/resource.cpp8
-rw-r--r--engines/cryo/video.cpp4
3 files changed, 6 insertions, 22 deletions
diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h
index 83fdfee236..4a7ca01fcc 100644
--- a/engines/cryo/cryolib.h
+++ b/engines/cryo/cryolib.h
@@ -32,22 +32,6 @@ namespace Cryo {
class CryoEngine;
-#define SW16(n) ( (((n) & 0xFF) << 8) | (((n) >> 8) & 0xFF) )
-#define SW32(n) ( (((n) & 0xFF) << 24) | (((n) >> 24) & 0xFF) | (((n) & 0xFF00) << 8) | (((n) >> 8) & 0xFF00))
-#ifdef SCUMM_BIG_ENDIAN
-//big-endian host
-#define LE16(n) SW16(n)
-#define LE32(n) SW32(n)
-#define BE16(n) (n)
-#define BE32(n) (n)
-#else
-//little-endian host
-#define LE16(n) (n)
-#define LE32(n) (n)
-#define BE16(n) SW16(n)
-#define BE32(n) SW32(n)
-#endif
-
enum {
fsFromStart = 1
};
diff --git a/engines/cryo/resource.cpp b/engines/cryo/resource.cpp
index ccc1e738f0..3dbfbc4eb1 100644
--- a/engines/cryo/resource.cpp
+++ b/engines/cryo/resource.cpp
@@ -234,13 +234,13 @@ int EdenGame::loadSound(uint16 num) {
uint32 val = 0;
_bigfile.read(&val, 3);
- unsigned int chunkLen = LE32(val);
+ unsigned int chunkLen = FROM_LE_32(val);
if (chunkType == 5) {
_bigfile.read(_gameLipsync + 7260, chunkLen);
chunkType = _bigfile.readByte();
_bigfile.read(&val, 3);
- chunkLen = LE32(val);
+ chunkLen = FROM_LE_32(val);
}
// 3. Normal sound data
@@ -259,7 +259,7 @@ void EdenGame::convertMacToPC() {
// Array of longs
int *p = (int *)_gameLipsync;
for (int i = 0; i < 7240 / 4; i++)
- p[i] = BE32(p[i]);
+ p[i] = FROM_BE_32(p[i]);
}
void EdenGame::loadpermfiles() {
@@ -472,7 +472,7 @@ bool EdenGame::ReadDataSyncVOC(unsigned int num) {
uint32 chunkLen = 0;
loadpartoffile(resNum, &chunkLen, filePos, 3);
filePos += 3;
- chunkLen = LE32(chunkLen);
+ chunkLen = FROM_LE_32(chunkLen);
loadpartoffile(resNum, _gameLipsync + 7260, filePos, chunkLen);
return true;
}
diff --git a/engines/cryo/video.cpp b/engines/cryo/video.cpp
index fe8afb7ce8..81e3ee171d 100644
--- a/engines/cryo/video.cpp
+++ b/engines/cryo/video.cpp
@@ -129,7 +129,7 @@ void HnmPlayer::closeSound() {
void HnmPlayer::loadDecompTable(int16 *buffer) {
for (int16 i = 0; i < 256; i++) {
int16 e = *buffer++;
- decompTable[i] = LE16(e);
+ decompTable[i] = FROM_LE_16(e);
}
}
@@ -225,7 +225,7 @@ void HnmPlayer::tryRead(int size) {
bool HnmPlayer::loadFrame() {
tryRead(4);
int chunk = *(int *)_readBuffer;
- chunk = LE32(chunk);
+ chunk = FROM_LE_32(chunk);
chunk &= 0xFFFFFF; // upper bit - keyframe mark?
if (!chunk)
return false;