changeset 1799:dfafcd39c67b

GetSpellColor, DrawSkyD3D()(continue)
author Ritor1
date Sun, 06 Oct 2013 22:45:00 +0600
parents 4d4df91a2546
children c3140e8ad3ef
files Render.cpp mm7_2.cpp mm7_3.cpp
diffstat 3 files changed, 310 insertions(+), 199 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Fri Oct 04 20:25:02 2013 +0600
+++ b/Render.cpp	Sun Oct 06 22:45:00 2013 +0600
@@ -8767,6 +8767,8 @@
     {
       pNextVertices = depth_num_vertices++;
       memcpy(&array_507D30[pNextVertices], &array_50AC10[i], 0x30);
+      //array_507D30[pNextVertices]._rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001);
+      //array_507D30[pNextVertices].flt_2C = array_50AC10[i].flt_2C;
     }
     previous_vertices_flag = current_vertices_flag;
   }
--- a/mm7_2.cpp	Fri Oct 04 20:25:02 2013 +0600
+++ b/mm7_2.cpp	Sun Oct 06 22:45:00 2013 +0600
@@ -2752,119 +2752,26 @@
 //----- (0045828B) --------------------------------------------------------
 unsigned int __fastcall GetSpellColor(signed int a1)
 {
-  unsigned __int16 v1; // dx@3
-  unsigned __int16 v2; // cx@6
-  unsigned __int16 v4; // [sp-4h] [bp-4h]@3
-
-  if ( a1 < 1 )
-  {
-    if ( a1 < 12 )
-    {
-      if ( a1 < 23 )
-      {
-        if ( a1 < 34 )
-        {
-          if ( a1 < 45 )
-          {
-            if ( a1 < 56 )
-            {
-              if ( a1 < 67 )
-              {
-                if ( a1 < 78 )
-                {
-                  if ( a1 < 89 )
-				  {
-					v4 = 0;
-					v1 = 0;
-					v2 = 0;
-					return TargetColor(v2, v1, v4);
-				  }
-                }
-				else
-				{
-LABEL_25:
-					if ( a1 < 89 )
-					{
-					  v4 = 155;
-					  v2 = 255;
-					  v1 = v2;
-					  return TargetColor(v2, v1, v4);
-					}
-				}
-                if ( a1 < 100 )
-                {
-                  v4 = 240;
-                  v2 = 192;
-				  v1 = v2;
-				  return TargetColor(v2, v1, v4);
-                }
-                v4 = 0;
-                v1 = 0;
-				v2 = 0;
-				return TargetColor(v2, v1, v4);
-              }
-LABEL_21:
-              if ( a1 < 78 )
-                return TargetColor(255, 128, 0);
-              goto LABEL_25;
-            }
-LABEL_18:
-            if ( a1 < 67 )
-            {
-              v4 = 255;
-              v1 = 15;
-              v2 = 235;
-              return TargetColor(v2, v1, v4);
-            }
-            goto LABEL_21;
-          }
-LABEL_15:
-          if ( a1 < 56 )
-          {
-            v2 = 225;
-            v4 = v2;
-            v1 = v2;
-            return TargetColor(v2, v1, v4);
-          }
-          goto LABEL_18;
-        }
-LABEL_11:
-        if ( a1 < 45 )
-        {
-          v2 = 128;
-          v4 = v2;
-          v1 = v2;
-          return TargetColor(v2, v1, v4);
-        }
-        goto LABEL_15;
-      }
-LABEL_8:
-      if ( a1 < 34 )
-      {
-        v4 = 255;
-        v1 = 128;
-        v2 = 0;
-        return TargetColor(v2, v1, v4);
-      }
-      goto LABEL_11;
-    }
-  }
-  else
-  {
-    if ( a1 < 12 )
-    {
-      v4 = 0;
-      v1 = 85;
-      v2 = 255;
-      return TargetColor(v2, v1, v4);
-    }
-  }
-  if ( a1 >= 23 )
-    goto LABEL_8;
-  v4 = 255;
-  v1 = 212;
-  v2 = 150;
-  return TargetColor(v2, v1, v4);
+  if ( a1 == 0 )
+    return TargetColor(0, 0, 0);
+  if ( a1 < 12 )
+    return TargetColor(255, 85, 0);
+  if ( a1 < 23 )
+    return TargetColor(150, 212, 255);
+  if ( a1 < 34 )
+    return TargetColor(0, 128, 255);
+  if ( a1 < 45 )
+    return TargetColor(128, 128, 128);
+  if ( a1 < 56 )
+    return TargetColor(225, 225, 225);
+  if ( a1 < 67 )
+    return TargetColor(235, 15, 255);
+  if ( a1 < 78 )
+    return TargetColor(255, 128, 0);
+  if ( a1 < 89 )
+    return TargetColor(255, 255, 155);
+  if ( a1 < 100 )
+    return TargetColor(192, 192, 240);
 }
 
 //----- (004610AA) --------------------------------------------------------
