diff mm7_4.cpp @ 24:74940016abc8

* on Players * render now properly handles primary surface pitch
author Nomad
date Mon, 15 Oct 2012 18:28:43 +0200
parents 509744251c8e
children 2bbf33898c6b
line wrap: on
line diff
--- a/mm7_4.cpp	Sun Oct 14 00:27:38 2012 +0200
+++ b/mm7_4.cpp	Mon Oct 15 18:28:43 2012 +0200
@@ -7550,25 +7550,30 @@
         v1 = pRenderer->pTargetSurface;
         v2 = Dst.lpSurface;
 
-        //memset(pRenderer->pTargetSurface, 128, 640 * 2 * 320);
-
+        for (uint y = 0; y < 480; ++y)
+        {
+          auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
+          for (uint x = 0; x < 640; ++x)
+            pDst[x] = pRenderer->uTargetGMask | pRenderer->uTargetBMask;
+        }
+        
         auto pSrc = pRenderer->pTargetSurface;
         auto pDst = (__int16 *)Dst.lpSurface;
 
         for (uint y = 0; y < 8; ++y)
-          memcpy(pDst + y * 640,
+          memcpy(pDst + y * Dst.lPitch / 2,
                  pSrc + y * 640, 640 * sizeof(__int16));
 
         for (uint y = 8; y < 352; ++y)
         {
-          memcpy(pDst + y * 640,
+          memcpy(pDst + y * Dst.lPitch / 2,
                  pSrc + y * 640, 8 * sizeof(__int16));
-          memcpy(pDst + y * 640 + 8 + 460/*462*/,
-                 pSrc + y * 640 + 8 + 460/*462*/, 174/*172*/ * sizeof(__int16));
+          memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2,
+                 pSrc + 8 + 460/*462*/ + y * Dst.lPitch / 2, 174/*172*/ * sizeof(__int16));
         }
 
         for (uint y = 351/*352*/; y < 480; ++y)
-          memcpy(pDst + y * 640,
+          memcpy(pDst + y * Dst.lPitch / 2,
                  pSrc + y * 640, 640 * sizeof(__int16));
 
 
@@ -7589,8 +7594,8 @@
         v13 = v24;
 
         for (uint y = pViewport->uViewportY; y < pViewport->uViewportW; ++y)
-          memcpy(pDst + 640 * y + pViewport->uViewportX,
-                 pSrc + 640 * y + pViewport->uViewportX, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
+          memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
+                 pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
         
               ErrD3D(pRenderer->pBackBuffer4->Unlock(0));