diff Render.cpp @ 1390:613c77e51e38

Messed with spell effects drawing a bit.
author Nomad
date Thu, 18 Jul 2013 04:08:20 +0200
parents 65379a50e4eb
children cc9a3a24d61d
line wrap: on
line diff
--- a/Render.cpp	Wed Jul 17 00:40:15 2013 +0200
+++ b/Render.cpp	Thu Jul 18 04:08:20 2013 +0200
@@ -3715,9 +3715,9 @@
           local_0.x = v3;
           local_0.y = (double)*(signed int *)v0;
           local_0.z = (double)*((signed int *)v0 + 1);
-          local_0.flt_10 = 0.0;
-          local_0.flt_14 = 0.0;
-          local_0.flt_18 = 0.0;
+          local_0.r = 0.0;
+          local_0.g = 0.0;
+          local_0.b = 0.0;
           local_0.flt_28 = 1.0;
           local_0.timeToLive = (rand() & 0x80) + 128;
           local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
@@ -7079,10 +7079,7 @@
       pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0);
       pRenderer->uNumBillboardsToDraw = 0;
       pRenderD3D->pDevice->BeginScene();
-      if (!pRenderD3D->DoesRaiseExceptions())
-      {
-        MessageBoxW(nullptr, L"Error executing scratch 3D operations", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\screen16_3d.cpp:360", 0);
-      }
+
       if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
         uFogColor = GetLevelFogColor();
       else
@@ -7569,6 +7566,433 @@
   }
 }
 