@@ -2932,7 +2839,8 @@
     //{
       v3 = pActor->pMonsterInfo.uID;
       v17 = 0;
-      if ( v3 >= 115 && v3 <= 186 || v3 >= 232 && v3 <= 249 )
+      if ( pActor->pMonsterInfo.uID >= 115 && pActor->pMonsterInfo.uID <= 186
+        || pActor->pMonsterInfo.uID >= 232 && pActor->pMonsterInfo.uID <= 249 )
         v17 = 1;
       //v1 = 0;
       v4 = (v3 - 1) % 3;
--- a/mm7_3.cpp	Fri Oct 04 20:25:02 2013 +0600
+++ b/mm7_3.cpp	Sun Oct 06 22:45:00 2013 +0600
@@ -751,102 +751,102 @@
 //----- (0047050A) --------------------------------------------------------
 int stru141_actor_collision_object::_47050A(int dt)
 {
-  stru141_actor_collision_object *v2; // esi@1
+  //stru141_actor_collision_object *v2; // esi@1
   //signed int v3; // eax@1
   //int v4; // ecx@1
   //int v5; // edx@1
   //int v6; // edx@1
   int v7; // eax@1
-  int v8; // eax@3
+  //int v8; // eax@3
   signed int result; // eax@4
-  int v10; // eax@5
-  int v11; // eax@5
-  int v12; // ebx@5
-  int v13; // edx@5
-  int v14; // edi@5
-  int v15; // ecx@5
-  int v16; // eax@5
+  //int v10; // eax@5
+  //int v11; // eax@5
+  //int v12; // ebx@5
+  //int v13; // edx@5
+  //int v14; // edi@5
+  //int v15; // ecx@5
+  //int v16; // eax@5
   int v17; // eax@5
   int v18; // eax@7
-  int v19; // edx@9
-  int v20; // edi@9
+  //int v19; // edx@9
+  //int v20; // edi@9
   int v21; // eax@9
   int v22; // eax@11
-  int v23; // edx@13
-  int v24; // eax@13
-  int v25; // eax@14
-  int v26; // eax@16
-  int v27; // eax@17
-  int v28; // [sp+14h] [bp+8h]@5
-
-  v2 = this;
+  //int v23; // edx@13
+  //int v24; // eax@13
+  //int v25; // eax@14
+  //int v26; // eax@16
+  //int v27; // eax@17
+  //int v28; // [sp+14h] [bp+8h]@5
+
+  //v2 = this;
   int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x);
 
-  v2->direction.x = 65536 / speed * v2->velocity.x;
-  v2->direction.y = 65536 / speed * v2->velocity.y;
-  v2->direction.z = 65536 / speed * v2->velocity.z;
-
-  v2->speed = speed;
-  v2->inv_speed = 65536 / speed;
+  this->direction.x = 65536 / speed * this->velocity.x;
+  this->direction.y = 65536 / speed * this->velocity.y;
+  this->direction.z = 65536 / speed * this->velocity.z;
+
+  this->speed = speed;
+  this->inv_speed = 65536 / speed;
 
   if (dt)
     v7 = dt;
   else
     v7 = pEventTimer->dt_in_some_format;
 
