diff Render.cpp @ 2102:0db53678ff48

RasterLine2D, DIALOGUE_EVT_A etc.
author Ritor1
date Tue, 17 Dec 2013 21:34:20 +0600
parents ee2724b9ca05
children 68fbaf45ef66
line wrap: on
line diff
--- a/Render.cpp	Mon Dec 16 18:43:42 2013 +0600
+++ b/Render.cpp	Tue Dec 17 21:34:20 2013 +0600
@@ -3561,16 +3561,11 @@
 }
 
 //----- (004A0BEE) --------------------------------------------------------
-char Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor)
-{
-  signed int v8; // ebx@5
-  signed int v10; // ecx@9
-  signed int v11; // esi@13
+void Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor)
+{
   signed int v12; // eax@17
-  int v13; // eax@21
-  int v16; // eax@27
-  signed int v19; // qax@41
-  int v20; // edi@41
+  //signed int v19; // qax@41
+  //int v20; // edi@41
   unsigned int v21; // edi@46
   int v22; // esi@47
   int v23; // ebx@47
@@ -3586,46 +3581,44 @@
   __int64 v36; // [sp+14h] [bp-8h]@1
   signed int v37; // [sp+18h] [bp-4h]@28
   unsigned int uXa; // [sp+24h] [bp+8h]@49
-  unsigned int uYa; // [sp+28h] [bp+Ch]@28
+  //unsigned int uYa; // [sp+28h] [bp+Ch]@28
   int uYb; // [sp+28h] [bp+Ch]@47
-  int uZa; // [sp+2Ch] [bp+10h]@38
+  //int uZa; // [sp+2Ch] [bp+10h]@38
+  bool left_border;
 
   v36 = 0i64;
   if ( uX < this->raster_clip_x )// x выходит за рамки левой границы
-    HIDWORD(v36) = 8;
+    HIDWORD(v36) = 8; //left_border = true;
   if ( uX > this->raster_clip_z )// x выходит за рамки правой границы
-    HIDWORD(v36) |= 4;
+    HIDWORD(v36) |= 4;//right_border = true;
 
   if ( uZ < this->raster_clip_x )// z выходит за рамки левой границы
-    LODWORD(v36) = 8;
+    LODWORD(v36) = 8;//
   if ( uZ > this->raster_clip_z )// z выходит за рамки правой границы
     LODWORD(v36) |= 4;
 
   if ( uY < this->raster_clip_y )// y выходит за рамки верхней границы
-    HIDWORD(v36) |= 2;
+    HIDWORD(v36) |= 2;//upper_border = true;
   if ( uY > this->raster_clip_w )// y выходит за рамки нижней границы
-    HIDWORD(v36) |= 1;
+    HIDWORD(v36) |= 1;//bottom_border = true;
 
   if ( uW < this->raster_clip_y )// w выходит за рамки верхней границы
     LODWORD(v36) |= 2;
   if ( uW > this->raster_clip_w )// w выходит за рамки нижней границы
     LODWORD(v36) |= 1;
 
-  v8 = uY;
-  v11 = uW;
-  v10 = uZ;
-
-  LOBYTE(v12) = v36;
+  //LOBYTE(v12) = v36;
   if ( (unsigned int)v36 & HIDWORD(v36) )
-    return v12;
-  if ( !v36 )
+    return;
+
+  if ( !v36 ) //полностью в рамках
   {
 LABEL_46:
     v21 = pRenderer->uTargetSurfacePitch;
     if ( pRenderer->uTargetSurfacePitch )
     {
       v12 = uX + uY * pRenderer->uTargetSurfacePitch;
-      v22 = v11 - v8;
+      v22 = uW - uY;
       v23 = v22;
       uYb = v22;
       if ( v22 < 0 )
@@ -3634,7 +3627,7 @@
         uYb = -v22;
         v21 = -pRenderer->uTargetSurfacePitch;
       }
-      uXa = v10 - uX;
+      uXa = uZ - uX;
       if ( (uXa & 0x80000000u) == 0 )
       {
         v24 = 1;
@@ -3715,89 +3708,80 @@
         }
       }
     }
-    return v12;
-  }
-  if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )
-  {
-    if ( BYTE4(v36) & 8 )
-    {
-      v13 = ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX);
-      v8 = v13 + uY;
+    return;
+  }
+
+  if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//левая и 
+  {
+    if ( BYTE4(v36) & 8 )//left_border = true;
+    {
+      uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX);
       uX = this->raster_clip_x;
-      goto LABEL_24;
-    }
-    v10 = this->raster_clip_x;
-    v11 = ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ) + uW;
-  }
-LABEL_24:
+    }
+    else
+    {
+      uZ = this->raster_clip_x;
+      uW += ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ);
+    }
+  }
   if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 )
   {
-    //v15 = this->raster_clip_z;
-    if ( BYTE4(v36) & 4 )
-    {
-      v8 += ((v11 - v8) * (this->raster_clip_z - uX)) / (v10 - uX);
+    if ( BYTE4(v36) & 4 ) //right_border = true
+    {
+      uY += ((uW - uY) * (this->raster_clip_z - uX)) / (uZ - uX);
       uX = this->raster_clip_z;
     }
     else
     {
-      v16 = ((v8 - v11) * (this->raster_clip_z - v10)) / (uX - v10);
-      v10 = this->raster_clip_z;
-      v11 += v16;
+      uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ);
+      uY = this->raster_clip_z;
     }
   }
   v37 = 0;
-  uYa = this->raster_clip_y;
-  if ( v8 < this->raster_clip_y )
+  if ( uY < this->raster_clip_y )
     v37 = 2;
-  if ( v8 > this->raster_clip_w )
+  if ( uY > this->raster_clip_w )
     v37 |= 1;
 
-  if ( v11 >= this->raster_clip_y )
+  if ( uW >= this->raster_clip_y )
     v12 = 0;
   else
     v12 = 2;
-  if ( v11 > this->raster_clip_w )
-    LOBYTE(v12) = v12 | 1;
+  if ( uW > this->raster_clip_w )
+    v12 |= 1;
 
   if ( !(v12 & v37) )
   {
     v12 ^= v37;
-    uZa = v12;
     if ( v12 & 2 )
     {
       if ( v37 & 2 )
       {
-        uX += ((v10 - uX) * (uYa - v8)) / (v11 - v8);
-        LOBYTE(v12) = (char)this;
-        v8 = this->raster_clip_y;
+        uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY);
+        uY = this->raster_clip_y;
       }
       else
       {
-        v19 = (uX - v10) * (uYa - v11);
-        v20 = v8 - v11;
-        v11 = uYa;
-        v12 = v19 / v20;
-        v10 += v12;
-      }
-    }
-    if ( uZa & 1 )
+        uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW);
+        uW = this->raster_clip_y;
+      }
+    }
+    if ( v12 & 1 )
     {
       if ( v37 & 1 )
       {
-        uX += ((v10 - uX) * (this->raster_clip_w - v8)) / (v11 - v8);
-        LOBYTE(v12) = (char)this;
-        v8 = this->raster_clip_w;
+        uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY);
+        uY = this->raster_clip_w;
       }
       else
       {
-        v12 = ((uX - v10) * (this->raster_clip_w - v11)) / (v8 - v11);
-        v11 = this->raster_clip_w;
-        v10 += v12;
+        uZ += ((uX - uZ) * (this->raster_clip_w - uW)) / (uY - uW);
+        uW = this->raster_clip_w;
       }
     }
     goto LABEL_46;
   }
-  return v12;
+  return;
 }
 
 //----- (004A0E80) --------------------------------------------------------