+
+//----- (00479A53) --------------------------------------------------------
+void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID)
+{
+  BLVFace *pFace; // esi@1
+  unsigned int v3; // edi@1
+  PolygonType v4; // al@1
+  double v5; // st7@3
+  signed __int64 v6; // qax@3
+  PolygonType v7; // cl@3
+  int v8; // esi@7
+  int v9; // eax@7
+  unsigned int v10; // eax@7
+  double v11; // st6@7
+  int v12; // edx@7
+  int v13; // eax@7
+  char *v14; // esi@8
+  void *v15; // ecx@9
+  int v16; // eax@9
+  int v17; // edi@9
+  double v18; // st7@9
+  signed int v19; // ebx@9
+  void *v20; // ecx@9
+  int v21; // ebx@11
+  int v22; // eax@14
+  signed __int64 v23; // qtt@16
+  double v24; // st7@16
+  unsigned __int8 v25; // sf@16
+  unsigned __int8 v26; // of@16
+  Render *v27; // ecx@17
+  double v28; // st7@20
+  char *v29; // ebx@20
+  char *v30; // edx@20
+  unsigned __int8 v31; // c0@21
+  unsigned __int8 v32; // c3@21
+  double v33; // st6@23
+  char *v34; // esi@30
+  const void *v35; // ecx@31
+  int v36; // eax@31
+  const void *v37; // edi@31
+  signed __int64 v38; // qax@31
+  int v39; // ecx@31
+  int v40; // ebx@33
+  int v41; // eax@36
+  signed __int64 v42; // qtt@39
+  int v43; // eax@39
+  char v44; // zf@39
+  double v45; // st7@39
+  double v46; // st7@39
+  unsigned int v47; // edx@40
+  double v48; // st7@41
+  RenderVertexSoft *v49; // ebx@41
+  void *v50; // edi@43
+  double v51; // st7@46
+  RenderVertexSoft *v52; // edx@46
+  void *v53; // edi@48
+  char *v54; // ebx@52
+  unsigned int v55; // eax@53
+  unsigned int v56; // eax@55
+  int v57; // ST10_4@55
+  Texture *v58; // eax@55
+  signed int v59; // [sp-4h] [bp-178h]@17
+  stru148 *v60; // [sp+0h] [bp-174h]@17
+  IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
+  stru148 v62; // [sp+14h] [bp-160h]@6
+  unsigned int v63; // [sp+120h] [bp-54h]@7
+  double v64; // [sp+124h] [bp-50h]@7
+  unsigned int v65; // [sp+128h] [bp-4Ch]@1
+  unsigned int v66; // [sp+12Ch] [bp-48h]@7
+  float v67; // [sp+130h] [bp-44h]@7
+  __int64 v68; // [sp+134h] [bp-40h]@3
+  __int64 v69; // [sp+13Ch] [bp-38h]@3
+  int v70; // [sp+144h] [bp-30h]@3
+  int X; // [sp+148h] [bp-2Ch]@9
+  int v72; // [sp+14Ch] [bp-28h]@7
+  float v73; // [sp+150h] [bp-24h]@16
+  unsigned int v74; // [sp+154h] [bp-20h]@3
+  RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3
+  float v76; // [sp+15Ch] [bp-18h]@9
+  int v77; // [sp+160h] [bp-14h]@9
+  int v78; // [sp+164h] [bp-10h]@7
+  void *v79; // [sp+168h] [bp-Ch]@9
+  float v80; // [sp+16Ch] [bp-8h]@3
+  const void *v81; // [sp+170h] [bp-4h]@7
+
+  __debugbreak();
+
+  pFace = &pIndoor->pFaces[uFaceID];
+  v65 = uFaceID;
+  v3 = uNumVertices;
+  v4 = pFace->uPolygonType;
+  if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor )
+  {
+    if ( (signed int)uNumVertices > 0 )
+    {
+      v54 = (char *)&array_507D30[0].u;
+      LODWORD(v80) = uNumVertices;
+      do
+      {
+        v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x;
+        *(float *)v54 = (double)v69 + *(float *)v54;
+        *(float *)v54 = *(float *)v54 * 0.25;
+        v55 = GetTickCount();
+        v54 += 48;
+        v44 = LODWORD(v80)-- == 1;
+        v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5);
+        *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25;
+      }
+      while ( !v44 );
+      uFaceID = v65;
+    }
+    v56 = 8 * uFaceID;
+    LOBYTE(v56) = PID(OBJECT_BModel,uFaceID);
+    v57 = v56;
+    v58 = pFace->GetTexture();
+    pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0);
+    return;
+  }
+  HIDWORD(v69) = pIndoorCamera->sRotationX;
+  HIDWORD(v68) = pIndoorCamera->pos.z;
+  *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
+  v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z)
+                       / (((double)pBLVRenderParams->field_40 + 16192.0)
+                        * 65536.0)
+                       + *(float *)&v74);
+  v5 = (double)pIndoorCamera->sRotationX * 0.0030664064;
+  *(float *)&v75 = v5;
+  v80 = cos(v5) * 16192.0;
+  v6 = (signed __int64)(*(float *)&v74
+                      - (double)pBLVRenderParams->field_40
+                      / ((v80 + 0.0000001)
+                       * 65535.0)
+                      * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68)));
+  v7 = pFace->uPolygonType;
+  if ( v7 == 4 || v7 == 3 )
+    v70 = v6;
+  stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0);
+  v62._48607B(&stru_8019C8);
+  v62.uTileBitmapID = pFace->uBitmapID;
+  v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0);
+  if ( !v62.pTexture )
+    return;
+  v8 = pBLVRenderParams->sPartyRotX;
+  v62.dimming_level = 0;
+  v62.uNumVertices = v3;
+  v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16);
+  v62.v_18.y = 0;
+  v62.v_18.x = -v9;
+  v62.v_18.z = -stru_5C6E00->Cos(v8 + 16);
+  v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX;
+  memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3]));
+  LODWORD(v80) = v10;
+  v62.field_24 = 33554432;
+  v64 = (double)(signed int)v10 * 0.5;
+  v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5);
+  LODWORD(v80) = v62.pTexture->uTextureWidth;
+  v11 = 1.0 / (double)SLODWORD(v80);
+  LODWORD(v80) = v62.pTexture->uTextureHeight;
+  v12 = v62.pTexture->uWidthMinus1;
+  v13 = v62.pTexture->uHeightMinus1;
+  v67 = v11;
+  v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13;
+  v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12;
+  v78 = 0;
+  v81 = 0;
+  *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80);
+  if ( (signed int)v62.uNumVertices <= 0 )
+  {
+LABEL_17:
+    v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID];
+    v27 = pRenderer;
+    v60 = &v62;
+    v59 = v62.uNumVertices;
+    goto LABEL_18;
+  }
+  v14 = (char *)&array_507D30[0].vWorldViewProjY;
+  while ( 2 )
+  {
+    v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14));
+    LODWORD(v80) = v62.ptr_38->field_14;
+    v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16;
+    v16 = v77 + v62.ptr_38->field_C;
+    v77 = (int)v15;
+    v74 = v16;
+    LODWORD(v80) = v62.ptr_38->field_20;
+    v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16;
+    v79 = v15;
+    v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18);
+    LODWORD(v80) = v62.v_18.z;
+    v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16);
+    v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1));
+    v18 = *(float *)v14 - 1.0;
+    v19 = -v62.field_24;
+    v77 = -v62.field_24;
+    X = (int)((char *)v79 + v62.v_18.x);
+    LODWORD(v76) = (signed __int64)v18;
+    v20 = (void *)(v72 * (v70 - LODWORD(v76)));
+    while ( 1 )
+    {
+      v79 = v20;
+      if ( !X )
+        goto LABEL_14;
+      v21 = abs(v19 >> 14);
+      if ( v21 <= abs(X) )
+        break;
+      if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
+        break;
+      v19 = v77;
+      v20 = v79;
+LABEL_14:
+      LODWORD(v80) = v62.v_18.z;
+      v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16);
+      v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16;
+      --LODWORD(v76);
+      v20 = (char *)v20 + v72;
+      X = v22 + v62.v_18.x;
+      v78 = 1;
+    }
+    if ( !v78 )
+    {
+      LODWORD(v23) = v77 << 16;
+      HIDWORD(v23) = v77 >> 16;
+      v79 = (void *)(v23 / X);
+      v77 = v17;
+      LODWORD(v80) = v62.ptr_38->field_10;
+      v77 = v17;
+      LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16);
+      LODWORD(v80) = v62.ptr_38->field_1C;
+      v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16));
+      v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16;
+      LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16;
+      v14 += 48;
+      LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4);
+      v81 = (char *)v81 + 1;
+      v24 = (double)SLODWORD(v80) * 0.000015259022;
+      LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4);
+      v26 = __OFSUB__((int)v81, v62.uNumVertices);
+      v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0;
+      *((float *)v14 - 10) = v24 * v67;
+      *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1);
+      *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79;
+      if ( !(v25 ^ v26) )
+        goto LABEL_17;
+      continue;
+    }
+    break;
+  }
+  LODWORD(v73) = 0;
+  v80 = v76;
+  if ( (signed int)v62.uNumVertices > 0 )
+  {
+    v28 = (double)SLODWORD(v76);
+    LODWORD(v76) = (int)(char *)array_50AC10 + 28;
+    v29 = (char *)&array_50AC10[0].vWorldViewProjX;
+    v30 = (char *)&array_507D30[1].vWorldViewProjY;
+    v79 = array_50AC10;
+    v81 = array_507D30;
+    v78 = v62.uNumVertices;
+    do
+    {
+      v31 = v28 < *((float *)v30 - 12);
+      v32 = v28 == *((float *)v30 - 12);
+      ++LODWORD(v73);
+      memcpy(v79, v81, 0x30u);
+      v79 = (char *)v79 + 48;
+      LODWORD(v76) += 48;
+      v29 += 48;
+      if ( v31 | v32 || v28 >= *(float *)v30 )
+      {
+        if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 )
+          goto LABEL_28;
+        v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12))
+            + *((float *)v30 - 1);
+      }
+      else
+      {
+        v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30)
+            + *((float *)v30 - 13);
+      }
+      *(float *)v29 = v33;
+      v79 = (char *)v79 + 48;
+      v29 += 48;
+      ++LODWORD(v73);
+      *(unsigned int *)LODWORD(v76) = v28;
+      LODWORD(v76) += 48;
+LABEL_28:
+      v81 = (char *)v81 + 48;
+      v30 += 48;
+      --v78;
+    }
+    while ( v78 );
+  }
+  if ( SLODWORD(v73) <= 0 )
+    goto LABEL_40;
+  v34 = (char *)&array_50AC10[0].vWorldViewProjY;
+  v65 = v77 >> 14;
+  HIDWORD(v69) = LODWORD(v73);
+  do
+  {
+    v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34));
+    v78 = v62.ptr_38->field_14;
+    v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
+    v36 = (int)((char *)v81 + v62.ptr_38->field_C);
+    v81 = v35;
+    v74 = v36;
+    v78 = v62.ptr_38->field_20;
+    v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
+    v78 = (int)v35;
+    v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18);
+    v81 = (const void *)v62.v_18.z;
+    v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16;
+    v37 = (const void *)(v72
+                       * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1)));
+    v38 = (signed __int64)(*(float *)v34 - 1.0);
+    v81 = 0;
+    LODWORD(v76) = v38;
+    v39 = v72 * (v70 - v38);
+    while ( 1 )
+    {
+      v78 = v39;
+      if ( !X )
+        goto LABEL_36;
+      v40 = abs(X);
+      if ( abs((signed __int64)v65) <= v40 )
+        break;
+      if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
+        break;
+      v39 = v78;
+LABEL_36:
+      v78 = v62.v_18.z;
+      v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16;
+      --LODWORD(v76);
+      v39 += v72;
+      X = v41 + v62.v_18.x;
+      v81 = (const void *)1;
+    }
+    if ( v81 )
+    {
+      v79 = (void *)v62.v_18.z;
+      v78 = 2 * LODWORD(v76);
+      v81 = (const void *)((unsigned __int64)(v62.v_18.z
+                                            * (signed __int64)(signed int)(signed __int64)(((double)v70
+                                                                                          - ((double)(2 * LODWORD(v76))
+                                                                                           - *(float *)v34))
+                                                                                         * (double)v72)) >> 16);
+      X = (int)((char *)v81 + v62.v_18.x);
+    }
+    LODWORD(v42) = v77 << 16;
+    HIDWORD(v42) = v77 >> 16;
+    v79 = (void *)(v42 / X);
+    v81 = v37;
+    v78 = v62.ptr_38->field_10;
+    v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
+    v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
+    v74 = (unsigned int)v37;
+    LODWORD(v76) = v43;
+    v78 = v62.ptr_38->field_1C;
+    v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16));
+    v74 = (unsigned __int64)(v43 * v42 / X) >> 16;
+    v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16);
+    v34 += 48;
+    v78 = v66 + ((signed int)v74 >> 4);
+    v44 = HIDWORD(v69)-- == 1;
+    v45 = (double)v78 * 0.000015259022;
+    v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4);
+    *((float *)v34 - 10) = v45 * v67;
+    *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1);
+    v46 = (double)(signed int)v79;
+    *((float *)v34 - 16) = 0.000015258789 * v46;
+    *((float *)v34 - 11) = 65536.0 / v46;
+  }
+  while ( !v44 );
+LABEL_40:
+  v47 = 0;
+  if ( SLODWORD(v73) > 0 )
+  {
+    v48 = (double)SLODWORD(v80);
+    v75 = array_507D30;
+    v49 = array_50AC10;
+    HIDWORD(v69) = LODWORD(v73);
+    do
+    {
+      if ( v48 >= v49->vWorldViewProjY )
+      {
+        v50 = v75;
+        ++v47;
+        ++v75;
+        memcpy(v50, v49, 0x30u);
+      }
+      ++v49;
+      --HIDWORD(v69);
+    }
+    while ( HIDWORD(v69) );
+  }
+  v62.uNumVertices = v47;
+  pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]);
+  *(float *)&v74 = 0.0;
+  if ( SLODWORD(v73) > 0 )
+  {
+    v51 = (double)SLODWORD(v80);
+    v75 = array_507D30;
+    v52 = array_50AC10;
+    v80 = v73;
+    do
+    {
+      if ( v51 <= v52->vWorldViewProjY )
+      {
+        v53 = v75;
+        ++v74;
+        ++v75;
+        memcpy(v53, v52, 0x30u);
+      }
+      ++v52;
+      --LODWORD(v80);
+    }
+    while ( v80 != 0.0 );
+  }
+  v62.uNumVertices = v74;
+  v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID];
+  v60 = &v62;
+  v59 = v74;
+  v27 = pRenderer;
+LABEL_18:
+  v27->_4A2ED5(v59, v60, v61);
+}
+
+
 //----- (004A2FC0) --------------------------------------------------------
 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8)
 {
@@ -7841,54 +8265,54 @@
       v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0);
     }
     //v13 = (double)v25;
