changeset 2562:b8a56afc6ba1

new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
author Ritor1
date Sun, 17 May 2015 22:42:13 +0600
parents 98057834c9a0
children 65c97624c047
files Engine/Engine.cpp Engine/Graphics/DecalBuilder.cpp Engine/Graphics/Indoor.cpp Engine/Graphics/Indoor.h Engine/Graphics/IndoorCameraD3D.cpp Engine/Graphics/IndoorCameraD3D.h Engine/Graphics/LightmapBuilder.cpp Engine/Graphics/LightmapBuilder.h Engine/Graphics/Outdoor.cpp Engine/Graphics/Render.cpp Engine/Graphics/RenderStruct.h Engine/Graphics/stru9.cpp Engine/Objects/Actor.cpp Engine/mm7_data.h Engine/stru314.h OSWindow.cpp _deleted.cpp
diffstat 17 files changed, 1062 insertions(+), 1114 deletions(-) [+]
line wrap: on
line diff
--- a/Engine/Engine.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Engine.cpp	Sun May 17 22:42:13 2015 +0600
@@ -460,8 +460,8 @@
     //depth = v2;
 
     PickMouse(depth, cursor.x, cursor.y, false, v10, v11);
-    pLightmapBuilder->std__vector_000004_size = 0;
-    pLightmapBuilder->std__vector_183808_size = 0;
+    pLightmapBuilder->StationaryLightsCount = 0;
+    pLightmapBuilder->MobileLightsCount = 0;
     pDecalBuilder->std__vector_pDecals_size = 0;
     pDecalBuilder->field_308008 = 0;
     if (!_44F07B())
@@ -545,10 +545,10 @@
 //----- (0044EE7C) --------------------------------------------------------
 bool Engine::draw_debug_outlines()
 {
-    if (uFlags & 0x04)
+    if (/*uFlags & 0x04*/ debug_lights)
     {
         pLightmapBuilder->DrawDebugOutlines(-1);
-        pDecalBuilder->DrawDecalDebugOutlines();
+        //pDecalBuilder->DrawDecalDebugOutlines();
     }
     return true;
 }
@@ -1066,7 +1066,7 @@
     //static_assert(sizeof(ArcomageGame) == 0xFB, "Wrong type size");
     static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size");
     static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size");
-    static_assert(sizeof(stru320) == 0x3FC, "Wrong type size");
+    static_assert(sizeof(LightsData) == 0x3FC, "Wrong type size");
     static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size");
     static_assert(sizeof(stru336) == 0x798, "Wrong type size");
     static_assert(sizeof(Vec3_short_) == 6, "Wrong type size");
@@ -2138,6 +2138,9 @@
     signed int v20; // [sp+18h] [bp-44h]@14
     int v21[16]; // [sp+1Ch] [bp-40h]@17
 
+  if(no_actors)
+	uNumActors = 0;
+
     GenerateItemsInChest();
     pGameLoadingUI_ProgressBar->Progress();
     pParty->uFlags |= 2;
--- a/Engine/Graphics/DecalBuilder.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/DecalBuilder.cpp	Sun May 17 22:42:13 2015 +0600
@@ -151,12 +151,12 @@
   //v19 = v16->face_plane.vNormal.y;
   //v20 = v16->face_plane.vNormal.x;
   //v37 = (int)&static_AE4F60.field_1C;
-  static_AE4F60.field_4.y = v16->face_plane.vNormal.y;
-  static_AE4F60.field_4.x = v16->face_plane.vNormal.x;
+  static_AE4F60.Normal.y = v16->face_plane.vNormal.y;
+  static_AE4F60.Normal.x = v16->face_plane.vNormal.x;
   //LODWORD(v36) = (DWORD)&static_AE4F60.field_10;
-  static_AE4F60.field_4.z = v16->face_plane.vNormal.z;
+  static_AE4F60.Normal.z = v16->face_plane.vNormal.z;
   static_AE4F60.dist = v16->face_plane.dist;
-  if ( !pIndoorCameraD3D->GetFacetOrientation(v16->polygonType, &static_AE4F60.field_4,
+  if ( !pIndoorCameraD3D->GetFacetOrientation(v16->polygonType, &static_AE4F60.Normal,
      &static_AE4F60.field_10, &static_AE4F60.field_1C) )
       MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:101", 0);
   
@@ -229,9 +229,9 @@
   this->field_30C02C = sqrt((a6 + a6 - this->field_30C028) * this->field_30C028);
 
   this->flt_30C030 = 1.0 - (a6 - this->field_30C02C) / a6;
-  decal->field_C08 = (signed __int64)(blood->x - a8 * a9->field_4.x);
-  decal->field_C0A = (signed __int64)(blood->y - a8 * a9->field_4.y);
-  decal->field_C0C = (signed __int64)(blood->z - a8 * a9->field_4.z);
+  decal->field_C08 = (signed __int64)(blood->x - a8 * a9->Normal.x);
+  decal->field_C0A = (signed __int64)(blood->y - a8 * a9->Normal.y);
+  decal->field_C0C = (signed __int64)(blood->z - a8 * a9->Normal.z);
 
   this->field_30C034 = a6 * this->flt_30C030;
   this->field_30C010 = this->field_30C034 * a9->field_10.x;
@@ -268,18 +268,18 @@
 
   for ( uint i = 0; i < 4; ++i )
   {
-    v28 = a9->field_4.x * decal->pVertices[i].vWorldPosition.x
-        + a9->field_4.y * decal->pVertices[i].vWorldPosition.y
-        + a9->field_4.z * decal->pVertices[i].vWorldPosition.z
+    v28 = a9->Normal.x * decal->pVertices[i].vWorldPosition.x
+        + a9->Normal.y * decal->pVertices[i].vWorldPosition.y
+        + a9->Normal.z * decal->pVertices[i].vWorldPosition.z
         + a9->dist;
-    decal->pVertices[i].vWorldPosition.x = decal->pVertices[i].vWorldPosition.x - v28 * a9->field_4.x;
-    decal->pVertices[i].vWorldPosition.y = decal->pVertices[i].vWorldPosition.y - v28 * a9->field_4.y;
-    decal->pVertices[i].vWorldPosition.z = decal->pVertices[i].vWorldPosition.z - v28 * a9->field_4.z;
+    decal->pVertices[i].vWorldPosition.x = decal->pVertices[i].vWorldPosition.x - v28 * a9->Normal.x;
+    decal->pVertices[i].vWorldPosition.y = decal->pVertices[i].vWorldPosition.y - v28 * a9->Normal.y;
+    decal->pVertices[i].vWorldPosition.z = decal->pVertices[i].vWorldPosition.z - v28 * a9->Normal.z;
   }
   decal->uColorMultiplier = uColorMultiplier;
   decal->uNumVertices = 4;
   decal->field_C14 = a2;
-  result = pEngine->pStru9Instance->_4980B9(a11, a10, a9->field_4.x, a9->field_4.y, a9->field_4.z, decal->pVertices, (signed int*)&decal->uNumVertices);
+  result = pEngine->pStru9Instance->_4980B9(a11, a10, a9->Normal.x, a9->Normal.y, a9->Normal.z, decal->pVertices, (signed int*)&decal->uNumVertices);
   if ( result )
   {
     if ( !decal->uNumVertices )
@@ -302,12 +302,12 @@
     {
       if ( uClipFlags & 2 )
       {
-        pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
+        pIndoorCameraD3D->LightmapNeerClip(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
         pIndoorCameraD3D->_437143(a8b, decal->pVertices, this->pVertices, (signed int *)&decal->uNumVertices);
       }
       else if ( uClipFlags & 4 )
       {
-        pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
+        pIndoorCameraD3D->LightmapFarClip(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
         pIndoorCameraD3D->_437143(a8b, decal->pVertices, this->pVertices, (signed int *)&decal->uNumVertices);
       }
       else
--- a/Engine/Graphics/Indoor.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/Indoor.cpp	Sun May 17 22:42:13 2015 +0600
@@ -49,7 +49,7 @@
 
 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null;
 
-stru320 stru_F8AD28; // idb
+LightsData Lights; // stru_F8AD28
 stru337 stru_F81018;
 BspRenderer_PortalViewportData stru_F8A590;
 BspRenderer *pBspRenderer = new BspRenderer; // idb
@@ -446,17 +446,17 @@
       if (pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
                      static_vertices_F7B628, pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
       {
-        a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
-        v17 = (248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3))
-          | (((248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3))
-           | ((248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3)) << 8)) << 8);
+        a4a = SHIWORD(Lights.uCurrentAmbientLightLevel);
+        v17 = (248 - (SHIWORD(Lights.uCurrentAmbientLightLevel) << 3))
+          | (((248 - (SHIWORD(Lights.uCurrentAmbientLightLevel) << 3))
+           | ((248 - (SHIWORD(Lights.uCurrentAmbientLightLevel) << 3)) << 8)) << 8);
         sub_4B0E07(uFaceID);
         pEngine->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
         pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
-        pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
+        pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &Lights);
         pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
-        pEngine->pLightmapBuilder->std__vector_000004_size = 0;
-        if (stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0)
+        pEngine->pLightmapBuilder->StationaryLightsCount = 0;
+        if (Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0)
         {
           stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x;
           stru_F7B60C.polygonType = pFace->uPolygonType;
@@ -465,8 +465,8 @@
           stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist;
         }
 
-        if (stru_F8AD28.uNumLightsApplied > 0 && !pFace->Indoor_sky()) //for torchlight(для света факелов)
-          pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0);
+        if (Lights.uNumLightsApplied > 0 && !pFace->Indoor_sky()) //for torchlight(для света факелов)
+          pEngine->pLightmapBuilder->ApplyLights(&Lights, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0);
 
         if (pDecalBuilder->uNumDecals > 0)//отрисовка пятен крови
           pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID);
@@ -512,22 +512,22 @@
 {
   unsigned int result; // eax@1
 
-  stru_F8AD28.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU;
-  stru_F8AD28.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV;
+  Lights.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU;
+  Lights.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV;
   result = GetTickCount() >> 3;
   if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_DIAGONAL )
-    stru_F8AD28.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
+    Lights.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
   else
   {
     if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_VERTICAL )
-      stru_F8AD28.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
+      Lights.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
   }
   if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_FLOW_HORIZONTAL )
-    stru_F8AD28.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
+    Lights.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
   else
   {
     if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_DONT_CACHE_TEXTURE )
-      stru_F8AD28.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
+      Lights.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
   }
   return result;
 }
@@ -2581,6 +2581,9 @@
   int v62; // [sp+58h] [bp-8h]@6
   unsigned int actor_id; // [sp+5Ch] [bp-4h]@1
 
