aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-09-12 20:26:54 +0000
committerMax Horn2003-09-12 20:26:54 +0000
commit2ce7c27f0b6bd7fc5166de0dcdedde7dea984655 (patch)
treec77191f7d101da32cdd0d0131be12429e7c80d23
parent9dc282f1d59c75f4aa0cbda6e85efd6ea30dc347 (diff)
downloadscummvm-rg350-2ce7c27f0b6bd7fc5166de0dcdedde7dea984655.tar.gz
scummvm-rg350-2ce7c27f0b6bd7fc5166de0dcdedde7dea984655.tar.bz2
scummvm-rg350-2ce7c27f0b6bd7fc5166de0dcdedde7dea984655.zip
properly fixed parallax layers in BE systems
svn-id: r10193
-rw-r--r--sword2/protocol.cpp18
-rw-r--r--sword2/resman.cpp50
2 files changed, 32 insertions, 36 deletions
diff --git a/sword2/protocol.cpp b/sword2/protocol.cpp
index 427ef04a4b..8901a69163 100644
--- a/sword2/protocol.cpp
+++ b/sword2/protocol.cpp
@@ -162,12 +162,6 @@ _parallax *FetchBackgroundParallaxLayer(uint8 *screenFile, int layer) // Chris 0
_parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[layer]);
-// FIXME: this shouldn't be here
-#if defined(SCUMM_BIG_ENDIAN)
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
-#endif
-
return parallax;
}
//---------------------------------------------------------------
@@ -182,12 +176,6 @@ _parallax *FetchBackgroundLayer(uint8 *screenFile) // Chris 04Oct96
_parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader));
-// FIXME: this shouldn't be here
-#if defined(SCUMM_BIG_ENDIAN)
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
-#endif
-
return parallax;
}
//---------------------------------------------------------------
@@ -202,12 +190,6 @@ _parallax *FetchForegroundParallaxLayer(uint8 *screenFile, int layer) // Chris 0
_parallax *parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[layer]);
-// FIXME: this shouldn't be here
-#if defined(SCUMM_BIG_ENDIAN)
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
-#endif
-
return parallax;
}
//---------------------------------------------------------------
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 7b667c2b85..87a67162b6 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -456,32 +456,46 @@ void resMan::convertEndian(uint8 *file) {
}
// FIXME: byte swapping should be done here instead of in protocol.cpp
-/*
+
// backgroundParallaxLayer
_parallax *parallax;
- parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[0]);
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
+ int offset;
+ offset = mscreenHeader->bg_parallax[0];
+ if (offset > 0) {
+ parallax = (_parallax *) ((uint8 *) mscreenHeader + offset);
+ parallax->w = SWAP_BYTES_16(parallax->w);
+ parallax->h = SWAP_BYTES_16(parallax->h);
+ }
- parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[1]);
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
+ offset = mscreenHeader->bg_parallax[1];
+ if (offset > 0) {
+ parallax = (_parallax *) ((uint8 *) mscreenHeader + offset);
+ parallax->w = SWAP_BYTES_16(parallax->w);
+ parallax->h = SWAP_BYTES_16(parallax->h);
+ }
// backgroundLayer
- parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader));
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
+ offset = mscreenHeader->screen + (int)sizeof(_screenHeader);
+ if (offset > 0) {
+ parallax = (_parallax *) ((uint8 *) mscreenHeader + offset);
+ parallax->w = SWAP_BYTES_16(parallax->w);
+ parallax->h = SWAP_BYTES_16(parallax->h);
+ }
// foregroundParallaxLayer
- parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[0]);
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
-
- parallax = (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[1]);
- parallax->w = SWAP_BYTES_16(parallax->w);
- parallax->h = SWAP_BYTES_16(parallax->h);
-*/
+ offset = mscreenHeader->fg_parallax[0];
+ if (offset > 0) {
+ parallax = (_parallax *) ((uint8 *) mscreenHeader + offset);
+ parallax->w = SWAP_BYTES_16(parallax->w);
+ parallax->h = SWAP_BYTES_16(parallax->h);
+ }
+ offset = mscreenHeader->fg_parallax[1];
+ if (offset > 0) {
+ parallax = (_parallax *) ((uint8 *) mscreenHeader + offset);
+ parallax->w = SWAP_BYTES_16(parallax->w);
+ parallax->h = SWAP_BYTES_16(parallax->h);
+ }
break;
}
case GAME_OBJECT: {