diff Render.cpp @ 1413:3881d2f94eb1

UseNPCSkill DIALOGUE_USE_NPC_ABILITY
author Nomad
date Sat, 27 Jul 2013 16:09:00 +0200
parents 38df78aba732
children 5930342f092b a8b1bbac95d4
line wrap: on
line diff
--- a/Render.cpp	Sat Jul 27 14:28:14 2013 +0200
+++ b/Render.cpp	Sat Jul 27 16:09:00 2013 +0200
@@ -50,22 +50,11 @@
 int uNumSpritesDrawnThisFrame; // weak
 
 RenderVertexSoft array_507D30[50];
-RenderVertexSoft array_508690[50];
-RenderVertexSoft array_508FF0[50];
-RenderVertexSoft array_509950[50];
-RenderVertexSoft array_50A2B0[50];
 RenderVertexSoft array_50AC10[50];
-
 RenderVertexSoft array_73D150[20];
 
 RenderVertexD3D3 d3d_vertex_buffer[50];
 
-RenderVertexSoft *ptr_801A04;
-RenderVertexSoft *ptr_801A08;
-
-RenderVertexSoft pVerticesSR_801A10[384];
-RenderVertexSoft pVerticesSR_806210[384];
-
 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
 
 /*  384 */
@@ -383,588 +372,6 @@
   }
 }
 