+  if(no_actors)
+	uNumActors = 0;
+
   for ( actor_id = 0; actor_id < uNumActors; actor_id++ )
   {
     if ( pActors[actor_id].uAIState == Removed || pActors[actor_id].uAIState == Disabled
@@ -3107,6 +3110,7 @@
 
   // INDOOR initialize actors
   v38 = 0;
+
   for (uint i = 0; i < uNumActors; ++i)
   {
     if (pActors[i].uAttributes & ACTOR_UNKNOW7)
--- a/Engine/Graphics/Indoor.h	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/Indoor.h	Sun May 17 22:42:13 2015 +0600
@@ -7,7 +7,7 @@
 
 /*  358 */
 #pragma pack(push, 1)
-struct stru320
+struct LightsData
 {
 	int field_0;
 	Plane_int_ plane_4;
@@ -71,7 +71,7 @@
 };
 #pragma pack(pop)
 
-extern stru320 stru_F8AD28; // idb
+extern LightsData Lights; // idb
 
 
 
--- a/Engine/Graphics/IndoorCameraD3D.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/IndoorCameraD3D.cpp	Sun May 17 22:42:13 2015 +0600
@@ -82,7 +82,7 @@
 }
 
 //----- (004364C5) --------------------------------------------------------
-void IndoorCameraD3D::ViewTransfrom_OffsetUV(RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutVertices, stru320 *a5)
+void IndoorCameraD3D::ViewTransfrom_OffsetUV(RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutVertices, LightsData *a5)
 {
   for (uint i = 0; i < uNumVertices; ++i)
   {
@@ -1035,164 +1035,146 @@
 }
 
 //----- (00436F09) --------------------------------------------------------
-void IndoorCameraD3D::_436F09_mess_with_lightmap__clipflag_4(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
+void IndoorCameraD3D::LightmapFarClip(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
 {
-  unsigned int *pOutNumVertices_; // ebx@1
-  signed int v7; // esi@2
-  double v11; // st6@11
-  unsigned __int8 v14; // c2@16
-  unsigned __int8 v15; // c3@16
-  bool a1a; // [sp+Ch] [bp+8h]@7
+  bool current_vertices_flag;
+  bool next_vertices_flag;
+  double t;
+  signed int depth_num_vertices;
 
-  pOutNumVertices_ = pOutNumVertices;
-  *pOutNumVertices = 0;
-  if ( uNumInVertices )
+  memcpy(&pInVertices[uNumInVertices], &pInVertices[0], sizeof(pInVertices[uNumInVertices]));
+  depth_num_vertices = 0;
+  current_vertices_flag = false;
+  if ( pInVertices[0].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist )
+    current_vertices_flag = true;//настоящая вершина больше границы видимости
+  if ( (signed int)uNumInVertices <= 0 )
+    return;
+  //check for far clip plane(проверка по дальней границе)
+  //   
+  // v3.__________________. v0
+  //   |                  |
+  //   |                  |
+  //   |                  |
+  //  ----------------------- 8192.0(far_clip - 0x2000)
+  //   |                  |
+  //   .__________________.
+  //  v2                     v1
+
+  for ( uint i = 0; i < uNumInVertices; ++i )
   {
-    memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
-    v7 = 0;
-    if ( (double)pODMRenderParams->shading_dist_mist >= pInVertices->vWorldViewPosition.x )
-      v7 = 1;
-    for ( uint i = 0; i < uNumInVertices; i++ )
+    next_vertices_flag = pInVertices[i + 1].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist;
+    if ( current_vertices_flag ^ next_vertices_flag )//одна из граней за границей видимости
     {
-      a1a = (double)pODMRenderParams->shading_dist_mist >= pInVertices[i + 1].vWorldViewPosition.x;
-      if ( v7 != a1a )
+      if ( next_vertices_flag )//следующая вершина больше границы видимости(настоящая вершина меньше границы видимости) - v3
       {
-        if (a1a)
-        {
-          v11 = ((double)pODMRenderParams->shading_dist_mist - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i + 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x);
-          pOutVertices[*pOutNumVertices_].vWorldViewPosition.y = (pInVertices[i + 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * v11 + pInVertices[i].vWorldViewPosition.y;
-          pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (pInVertices[i + 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * v11 + pInVertices[i].vWorldViewPosition.z;
-          pOutVertices[*pOutNumVertices_].u = (pInVertices[i + 1].u - pInVertices[i].u) * v11 + pInVertices[i].u;
-          pOutVertices[*pOutNumVertices_].v = (pInVertices[i + 1].v - pInVertices[i].v) * v11 + pInVertices[i].v;
-        }
-        else
-        {
-          v11 = ((double)pODMRenderParams->shading_dist_mist - pInVertices[i + 1].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i + 1].vWorldViewPosition.x);
-          pOutVertices[*pOutNumVertices_].vWorldViewPosition.y = (pInVertices[i].vWorldViewPosition.y - pInVertices[i + 1].vWorldViewPosition.y) * v11 + pInVertices[i + 1].vWorldViewPosition.y;
-          pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (pInVertices[i].vWorldViewPosition.z - pInVertices[i + 1].vWorldViewPosition.z) * v11 + pInVertices[i + 1].vWorldViewPosition.z;
-          pOutVertices[*pOutNumVertices_].u = (pInVertices[i].u - pInVertices[i + 1].u) * v11 + pInVertices[i + 1].u;
-          pOutVertices[*pOutNumVertices_].v = (pInVertices[i].v - pInVertices[i + 1].v) * v11 + pInVertices[i + 1].v;
-        }
-        pOutVertices[*pOutNumVertices_].vWorldViewPosition.x = (double)pODMRenderParams->shading_dist_mist;
-        pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (double)pODMRenderParams->shading_dist_mist;
-        if (v7)
-        {
-          if (pOutVertices[*pOutNumVertices_].vWorldViewPosition.x != pInVertices[i].vWorldViewPosition.x
-           || pOutVertices[*pOutNumVertices_].vWorldViewPosition.y != pInVertices[i].vWorldViewPosition.y)
-            ++*pOutNumVertices_;
-          else
-          {
-            v14 = 0;
-            v15 = pOutVertices[*pOutNumVertices_].vWorldViewPosition.z == pInVertices[i].vWorldViewPosition.z;
-            if (!(v15 | v14))
-              ++*pOutNumVertices_;
-          }
-        }
-        else
-        {
-          if (pOutVertices[*pOutNumVertices_].vWorldViewPosition.x != pInVertices[i + 1].vWorldViewPosition.x
-           || pOutVertices[*pOutNumVertices_].vWorldViewPosition.y != pInVertices[i + 1].vWorldViewPosition.y)
-            ++*pOutNumVertices_;
-          else
-          {
-            v14 = 0;
-            v15 = pOutVertices[*pOutNumVertices_].vWorldViewPosition.z == pInVertices[i + 1].vWorldViewPosition.z;
-            if (!(v15 | v14))
-              ++*pOutNumVertices_;
-          }
-        }
+        //t = far_clip - v2.x / v3.x - v2.x (формула получения точки пересечения отрезка с плоскостью)
+        t = (pODMRenderParams->shading_dist_mist - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i + 1].vWorldViewPosition.x);
+        pOutVertices[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
+        //New_y = v2.y + (v3.y - v2.y)*t
+        pOutVertices[depth_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i].vWorldViewPosition.y - pInVertices[i + 1].vWorldViewPosition.y) * t;
+        //New_z = v2.z + (v3.z - v2.z)*t
+        pOutVertices[depth_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i].vWorldViewPosition.z - pInVertices[i + 1].vWorldViewPosition.z) * t;
+        pOutVertices[depth_num_vertices].u = pInVertices[i].u + (pInVertices[i].u - pInVertices[i + 1].u) * t;
+        pOutVertices[depth_num_vertices].v = pInVertices[i].v + (pInVertices[i].v - pInVertices[i + 1].v) * t;
+        pOutVertices[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist;
       }
-      if ( a1a )
+      else//настоящая вершина больше границы видимости(следующая вершина меньше границы видимости) - v0
       {
-        memcpy(&pOutVertices[*pOutNumVertices_], &pInVertices[i + 1], sizeof(pOutVertices[*pOutNumVertices_]));
-        pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (pInVertices[i + 1].vWorldViewPosition.x + 0.0000001);
-        pOutVertices[(*pOutNumVertices_)++].flt_2C = pInVertices[i + 1].flt_2C;
+        //t = far_clip - v1.x / v0.x - v1.x
+        t = (pODMRenderParams->shading_dist_mist - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i + 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x);
+        pOutVertices[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
+        //New_y = (v0.y - v1.y)*t + v1.y
+        pOutVertices[depth_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i + 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * t;
+        //New_z = (v0.z - v1.z)*t + v1.z
+        pOutVertices[depth_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i + 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * t;
+        pOutVertices[depth_num_vertices].u = pInVertices[i].u + (pInVertices[i + 1].u - pInVertices[i].u) * t;
+        pOutVertices[depth_num_vertices].v = pInVertices[i].v + (pInVertices[i + 1].v - pInVertices[i].v) * t;
+        pOutVertices[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist;
       }
-      v7 = a1a;
+      ++depth_num_vertices;
+    }
+    if ( !next_vertices_flag )//оба в границе видимости
+    {
+      memcpy(&pOutVertices[depth_num_vertices], &pInVertices[i + 1], sizeof(pOutVertices[depth_num_vertices]));
+      depth_num_vertices++;
     }
-    if ( (signed int)*pOutNumVertices_ < 3 )
-      *pOutNumVertices_ = 0;
+    current_vertices_flag = next_vertices_flag;
   }
+  if(depth_num_vertices >= 3)
+	*pOutNumVertices = depth_num_vertices;
+  else
+	*pOutNumVertices = 0;
 }
 
 //----- (00436CDC) --------------------------------------------------------
-void IndoorCameraD3D::_436CDC_mess_with_lightmap__clipflag_2(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
+void IndoorCameraD3D::LightmapNeerClip(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
 {
-  signed int v5; // esi@2
-  double v9; // st6@11
-  double v10; // st6@12
-  unsigned __int8 v12; // c2@16
-  unsigned __int8 v13; // c3@16
-  bool a1a; // [sp+Ch] [bp+8h]@7
+  double t; // st6@11
+  bool current_vertices_flag; // esi@2
+  bool next_vertices_flag; // [sp+Ch] [bp+8h]@7
+
+  //check for near clip plane(проверка по ближней границе)
+  //   
+  // v3.__________________. v0
+  //   |                  |
+  //   |                  |
+  //   |                  |
+  //  ----------------------- 8.0(near_clip - 8.0)
+  //   |                  |
+  //   .__________________.
+  //  v2                     v1
+
+  int out_num_vertices = 0;
 
   if ( uNumInVertices )
   {
-    *pOutNumVertices = 0;
-    memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
-    v5 = 0;
-    if ( pInVertices->vWorldViewPosition.x >= 8.0 )
-      v5 = 1;
-    if ( uNumInVertices + 1 > 1 )
-    {
-      for ( uint i = 1; i <= uNumInVertices; i++ )
-      {
-        a1a = pInVertices[i].vWorldViewPosition.x >= 8.0;
-        if ( v5 == a1a )
-          goto LABEL_23;
-        if ( a1a )
-        {
-          v9 = (8.0 - pInVertices[i - 1].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i - 1].vWorldViewPosition.x);
-          pOutVertices[*pOutNumVertices].vWorldViewPosition.y = (pInVertices[i].vWorldViewPosition.y - pInVertices[i - 1].vWorldViewPosition.y) * v9 + pInVertices[i - 1].vWorldViewPosition.y;
-          pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (pInVertices[i].vWorldViewPosition.z - pInVertices[i - 1].vWorldViewPosition.z) * v9 + pInVertices[i - 1].vWorldViewPosition.z;
-          pOutVertices[*pOutNumVertices].u = (pInVertices[i].u - pInVertices[i - 1].u) * v9 + pInVertices[i - 1].u;
-          pOutVertices[*pOutNumVertices].v = (pInVertices[i].v - pInVertices[i - 1].v) * v9 + pInVertices[i - 1].v;
-        }
-        else
-        {
-          v10 = (8.0 - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i - 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x);
-          pOutVertices[*pOutNumVertices].vWorldViewPosition.y = (pInVertices[i - 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * v10 + pInVertices[i].vWorldViewPosition.y;
-          pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (pInVertices[i - 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * v10 + pInVertices[i].vWorldViewPosition.z;
-          pOutVertices[*pOutNumVertices].u = (pInVertices[i - 1].u - pInVertices[i].u) * v10 + pInVertices[i].u;
-          pOutVertices[*pOutNumVertices].v = (pInVertices[i - 1].v - pInVertices[i].v) * v10 + pInVertices[i].v;
-        }
-        pOutVertices[*pOutNumVertices].vWorldViewPosition.x = 8.0;
-        pOutVertices[*pOutNumVertices]._rhw = 0.125;
-        if ( v5 )
-        {
-          if ( pOutVertices[*pOutNumVertices].vWorldViewPosition.x != pInVertices[i - 1].vWorldViewPosition.x
-            || pOutVertices[*pOutNumVertices].vWorldViewPosition.y != pInVertices[i - 1].vWorldViewPosition.y )
-          {
-            ++*pOutNumVertices;
-            goto LABEL_23;
-          }
-          v12 = 0;
-          v13 = pOutVertices[*pOutNumVertices].vWorldViewPosition.z == pInVertices[i - 1].vWorldViewPosition.z;
-        }
-        else
-        {
-          if ( pOutVertices[*pOutNumVertices].vWorldViewPosition.x != pInVertices[i].vWorldViewPosition.x
-            || pOutVertices[*pOutNumVertices].vWorldViewPosition.y != pInVertices[i].vWorldViewPosition.y )
-          {
-            ++*pOutNumVertices;
-            goto LABEL_23;
-          }
-          v12 = 0;
-          v13 = pOutVertices[*pOutNumVertices].vWorldViewPosition.z == pInVertices[i].vWorldViewPosition.z;
-        }
-        if ( !(v13 | v12) )
-          ++*pOutNumVertices;
-LABEL_23:
-        if ( a1a )
-        {
-          memcpy(&pOutVertices[*pOutNumVertices], &pInVertices[i], sizeof(pOutVertices[*pOutNumVertices]));
-          pOutVertices[(*pOutNumVertices)++]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001);
-        }
-        v5 = a1a;
-      }
-    }
-    if ( (signed int)*pOutNumVertices < 3 )
-      *pOutNumVertices = 0;
-  }
+	  memcpy(&pInVertices[uNumInVertices], &pInVertices[0], sizeof(pInVertices[0]));
+	  next_vertices_flag = false;
+	  current_vertices_flag = false;
+	  if ( pInVertices[0].vWorldViewPosition.x <= 8.0 )
+		current_vertices_flag = true;
+	  for (uint i = 0; i < uNumInVertices; ++i)
+	  {
+		next_vertices_flag = pInVertices[i + 1].vWorldViewPosition.x <= 8.0;//
+		if ( current_vertices_flag ^ next_vertices_flag )
+		{
+		  if ( next_vertices_flag )//следующая вершина за ближней границей
+		  {
+			//t = near_clip - v0.x / v1.x - v0.x    (формула получения точки пересечения отрезка с плоскостью)
+			t = (8.0 - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i + 1].vWorldViewPosition.x - pInVertices[i].vWorldViewPosition.x);
+			pOutVertices[out_num_vertices].vWorldViewPosition.x = 8.0;
+			pOutVertices[out_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i + 1].vWorldViewPosition.y - pInVertices[i].vWorldViewPosition.y) * t;
+			pOutVertices[out_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i + 1].vWorldViewPosition.z - pInVertices[i].vWorldViewPosition.z) * t;
+			pOutVertices[out_num_vertices].u = pInVertices[i].u + (pInVertices[i + 1].u - pInVertices[i].u) * t;
+			pOutVertices[out_num_vertices].v = pInVertices[i].v + (pInVertices[i + 1].v - pInVertices[i].v) * t;
+			pOutVertices[out_num_vertices]._rhw = 1.0 / 8.0;
+			//pOutVertices[*pOutNumVertices]._rhw = 0.125;
+		  }
+		  else// текущая вершина за ближней границей
+		  {
+			t = (8.0 - pInVertices[i].vWorldViewPosition.x) / (pInVertices[i].vWorldViewPosition.x - pInVertices[i + 1].vWorldViewPosition.x);
+			pOutVertices[out_num_vertices].vWorldViewPosition.x = 8.0;
+			pOutVertices[out_num_vertices].vWorldViewPosition.y = pInVertices[i].vWorldViewPosition.y + (pInVertices[i].vWorldViewPosition.y - pInVertices[i + 1].vWorldViewPosition.y) * t;
+			pOutVertices[out_num_vertices].vWorldViewPosition.z = pInVertices[i].vWorldViewPosition.z + (pInVertices[i].vWorldViewPosition.z - pInVertices[i + 1].vWorldViewPosition.z) * t;
+			pOutVertices[out_num_vertices].u = pInVertices[i].u + (pInVertices[i].u - pInVertices[i + 1].u) * t;
+			pOutVertices[out_num_vertices].v = pInVertices[i].v + (pInVertices[i].v - pInVertices[i + 1].v) * t;
+			pOutVertices[out_num_vertices]._rhw = 1.0 / 8.0;
+		  }
+		  ++out_num_vertices;
+		}
+		if ( !next_vertices_flag )
+		{
+		  memcpy(&pOutVertices[out_num_vertices], &pInVertices[i + 1], sizeof(pInVertices[i + 1]));
+		  //pOutVertices[out_num_vertices]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001);
+		  out_num_vertices++;
+		}
+		current_vertices_flag = next_vertices_flag;
+	  }
+	  if(out_num_vertices >=3 )
+		*pOutNumVertices = out_num_vertices;
+	  else
+		*pOutNumVertices = 0;
+	}
 }
 
 //----- (00481D77) --------------------------------------------------------
--- a/Engine/Graphics/IndoorCameraD3D.h	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/IndoorCameraD3D.h	Sun May 17 22:42:13 2015 +0600
@@ -138,8 +138,8 @@
   struct IDirect3DTexture2 *LoadTextureAndGetHardwarePtr(char *Str1);
   void Project(signed int x, signed int y, signed int z, int *a5, int *a6);
   void Project(struct RenderVertexSoft *pVertices, unsigned int uNumVertices, char a4);
-  void _436CDC_mess_with_lightmap__clipflag_2(struct RenderVertexSoft *pInVertices, int uNumInVertices, struct RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices);
-  void _436F09_mess_with_lightmap__clipflag_4(struct RenderVertexSoft *pInVertices, int uNumInVertices, struct RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices);
+  void LightmapNeerClip(struct RenderVertexSoft *pInVertices, int uNumInVertices, struct RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices);
+  void LightmapFarClip(struct RenderVertexSoft *pInVertices, int uNumInVertices, struct RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices);
   void _437143(unsigned int uNumInVertices, struct RenderVertexSoft *pOutVertices, struct RenderVertexSoft *pInVertices, signed int *pOutNumVertices);
   bool _4371C3(struct RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, int _unused);
   bool CalcPortalShape(struct RenderVertexSoft *a1, unsigned int *pOutNumVertices, struct RenderVertexSoft *pVertices, IndoorCameraD3D_Vec4 *a4, signed int uNumVertices, char a6, int _unused);
@@ -161,7 +161,7 @@
   bool GetFacetOrientation(char polyType, struct Vec3_float_ *a2, struct Vec3_float_ *a3, struct Vec3_float_ *a4);
   void ViewTransform(struct RenderVertexSoft *a1a, unsigned int uNumVertices);
   bool IsCulled(struct BLVFace *pFace);
-  void ViewTransfrom_OffsetUV(struct RenderVertexSoft *pVertices, unsigned int uNumVertices, struct RenderVertexSoft *pOutVertices, struct stru320 *a5);
+  void ViewTransfrom_OffsetUV(struct RenderVertexSoft *pVertices, unsigned int uNumVertices, struct RenderVertexSoft *pOutVertices, struct LightsData *a5);
   bool ApplyViewTransform_TrueIfStillVisible_BLV(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow);
   float GetPickDepth();
   float GetShadingDistMist();
--- a/Engine/Graphics/LightmapBuilder.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/LightmapBuilder.cpp	Sun May 17 22:42:13 2015 +0600
@@ -38,12 +38,12 @@
   // For initialization step(II)
 
   for ( int i = 0; i < 512; ++i )//for light type 1
-    this->std__vector_000004[i] = Lightmap();
-  this->std__vector_000004_size = 0;
+    this->StationaryLights[i] = Lightmap();
+  this->StationaryLightsCount = 0;
 
   for ( int i = 0; i < 768; ++i )//for light type 2
-    this->std__vector_183808[i] = Lightmap();
-  this->std__vector_183808_size = 0;
+    this->MobileLights[i] = Lightmap();
+  this->MobileLightsCount = 0;
 
   for ( int i = 0; i < 256; i++ )
     this->field_3C8C34[i].flt_2C = 0.0f;
@@ -58,9 +58,9 @@
   bool result; // eax@9
   int pSlot; // [sp+10h] [bp-4h]@1
 
-  v3 = stru_F8AD28.uDefaultAmbientLightLevel + pFace->uShadeType;
+  v3 = Lights.uDefaultAmbientLightLevel + pFace->uShadeType;
   pSlot = 0;
-  stru_F8AD28.uCurrentAmbientLightLevel = v3 << 16;
+  Lights.uCurrentAmbientLightLevel = v3 << 16;
   for ( uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i )
   {
     if ( pSlot >= 20 )
@@ -74,7 +74,7 @@
     ApplyLight_ODM(&pStationaryLightsStack->pLights[i], pFace, (unsigned int *)&pSlot, 0);
   }
   result = pSlot;
-  stru_F8AD28.uNumLightsApplied = pSlot;
+  Lights.uNumLightsApplied = pSlot;
   return true;
 }
 
@@ -154,65 +154,38 @@
     return false;
 
   Vec3_float_::NegDot(&TerrainVertices->vWorldPosition, pNormal, a3);
-  float p_dot = (float)pLight->vPosition.x * pNormal->x 
+  float p_dot = ((float)pLight->vPosition.x * pNormal->x 
               + (float)pLight->vPosition.y * pNormal->y 
-              + (float)pLight->vPosition.z * pNormal->z + *a3;
-  p_dot = p_dot + 0.5f;
-  if  ( (//v49 = pNormal,
-        //Vec3_float_::NegDot(&a1->vWorldPosition, pNormal, a3),
-        //X = v8->vPosition.y,
-        //v50 = (double)v8->vPosition.y * v49->y,
-        //X = v8->vPosition.z,
-        //v51 = (double)v8->vPosition.z * v49->z,
-        //X = v8->vPosition.x,
-        //*(float *)&a3 = (double)pLight->vPosition.y * pNormal->y 
-                      //+ (double)pLight->vPosition.z * pNormal->z 
-                      //+ (double)pLight->vPosition.x * pNormal->x + *a3,
-        //v61 = *(float *)&a3 + 0.5f,
-        //result = LODWORD(v61),
-        //X = LODWORD(v61),
-        //v52 = v63,
-        p_dot > pLight->uRadius) )
+              + (float)pLight->vPosition.z * pNormal->z + *a3)+0.5f;
+  if  ( p_dot > pLight->uRadius )
     return false;
-/*
-        v49 = pNormal;
-        Vec3_float_::NegDot(&v11->vWorldPosition, pNormal, a3);
-        *(float *)a3 = (double)v8->vPosition.x * v49->x
-                      + (double)v8->vPosition.y * v49->y
-                      + (double)v8->vPosition.z * v49->z + *a3;
-        v61 = *(float *)a3 + 6.7553994e15;
-        result = LODWORD(v61);
-        X = LODWORD(v61);
-        v52 = radius_1;
-  if ( SLODWORD(v61) > radius_1)*/
-  //v53 = pSlot;
-  //v60 = X;
-  stru_F8AD28._blv_lights_radii[*pSlot] = pLight->uRadius;
-  stru_F8AD28._blv_lights_inv_radii[*pSlot] = 65536 / pLight->uRadius;
-  stru_F8AD28._blv_lights_xs[*pSlot] = pLight->vPosition.x;
-  stru_F8AD28._blv_lights_ys[*pSlot] = pLight->vPosition.y;
-  stru_F8AD28._blv_lights_zs[*pSlot] = pLight->vPosition.z;
+
+  Lights._blv_lights_radii[*pSlot] = pLight->uRadius;
+  Lights._blv_lights_inv_radii[*pSlot] = 65536 / pLight->uRadius;
+  Lights._blv_lights_xs[*pSlot] = pLight->vPosition.x;
+  Lights._blv_lights_ys[*pSlot] = pLight->vPosition.y;
+  Lights._blv_lights_zs[*pSlot] = pLight->vPosition.z;
 
-  stru_F8AD28._blv_lights_rs[*pSlot] = pLight->uLightColorR / 255.0f;
-  stru_F8AD28._blv_lights_gs[*pSlot] = pLight->uLightColorG / 255.0f;
-  stru_F8AD28._blv_lights_bs[*pSlot] = pLight->uLightColorB / 255.0f;
+  Lights._blv_lights_rs[*pSlot] = pLight->uLightColorR / 255.0f;
+  Lights._blv_lights_gs[*pSlot] = pLight->uLightColorG / 255.0f;
+  Lights._blv_lights_bs[*pSlot] = pLight->uLightColorB / 255.0f;
 
-  stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = abs(p_dot);
-  stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType;
+  Lights._blv_lights_light_dot_faces[*pSlot] = abs(p_dot);
+  Lights._blv_lights_types[*pSlot] = pLight->uLightType;
 
-  v57 = stru_F8AD28._blv_lights_types[*pSlot];
-  if ( /*pRenderer->pRenderD3D &&*/ pRenderer->bUsingSpecular && stru_F8AD28._blv_lights_types[*pSlot] & 4 )
+  v57 = Lights._blv_lights_types[*pSlot];
+  if ( pRenderer->bUsingSpecular && Lights._blv_lights_types[*pSlot] & 4 )
     v57 = _4E94D2_light_type;
-  stru_F8AD28._blv_lights_types[*pSlot] = v57;
+  Lights._blv_lights_types[*pSlot] = v57;
 
   int id = 4 * *pSlot;
-  if ( /*pRenderer->pRenderD3D &&*/ pRenderer->bUsingSpecular )
+  if ( pRenderer->bUsingSpecular )
   {
-    if ( stru_F8AD28._blv_lights_types[*pSlot] & 4 )
+    if ( Lights._blv_lights_types[*pSlot] & 4 )
     {
-      stru_F8AD28._blv_lights_rs[id] = stru_F8AD28._blv_lights_rs[id] * 0.3300000131130219;
-      stru_F8AD28._blv_lights_gs[id] = stru_F8AD28._blv_lights_gs[id] * 0.3300000131130219;
-      stru_F8AD28._blv_lights_bs[id] = stru_F8AD28._blv_lights_bs[id] * 0.3300000131130219;
+      Lights._blv_lights_rs[id] = Lights._blv_lights_rs[id] * 0.3300000131130219;
+      Lights._blv_lights_gs[id] = Lights._blv_lights_gs[id] * 0.3300000131130219;
+      Lights._blv_lights_bs[id] = Lights._blv_lights_bs[id] * 0.3300000131130219;
     }
   }
   ++*pSlot;
@@ -237,33 +210,33 @@
     && (pLight->vPosition.z > pFace->pBoundingBox.z1 - pLight->uRadius) && pLight->vPosition.z < pLight->uRadius + pFace->pBoundingBox.z2
     && ((a4) || v10 >= 0) && v10 <= pLight->uRadius )
   {
-    stru_F8AD28._blv_lights_radii[*pSlot] = pLight->uRadius;
-    stru_F8AD28._blv_lights_inv_radii[*pSlot] = 65536 / pLight->uRadius;
-    stru_F8AD28._blv_lights_xs[*pSlot] = pLight->vPosition.x;
-    stru_F8AD28._blv_lights_ys[*pSlot] = pLight->vPosition.y;
-    stru_F8AD28._blv_lights_zs[*pSlot] = pLight->vPosition.z;
-    stru_F8AD28._blv_lights_rs[*pSlot] = (double)pLight->uLightColorR * 0.0039215689;
-    stru_F8AD28._blv_lights_gs[*pSlot] = (double)pLight->uLightColorG * 0.0039215689;
-    stru_F8AD28._blv_lights_bs[*pSlot] = (double)pLight->uLightColorB * 0.0039215689;
+    Lights._blv_lights_radii[*pSlot] = pLight->uRadius;
+    Lights._blv_lights_inv_radii[*pSlot] = 65536 / pLight->uRadius;
+    Lights._blv_lights_xs[*pSlot] = pLight->vPosition.x;
+    Lights._blv_lights_ys[*pSlot] = pLight->vPosition.y;
+    Lights._blv_lights_zs[*pSlot] = pLight->vPosition.z;
+    Lights._blv_lights_rs[*pSlot] = (double)pLight->uLightColorR * 0.0039215689;
+    Lights._blv_lights_gs[*pSlot] = (double)pLight->uLightColorG * 0.0039215689;
+    Lights._blv_lights_bs[*pSlot] = (double)pLight->uLightColorB * 0.0039215689;
     //v11 = abs(v10);
     //v12 = pRenderer->bUsingSpecular;
-    stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = abs(v10);
-    stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType;
+    Lights._blv_lights_light_dot_faces[*pSlot] = abs(v10);
+    Lights._blv_lights_types[*pSlot] = pLight->uLightType;
     //v13 = pRenderer->pRenderD3D;
-    v14 = stru_F8AD28._blv_lights_types[*pSlot];
+    v14 = Lights._blv_lights_types[*pSlot];
     if ( /*pRenderer->pRenderD3D &&*/ pRenderer->bUsingSpecular && v14 & 4 )
       v14 = _4E94D2_light_type;
-    stru_F8AD28._blv_lights_types[*pSlot] = v14;
+    Lights._blv_lights_types[*pSlot] = v14;
     result = 4 * *pSlot;
     if ( /*v13*/true && pRenderer->bUsingSpecular )
     {
-      if ( stru_F8AD28._blv_lights_types[*pSlot] & 4 )
+      if ( Lights._blv_lights_types[*pSlot] & 4 )
       {
-        *(float *)((char *)stru_F8AD28._blv_lights_rs + result) = *(float *)((char *)stru_F8AD28._blv_lights_rs + result)
+        *(float *)((char *)Lights._blv_lights_rs + result) = *(float *)((char *)Lights._blv_lights_rs + result)
                                                                 * 0.33000001;
-        *(float *)((char *)stru_F8AD28._blv_lights_gs + result) = *(float *)((char *)stru_F8AD28._blv_lights_gs + result)
+        *(float *)((char *)Lights._blv_lights_gs + result) = *(float *)((char *)Lights._blv_lights_gs + result)
                                                                 * 0.33000001;
-        *(float *)((char *)stru_F8AD28._blv_lights_bs + result) = *(float *)((char *)stru_F8AD28._blv_lights_bs + result)
+        *(float *)((char *)Lights._blv_lights_bs + result) = *(float *)((char *)Lights._blv_lights_bs + result)
                                                                 * 0.33000001;
       }
     }
@@ -283,7 +256,7 @@
   BLVFace* pFace = &pIndoor->pFaces[uFaceID];
   BLVSector* pSector = &pIndoor->pSectors[pFace->uSectorID];
 
-  stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + pSector->uMinAmbientLightLevel) << 16;//0x00180000
+  Lights.uCurrentAmbientLightLevel = (Lights.uDefaultAmbientLightLevel + pSector->uMinAmbientLightLevel) << 16;//0x00180000
 
   uint uNumLightsApplied = 0;
   for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i)
@@ -312,7 +285,7 @@
     ApplyLight_BLV(pStationaryLightsStack->pLights + i, pFace, &uNumLightsApplied, false, &_4E94D0_light_type);
   }
 
-  stru_F8AD28.uNumLightsApplied = uNumLightsApplied;
+  Lights.uNumLightsApplied = uNumLightsApplied;
   return true;
 }
 
@@ -337,16 +310,16 @@
     {
       unsigned int slot = *pSlot;
 
-      stru_F8AD28._blv_lights_radii[slot] = pLight->uRadius;
-      stru_F8AD28._blv_lights_inv_radii[slot] = 65536 / pLight->uRadius;
-      stru_F8AD28._blv_lights_xs[slot] = pLight->vPosition.x;
-      stru_F8AD28._blv_lights_ys[slot] = pLight->vPosition.y;
-      stru_F8AD28._blv_lights_zs[slot] = pLight->vPosition.z;
-      stru_F8AD28._blv_lights_rs[slot] = (double)pLight->uLightColorR / 255.0f;
-      stru_F8AD28._blv_lights_gs[slot] = (double)pLight->uLightColorG / 255.0f;
-      stru_F8AD28._blv_lights_bs[slot] = (double)pLight->uLightColorB / 255.0f;
-      stru_F8AD28._blv_lights_light_dot_faces[slot] = abs((int)floorf(v13 + 0.5f));
-      stru_F8AD28._blv_lights_types[slot] = pLight->uLightType;
+      Lights._blv_lights_radii[slot] = pLight->uRadius;
+      Lights._blv_lights_inv_radii[slot] = 65536 / pLight->uRadius;
+      Lights._blv_lights_xs[slot] = pLight->vPosition.x;
+      Lights._blv_lights_ys[slot] = pLight->vPosition.y;
+      Lights._blv_lights_zs[slot] = pLight->vPosition.z;
+      Lights._blv_lights_rs[slot] = (double)pLight->uLightColorR / 255.0f;
+      Lights._blv_lights_gs[slot] = (double)pLight->uLightColorG / 255.0f;
+      Lights._blv_lights_bs[slot] = (double)pLight->uLightColorB / 255.0f;
+      Lights._blv_lights_light_dot_faces[slot] = abs((int)floorf(v13 + 0.5f));
+      Lights._blv_lights_types[slot] = pLight->uLightType;
 
       *pSlot += 1;
       return true;
@@ -365,8 +338,8 @@
   v.y = 1.0;
   v.x = 1.0;
   
-  for (uint i = 0; i < std__vector_183808_size; ++i)
-    if (!pRenderer->DrawLightmap(std__vector_183808 + i, &v, z_bias))
+  for (uint i = 0; i < MobileLightsCount; ++i)
+    if (!pRenderer->DrawLightmap(&MobileLights[i], &v, z_bias))
       Error("Invalid lightmap detected! (%u)", i);
 
   return true;
@@ -497,7 +470,7 @@
   v6 = 0;
   //v7 = this;
   a7 = 0;
-  stru_F8AD28.uCurrentAmbientLightLevel = pOutdoor->field_CBC_terrain_triangles_shade_type;
+  Lights.uCurrentAmbientLightLevel = pOutdoor->field_CBC_terrain_triangles_shade_type;
   if ( pMobileLightsStack->uNumLightsActive > 0 )
   {
     v8 = pMobileLightsStack->pLights;
@@ -526,7 +499,7 @@
     while ( v9 < pStationaryLightsStack->uNumLightsActive );
   }
 
-  stru_F8AD28.uNumLightsApplied = a7;
+  Lights.uNumLightsApplied = a7;
   return true;*/
 //	bool __stdcall sub_45D036(struct Vec3<float> *pNormal, int a2, struct RenderVertex *a3, int a4, signed int X)
 //{
@@ -537,7 +510,7 @@
   int i;
 
   num_lights = 0;
-  stru_F8AD28.uCurrentAmbientLightLevel = pOutdoor->max_terrain_dimming_level;
+  Lights.uCurrentAmbientLightLevel = pOutdoor->max_terrain_dimming_level;
   for (i = 0; i < pMobileLightsStack->uNumLightsActive; ++i)
   {
       if ( num_lights >= 20 )
@@ -552,7 +525,7 @@
       StackLight_TerrainFace(&pStationaryLightsStack->pLights[i], pNormal, Light_tile_dist, a3, uStripType, bLightBackfaces, &num_lights);
   }
 
-  stru_F8AD28.uNumLightsApplied = num_lights;
+  Lights.uNumLightsApplied = num_lights;
   return true;
 
 }
@@ -560,7 +533,7 @@
 
 /////////////////////////TOGETHER///////////////////////////////////////////////////////
 //----- (0045BC07) --------------------------------------------------------
-bool LightmapBuilder::ApplyLights(stru320 *a2, stru154 *a3, unsigned int uNumVertices, RenderVertexSoft *a5, IndoorCameraD3D_Vec4 *a6, char uClipFlag)
+bool LightmapBuilder::ApplyLights(LightsData *pLights, stru154 *a3, unsigned int uNumVertices, RenderVertexSoft *VertexRenderList, IndoorCameraD3D_Vec4 *a6, char uClipFlag)
 {
  //For outdoor terrain and indoor light (III)(III)
   Vec3_int_ pos; // [sp+2Ch] [bp-40h]@21
@@ -571,11 +544,11 @@
 
   static RenderVertexSoft static_69B140[64];
 
-  a9 = a5;
+  a9 = VertexRenderList;
   if (a6)
   {
     for (uint i = 0; i < uNumVertices; ++i)
-      memcpy(&static_69B140[i], a5 + i, sizeof(RenderVertexSoft));
+      memcpy(&static_69B140[i], VertexRenderList + i, sizeof(RenderVertexSoft));
 
     if (pIndoorCameraD3D->_437376(a3, static_69B140, &uNumVertices) == 1)
     {
@@ -586,32 +559,32 @@
   }
 
   static stru314 static_69B110;
-  static_69B110.field_4.x = a3->face_plane.vNormal.x;
-  static_69B110.field_4.y = a3->face_plane.vNormal.y;
-  static_69B110.field_4.z = a3->face_plane.vNormal.z;
+  static_69B110.Normal.x = a3->face_plane.vNormal.x;
+  static_69B110.Normal.y = a3->face_plane.vNormal.y;
+  static_69B110.Normal.z = a3->face_plane.vNormal.z;
   static_69B110.dist = a3->face_plane.dist;
-  if (!pIndoorCameraD3D->GetFacetOrientation(a3->polygonType, &static_69B110.field_4,
+  if (!pIndoorCameraD3D->GetFacetOrientation(a3->polygonType, &static_69B110.Normal,
           &static_69B110.field_10, &static_69B110.field_1C))
   {
     MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:119", 0);
     ExitProcess(0);
   }
 
-  for (uint i = 0; i < a2->uNumLightsApplied; ++i)
+  for (uint i = 0; i < pLights->uNumLightsApplied; ++i)
   {
-    pos.x = a2->_blv_lights_xs[i];
-    pos.y = a2->_blv_lights_ys[i];
-    pos.z = a2->_blv_lights_zs[i];
+    pos.x = pLights->_blv_lights_xs[i];
+    pos.y = pLights->_blv_lights_ys[i];
+    pos.z = pLights->_blv_lights_zs[i];
 
-    uint uColorR = (uint)floorf(a2->_blv_lights_rs[i] * 255.0 + 0.5f) & 0xFF,
-         uColorG = (uint)floorf(a2->_blv_lights_gs[i] * 255.0 + 0.5f) & 0xFF,
-         uColorB = (uint)floorf(a2->_blv_lights_bs[i] * 255.0 + 0.5f) & 0xFF;
+    uint uColorR = (uint)floorf(pLights->_blv_lights_rs[i] * 255.0 + 0.5f) & 0xFF,
+         uColorG = (uint)floorf(pLights->_blv_lights_gs[i] * 255.0 + 0.5f) & 0xFF,
+         uColorB = (uint)floorf(pLights->_blv_lights_bs[i] * 255.0 + 0.5f) & 0xFF;
     uint uColor = (uColorR << 16) | (uColorG << 8) | uColorB;
     if (!uColor)
       uColor = 0x0FFFFF;//0x00FFFFF;
 
-    if (!_45BE86_build_light_polygon(&pos, a2->_blv_lights_radii[i], uColor, a2->_blv_lights_light_dot_faces[i],
-              a2->_blv_lights_types[i], &static_69B110, uNumVertices, a9, uClipFlag) )
+    if (!_45BE86_build_light_polygon(&pos, pLights->_blv_lights_radii[i], uColor, pLights->_blv_lights_light_dot_faces[i],
+              pLights->_blv_lights_types[i], &static_69B110, uNumVertices, a9, uClipFlag) )
     {
       MessageBoxW(nullptr, L"Error: Failed to build light polygon", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:138", 0);
     }
@@ -634,59 +607,59 @@
   if (radius < 0.0f)
     return true;
 
-  lightmap = uLightType & 1 ? &std__vector_000004[std__vector_000004_size] ://stationary
-                         &std__vector_183808[std__vector_183808_size];//mobile
+  lightmap = uLightType & 1 ? &StationaryLights[StationaryLightsCount] ://stationary
+                         &MobileLights[MobileLightsCount];//mobile
   tex_light_radius = radius - dot_dist;
   flt_3C8C28 = sqrt((radius + radius - tex_light_radius) * tex_light_radius);
   //flt_3C8C28 = sqrt(tex_light_radius * tex_light_radius);
   flt_3C8C2C_lightmaps_brightness = 1.0 - (radius - flt_3C8C28) / radius;
-  lightmap->position_x = (double)pos->x - dot_dist * a7->field_4.x;
-  lightmap->position_y = (double)pos->y - dot_dist * a7->field_4.y;
-  lightmap->position_z = (double)pos->z - dot_dist * a7->field_4.z;
+  lightmap->position_x = (double)pos->x - dot_dist * a7->Normal.x;
+  lightmap->position_y = (double)pos->y - dot_dist * a7->Normal.y;
+  lightmap->position_z = (double)pos->z - dot_dist * a7->Normal.z;
 
-  flt_3C8C30 = radius * flt_3C8C2C_lightmaps_brightness;
-  flt_3C8C0C = flt_3C8C30 * a7->field_10.x;
-  flt_3C8C10 = flt_3C8C30 * a7->field_10.y;
-  flt_3C8C14 = flt_3C8C30 * a7->field_10.z;
+  light_radius = radius * flt_3C8C2C_lightmaps_brightness;
+  light_length_x = light_radius * a7->field_10.x;
+  light_length_y = light_radius * a7->field_10.y;
+  light_length_z = light_radius * a7->field_10.z;
 
-  flt_3C8C18 = flt_3C8C30 * a7->field_1C.x;
-  flt_3C8C1C = flt_3C8C30 * a7->field_1C.y;
-  flt_3C8C20 = flt_3C8C30 * a7->field_1C.z;
+  light_length_x2 = light_radius * a7->field_1C.x;
+  light_length_y2 = light_radius * a7->field_1C.y;
+  light_length_z2 = light_radius * a7->field_1C.z;
 
-  lightmap->pVertices[0].vWorldPosition.x = lightmap->position_x - flt_3C8C18 + flt_3C8C0C;
-  lightmap->pVertices[0].vWorldPosition.y = lightmap->position_y - flt_3C8C1C + flt_3C8C10;
-  lightmap->pVertices[0].vWorldPosition.z = lightmap->position_z - flt_3C8C20 + flt_3C8C14;
+  lightmap->pVertices[0].vWorldPosition.x = lightmap->position_x - light_length_x2 + light_length_x;
+  lightmap->pVertices[0].vWorldPosition.y = lightmap->position_y - light_length_y2 + light_length_y;
+  lightmap->pVertices[0].vWorldPosition.z = lightmap->position_z - light_length_z2 + light_length_z;
   lightmap->pVertices[0].u = 0.0;
   lightmap->pVertices[0].v = 0.0;
 
-  lightmap->pVertices[1].vWorldPosition.x = lightmap->position_x - flt_3C8C18 - flt_3C8C0C;
-  lightmap->pVertices[1].vWorldPosition.y = lightmap->position_y - flt_3C8C1C - flt_3C8C10;
-  lightmap->pVertices[1].vWorldPosition.z = lightmap->position_z - flt_3C8C20 - flt_3C8C14;
+  lightmap->pVertices[1].vWorldPosition.x = lightmap->position_x - light_length_x2 - light_length_x;
+  lightmap->pVertices[1].vWorldPosition.y = lightmap->position_y - light_length_y2 - light_length_y;
+  lightmap->pVertices[1].vWorldPosition.z = lightmap->position_z - light_length_z2 - light_length_z;
   lightmap->pVertices[1].u = 0.0;
   lightmap->pVertices[1].v = 1.0;
 
-  lightmap->pVertices[2].vWorldPosition.x = lightmap->position_x + flt_3C8C18 - flt_3C8C0C;
-  lightmap->pVertices[2].vWorldPosition.y = lightmap->position_y + flt_3C8C1C - flt_3C8C10;
-  lightmap->pVertices[2].vWorldPosition.z = lightmap->position_z + flt_3C8C20 - flt_3C8C14;
+  lightmap->pVertices[2].vWorldPosition.x = lightmap->position_x + light_length_x2 - light_length_x;
+  lightmap->pVertices[2].vWorldPosition.y = lightmap->position_y + light_length_y2 - light_length_y;
+  lightmap->pVertices[2].vWorldPosition.z = lightmap->position_z + light_length_z2 - light_length_z;
   lightmap->pVertices[2].u = 1.0;
   lightmap->pVertices[2].v = 1.0;
 
-  lightmap->pVertices[3].vWorldPosition.x = lightmap->position_x + flt_3C8C18 + flt_3C8C0C;
-  lightmap->pVertices[3].vWorldPosition.y = lightmap->position_y + flt_3C8C1C + flt_3C8C10;
-  lightmap->pVertices[3].vWorldPosition.z = lightmap->position_z + flt_3C8C20 + flt_3C8C14;
+  lightmap->pVertices[3].vWorldPosition.x = lightmap->position_x + light_length_x2 + light_length_x;
+  lightmap->pVertices[3].vWorldPosition.y = lightmap->position_y + light_length_y2 + light_length_y;
+  lightmap->pVertices[3].vWorldPosition.z = lightmap->position_z + light_length_z2 + light_length_z;
   lightmap->pVertices[3].u = 1.0;
   lightmap->pVertices[3].v = 0.0;
 
   for (uint i = 0; i < 4; ++i)
   {
-    v24 = a7->field_4.y * lightmap->pVertices[i].vWorldPosition.y
-        + a7->field_4.z * lightmap->pVertices[i].vWorldPosition.z
-        + a7->field_4.x * lightmap->pVertices[i].vWorldPosition.x
+    v24 = a7->Normal.y * lightmap->pVertices[i].vWorldPosition.y
+        + a7->Normal.z * lightmap->pVertices[i].vWorldPosition.z
+        + a7->Normal.x * lightmap->pVertices[i].vWorldPosition.x
         + a7->dist;
 
-    lightmap->pVertices[i].vWorldPosition.x -= v24 * a7->field_4.x;
-    lightmap->pVertices[i].vWorldPosition.y -= v24 * a7->field_4.y;
-    lightmap->pVertices[i].vWorldPosition.z -= v24 * a7->field_4.z;
+    lightmap->pVertices[i].vWorldPosition.x -= v24 * a7->Normal.x;
+    lightmap->pVertices[i].vWorldPosition.y -= v24 * a7->Normal.y;
+    lightmap->pVertices[i].vWorldPosition.z -= v24 * a7->Normal.z;
   }
 
   lightmap->uColorMask = uColorMask;
@@ -714,14 +687,14 @@
     if (v38 > radius)
       return true;
     //radius = (1 / radius) * v38;
-    if ( uLightType & 4 )
+    if ( uLightType & 4 )//LIGHT_ATTR_POINT
     {
-      v39 = fabs(a1.x * a7->field_4.x + a1.z * a7->field_4.z + a1.y * a7->field_4.y);
+      v39 = fabs(a1.x * a7->Normal.x + a1.z * a7->Normal.z + a1.y * a7->Normal.y);
       v40 = v39 * 1.0 * flt_4D86CC;
 
       lightmap->fBrightness = v40 - ((1 / radius) * v38) * v40;
     }
-    else if ( uLightType & 8 )
+    else if ( uLightType & 8 )//LIGHT_ATTR_SPOTLIGHT
     {
         v40 = 1.0 * 1.0;
         lightmap->fBrightness = v40 - ((1 / radius) * v38);
@@ -732,7 +705,7 @@
  //Brightness(яркость)/////////////////////////////////////////////////////
 
   if (!pEngine->pStru9Instance->_4980B9(a9, uNumVertices,
-                                      a7->field_4.x, a7->field_4.y, a7->field_4.z,
+                                      a7->Normal.x, a7->Normal.y, a7->Normal.z,
                                       lightmap->pVertices, &lightmap->NumVertices))
     return false;
 
@@ -747,18 +720,18 @@
   pIndoorCameraD3D->Project(lightmap->pVertices, lightmap->NumVertices, 0);
 
   unsigned int _a4 = 0;
-  if ( !(uClipFlag & 1) )
+  if ( !(uClipFlag & 1) )//NoClipFlag
     _a4 = 1;
   else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
   {
-    if ( uClipFlag & 2 )
+    if ( uClipFlag & 2 )//NeerClipFlag
     {
-      pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
+      pIndoorCameraD3D->LightmapNeerClip(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
       pIndoorCameraD3D->_437143(_a4, lightmap->pVertices, field_3C8C34, &lightmap->NumVertices);
     }
-    else if ( uClipFlag & 4 )
+    else if ( uClipFlag & 4 )//FarClipFlag
     {
-      pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
+      pIndoorCameraD3D->LightmapFarClip(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
       pIndoorCameraD3D->_437143(_a4, lightmap->pVertices, field_3C8C34, &lightmap->NumVertices);
     }
     else
@@ -771,13 +744,13 @@
   {
     if (uLightType & 1)
     {
-      if (std__vector_000004_size < 512 - 1)
-        ++std__vector_000004_size;
+      if (StationaryLightsCount < 512 - 1)
+        ++StationaryLightsCount;
     }
     else
     {
-      if (std__vector_183808_size < 768 - 1)
-        ++std__vector_183808_size;
+      if (MobileLightsCount < 768 - 1)
+        ++MobileLightsCount;
     }
     //if ( v50 ^ v51 )
     //  *(unsigned int *)v48 = v49 + 1;
@@ -786,7 +759,7 @@
 }
 
 //----- (0045C6D6) --------------------------------------------------------
-int LightmapBuilder::_45C6D6(int a2, RenderVertexSoft *a3, Lightmap *pLightmap)
+int LightmapBuilder::_45C6D6(int uNumVertices, RenderVertexSoft *a3, Lightmap *pLightmap)
 {
   //For outdoor terrain and indoor light (V)(V)
   signed int v6; // esi@1
@@ -802,9 +775,9 @@
   {
     for ( uint i = 0; i < (signed int)pLightmap->NumVertices; ++i )
     {
-      if ( a2 > 0 )
+      if ( uNumVertices > 0 )
       {
-        for ( uint j = 0; j < a2; ++j )
+        for ( uint j = 0; j < uNumVertices; ++j )
         {
           if ( pLightmap->pVertices[i].vWorldPosition.x <= (double)a3[j].vWorldPosition.x )
             temp_x = a3[j].vWorldPosition.x - pLightmap->pVertices[i].vWorldPosition.x;
@@ -854,13 +827,13 @@
 }
 
 //----- (0045D74F) --------------------------------------------------------
-bool LightmapBuilder::DrawLightmaps(int *indices)
+bool LightmapBuilder::DrawLightmaps(int indices)
 {
   //For outdoor terrain and indoor light (VI)(VI)
   Lightmap *v28; // [sp+50h] [bp-38h]@2
   Vec3_float_ arg4;
 
-  if (std__vector_000004_size == 0)
+  if (StationaryLightsCount == 0)
     return true;
   
   if (byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_01_lightmap_related)
@@ -871,23 +844,23 @@
   arg4.x = 1.0f;
   arg4.y = 1.0f;
   arg4.z = 1.0f;
-  if (indices)
+  if (lights_flag)
   {
-    for (int* i = indices; *i != -1; ++i)
-    {
-      __debugbreak();//Not used?
-      v28 = &std__vector_000004[*i];
-      if ( !pRenderer->DrawLightmap(v28, &arg4, 0.0) )
-        Error("Invalid lightmap detected! (%u)", *i);
-    }
+	  if (indices != -1)
+	  {
+		for (unsigned int i = 0; i < MobileLightsCount; ++i)
+		{
+		  if ( !pRenderer->DrawLightmap(&MobileLights[i], &arg4, 0.0) )
+			Error("Invalid lightmap detected! (%u)", i);
+		}
+	  }
+	  else
+	  {
+		for (unsigned int i = 0; i < StationaryLightsCount; ++i)
+		  if ( !pRenderer->DrawLightmap(&StationaryLights[i], &arg4, 0.0) )
+			Error("Invalid lightmap detected! (%u)", i);
+	  }
   }
-  else
-    if (for_refactoring)
-    {
-    for (unsigned int i = 0; i < std__vector_000004_size; ++i)
-      if ( !pRenderer->DrawLightmap(std__vector_000004 + i, &arg4, 0.0) )
-        Error("Invalid lightmap detected! (%u)", i);
-	}
 
   pRenderer->EndLightmaps();
   
@@ -955,7 +928,7 @@
 void LightmapBuilder::Draw_183808_Lightmaps()
 {
   //For outdoor and indoor light (III)(IX)
-  if (!std__vector_183808_size)
+  if (!MobileLightsCount)
     return;
 
   pRenderer->BeginLightmaps2();
@@ -968,10 +941,10 @@
 
 ////////////////////////OTHER////////////////////////////////////////////////////////
 //----- (0045CA88) --------------------------------------------------------
-int LightmapBuilder::_45CA88(stru320 *a2, RenderVertexSoft *a3, int a4, Vec3_float_ *pNormal)
+int LightmapBuilder::_45CA88(LightsData *a2, RenderVertexSoft *a3, int a4, Vec3_float_ *pNormal)
 {
   int result; // eax@1
-  stru320 *v6; // ecx@2
+  LightsData *v6; // ecx@2
   RenderVertexSoft *v7; // ebx@2
   double v8; // st7@2
   double v9; // st6@2
@@ -1220,52 +1193,16 @@
 // 519AB4: using guessed type int uNumStationaryLightsApplied;
 
 //----- (0045D698) --------------------------------------------------------
-bool LightmapBuilder::DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2)
+void LightmapBuilder::DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2)
 {
-  bool result; // eax@1
-  LightmapBuilder *v3; // esi@1
-  RenderVertexSoft *v4; // edi@3
-  RenderVertexSoft *v5; // edi@7
-  IndoorCameraD3D *thisa; // [sp+10h] [bp-8h]@1
-  bool v7; // [sp+14h] [bp-4h]@2
-  bool a2a; // [sp+20h] [bp+8h]@6
-
-  __debugbreak();//Not used?
-  result = (bool)pIndoorCameraD3D;
-  v3 = this;
-  thisa = pIndoorCameraD3D;
   if ( bit_one_for_list1__bit_two_for_list2 & 1 )
   {
-    v7 = 0;
-    if ( (signed int)this->std__vector_000004_size > 0 )
-    {
-      v4 = this->std__vector_000004[0].pVertices;
-      do
-      {
-        pIndoorCameraD3D->debug_outline_sw(v4, *((unsigned int *)v4 - 1), 0xFF00u, 0.0);
-        ++v7;
-        v4 = (RenderVertexSoft *)((char *)v4 + 3100);
-        result = v7;
-      }
-      while ( v7 < (signed int)v3->std__vector_000004_size );
-    }
+	for (int i = 0; i < this->StationaryLightsCount; ++i)
+      pIndoorCameraD3D->debug_outline_sw(this->StationaryLights[i].pVertices, this->StationaryLights[i].NumVertices, 0xFF00, 0.0f);
   }
   if ( bit_one_for_list1__bit_two_for_list2 & 2 )
   {
-    a2a = 0;
-    if ( (signed int)v3->std__vector_183808_size > 0 )
-    {
-      v5 = v3->std__vector_183808[0].pVertices;
-      do
-      {
-        pIndoorCameraD3D->debug_outline_sw(v5, *((unsigned int *)v5 - 1), 0xC04000u, 0.00019999999);
-        ++a2a;
-        v5 = (RenderVertexSoft *)((char *)v5 + 3100);
-        result = a2a;
-      }
-      while ( a2a < (signed int)v3->std__vector_183808_size );
-    }
+	for (uint i = 0; i < this->MobileLightsCount; ++i)
+	  pIndoorCameraD3D->debug_outline_sw(this->MobileLights[i].pVertices, this->MobileLights[i].NumVertices, 0xC04000, 0.00019999999f);
   }
-  LOBYTE(result) = 1;
-  return result;
 }
--- a/Engine/Graphics/LightmapBuilder.h	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/LightmapBuilder.h	Sun May 17 22:42:13 2015 +0600
@@ -38,9 +38,9 @@
   void Draw_183808_Lightmaps();				//используется для мобильного света
   //bool DrawLightmap(Lightmap *a1, Vec3_float_ *pColorMult, float z_bias);
   bool DoDraw_183808_Lightmaps(float a2);	//используется для мобильного света
-  bool DrawLightmaps(int *indices = nullptr);
+  bool DrawLightmaps(int indices);
   void DrawLightmapsType(int type);
-  bool DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2);
+  void DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2);
   double _45D643_sw(struct Edge *a1, float a2);
   //int _45D426_sw(struct Span *a1, struct Edge **a2, unsigned int a3, struct Edge *a4, int a5);
   //bool _45D3C7_sw(struct Polygon *a1);
@@ -51,32 +51,32 @@
   double _45CC0C_light(struct Vec3_float_ a1, float a2, float a3, struct Vec3_float_ *pNormal, float a5, int uLightType);
   int _45CBD4(struct RenderVertexSoft *a2, int a3, int *a4, int *a5);
   int _45CB89(struct RenderVertexSoft *a1, int a2);
-  int _45CA88(struct stru320 *a2, struct RenderVertexSoft *a3, int a4, struct Vec3_float_ *pNormal);
+  int _45CA88(struct LightsData *a2, struct RenderVertexSoft *a3, int a4, struct Vec3_float_ *pNormal);
   bool ApplyLight_BLV(struct StationaryLight *pLight, struct BLVFace *a2, unsigned int *pSlot, bool bLightBackfaces, char *a5);
   bool ApplyLights_IndoorFace(unsigned int uFaceID);
   int _45C6D6(int a2, struct RenderVertexSoft *a3, Lightmap *pLightmap);
   int _45C4B9(int a2, struct RenderVertexSoft *a3, Lightmap *pLightmap);
   bool _45BE86_build_light_polygon(Vec3_int_ *pos, float radius, unsigned int uColorMask, float dot_dist, int uLightType, struct stru314 *a7, unsigned int uNumVertices, RenderVertexSoft *a9, char uClipFlag);
-  bool ApplyLights(struct stru320 *a2, struct stru154 *a3, unsigned int uNumVertices, struct RenderVertexSoft *a5, struct IndoorCameraD3D_Vec4 *, char uClipFlag);
+  bool ApplyLights(struct LightsData *a2, struct stru154 *a3, unsigned int uNumVertices, struct RenderVertexSoft *a5, struct IndoorCameraD3D_Vec4 *, char uClipFlag);
 
 
   //void ( ***vdestructor_ptr)(LightmapBuilder *, bool);
   //std::vector<Lightmap> std__vector_000004;
   //std::vector<Lightmap> std__vector_183808;
-  Lightmap std__vector_000004[512];
-  unsigned int std__vector_000004_size;
-  Lightmap std__vector_183808[768];
-  unsigned int std__vector_183808_size;
-  float flt_3C8C0C;
-  float flt_3C8C10;
-  float flt_3C8C14;
-  float flt_3C8C18;
-  float flt_3C8C1C;
-  float flt_3C8C20;
+  Lightmap StationaryLights[512];//std__vector_000004
+  unsigned int StationaryLightsCount;//std__vector_000004_size
+  Lightmap MobileLights[768];//std__vector_183808
+  unsigned int MobileLightsCount;//std__vector_183808_size
+  float light_length_x;
+  float light_length_y;
+  float light_length_z;
+  float light_length_x2;
+  float light_length_y2;
+  float light_length_z2;
   float tex_light_radius;//flt_3C8C24;
   float flt_3C8C28;
   float flt_3C8C2C_lightmaps_brightness;
-  float flt_3C8C30;
+  float light_radius;
   RenderVertexSoft field_3C8C34[256];
   int uFlags;
 };
--- a/Engine/Graphics/Outdoor.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/Outdoor.cpp	Sun May 17 22:42:13 2015 +0600
@@ -2926,10 +2926,10 @@
 {
   for ( uint i = 0; i < uNumVertices; i++ )
    {
-    memcpy(&array_50AC10[i], &array_507D30[i], sizeof(array_50AC10[i]));
-    array_50AC10[i].vWorldViewProjX = (double)pViewport->uScreenCenterX 
+    memcpy(&VertexRenderList[i], &array_507D30[i], sizeof(VertexRenderList[i]));
+    VertexRenderList[i].vWorldViewProjX = (double)pViewport->uScreenCenterX 
         - ((double)pODMRenderParams->int_fov_rad * array_507D30[i]._rhw) * array_507D30[i].vWorldViewPosition.y;
-    array_50AC10[i].vWorldViewProjY = (double)pViewport->uScreenCenterY
+    VertexRenderList[i].vWorldViewProjY = (double)pViewport->uScreenCenterY
         - ((double)pODMRenderParams->int_fov_rad * array_507D30[i]._rhw) * array_507D30[i].vWorldViewPosition.z;
    }
  }
@@ -4151,6 +4151,9 @@
 	unsigned int v75; // [sp+48h] [bp-8h]@1
 	int uIsOnWater; // [sp+4Ch] [bp-4h]@10
 
+  if(no_actors)
+	uNumActors = 0;
+
 	for (v75 = 0; v75 < uNumActors; ++v75)
 	{
 		if (pActors[v75].uAIState == Removed
--- a/Engine/Graphics/Render.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/Render.cpp	Sun May 17 22:42:13 2015 +0600
@@ -48,7 +48,7 @@
 int uNumSpritesDrawnThisFrame; // weak
 
 RenderVertexSoft array_507D30[50];
-RenderVertexSoft array_50AC10[50];
+RenderVertexSoft VertexRenderList[50];//array_50AC10
 RenderVertexSoft array_73D150[20];
 
 RenderVertexD3D3 d3d_vertex_buffer[50];
@@ -366,8 +366,8 @@
       pTilePolygon->field_50 = (8 * (0 | (0 << 6))) | 6;
       for (unsigned int k = 0; k < pTilePolygon->uNumVertices; ++k)
       {
-        memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft));
-        array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097);
+        memcpy(&VertexRenderList[k], &array_73D150[k], sizeof(struct RenderVertexSoft));
+        VertexRenderList[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097);
       }
 //shading (затенение)----------------------------------------------------------------------------
       //uint norm_idx = pTerrainNormalIndices[2 * (z * 128 + x) + 1];
@@ -383,13 +383,13 @@
         norm = 0;
       else
         norm = &pTerrainNormals[norm_idx];
-      if (for_refactoring)
-      {
+	  if (lights_flag)
+	  {
         //MessageBoxA(nullptr, "Ritor1: function StackLights_TerrainFace needed refactoring and result - slows", "", 0);
         //__debugbreak();
 
-      pEngine->pLightmapBuilder->StackLights_TerrainFace(norm, &Light_tile_dist, array_50AC10, 4, 1);//Ritor1: slows
-      //pDecalBuilder->_49BE8A(pTilePolygon, norm, &Light_tile_dist, array_50AC10, 4, 1);
+      pEngine->pLightmapBuilder->StackLights_TerrainFace(norm, &Light_tile_dist, VertexRenderList, 4, 1);//Ritor1: slows
+      //pDecalBuilder->_49BE8A(pTilePolygon, norm, &Light_tile_dist, VertexRenderList, 4, 1);
       }
       unsigned int a5 = 4;
 
@@ -406,20 +406,20 @@
                    || (double)pODMRenderParams->shading_dist_mist < array_73D150[2].vWorldViewPosition.x
                    || (double)pODMRenderParams->shading_dist_mist < array_73D150[3].vWorldViewPosition.x;
 
-      int v33 = 0;
+      int uClipFlag = 0;
       static stru154 static_sub_0048034E_stru_154;
-      pEngine->pLightmapBuilder->std__vector_000004_size = 0;
-      if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
+      pEngine->pLightmapBuilder->StationaryLightsCount = 0;
+      if ( Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
       {
         if ( neer_clip )
-          v33 = 3;
+          uClipFlag = 3;
         else
-          v33 = far_clip != 0 ? 5 : 0;
+          uClipFlag = far_clip != 0 ? 5 : 0;
         static_sub_0048034E_stru_154.ClassifyPolygon(norm, Light_tile_dist);
         if ( pDecalBuilder->uNumDecals > 0 )
-          pDecalBuilder->ApplyDecals(31 - pTilePolygon->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1);
-        if ( stru_F8AD28.uNumLightsApplied > 0 )
-          pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33);
+          pDecalBuilder->ApplyDecals(31 - pTilePolygon->dimming_level, 4, &static_sub_0048034E_stru_154, a5, VertexRenderList, 0, *(float *)&uClipFlag, -1);
+        if ( Lights.uNumLightsApplied > 0 )
+          pEngine->pLightmapBuilder->ApplyLights(&Lights, &static_sub_0048034E_stru_154, a5, VertexRenderList, 0, uClipFlag);
       }
 
       if ( !byte_4D864C || ~pEngine->uFlags & 0x80 )
@@ -2007,18 +2007,18 @@
   v6 = 0;
   if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 )
   {
-    //v54 = pEngine->pLightmapBuilder->std__vector_000004_size;
-    if ( pEngine->pLightmapBuilder->std__vector_000004_size)
+    //v54 = pEngine->pLightmapBuilder->StationaryLightsCount;
+    if ( pEngine->pLightmapBuilder->StationaryLightsCount)
       a2 = -1;
     pEngine->AlterGamma_ODM(a4, &a2);
     if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_01_lightmap_related)
     {
-      v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0);
-      pEngine->pLightmapBuilder->DrawLightmaps(/*v8, 0*/);
+      v8 = ::GetActorTintColor(a3->dimming_level, 0, VertexRenderList[0].vWorldViewPosition.x, 0, 0);
+      pEngine->pLightmapBuilder->DrawLightmaps(v8/*, 0*/);
     }
     else
     {
-      if ( !pEngine->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pEngine->uFlags & 2 )
+      if ( !pEngine->pLightmapBuilder->StationaryLightsCount || byte_4D864C && pEngine->uFlags & 2 )
       {
         ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW));
@@ -2031,19 +2031,19 @@
 		for (uint i = 0; i < uNumVertices; ++i)
 		{
 		
-		  d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX;
-		  d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY;
-		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
-		  d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001);
-		  d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0);
+		  d3d_vertex_buffer[i].pos.x = VertexRenderList[i].vWorldViewProjX;
+		  d3d_vertex_buffer[i].pos.y = VertexRenderList[i].vWorldViewProjY;
+		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((VertexRenderList[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
+		  d3d_vertex_buffer[i].rhw = 1.0 / (VertexRenderList[i].vWorldViewPosition.x + 0.0000001);
+		  d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, VertexRenderList[i].vWorldViewPosition.x, 0, 0);
           pEngine->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse);
 
 		  if ( this->bUsingSpecular )
-            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x);
+            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, VertexRenderList[i].vWorldViewPosition.x);
           else
             d3d_vertex_buffer[i].specular = 0;
-		  d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u;
-		  d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v;
+		  d3d_vertex_buffer[i].texcoord.x = VertexRenderList[i].u;
+		  d3d_vertex_buffer[i].texcoord.y = VertexRenderList[i].v;
 		  
 		}
 
@@ -2070,17 +2070,17 @@
 		for (uint i = 0; i < uNumVertices; ++i)
 		{
 		
-		  d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX;
-		  d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY;
-		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
-		  d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001);
-		  d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0);
+		  d3d_vertex_buffer[i].pos.x = VertexRenderList[i].vWorldViewProjX;
+		  d3d_vertex_buffer[i].pos.y = VertexRenderList[i].vWorldViewProjY;
+		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((VertexRenderList[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
+		  d3d_vertex_buffer[i].rhw = 1.0 / (VertexRenderList[i].vWorldViewPosition.x + 0.0000001);
+		  d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, VertexRenderList[i].vWorldViewPosition.x, 0, 0);
           if ( this->bUsingSpecular )
-            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x);
+            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, VertexRenderList[i].vWorldViewPosition.x);
           else
             d3d_vertex_buffer[i].specular = 0;
-		  d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u;
-		  d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v;
+		  d3d_vertex_buffer[i].texcoord.x = VertexRenderList[i].u;
+		  d3d_vertex_buffer[i].texcoord.y = VertexRenderList[i].v;
 		  
 		}
 	  
@@ -2098,7 +2098,7 @@
         //v50 = (const char *)v5->pRenderD3D->pDevice;
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
         //(*(void (**)(void))(*(int *)v50 + 88))();
-        pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/);
+        pEngine->pLightmapBuilder->DrawLightmaps(-1/*, 0*/);
 	    for (uint i = 0; i < uNumVertices; ++i)
 		{
 		  d3d_vertex_buffer[i].diffuse = a2;
@@ -4553,44 +4553,44 @@
       this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
      }
 
-     pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX;
-     pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY;
-     pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
-     pVertices[0].rhw = 1.0 / (array_50AC10[0].vWorldViewPosition.x + 0.0000001000000011686097);
-     pVertices[0].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0);
+     pVertices[0].pos.x = VertexRenderList[0].vWorldViewProjX;
+     pVertices[0].pos.y = VertexRenderList[0].vWorldViewProjY;
+     pVertices[0].pos.z = 1.0 - 1.0 / (1000 * VertexRenderList[0].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
+     pVertices[0].rhw = 1.0 / (VertexRenderList[0].vWorldViewPosition.x + 0.0000001000000011686097);
+     pVertices[0].diffuse = GetActorTintColor(a3->field_58, 0, VertexRenderList[0].vWorldViewPosition.x, 0, 0);
      pVertices[0].specular = 0;
-     pVertices[0].texcoord.x = array_50AC10[0].u;
-     pVertices[0].texcoord.y = array_50AC10[0].v;
+     pVertices[0].texcoord.x = VertexRenderList[0].u;
+     pVertices[0].texcoord.y = VertexRenderList[0].v;
  
-     pVertices[1].pos.x = array_50AC10[3].vWorldViewProjX;
-     pVertices[1].pos.y = array_50AC10[3].vWorldViewProjY;
-     pVertices[1].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[3].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
-     pVertices[1].rhw = 1.0 / (array_50AC10[3].vWorldViewPosition.x + 0.0000001000000011686097);
-     pVertices[1].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[3].vWorldViewPosition.x, 0, 0);
+     pVertices[1].pos.x = VertexRenderList[3].vWorldViewProjX;
+     pVertices[1].pos.y = VertexRenderList[3].vWorldViewProjY;
+     pVertices[1].pos.z = 1.0 - 1.0 / (1000 * VertexRenderList[3].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
+     pVertices[1].rhw = 1.0 / (VertexRenderList[3].vWorldViewPosition.x + 0.0000001000000011686097);
+     pVertices[1].diffuse = GetActorTintColor(a3->field_58, 0, VertexRenderList[3].vWorldViewPosition.x, 0, 0);
      pVertices[1].specular = 0;
-     pVertices[1].texcoord.x = array_50AC10[3].u;
-     pVertices[1].texcoord.y = array_50AC10[3].v;
-
-     pVertices[2].pos.x = array_50AC10[1].vWorldViewProjX;
-     pVertices[2].pos.y = array_50AC10[1].vWorldViewProjY;
-     pVertices[2].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[1].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
-     pVertices[2].rhw = 1.0 / (array_50AC10[1].vWorldViewPosition.x + 0.0000001000000011686097);
-     pVertices[2].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[1].vWorldViewPosition.x, 0, 0);
+     pVertices[1].texcoord.x = VertexRenderList[3].u;
+     pVertices[1].texcoord.y = VertexRenderList[3].v;
+
+     pVertices[2].pos.x = VertexRenderList[1].vWorldViewProjX;
+     pVertices[2].pos.y = VertexRenderList[1].vWorldViewProjY;
+     pVertices[2].pos.z = 1.0 - 1.0 / (1000 * VertexRenderList[1].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
+     pVertices[2].rhw = 1.0 / (VertexRenderList[1].vWorldViewPosition.x + 0.0000001000000011686097);
+     pVertices[2].diffuse = GetActorTintColor(a3->field_58, 0, VertexRenderList[1].vWorldViewPosition.x, 0, 0);
      pVertices[2].specular = 0;
-     pVertices[2].texcoord.x = array_50AC10[1].u;
-     pVertices[2].texcoord.y = array_50AC10[1].v;
+     pVertices[2].texcoord.x = VertexRenderList[1].u;
+     pVertices[2].texcoord.y = VertexRenderList[1].v;
 
      memcpy(pVertices + 3, pVertices + 2, sizeof(RenderVertexD3D3));
      memcpy(pVertices + 4, pVertices + 1, sizeof(RenderVertexD3D3));
 
-     pVertices[5].pos.x = array_50AC10[2].vWorldViewProjX;
-     pVertices[5].pos.y = array_50AC10[2].vWorldViewProjY;
-     pVertices[5].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[2].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
-     pVertices[5].rhw = 1.0 / (array_50AC10[2].vWorldViewPosition.x + 0.0000001000000011686097);
-     pVertices[5].diffuse = GetActorTintColor(a3->field_58, 0, array_50AC10[2].vWorldViewPosition.x, 0, 0);
+     pVertices[5].pos.x = VertexRenderList[2].vWorldViewProjX;
+     pVertices[5].pos.y = VertexRenderList[2].vWorldViewProjY;
+     pVertices[5].pos.z = 1.0 - 1.0 / (1000 * VertexRenderList[2].vWorldViewPosition.x / (double)pODMRenderParams->shading_dist_mist);
+     pVertices[5].rhw = 1.0 / (VertexRenderList[2].vWorldViewPosition.x + 0.0000001000000011686097);
+     pVertices[5].diffuse = GetActorTintColor(a3->field_58, 0, VertexRenderList[2].vWorldViewPosition.x, 0, 0);
      pVertices[5].specular = 0;
-     pVertices[5].texcoord.x = array_50AC10[2].u;
-     pVertices[5].texcoord.y = array_50AC10[2].v;
+     pVertices[5].texcoord.x = VertexRenderList[2].u;
+     pVertices[5].texcoord.y = VertexRenderList[2].v;
 
 
      this->pRenderD3D->pDevice->SetTexture(0, pTexture);
@@ -4616,15 +4616,15 @@
 
   /*  v9 = pEngine->pLightmapBuilder;
     v65 = v9;
-    v10 = v9->std__vector_000004_size;*/
+    v10 = v9->StationaryLightsCount;*/
     if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_01_lightmap_related)
     {
-      v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0);
-      pEngine->pLightmapBuilder->DrawLightmaps(/*v11, 0*/);
+      v11 = ::GetActorTintColor(a4->dimming_level, 0, VertexRenderList[0].vWorldViewPosition.x, 0, 0);
+      pEngine->pLightmapBuilder->DrawLightmaps(v11/*, 0*/);
     }
     else
     {
-      if (transparent || !pEngine->pLightmapBuilder->std__vector_000004_size || 
+      if (transparent || !pEngine->pLightmapBuilder->StationaryLightsCount || 
           byte_4D864C && pEngine->uFlags & 2 )
       {
         if (clampAtTextureBorders)
@@ -4652,21 +4652,21 @@
 		for (uint i = 0; i < uNumVertices; ++i)
 		{
 		
-		  d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX;
-		  d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY;
-		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
-		  d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001);
-		  d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0);
+		  d3d_vertex_buffer[i].pos.x = VertexRenderList[i].vWorldViewProjX;
+		  d3d_vertex_buffer[i].pos.y = VertexRenderList[i].vWorldViewProjY;
+		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((VertexRenderList[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
+		  d3d_vertex_buffer[i].rhw = 1.0 / (VertexRenderList[i].vWorldViewPosition.x + 0.0000001);
+		  d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, VertexRenderList[i].vWorldViewPosition.x, 0, 0);
           if ( this->bUsingSpecular )
           {
-            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x);
+            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, VertexRenderList[i].vWorldViewPosition.x);
           }
           else
           {
             d3d_vertex_buffer[i].specular = 0;
 		  }
-		  d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u;
-		  d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v;
+		  d3d_vertex_buffer[i].texcoord.x = VertexRenderList[i].u;
+		  d3d_vertex_buffer[i].texcoord.y = VertexRenderList[i].v;
 		}
 
 		this->pRenderD3D->pDevice->SetTexture(0, a5);
@@ -4683,14 +4683,14 @@
 		for (uint i = 0; i < uNumVertices; ++i)
 		{
 		
-		  d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX;
-		  d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY;
-		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
-		  d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001);
-		  d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0);
+		  d3d_vertex_buffer[i].pos.x = VertexRenderList[i].vWorldViewProjX;
+		  d3d_vertex_buffer[i].pos.y = VertexRenderList[i].vWorldViewProjY;
+		  d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((VertexRenderList[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist);
+		  d3d_vertex_buffer[i].rhw = 1.0 / (VertexRenderList[i].vWorldViewPosition.x + 0.0000001);
+		  d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, VertexRenderList[i].vWorldViewPosition.x, 0, 0);
           if ( this->bUsingSpecular )
           {
-            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x);
+            d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, VertexRenderList[i].vWorldViewPosition.x);
           }
           else
           {
@@ -4698,8 +4698,8 @@
 		  }
           //__debugbreak(); // warning C4700: uninitialized local variable 'v20' used
 		  //d3d_vertex_buffer[i].specular = v20;
-		  d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u;
-		  d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v;
+		  d3d_vertex_buffer[i].texcoord.x = VertexRenderList[i].u;
+		  d3d_vertex_buffer[i].texcoord.y = VertexRenderList[i].v;
 		}
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE));
         ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
@@ -4715,7 +4715,7 @@
         //v63 = (const char *)v7->pRenderD3D->pDevice;
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
         //(*(void (**)(void))(*(int *)v63 + 88))();
-        pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/);
+        pEngine->pLightmapBuilder->DrawLightmaps(-1/*, 0*/);
 	    for (uint i = 0; i < uNumVertices; ++i)
 	    {
 		  d3d_vertex_buffer[i].diffuse = -1;
@@ -4790,18 +4790,18 @@
     }
     for ( uint i = 0; i < uNumVertices; ++i )
     {
-      pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX;
-      pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY;
+      pVertices[i].pos.x = VertexRenderList[i].vWorldViewProjX;
+      pVertices[i].pos.y = VertexRenderList[i].vWorldViewProjY;
       pVertices[i].pos.z = 0.99989998;
-      pVertices[i].rhw = array_50AC10[i]._rhw;
-
-      pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0);
+      pVertices[i].rhw = VertexRenderList[i]._rhw;
+
+      pVertices[i].diffuse = ::GetActorTintColor(31, 0, VertexRenderList[i].vWorldViewPosition.x, 1, 0);
       v7 = 0;
       if (this->bUsingSpecular)
-        v7 = sub_47C3D7_get_fog_specular(0, 1, array_50AC10[i].vWorldViewPosition.x);
+        v7 = sub_47C3D7_get_fog_specular(0, 1, VertexRenderList[i].vWorldViewPosition.x);
       pVertices[i].specular = v7;
-      pVertices[i].texcoord.x = array_50AC10[i].u;
-      pVertices[i].texcoord.y = array_50AC10[i].v;
+      pVertices[i].texcoord.x = VertexRenderList[i].u;
+      pVertices[i].texcoord.y = VertexRenderList[i].v;
     }
     pRenderD3D->pDevice->SetTexture(0, pTexture);
     pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
@@ -5023,12 +5023,12 @@
   if ( (signed int)pSkyPolygon.uNumVertices > 0 )
   {
     v28 = (double)SLODWORD(v76);
-    LODWORD(v76) = (int)(char *)array_50AC10 + 28;
+    LODWORD(v76) = (int)(char *)VertexRenderList + 28;
 	uint i = 0;
     for ( v78 = pSkyPolygon.uNumVertices; v78; --v78 )
     {
       ++LODWORD(v73);
-      memcpy(&array_50AC10[i], &array_507D30[i], 0x30u);
+      memcpy(&VertexRenderList[i], &array_507D30[i], 0x30u);
       LODWORD(v76) += 48;
       if ( v28 < array_507D30[i].vWorldViewProjY | v28 == array_507D30[i].vWorldViewProjY
         || v28 >= array_507D30[i + 1].vWorldViewProjY )
@@ -5046,7 +5046,7 @@
         v33 = (array_507D30[i].vWorldViewProjX - array_507D30[i + 1].vWorldViewProjX) * v28 / (array_507D30[i].vWorldViewProjY - array_507D30[i + 1].vWorldViewProjY)
             + array_507D30[i].vWorldViewProjX;
       }
-      array_50AC10[i + 1].vWorldViewProjX = v33;
+      VertexRenderList[i + 1].vWorldViewProjX = v33;
       ++LODWORD(v73);
       *(unsigned int *)LODWORD(v76) = v28;
       LODWORD(v76) += 48;
@@ -5055,13 +5055,13 @@
   }
   if ( SLODWORD(v73) <= 0 )
     goto LABEL_40;
-  //v34 = (char *)&array_50AC10[0].vWorldViewProjY;
+  //v34 = (char *)&VertexRenderList[0].vWorldViewProjY;
   uint j = 0;
   v65 = v77 >> 14;
   //HIDWORD(v69) = LODWORD(v73);
   for ( int t = (int)LODWORD(v73); t > 1; t-- )
   {
-    v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)array_50AC10[j].vWorldViewProjY));
+    v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)VertexRenderList[j].vWorldViewProjY));
 
     //v78 = pSkyPolygon.ptr_38->viewing_angle_from_west_east;
     //v81 = (const void *)fixpoint_mul(pSkyPolygon.ptr_38->viewing_angle_from_west_east, v35);