-    pBillboardRenderListD3D[v7].pQuards[0].specular = 0;
-    pBillboardRenderListD3D[v7].pQuards[0].diffuse = v12;
-    pBillboardRenderListD3D[v7].pQuards[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1;
+    pBillboardRenderListD3D[v7].pQuads[0].specular = 0;
+    pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1;
     //v14 = (double)v24;
     //v32 = v14;
-    pBillboardRenderListD3D[v7].pQuards[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29;
+    pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29;
     v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894);
-    pBillboardRenderListD3D[v7].pQuards[0].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15;
     v16 = 1.0 / pSoftBillboard->zbuffer_depth;
-    pBillboardRenderListD3D[v7].pQuards[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth;
-    pBillboardRenderListD3D[v7].pQuards[0].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v7].pQuards[0].texcoord.y = 0.0;
+    pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth;
+    pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0;
     v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX);
     v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight);
     if ( pSoftBillboard->uFlags & 4 )
       v17 = v17 * -1.0;
-    pBillboardRenderListD3D[v7].pQuards[1].specular = 0;
-    pBillboardRenderListD3D[v7].pQuards[1].diffuse = v12;
-    pBillboardRenderListD3D[v7].pQuards[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1;
-    pBillboardRenderListD3D[v7].pQuards[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29;
-    pBillboardRenderListD3D[v7].pQuards[1].pos.z = v15;
-    pBillboardRenderListD3D[v7].pQuards[1].rhw = v16;
-    pBillboardRenderListD3D[v7].pQuards[1].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v7].pQuards[1].texcoord.y = 1.0;
+    pBillboardRenderListD3D[v7].pQuads[1].specular = 0;
+    pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1;
+    pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29;
+    pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuads[1].rhw = v16;
+    pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0;
     v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight;
     v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth);
     if ( pSoftBillboard->uFlags & 4 )
       v20 = v20 * -1.0;