-//----- (0048034E) --------------------------------------------------------
-void Render::DrawTerrainD3D(int a1, int a2, int a3, int unk4)
-{
-  //int v3; // esi@1
-  int v4; // edi@1
-  int v5; // ebx@2
-  int v6; // eax@2
-  int v7; // eax@3
-  RenderVertexSoft *v8; // edi@3
-  RenderVertexSoft *v9; // ebx@4
-  RenderVertexSoft *v10; // ecx@4
-  float v11; // eax@6
-  double v12; // ST5C_8@6
-  double v13; // ST2C_8@6
-  int v14; // eax@6
-  double v15; // st7@6
-  struct Polygon *pTile; // ebx@12
-  unsigned __int16 v17; // ax@12
-  int v18; // eax@13
-  signed int v22; // eax@13
-  Vec3_float_ *norm; // eax@15
-  //double v24; // st6@17
-  double v25; // ST54_8@17
-  unsigned __int8 v26; // sf@17
-  unsigned __int8 v27; // of@17
-  double v28; // st5@19
-  double v29; // st5@19
-  double v30; // st5@19
-  double v31; // st5@19
-  struct struct8 *v32; // esi@21
-  double v3a; // st7@32
-  int v33; // edi@38
-  unsigned int v34; // ecx@47
-  char v35; // zf@47
-  unsigned int v36; // eax@50
-  int v37; // eax@54
-  //Polygon *v38; // ecx@55
-  unsigned int v39; // eax@59
-  struct Polygon *v40; // ebx@62
-  unsigned __int16 pTileBitmapsID; // ax@62
-  int v42; // eax@63
-  LightmapBuilder *v43; // ecx@63
-  int v44; // eax@63
-  int v45; // eax@63
-  int v46; // eax@63
-  signed int v47; // eax@63
-  Vec3_float_ *v48; // eax@65
-  double v49; // st6@67
-  double v50; // ST4C_8@67
-  double v51; // st5@71
-  double v52; // st5@71
-  double v53; // st5@71
-  double v54; // st7@84
-  unsigned int v55; // ecx@98
-  unsigned int v56; // eax@101
-  int v57; // eax@105
-  unsigned int v58; // eax@109
-  struct Polygon *v59; // esi@112
-  unsigned __int16 v60; // ax@112
-  int v61; // eax@113
-  signed int v62; // eax@113
-  Vec3_float_ *v63; // eax@114
-  double v64; // st6@116
-  double v65; // ST3C_8@116
-  double v66; // st5@120
-  double v67; // st5@120
-  double v68; // st5@120
-  double v69; // st7@133
-  int v70; // edi@138
-  struct Polygon *v71; // esi@147
-  unsigned int v72; // ecx@147
-  unsigned int v73; // eax@150
-  int v74; // eax@154
-  unsigned int v75; // eax@158
-  //unsigned int v76; // [sp-10h] [bp-E0h]@61
-  int v77; // [sp-Ch] [bp-DCh]@61
-  IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61
-  //int v79; // [sp-4h] [bp-D4h]@61
-  bool v80; // [sp+0h] [bp-D0h]@59
-  bool v81; // [sp+0h] [bp-D0h]@109
-  int v82; // [sp+54h] [bp-7Ch]@1
-  int v83; // [sp+60h] [bp-70h]@1
-  int v84; // [sp+6Ch] [bp-64h]@1
-  int v85; // [sp+70h] [bp-60h]@63
-  float a4; // [sp+74h] [bp-5Ch]@73
-  float v87; // [sp+78h] [bp-58h]@122
-  int v88; // [sp+7Ch] [bp-54h]@1
-  int v89; // [sp+80h] [bp-50h]@6
-  int v93; // [sp+90h] [bp-40h]@2
-  int X; // [sp+94h] [bp-3Ch]@1
-  float v95; // [sp+98h] [bp-38h]@21
-  LightmapBuilder *v96; // [sp+9Ch] [bp-34h]@73
-  int v97; // [sp+A0h] [bp-30h]@6
-  int sX; // [sp+A4h] [bp-2Ch]@6
-  unsigned int uNumVertices; // [sp+A8h] [bp-28h]@73
-  int v100; // [sp+ACh] [bp-24h]@122
-  int sY; // [sp+B0h] [bp-20h]@6
-  RenderVertexSoft *v102; // [sp+B4h] [bp-1Ch]@3
-  unsigned int a5; // [sp+B8h] [bp-18h]@21
-  RenderVertexSoft *v101; // [sp+BCh] [bp-14h]@6
-  Vec3_float_ *v99; // [sp+C0h] [bp-10h]@17
-  RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6
-  RenderVertexSoft *pVertices2; // [sp+C8h] [bp-8h]@6
-  char v108; // [sp+CFh] [bp-1h]@36
-  float thisd; // [sp+D8h] [bp+8h]@6
-  float thise; // [sp+D8h] [bp+8h]@6
-  float thisf; // [sp+D8h] [bp+8h]@17
-  IndoorCameraD3D *thisa; // [sp+D8h] [bp+8h]@23
-  float thisg; // [sp+D8h] [bp+8h]@67
-  IndoorCameraD3D *thisb; // [sp+D8h] [bp+8h]@75
-  float thish; // [sp+D8h] [bp+8h]@116
-  IndoorCameraD3D *thisc; // [sp+D8h] [bp+8h]@124
-  char this_3; // [sp+DBh] [bp+Bh]@30
-  char this_3a; // [sp+DBh] [bp+Bh]@82
-  char this_3b; // [sp+DBh] [bp+Bh]@131
-
-  static stru154 static_sub_0048034E_stru_154;
-  static stru154 stru_76D5A8;
-  //v3 = a1;
-  v82 = a2;
-  v83 = a3;
-  X = abs(unk4);
-  v4 = 0;
-  v88 = 0;
-  v84 = a1 - 1;
-/*  if ( a1 - 1 > 0 )
-  {
-    while ( 1 )
-    {
-      v5 = abs(X);//v5 = 13108
-      v6 = abs(v83);//v6 = 13108
-      --X;
-      //__debugbreak(); // uncoment & refactor following large if
-      v93 = (int)&terrain_76E5C8[(v5 << 7) + v6];
-      /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7),
-                                                                       v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)),
-             ((a8 = v9,
-               pVertices = &pVerticesSR_801A10[1] + v7,
-               v11 = v8->vWorldPosition.x,
-               v101 = v10,
-               v12 = v11 + 6.755399441055744e15,
-               sX = LODWORD(v12),
-               v13 = v8->vWorldPosition.y + 6.755399441055744e15,
-               sY = LODWORD(v13),
-               thisd = (v10->vWorldPosition.x + v8->vWorldPosition.x) * 0.5,
-               v14 = WorldPosToGridCellX(floorf(thisd + 0.5f)),//maybe current camera position X
-               v15 = v9->vWorldPosition.y + v8->vWorldPosition.y,
-               v89 = v14,
-               thise = v15 * 0.5,
-               _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z
-               WorldPosToGridCellX(sX),
-               WorldPosToGridCellZ(sY),
-               !byte_4D864C)
-           || !(pGame->uFlags & 0x80))
-          && !_481EFA_clip_terrain_poly(v8, v9, v101, pVertices, 1)) )*/
-      /*if ( !&terrain_76E5C8[(v5 << 7) + v6] )
-        goto LABEL_162*/
-      v8 = &pVerticesSR_806210[v4];
-      //pVertices2 = &pVerticesSR_801A10[v4 + 1];
-      //v102 = v8;
-      if (!v82)
-      {
-        pVertices = &pVerticesSR_801A10[v4];
-        v101 = &pVerticesSR_806210[v4 + 1];
-      }
-      else
-      {
-        pVertices = &pVerticesSR_801A10[v4 + 1];
-        v101 = &pVerticesSR_806210[v4];
-      }
-      sX = floorf(v8->vWorldPosition.x + 0.5f);
-      sY = floorf(v8->vWorldPosition.z + 0.5f);
-      v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));
-      v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f));
-      /*WorldPosToGridCellX(sX);
-      WorldPosToGridCellZ(sY);
-      if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !_481EFA_clip_terrain_poly(v8, pVertices, v101, pVertices2, 1))
-        if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y 
-             || pVertices2->vWorldPosition.y != v101->vWorldPosition.y )
-          break;*/
-        pTile = &array_77EC08[pOutdoorCamera->uNumPolygons];
-        pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
-        if ( pTile->uTileBitmapID != -1 )
-        {
-          pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(sX, sY);
-          pTile->field_32 = 0;
-          pTile->field_59 = 1;
-          pTile->terrain_grid_x = (char)v97;
-          __debugbreak(); // warning C4700: uninitialized local variable 'v93' used
-          pTile->field_34 = *(_WORD *)(v93 + 2);
-          pTile->terrain_grid_z = v89;
-          v22 = pTerrainNormalIndices[2 * (v97 + 128 * v89) + 1];
-          if ( v22 < 0 || v22 > uNumTerrainNormals - 1 )
-            norm = 0;
-          else
-            norm = &pTerrainNormals[v22];
-          thisf = 20.0 - ( -(((float)pOutdoor->vSunlight.x / 65536.0) * norm->x) -
-                            (((float)pOutdoor->vSunlight.y / 65536.0) * norm->y) -
-                            (((float)pOutdoor->vSunlight.z / 65536.0) * norm->z)) * 20.0;
-          //v25 = thisf + 6.7553994e15;
-          //v27 = pOutdoorCamera->uNumPolygons > 1999;
-          //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0;
-          pTile->dimming_level = floorf(thisf + 0.5f);
-          if ( pOutdoorCamera->uNumPolygons >= 1999 )
-            return;
-          ++pOutdoorCamera->uNumPolygons;
-          //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary
-          //goto LABEL_126;
-          //{
-            //--pOutdoorCamera->uNumPolygons;
-            //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;
-          __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;
-          /*if ( !(byte_76D5C0 & 1) )
-          {
-            byte_76D5C0 |= 1u;
-            stru154(stru_76D5A8);
-            atexit(loc_481199);
-          }*/
-          v32 = (struct8 *)array_50AC10;
-          v97 = (int)pGame->pLightmapBuilder;
-          pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &v95, array_50AC10, 4, 1);
-          pDecalBuilder->_49BE8A(pTile, norm, &v95, array_50AC10, 4, 1);
-          a5 = 4;
-          if ( byte_4D864C && pGame->uFlags & 0x80 )
-          {
-            thisa = pGame->pIndoorCameraD3D;
-            if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 )
-              goto LABEL_162;
-            thisa->ViewTransform(array_50AC10, a5);
-            thisa->Project(array_50AC10, a5, 0);
-          }
-          this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0
-              || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
-          v3a = (double)pOutdoorCamera->shading_dist_mist;
-          v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x
-              || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x;
-          v33 = 0;
-          pGame->pLightmapBuilder->std__vector_000004_size = 0;
-          if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
-          {
-            if ( this_3 )
-              v33 = 3;
-            else
-              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 )
-            pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33);
-          v34 = a5;
-          //v35 = byte_4D864C == 0;
-          pTile->uNumVertices = a5;
-          if ( !byte_4D864C || ~pGame->uFlags & 0x80 )
-          {
-            if ( this_3 )
-            {
-              v36 = sr_424CD7(v34);
-              pTile->uNumVertices = v36;
-              OutdoorCamera::Project(v36);
-            }
-            if ( v108 )
-            {
-              v36 = sr_424EE0_MakeFanFromTriangle(v34);
-              pTile->uNumVertices = v36;
-              OutdoorCamera::Project(v36);
-            }
-          }
-          //v37 = *(int *)&v16->flags;
-          if ( ~pTile->flags & 1 )
-          {
-            if ( pTile->flags & 2 && pTile->uTileBitmapID == pRenderer->hd_water_tile_id )
-            {
-              v80 = false;
-              v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
-            }
-            else
-            {
-              v39 = pTile->uTileBitmapID;
-              v80 = true;
-            }
-            //v79 = 0;
-            //v78 = pBitmaps_LOD->pHardwareTextures[v39];
-            pTile->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v39];// Ritor1: It's temporary
-            v77 = (int)pTile;
-            //v76 = v16->uNumVertices;
-//LABEL_161:
-            pRenderer->DrawTerrainPolygon(pTile->uNumVertices, pTile, pBitmaps_LOD->pHardwareTextures[v39], false, v80);
-            goto LABEL_162;
-          }
-LABEL_56:
-          pTile->DrawBorderTiles();
-        }
-LABEL_162:
-        v4 = v88 + 1;
-        if ( ++v88 >= v84 )
-          return;
-      }
-    /*  v40 = &array_77EC08[pOutdoorCamera->uNumPolygons];
-      v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
-      if ( v40->uTileBitmapID == -1 )
-        goto LABEL_162;
-      v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY);
-      BYTE1(v42) |= 0x80u;
-      v43 = pGame->pLightmapBuilder;
-      *(int *)&v40->flags = v42;
-      v44 = v93;
-      v40->field_59 = 1;
-      v40->terrain_grid_x = (char)v43;
-      v40->field_34 = *(_WORD *)(v44 + 2);
-      v45 = v89;
-      v40->terrain_grid_z = v89;
-      v46 = 4 * ((char)v43 + (v45 << 7));
-      v85 = v46;
-      v47 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v46 + 2);//    v47 = pTerrainNormalIndices[v46 + 1];
-      if ( v47 < 0 || v47 > (signed int)(uNumTerrainNormals - 1) )
-        v48 = 0;
-      else
-        v48 = &pTerrainNormals[v47];
-      v49 = v92 * v48->y;
-      //v99 = v48;
-      thisg = 20.0 - (-v49 - v91 * v48->z - v90 * v48->x) * 20.0;
-      v50 = thisg + 6.755399441055744e15;
-      v40->dimming_level = LOBYTE(v50);
-      if ( LOBYTE(v50) < 0 )
-        v40->dimming_level = 0;
-      if ( pOutdoorCamera->uNumPolygons >= 1999 )
-        return;
-      ++pOutdoorCamera->uNumPolygons;
-      /*if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary
-        //goto LABEL_77;
-        {
-          --pOutdoorCamera->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;
-      static stru154 static_sub_0048034E_stru_76D590;
-      /*static bool __init_flag2 = false;
-      if (!__init_flag2)
-      {
-        __init_flag2 = true;
-        stru154::stru154(&static_sub_0048034E_stru_76D590);
-      }*/
-      /*if ( !(byte_76D5C0 & 2) )
-      {
-        byte_76D5C0 |= 2;
-        Polygon(stru_76D590);
-        atexit(loc_48118F);
-      }*/
-      /*v96 = pGame->pLightmapBuilder;
-      pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0);
-      pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0);
-      uNumVertices = 3;
-      if ( byte_4D864C && pGame->uFlags & 0x80 )
-      {
-        thisb = pGame->pIndoorCameraD3D;
-        if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices )
-        {
-//LABEL_77:
-          --pOutdoorCamera->uNumPolygons;
-          goto LABEL_112;
-        }
-        thisb->ViewTransform(array_50AC10, uNumVertices);
-        thisb->Project(array_50AC10, uNumVertices, 0);
-      }
-      this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
-      v54 = (double)pOutdoorCamera->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 )
-      {
-        if ( this_3a )
-          pVertices = (RenderVertexSoft *)3;
-        else
-          pVertices = (RenderVertexSoft *)(v108 != 0 ? 5 : 0);
-        //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);
-      v55 = uNumVertices;
-      //v35 = byte_4D864C == 0;
-      v40->uNumVertices = uNumVertices;
-      if ( !byte_76D5C0 || !(pGame->uFlags & 0x80) )
-      {
-        if ( this_3a )
-        {
-          v56 = sr_424CD7(v55);
-        }
-        else
-        {
-          if ( !v108 )
-            goto LABEL_105;
-          v56 = sr_424EE0_MakeFanFromTriangle(v55);
-        }
-        v40->uNumVertices = v56;
-        OutdoorCamera::Project(v56);
-      }
-LABEL_105:
-      v57 = *(int *)&v40->flags;
-      if ( BYTE1(v57) & 1 )
-      {
-        v40->DrawBorderTiles();
-      }
-      else
-      {
-        if ( v57 & 2 && v40->uTileBitmapID == pRenderer->hd_water_tile_id )
-        {
-          v81 = false;
-          v58 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
-        }
-        else
-        {
-          v58 = v40->uTileBitmapID;
-          v81 = true;
-        }
-        pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81);
-      }
-LABEL_112:
-      v59 = &array_77EC08[pOutdoorCamera->uNumPolygons];
-      //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->uNumPolygons];
-      v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
-      if ( v59->uTileBitmapID  == -1 )
-        goto LABEL_162;
-      *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY);
-      v61 = v93;
-      v59->field_59 = 1;
-      v59->field_34 = *(_WORD *)(v61 + 2);
-      v59->terrain_grid_z = v89;
-      v59->terrain_grid_x = v97;
-      v62 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v85);
-      if ( v62 > (signed int)(uNumTerrainNormals - 1) )
-        v63 = 0;
-      else
-        v63 = &pTerrainNormals[v62];
-      v64 = v92 * v63->y;
-      //v99 = v63;
-      thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0;
-      v59->dimming_level = floorf(thish + 0.5f);
-      if ( v59->dimming_level < 0 )
-        v59->dimming_level = 0;
-      if ( pOutdoorCamera->uNumPolygons >= 1999 )
-        return;
-      ++pOutdoorCamera->uNumPolygons;
-      if ( !_481FC9_terrain(v101, v102, pVertices2, v59) )
-      {
-//LABEL_126:
-        --pOutdoorCamera->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;
-      static stru154 static_sub_0048034E_stru_76D578;
-      /*static bool __init_flag1 = false;
-      if (!__init_flag1)
-      {
-        __init_flag1 = true;
-        stru154::stru154(&static_sub_0048034E_stru_76D578);
-      }*/
-     /* v96 = pGame->pLightmapBuilder;
-      pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1);
-      pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1);
-      v100 = 3;
-      if ( byte_4D864C && pGame->uFlags & 0x80 )
-      {
-        thisc = pGame->pIndoorCameraD3D;
-        if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 )
-          //goto LABEL_126;
-        {
-          --pOutdoorCamera->uNumPolygons;
-          goto LABEL_162;
-        }
-        thisc->ViewTransform(array_50AC10, v100);
-        thisc->Project(array_50AC10, v100, 0);
-      }
-      this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0
-           || v101->vWorldViewPosition.x < 8.0;
-      v69 = (double)pOutdoorCamera->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 )
-      {
-        if ( this_3b )
-          v70 = 3;
-        else
-          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);
-      v71 = v59;
-      v72 = v100;
-      //v35 = byte_4D864C == 0;
-      v59->uNumVertices = v100;//???
-      if ( !byte_4D864C && pGame->uFlags & 0x80 )
-        goto LABEL_154;
-      if ( this_3b )
-      {
-        v73 = sr_424CD7(v72);
-      }
-      else
-      {
-        if ( !v108 )
-        {
-LABEL_154:
-          v74 = v71->flags;
-          if ( !(BYTE1(v74) & 1) )
-          {
-            if ( v74 & 2 && v71->uTileBitmapID == pRenderer->hd_water_tile_id )
-            {
-              v80 = false;
-              v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
-            }
-            else
-            {
-              v75 = v71->uTileBitmapID;
-              v80 = true;
-            }
-            //v79 = 0;
-            v78 = pBitmaps_LOD->pHardwareTextures[v75];
-            v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary
-            //v77 = (int)v71;
-            //v76 = v71->uNumVertices;
-            //goto LABEL_161;
-            pRenderer->DrawTerrainPolygon(v71->uNumVertices, (Polygon *)v71, v78, 0, v80);
-            goto LABEL_162;
-          }
-          v38 = (Polygon *)v71;
-          goto LABEL_56;
-        }
-        v73 = sr_424EE0_MakeFanFromTriangle(v72);
-      }
-      v71->uNumVertices = v73;
-      OutdoorCamera::Project(v73);
-      goto LABEL_154;
-    }
-  }*/
 
 
 //----- (0047BACF) --------------------------------------------------------