@@ -5075,8 +5075,8 @@
     v75 = (RenderVertexSoft *)((char *)v81 + pSkyPolygon.ptr_38->angle_from_east);
     //v81 = (const void *)pSkyPolygon.v_18.z;
     v78 = fixpoint_mul(pSkyPolygon.v_18.z, (int)v35);
-    v37 = (const void *)(v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)array_50AC10[j].vWorldViewProjX));
-    v38 = (signed __int64)(array_50AC10[j].vWorldViewProjY - 1.0);
+    v37 = (const void *)(v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)VertexRenderList[j].vWorldViewProjX));
+    v38 = (signed __int64)(VertexRenderList[j].vWorldViewProjY - 1.0);
     v81 = 0;
     LODWORD(v76) = v38;
     v39 = v72 * (v70 - v38);
@@ -5103,7 +5103,7 @@
     {
       v79 = (void *)pSkyPolygon.v_18.z;
       v78 = 2 * LODWORD(v76);
-      v81 = (const void *)fixpoint_mul(pSkyPolygon.v_18.z, (((double)v70 - ((double)(2 * LODWORD(v76)) - array_50AC10[j].vWorldViewProjY))
+      v81 = (const void *)fixpoint_mul(pSkyPolygon.v_18.z, (((double)v70 - ((double)(2 * LODWORD(v76)) - VertexRenderList[j].vWorldViewProjY))
                                                                                          * (double)v72));
       X = (int)((char *)v81 + pSkyPolygon.v_18.x);
     }
@@ -5128,11 +5128,11 @@
     //v44 = HIDWORD(v69)-- == 1;
     //v45 = (double)(v66 + ((signed int)fixpoint_mul(v43, v42 / X) >> 4)) * 0.000015259022;
     //v78 = v63 + ((signed int)fixpoint_mul((int)v75, v42 / X) >> 4);
-    array_50AC10[j].u = ((double)(v66 + ((signed int)fixpoint_mul(v43, v42 / X) >> 4)) * 0.000015259022) * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth);
-    array_50AC10[j].v = ((double)(v66 + ((signed int)fixpoint_mul(v43, v42 / X) >> 4)) * 0.000015259022) * v68;
+    VertexRenderList[j].u = ((double)(v66 + ((signed int)fixpoint_mul(v43, v42 / X) >> 4)) * 0.000015259022) * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth);
+    VertexRenderList[j].v = ((double)(v66 + ((signed int)fixpoint_mul(v43, v42 / X) >> 4)) * 0.000015259022) * v68;
     //v46 = (double)(signed int)v79;