-    pBillboardRenderListD3D[v7].pQuards[2].specular = 0;
-    pBillboardRenderListD3D[v7].pQuards[2].diffuse = v12;
-    pBillboardRenderListD3D[v7].pQuards[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX;
-    pBillboardRenderListD3D[v7].pQuards[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29;
-    pBillboardRenderListD3D[v7].pQuards[2].pos.z = v15;
-    pBillboardRenderListD3D[v7].pQuards[2].rhw = v16;
-    pBillboardRenderListD3D[v7].pQuards[2].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v7].pQuards[2].texcoord.y = 1.0;
+    pBillboardRenderListD3D[v7].pQuads[2].specular = 0;
+    pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX;
+    pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29;
+    pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuads[2].rhw = v16;
+    pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0;
     v21 = pSprite->uBufferHeight - pSprite->uAreaY;
     v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth);
     if ( pSoftBillboard->uFlags & 4 )
       v22 = v22 * -1.0;
-    pBillboardRenderListD3D[v7].pQuards[3].specular = 0;
-    pBillboardRenderListD3D[v7].pQuards[3].diffuse = v12;
-    pBillboardRenderListD3D[v7].pQuards[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX;
-    pBillboardRenderListD3D[v7].pQuards[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29;
-    pBillboardRenderListD3D[v7].pQuards[3].pos.z = v15;
-    pBillboardRenderListD3D[v7].pQuards[3].rhw = v16;
-    pBillboardRenderListD3D[v7].pQuards[3].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v7].pQuards[3].texcoord.y = 0.0;
+    pBillboardRenderListD3D[v7].pQuads[3].specular = 0;
+    pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12;
+    pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX;
+    pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29;
+    pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15;
+    pBillboardRenderListD3D[v7].pQuads[3].rhw = v16;
+    pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0;
     //v23 = pSprite->pTexture;
     pBillboardRenderListD3D[v7].uNumVertices = 4;
     pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth;
@@ -7967,7 +8391,7 @@
       v19 = stru_5C6E00->Sin(angle);
       v20 = stru_5C6E00->Sin(angle);
       v21 = stru_5C6E00->Cos(angle);
-      pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022
+      pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022
                                                        + (double)(v18 >> 16))
                                                        * v16
                                                        - ((double)(unsigned __int16)v19 * 0.000015259022
@@ -7979,20 +8403,20 @@
            - 12.0)
           * v11
           + (double)a2->uScreenSpaceY;
