[Scummvm-cvs-logs] SF.net SVN: scummvm: [27645] scummvm/trunk/engines/agos/vga_e2.cpp

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Sat Jun 23 09:25:50 CEST 2007


Revision: 27645
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27645&view=rev
Author:   Kirben
Date:     2007-06-23 00:25:50 -0700 (Sat, 23 Jun 2007)

Log Message:
-----------
Fix alignment issue in setWindowPalete video opcode.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/vga_e2.cpp

Modified: scummvm/trunk/engines/agos/vga_e2.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_e2.cpp	2007-06-23 00:42:26 UTC (rev 27644)
+++ scummvm/trunk/engines/agos/vga_e2.cpp	2007-06-23 07:25:50 UTC (rev 27645)
@@ -74,14 +74,16 @@
 
 	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 @@
 		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 @@
 
 		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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list