-    array_50AC10[j].vWorldViewPosition.x = 0.000015258789 * (double)(signed int)v79;
-    array_50AC10[j]._rhw = 65536.0 / (double)(signed int)v79;
+    VertexRenderList[j].vWorldViewPosition.x = 0.000015258789 * (double)(signed int)v79;
+    VertexRenderList[j]._rhw = 65536.0 / (double)(signed int)v79;
 	++j;
   }
   //while ( !v44 );
@@ -5143,10 +5143,10 @@
     v48 = (double)SLODWORD(v80);
     for ( HIDWORD(v69) = LODWORD(v73); HIDWORD(v69); --HIDWORD(v69) )
     {
-      if ( v48 >= array_50AC10[i].vWorldViewProjY )
+      if ( v48 >= VertexRenderList[i].vWorldViewProjY )
       {
         ++i;
-        memcpy(&array_507D30[i], &array_50AC10[i], 0x30u);
+        memcpy(&array_507D30[i], &VertexRenderList[i], 0x30u);
       }
     }
   }
@@ -5158,10 +5158,10 @@
     v51 = (double)SLODWORD(v80);
     for ( v80 = v73; v80 != 0.0; --LODWORD(v80) )
     {
-      if ( v51 <= array_50AC10[pNumVertices].vWorldViewProjY )
+      if ( v51 <= VertexRenderList[pNumVertices].vWorldViewProjY )
       {
         ++pNumVertices;
-        memcpy(&array_507D30[pNumVertices], &array_50AC10[pNumVertices], 0x30u);
+        memcpy(&array_507D30[pNumVertices], &VertexRenderList[pNumVertices], 0x30u);
       }
     }
   }