-      pBillboardRenderListD3D[v8].pQuards[0].specular = 0;
-      pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse;
-      pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22;
-      pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894);
-      pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth;
-      pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0;
-      pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0;
+      pBillboardRenderListD3D[v8].pQuads[0].specular = 0;
+      pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse;
+      pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22;
+      pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894);
+      pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth;
+      pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0;
+      pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0;
       v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX;
       v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12);
       v25 = stru_5C6E00->Cos(angle);
       v26 = stru_5C6E00->Sin(angle);
       v27 = stru_5C6E00->Sin(angle);
       v28 = stru_5C6E00->Cos(angle);
-      pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022
+      pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022
                                                        + (double)(v25 >> 16))
                                                        * v31
                                                        - ((double)(unsigned __int16)v26 * 0.000015259022
@@ -8004,47 +8428,47 @@
            - 12.0)
           * v11
           + (double)a2->uScreenSpaceY;
-      pBillboardRenderListD3D[v8].pQuards[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuards[0].pos.z;
-      v30 = pBillboardRenderListD3D[v8].pQuards[0].rhw;
-      pBillboardRenderListD3D[v8].pQuards[1].pos.y = v29;
-      pBillboardRenderListD3D[v8].pQuards[1].specular = 0;
-      pBillboardRenderListD3D[v8].pQuards[1].rhw = v30;
-      pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse;
-      pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0;
-      pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0;
+      pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z;
+      v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw;
+      pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29;
+      pBillboardRenderListD3D[v8].pQuads[1].specular = 0;
+      pBillboardRenderListD3D[v8].pQuads[1].rhw = v30;
+      pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse;
+      pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0;
+      pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0;
       v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX;
       v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12);
       v33 = stru_5C6E00->Cos(angle);
       v34 = stru_5C6E00->Sin(angle);
       v35 = stru_5C6E00->Sin(angle);
       v36 = stru_5C6E00->Cos(angle);
-      pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022
+      pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022
                                                         + (double)(v33 >> 16))
                                                         * v23
                                                         - ((double)(unsigned __int16)v34 * 0.000015259022
                                                         + (double)(v34 >> 16))
                                                         * v24)
                                                         * v11 + (double) a2->uScreenSpaceX;
-      v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z;
+      v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z;
       v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24
            + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23
            - 12.0)
           * v11
           + (double)a2->uScreenSpaceY;
-      pBillboardRenderListD3D[v8].pQuards[2].specular = 0;
-      pBillboardRenderListD3D[v8].pQuards[2].pos.z = v37;
-      pBillboardRenderListD3D[v8].pQuards[2].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw;
-      pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse;
-      pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38;
-      pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0;
-      pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0;
+      pBillboardRenderListD3D[v8].pQuads[2].specular = 0;
+      pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37;
+      pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw;
+      pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse;
+      pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38;
+      pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0;
+      pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0;
       v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX;
       v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12);
       v41 = stru_5C6E00->Cos(angle);
       v42 = stru_5C6E00->Sin(angle);
       v43 = stru_5C6E00->Sin(angle);
       v44 = stru_5C6E00->Cos(angle);
-      pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022
+      pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022
                                                         + (double)(v41 >> 16))
                                                         * v39
                                                         - ((double)(unsigned __int16)v42 * 0.000015259022
@@ -8056,17 +8480,17 @@
            - 12.0)
           * v11
           + (double)a2->uScreenSpaceY;
-      v46 = pBillboardRenderListD3D[v8].pQuards[0].pos.z;
-      pBillboardRenderListD3D[v8].pQuards[3].specular = 0;
-      pBillboardRenderListD3D[v8].pQuards[3].pos.z = v46;
-      pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw;
-      pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse;
+      v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z;
+      pBillboardRenderListD3D[v8].pQuads[3].specular = 0;
+      pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46;
+      pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw;
+      pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse;
       pBillboardRenderListD3D[v8].pTexture = a3;
       pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth;
       pBillboardRenderListD3D[v8].uNumVertices = 4;
