aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: {