@@ -5176,7 +5176,7 @@
 
   int sCorrectedColor = uColor;
 
-  if (pEngine->pLightmapBuilder->std__vector_000004_size)
+  if (pEngine->pLightmapBuilder->StationaryLightsCount)
     sCorrectedColor = -1;
   pEngine->AlterGamma_BLV(pFace, &sCorrectedColor);
 
@@ -5210,11 +5210,11 @@
       ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
               D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
               d3d_vertex_buffer, uNumVertices, 28));
-      pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/);
+      pEngine->pLightmapBuilder->DrawLightmaps(-1/*, 0*/);
   }
   else
   {
-    if (!pEngine->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pEngine->uFlags & 2)
+    if (!pEngine->pLightmapBuilder->StationaryLightsCount || byte_4D864C && pEngine->uFlags & 2)
     {
       for (uint i = 0; i < uNumVertices; ++i)
       {
@@ -5255,7 +5255,7 @@
               d3d_vertex_buffer, uNumVertices, 28));
 
       ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
-      pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/);
+      pEngine->pLightmapBuilder->DrawLightmaps(-1/*, 0*/);
 
       for (uint i = 0; i < uNumVertices; ++i)
         d3d_vertex_buffer[i].diffuse = sCorrectedColor;
@@ -8153,7 +8153,7 @@
     return 0;
   for (uint i = 0; i < num_vertices; ++i)// есть ли пограничные вершины
   {
-    if ( array_50AC10[i].vWorldViewPosition.x > 8.0 )
+    if ( VertexRenderList[i].vWorldViewPosition.x > 8.0 )
     {
       bFound = true;
       break;
@@ -8162,10 +8162,10 @@
   if ( !bFound )
     return 0;
 
-  memcpy(&array_50AC10[num_vertices], &array_50AC10[0], sizeof(array_50AC10[0]));
+  memcpy(&VertexRenderList[num_vertices], &VertexRenderList[0], sizeof(VertexRenderList[0]));
+  next_vertices_flag = false;
   current_vertices_flag = false;
-  next_vertices_flag = false;
-  if ( array_50AC10[0].vWorldViewPosition.x <= 8.0 )
+  if ( VertexRenderList[0].vWorldViewPosition.x <= 8.0 )
     current_vertices_flag = true;
   //check for near clip plane(проверка по ближней границе)
   //   
@@ -8181,28 +8181,28 @@
   int out_num_vertices = 0;
   for (uint i = 0; i < num_vertices; ++i)
   {
-    next_vertices_flag = array_50AC10[i + 1].vWorldViewPosition.x <= 8.0;//
+    next_vertices_flag = VertexRenderList[i + 1].vWorldViewPosition.x <= 8.0;//
     if ( current_vertices_flag ^ next_vertices_flag )
     {
       if ( next_vertices_flag )//следующая вершина за ближней границей
       {
         //t = near_clip - v0.x / v1.x - v0.x    (формула получения точки пересечения отрезка с плоскостью)
-        t = (8.0 - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i + 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x);
+        t = (8.0 - VertexRenderList[i].vWorldViewPosition.x) / (VertexRenderList[i + 1].vWorldViewPosition.x - VertexRenderList[i].vWorldViewPosition.x);
         array_507D30[out_num_vertices].vWorldViewPosition.x = 8.0;
-        array_507D30[out_num_vertices].vWorldViewPosition.y = array_50AC10[i].vWorldViewPosition.y + (array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t;
-        array_507D30[out_num_vertices].vWorldViewPosition.z = array_50AC10[i].vWorldViewPosition.z + (array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t;
-        array_507D30[out_num_vertices].u = array_50AC10[i].u + (array_50AC10[i + 1].u - array_50AC10[i].u) * t;
-        array_507D30[out_num_vertices].v = array_50AC10[i].v + (array_50AC10[i + 1].v - array_50AC10[i].v) * t;
+        array_507D30[out_num_vertices].vWorldViewPosition.y = VertexRenderList[i].vWorldViewPosition.y + (VertexRenderList[i + 1].vWorldViewPosition.y - VertexRenderList[i].vWorldViewPosition.y) * t;
+        array_507D30[out_num_vertices].vWorldViewPosition.z = VertexRenderList[i].vWorldViewPosition.z + (VertexRenderList[i + 1].vWorldViewPosition.z - VertexRenderList[i].vWorldViewPosition.z) * t;
+        array_507D30[out_num_vertices].u = VertexRenderList[i].u + (VertexRenderList[i + 1].u - VertexRenderList[i].u) * t;
+        array_507D30[out_num_vertices].v = VertexRenderList[i].v + (VertexRenderList[i + 1].v - VertexRenderList[i].v) * t;
         array_507D30[out_num_vertices]._rhw = 1.0 / 8.0;
       }
       else// текущая вершина за ближней границей
       {
-        t = (8.0 - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i].vWorldViewPosition.x - array_50AC10[i + 1].vWorldViewPosition.x);
+        t = (8.0 - VertexRenderList[i].vWorldViewPosition.x) / (VertexRenderList[i].vWorldViewPosition.x - VertexRenderList[i + 1].vWorldViewPosition.x);
         array_507D30[out_num_vertices].vWorldViewPosition.x = 8.0;
-        array_507D30[out_num_vertices].vWorldViewPosition.y = array_50AC10[i].vWorldViewPosition.y + (array_50AC10[i].vWorldViewPosition.y - array_50AC10[i + 1].vWorldViewPosition.y) * t;
-        array_507D30[out_num_vertices].vWorldViewPosition.z = array_50AC10[i].vWorldViewPosition.z + (array_50AC10[i].vWorldViewPosition.z - array_50AC10[i + 1].vWorldViewPosition.z) * t;
-        array_507D30[out_num_vertices].u = array_50AC10[i].u + (array_50AC10[i].u - array_50AC10[i + 1].u) * t;
-        array_507D30[out_num_vertices].v = array_50AC10[i].v + (array_50AC10[i].v - array_50AC10[i + 1].v) * t;
+        array_507D30[out_num_vertices].vWorldViewPosition.y = VertexRenderList[i].vWorldViewPosition.y + (VertexRenderList[i].vWorldViewPosition.y - VertexRenderList[i + 1].vWorldViewPosition.y) * t;
+        array_507D30[out_num_vertices].vWorldViewPosition.z = VertexRenderList[i].vWorldViewPosition.z + (VertexRenderList[i].vWorldViewPosition.z - VertexRenderList[i + 1].vWorldViewPosition.z) * t;
+        array_507D30[out_num_vertices].u = VertexRenderList[i].u + (VertexRenderList[i].u - VertexRenderList[i + 1].u) * t;
+        array_507D30[out_num_vertices].v = VertexRenderList[i].v + (VertexRenderList[i].v - VertexRenderList[i + 1].v) * t;
         array_507D30[out_num_vertices]._rhw = 1.0 / 8.0;
       }
       //array_507D30[out_num_vertices]._rhw = 0x3E000000u;
@@ -8210,7 +8210,7 @@
     }
     if ( !next_vertices_flag )
     {
-      memcpy(&array_507D30[out_num_vertices], &array_50AC10[i + 1], sizeof(array_50AC10[i + 1]));
+      memcpy(&array_507D30[out_num_vertices], &VertexRenderList[i + 1], sizeof(VertexRenderList[i + 1]));
       out_num_vertices++;
     }
     current_vertices_flag = next_vertices_flag;
@@ -8230,16 +8230,16 @@
 
   bFound = false;
 
-  memcpy(&array_50AC10[uNumVertices], &array_50AC10[0], sizeof(array_50AC10[uNumVertices]));
+  memcpy(&VertexRenderList[uNumVertices], &VertexRenderList[0], sizeof(VertexRenderList[uNumVertices]));
   depth_num_vertices = 0;
   current_vertices_flag = false;
-  if ( array_50AC10[0].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist )
+  if ( VertexRenderList[0].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist )
     current_vertices_flag = true;//настоящая вершина больше границы видимости
   if ( (signed int)uNumVertices <= 0 )
     return 0;
   for (uint i = 0; i < uNumVertices; ++i)// есть ли пограничные вершины
   {
-    if ( array_50AC10[i].vWorldViewPosition.x < pODMRenderParams->shading_dist_mist )
+    if ( VertexRenderList[i].vWorldViewPosition.x < pODMRenderParams->shading_dist_mist )
     {
       bFound = true;
       break;
@@ -8260,40 +8260,40 @@
 
   for ( uint i = 0; i < uNumVertices; ++i )
   {
-    next_vertices_flag = array_50AC10[i + 1].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist;
+    next_vertices_flag = VertexRenderList[i + 1].vWorldViewPosition.x >= pODMRenderParams->shading_dist_mist;
     if ( current_vertices_flag ^ next_vertices_flag )//одна из граней за границей видимости
     {
       if ( next_vertices_flag )//следующая вершина больше границы видимости(настоящая вершина меньше границы видимости) - v3
       {
         //t = far_clip - v2.x / v3.x - v2.x (формула получения точки пересечения отрезка с плоскостью)
-        t = (pODMRenderParams->shading_dist_mist - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i].vWorldViewPosition.x - array_50AC10[i + 1].vWorldViewPosition.x);
+        t = (pODMRenderParams->shading_dist_mist - VertexRenderList[i].vWorldViewPosition.x) / (VertexRenderList[i].vWorldViewPosition.x - VertexRenderList[i + 1].vWorldViewPosition.x);
         array_507D30[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
         //New_y = v2.y + (v3.y - v2.y)*t
-        array_507D30[depth_num_vertices].vWorldViewPosition.y = array_50AC10[i].vWorldViewPosition.y + (array_50AC10[i].vWorldViewPosition.y - array_50AC10[i + 1].vWorldViewPosition.y) * t;
+        array_507D30[depth_num_vertices].vWorldViewPosition.y = VertexRenderList[i].vWorldViewPosition.y + (VertexRenderList[i].vWorldViewPosition.y - VertexRenderList[i + 1].vWorldViewPosition.y) * t;
         //New_z = v2.z + (v3.z - v2.z)*t
-        array_507D30[depth_num_vertices].vWorldViewPosition.z = array_50AC10[i].vWorldViewPosition.z + (array_50AC10[i].vWorldViewPosition.z - array_50AC10[i + 1].vWorldViewPosition.z) * t;
-        array_507D30[depth_num_vertices].u = array_50AC10[i].u + (array_50AC10[i].u - array_50AC10[i + 1].u) * t;
-        array_507D30[depth_num_vertices].v = array_50AC10[i].v + (array_50AC10[i].v - array_50AC10[i + 1].v) * t;
+        array_507D30[depth_num_vertices].vWorldViewPosition.z = VertexRenderList[i].vWorldViewPosition.z + (VertexRenderList[i].vWorldViewPosition.z - VertexRenderList[i + 1].vWorldViewPosition.z) * t;
+        array_507D30[depth_num_vertices].u = VertexRenderList[i].u + (VertexRenderList[i].u - VertexRenderList[i + 1].u) * t;
+        array_507D30[depth_num_vertices].v = VertexRenderList[i].v + (VertexRenderList[i].v - VertexRenderList[i + 1].v) * t;
         array_507D30[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist;
       }
       else//настоящая вершина больше границы видимости(следующая вершина меньше границы видимости) - v0
       {
         //t = far_clip - v1.x / v0.x - v1.x
-        t = (pODMRenderParams->shading_dist_mist - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i + 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x);
+        t = (pODMRenderParams->shading_dist_mist - VertexRenderList[i].vWorldViewPosition.x) / (VertexRenderList[i + 1].vWorldViewPosition.x - VertexRenderList[i].vWorldViewPosition.x);
         array_507D30[depth_num_vertices].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
         //New_y = (v0.y - v1.y)*t + v1.y
-        array_507D30[depth_num_vertices].vWorldViewPosition.y = array_50AC10[i].vWorldViewPosition.y + (array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t;
+        array_507D30[depth_num_vertices].vWorldViewPosition.y = VertexRenderList[i].vWorldViewPosition.y + (VertexRenderList[i + 1].vWorldViewPosition.y - VertexRenderList[i].vWorldViewPosition.y) * t;
         //New_z = (v0.z - v1.z)*t + v1.z
-        array_507D30[depth_num_vertices].vWorldViewPosition.z = array_50AC10[i].vWorldViewPosition.z + (array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t;
-        array_507D30[depth_num_vertices].u = array_50AC10[i].u + (array_50AC10[i + 1].u - array_50AC10[i].u) * t;
-        array_507D30[depth_num_vertices].v = array_50AC10[i].v + (array_50AC10[i + 1].v - array_50AC10[i].v) * t;
+        array_507D30[depth_num_vertices].vWorldViewPosition.z = VertexRenderList[i].vWorldViewPosition.z + (VertexRenderList[i + 1].vWorldViewPosition.z - VertexRenderList[i].vWorldViewPosition.z) * t;
+        array_507D30[depth_num_vertices].u = VertexRenderList[i].u + (VertexRenderList[i + 1].u - VertexRenderList[i].u) * t;
+        array_507D30[depth_num_vertices].v = VertexRenderList[i].v + (VertexRenderList[i + 1].v - VertexRenderList[i].v) * t;
         array_507D30[depth_num_vertices]._rhw = 1.0 / pODMRenderParams->shading_dist_mist;
       }
       ++depth_num_vertices;
     }
     if ( !next_vertices_flag )//оба в границе видимости
     {
-      memcpy(&array_507D30[depth_num_vertices], &array_50AC10[i + 1], sizeof(array_507D30[depth_num_vertices]));
+      memcpy(&array_507D30[depth_num_vertices], &VertexRenderList[i + 1], sizeof(array_507D30[depth_num_vertices]));
       depth_num_vertices++;
     }
     current_vertices_flag = next_vertices_flag;
@@ -8442,8 +8442,8 @@
               array_77EC08[pODMRenderParams->uNumPolygons].field_50 = v27;
               for ( int vertex_id = 0; vertex_id < pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices; ++vertex_id)
               {
-                memcpy(&array_50AC10[vertex_id], &array_73D150[vertex_id], sizeof(array_50AC10[vertex_id]));
-                array_50AC10[vertex_id]._rhw = 1.0 / (array_73D150[vertex_id].vWorldViewPosition.x + 0.0000001);
+                memcpy(&VertexRenderList[vertex_id], &array_73D150[vertex_id], sizeof(VertexRenderList[vertex_id]));
+                VertexRenderList[vertex_id]._rhw = 1.0 / (array_73D150[vertex_id].vWorldViewPosition.x + 0.0000001);
               }
               static stru154 static_RenderBuildingsD3D_stru_73C834;
               /*static bool __init_flag = false;
@@ -8458,9 +8458,9 @@
               v40 = (int)&pOutdoor->pBModels[model_id].pFaces[face_id];
               pEngine->pLightmapBuilder->ApplyLights_OutdoorFace(&pOutdoor->pBModels[model_id].pFaces[face_id]);
               pDecalBuilder->ApplyDecals_OutdoorFace(&pOutdoor->pBModels[model_id].pFaces[face_id]);
-              pEngine->pLightmapBuilder->std__vector_000004_size = 0;
+              pEngine->pLightmapBuilder->StationaryLightsCount = 0;
               int v31 = 0;
-              if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
+              if ( Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
               {
                 v31 = v50 ? 3 : v49 != 0 ? 5 : 0;
                 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(&pOutdoor->pBModels[model_id].pFaces[face_id], &pOutdoor->pBModels[model_id].pVertices);
@@ -8468,11 +8468,11 @@
                 {
                   v40 = -1;
                   pDecalBuilder->ApplyDecals(31 - array_77EC08[pODMRenderParams->uNumPolygons].dimming_level, 2, &static_RenderBuildingsD3D_stru_73C834,
-                                       pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices, array_50AC10, 0, (char)v31, -1);
+                                       pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices, VertexRenderList, 0, (char)v31, -1);
                 }
               }
-              if ( stru_F8AD28.uNumLightsApplied > 0 )
-                pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_RenderBuildingsD3D_stru_73C834, uNumVertices, array_50AC10, 0, (char)v31);
+              if ( Lights.uNumLightsApplied > 0 )
+                pEngine->pLightmapBuilder->ApplyLights(&Lights, &static_RenderBuildingsD3D_stru_73C834, uNumVertices, VertexRenderList, 0, (char)v31);
               if ( v50 )
               {
                 array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices = ODM_NearClip(pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices);
@@ -8568,17 +8568,17 @@
   //  |8,351                468,351 |
   // 1._____________________________.2
   // 
-    array_50AC10[0].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;//8
-    array_50AC10[0].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;//8
-
-    array_50AC10[1].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;//8
-    array_50AC10[1].vWorldViewProjY = (double)v38;//247
-
-    array_50AC10[2].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;//468
-    array_50AC10[2].vWorldViewProjY = (double)v38;//247
-
-    array_50AC10[3].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;//468
-    array_50AC10[3].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;//8
+    VertexRenderList[0].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;//8
+    VertexRenderList[0].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;//8
+
+    VertexRenderList[1].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;//8
+    VertexRenderList[1].vWorldViewProjY = (double)v38;//247
+
+    VertexRenderList[2].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;//468
+    VertexRenderList[2].vWorldViewProjY = (double)v38;//247
+
+    VertexRenderList[3].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;//468
+    VertexRenderList[3].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;//8
 
     pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//7168
     pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;//7168
@@ -8592,19 +8592,19 @@
       // направление на север и/или юг (либо на восток и/или запад), значению 65536 еденицам(0х10000) соответствует угол 90.
       // две переменные хранят данные по углу обзора. field_14 по западу и востоку. field_20 по югу и северу
       // от -25080 до 25080
-      v39 = fixpoint_mul(pSkyPolygon.ptr_38->viewing_angle_from_west_east, v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.5)));
+      v39 = fixpoint_mul(pSkyPolygon.ptr_38->viewing_angle_from_west_east, v33 * (v30 - floor(VertexRenderList[i].vWorldViewProjY + 0.5)));
       v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;
 
-      v39 = fixpoint_mul(pSkyPolygon.ptr_38->viewing_angle_from_north_south, v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.f)));
+      v39 = fixpoint_mul(pSkyPolygon.ptr_38->viewing_angle_from_north_south, v33 * (v30 - floor(VertexRenderList[i].vWorldViewProjY + 0.f)));
       v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;
 
-      v9 = fixpoint_mul(pSkyPolygon.v_18.z, v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.5)));
+      v9 = fixpoint_mul(pSkyPolygon.v_18.z, v33 * (v30 - floor(VertexRenderList[i].vWorldViewProjY + 0.5)));
       v10 = pSkyPolygon.v_18.x + v9;
       if ( v10 > 0 )
         v10 = 0;
-      v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
+      v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)VertexRenderList[i].vWorldViewProjX);
       v34 = -pSkyPolygon.field_24;
-      v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0;
+      v32 = (signed __int64)VertexRenderList[i].vWorldViewProjY - 1.0;
       v14 = v33 * (v30 - v32);
       while ( 1 )
       {
@@ -8630,20 +8630,20 @@
         v18 = pODMRenderParams->shading_dist_mist;
       v37 = v35 + fixpoint_mul(pSkyPolygon.ptr_38->angle_from_west, v13);
       v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)fixpoint_mul(v37, v18) >> 3);
-      array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);
+      VertexRenderList[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);
 
       v36 = v36 + fixpoint_mul(pSkyPolygon.ptr_38->angle_from_south, v13);
       v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)fixpoint_mul(v36, v18) >> 3);
-      array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
-
-      array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist 8192
-      array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
+      VertexRenderList[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
+
+      VertexRenderList[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist 8192
+      VertexRenderList[i]._rhw = 1.0 / (double)(v18 >> 16);
     }
     pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
-    array_50AC10[0].vWorldViewProjY = (double)v10;
-    array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
-    array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
-    array_50AC10[3].vWorldViewProjY = (double)v10;
+    VertexRenderList[0].vWorldViewProjY = (double)v10;
+    VertexRenderList[1].vWorldViewProjY = VertexRenderList[1].vWorldViewProjY + 30.0;
+    VertexRenderList[2].vWorldViewProjY = VertexRenderList[2].vWorldViewProjY + 30.0;
+    VertexRenderList[3].vWorldViewProjY = (double)v10;
     pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
     return;
   }
--- a/Engine/Graphics/RenderStruct.h	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/RenderStruct.h	Sun May 17 22:42:13 2015 +0600
@@ -345,7 +345,7 @@
 
 
 extern RenderVertexSoft array_507D30[50];
-extern RenderVertexSoft array_50AC10[50];
+extern RenderVertexSoft VertexRenderList[50];
 extern RenderVertexSoft array_73D150[20];
 
 extern RenderVertexD3D3 d3d_vertex_buffer[50];
--- a/Engine/Graphics/stru9.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Graphics/stru9.cpp	Sun May 17 22:42:13 2015 +0600
@@ -241,15 +241,11 @@
 //----- (00498737) --------------------------------------------------------
 void stru9::AddVertex(struct VertexBuffer *pVertexBuffer, struct RenderVertexSoft *pVertex)
 {
-//  __debugbreak();
-  RenderVertexSoft *v3; // eax@1
-
-  v3 = &pVertexBuffer->pVertices[pVertexBuffer->uNumVertices];
-  v3->vWorldPosition.x = pVertex->vWorldPosition.x;
-  v3->vWorldPosition.y = pVertex->vWorldPosition.y;
-  v3->vWorldPosition.z = pVertex->vWorldPosition.z;
-  v3->u = pVertex->u;
-  v3->v = pVertex->v;
+  pVertexBuffer->pVertices[pVertexBuffer->uNumVertices].vWorldPosition.x = pVertex->vWorldPosition.x;
+  pVertexBuffer->pVertices[pVertexBuffer->uNumVertices].vWorldPosition.y = pVertex->vWorldPosition.y;
+  pVertexBuffer->pVertices[pVertexBuffer->uNumVertices].vWorldPosition.z = pVertex->vWorldPosition.z;
+  pVertexBuffer->pVertices[pVertexBuffer->uNumVertices].u = pVertex->u;
+  pVertexBuffer->pVertices[pVertexBuffer->uNumVertices].v = pVertex->v;
   ++pVertexBuffer->uNumVertices;
 }
 
@@ -362,7 +358,7 @@
 }
 
 //----- (004980B9) --------------------------------------------------------
-bool stru9::_4980B9(RenderVertexSoft *a1, unsigned int uNumVertices, float a3, float a4, float a5, RenderVertexSoft *pOutVertices, signed int *pOutNumVertices)
+bool stru9::_4980B9(RenderVertexSoft *a1, unsigned int uNumVertices, float pNormalX, float pNormalY, float pNormalZ, RenderVertexSoft *pOutVertices, signed int *pOutNumVertices)
 {
   RenderVertexSoft *v12; // ecx@9
   double v13; // st7@12
@@ -386,7 +382,7 @@
     v12 = &a1[(i + 1) % uNumVertices];
     if (a1[i].vWorldPosition.x != v12->vWorldPosition.x ||
         a1[i].vWorldPosition.y != v12->vWorldPosition.y ||
-        a1[i].vWorldPosition.z!= v12->vWorldPosition.z)
+        a1[i].vWorldPosition.z != v12->vWorldPosition.z)
     {
       v13 = v12->vWorldPosition.x - a1[i].vWorldPosition.x;
       v14 = v12->vWorldPosition.y - a1[i].vWorldPosition.y;
@@ -394,9 +390,9 @@
       ++v25;
 
       static_sub_4980B9_stru_AE3FE8.uNumVertices = 0;
-      static_sub_4980B9_stru_AE4BEC.x = a4 * v15 - v14 * a5;
-      static_sub_4980B9_stru_AE4BEC.y = v13 * a5 - v15 * a3;
-      static_sub_4980B9_stru_AE4BEC.z = v14 * a3 - v13 * a4;
+      static_sub_4980B9_stru_AE4BEC.x = pNormalY * v15 - v14 * pNormalZ;
+      static_sub_4980B9_stru_AE4BEC.y = v13 * pNormalZ - v15 * pNormalX;
+      static_sub_4980B9_stru_AE4BEC.z = v14 * pNormalX - v13 * pNormalY;
       if (*pOutNumVertices == 0)
         return true;
 
@@ -424,7 +420,7 @@
 
       for (uint j = 0; j < static_sub_4980B9_stru_AE3FE8.uNumVertices; ++j)
       {
-          pOutVertices[j].vWorldPosition.y = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.x;
+          pOutVertices[j].vWorldPosition.x = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.x;
           pOutVertices[j].vWorldPosition.y = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.y;
           pOutVertices[j].vWorldPosition.z = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.z;
           pOutVertices[j].u = static_sub_4980B9_stru_AE3FE8.pVertices[j].u;
--- a/Engine/Objects/Actor.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/Objects/Actor.cpp	Sun May 17 22:42:13 2015 +0600
@@ -4586,7 +4586,7 @@
   int v10; // ebx@14
   int v21; // [sp+Ch] [bp-14h]@4
   int v22; // [sp+10h] [bp-10h]@4
-
+  
   pParty->uFlags &= 0xFFFFFFCF;//~0x30
 
   ai_arrays_size = 0;
--- a/Engine/mm7_data.h	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/mm7_data.h	Sun May 17 22:42:13 2015 +0600
@@ -783,3 +783,6 @@
 extern bool new_speed;
 extern bool bSnow;
 extern bool draw_terrain_dist_mist;
+extern bool no_actors;
+extern bool lights_flag;
+extern bool debug_lights;
\ No newline at end of file
--- a/Engine/stru314.h	Thu May 14 19:29:28 2015 +0600
+++ b/Engine/stru314.h	Sun May 17 22:42:13 2015 +0600
@@ -8,9 +8,9 @@
   //----- (00489B60) --------------------------------------------------------
   stru314()
   {
-    this->field_4.x = 0.0;
-    this->field_4.y = 0.0;
-    this->field_4.z = 0.0;
+    this->Normal.x = 0.0;
+    this->Normal.y = 0.0;
+    this->Normal.z = 0.0;
 
     this->field_10.x = 0.0;
     this->field_10.y = 0.0;
@@ -28,7 +28,7 @@
 
 
   void (__fastcall ***vdestructor_ptr)(stru314 *, bool);
-  Vec3_float_ field_4;
+  Vec3_float_ Normal;
   Vec3_float_ field_10;
   Vec3_float_ field_1C;
   float dist;
--- a/OSWindow.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/OSWindow.cpp	Sun May 17 22:42:13 2015 +0600
@@ -32,6 +32,9 @@
 bool new_speed = false;
 bool bSnow = false;
 bool draw_terrain_dist_mist = false;//новая дальность отрисовки тайлов
+bool no_actors = false;           // remove all monsters / убрать всех монстров
+bool lights_flag = false;
+bool debug_lights = false;
 
 bool OSWindow::OnMouseLeftClick(int x, int y)
 {
@@ -624,7 +627,7 @@
           AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40064, L"Evil");
         }
       }
-
+      AppendMenuW(debug, MF_ENABLED | MF_STRING, 40122, L"Actors off");
       HMENU debug_time = CreatePopupMenu();
       AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_time, L"&Time");
       {
@@ -649,65 +652,78 @@
       HMENU debug_graphics = CreatePopupMenu();
       AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_graphics, L"&Graphics");
       {
+		HMENU lights_off = CreatePopupMenu();
+		AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)lights_off, L"Lights");//40104
+		{
+			AppendMenuW(lights_off, MF_ENABLED | MF_STRING, 40123, L"Lights on");
+			AppendMenuW(lights_off, MF_ENABLED | MF_STRING, 40124, L"Lights off");
+		}
+        //AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40025, L"Debug Lights");
+		HMENU debug_lights = CreatePopupMenu();
+		AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_lights, L"Debug Lights");//40104
+		{
+			AppendMenuW(debug_lights, MF_ENABLED | MF_STRING, 40125, L"Debug lights on");
+			AppendMenuW(debug_lights, MF_ENABLED | MF_STRING, 40126, L"Debug lights off");
+		}
         AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40023, L"Lighting Mode");
         AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40024, L"Lighting Geometry");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40104, L"Lights Off");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40105, L"Colored Lights");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40025, L"Debug Lights");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40101, L"Debug Decals");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40027, L"HWID Portals");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40047, L"SWID Portals");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40051, L"OD Frustum");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40054, L"SWOD Constant Redraw");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40055, L"SWOD Lit Rasterizer");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40056, L"Party Light off");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40060, L"SWOD Nice Lighting off");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40067, L"HWOD Additive Fog Lights");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40072, L"HWID Nice Lighting");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40048, L"Wireframe");
-        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40049, L"Fog");
+
+        //AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING/* | MF_GRAYED*/, 40123, L"Lights Off");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40105, L"Colored Lights");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40101, L"Debug Decals");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40027, L"HWID Portals");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40047, L"SWID Portals");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40051, L"OD Frustum");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40054, L"SWOD Constant Redraw");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40055, L"SWOD Lit Rasterizer");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40056, L"Party Light off");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40060, L"SWOD Nice Lighting off");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40067, L"HWOD Additive Fog Lights");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40072, L"HWID Nice Lighting");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40048, L"Wireframe");
+        AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40049, L"Fog");
       }
 
       HMENU debug_misc = CreatePopupMenu();
       AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_misc, L"&Misc");
       {
-        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40066, L"Object Viewcone Culling");
-        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40068, L"Red Tint");
-        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40071, L"Display Secrets");
-        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40102, L"Massive Bloodsplat");
-        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40103, L"Underwater Gravity");
+        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING | MF_GRAYED, 40066, L"Object Viewcone Culling");
+        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING | MF_GRAYED, 40068, L"Red Tint");
+        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING | MF_GRAYED, 40071, L"Display Secrets");
+        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING | MF_GRAYED, 40102, L"Massive Bloodsplat");
+        AppendMenuW(debug_misc, MF_ENABLED | MF_STRING | MF_GRAYED, 40103, L"Underwater Gravity");
       }
       
       HMENU debug_eax = CreatePopupMenu();
       AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_eax, L"EAX Environs");
       {
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40074, L"NONE");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40075, L"GENERIC");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40076, L"PADDEDCELL");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40077, L"ROOM");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40078, L"BATHROOM");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40079, L"LIVINGROOM");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40080, L"STONEROOM");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40081, L"AUDITORIUM");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40082, L"CONCERTHALL");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40083, L"CAVE");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40084, L"ARENA");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40085, L"HANGAR");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40086, L"CARPETEDHALLWAY");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40087, L"HALLWAY");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40088, L"STONECORRIDOR");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40089, L"ALLEY");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40090, L"FOREST");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40091, L"CITY");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40092, L"MOUNTAINS");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40093, L"QUARRY");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40094, L"PLAIN");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40095, L"PARKINGLOT");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40096, L"SEWERPIPE");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40097, L"UNDERWATER");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40098, L"DRUGGED");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40099, L"DIZZY");
-        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40100, L"PSICHOTIC");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40074, L"NONE");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40075, L"GENERIC");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40076, L"PADDEDCELL");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40077, L"ROOM");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40078, L"BATHROOM");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40079, L"LIVINGROOM");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40080, L"STONEROOM");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40081, L"AUDITORIUM");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40082, L"CONCERTHALL");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40083, L"CAVE");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40084, L"ARENA");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40085, L"HANGAR");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40086, L"CARPETEDHALLWAY");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40087, L"HALLWAY");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40088, L"STONECORRIDOR");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40089, L"ALLEY");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40090, L"FOREST");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40091, L"CITY");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40092, L"MOUNTAINS");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40093, L"QUARRY");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40094, L"PLAIN");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40095, L"PARKINGLOT");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40096, L"SEWERPIPE");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40097, L"UNDERWATER");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40098, L"DRUGGED");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40099, L"DIZZY");
+        AppendMenuW(debug_eax, MF_ENABLED | MF_STRING | MF_GRAYED, 40100, L"PSICHOTIC");
       }
     }
     HMENU other = CreatePopupMenu();