-      pBillboardRenderListD3D[v8].pQuards[3].pos.y = v45;
-      pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0;
-      pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0;
+      pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45;
+      pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0;
+      pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0;
     }
   }
 }
@@ -8141,7 +8565,7 @@
     v20 = stru_5C6E00->Sin(angle);
     v21 = stru_5C6E00->Sin(angle);
     v22 = stru_5C6E00->Cos(angle);
-    pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022
+    pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022
                                                     + (double)(v18 >> 16))
                                                     * v16
                                                     - ((double)(unsigned __int16)v20 * 0.000015259022
@@ -8153,22 +8577,22 @@
          - 12.0)
         * v11
         + (double)a2->uScreenSpaceY;
-    pBillboardRenderListD3D[v8].pQuards[0].specular = 0;
-    pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse;
-    pBillboardRenderListD3D[v8].pQuards[0].pos.y = v23;
+    pBillboardRenderListD3D[v8].pQuads[0].specular = 0;
+    pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse;
+    pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23;
     v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
-    pBillboardRenderListD3D[v8].pQuards[0].pos.z = v24;
+    pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24;
     v25 = 1.0 / v6;
-    pBillboardRenderListD3D[v8].pQuards[0].rhw = v25;
-    pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0;
+    pBillboardRenderListD3D[v8].pQuads[0].rhw = v25;
+    pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0;
     v26 = (double)(a2->uScreenSpaceX - 12) - v13;
     v27 = (double)a2->uScreenSpaceY - v15;
     v28 = stru_5C6E00->Cos(angle);
     v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
     v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
     v31 = stru_5C6E00->Cos(angle);
-    pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022
+    pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022
                                                      + (double)(v28 >> 16))
                                                      * v26
                                                      - ((double)(unsigned __int16)v29 * 0.000015259022
@@ -8180,20 +8604,20 @@
          - 12.0)
         * v11
         + (double)a2->uScreenSpaceY;
-    pBillboardRenderListD3D[v8].pQuards[1].pos.z = v24;
-    pBillboardRenderListD3D[v8].pQuards[1].pos.y = v32;
-    pBillboardRenderListD3D[v8].pQuards[1].specular = 0;
-    pBillboardRenderListD3D[v8].pQuards[1].rhw = v25;
-    pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse;
-    pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24;
+    pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32;
+    pBillboardRenderListD3D[v8].pQuads[1].specular = 0;
+    pBillboardRenderListD3D[v8].pQuads[1].rhw = v25;
+    pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse;
+    pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0;
     v33 = (double)(a2->uScreenSpaceX + 12) - v13;
     v34 = (double)a2->uScreenSpaceY - v15;
     v35 = stru_5C6E00->Cos(angle);
     v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
     v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
     v38 = stru_5C6E00->Cos(angle);
-    pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022
+    pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022
                                                      + (double)(v35 >> 16))
                                                      * v33
                                                      - ((double)(unsigned __int16)v36 * 0.000015259022
@@ -8205,20 +8629,20 @@
          - 12.0)
         * v11
         + (double)a2->uScreenSpaceY;
-    pBillboardRenderListD3D[v8].pQuards[2].specular = 0;
-    pBillboardRenderListD3D[v8].pQuards[2].pos.z = v24;
-    pBillboardRenderListD3D[v8].pQuards[2].rhw = v25;
-    pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse;
-    pBillboardRenderListD3D[v8].pQuards[2].pos.y = v39;
-    pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[2].specular = 0;
+    pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24;
+    pBillboardRenderListD3D[v8].pQuads[2].rhw = v25;
+    pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse;
+    pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39;
+    pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0;
     v40 = (double)(a2->uScreenSpaceX + 12) - v13;
     v41 = (double)(a2->uScreenSpaceY - 25) - v15;
     v42 = stru_5C6E00->Cos(angle);
     v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
     v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
     v45 = stru_5C6E00->Cos(angle);
-    pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022
+    pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022
                                                      + (double)(v42 >> 16))
                                                      * v40
                                                      - ((double)(unsigned __int16)v43 * 0.000015259022
@@ -8230,16 +8654,16 @@
          - 12.0)
         * v11
         + (double)a2->uScreenSpaceY;
-    pBillboardRenderListD3D[v8].pQuards[3].specular = 0;
-    pBillboardRenderListD3D[v8].pQuards[3].pos.z = v24;
-    pBillboardRenderListD3D[v8].pQuards[3].rhw = v25;
-    pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse;
+    pBillboardRenderListD3D[v8].pQuads[3].specular = 0;
+    pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24;
+    pBillboardRenderListD3D[v8].pQuads[3].rhw = v25;
+    pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse;
     pBillboardRenderListD3D[v8].pTexture = a3;
     pBillboardRenderListD3D[v8].z_order = v6;
     pBillboardRenderListD3D[v8].uNumVertices = 4;
