diff LightmapBuilder.cpp @ 1637:2c71fa8913d2

class OutdoorCamera -> ODMRenderParams
author Nomad
date Tue, 17 Sep 2013 14:10:41 +0200
parents c4ab816fcc5e
children c1c74df0a33e
line wrap: on
line diff
--- a/LightmapBuilder.cpp	Tue Sep 17 12:40:37 2013 +0200
+++ b/LightmapBuilder.cpp	Tue Sep 17 14:10:41 2013 +0200
@@ -6,7 +6,6 @@
 #include "Log.h"
 #include "ErrorHandling.h"
 
-#include "OutdoorCamera.h"
 #include "Lights.h"
 
 #include "mm7_data.h"
@@ -1312,223 +1311,6 @@
   ++*v53;
   return 1;
 }
-// 4E94D2: using guessed type char _4E94D2_light_type;
-
-//----- (0045D3C7) --------------------------------------------------------
-bool LightmapBuilder::_45D3C7(struct Polygon *a1)
-{
-  LightmapBuilder *v2; // ebx@1
-  struct Polygon *result; // eax@1
-  float v4; // ecx@2
-  Span *i; // edi@5
-
-  v2 = this;
-  result = (struct Polygon *)a1->prolly_head;
-  if ( result && (v4 = result->field_4, *(int *)&v4) != 0 && *(unsigned int *)(LODWORD(v4) + 60) )
-  {
-    for ( i = a1->prolly_head; ; i = i->pNext )
-    {
-      result = i->pParent;
-      if ( result->field_108 )
-        result = (struct Polygon *)_45D426(
-                              i,
-                              a1->pEdgeList1,
-                              a1->uEdgeList1Size,
-                              (Edge *)a1->pEdgeList2,
-                              a1->uEdgeList2Size);
-      if ( a1->prolly_tail == i )
-        break;
-    }
-    LOBYTE(result) = 1;
-  }
-  else
-  {
-    LOBYTE(result) = 0;
-  }
-  return (bool)result;
-}
-
-//----- (0045D426) --------------------------------------------------------
-int LightmapBuilder::_45D426(Span *a1, Edge **a2, unsigned int a3, Edge *a4, int a5)
-{
-  int v6; // edi@1
-  signed int v7; // ebx@3
-  signed int v8; // ecx@3
-  Span *v9; // esi@3
-  double v10; // st7@4
-  Edge *v11; // edx@5
-  double v12; // st7@11
-  int v13; // edx@12
-  int v14; // ebx@17
-  Edge *v15; // edi@17
-  float v16; // ST04_4@17
-  float v17; // ST04_4@17
-  double v18; // st7@17
-  int result; // eax@19
-  //double v20; // ST14_8@20
-  //double v21; // ST14_8@20
-  double v22; // st7@20
-  int v23; // ecx@20
-  double v24; // st6@20
-  double v25; // st7@23
-  double v26; // st7@28
-  __int16 v27; // fps@28
-  char v28; // c0@28
-  char v29; // c2@28
-  char v30; // c3@28
-  double v31; // st7@29
-  double v32; // st7@30
-  __int16 v33; // fps@30
-  char v34; // c0@30
-  char v35; // c2@30
-  char v36; // c3@30
-  LightmapBuilder *this_4; // [sp+14h] [bp-8h]@1
-  signed int v38; // [sp+18h] [bp-4h]@3
-  float a1a; // [sp+24h] [bp+8h]@20
-  float a2a; // [sp+28h] [bp+Ch]@17
-  float a3a; // [sp+2Ch] [bp+10h]@17
-  float a5a; // [sp+34h] [bp+18h]@20
-  float a5b; // [sp+34h] [bp+18h]@20
-
-  v6 = 0;
-  this_4 = this;
-  if ( a5 && a3 )
-  {
-    v7 = -1;
-    v8 = 0;
-    v9 = a1;
-    v38 = -1;
-    if ( (signed int)a3 > 0 )
-    {
-      v10 = (double)a1->field_A;
-      while ( 1 )
-      {
-        v11 = a2[v8];
-        if ( v10 >= v11->field_2C )
-        {
-          if ( v10 <= v11->field_30 )
-            break;
-        }
-        ++v8;
-        if ( v8 >= (signed int)a3 )
-          goto LABEL_10;
-      }
-      v38 = v8;
-    }
-LABEL_10:
-    if ( a5 > 0 )
-    {
-      v12 = (double)a1->field_A;
-      while ( 1 )
-      {
-        v13 = *((unsigned int *)&a4->field_0 + v6);
-        if ( v12 >= *(float *)(v13 + 44) )
-        {
-          if ( v12 <= *(float *)(v13 + 48) )
-            break;
-        }
-        ++v6;
-        if ( v6 >= a5 )
-          goto LABEL_17;
-      }
-      v7 = v6;
-    }
-LABEL_17:
-    v14 = *((unsigned int *)&a4->field_0 + v7);
-    v15 = a2[v38];
-    v16 = (double)a1->field_A;
-    a3a = _45D643(a2[v38], v16);
-    v17 = (double)a1->field_A;
-    v18 = _45D643((Edge *)v14, v17);
-    a2a = v18;
-    if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x80 )
-    {
-      HIWORD(result) = HIWORD(a3a);
-      a1->field_14 = v18;
-      a1->field_10 = a3a;
-    }
-    else
-    {
-      a5a = ((double)a1->field_A - v15->field_2C) * v15->field_4 + v15->field_24 - 0.5;
-      //v20 = a5a + 6.7553994e15;
-      //a5b = (double)SLODWORD(v20);
-      a5b = (double)floorf(a5a + 0.5f);
-      a1a = ((double)a1->field_A - *(float *)(v14 + 44)) * *(float *)(v14 + 4) + *(float *)(v14 + 36) + 0.5;
-      //v21 = a1a + 6.7553994e15;
-      //v22 = (double)SLODWORD(v21);
-      v22 = (double)floorf(a1a + 0.5f);
-      result = v9->field_8;
-      v23 = v9->field_C;
-      v24 = -((a3a - a2a) / (v22 - a5b));
-      v9->field_10 = ((double)result - a5b) * v24 + a3a;
-      v9->field_14 = a2a - (v22 - (double)(result + v23)) * v24;
-    }
-    if ( v9->field_10 < 0.0 || v9->field_10 <= 1.0 )
-    {
-      if ( v9->field_10 >= 0.0 )
-        v25 = v9->field_10;
-      else
-        v25 = 0.0;
-    }
-    else
-    {
-      v25 = 1.0;
-    }
-    v9->field_10 = v25;
-      __debugbreak(); // warning C4700: uninitialized local variable 'v27' used
-    if ( v9->field_14 < 0.0
-      || (v26 = v9->field_14,
-          //UNDEF(v27),
-          v28 = 1.0 < v26,
-          v29 = 0,
-          v30 = 1.0 == v26,
-          BYTE1(result) = HIBYTE(v27),
-          v26 <= 1.0) )
-    {
-      v32 = v9->field_14;
-      //UNDEF(v33);
-      v34 = 0.0 < v32;
-      v35 = 0;
-      v36 = 0.0 == v32;
-      __debugbreak(); // warning C4700: uninitialized local variable 'v33' used
-      BYTE1(result) = HIBYTE(v33);
-      if ( v32 >= 0.0 )
-        v31 = v9->field_14;
-      else
-        v31 = 0.0;
-    }
-    else
-    {
-      v31 = 1.0;
-    }
-    v9->field_14 = v31;
-    LOBYTE(result) = 1;
-  }
-  else
-  {
-    LOBYTE(result) = 0;
-  }
-  return result;
-}
-// 4D864C: using guessed type char byte_4D864C;
-
-//----- (0045D643) --------------------------------------------------------
-double LightmapBuilder::_45D643(Edge *a1, float a2)
-{
-  double result; // st7@1
-
-  result = (a1->field_1C - a1->field_20) * -1.0 / (a1->field_30 - a1->field_2C) * (a2 - a1->field_2C) + a1->field_1C;
-  if ( result < 0.0 || result <= 1.0 )
-  {
-    if ( result < 0.0 )
-      result = 0.0;
-  }
-  else
-  {
-    result = 1.0;
-  }
-  return result;
-}
 
 //----- (0045D698) --------------------------------------------------------
 bool LightmapBuilder::DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2)
@@ -1741,7 +1523,7 @@
   uint uLightmapColor = uLightmapColorB | (uLightmapColorMaskG << 8) | (uLightmapColorMaskR << 16);
 
   if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    v10 = (double)pOutdoorCamera->shading_dist_mist;
+    v10 = (double)pODMRenderParams->shading_dist_mist;
   else
     v10 = 16192.0;
   v14 = 1.0 / v10;