@@ -911,7 +927,11 @@
     case 40118:  bSnow = false;  break;
     case 40119:  draw_terrain_dist_mist = true;  break;
     case 40120:  draw_terrain_dist_mist = false;  break;
-
+    case 40122:  no_actors = true; break;
+	case 40123:  lights_flag = true;  break;
+	case 40124:  lights_flag = false;  break;
+	case 40125:	debug_lights = true; break;
+	case 40126: debug_lights = false; break;
   }
 
   return true;
--- a/_deleted.cpp	Thu May 14 19:29:28 2015 +0600
+++ b/_deleted.cpp	Sun May 17 22:42:13 2015 +0600
@@ -1552,7 +1552,7 @@
           do
           {
             v32 = 1.0 / (*(float *)(v31 * 48 + 7590236) + 0.0000001);
-            memcpy(&array_50AC10[v31], &array_73D150[v31], sizeof(array_50AC10[v31]));
+            memcpy(&VertexRenderList[v31], &array_73D150[v31], sizeof(VertexRenderList[v31]));
             ++v31;
             array_50A2B0[v31 + 49]._rhw = v32;
             v84 = v12->sTextureDeltaU + *(short *)(v30 - 40);
@@ -1571,7 +1571,7 @@
         static stru154 static_sub_004789DE_stru_73C818; // idb
 
         pEngine->pLightmapBuilder->ApplyLights_OutdoorFace((ODMFace *)v3);
-        if ( stru_F8AD28.uNumLightsApplied <= 0 )
+        if ( pLightsData.uNumLightsApplied <= 0 )
         {
           v12->field_108 = 0;
         }
@@ -1584,7 +1584,7 @@
           v55 = static_sub_004789DE_stru_73C818.face_plane.vNormal.x;
           v56 = static_sub_004789DE_stru_73C818.face_plane.vNormal.y;
           v57 = static_sub_004789DE_stru_73C818.face_plane.vNormal.z;
-          pEngine->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, v26, (Vec3_float_ *)&v55);
+          pEngine->pLightmapBuilder->_45CA88(&Lights, VertexRenderList, v26, (Vec3_float_ *)&v55);
         }
         if ( v74 )
         {
@@ -3250,27 +3250,27 @@
         if ( !_481FC9_terrain(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) )
           goto LABEL_104;
         v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
-        memcpy(array_50AC10, v104, 0x30u);
-        array_50AC10[0]._rhw = v26;
-        array_50AC10[0].u = 0.0;
-        array_50AC10[0].v = 0.0;
+        memcpy(VertexRenderList, v104, 0x30u);
+        VertexRenderList[0]._rhw = v26;
+        VertexRenderList[0].u = 0.0;
+        VertexRenderList[0].v = 0.0;
         v27 = *(float *)(HIDWORD(v101) + 12) + 0.0000001;
-        memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1]));
-        array_50AC10[1]._rhw = 1.0 / v27;
-        array_50AC10[1].u = 0.0;
-        array_50AC10[1].v = 1.0;
+        memcpy(&VertexRenderList[1], (void *)HIDWORD(v101), sizeof(VertexRenderList[1]));
+        VertexRenderList[1]._rhw = 1.0 / v27;
+        VertexRenderList[1].u = 0.0;
+        VertexRenderList[1].v = 1.0;
         v28 = v103->vWorldViewPosition.x + 0.0000001;
-        memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2]));
-        array_50AC10[2]._rhw = 1.0 / v28;
-        array_50AC10[2].u = 1.0;
-        array_50AC10[2].v = 1.0;
+        memcpy(&VertexRenderList[2], v103, sizeof(VertexRenderList[2]));
+        VertexRenderList[2]._rhw = 1.0 / v28;
+        VertexRenderList[2].u = 1.0;
+        VertexRenderList[2].v = 1.0;
         v29 = v102->vWorldViewPosition.x + 0.0000001;
-        memcpy(&array_50AC10[3], v102, sizeof(array_50AC10[3]));
-        array_50AC10[3]._rhw = 1.0 / v29;
-        array_50AC10[3].u = 1.0;
-        array_50AC10[3].v = 0.0;
-        pEngine->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 4u, 1);
-        if ( stru_F8AD28.uNumLightsApplied <= 0 )
+        memcpy(&VertexRenderList[3], v102, sizeof(VertexRenderList[3]));
+        VertexRenderList[3]._rhw = 1.0 / v29;
+        VertexRenderList[3].u = 1.0;
+        VertexRenderList[3].v = 0.0;
+        pEngine->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, VertexRenderList, 4u, 1);
+        if ( pLightsData.uNumLightsApplied <= 0 )
         {
           v17->field_108 = 0;
         }
@@ -3278,7 +3278,7 @@
         {
           v30 = pEngine;
           v17->field_108 = 1;
-          pEngine->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 4, pNormal);
+          pEngine->pLightmapBuilder->_45CA88(&Lights, VertexRenderList, 4, pNormal);
         }
         if ( v104->vWorldViewPosition.x < 8.0
           || *(float *)(HIDWORD(v101) + 12) < 8.0
@@ -3371,22 +3371,22 @@
     if ( !_481FC9_terrain((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) )
       goto LABEL_74;
     v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
-    memcpy(array_50AC10, v104, 0x30u);
-    array_50AC10[0]._rhw = v48;
-    array_50AC10[0].u = 0.0;
-    array_50AC10[0].v = 0.0;
+    memcpy(VertexRenderList, v104, 0x30u);
+    VertexRenderList[0]._rhw = v48;
+    VertexRenderList[0].u = 0.0;
+    VertexRenderList[0].v = 0.0;
     v49 = *(float *)(HIDWORD(v101) + 12) + 0.0000001;
-    memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1]));
-    array_50AC10[1]._rhw = 1.0 / v49;
-    array_50AC10[1].u = 0.0;
-    array_50AC10[1].v = 1.0;
+    memcpy(&VertexRenderList[1], (void *)HIDWORD(v101), sizeof(VertexRenderList[1]));
+    VertexRenderList[1]._rhw = 1.0 / v49;
+    VertexRenderList[1].u = 0.0;
+    VertexRenderList[1].v = 1.0;
     v50 = v103->vWorldViewPosition.x + 0.0000001;
-    memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2]));
-    array_50AC10[2]._rhw = 1.0 / v50;
-    array_50AC10[2].u = 1.0;
-    array_50AC10[2].v = 1.0;
-    pEngine->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 3u, 0);
-    if ( stru_F8AD28.uNumLightsApplied <= 0 )
+    memcpy(&VertexRenderList[2], v103, sizeof(VertexRenderList[2]));
+    VertexRenderList[2]._rhw = 1.0 / v50;
+    VertexRenderList[2].u = 1.0;
+    VertexRenderList[2].v = 1.0;
+    pEngine->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, VertexRenderList, 3u, 0);
+    if ( pLightsData.uNumLightsApplied <= 0 )
     {
       v38->field_108 = 0;
     }
@@ -3394,7 +3394,7 @@
     {
       v51 = pEngine;
       v38->field_108 = 1;
-      pEngine->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormala);
+      pEngine->pLightmapBuilder->_45CA88(&Lights, VertexRenderList, 3, pNormala);
     }
     if ( v104->vWorldViewPosition.x < 8.0
       || *(float *)(HIDWORD(v101) + 12) < 8.0
@@ -3465,22 +3465,22 @@
             goto LABEL_105;
           }
           v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
-          memcpy(array_50AC10, v104, 0x30u);
-          array_50AC10[0]._rhw = v62;
-          array_50AC10[0].u = 0.0;
-          array_50AC10[0].v = 0.0;
+          memcpy(VertexRenderList, v104, 0x30u);
+          VertexRenderList[0]._rhw = v62;
+          VertexRenderList[0].u = 0.0;
+          VertexRenderList[0].v = 0.0;
           v63 = v103->vWorldViewPosition.x + 0.0000001;
-          memcpy(&array_50AC10[1], v103, sizeof(array_50AC10[1]));
-          array_50AC10[1]._rhw = 1.0 / v63;
-          array_50AC10[1].u = 1.0;
-          array_50AC10[1].v = 1.0;
+          memcpy(&VertexRenderList[1], v103, sizeof(VertexRenderList[1]));
+          VertexRenderList[1]._rhw = 1.0 / v63;
+          VertexRenderList[1].u = 1.0;
+          VertexRenderList[1].v = 1.0;
           v64 = v102->vWorldViewPosition.x + 0.0000001;
-          memcpy(&array_50AC10[2], v102, sizeof(array_50AC10[2]));
-          array_50AC10[2]._rhw = 1.0 / v64;
-          array_50AC10[2].u = 1.0;
-          array_50AC10[2].v = 0.0;
-          pEngine->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 3u, 1);
-          if ( stru_F8AD28.uNumLightsApplied <= 0 )
+          memcpy(&VertexRenderList[2], v102, sizeof(VertexRenderList[2]));
+          VertexRenderList[2]._rhw = 1.0 / v64;
+          VertexRenderList[2].u = 1.0;
+          VertexRenderList[2].v = 0.0;
+          pEngine->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, VertexRenderList, 3u, 1);
+          if ( pLightsData.uNumLightsApplied <= 0 )
           {
             v17->field_108 = 0;
           }
@@ -3488,7 +3488,7 @@
           {
             v65 = pEngine;
             v17->field_108 = 1;
-            pEngine->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormalb);
+            pEngine->pLightmapBuilder->_45CA88(&Lights, VertexRenderList, 3, pNormalb);
           }
           if ( v104->vWorldViewPosition.x < 8.0 || v103->vWorldViewPosition.x < 8.0 || v102->vWorldViewPosition.x < 8.0 )
           {
@@ -4571,8 +4571,8 @@
             LOBYTE(v2->uAttributes) |= 0x80u;
             v109 = v6;
             sr_4AE5F1(v1);
-            v126 = stru_F8AD28.pDeltaUV[0];
-            v128 = stru_F8AD28.pDeltaUV[1];
+            v126 = pLightsData.pDeltaUV[0];
+            v128 = pLightsData.pDeltaUV[1];
             v107 = bUseLoResSprites;
             v7 = GetPortalScreenCoord(v1);
             if ( v7 )
@@ -4581,20 +4581,20 @@
               {
                 if ( v2->uPolygonType == 1 )
                 {
-                  for ( i = 0; i < stru_F8AD28.uNumLightsApplied; stru_F8AD28._blv_lights_ys[v18] = v20 )
+                  for ( i = 0; i < Lights.uNumLightsApplied; Lights._blv_lights_ys[v18] = v20 )
                   {
                     v18 = i;
-                    v120 = stru_F8AD28._blv_lights_xs[i];
-                    v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16;
-                    v133 = stru_F8AD28.plane_4.vNormal.x;
-                    v120 = stru_F8AD28._blv_lights_ys[i];
-                    v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16;
+                    v120 = pLightsData._blv_lights_xs[i];
+                    v134 = (unsigned __int64)(v120 * (signed __int64)-pLightsData.plane_4.vNormal.y) >> 16;
+                    v133 = pLightsData.plane_4.vNormal.x;
+                    v120 = pLightsData._blv_lights_ys[i];
+                    v133 = (unsigned __int64)(v120 * (signed __int64)pLightsData.plane_4.vNormal.x) >> 16;
                     v19 = v128;
-                    stru_F8AD28._blv_lights_xs[i] = v126
+                    Lights._blv_lights_xs[i] = v126
                                                   + v134
                                                   + ((unsigned __int64)(v120
-                                                                      * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16);
-                    v20 = v19 - stru_F8AD28._blv_lights_zs[i++];
+                                                                      * (signed __int64)Lights.plane_4.vNormal.x) >> 16);
+                    v20 = v19 - Lights._blv_lights_zs[i++];
                   }
                 }
                 else
@@ -4605,44 +4605,44 @@
                     {
 LABEL_16:
                       a2 = 0;
-                      if ( stru_F8AD28.uNumLightsApplied > 0 )
+                      if ( Lights.uNumLightsApplied > 0 )
                       {
                         do
                         {
                           v8 = a2;
-                          v9 = stru_F8AD28._blv_lights_xs[a2];
-                          v131 = stru_F8AD28._blv_lights_ys[a2];
-                          v10 = stru_F8AD28._blv_lights_zs[a2];
-                          v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z
-                                           + stru_F8AD28.plane_4.dist
-                                           + v9 * stru_F8AD28.plane_4.vNormal.x
-                                           + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16;
+                          v9 = Lights._blv_lights_xs[a2];
+                          v131 = Lights._blv_lights_ys[a2];
+                          v10 = Lights._blv_lights_zs[a2];
+                          v11 = (signed int)(v10 * Lights.plane_4.vNormal.z
+                                           + Lights.plane_4.dist
+                                           + v9 * Lights.plane_4.vNormal.x
+                                           + v131 * Lights.plane_4.vNormal.y) >> 16;
                           v119 = v9
-                               - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                   * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z
-                                                                                 + stru_F8AD28.plane_4.dist
-                                                                                 + v9 * stru_F8AD28.plane_4.vNormal.x
-                                                                                 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16);
-                          v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16;
-                          v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16);
-                          stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119
-                                                                             * (signed __int64)stru_F8AD28.vec_14.x) >> 16)
+                               - ((unsigned __int64)(Lights.plane_4.vNormal.x
+                                                   * (signed __int64)((signed int)(v10 * Lights.plane_4.vNormal.z
+                                                                                 + Lights.plane_4.dist
+                                                                                 + v9 * Lights.plane_4.vNormal.x
+                                                                                 + v131 * Lights.plane_4.vNormal.y) >> 16)) >> 16);
+                          v131 -= (unsigned __int64)(Lights.plane_4.vNormal.y * (signed __int64)v11) >> 16;
+                          v127 = v10 - ((unsigned __int64)(Lights.plane_4.vNormal.z * (signed __int64)v11) >> 16);
+                          Lights._blv_lights_xs[a2] = ((unsigned __int64)(v119
+                                                                             * (signed __int64)Lights.vec_14.x) >> 16)
                                                          + ((unsigned __int64)((signed int)v131
-                                                                             * (signed __int64)stru_F8AD28.vec_14.y) >> 16);
-                          v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16;
-                          v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16;
-                          v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16;
+                                                                             * (signed __int64)Lights.vec_14.y) >> 16);
+                          v124 = (unsigned __int64)(v119 * (signed __int64)Lights.vec_20.x) >> 16;
+                          v134 = (unsigned __int64)((signed int)v131 * (signed __int64)Lights.vec_20.y) >> 16;
+                          v133 = (unsigned __int64)(v127 * (signed __int64)Lights.vec_20.z) >> 16;
                           v12 = v126;
-                          stru_F8AD28._blv_lights_ys[v8] = v124
+                          Lights._blv_lights_ys[v8] = v124
                                                          + ((unsigned __int64)((signed int)v131
-                                                                             * (signed __int64)stru_F8AD28.vec_20.y) >> 16)
+                                                                             * (signed __int64)Lights.vec_20.y) >> 16)
                                                          + ((unsigned __int64)(v127
-                                                                             * (signed __int64)stru_F8AD28.vec_20.z) >> 16);
-                          stru_F8AD28._blv_lights_xs[v8] += v12;
-                          stru_F8AD28._blv_lights_ys[v8] += v128;
+                                                                             * (signed __int64)Lights.vec_20.z) >> 16);
+                          Lights._blv_lights_xs[v8] += v12;
+                          Lights._blv_lights_ys[v8] += v128;
                           ++a2;
                         }
-                        while ( a2 < stru_F8AD28.uNumLightsApplied );
+                        while ( a2 < Lights.uNumLightsApplied );
                         v2 = v103;
                       }
                       goto LABEL_24;
@@ -4654,20 +4654,20 @@
                       goto LABEL_16;
                     }
                   }
