diff Game.cpp @ 45:bcc051713d20

BLV render & seffects
author Nomad
date Mon, 22 Oct 2012 20:45:14 +0200
parents f4450ff595fe
children 79a30ee1ecdb
line wrap: on
line diff
--- a/Game.cpp	Sun Oct 21 23:26:23 2012 +0600
+++ b/Game.cpp	Mon Oct 22 20:45:14 2012 +0200
@@ -105,15 +105,15 @@
         pRenderer->field_1036A8_bitmapid = floorf(v2 + 0.5f);
       }
 
-      if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
+      if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
         pIndoor->Draw();
-      else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-          pOutdoor->Draw();
+      else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+        pOutdoor->Draw();
 
-      if ( pRenderer->pRenderD3D )
+      if (pRenderer->pRenderD3D)
       {
         pDecalBuilder->DrawBloodsplats();
-        if ( pRenderer->pRenderD3D )
+        if (pRenderer->pRenderD3D)
           pGame->pLightmapBuilder->DrawLightmaps(2);
       }
     }
@@ -494,33 +494,19 @@
 
 
 //----- (0044F192) --------------------------------------------------------
-void Game::PushStru165s()
+void Game::PrepareBloodsplats()
 {
-  Game *v1; // edi@1
-  int v2; // ebx@1
-  float *v3; // esi@2
-
-  auto a1 = this;
-  v1 = a1;
-  v2 = 0;
-  if ( a1->array_708_size > 0 )
+  for (uint i = 0; i < uNumBloodsplats; ++i)
   {
-    v3 = &a1->array_708[0].flt_10;
-    do
-    {
-      pBloodsplatContainer->AddBloodsplat(
-        *(v3 - 4),
-        *(v3 - 3),
-        *(v3 - 2),
-        v3[2],
-        (signed __int64)*(v3 - 1),
-        (signed __int64)*v3,
-        (signed __int64)v3[1]);
-      ++v2;
-      v3 += 7;
-    }
-    while ( v2 < v1->array_708_size );
-  }
+    pBloodsplatContainer->AddBloodsplat(
+        pBloodsplats[i].x,
+        pBloodsplats[i].y,
+        pBloodsplats[i].z,
+        pBloodsplats[i].radius,
+        pBloodsplats[i].r,
+        pBloodsplats[i].g,
+        pBloodsplats[i].b);
+   }
 }
 
 
@@ -561,7 +547,7 @@
 
   if ( !(uFlags & 0x40) )
   {
-    array_708_size = 0;
+    uNumBloodsplats = 0;
     field_E0C = 0;
   }
 }
@@ -592,7 +578,7 @@
 //----- (0044EEA7) --------------------------------------------------------
 bool Game::_44EEA7()
 {
-  Game *v1; // esi@1
+  //Game *v1; // esi@1
   double v2; // st7@2
   float depth; // ST00_4@9
   bool result; // eax@9
@@ -605,7 +591,7 @@
   stru157 *v11; // [sp+14h] [bp-14h]@2
   POINT a2; // [sp+20h] [bp-8h]@1
 
-  v1 = this;
+  //v1 = this;
   ++qword_5C6DF0;
   pParticleEngine->UpdateParticles();
   pMouseInstance->GetCursorPos(&a2);
@@ -620,7 +606,7 @@
   }
   else
   {
-    if ( v1->uFlags2 & 0x10 )
+    if ( uFlags2 & 0x10 )
     {
       v11 = &a5;
       v10 = &stru_F93E1C;
@@ -649,8 +635,8 @@
   depth = v2;
 
   PickMouse(depth, y, x, v9, v10, v11);
-  v1->pLightmapBuilder->std__vector_000004_size = 0;
-  v1->pLightmapBuilder->std__vector_183808_size = 0;
+  pLightmapBuilder->std__vector_000004_size = 0;
+  pLightmapBuilder->std__vector_183808_size = 0;
   pDecalBuilder->std__vector_pDecals_size = 0;
   pDecalBuilder->field_308008 = 0;
   result = _44F07B();
@@ -661,7 +647,7 @@
     if ( pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
     {
       v5 = GetLevelFogColor();
-      LODWORD(pRenderer->uFogColor) = v5 & 0xFFFFFF;
+      pRenderer->uFogColor = v5 & 0xFFFFFF;
     }
     if (uFlags & 0x0400)
       uFlags2 |= 0x01;
@@ -670,24 +656,20 @@
       uFlags2 |= 0x01;
       field_E10 = qword_5C6DF0;
     }
-    v6 = qword_5C6DF0 - v1->field_E10;
-    if ( qword_5C6DF0 - v1->field_E10 == 1 )
-      v1->uFlags2 |= v6;
-    if ( v1->uNumStationaryLights_in_pStationaryLightsStack != uNumStationaryLightsApplied )
+    v6 = qword_5C6DF0 - field_E10;
+    if ( qword_5C6DF0 - field_E10 == 1 )
+      uFlags2 |= v6;
+    if (uNumStationaryLights_in_pStationaryLightsStack != uNumStationaryLightsApplied )
     {
-      v1->uFlags2 |= 1u;
-      v1->uNumStationaryLights_in_pStationaryLightsStack = uNumStationaryLightsApplied;
+      uFlags2 |= 1u;
+      uNumStationaryLights_in_pStationaryLightsStack = uNumStationaryLightsApplied;
     }
     _44E904();
     LOBYTE(result) = 1;
   }
   return result;
 }