-  v8 = fixpoint_mul(v7, speed) - v2->field_70; // speed * dt - something
-  v2->field_6C = v8;
-  if ( v8 > 0 )
-  {
-    v10 = fixpoint_mul(v8, v2->direction.x) + v2->normal.x;
-    v2->field_4C = v10;
-    v2->normal2.x = v10;
-    v11 = fixpoint_mul(v2->field_6C, v2->direction.y) + v2->normal.y;
-    v2->field_50 = v11;
-    v2->normal2.y = v11;
-    v2->normal2.z = fixpoint_mul(v2->field_6C, v2->direction.z) + v2->normal.z;
-    v12 = v2->position.z;
-    v13 = v2->normal.x;
-    v14 = v2->normal2.x;
-    v15 = v2->prolly_normal_d;
-    v16 = v12 + fixpoint_mul(v2->field_6C, v2->direction.z);
-    v28 = v16;
-    v2->field_54 = v16;
-    v17 = v13;
-    if ( v13 >= v14 )
-      v17 = v14;
-    v2->sMaxX = v17 - v15;
-    v18 = v15 + v13;
-    if ( v13 <= v14 )
-      v18 = v15 + v14;
-    v19 = v2->normal.y;
-    v20 = v2->normal2.y;
-    v2->sMinX = v18;
-    v21 = v19;
-    if ( v19 >= v20 )
-      v21 = v20;
-    v2->sMaxY = v21 - v15;
-    v22 = v15 + v19;
-    if ( v19 <= v20 )
-      v22 = v20 + v15;
-    v23 = v2->normal2.z;
-    v2->sMinY = v22;
-    v24 = v2->normal.z;
-    if ( v24 >= v23 )
-      v25 = v23 - v15;
+  //v8 = fixpoint_mul(v7, speed) - this->field_70; // speed * dt - something
+  this->field_6C = fixpoint_mul(v7, speed) - this->field_70;
+  if ( this->field_6C > 0 )
+  {
+    //v10 = fixpoint_mul(v8, this->direction.x) + this->normal.x;
+    this->field_4C = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x;
+    this->normal2.x = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x;
+    //v11 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y;
+    this->field_50 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y;
+    this->normal2.y = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y;
+    this->normal2.z = fixpoint_mul(this->field_6C, this->direction.z) + this->normal.z;
+    //v12 = this->position.z;
+    //v13 = this->normal.x;
+    //v14 = this->normal2.x;
+    //v15 = this->prolly_normal_d;
+    //v16 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z);
+    //v28 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z);
+    this->field_54 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z);
+    v17 = this->normal.x;
+    if ( v17 >= this->normal2.x )
+      v17 = this->normal2.x;
+    this->sMaxX = v17 - this->prolly_normal_d;
+    v18 = this->prolly_normal_d + this->normal.x;
+    if ( this->normal.x <= this->normal2.x )
+      v18 = this->prolly_normal_d + this->normal2.x;
+    //v19 = this->normal.y;
+    //v20 = this->normal2.y;
+    this->sMinX = v18;
+    v21 = this->normal.y;
+    if ( v21 >= this->normal2.y )
+      v21 = this->normal2.y;
+    this->sMaxY = v21 - this->prolly_normal_d;
+    v22 = this->prolly_normal_d + this->normal.y;
+    if ( this->normal.y <= this->normal2.y )
+      v22 = this->normal2.y + this->prolly_normal_d;
+    //v23 = this->normal2.z;
+    this->sMinY = v22;
+    //v24 = this->normal.z;
+    if ( this->normal.z >= this->normal2.z )
+      this->sMaxZ = this->normal2.z - this->prolly_normal_d;
     else
-      v25 = v24 - v15;
-    v2->sMaxZ = v25;
-    v26 = v2->field_8_radius;
-    if ( v12 <= v28 )
-      v27 = v28 + v26;
+      this->sMaxZ = this->normal.z - this->prolly_normal_d;
+    //this->sMaxZ = v25;
+    //v26 = this->field_8_radius;
+    if ( this->position.z <= this->position.z + fixpoint_mul(this->field_6C, this->direction.z) )
+      this->sMinZ = (this->position.z + fixpoint_mul(this->field_6C, this->direction.z)) + this->field_8_radius;
     else
-      v27 = v12 + v26;
-    v2->uFaceID = 0;
-    v2->field_80 = -1;
-    v2->field_88 = -1;
-    v2->sMinZ = v27;
-    v2->field_7C = 0xFFFFFFu;
+      this->sMinZ = this->position.z + this->field_8_radius;
+    this->uFaceID = 0;
+    this->field_80 = -1;
+    this->field_88 = -1;
+    //this->sMinZ = v27;
+    this->field_7C = 0xFFFFFFu;
     result = 0;
   }
   else
