diff Engine/Graphics/stru10.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 68cdef6879a0
children b6140dfeac27
line wrap: on
line diff
--- a/Engine/Graphics/stru10.cpp	Sat May 09 12:55:58 2015 +0200
+++ b/Engine/Graphics/stru10.cpp	Sun May 10 01:29:11 2015 +0200
@@ -3,11 +3,10 @@
 #include <crtdbg.h>
 
 #define _CRT_SECURE_NO_WARNINGS
+#include "Engine/Engine.h"
 #include "stru10.h"
 #include "Indoor.h"
-#include "../Game.h"
-#include "../Party.h"
-#include "../ErrorHandling.h"
+#include "Engine/Party.h"
 
 
 
@@ -242,7 +241,7 @@
 
   //_ESI = a3;
   //v31 = this;
-  //v6 = pGame->pIndoorCameraD3D;
+  //v6 = pEngine->pIndoorCameraD3D;
   //v7 = a3->uPolygonType;
 
   a1.x = 0.0f;
@@ -670,9 +669,9 @@
   RenderVertexSoft v25; // [sp+10h] [bp-90h]@20
   memcpy(&v25, pOutBounding, sizeof(RenderVertexSoft));
 
-  float _dp = (v25.vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) * a1.x +
-              (v25.vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) * a1.y +
-              (v25.vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) * a1.z;
+  float _dp = (v25.vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) * a1.x +
+              (v25.vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) * a1.y +
+              (v25.vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) * a1.z;
   if (fabs(_dp) < 1e-6f)
   {
     memcpy(&v25, &pOutBounding[1], sizeof(RenderVertexSoft));
@@ -680,7 +679,7 @@
     memcpy(&pOutBounding[3], &v25, sizeof(RenderVertexSoft));
   }
 
-    //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
+    //if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
     //{
       RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
       if ( draw_portals_loops )
@@ -691,32 +690,32 @@
           v26.vWorldPosition.y = pParty->vPosition.y;
           v26.vWorldPosition.z = pParty->vPosition.z + pParty->sEyelevel;             // frustum
 
-          pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF0000u, &pOutBounding[0], 0xFF0000u, 0, 0);
-          pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF00u, &pOutBounding[1], 0xFF00u, 0, 0);
-          pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFu, &pOutBounding[2], 0xFFu, 0, 0);
-          pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFFFFFu, &pOutBounding[3], 0xFFFFFFu, 0, 0);
+          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF0000u, &pOutBounding[0], 0xFF0000u, 0, 0);
+          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF00u, &pOutBounding[1], 0xFF00u, 0, 0);
+          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFu, &pOutBounding[2], 0xFFu, 0, 0);
+          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFFFFFu, &pOutBounding[3], 0xFFFFFFu, 0, 0);
           bDoNotDrawPortalFrustum = true;
         }
-        pGame->pIndoorCameraD3D->debug_outline_sw(pOutBounding, uNumVertices, 0x1EFF1Eu, 0.00019999999);    // bounding
+        pEngine->pIndoorCameraD3D->debug_outline_sw(pOutBounding, uNumVertices, 0x1EFF1Eu, 0.00019999999);    // bounding
       }
     //}
 
-    //pGame->pIndoorCameraD3D->debug_outline_sw(pFaceLimits,  4, 0xFFF14040, 0.000099999997);     // limits
+    //pEngine->pIndoorCameraD3D->debug_outline_sw(pFaceLimits,  4, 0xFFF14040, 0.000099999997);     // limits
 
-  /*if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
+  /*if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
   {
     RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
     v26.vWorldPosition.x = face_center_x;                                    // corner to center
     v26.vWorldPosition.y = face_center_y;
     v26.vWorldPosition.z = face_center_z;
 
-    pGame->pIndoorCameraD3D->do_draw_debug_line_sw(pFaceLimits, 0xFF00u, &v26, 0xFF0000u, 0, 0);  
+    pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(pFaceLimits, 0xFF00u, &v26, 0xFF0000u, 0, 0);  
   }*/
 
 
         /*if ( byte_4D864C )
   {
-      if ( pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)*/
+      if ( pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)*/
       {
         RenderVertexSoft v25; // [sp+10h] [bp-90h]@20
         RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
@@ -730,7 +729,7 @@
         v26.vWorldPosition.z = face_center_z + a1.z * 400.0f;
 
         if ( draw_portals_loops )
-          pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v25, -1, &v26, 0xFFFF00u, 0, 0);
+          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v25, -1, &v26, 0xFFFF00u, 0, 0);
       }
   //}
 
@@ -757,8 +756,8 @@
 
   _49CE9E(pFace, pVertices, *pNumVertices, pLimits);
 
-  //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
-  //  pGame->pIndoorCameraD3D->debug_outline_sw(a4a, 4u, 0xFF1E1Eu, 0.000099999997);
+  //if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
+  //  pEngine->pIndoorCameraD3D->debug_outline_sw(a4a, 4u, 0xFF1E1Eu, 0.000099999997);
   if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding))
     return _49C720(pOutBounding, a5);
   return false;
@@ -771,8 +770,8 @@
   RenderVertexSoft pLimits[4]; // [sp+Ch] [bp-C0h]@1
 
   CalcPolygonLimits(pFace, pLimits);//определение границ портала
-  //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
- //   pGame->pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997);
+  //if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
+ //   pEngine->pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997);
   if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding))
     return _49C720(pOutBounding, pPortalDataFrustum) != 0;
   return false;
@@ -784,9 +783,9 @@
 char stru10::_49C720(RenderVertexSoft *pFaceBounding, IndoorCameraD3D_Vec4 *pPortalDataFrustum)
 {
   Vec3_float_ pRayStart; // [sp+4h] [bp-34h]@1
-  pRayStart.x = (double)pGame->pIndoorCameraD3D->vPartyPos.x;
-  pRayStart.y = (double)pGame->pIndoorCameraD3D->vPartyPos.y;
-  pRayStart.z = (double)pGame->pIndoorCameraD3D->vPartyPos.z;
+  pRayStart.x = (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
+  pRayStart.y = (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
+  pRayStart.z = (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
 
   if (FindFaceNormal(&pFaceBounding[0], &pFaceBounding[1], &pRayStart, &pPortalDataFrustum[0]) &&
       FindFaceNormal(&pFaceBounding[1], &pFaceBounding[2], &pRayStart, &pPortalDataFrustum[1]) &&