-    pBillboardRenderListD3D[v8].pQuards[3].pos.y = v46;
-    pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0;
+    pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46;
+    pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0;
   }
 }
 
@@ -8287,53 +8711,53 @@
   v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY);
   if (a2->uFlags & 4)
     v14 *= -1.0;
-  pBillboardRenderListD3D[v8].pQuards[0].diffuse = diffuse;
-  pBillboardRenderListD3D[v8].pQuards[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30;
-  pBillboardRenderListD3D[v8].pQuards[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
-  pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
-  pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth;
-  pBillboardRenderListD3D[v8].pQuards[0].specular = specular;
-  pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0;
-  pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0;
+  pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse;
+  pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30;
+  pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
+  pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
+  pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth;
+  pBillboardRenderListD3D[v8].pQuads[0].specular = specular;
+  pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0;
+  pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0;
 
     v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX);
     v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY);
     if ( a2->uFlags & 4 )
       v14 = v14 * -1.0;
-    pBillboardRenderListD3D[v8].pQuards[1].specular = specular;
-    pBillboardRenderListD3D[v8].pQuards[1].diffuse = diffuse;
-    pBillboardRenderListD3D[v8].pQuards[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30;
-    pBillboardRenderListD3D[v8].pQuards[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
-    pBillboardRenderListD3D[v8].pQuards[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
-    pBillboardRenderListD3D[v8].pQuards[1].rhw = 1.0 / a2->zbuffer_depth;
-    pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0;
-    pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[1].specular = specular;
+    pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse;
+    pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30;
+    pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
+    pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
+    pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth;
+    pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0;
 
     v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth);
     v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY);
     if ( a2->uFlags & 4 )
       v14 *= -1.0;
-    pBillboardRenderListD3D[v8].pQuards[2].diffuse = diffuse;
-    pBillboardRenderListD3D[v8].pQuards[2].specular = specular;
-    pBillboardRenderListD3D[v8].pQuards[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30;
-    pBillboardRenderListD3D[v8].pQuards[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
-    pBillboardRenderListD3D[v8].pQuards[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
-    pBillboardRenderListD3D[v8].pQuards[2].rhw = 1.0 / a2->zbuffer_depth;
-    pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse;
+    pBillboardRenderListD3D[v8].pQuads[2].specular = specular;
+    pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30;
+    pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
+    pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
+    pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth;
+    pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0;
 
     v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth);
     v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY);
     if ( a2->uFlags & 4 )
       v14 *= -1.0;
-    pBillboardRenderListD3D[v8].pQuards[3].diffuse = diffuse;
-    pBillboardRenderListD3D[v8].pQuards[3].specular = specular;
-    pBillboardRenderListD3D[v8].pQuards[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30;
-    pBillboardRenderListD3D[v8].pQuards[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
-    pBillboardRenderListD3D[v8].pQuards[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
-    pBillboardRenderListD3D[v8].pQuards[3].rhw = 1.0 / a2->zbuffer_depth;
-    pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0;
-    pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0;
+    pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse;
+    pBillboardRenderListD3D[v8].pQuads[3].specular = specular;
+    pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30;
+    pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
+    pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
+    pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth;
+    pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0;
+    pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0;
 
   pBillboardRenderListD3D[v8].uNumVertices = 4;
   pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture;
@@ -8509,79 +8933,54 @@
 }
 
 //----- (004A4CC9) --------------------------------------------------------
-void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2)
-{
-  int v3; // eax@1
-  int v4; // edx@3
+void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse)
+{
   unsigned int v5; // eax@7
-  int v6; // edi@7
   char *v7; // edx@8
-  char *v8; // ecx@8
-  char v9; // zf@9
   double v10; // st6@9
   double v11; // st6@10
   int v12; // ebx@13
-  int v13; // ecx@16
-  unsigned int v14; // [sp+Ch] [bp-4h]@1
-
-  auto _this = this;
-
-  *(float *)&v14 = 1000000.0;
-  v3 = a1->field_10;
-  if ( v3 >= 3 )
-  {
-    if ( v3 > 0 )
-    {
-      _this = (Render *)&a1->field_14[62];
-      v4 = a1->field_10;
-      do
-      {
-        if ( *(float *)&this->bUserDirect3D < (double)*(float *)&v14 )
-          v14 = this->bUserDirect3D;
-        _this = (Render *)((char *)_this + 16);
-        --v4;
-      }
-      while ( v4 );
-    }
-    v5 = Billboard_ProbablyAddToListAndSortByZOrder(v14);
-    v6 = 0;
-    pBillboardRenderListD3D[v5].field_90 = 0;
-    pBillboardRenderListD3D[v5].uParentBillboardID = -1;
-    pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2;
-    if ( a1->field_10 > 0 )
-    {
-      v7 = (char *)&a1->field_14[62];
-      v8 = (char *)&pBillboardRenderListD3D[v5].pQuards[0].pos.z;
-      do
-      {
-        v9 = uCurrentlyLoadedLevelType == LEVEL_Indoor;
-        *((int *)v8 - 2) = *((int *)v7 - 2);
-        *((int *)v8 - 1) = *((int *)v7 - 1);
-        v10 = *(float *)v7;
-        if ( v9 )
-          v11 = v10 * 0.061758894;
-        else
-          v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
-        *(float *)v8 = 1.0 - 1.0 / v11;
-        *((float *)v8 + 1) = 1.0 / *(float *)v7;
-        if ( a2 & 0xFF000000 )
-          v12 = *((int *)v7 + 1);
-        else
-          v12 = a2;
-        *((int *)v8 + 3) = 0;
-        *((int *)v8 + 2) = v12;
-        ++v6;
-        v7 += 16;
-        *((float *)v8 + 4) = 0.0;
-        *((float *)v8 + 5) = 0.0;
-        v8 += 32;
-      }
-      while ( v6 < a1->field_10 );
-    }
-    v13 = a1->field_10;
-    pBillboardRenderListD3D[v5].pTexture = 0;
-    pBillboardRenderListD3D[v5].uNumVertices = v13;
-    LODWORD(pBillboardRenderListD3D[v5].z_order) = v14;
+
+  if (a1->uNumVertices < 3)
+    return;
+
+  float depth = 1000000.0;
+  for (uint i = 0; i < a1->uNumVertices; ++i)
+  {
+    if (a1->field_104[i].z < depth)
+      depth = a1->field_104[i * 4].z;
+  }
+
+  v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth);
+  pBillboardRenderListD3D[v5].field_90 = 0;
+  pBillboardRenderListD3D[v5].uParentBillboardID = -1;
+  pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2;
+  pBillboardRenderListD3D[v5].pTexture = 0;
+  pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
+  pBillboardRenderListD3D[v5].z_order = depth;
+
+  for (uint i = 0; i < a1->uNumVertices; ++i)
+  {
+    pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x;
+    pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y;
+
+    v10 = a1->field_104[i].z;
+    if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+      v11 = v10 * 0.061758894;
+    else
+      v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
+    pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11;
+    pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z;
+
+    if (diffuse & 0xFF000000)
+      v12 = a1->field_104[i].diffuse;
+    else
+      v12 = diffuse;
+    pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12;
+    pBillboardRenderListD3D[v5].pQuads[i].specular = 0;
+
+    pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0;
+    pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0;
   }
 }
 
@@ -10649,12 +11048,6 @@
 // 6BE364: using guessed type int dword_6BE364_game_settings_1;
 // A74C88: using guessed type int dword_A74C88;
 
-//----- (0044EC20) --------------------------------------------------------
-bool RenderD3D::DoesRaiseExceptions()
-{
-  return true;
-}
-
 
 //----- (004524D8) --------------------------------------------------------
 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps)
@@ -10881,20 +11274,20 @@
   auto p = &pRenderer->pBillboardRenderListD3D[0];
   for (int i = 0; i < p->uNumVertices; ++i)
   {
-    p->pQuards[i].pos.z -= p->pQuards[i].pos.z * 0.6;
-    //p->pQuards[i].rhw = + 0.8 * (1.0f - p->pQuards[i].rhw);
-  }
-  p->pQuards[0].pos.x = 10;
-  p->pQuards[0].pos.y = 10;
-
-  p->pQuards[1].pos.x = 10;
-  p->pQuards[1].pos.y = 200;
-
-  p->pQuards[2].pos.x = 100;
-  p->pQuards[2].pos.y = 200;
-
-  p->pQuards[3].pos.x = 100;
-  p->pQuards[3].pos.y = 10;
+    p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6;
+    //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw);
+  }
+  p->pQuads[0].pos.x = 10;
+  p->pQuads[0].pos.y = 10;
+
+  p->pQuads[1].pos.x = 10;
+  p->pQuads[1].pos.y = 200;
+
+  p->pQuads[2].pos.x = 100;
+  p->pQuads[2].pos.y = 200;
+
+  p->pQuads[3].pos.x = 100;
+  p->pQuads[3].pos.y = 10;
 
       if (p->uOpacity != RenderBillboardD3D::NoBlend)
       SetBillboardBlendOptions(p->uOpacity);
@@ -10902,7 +11295,7 @@
     pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture);
     ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                                          D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                                                         p->pQuards, p->uNumVertices,
+                                                         p->pQuads, p->uNumVertices,
                                                          D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS));
 
   }*/
@@ -10917,7 +11310,7 @@
     pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture);
     ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                                          D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                                                         p->pQuards, p->uNumVertices,
+                                                         p->pQuads, p->uNumVertices,
                                                          D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS));
   }
 
@@ -10987,3 +11380,11 @@
 {
   pRenderer->Present();
 }
+
+
+
+//----- (0044EC20) --------------------------------------------------------
+/*bool RenderD3D::DoesRaiseExceptions()
+{
+  return true;
+}*/
\ No newline at end of file