diff options
author | Travis Howell | 2007-06-23 07:25:50 +0000 |
---|---|---|
committer | Travis Howell | 2007-06-23 07:25:50 +0000 |
commit | f311ca82ce10688246747f0db00a48ab10c9a365 (patch) | |
tree | 2e26760398d1679bdcec79da25acff2be65b2810 /engines | |
parent | d8dc693578e3616e4385e54cec30154770512f6e (diff) | |
download | scummvm-rg350-f311ca82ce10688246747f0db00a48ab10c9a365.tar.gz scummvm-rg350-f311ca82ce10688246747f0db00a48ab10c9a365.tar.bz2 scummvm-rg350-f311ca82ce10688246747f0db00a48ab10c9a365.zip |
Fix alignment issue in setWindowPalete video opcode.
svn-id: r27645
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/vga_e2.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index ca5ed3ec3b..45c70256ee 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -74,14 +74,16 @@ void AGOSEngine::vc45_setWindowPalette() { if (num == 4) { const uint16 *vlut = &_videoWindows[num * 4]; - uint16 *dst = (uint16 *)_window4BackScn; - uint width = vlut[2] * 16 / 2; + byte *dst = _window4BackScn; + uint width = vlut[2] * 16; uint height = vlut[3]; for (uint h = 0; h < height; h++) { for (uint w = 0; w < width; w++) { - dst[w] &= 0xF0F; - dst[w] |= color * 16; + uint16 val = READ_LE_UINT16(dst + w * 2); + val &= 0xF0F; + val |= color * 16; + WRITE_LE_UINT16(dst + w * 2, val); } dst += width; } @@ -89,7 +91,7 @@ void AGOSEngine::vc45_setWindowPalette() { const uint16 *vlut = &_videoWindows[num * 4]; Graphics::Surface *screen = _system->lockScreen(); - uint16 *dst = (uint16 *)screen->pixels + vlut[0] * 8 + vlut[1] * _dxSurfacePitch / 2; + byte *dst = (byte *)screen->pixels + vlut[0] * 16 + vlut[1] * _dxSurfacePitch; uint width = vlut[2] * 16 / 2; uint height = vlut[3]; @@ -101,10 +103,12 @@ void AGOSEngine::vc45_setWindowPalette() { for (uint h = 0; h < height; h++) { for (uint w = 0; w < width; w++) { - dst[w] &= 0xF0F; - dst[w] |= color * 16; + uint16 val = READ_LE_UINT16(dst + w * 2); + val &= 0xF0F; + val |= color * 16; + WRITE_LE_UINT16(dst + w * 2, val); } - dst += _dxSurfacePitch / 2; + dst += _dxSurfacePitch; } _system->unlockScreen(); |