-                  for ( j = 0; j < stru_F8AD28.uNumLightsApplied; *(int *)v15 = v16 )
+                  for ( j = 0; j < Lights.uNumLightsApplied; *(int *)v15 = v16 )
                   {
                     v14 = v128;
-                    stru_F8AD28._blv_lights_xs[j] += v126;
+                    Lights._blv_lights_xs[j] += v126;
                     v15 = 4 * j + 16297672;
-                    v16 = v14 - stru_F8AD28._blv_lights_ys[j++];
+                    v16 = v14 - Lights._blv_lights_ys[j++];
                   }
                 }
 LABEL_24:
                 v135 = 1;
                 pEngine->_44ED0A(v2, &v135, 31);
                 v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1);
-                v134 = stru_F8AD28.field_44;
-                v106 = stru_F8AD28.field_48;
+                v134 = Lights.field_44;
+                v106 = Lights.field_48;
                 v21 = stru_F8A590._viewport_space_y;
                 a2 = stru_F8A590._viewport_space_y;
                 v110 = v111 * stru_F8A590._viewport_space_y;
@@ -4711,7 +4711,7 @@
                     v131 = (unsigned int)v26;
                     HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0);
                     LOWORD(v28) = 0;
-                    v105 = stru_F8AD28.field_0 | v28;
+                    v105 = Lights.field_0 | v28;
                     v123 = sr_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8));
                     if ( (unsigned int)pColorPixel < v131 )
                     {
@@ -4724,7 +4724,7 @@
                         v30 = *((int *)v29 - 2);
                         LOWORD(v30) = 0;
                         v117 = v105;
-                        v31 = stru_F8AD28.field_0 | v30;
+                        v31 = Lights.field_0 | v30;
                         if ( v105 <= (unsigned int)v31 )
                           v117 = v31;
                         v105 = v31;
@@ -6885,9 +6885,9 @@
 
   v1 = uVertexID;
   v2 = (double)pODMRenderParams->shading_dist_mist;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  memcpy(&VertexRenderList[uVertexID], VertexRenderList, sizeof(VertexRenderList[uVertexID]));
   v22 = 0;
-  v18 = array_50AC10[0].vWorldViewPosition.x <= v2;
+  v18 = VertexRenderList[0].vWorldViewPosition.x <= v2;
   if ( (signed int)(uVertexID + 1) <= 1 )
     return 0;
   v3 = (char *)&array_507D30[0].vWorldViewPosition.z;
@@ -6898,7 +6898,7 @@
   v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v24 = (char *)&array_507D30[0].vWorldViewPosition;
   v26 = (char *)&array_507D30[0].flt_2C;
-  v5 = (char *)&array_50AC10[0].vWorldViewPosition;
+  v5 = (char *)&VertexRenderList[0].vWorldViewPosition;
   v17 = v1;
   do
   {
@@ -7014,9 +7014,9 @@
   char *v25; // [sp+2Ch] [bp-4h]@5
 
   v1 = uVertexID;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  memcpy(&VertexRenderList[uVertexID], VertexRenderList, sizeof(VertexRenderList[uVertexID]));
   v21 = 0;
-  v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0;
+  v17 = VertexRenderList[0].vWorldViewPosition.x >= 8.0;
   if ( (signed int)(uVertexID + 1) <= 1 )
     return 0;
   v2 = (char *)&array_507D30[0].vWorldViewPosition.z;
@@ -7027,7 +7027,7 @@
   v20 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v23 = (char *)&array_507D30[0].vWorldViewPosition;
   v25 = (char *)&array_507D30[0].flt_2C;
-  v4 = (char *)&array_50AC10[0].vWorldViewPosition;
+  v4 = (char *)&VertexRenderList[0].vWorldViewPosition;
   v16 = v1;
   do
   {
@@ -7268,11 +7268,11 @@
     return v117;
   v127 = a1;
   v1 = a1;
-  memcpy(sr_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2));
+  memcpy(sr_508690, VertexRenderList, 4 * ((unsigned int)(48 * a1) >> 2));
   v2 = 0;
   do
   {
-    if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 )
+    if ( VertexRenderList[v2].vWorldViewProjX < (double)v101 || VertexRenderList[v2].vWorldViewProjX > (double)v100 )
       v136 = 0;
     if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 )
       v136 = 0;
@@ -7283,8 +7283,8 @@
   if ( v136 )
     return v117;
   v110 = 0;
-  memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1]));
-  v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15;
+  memcpy(&VertexRenderList[v1], VertexRenderList, sizeof(VertexRenderList[v1]));
+  v4 = VertexRenderList[0].vWorldViewProjX + 6.7553994e15;
   v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X;
   if ( v117 < 1 )
     goto LABEL_112;
@@ -7294,7 +7294,7 @@
   v128 = (char *)&array_50A2B0[0].vWorldViewProjY;
   v121 = (char *)&array_50A2B0[0].flt_2C;
   v114 = (char *)&array_50A2B0[0]._rhw;
-  v7 = (char *)&array_50AC10[0].flt_2C;
+  v7 = (char *)&VertexRenderList[0].flt_2C;
   do
   {
     v103 = *((float *)v7 + 7) + 6.7553994e15;
@@ -7747,7 +7747,7 @@
 
 
 //----- (00424579) --------------------------------------------------------
-int __fastcall sr_424579(int uFaceID, stru320 *a2)
+int __fastcall sr_424579(int uFaceID, LightsData *a2)
 {
   BLVFace *v2; // eax@1
   Vec3_short_ *v3; // ebx@1
@@ -7794,7 +7794,7 @@
   v25 = v5;
   if ( (signed int)v5 > 0 )
   {
-    _ECX = (char *)&array_50AC10[0].vWorldPosition.z;
+    _ECX = (char *)&VertexRenderList[0].vWorldPosition.z;
     do
     {
       v7 = v3[v2->pVertexIDs[v29]].x;
@@ -7833,7 +7833,7 @@
     }
     while ( v29 < (signed int)v25 );
   }
-  _EDX = (char *)&array_50AC10[0].vWorldViewPosition;
+  _EDX = (char *)&VertexRenderList[0].vWorldViewPosition;
   if ( pBLVRenderParams->sPartyRotX )
   {
     if ( (signed int)v5 > 0 )
@@ -7844,7 +7844,7 @@
         fild    pBLVRenderParams->vPartyPos.y
         fild    pBLVRenderParams->vPartyPos.z
       }
-      _EAX = (char *)&array_50AC10[0].vWorldPosition.z;
+      _EAX = (char *)&VertexRenderList[0].vWorldPosition.z;
       v15 = v5;
       do
       {
@@ -7911,7 +7911,7 @@
         fild    pBLVRenderParams->vPartyPos.y
         fild    pBLVRenderParams->vPartyPos.z
       }
-      _EAX = (char *)&array_50AC10[0].vWorldViewPosition;
+      _EAX = (char *)&VertexRenderList[0].vWorldViewPosition;
       v19 = v5;
       do
       {
@@ -8171,15 +8171,15 @@
               v92 = v5;
               sr_4AE5F1(v2);
               ++pBLVRenderParams->field_84;
-              v6 = stru_F8AD28.pDeltaUV[0];
-              v116 = stru_F8AD28.pDeltaUV[1];
+              v6 = Lights.pDeltaUV[0];
+              v116 = Lights.pDeltaUV[1];
               v7 = 0;
-              for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 )
+              for ( i = bUseLoResSprites; v7 < Lights.uNumLightsApplied; *(int *)v9 = v10 )
               {
                 v8 = v116;
-                stru_F8AD28._blv_lights_xs[v7] += v6;
+                Lights._blv_lights_xs[v7] += v6;
                 v9 = 4 * v7 + 16297672;
-                v10 = v8 - stru_F8AD28._blv_lights_ys[v7++];
+                v10 = v8 - Lights._blv_lights_ys[v7++];
               }
               v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1);
               result = stru_F8A590._viewport_space_y;
@@ -8226,7 +8226,7 @@
                   HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0);
                   v18 = stru_F81018.field_0.field_10;
                   LOWORD(v17) = 0;
-                  v97 = stru_F8AD28.field_0 | v17;
+                  v97 = Lights.field_0 | v17;
                   v110 = sr_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8));
                   v19 = stru_F81018.field_0.field_4 >> i;
                   v20 = 11 - v18;
@@ -8248,7 +8248,7 @@
                       v25 = *((int *)v24 - 2);
                       LOWORD(v25) = 0;
                       v115 = v97;
-                      v26 = stru_F8AD28.field_0 | v25;
+                      v26 = Lights.field_0 | v25;
                       if ( v97 <= (unsigned int)v26 )
                         v115 = v26;
                       v97 = v26;
@@ -8556,31 +8556,31 @@
   _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y;
   _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x;
   ++pBLVRenderParams->field_88;
-  v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C;
-  v6 = v5 + _dx * stru_F8AD28.vec_80.x;
-  v11 = v5 + _dx * stru_F8AD28.vec_80.x;
-  if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) )
-  {
-    LODWORD(v8) = stru_F8AD28.vec_80.z << 16;
-    HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16;
+  v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * Lights.vec_80.y + Lights.field_7C;
+  v6 = v5 + _dx * Lights.vec_80.x;
+  v11 = v5 + _dx * Lights.vec_80.x;
+  if ( v5 + _dx * Lights.vec_80.x && (v7 = abs(Lights.vec_80.z) >> 14, v7 <= abs(v6)) )
+  {
+    LODWORD(v8) = Lights.vec_80.z << 16;
+    HIDWORD(v8) = Lights.vec_80.z >> 16;
     v9 = v8 / v11;
   }
   else
   {
     v9 = 0x40000000u;
   }
-  if ( (signed int)v9 >= stru_F8AD28.field_34 )
+  if ( (signed int)v9 >= Lights.field_34 )
     p->field_0 = v9;
   else
-    p->field_0 = stru_F8AD28.field_34;
-  p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y)
+    p->field_0 = Lights.field_34;
+  p->field_4 = ((unsigned __int64)((_dy * Lights.vec_8C.z + Lights.vec_8C.x + _dx * Lights.vec_8C.y)
                                  * (signed __int64)(signed int)v9) >> 16)
-             + stru_F8AD28.field_98
-             + (stru_F8AD28.pDeltaUV[0] << 16);
-  p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y)
+             + Lights.field_98
+             + (Lights.pDeltaUV[0] << 16);
+  p->field_8 = ((unsigned __int64)((_dy * Lights.vec_9C.z + Lights.vec_9C.x + _dx * Lights.vec_9C.y)
                                  * (signed __int64)(signed int)v9) >> 16)
-             + stru_F8AD28.field_A8
-             + (stru_F8AD28.pDeltaUV[1] << 16);
+             + Lights.field_A8
+             + (Lights.pDeltaUV[1] << 16);
   result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16);
   if ( result < 369620 || bUseLoResSprites )
   {
@@ -8614,26 +8614,26 @@
   int v16; // [sp+14h] [bp-8h]@1
   int v17; // [sp+18h] [bp-4h]@1
 
-  v2 = a1 >> SLOBYTE(stru_F8AD28.field_38);
-  v3 = a2 >> SLOBYTE(stru_F8AD28.field_38);
-  v17 = stru_F8AD28.uCurrentAmbientLightLevel;
+  v2 = a1 >> SLOBYTE(Lights.field_38);
+  v3 = a2 >> SLOBYTE(Lights.field_38);
+  v17 = Lights.uCurrentAmbientLightLevel;
   v4 = 0;
   v15 = v2;
   v16 = 0;
-  if ( stru_F8AD28.uNumLightsApplied > 0 )
+  if ( Lights.uNumLightsApplied > 0 )
   {
     do
     {
       v5 = v16;
-      v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]);
-      v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]);
-      v6 = stru_F8AD28._blv_lights_light_dot_faces[v16];
+      v13 = abs(v2 - Lights._blv_lights_xs[v16]);
+      v14 = abs(v3 - Lights._blv_lights_ys[v16]);
+      v6 = Lights._blv_lights_light_dot_faces[v16];
       v7 = v13;
       v8 = v14;
       if ( v6 < v13 )
       {
         v6 = v13;
-        v7 = stru_F8AD28._blv_lights_light_dot_faces[v16];
+        v7 = Lights._blv_lights_light_dot_faces[v16];
       }
       if ( v6 < v14 )
       {
@@ -8648,16 +8648,16 @@
         v7 = v10;
       }
       v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6;
-      if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] )
-        v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536);
+      if ( (signed int)v11 < Lights._blv_lights_radii[v5] )
+        v17 += 30 * (v11 * Lights._blv_lights_inv_radii[v5] - 65536);
       ++v16;
       v2 = v15;
     }
-    while ( v16 < stru_F8AD28.uNumLightsApplied );
+    while ( v16 < Lights.uNumLightsApplied );
     v4 = 0;
   }
-  if ( stru_F8AD28.field_3E4 != v4 )
-    v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4);
+  if ( Lights.field_3E4 != v4 )
+    v17 -= Lights.field_3E8 * (v2 - Lights.field_3F0) + Lights.field_3EC * (v3 - Lights.field_3F4);
   if ( v17 >= v4 )
   {
     if ( v17 > 2031616 )
@@ -8757,74 +8757,74 @@
   v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0);
   v6 = 8 * uFaceID;
   LOBYTE(v6) = PID(OBJECT_BModel,uFaceID);
-  stru_F8AD28.field_0 = v6;
-  stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x;
-  stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y;
-  stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z;
-  stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist;
-  stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU;
-  stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV;
+  Lights.field_0 = v6;
+  Lights.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x;
+  Lights.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y;
+  Lights.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z;
+  Lights.plane_4.dist = v1->pFacePlane_old.dist;
+  Lights.pDeltaUV[0] = v2->sTextureDeltaU;
+  Lights.pDeltaUV[1] = v2->sTextureDeltaV;
   v7 = GetTickCount();
   v8 = v1->uAttributes;
   v9 = v7 >> 3;
   if ( v8 & 4 )
   {
-    stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1;
+    Lights.pDeltaUV[1] -= v9 & v5->uHeightMinus1;
   }
   else
   {
     if ( v8 & 0x20 )
-      stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1;
+      Lights.pDeltaUV[1] += v9 & v5->uHeightMinus1;
   }
   v10 = v1->uAttributes;
   if ( BYTE1(v10) & 8 )
   {
-    stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1;
+    Lights.pDeltaUV[0] -= v9 & v5->uWidthMinus1;
   }
   else
   {
     if ( v10 & 0x40 )
-      stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1;
+      Lights.pDeltaUV[0] += v9 & v5->uWidthMinus1;
   }
   v1->_get_normals(&v67, &v66);