-// 519AB4: using guessed type int uNumStationaryLightsApplied;
-// 5C6DEC: using guessed type char static_sub_44EEA7_byte_5C6DEC__init_flag;
-// 5C6DF0: using guessed type __int64 qword_5C6DF0;
-// F93E1C: using guessed type stru157 stru_F93E1C;
-// F93E30: using guessed type stru157 stru_F93E30;
+
 
 //----- (0044EDE4) --------------------------------------------------------
 bool Game::_44EDE4(BLVFace *pFace, int *a3)
@@ -912,7 +894,7 @@
 Game::Game()
 {
   uNumStationaryLights = 0;
-  array_708_size = 0;
+  uNumBloodsplats = 0;
   field_E0C = 0;
   field_E10 = 0;
   uNumStationaryLights_in_pStationaryLightsStack = 0;
@@ -984,7 +966,7 @@
 //----- (0044E904) --------------------------------------------------------
 void Game::_44E904()
 {
-  Game *v1; // esi@1
+  //Game *v1; // esi@1
   unsigned __int64 v2; // qax@1
   unsigned int v3; // ecx@1
   int v4; // edi@1
@@ -993,13 +975,13 @@
   double v7; // st7@15
   signed __int64 v8; // [sp+Ch] [bp-8h]@1
 
-  v1 = this;
+  //v1 = this;
   v2 = pEventTimer->Time();
-  v4 = (v2 - v1->uSomeGammaStartTime) >> 32;
-  v3 = v2 - LODWORD(v1->uSomeGammaStartTime);
-  v8 = v2 - v1->uSomeGammaStartTime;
+  v4 = (v2 - uSomeGammaStartTime) >> 32;
+  v3 = v2 - LODWORD(uSomeGammaStartTime);
+  v8 = v2 - uSomeGammaStartTime;
   if ( v4 < 0
-    || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(v1->uSomeGammaStartTime)) + HIDWORD(v1->uSomeGammaStartTime) | v4 == 0
+    || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(uSomeGammaStartTime)) + HIDWORD(uSomeGammaStartTime) | v4 == 0
     && v3 <= 0x80 )
   {
     if ( v4 > 0 || v4 >= 0 )
@@ -1009,25 +991,25 @@
   }
   else
   {
-    if ( v1->uSomeGammaDeltaTime )
+    if ( uSomeGammaDeltaTime )
     {
-      LODWORD(v1->uSomeGammaDeltaTime) = 0;
-      HIDWORD(v1->uSomeGammaDeltaTime) = 0;
+      LODWORD(uSomeGammaDeltaTime) = 0;
+      HIDWORD(uSomeGammaDeltaTime) = 0;
     }
     else
     {
-      LODWORD(v1->uSomeGammaDeltaTime) = v3;
-      HIDWORD(v1->uSomeGammaDeltaTime) = v4;
+      LODWORD(uSomeGammaDeltaTime) = v3;
+      HIDWORD(uSomeGammaDeltaTime) = v4;
     }
     v5 = __CFADD__(v3, -128);
     v3 -= 128;
     v4 = v5 + v4 - 1;
   }
-  v1->uSomeGammaStartTime = v2;
+  uSomeGammaStartTime = v2;
   v8 = __PAIR__(v4, v3);
 LABEL_12:
-  if ( v1->uSomeGammaDeltaTime )
-    v6 = (double)(signed __int64)(v1->uSomeGammaDeltaTime - __PAIR__(v4, v3));
+  if ( uSomeGammaDeltaTime )
+    v6 = (double)(signed __int64)(uSomeGammaDeltaTime - __PAIR__(v4, v3));
   else
     v6 = (double)v8;
   v7 = v6 * 0.0078125;
@@ -1041,9 +1023,9 @@
     v7 = 1.0;
   }
   if ( pRenderer->pRenderD3D )
-    v1->_E28_timed_gamma_strength = v7;
+    _E28_timed_gamma_strength = v7;
   else
-    v1->_E28_timed_gamma_strength = (1.0 - 0.5) * v7 + 0.5;
+    _E28_timed_gamma_strength = (1.0 - 0.5) * v7 + 0.5;
 }
 
 //----- (0044EA17) --------------------------------------------------------