@@ -5048,25 +5048,26 @@
       break;
     }
 
-    pShading = fixpoint_div(v34, pViewportBR_Y);
+    pShading = fixpoint_div(v34, pViewportBR_Y);//53570690 = -33554432 / -41049
     if ( pShading < 0 )
       pShading = pODMRenderParams->shading_dist_mist;
-
+	int a = ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16);//16316
     v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16);
+	int b = ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16);
     screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16);
     v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, pShading) / 8;// Медленно вращаем небесный купол
     screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(screen_center_x, pShading) / 8;
 
-    //array_50AC10[vertex_id].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
-    //array_50AC10[vertex_id].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0);
+    array_50AC10[vertex_id].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
+    //array_50AC10[vertex_id].vWorldPosition.x = v36 / (pSkyPolygon.pTexture->uTextureHeight * 65536.0);
     //array_50AC10[vertex_id].vWorldPosition.y = 1.0 / (pODMRenderParams->shading_dist_mist >> 16);
-    //array_50AC10[vertex_id].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0);
-    //array_50AC10[vertex_id]._rhw = 1.0f / (pShading >> 16);
-    //array_50AC10[vertex_id].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth);
-    //array_50AC10[vertex_id].v = (double)screen_center_x / (65536.0 * pSkyPolygon.pTexture->uTextureHeight);
+    //array_50AC10[vertex_id].vWorldPosition.z = v35 / (pSkyPolygon.pTexture->uTextureWidth * 65536.0);
+    array_50AC10[vertex_id]._rhw = 1.0f / (pShading >> 16);//1.0 / (array_50AC10[vertex_id].vWorldViewPosition.x + 0.0000001);
+    array_50AC10[vertex_id].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth);//t - pParty->sRotationY / 1024.0f
+    array_50AC10[vertex_id].v = (double)screen_center_x / (65536.0 * pSkyPolygon.pTexture->uTextureHeight);
   //-----------------------------------------------------------------------------------------
 
-    array_50AC10[vertex_id]._rhw = 1.0f;
+    //array_50AC10[vertex_id]._rhw = 1.0f;
   }
   //if ( i  == _this.uNumVertices - 1 )
   //{
@@ -5080,6 +5081,206 @@
     pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]);
   //}
 }