-  stru_F8AD28.vec_14.x = v67.x;
-  stru_F8AD28.vec_14.y = v67.y;
-  stru_F8AD28.vec_14.z = v67.z;
-  stru_F8AD28.vec_20.x = v66.x;
-  stru_F8AD28.vec_20.y = v66.y;
-  stru_F8AD28.vec_20.z = v66.z;
-  stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22;
+  Lights.vec_14.x = v67.x;
+  Lights.vec_14.y = v67.y;
+  Lights.vec_14.z = v67.z;
+  Lights.vec_20.x = v66.x;
+  Lights.vec_20.y = v66.y;
+  Lights.vec_20.z = v66.z;
+  Lights.uDefaultAmbientLightLevel = v2->field_22;
   if ( pBLVRenderParams->sPartyRotX )
   {
-    v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v74;
-    X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
-    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - X;
-    stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
+    v74 = (unsigned __int64)(Lights.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v74 = ((unsigned __int64)(Lights.plane_4.vNormal.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v74;
+    X = (unsigned __int64)(Lights.plane_4.vNormal.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    Lights.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - X;
+    Lights.rotated_normal.y = ((unsigned __int64)(Lights.plane_4.vNormal.x
                                                      * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                                 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
+                                 + ((unsigned __int64)(Lights.plane_4.vNormal.y
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
-                                 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
+    Lights.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                                 + ((unsigned __int64)(Lights.plane_4.vNormal.z
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
-    v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
-    X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
-    v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v70 = (unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v74 = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
+    v70 = (unsigned __int64)(Lights.vec_14.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    Lights.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
+    Lights.vec_60.z = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.field_6C = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(Lights.vec_14.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v70 = (unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v74 = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
+    X = (unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v72 = (unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
+    v70 = (unsigned __int64)(Lights.vec_20.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    Lights.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
+    Lights.vec_70.y = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(Lights.vec_20.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
     v74 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
         - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
     v11 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
@@ -8840,81 +8840,81 @@
   }
   else
   {
-    v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
+    v70 = (unsigned __int64)(Lights.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    Lights.rotated_normal.x = ((unsigned __int64)(Lights.plane_4.vNormal.x
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                                  - v70;
-    stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
-    stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
+    Lights.rotated_normal.z = Lights.plane_4.vNormal.z;
+    Lights.rotated_normal.y = ((unsigned __int64)(Lights.plane_4.vNormal.x
                                                      * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                                 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
+                                 + ((unsigned __int64)(Lights.plane_4.vNormal.y
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+    v70 = (unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    Lights.vec_60.y = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                          - v70;
-    stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+    Lights.field_6C = Lights.vec_14.z;
+    Lights.vec_60.z = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    v70 = (unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    Lights.vec_70.x = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                          - v70;
-    v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v69 = (unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
     v14 = pBLVRenderParams->vPartyPos.x;
-    stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
+    Lights.vec_70.z = Lights.vec_20.z;
     v13 = pBLVRenderParams->vPartyPos.y;
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.vec_70.y = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
     v12 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
         - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
     v11 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
           + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
     v70 = -65536 * pBLVRenderParams->vPartyPos.z;
   }
-  stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
-  stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z
-                       + stru_F8AD28.plane_4.dist
-                       + stru_F8AD28.plane_4.vNormal.y * v13
-                       + stru_F8AD28.plane_4.vNormal.x * v14;
-  stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
-                                          * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
-  stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
-                                          * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
-  stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
-  stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
-  stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
-  stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
-  X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16;
+  Lights.field_7C = Lights.rotated_normal.x;
+  Lights.vec_60.x = Lights.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z
+                       + Lights.plane_4.dist
+                       + Lights.plane_4.vNormal.y * v13
+                       + Lights.plane_4.vNormal.x * v14;
+  Lights.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
+                                          * (signed __int64)Lights.rotated_normal.y) >> 16;
+  Lights.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
+                                          * (signed __int64)Lights.rotated_normal.z) >> 16;
+  Lights.vec_80.z = -Lights.vec_60.x;
+  Lights.vec_8C.x = Lights.vec_60.y;
+  Lights.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.vec_60.z) >> 16;
+  Lights.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.field_6C) >> 16;
+  X = (unsigned __int64)(Lights.vec_60.y * (signed __int64)v12) >> 16;
   v15 = v70;
-  v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16;
-  stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
-  stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70);
-  stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
-  stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
-  X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16;
-  v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16;
-  v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16;
-  stru_F8AD28.field_38 = 0;
-  stru_F8AD28.field_A8 = -(X
-                         + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16));
+  v70 = (unsigned __int64)(Lights.field_6C * (signed __int64)v70) >> 16;
+  Lights.vec_9C.x = Lights.vec_70.x;
+  Lights.field_98 = -(X + ((unsigned __int64)(Lights.vec_60.z * (signed __int64)v11) >> 16) + v70);
+  Lights.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.vec_70.y) >> 16;
+  Lights.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.vec_70.z) >> 16;
+  X = (unsigned __int64)(Lights.vec_70.x * (signed __int64)v12) >> 16;
+  v69 = (unsigned __int64)(Lights.vec_70.y * (signed __int64)v11) >> 16;
+  v70 = (unsigned __int64)(Lights.vec_70.z * (signed __int64)v15) >> 16;
+  Lights.field_38 = 0;
+  Lights.field_A8 = -(X
+                         + ((unsigned __int64)(Lights.vec_70.y * (signed __int64)v11) >> 16)
+                         + ((unsigned __int64)(Lights.vec_70.z * (signed __int64)v15) >> 16));
   if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 )
   {
-    stru_F8AD28.field_3E4 = 1;
-    stru_F8AD28.field_3E8 = *(int *)&v68->field_4;
-    stru_F8AD28.field_3EC = *(int *)&v68->field_8;
-    stru_F8AD28.field_3F0 = v68->field_1E;
-    stru_F8AD28.field_3F4 = v68->field_20;
+    Lights.field_3E4 = 1;
+    Lights.field_3E8 = *(int *)&v68->field_4;
+    Lights.field_3EC = *(int *)&v68->field_8;
+    Lights.field_3F0 = v68->field_1E;
+    Lights.field_3F4 = v68->field_20;
   }
   else
   {
-    stru_F8AD28.field_3E4 = 0;
+    Lights.field_3E4 = 0;
   }
   v16 = 0.0039215689;
   v17 = 116 * v1->uSectorID;
   v69 = v17;
   v74 = 0;
   v73 = 0;
-  stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16;
+  Lights.uCurrentAmbientLightLevel = (Lights.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16;
   v70 = pMobileLightsStack->uNumLightsActive;
   if ( pMobileLightsStack->uNumLightsActive > 0 )
   {
@@ -8947,12 +8947,12 @@
                   {
                     v23 = X;
                     v24 = v74;
-                    stru_F8AD28._blv_lights_radii[v74] = v19;
-                    stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19;
-                    *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16;
-                    stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1);
-                    stru_F8AD28._blv_lights_ys[v24] = *(short *)v18;
-                    stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1);
+                    Lights._blv_lights_radii[v74] = v19;
+                    Lights._blv_lights_inv_radii[v24] = 65536 / v19;
+                    *(int *)((char *)&Lights.field_240 + v24 * 4) = *((short *)v18 + 5) << 16;
+                    Lights._blv_lights_xs[v24] = *((short *)v18 - 1);
+                    Lights._blv_lights_ys[v24] = *(short *)v18;
+                    Lights._blv_lights_zs[v24] = *((short *)v18 + 1);
                     v68 = (BLVFaceExtra *)(unsigned __int8)v18[6];
                     v25 = (double)(signed int)v68 * v16;
                     v68 = (BLVFaceExtra *)(unsigned __int8)v18[7];
@@ -8963,11 +8963,11 @@
                     *(float *)(v24 * 4 + 16298072) = v27 * v16;
                     *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16;
                     v16 = 0.0039215689;
-                    stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23);
+                    Lights._blv_lights_light_dot_faces[v24] = abs(v23);
                     v28 = v74;
                     v29 = v18[9];
                     ++v74;
-                    stru_F8AD28._blv_lights_types[v28] = v29;
+                    Lights._blv_lights_types[v28] = v29;
                   }
                 }
               }
@@ -9020,22 +9020,22 @@
                       if ( v38 <= v35 && v35 )
                       {
                         v39 = v74;
-                        stru_F8AD28._blv_lights_radii[v74] = v35;
-                        stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68;
-                        *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16;
-                        stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x;
-                        stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y;
-                        stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z;
+                        Lights._blv_lights_radii[v74] = v35;
+                        Lights._blv_lights_inv_radii[v39] = 65536 / (signed int)v68;
+                        *(int *)((char *)&Lights.field_240 + v39 * 4) = X << 16;
+                        Lights._blv_lights_xs[v39] = v32->vPosition.x;
+                        Lights._blv_lights_ys[v39] = v32->vPosition.y;
+                        Lights._blv_lights_zs[v39] = v32->vPosition.z;
                         v68 = (BLVFaceExtra *)v32->uRed;
-                        stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16;
+                        Lights._blv_lights_rs[v39] = (double)(signed int)v68 * v16;
                         v68 = (BLVFaceExtra *)v32->uGreen;
-                        stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16;
+                        Lights._blv_lights_gs[v39] = (double)(signed int)v68 * v16;
                         v68 = (BLVFaceExtra *)v32->uBlue;
-                        stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16;
+                        Lights._blv_lights_bs[v39] = (double)(signed int)v68 * v16;
                         v16 = 0.0039215689;
-                        stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38);
+                        Lights._blv_lights_light_dot_faces[v39] = abs(v38);
                         v40 = v74++;
-                        stru_F8AD28._blv_lights_types[v40] = 1;
+                        Lights._blv_lights_types[v40] = 1;
                       }
                     }
                   }
@@ -9086,24 +9086,24 @@
                     {
                       v47 = v69;
                       v48 = v74;
-                      stru_F8AD28._blv_lights_radii[v74] = v42;
-                      stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42;
-                      stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1);
-                      stru_F8AD28._blv_lights_ys[v48] = *(short *)v41;
-                      stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1);
+                      Lights._blv_lights_radii[v74] = v42;
+                      Lights._blv_lights_inv_radii[v48] = 65536 / v42;
+                      Lights._blv_lights_xs[v48] = *((short *)v41 - 1);
+                      Lights._blv_lights_ys[v48] = *(short *)v41;
+                      Lights._blv_lights_zs[v48] = *((short *)v41 + 1);
                       v68 = (BLVFaceExtra *)(unsigned __int8)v41[6];
                       v49 = (double)(signed int)v68 * v16;
                       v68 = (BLVFaceExtra *)(unsigned __int8)v41[7];
                       v50 = (unsigned __int8)v41[8];
-                      stru_F8AD28._blv_lights_rs[v48] = v49;
+                      Lights._blv_lights_rs[v48] = v49;
                       v51 = (double)(signed int)v68;
                       v68 = (BLVFaceExtra *)v50;
-                      stru_F8AD28._blv_lights_gs[v48] = v51 * v16;
-                      stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16;
+                      Lights._blv_lights_gs[v48] = v51 * v16;
+                      Lights._blv_lights_bs[v48] = (double)(signed int)v68 * v16;
                       v16 = 0.0039215689;
-                      stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47);
+                      Lights._blv_lights_light_dot_faces[v48] = abs(v47);
                       v52 = v74++;
-                      stru_F8AD28._blv_lights_types[v52] = 1;
+                      Lights._blv_lights_types[v52] = 1;
                     }
                   }
                 }
@@ -9117,7 +9117,7 @@
     }
     while ( v73 < pStationaryLightsStack->uNumLightsActive );
   }
-  stru_F8AD28.uNumLightsApplied = v74;
+  Lights.uNumLightsApplied = v74;
   v53 = v1->pBounding.x2;
   if ( pBLVRenderParams->vPartyPos.x <= v53 )
   {
@@ -9161,10 +9161,10 @@
   }
   v64 = v62 * v62 + v60;
   if ( v64 )
-    stru_F8AD28.field_34 = integer_sqrt(v64) << 16;
+    Lights.field_34 = integer_sqrt(v64) << 16;
   else
-    stru_F8AD28.field_34 = 0;
-  v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y);
+    Lights.field_34 = 0;
+  v68 = (BLVFaceExtra *)abs(Lights.rotated_normal.y);
   v65 = (double)(signed int)v68;
   if ( v65 >= 655.36 )
   {
@@ -9172,25 +9172,25 @@
     {
       if ( v65 >= 45875.2 )
       {
-        stru_F8AD28.field_44 = 8;
-        stru_F8AD28.field_48 = 3;
+        Lights.field_44 = 8;
+        Lights.field_48 = 3;
       }
       else
       {
-        stru_F8AD28.field_44 = 16;
-        stru_F8AD28.field_48 = 4;
+        Lights.field_44 = 16;
+        Lights.field_48 = 4;
       }
     }
     else
     {
-      stru_F8AD28.field_44 = 32;
-      stru_F8AD28.field_48 = 5;
+      Lights.field_44 = 32;
+      Lights.field_48 = 5;
     }
   }
   else
   {
-    stru_F8AD28.field_44 = 64;
-    stru_F8AD28.field_48 = 6;
+    Lights.field_44 = 64;
+    Lights.field_48 = 6;
   }
 }
 
@@ -9209,47 +9209,47 @@
   int v9; // eax@2
   int result; // eax@4
 
-  stru_F8AD28.plane_4.vNormal.z = -65536;
-  stru_F8AD28.vec_20.y = -65536;
-  stru_F8AD28.plane_4.vNormal.x = 0;
-  stru_F8AD28.plane_4.vNormal.y = 0;
-  stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16;
-  stru_F8AD28.vec_14.x = 65536;
-  stru_F8AD28.vec_14.y = 0;
-  stru_F8AD28.vec_14.z = 0;
-  stru_F8AD28.vec_20.x = 0;
-  stru_F8AD28.vec_20.z = 0;
-  stru_F8AD28.uDefaultAmbientLightLevel = 0;
+  Lights.plane_4.vNormal.z = -65536;
+  Lights.vec_20.y = -65536;
+  Lights.plane_4.vNormal.x = 0;
+  Lights.plane_4.vNormal.y = 0;
+  Lights.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16;
+  Lights.vec_14.x = 65536;
+  Lights.vec_14.y = 0;
+  Lights.vec_14.z = 0;
+  Lights.vec_20.x = 0;
+  Lights.vec_20.z = 0;
+  Lights.uDefaultAmbientLightLevel = 0;
   if ( pBLVRenderParams->sPartyRotX )
   {
-    v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
-       - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
-                                 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
+    v0 = ((unsigned __int64)(Lights.plane_4.vNormal.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+       - ((unsigned __int64)(Lights.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    Lights.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+                                 - ((unsigned __int64)(Lights.plane_4.vNormal.z
                                                      * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
-    stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
+    Lights.rotated_normal.y = ((unsigned __int64)(Lights.plane_4.vNormal.x
                                                      * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                                 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
+                                 + ((unsigned __int64)(Lights.plane_4.vNormal.y
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
-                                 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
+    Lights.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                                 + ((unsigned __int64)(Lights.plane_4.vNormal.z
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
-    v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
-       - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
-    v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
-       - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v1 = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+       - ((unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    Lights.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+                         - ((unsigned __int64)(Lights.vec_14.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
+    Lights.vec_60.z = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.field_6C = ((unsigned __int64)(v1 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(Lights.vec_14.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v2 = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+       - ((unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    Lights.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+                         - ((unsigned __int64)(Lights.vec_20.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
+    Lights.vec_70.y = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(Lights.vec_20.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
     v3 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
          + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
     v4 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
@@ -9264,26 +9264,26 @@
   }
   else
   {
-    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
+    Lights.rotated_normal.x = ((unsigned __int64)(Lights.plane_4.vNormal.x
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
-                                 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
+                                 - ((unsigned __int64)(Lights.plane_4.vNormal.y
                                                      * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
-    stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
+    Lights.rotated_normal.z = Lights.plane_4.vNormal.z;
+    Lights.rotated_normal.y = ((unsigned __int64)(Lights.plane_4.vNormal.x
                                                      * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                                 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
+                                 + ((unsigned __int64)(Lights.plane_4.vNormal.y
                                                      * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    Lights.vec_60.y = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+                         - ((unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    Lights.field_6C = Lights.vec_14.z;
+    Lights.vec_60.z = ((unsigned __int64)(Lights.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.vec_70.x = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+                         - ((unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
     v8 = pBLVRenderParams->vPartyPos.y;
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
+    Lights.vec_70.y = ((unsigned __int64)(Lights.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(Lights.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    Lights.vec_70.z = Lights.vec_20.z;
     v9 = pBLVRenderParams->vPartyPos.x;
     v5 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
        - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
@@ -9292,34 +9292,34 @@
          + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
     v7 = -65536 * pBLVRenderParams->vPartyPos.z;
   }
-  stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
-  stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8
-                       + stru_F8AD28.plane_4.dist
-                       + stru_F8AD28.plane_4.vNormal.x * v9
-                       + stru_F8AD28.plane_4.vNormal.z * v6;
-  stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
-                                          * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
-  stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
-                                          * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
-  stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
-  stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
-  stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
-  stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
-  stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
-  stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16));
-  stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
-  stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
+  Lights.field_7C = Lights.rotated_normal.x;
+  Lights.vec_60.x = Lights.plane_4.vNormal.y * v8
+                       + Lights.plane_4.dist
+                       + Lights.plane_4.vNormal.x * v9
+                       + Lights.plane_4.vNormal.z * v6;
+  Lights.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
+                                          * (signed __int64)Lights.rotated_normal.y) >> 16;
+  Lights.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
+                                          * (signed __int64)Lights.rotated_normal.z) >> 16;
+  Lights.vec_80.z = -Lights.vec_60.x;
+  Lights.vec_8C.x = Lights.vec_60.y;
+  Lights.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.vec_60.z) >> 16;
+  Lights.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.field_6C) >> 16;
+  Lights.vec_9C.x = Lights.vec_70.x;
+  Lights.field_98 = -(((unsigned __int64)(Lights.vec_60.y * (signed __int64)v5) >> 16)
+                         + ((unsigned __int64)(Lights.vec_60.z * (signed __int64)v3) >> 16)
+                         + ((unsigned __int64)(Lights.field_6C * (signed __int64)v7) >> 16));
+  Lights.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.vec_70.y) >> 16;
+  Lights.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)Lights.vec_70.z) >> 16;
   result = 0;
-  stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16));
-  stru_F8AD28.field_38 = 0;
-  stru_F8AD28.field_3E4 = 0;
-  stru_F8AD28.uCurrentAmbientLightLevel = 0;
-  stru_F8AD28.uNumLightsApplied = 0;
-  stru_F8AD28.field_34 = 0;
+  Lights.field_A8 = -(((unsigned __int64)(Lights.vec_70.x * (signed __int64)v5) >> 16)
+                         + ((unsigned __int64)(Lights.vec_70.y * (signed __int64)v3) >> 16)
+                         + ((unsigned __int64)(Lights.vec_70.z * (signed __int64)v7) >> 16));
+  Lights.field_38 = 0;
+  Lights.field_3E4 = 0;
+  Lights.uCurrentAmbientLightLevel = 0;
+  Lights.uNumLightsApplied = 0;
+  Lights.field_34 = 0;
   return result;
 }
 //----- (004ADD1D) --------------------------------------------------------
@@ -9396,7 +9396,7 @@
     v2 = &pIndoor->pFaces[uFaceID];
     if ( pRenderer->pRenderD3D )
     {
-      v3 = sr_424579(uFaceID, &stru_F8AD28);
+      v3 = sr_424579(uFaceID, &Lights);
       v59 = v3;
     }
     else
@@ -9429,7 +9429,7 @@
             v5 = v43;
           }
           v7 = v5;
-          v41 = stru_F8AD28.field_0;
+          v41 = Lights.field_0;
           array_507D30[v7].u = array_507D30[v7].u * 0.25;
           array_507D30[v7].v = array_507D30[v7].v * 0.25;
           if ( BYTE1(v2->uAttributes) & 0x40 )
@@ -9480,7 +9480,7 @@
               v18 = v14->field_28;
               v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13);
               LOWORD(v18) = 0;
-              v46 = stru_F8AD28.field_0 | v18;
+              v46 = Lights.field_0 | v18;
               v61 = *(__int16 *)((char *)stru_F8A590.viewport_right_side + v13) - v19;
               if ( LOBYTE(viewparams->field_20) )
               {
@@ -9616,27 +9616,27 @@
   v3 = pBLVRenderParams->uViewportCenterY - a3;
   v4 = pBLVRenderParams->uViewportCenterX - a2;
   v11 = a1;
-  v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y
-     + stru_F8AD28.field_7C
-     + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x;
-  if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) )
-  {
-    LODWORD(v6) = stru_F8AD28.vec_80.z << 16;
-    HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16;
-    v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x);
+  v5 = (pBLVRenderParams->uViewportCenterY - a3) * Lights.vec_80.y
+     + Lights.field_7C
+     + (pBLVRenderParams->uViewportCenterX - a2) * Lights.vec_80.x;
+  if ( v5 && (v12 = abs(Lights.vec_80.z) >> 14, v12 <= abs(v5)) )
+  {
+    LODWORD(v6) = Lights.vec_80.z << 16;
+    HIDWORD(v6) = Lights.vec_80.z >> 16;
+    v7 = v6 / (v3 * Lights.vec_80.y + Lights.field_7C + v4 * Lights.vec_80.x);
   }
   else
   {
     v7 = 1073741824;
   }
-  v8 = stru_F8AD28.vec_9C.z;
-  stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z
-                                                + stru_F8AD28.vec_8C.x
-                                                + v4 * stru_F8AD28.vec_8C.y)
+  v8 = Lights.vec_9C.z;
+  stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * Lights.vec_8C.z
+                                                + Lights.vec_8C.x
+                                                + v4 * Lights.vec_8C.y)
                                                * (signed __int64)v7) >> 16)
-                           + stru_F8AD28.field_98;
-  result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16;
-  v10 = result + stru_F8AD28.field_A8;
+                           + Lights.field_98;
+  result = (unsigned __int64)((v3 * v8 + Lights.vec_9C.x + v4 * Lights.vec_9C.y) * (signed __int64)v7) >> 16;
+  v10 = result + Lights.field_A8;
   stru_F83B80[v11].field_28 = v7;
   stru_F83B80[v11].field_4 = v10;
   return result;
@@ -14283,41 +14283,41 @@
             //goto LABEL_162;
           //}
           __debugbreak(); // warning C4700: uninitialized local variable 'v102' used
-          memcpy(&array_50AC10[0], v102, 0x30u);
-          array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
-          array_50AC10[0].u = 0.0;
-          array_50AC10[0].v = 0.0;
-          memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1]));
-          array_50AC10[1]._rhw = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097);
-          array_50AC10[1].u = 0.0;
-          array_50AC10[1].v = 1.0;
+          memcpy(&VertexRenderList[0], v102, 0x30u);
+          VertexRenderList[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
+          VertexRenderList[0].u = 0.0;
+          VertexRenderList[0].v = 0.0;
+          memcpy(&VertexRenderList[1], pVertices, sizeof(VertexRenderList[1]));
+          VertexRenderList[1]._rhw = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097);
+          VertexRenderList[1].u = 0.0;
+          VertexRenderList[1].v = 1.0;
           __debugbreak(); // warning C4700: uninitialized local variable 'pVertices2' used
-          memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2]));
-          array_50AC10[2]._rhw = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097);
-          array_50AC10[2].u = 1.0;
-          array_50AC10[2].v = 1.0;
-          memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3]));
-          array_50AC10[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097);
-          array_50AC10[3].u = 1.0;
-          array_50AC10[3].v = 0.0;
+          memcpy(&VertexRenderList[2], pVertices2, sizeof(VertexRenderList[2]));
+          VertexRenderList[2]._rhw = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097);
+          VertexRenderList[2].u = 1.0;
+          VertexRenderList[2].v = 1.0;
+          memcpy(&VertexRenderList[3], v101, sizeof(VertexRenderList[3]));
+          VertexRenderList[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097);
+          VertexRenderList[3].u = 1.0;
+          VertexRenderList[3].v = 0.0;
           if ( !(_76D5C0_static_init_flag & 1) )
           {
             _76D5C0_static_init_flag |= 1u;
             stru154(stru_76D5A8);
             atexit(loc_481199);
           }
-          v32 = (struct8 *)array_50AC10;
+          v32 = (struct8 *)VertexRenderList;
           v97 = (int)pEngine->pLightmapBuilder;
-          pEngine->pLightmapBuilder->StackLights_TerrainFace(norm, &v95, array_50AC10, 4, 1);
-          pDecalBuilder->_49BE8A(pTile, norm, &v95, array_50AC10, 4, 1);
+          pEngine->pLightmapBuilder->StackLights_TerrainFace(norm, &v95, VertexRenderList, 4, 1);
+          pDecalBuilder->_49BE8A(pTile, norm, &v95, VertexRenderList, 4, 1);
           a5 = 4;
           if ( byte_4D864C && pEngine->uFlags & 0x80 )
           {
             thisa = pIndoorCameraD3D;
-            if ( pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 )
+            if ( pIndoorCameraD3D->_4371C3(VertexRenderList, &a5, 0) == 1 && !a5 )
               goto LABEL_162;
-            thisa->ViewTransform(array_50AC10, a5);
-            thisa->Project(array_50AC10, a5, 0);
+            thisa->ViewTransform(VertexRenderList, a5);
+            thisa->Project(VertexRenderList, a5, 0);
           }
           this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0
               || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
@@ -14325,8 +14325,8 @@
           v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x
               || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x;
           v33 = 0;
-          pEngine->pLightmapBuilder->std__vector_000004_size = 0;
-          if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
+          pEngine->pLightmapBuilder->StationaryLightsCount = 0;
+          if ( Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
           {
             if ( this_3 )
               v33 = 3;
@@ -14334,10 +14334,10 @@
               v33 = v108 != 0 ? 5 : 0;
             static_sub_0048034E_stru_154.ClassifyPolygon(norm, v95);
             if ( pDecalBuilder->uNumDecals > 0 )
-              pDecalBuilder->ApplyDecals(31 - pTile->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1);
-          }
-          if ( stru_F8AD28.uNumLightsApplied > 0 )
-            pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33);
+              pDecalBuilder->ApplyDecals(31 - pTile->dimming_level, 4, &static_sub_0048034E_stru_154, a5, VertexRenderList, 0, *(float *)&v33, -1);
+          }
+          if ( Lights.uNumLightsApplied > 0 )
+            pEngine->pLightmapBuilder->ApplyLights(&Lights, &static_sub_0048034E_stru_154, a5, VertexRenderList, 0, v33);
           v34 = a5;
           //v35 = byte_4D864C == 0;
           pTile->uNumVertices = a5;
@@ -14423,18 +14423,18 @@
           --pODMRenderParams->uNumPolygons;
           goto LABEL_112;
         }
-      memcpy(&array_50AC10[0], v102, 0x30u);
-      array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
-      array_50AC10[0].u = 0.0;
-      array_50AC10[0].v = 0.0;
-      memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1]));
-      array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097;
-      array_50AC10[1].u = 0.0;
-      array_50AC10[1].v = 1.0;
-      memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2]));
-      array_50AC10[2]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097;
-      array_50AC10[2].u = 1.0;
-      array_50AC10[2].v = 1.0;
+      memcpy(&VertexRenderList[0], v102, 0x30u);
+      VertexRenderList[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
+      VertexRenderList[0].u = 0.0;
+      VertexRenderList[0].v = 0.0;
+      memcpy(&VertexRenderList[1], pVertices, sizeof(VertexRenderList[1]));
+      VertexRenderList[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097;
+      VertexRenderList[1].u = 0.0;
+      VertexRenderList[1].v = 1.0;
+      memcpy(&VertexRenderList[2], pVertices2, sizeof(VertexRenderList[2]));
+      VertexRenderList[2]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097;
+      VertexRenderList[2].u = 1.0;
+      VertexRenderList[2].v = 1.0;
       static stru154 static_sub_0048034E_stru_76D590;
       static bool __init_flag2 = false;
       if (!__init_flag2)
@@ -14449,27 +14449,27 @@
         atexit(loc_48118F);
       }
       v96 = pEngine->pLightmapBuilder;
-      pEngine->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0);
-      pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0);
+      pEngine->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, VertexRenderList, 3, 0);
+      pDecalBuilder->_49BE8A(v40, v48, &a4, VertexRenderList, 3, 0);
       uNumVertices = 3;
       if ( byte_4D864C && pEngine->uFlags & 0x80 )
       {
         thisb = pIndoorCameraD3D;
-        if ( pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices )
+        if ( pIndoorCameraD3D->_4371C3(VertexRenderList, &uNumVertices, 0) == 1 && !uNumVertices )
         {
 //LABEL_77:
           --pODMRenderParams->uNumPolygons;
           goto LABEL_112;
         }
-        thisb->ViewTransform(array_50AC10, uNumVertices);
-        thisb->Project(array_50AC10, uNumVertices, 0);
+        thisb->ViewTransform(VertexRenderList, uNumVertices);
+        thisb->Project(VertexRenderList, uNumVertices, 0);
       }
       this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
       v54 = (double)pODMRenderParams->shading_dist_mist;
       v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x;
       pVertices = 0;
-      v96->std__vector_000004_size = 0;
-      if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
+      v96->StationaryLightsCount = 0;
+      if ( Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
       {
         if ( this_3a )
           pVertices = (RenderVertexSoft *)3;
@@ -14478,10 +14478,10 @@
         //a8 = (RenderVertexSoft *)(this_3a ? 3 : v108 != 0 ? 5 : 0);
         static_sub_0048034E_stru_76D590.ClassifyPolygon(v48, *(float *)&a4);
         if ( pDecalBuilder->uNumDecals > 0 )
-          pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices, -1);
-      }
-      if ( stru_F8AD28.uNumLightsApplied > 0 )
-        v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices);
+          pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D590, uNumVertices, VertexRenderList, 0, (char)pVertices, -1);
+      }
+      if ( Lights.uNumLightsApplied > 0 )
+        v96->ApplyLights(&Lights, &static_sub_0048034E_stru_76D590, uNumVertices, VertexRenderList, 0, (char)pVertices);
       v55 = uNumVertices;
       //v35 = byte_4D864C == 0;
       v40->uNumVertices = uNumVertices;
@@ -14552,18 +14552,18 @@
         --pODMRenderParams->uNumPolygons;
         goto LABEL_162;
       }
-      memcpy(&array_50AC10[0], v102, 0x30u);
-      array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
-      array_50AC10[0].u = 0.0;
-      array_50AC10[0].v = 0.0;
-      memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1]));
-      array_50AC10[1]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097;
-      array_50AC10[1].u = 1.0;
-      array_50AC10[1].v = 1.0;
-      memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2]));
-      array_50AC10[2]._rhw = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097;
-      array_50AC10[2].u = 1.0;
-      array_50AC10[2].v = 0.0;
+      memcpy(&VertexRenderList[0], v102, 0x30u);
+      VertexRenderList[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
+      VertexRenderList[0].u = 0.0;
+      VertexRenderList[0].v = 0.0;
+      memcpy(&VertexRenderList[1], pVertices2, sizeof(VertexRenderList[1]));
+      VertexRenderList[1]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097;
+      VertexRenderList[1].u = 1.0;
+      VertexRenderList[1].v = 1.0;
+      memcpy(&VertexRenderList[2], v101, sizeof(VertexRenderList[2]));
+      VertexRenderList[2]._rhw = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097;
+      VertexRenderList[2].u = 1.0;
+      VertexRenderList[2].v = 0.0;
       static stru154 static_sub_0048034E_stru_76D578;
       static bool __init_flag1 = false;
       if (!__init_flag1)
@@ -14572,28 +14572,28 @@
         stru154::stru154(&static_sub_0048034E_stru_76D578);
       }
       v96 = pEngine->pLightmapBuilder;
-      pEngine->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1);
-      pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1);
+      pEngine->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, VertexRenderList, 3, 1);
+      pDecalBuilder->_49BE8A(v40, v63, &v87, VertexRenderList, 3, 1);
       v100 = 3;
       if ( byte_4D864C && pEngine->uFlags & 0x80 )
       {
         thisc = pIndoorCameraD3D;
-        if ( pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 )
+        if ( pIndoorCameraD3D->_4371C3(VertexRenderList, (unsigned int *)&v100, 0) == 1 && !v100 )
           //goto LABEL_126;
         {
           --pODMRenderParams->uNumPolygons;
           goto LABEL_162;
         }
-        thisc->ViewTransform(array_50AC10, v100);
-        thisc->Project(array_50AC10, v100, 0);
+        thisc->ViewTransform(VertexRenderList, v100);
+        thisc->Project(VertexRenderList, v100, 0);
       }
       this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0
            || v101->vWorldViewPosition.x < 8.0;
       v69 = (double)pODMRenderParams->shading_dist_mist;
       v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x;
       v70 = 0;
-      v96->std__vector_000004_size = 0;
-      if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
+      v96->StationaryLightsCount = 0;
+      if ( Lights.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
       {
         if ( this_3b )
           v70 = 3;
@@ -14601,10 +14601,10 @@
           v70 = v108 != 0 ? 5 : 0;
         static_sub_0048034E_stru_76D578.ClassifyPolygon(v63, v87);
         if ( pDecalBuilder->uNumDecals > 0 )
-          pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70, -1);
-      }
-      if ( stru_F8AD28.uNumLightsApplied > 0 )
-        v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70);
+          pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D578, v100, VertexRenderList, 0, v70, -1);
+      }
+      if ( Lights.uNumLightsApplied > 0 )
+        v96->ApplyLights(&Lights, &static_sub_0048034E_stru_76D578, v100, VertexRenderList, 0, v70);
       v71 = v59;
       v72 = v100;
       //v35 = byte_4D864C == 0;