changeset 2199:3445abad44c5

RasterLine2D()
author Ritor1
date Sun, 02 Feb 2014 21:53:29 +0600
parents d9caf2b3d8d5
children 44d956d4f838
files Outdoor.cpp Render.cpp
diffstat 2 files changed, 150 insertions(+), 162 deletions(-) [+]
line wrap: on
line diff
--- a/Outdoor.cpp	Sun Feb 02 00:10:40 2014 +0600
+++ b/Outdoor.cpp	Sun Feb 02 21:53:29 2014 +0600
@@ -4169,7 +4169,7 @@
         else
         {
           v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
-          pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле
+          pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле 56
         }
         pParty->walk_sound_timer = 96;//таймер для бега
       }
--- a/Render.cpp	Sun Feb 02 00:10:40 2014 +0600
+++ b/Render.cpp	Sun Feb 02 21:53:29 2014 +0600
@@ -3660,8 +3660,6 @@
 {
   signed int lower_bound; // eax@17
   signed int left_bound;
-  //signed int v19; // qax@41
-  //int v20; // edi@41
   unsigned int v21; // edi@46
   int v22; // esi@47
   int v23; // ebx@47
@@ -3677,10 +3675,7 @@
   __int64 v36; // [sp+14h] [bp-8h]@1
   signed int upper_bound; // [sp+18h] [bp-4h]@28
   unsigned int uXa; // [sp+24h] [bp+8h]@49
-  //unsigned int uYa; // [sp+28h] [bp+Ch]@28
   int uYb; // [sp+28h] [bp+Ch]@47
-  //int uZa; // [sp+2Ch] [bp+10h]@38
-  bool left_border;
 
   v36 = 0i64;
   if ( uX < this->raster_clip_x )// x выходит за рамки левой границы
@@ -3707,175 +3702,168 @@
   if ( (unsigned int)v36 & HIDWORD(v36) )
     return;
 
-  if ( !v36 ) //полностью в рамках
-  {
-LABEL_46:
-    v21 = pRenderer->uTargetSurfacePitch;
-    if ( pRenderer->uTargetSurfacePitch )
-    {
-      //v12 = uX + uY * pRenderer->uTargetSurfacePitch;
-      v22 = uW - uY;
-      v23 = v22;
-      uYb = v22;
-      if ( v22 < 0 )
-      {
-        v23 = -v22;
-        uYb = -v22;
-        v21 = -pRenderer->uTargetSurfacePitch;
-      }
-      uXa = uZ - uX;
-      if ( (uXa & 0x80000000u) == 0 )
-      {
-        v24 = 1;
+  if ( v36 ) //не полностью в рамках
+  {
+    if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//for left and right(левая и правая)
+    {
+      if ( BYTE4(v36) & 8 )//left_border = true;
+      {
+        uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX);
+        uX = this->raster_clip_x;
+      }
+      else
+      {
+        uZ = this->raster_clip_x;
+        uW += ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ);
+      }
+    }
+    if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 )
+    {
+      if ( BYTE4(v36) & 4 ) //right_border = true
+      {
+        uY += ((uW - uY) * (this->raster_clip_z - uX)) / (uZ - uX);
+        uX = this->raster_clip_z;
       }
       else
       {
-        uXa = -uXa;
-        v24 = -1;
-      }
-      v25 = 0;
-
-      v26 = (unsigned __int16 *)this->pTargetSurface;
-      if ( v26 )
-      {
-        if ( (signed int)uXa <= v23 )//рисуем вертикальную линию
+        uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ);
+        uZ = this->raster_clip_z;
+      }
+    }
+    upper_bound = 0;
+    if ( uY < this->raster_clip_y )
+      upper_bound = 2;
+    if ( uY > this->raster_clip_w )
+      upper_bound |= 1;
+
+    lower_bound = 0;
+    if ( uW < this->raster_clip_y )
+      lower_bound = 2;
+    if ( uW > this->raster_clip_w )
+      lower_bound |= 1;
+
+    if ( !(lower_bound & upper_bound) )//for up and down(для верха и низа)
+    {
+      lower_bound ^= upper_bound;
+      if ( lower_bound & 2 )
+      {
+        if ( upper_bound & 2 )
+        {
+          uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY);
+          uY = this->raster_clip_y;
+        }
+        else
+        {
+          uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW);
+          uW = this->raster_clip_y;
+        }
+      }
+      if ( lower_bound & 1 )
+      {
+        if ( upper_bound & 1 )
+        {
+          uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY);
+          uY = this->raster_clip_w;
+        }
+        else
         {
-          v30 = v23 + 1;
-          if ( v30 > 0 )
+          uZ += ((uX - uZ) * (this->raster_clip_w - uW)) / (uY - uW);
+          uW = this->raster_clip_w;
+        }
+      }
+    }
+  }
+  v21 = pRenderer->uTargetSurfacePitch;
+  if ( pRenderer->uTargetSurfacePitch )
+  {
+    //v12 = uX + uY * pRenderer->uTargetSurfacePitch;
+    v22 = uW - uY;
+    v23 = v22;
+    uYb = v22;
+    if ( v22 < 0 )
+    {
+      v23 = -v22;
+      uYb = -v22;
+      v21 = -pRenderer->uTargetSurfacePitch;
+    }
+    uXa = uZ - uX;
+    if ((signed)(uZ - uX) >= 0)
+      v24 = 1;
+    else
+    {
+      uXa = -uXa;
+      v24 = -1;
+    }
+    v25 = 0;
+
+    v26 = (unsigned __int16 *)this->pTargetSurface;
+    if ( v26 )
+    {
+      if ( (signed int)uXa <= v23 )//рисуем вертикальную линию
+      {
+        v30 = v23 + 1;
+        if ( v30 > 0 )
+        {
+          v31 = 2 * v24;
+          v32 = 2 * v21;
+          //v12 = (int)&v26[v12];
+          int y = 0;
+          int x = 0;
+          for ( v30; v30; --v30 )
           {
-            v31 = 2 * v24;
-            v32 = 2 * v21;
-            //v12 = (int)&v26[v12];
-            int y = 0;
-            int x = 0;
-            for ( v30; v30; --v30 )
+            v25 += uXa;
+            //*(short *)v12 = uColor;
+            //v12 += v32;
+            WritePixel16(uX + x, uY + y, uColor);
+            if ( v32 >= 0 )
+              y += 1;
+            else
+              y -= 1;
+            if ( v25 > 0 )
             {
-              v25 += uXa;
-              //*(short *)v12 = uColor;
-              //v12 += v32;
-              WritePixel16(uX + x, uY + y, uColor);
-              if ( v32 >= 0 )
-                y += 1;
-              else
-                y -= 1;
-              if ( v25 > 0 )
-              {
-                v25 -= uYb;
-                //v12 += v31;
-                if ( v31 >= 0 )
-                  x += 1;
-                else
-                  x -= 1;
-              }
-            }
-          }
-        }
-        else//рисуем горизонтальную линию
-        {
-          v27 = uXa + 1;
-          if ( (signed int)(uXa + 1) > 0 )
-          {
-            v28 = 2 * v21;
-            v29 = 2 * v24;
-            int y = 0;
-            int x = 0;
-            //v12 = (int)&v26[v12];
-            for ( v27; v27; --v27 )
-            {
-              v25 += uYb;
-              //*(short *)v12 = uColor;
-              //v12 += v29;
-              WritePixel16(uX + x, uY + y, uColor);
-              if ( v29 >= 0 )
+              v25 -= uYb;
+              //v12 += v31;
+              if ( v31 >= 0 )
                 x += 1;
               else
                 x -= 1;
-              if ( v25 > (signed int)uXa )
-              {
-                v25 -= uXa;
-                //v12 += v28;
-                if ( v28 >= 0 )
-                  y += 1;
-                else
-                  y -= 1;
-              }
             }
           }
         }
       }
-    }
-    return;
-  }
-
-  if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//for left and right(левая и правая)
-  {
-    if ( BYTE4(v36) & 8 )//left_border = true;
-    {
-      uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX);
-      uX = this->raster_clip_x;
-    }
-    else
-    {
-      uZ = this->raster_clip_x;
-      uW += ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ);
-    }
-  }
-  if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 )
-  {
-    if ( BYTE4(v36) & 4 ) //right_border = true
-    {
-      uY += ((uW - uY) * (this->raster_clip_z - uX)) / (uZ - uX);
-      uX = this->raster_clip_z;
-    }
-    else
-    {
-      uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ);
-      uZ = this->raster_clip_z;
-    }
-  }
-
-  upper_bound = 0;
-  if ( uY < this->raster_clip_y )
-    upper_bound = 2;
-  if ( uY > this->raster_clip_w )
-    upper_bound |= 1;
-
-  lower_bound = 0;
-  if ( uW < this->raster_clip_y )
-    lower_bound = 2;
-  if ( uW > this->raster_clip_w )
-    lower_bound |= 1;
-
-  if ( !(lower_bound & upper_bound) )//for up and down(для верха и низа)
-  {
-    lower_bound ^= upper_bound;
-    if ( lower_bound & 2 )
-    {
-      if ( upper_bound & 2 )
-      {
-        uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY);
-        uY = this->raster_clip_y;
-      }
-      else
-      {
-        uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW);
-        uW = this->raster_clip_y;
-      }
-    }
-    if ( lower_bound & 1 )
-    {
-      if ( upper_bound & 1 )
-      {
-        uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY);
-        uY = this->raster_clip_w;
-      }
-      else
-      {
-        uZ += ((uX - uZ) * (this->raster_clip_w - uW)) / (uY - uW);
-        uW = this->raster_clip_w;
-      }
-    }
-    goto LABEL_46;
+      else//рисуем горизонтальную линию
+      {
+        v27 = uXa + 1;
+        if ( (signed int)(uXa + 1) > 0 )
+        {
+          v28 = 2 * v21;
+          v29 = 2 * v24;
+          int y = 0;
+          int x = 0;
+          //v12 = (int)&v26[v12];
+          for ( v27; v27; --v27 )
+          {
+            v25 += uYb;
+            //*(short *)v12 = uColor;
+            //v12 += v29;
+            WritePixel16(uX + x, uY + y, uColor);
+            if ( v29 >= 0 )
+              x += 1;
+            else
+              x -= 1;
+            if ( v25 > (signed int)uXa )
+            {
+              v25 -= uXa;
+              //v12 += v28;
+              if ( v28 >= 0 )
+                y += 1;
+              else
+                y -= 1;
+            }
+          }
+        }
+      }
+    }
   }
   return;
 }