diff _deleted.cpp @ 1638:ccde94f02b75

class IndoorCamera split into BLVRenderParams and ODMRenderParams
author Nomad
date Tue, 17 Sep 2013 15:40:09 +0200
parents 2c71fa8913d2
children 8971dc85b8fb
line wrap: on
line diff
--- a/_deleted.cpp	Tue Sep 17 14:10:41 2013 +0200
+++ b/_deleted.cpp	Tue Sep 17 15:40:09 2013 +0200
@@ -12987,7 +12987,6 @@
 }
 
 
-/*
 //  143
 #pragma pack(push, 1)
 struct Span
@@ -13049,7 +13048,157 @@
 
 extern Edge stru_80C9A4;
 extern Edge stru_80C9D8;
-*/
+
+
+
+#define INDOOR_CAMERA_DRAW_SW_OUTLINES 1
+#define INDOOR_CAMERA_DRAW_D3D_OUTLINES 2
+#define INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES 4
+//  157
+#pragma pack(push, 1)
+struct IndoorCamera
+{
+  //----- (0042391F) --------------------------------------------------------
+  IndoorCamera()
+  {
+    sRotationX = 0;
+    sRotationY = 0;
+    fov_rad = 2000.0f;
+    fov_rad_inv = 32.768002f;
+
+    flags = 0;
+  }
+  void Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight);
+  void Initialize2();
+  float ViewTransform_ODM(struct RenderVertexSoft *a1);
+
+
+  Vec3_int_ pos;
+  unsigned int uMapGridCellX;
+  unsigned int uMapGridCellZ;
+  int sRotationX;
+  int sRotationY;
+  float fov_rad;
+  float fov_rad_inv;
+  int field_24;
+  int field_28;
+  float fRotationYSine;
+  float fRotationYCosine;
+  float fRotationXSine;
+  float fRotationXCosine;
+  int _int_sine;
+  int _int_cosine;
+  int _int_sine_2;
+  int _int_cosine_2;
+  int flags;  // & INDOOR_CAMERA_DRAW_D3D_OUTLINES:  render terrain outlines in d3d
+};
+#pragma pack(pop)
+
+
+
+extern IndoorCamera *pIndoorCamera; // idb
+
+
+IndoorCamera *pIndoorCamera; // idb
+
+
+
+
+
+//----- (00481CCE) --------------------------------------------------------
+float IndoorCamera::ViewTransform_ODM(RenderVertexSoft *a1)
+{
+  float result; // eax@1
+  double vCamToVertexZ; // st7@1
+  double v3; // st6@1
+  double v4; // st5@1
+  double v5; // st4@1
+  float v6; // ST04_4@3
+  float v7; // [sp+0h] [bp-14h]@1
+  float v8; // [sp+8h] [bp-Ch]@1
+  float vCamToVertexX; // [sp+Ch] [bp-8h]@1
+  float vCamToVertexY; // [sp+10h] [bp-4h]@1
+
+  v8 = fRotationXCosine;
+  result = fRotationXSine;
+  v7 = fRotationXSine;
+  vCamToVertexX = a1->vWorldPosition.x - (double)pos.x;
+  vCamToVertexY = a1->vWorldPosition.y - (double)pos.y;
+  vCamToVertexZ = a1->vWorldPosition.z - (double)pos.z;
+  v3 = fRotationYCosine;
+  v4 = fRotationYSine;
+  v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
+  if ( sRotationX )
+  {
+    v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
+    a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ;
+    a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
+    a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7;
+  }
+  else
+  {
+    a1->vWorldViewPosition.x = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
+    a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
+    a1->vWorldViewPosition.z = vCamToVertexZ;
+  }
+  return result;
+}
+
+
+
+//----- (0042394D) --------------------------------------------------------
+void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight)
+{
+  IndoorCamera *v4; // esi@1
+  double v5; // st7@1
+
+  v4 = this;
+  v5 = (double)(signed int)(signed __int64)((double)(signed int)uViewportWidth
+                                          * 0.5
+                                          / tan((double)(degFov >> 1) * 0.01745329)
+                                          + 0.5);
+  v4->fov_rad = v5;
+  v4->fov_rad_inv = 65536.0 / v5;
+}
+
+//----- (004239A7) --------------------------------------------------------
+void IndoorCamera::Initialize2()
+{
+  //IndoorCamera *v1; // esi@1
+  double v2; // st7@4
+  //double v3; // st7@6
+  //int v4; // eax@6
+  //int v5; // eax@6
+  //int v6; // ST04_4@6
+  //int v7; // eax@6
+  //int v8; // ST04_4@6
+
+  //v1 = this;
+  fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationY * 0.00048828125);
+  fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationY * 0.00048828125);
+  if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
+  {
+    fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-sRotationX * 0.00048828125);
+    v2 = (3.141592653589793 + 3.141592653589793) * (double)-sRotationX;
+  }
+  else
+  {
+    fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationX * 0.00048828125);
+    v2 = (3.141592653589793 + 3.141592653589793) * (double)sRotationX;
+  }
+  //v3 = cos(v2 * 0.00048828125);
+  //v4 = sRotationY;
+  fRotationXCosine = cos(v2 * 0.00048828125);
+  //v5 = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi);
+  //v6 = sRotationY;
+  _int_sine = stru_5C6E00->Sin(sRotationY);
+  _int_cosine = stru_5C6E00->Cos(sRotationY);
+  //v7 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi);
+  //v8 = sRotationX;
+  _int_sine_2 = stru_5C6E00->Sin(sRotationX);
+  _int_cosine_2 = stru_5C6E00->Cos(sRotationX);
+}
+// 4D864C: using guessed type char byte_4D864C;