diff LightmapBuilder.cpp @ 1390:613c77e51e38

Messed with spell effects drawing a bit.
author Nomad
date Thu, 18 Jul 2013 04:08:20 +0200
parents 1803172dffd9
children cc9a3a24d61d
line wrap: on
line diff
--- a/LightmapBuilder.cpp	Wed Jul 17 00:40:15 2013 +0200
+++ b/LightmapBuilder.cpp	Thu Jul 18 04:08:20 2013 +0200
@@ -1,3 +1,5 @@
+#include <assert.h>
+
 #include "LightmapBuilder.h"
 #include "Game.h"
 #include "stru314.h"
@@ -1584,7 +1586,7 @@
 //----- (0045D74F) --------------------------------------------------------
 char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3)
 {
-  char v3; // zf@1
+  //char v3; // zf@1
   IDirect3DDevice3 *v4; // eax@2
   HRESULT v5; // eax@2
   //char *v6; // eax@2
@@ -1595,15 +1597,15 @@
   HRESULT v11; // eax@8
   HRESULT v12; // eax@8
   int *v13; // eax@8
-  float v14; // ecx@15
-  IDirect3DDevice3 *v15; // eax@21
-  HRESULT v16; // eax@21
-  IDirect3DDevice3 *v17; // eax@21
-  HRESULT v18; // eax@21
-  IDirect3DDevice3 *v19; // eax@21
-  HRESULT v20; // eax@21
-  IDirect3DDevice3 *v21; // eax@21
-  HRESULT v22; // eax@21
+  //float v14; // ecx@15
+  //IDirect3DDevice3 *v15; // eax@21
+  //HRESULT v16; // eax@21
+  //IDirect3DDevice3 *v17; // eax@21
+  //HRESULT v18; // eax@21
+  //IDirect3DDevice3 *v19; // eax@21
+  //HRESULT v20; // eax@21
+  //IDirect3DDevice3 *v21; // eax@21
+  //HRESULT v22; // eax@21
   //IDirect3DDevice3 *v23; // eax@23
   std::string v25; // [sp+44h] [bp-44h]@12
   signed int v26; // [sp+48h] [bp-40h]@21
@@ -1617,16 +1619,16 @@
   int v34; // [sp+74h] [bp-14h]@19
   int v35; // [sp+78h] [bp-10h]@2
   int *v36; // [sp+7Ch] [bp-Ch]@10
-  int a1; // [sp+80h] [bp-8h]@12
-  float v38; // [sp+84h] [bp-4h]@1
+  //int a1; // [sp+80h] [bp-8h]@12
+  //float v38; // [sp+84h] [bp-4h]@1
 
-  v3 = this->std__vector_000004_size == 0;
-  LODWORD(v38) = (int)this;
-  if ( !v3 )
-  {
+  if (std__vector_000004_size == 0)
+    return 1;
+
+  __debugbreak();
     //v30 = 0.0;
     //v4 = pRenderer->pRenderD3D->pDevice;
-    ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u));
+    ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3));
     //v6 = (char *)stru_69BD44.c_str();
     //if ( !stru_69BD44.c_str() )
     //  v6 = (char *)&dword_4D86F0;
@@ -1651,12 +1653,9 @@
           v36 = a3;
           do
           {
-            v28 = (Lightmap *)(3100 * *v13 + LODWORD(v38) + 4);
+            v28 = &std__vector_000004[*v13];
             if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) )
-            {
-              MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1230", 0);
-              a1 = 5080812;
-            }
+              assert(false && "Invalid lightmap detected!");
             v13 = v36 + 1;
             v36 = v13;
           }
@@ -1665,31 +1664,27 @@
       }
       else
       {
-        v14 = v38;
         v36 = 0;
-        if ( *(unsigned int *)(LODWORD(v38) + 1587204) > 0 )
+        if (std__vector_000004_size > 0 )
         {
-          a1 = LODWORD(v38) + 4;
           while ( 1 )
           {
-            if ( !DrawLightmap((Lightmap *)a1, (Vec3_float_ *)&arg4, 0.0) )
+            auto _a1 = &std__vector_000004[(int)v36];
+            if ( !DrawLightmap(_a1, (Vec3_float_ *)&arg4, 0.0) )
             {
               MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0);
               v35 = 5080812;
             }
             v36 = (int *)((char *)v36 + 1);
-            a1 += 3100;
-            if ( (signed int)v36 >= *(unsigned int *)(LODWORD(v38) + 1587204) )
+            if ( (signed int)v36 >= std__vector_000004_size)
               break;
-            v14 = v38;
           }
         }
       }
-      v15 = pRenderer->pRenderD3D->pDevice;
-      ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
-      ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
-      ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
-      ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
+      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
+      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
+      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
+      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
     }
     if ( pRenderer->bUsingSpecular )
     {
@@ -1705,7 +1700,7 @@
       //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice;
       ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
     }
-  }
+
   return 1;
 }