0
|
1 #include "IndoorCamera.h"
|
|
2 #include "Render.h"
|
|
3 #include "Game.h"
|
|
4 #include "Indoor.h"
|
|
5 #include "Math.h"
|
|
6
|
|
7 #include "mm7_data.h"
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13 IndoorCamera *pIndoorCamera; // idb
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19 //----- (00481CCE) --------------------------------------------------------
|
|
20 float IndoorCamera::ViewTransform(RenderVertexSoft *a1)
|
|
21 {
|
|
22 float result; // eax@1
|
|
23 double vCamToVertexZ; // st7@1
|
|
24 double v3; // st6@1
|
|
25 double v4; // st5@1
|
|
26 double v5; // st4@1
|
|
27 float v6; // ST04_4@3
|
|
28 float v7; // [sp+0h] [bp-14h]@1
|
|
29 float v8; // [sp+8h] [bp-Ch]@1
|
|
30 float vCamToVertexX; // [sp+Ch] [bp-8h]@1
|
|
31 float vCamToVertexY; // [sp+10h] [bp-4h]@1
|
|
32
|
|
33 v8 = fRotationXCosine;
|
|
34 result = fRotationXSine;
|
|
35 v7 = fRotationXSine;
|
|
36 vCamToVertexX = a1->vWorldPosition.x - (double)pos.x;
|
|
37 vCamToVertexY = a1->vWorldPosition.y - (double)pos.y;
|
|
38 vCamToVertexZ = a1->vWorldPosition.z - (double)pos.z;
|
|
39 v3 = fRotationYCosine;
|
|
40 v4 = fRotationYSine;
|
|
41 v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
|
|
42 if ( sRotationX )
|
|
43 {
|
|
44 v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
|
|
45 a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ;
|
|
46 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
|
|
47 a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7;
|
|
48 }
|
|
49 else
|
|
50 {
|
|
51 a1->vWorldViewPosition.x = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
|
|
52 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
|
|
53 a1->vWorldViewPosition.z = vCamToVertexZ;
|
|
54 }
|
|
55 return result;
|
|
56 }
|
|
57
|
|
58
|
|
59
|
|
60 //----- (0042394D) --------------------------------------------------------
|
|
61 void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight)
|
|
62 {
|
|
63 IndoorCamera *v4; // esi@1
|
|
64 double v5; // st7@1
|
|
65
|
|
66 v4 = this;
|
|
67 v5 = (double)(signed int)(signed __int64)((double)(signed int)uViewportWidth
|
|
68 * 0.5
|
|
69 / tan((double)(degFov >> 1) * 0.01745329)
|
|
70 + 0.5);
|
|
71 v4->flt_1C_fov = v5;
|
|
72 v4->flt_20_inv_1C = 65536.0 / v5;
|
|
73 }
|
|
74
|
|
75 //----- (004239A7) --------------------------------------------------------
|
|
76 void IndoorCamera::Initialize2()
|
|
77 {
|
|
78 //IndoorCamera *v1; // esi@1
|
|
79 double v2; // st7@4
|
|
80 //double v3; // st7@6
|
|
81 //int v4; // eax@6
|
|
82 //int v5; // eax@6
|
|
83 //int v6; // ST04_4@6
|
|
84 //int v7; // eax@6
|
|
85 //int v8; // ST04_4@6
|
|
86
|
|
87 //v1 = this;
|
|
88 fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationY * 0.00048828125);
|
|
89 fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationY * 0.00048828125);
|
|
90 if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
91 {
|
|
92 fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-sRotationX * 0.00048828125);
|
|
93 v2 = (3.141592653589793 + 3.141592653589793) * (double)-sRotationX;
|
|
94 }
|
|
95 else
|
|
96 {
|
|
97 fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationX * 0.00048828125);
|
|
98 v2 = (3.141592653589793 + 3.141592653589793) * (double)sRotationX;
|
|
99 }
|
|
100 //v3 = cos(v2 * 0.00048828125);
|
|
101 //v4 = sRotationY;
|
|
102 fRotationXCosine = cos(v2 * 0.00048828125);
|
|
103 //v5 = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi);
|
|
104 //v6 = sRotationY;
|
|
105 _int_sine = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi);
|
|
106 _int_cosine = stru_5C6E00->SinCos(sRotationY);
|
|
107 //v7 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi);
|
|
108 //v8 = sRotationX;
|
|
109 _int_sine_2 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi);
|
|
110 _int_cosine_2 = stru_5C6E00->SinCos(sRotationX);
|
|
111 }
|
|
112 // 4D864C: using guessed type char byte_4D864C; |