aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-01-06 23:12:34 +0100
committerStrangerke2013-01-06 23:12:34 +0100
commita91eaeb4f78608bf511b5d3c39f54646263365aa (patch)
tree6a56f2a7a11df191d96f30eef5bfdf9bdec2c8d9
parent117d99f22b5d90b411055b0657036f2932e6ff82 (diff)
downloadscummvm-rg350-a91eaeb4f78608bf511b5d3c39f54646263365aa.tar.gz
scummvm-rg350-a91eaeb4f78608bf511b5d3c39f54646263365aa.tar.bz2
scummvm-rg350-a91eaeb4f78608bf511b5d3c39f54646263365aa.zip
HOPKINS: Remove uint16 casting in m_scroll16 in order to avoid endian issue
-rw-r--r--engines/hopkins/anim.cpp35
-rw-r--r--engines/hopkins/graphics.cpp15
2 files changed, 25 insertions, 25 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
index bce08a3773..55e9fe17f1 100644
--- a/engines/hopkins/anim.cpp
+++ b/engines/hopkins/anim.cpp
@@ -880,7 +880,6 @@ LABEL_59:
*/
void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) {
bool v4;
- int v7;
byte *ptr = NULL;
byte *v10;
byte *v11 = NULL;
@@ -888,7 +887,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
size_t nbytes;
Common::File f;
- v7 = 0;
+ bool multiScreenFl = false;
for (;;) {
if (_vm->shouldQuit())
return;
@@ -914,12 +913,12 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
f.read(v10, nbytes);
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
- v7 = 1;
+ multiScreenFl = true;
ptr = _vm->_globals.allocMemory(307200);
memcpy((void *)ptr, v10, 307200);
}
if (NO_SEQ) {
- if (v7 == 1) {
+ if (multiScreenFl) {
assert(ptr != NULL);
memcpy((void *)ptr, _vm->_graphicsManager._vesaBuffer, 307200);
}
@@ -927,7 +926,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
} else {
_vm->_graphicsManager.lockScreen();
_vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette);
- if (v7)
+ if (multiScreenFl)
_vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
_vm->_graphicsManager.m_scroll16(v10, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
@@ -949,7 +948,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
}
if (_vm->_graphicsManager._skipVideoLockFl)
goto LABEL_54;
- if (v7 == 1)
+ if (multiScreenFl)
ptr = _vm->_globals.freeMemory(ptr);
_vm->_globals.freeMemory(v11);
f.close();
@@ -975,7 +974,7 @@ LABEL_23:
LABEL_33:
_vm->_eventsManager._rateCounter = 0;
_vm->_graphicsManager.lockScreen();
- if (v7) {
+ if (multiScreenFl) {
if (*v10 != kByteStop) {
_vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptr);
_vm->_graphicsManager.m_scroll16A(ptr, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
@@ -1009,7 +1008,7 @@ LABEL_44:
goto LABEL_33;
}
LABEL_54:
- if (_vm->_graphicsManager.FADE_LINUX == 2 && !v7) {
+ if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) {
byte *ptra = _vm->_globals.allocMemory(307200);
f.seek(0);
@@ -1028,24 +1027,22 @@ LABEL_54:
f.read(v10, nbytes);
memcpy(ptra, v10, 307200);
- bool v5 = false;
- do {
+ for (;;) {
memset(v11, 0, 19);
if (f.read(v11, 16) != 16)
- v5 = true;
+ break;
if (strncmp((const char *)v11, "IMAGE=", 6))
- v5 = true;
- if (!v5) {
- f.read(v10, READ_LE_UINT32(v11 + 8));
- if (*v10 != kByteStop)
- _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra);
- }
- } while (!v5);
+ break;
+
+ f.read(v10, READ_LE_UINT32(v11 + 8));
+ if (*v10 != kByteStop)
+ _vm->_graphicsManager.Copy_WinScan_Vbe(v10, ptra);
+ }
_vm->_graphicsManager.fadeOutDefaultLength(ptra);
ptra = _vm->_globals.freeMemory(ptra);
}
- if (v7 == 1) {
+ if (multiScreenFl) {
if (_vm->_graphicsManager.FADE_LINUX == 2)
_vm->_graphicsManager.fadeOutDefaultLength(ptr);
_vm->_globals.freeMemory(ptr);
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 03617fc08f..057d120405 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -422,19 +422,22 @@ void GraphicsManager::m_scroll16(const byte *surface, int xs, int ys, int width,
assert(_videoPtr);
const byte *srcP = xs + _lineNbr2 * ys + surface;
- uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destX * 2 + WinScan * destY);
+ byte *destP = (byte *)_videoPtr->pixels + destX * 2 + WinScan * destY;
for (int yp = 0; yp < height; ++yp) {
// Copy over the line, using the source pixels as lookups into the pixels palette
const byte *lineSrcP = srcP;
- uint16 *lineDestP = destP;
-
- for (int xp = 0; xp < width; ++xp)
- *lineDestP++ = *(uint16 *)&PAL_PIXELS[*lineSrcP++ * 2];
+ byte *lineDestP = destP;
+ for (int xp = 0; xp < width; ++xp) {
+ lineDestP[0] = PAL_PIXELS[lineSrcP[0] * 2];
+ lineDestP[1] = PAL_PIXELS[(lineSrcP[0] * 2) + 1];
+ lineDestP += 2;
+ lineSrcP++;
+ }
// Move to the start of the next line
srcP += _lineNbr2;
- destP += WinScan / 2;
+ destP += WinScan;
}
unlockScreen();