+/*void Render::DrawSkyD3D()
+{
+  int v0; // esi@2
+  int v1; // eax@2
+  double v2; // st7@2
+  double v3; // st6@2
+  double v4; // st5@2
+  double v5; // st4@2
+  double v6; // st7@2
+  char *v7; // esi@3
+  int v8; // eax@4
+  int v9; // eax@4
+  int v10; // ebx@4
+  signed __int64 v11; // qax@6
+  double v12; // st7@6
+  int v13; // edi@6
+  int v14; // ecx@6
+  int v15; // eax@8
+  int v16; // eax@12
+  signed __int64 v17; // qtt@13
+  signed int v18; // ecx@13
+  Texture *v19; // eax@15
+  double v20; // st6@15
+  double v21; // st7@15
+  double v22; // st6@15
+  unsigned __int8 v23; // sf@15
+  unsigned __int8 v24; // of@15
+  struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1
+  double v26; // [sp+120h] [bp-44h]@4
+  float v27; // [sp+128h] [bp-3Ch]@4
+  float v28; // [sp+12Ch] [bp-38h]@2
+  int v29; // [sp+130h] [bp-34h]@4
+  int v30; // [sp+134h] [bp-30h]@1
+  int v31; // [sp+138h] [bp-2Ch]@2
+  int v32; // [sp+13Ch] [bp-28h]@6
+  int v33; // [sp+140h] [bp-24h]@2
+  signed __int64 v34; // [sp+144h] [bp-20h]@1
+  int v35; // [sp+148h] [bp-1Ch]@4
+  double v36; // [sp+14Ch] [bp-18h]@2
+  int v37; // [sp+154h] [bp-10h]@8
+  int v38; // [sp+158h] [bp-Ch]@1
+  int v39; // [sp+15Ch] [bp-8h]@4
+  int v40; // [sp+160h] [bp-4h]@7
+
+  v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
+                       / ((double)pODMRenderParams->int_fov_rad + 8192.0)
+                       + (double)(pViewport->uScreenCenterY + 7));//include "+ 7"
+  //v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * (double)pODMRenderParams->shading_dist_mist;
+  /*v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
+                       - (double)pODMRenderParams->int_fov_rad
+                       / (v34 + 0.0000001)
+                       * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
+                        * (double)-pODMRenderParams->shading_dist_mist
+                        - (double)pGame->pIndoorCameraD3D->vPartyPos.z));*/
+  /*v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;
+  v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
+                       - (double)pODMRenderParams->int_fov_rad
+                       / (v34 + 0.0000001)
+                       * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
+                        * (double)-0x2000
+                        - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
+  pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38
+  pSkyPolygon.ptr_38->_48694B_frustum_sky();
+  pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//179(original 166)
+  pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
+  if ( pSkyPolygon.pTexture )
+  {
+    v0 = pGame->pIndoorCameraD3D->sRotationX;
+    pSkyPolygon.dimming_level = 0;
+    pSkyPolygon.uNumVertices = 4;
+    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
+    pSkyPolygon.v_18.y = 0;
+    v1 = stru_5C6E00->Cos(v0 + 16);
+    v2 = (double)(signed int)pViewport->uViewportTL_X;
+    pSkyPolygon.v_18.z = -v1;
+    array_50AC10[0].vWorldViewProjX = v2;
+    v3 = (double)(signed int)pViewport->uViewportTL_Y;
+    array_50AC10[0].vWorldViewProjY = v3;
+    array_50AC10[1].vWorldViewProjX = v2;
+    v4 = (double)v38;
+    pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
+    pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
+    v28 = v4;
+    array_50AC10[1].vWorldViewProjY = v4;
+    v5 = (double)(signed int)pViewport->uViewportBR_X;
+    array_50AC10[2].vWorldViewProjX = v5;
+    v38 = pViewport->uViewportBR_X - pViewport->uViewportTL_X;
+    pSkyPolygon.field_24 = 0x2000000u;
+    array_50AC10[2].vWorldViewProjY = v4;
+    array_50AC10[3].vWorldViewProjX = v5;
+    array_50AC10[3].vWorldViewProjY = v3;
+    v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;
+    v6 = tan(0.6457717418670654);
+    v31 = 0;
+    v33 = 65536 / (signed int)(signed __int64)(v36 / v6 + 0.5);
+    if ( (signed int)pSkyPolygon.uNumVertices <= 0 )
+      goto LABEL_16;
+    v7 = (char *)&array_50AC10[0].vWorldViewProjY;
+    while ( 1 )
+    {
+      LODWORD(v27) = *(_DWORD *)v7;
+      v26 = v27 + 6.7553994e15;
+      v29 = v27;
+      v38 = pSkyPolygon.ptr_38->field_14;
+      v39 = (unsigned __int64)(v38 * (signed __int64)(v33 * (v30 - v27))) >> 16;
+      v8 = v39 + pSkyPolygon.ptr_38->field_C;
+      v39 = v33 * (v30 - v27);
+      v35 = v8;
+      v38 = pSkyPolygon.ptr_38->field_20;
+      v39 = (unsigned __int64)(v38 * (signed __int64)(v33 * (v30 - v27))) >> 16;
+      v36 = v39 + pSkyPolygon.ptr_38->field_18;
+      v38 = pSkyPolygon.v_18.z;
+      v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - v27))) >> 16;
+      v10 = pSkyPolygon.v_18.x + v9;
+      v39 = pSkyPolygon.v_18.x + v9;
+      if ( pSkyPolygon.v_18.x + v9 > 0 )
+      {
+        v10 = 0;
+        v39 = 0;
+      }
+      v11 = (signed __int64)*((float *)v7 - 1);
+      v38 = v10;
+      v12 = *(float *)v7 - 1.0;
+      v13 = v33 * (pViewport->uScreenCenterX - v11);
+      v34 = -pSkyPolygon.field_24;
+      v32 = (signed __int64)v12;
+      v14 = v33 * (v30 - v32);
+      while ( 1 )
+      {
+        v40 = v14;
+        if ( !v10 )
+          goto LABEL_12;
+        v37 = abs((int)v34 >> 14);
+        v15 = abs(v10);
+        if ( v37 <= v15 || v32 <= (signed int)pViewport->uViewportTL_Y )
+        {
+          if ( v39 <= 0 )
+            break;
+        }
+        v14 = v40;
+LABEL_12:
+        v37 = pSkyPolygon.v_18.z;
+        v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16;
+        --v32;
+        v14 += v33;
+        v10 = pSkyPolygon.v_18.x + v16;
+        v39 = pSkyPolygon.v_18.x + v16;
+        v38 = pSkyPolygon.v_18.x + v16;
+      }
+      LODWORD(v17) = LODWORD(v34) << 16;
+      //HIDWORD(v17) = LODWORD(v34) >> 16;
+      HIDWORD(v17) = v34 >> 16;
+	  //v17 = (int)v34 >> 16;
+	  //v17 = v17 << 16;
+      v40 = v17 / v38;//v38 = -42331
+      v18 = v17 / v38;
+      if ( v18 < 0 )
+        v18 = pODMRenderParams->shading_dist_mist;
+      v40 = v13;
+      v37 = pSkyPolygon.ptr_38->field_10;
+      v40 = v13;
+      v37 = v35 + ((unsigned __int64)(v37 * (signed __int64)v13) >> 16);
+      v35 = pSkyPolygon.ptr_38->field_1C;
+      v36 += (unsigned __int64)(v35 * (signed __int64)v13) >> 16;
+      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
+          + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3);
+      v40 = (unsigned __int64)(v36 * (signed __int64)v18) >> 16;
+      v19 = pSkyPolygon.pTexture;
+      v36 = pSkyPolygon.pTexture->uTextureWidth;
+      v7 += 48;
+      v20 = (double)v36 * 65536.0;
+      HIDWORD(v36) = 224 * pMiscTimer->uTotalGameTimeElapsed + (v40 >> 3);
+      ++v31;
+      array_50AC10[v31 - 1].u = (double)v35 / v20;
+      v21 = (double)SHIDWORD(v36);
+      HIDWORD(v36) = v19->uTextureHeight;
+      v22 = (double)SHIDWORD(v36);
+      HIDWORD(v36) = v18 >> 16;
+      //v24 = __OFSUB__(v31, pSkyPolygon.uNumVertices);
+      //v23 = ((v31 - pSkyPolygon.uNumVertices) & 0x80000000u) != 0;
+      array_50AC10[v31 - 1].v = v21 / (v22 * 65536.0);
+      //array_50AC10[v31 - 1].vWorldViewPosition.x = (double)pODMRenderParams->shading_dist_mist;
+	  array_50AC10[v31 - 1].vWorldViewPosition.x = (double)0x2000;
+      array_50AC10[v31 - 1]._rhw = 1.0 / (double)SHIDWORD(v36);
+      //if ( !(v23 ^ v24) )
+      if ( v31 == pSkyPolygon.uNumVertices )
+      {
+LABEL_16:
+        pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices,
+          &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
+        array_50AC10[0].vWorldViewProjY = v28;
+        array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
+        array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
+        array_50AC10[3].vWorldViewProjY = v28;
+        pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
+        return;
+      }
+    }
+  }
+}*/
 
 //----- (0047A384) --------------------------------------------------------
 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa)