annotate IndoorCameraD3D.cpp @ 2327:5e4d90305d06

EventCastSpell removing duplicate code for handling empty pObjectList->pObjects array or not finding the correct value + moving everything into the main switch
author Grumpy7
date Tue, 01 Apr 2014 23:20:15 +0200
parents 847aba0b7f82
children ddb803517a48
rev   line source
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2245
diff changeset
1 #define _CRT_SECURE_NO_WARNINGS
0
Ritor1
parents:
diff changeset
2 #include "IndoorCameraD3D.h"
Ritor1
parents:
diff changeset
3 #include "VectorTypes.h"
Ritor1
parents:
diff changeset
4 #include "Game.h"
Ritor1
parents:
diff changeset
5 #include "Indoor.h"
Ritor1
parents:
diff changeset
6 #include "Viewport.h"
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
7 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
8 #include "Render.h"
Ritor1
parents:
diff changeset
9 #include "LOD.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 2006
diff changeset
10 #include "OurMath.h"
0
Ritor1
parents:
diff changeset
11 #include "mm7_data.h"
Ritor1
parents:
diff changeset
12
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 871
diff changeset
13 #include "stru9.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 871
diff changeset
14
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
15
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
16 // calculates FOV (Field of View) angle in radians for IndoorCamera::Initialize and BLVRenderParams::Reset
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
17 float _calc_fov(int viewport_width, int angle_degree)
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
18 {
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
19 return viewport_width * 0.5 / tan(angle_degree / 2 * 0.01745329) + 0.5;
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
20 }
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
21
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
22
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
23
781
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
24 //----- (004361EF) --------------------------------------------------------
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
25 IndoorCameraD3D::IndoorCameraD3D()
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
26 {
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
27 this->field_108 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
28 this->field_138 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
29 this->field_168 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
30 this->field_198 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
31 this->field_1C8 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
32 this->field_1F8 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
33 this->field_228 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
34 this->field_258 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
35 this->field_288 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
36 this->field_2B8 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
37 this->field_2E8 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
38 this->field_2BC = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
39 this->field_2C0 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
40 this->field_2C4 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
41 this->field_318 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
42 this->field_2EC = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
43 this->field_2F0 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
44 this->field_2F4 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
45 this->field_348 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
46 this->field_31C = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
47 this->field_320 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
48 this->field_324 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
49 this->field_378 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
50 this->field_34C = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
51 this->field_350 = 0.0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
52 this->field_354 = 0.0;
781
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
53 for (uint i = 0; i < 16384; ++i)
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
54 {
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
55 list_0037C[i].field_0 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
56 list_0037C[i].flt_30 = 0.0f;
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
57 }
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
58 list_0037C_size = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
59 for (uint i = 0; i < 256; ++i)
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
60 list_E0380[i].mm7__vector_000004_size = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
61 list_E0380_size = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
62 }
0
Ritor1
parents:
diff changeset
63
871
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
64
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
65 //----- (0043643E) --------------------------------------------------------
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
66 float IndoorCameraD3D::GetPickDepth()
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
67 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
68 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
69 return pODMRenderParams->uPickDepth;
871
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
70 else
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
71 return 16192.0;
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
72 }
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
73
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
74 //----- (00436427) --------------------------------------------------------
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
75 float IndoorCameraD3D::GetShadingDistMist()
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
76 {
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
77 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
78 return (double)pODMRenderParams->shading_dist_mist;
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
79 else
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
80 return 16192.0;
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
81 }
871
710cf848ad24 Particle engine made working.
Nomad
parents: 795
diff changeset
82
0
Ritor1
parents:
diff changeset
83 //----- (004364C5) --------------------------------------------------------
Ritor1
parents:
diff changeset
84 void IndoorCameraD3D::ViewTransfrom_OffsetUV(RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutVertices, stru320 *a5)
Ritor1
parents:
diff changeset
85 {
Ritor1
parents:
diff changeset
86 for (uint i = 0; i < uNumVertices; ++i)
Ritor1
parents:
diff changeset
87 {
Ritor1
parents:
diff changeset
88 pOutVertices[i].vWorldPosition.x = pVertices[i].vWorldPosition.x;
Ritor1
parents:
diff changeset
89 pOutVertices[i].vWorldPosition.y = pVertices[i].vWorldPosition.y;
Ritor1
parents:
diff changeset
90 pOutVertices[i].vWorldPosition.z = pVertices[i].vWorldPosition.z;
Ritor1
parents:
diff changeset
91
Ritor1
parents:
diff changeset
92 pOutVertices[i].u = pVertices[i].u + a5->pDeltaUV[0];
Ritor1
parents:
diff changeset
93 pOutVertices[i].v = pVertices[i].v + a5->pDeltaUV[1];
Ritor1
parents:
diff changeset
94 }
Ritor1
parents:
diff changeset
95 ViewTransform(pOutVertices, uNumVertices);
Ritor1
parents:
diff changeset
96 }
Ritor1
parents:
diff changeset
97
Ritor1
parents:
diff changeset
98 //----- (0043669D) --------------------------------------------------------
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
99 bool IndoorCameraD3D::ApplyViewTransform_TrueIfStillVisible_BLV(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow)
0
Ritor1
parents:
diff changeset
100 {
Ritor1
parents:
diff changeset
101 int to_z; // esi@2
Ritor1
parents:
diff changeset
102 int v9; // ecx@3
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
103 //signed int *v10; // esi@5
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
104 //int pOutY_; // ecx@5
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
105 //signed int v12; // esi@7
0
Ritor1
parents:
diff changeset
106 int v14; // [sp+8h] [bp-4h]@3
Ritor1
parents:
diff changeset
107 int to_x; // [sp+14h] [bp+8h]@1
Ritor1
parents:
diff changeset
108 int to_y; // [sp+18h] [bp+Ch]@1
Ritor1
parents:
diff changeset
109 int a2b; // [sp+18h] [bp+Ch]@5
Ritor1
parents:
diff changeset
110 int a3a; // [sp+1Ch] [bp+10h]@5
Ritor1
parents:
diff changeset
111
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
112 to_x = x - pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
113 to_y = y - pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
114 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
115 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
116 to_z = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
117 //if ( pRenderer->pRenderD3D )
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
118 //{
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
119 v14 = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y)
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
120 + (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
121 v9 = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y)
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
122 - (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
123 //}
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
124 a3a = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2155
diff changeset
125 *pOutX = fixpoint_mul(v14, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(to_z, pGame->pIndoorCameraD3D->int_sine_x);
0
Ritor1
parents:
diff changeset
126 *pOutZ = v9;
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2155
diff changeset
127 *pOutY = fixpoint_mul(v14, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(a3a, pGame->pIndoorCameraD3D->int_cosine_x);
0
Ritor1
parents:
diff changeset
128 }
Ritor1
parents:
diff changeset
129 else
Ritor1
parents:
diff changeset
130 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
131 *pOutY = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
132 //if ( pRenderer->pRenderD3D )
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
133 //{
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
134 //v10 = pOutX;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
135 *pOutX = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y)
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
136 + (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
137 *pOutZ = (unsigned __int64)(to_x * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y)
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
138 - (unsigned __int64)(to_y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
139 //}
0
Ritor1
parents:
diff changeset
140 }
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
141 if (!bDoNotShow)
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
142 return false;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
143
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
144 return *pOutX >= fixpoint_from_int(4, 0) &&
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
145 *pOutX <= fixpoint_from_int(8000, 0);
0
Ritor1
parents:
diff changeset
146 }
Ritor1
parents:
diff changeset
147
Ritor1
parents:
diff changeset
148 //----- (00436455) --------------------------------------------------------
Ritor1
parents:
diff changeset
149 bool IndoorCameraD3D::IsCulled(BLVFace *pFace)
Ritor1
parents:
diff changeset
150 {
Ritor1
parents:
diff changeset
151 RenderVertexSoft v; // [sp+8h] [bp-30h]@1
Ritor1
parents:
diff changeset
152
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
153 //----- (0043648F) --------------------------------------------------------
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
154 auto Vec3_short__to_RenderVertexSoft = [](RenderVertexSoft *_this, Vec3_short_ *a2) -> void
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
155 {
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
156 _this->flt_2C = 0.0;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
157
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
158 _this->vWorldPosition.x = a2->x;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
159 _this->vWorldPosition.y = a2->y;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
160 _this->vWorldPosition.z = a2->z;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
161 };
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
162
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2037
diff changeset
163
0
Ritor1
parents:
diff changeset
164 Vec3_short__to_RenderVertexSoft(&v, &pIndoor->pVertices[*pFace->pVertexIDs]);
Ritor1
parents:
diff changeset
165 return is_face_faced_to_camera(pFace, &v);
Ritor1
parents:
diff changeset
166 }
Ritor1
parents:
diff changeset
167
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
168
0
Ritor1
parents:
diff changeset
169 //----- (00436523) --------------------------------------------------------
Ritor1
parents:
diff changeset
170 void IndoorCameraD3D::ViewTransform(RenderVertexSoft *a1a, unsigned int uNumVertices)
Ritor1
parents:
diff changeset
171 {
Ritor1
parents:
diff changeset
172 if (byte_4D864C && pGame->uFlags & 0x80 ||
Ritor1
parents:
diff changeset
173 uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
174 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
175 float sin_x = fRotationXSine,
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
176 cos_x = fRotationXCosine;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
177 float sin_y = fRotationYSine,
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
178 cos_y = fRotationYCosine;
0
Ritor1
parents:
diff changeset
179
Ritor1
parents:
diff changeset
180 //v4 = uNumVertices;
Ritor1
parents:
diff changeset
181 //v7 = pIndoorCamera->fRotationXSine;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
182 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
183 {
Ritor1
parents:
diff changeset
184
Ritor1
parents:
diff changeset
185 //_EAX = a1a;
Ritor1
parents:
diff changeset
186 for (uint i = 0; i < uNumVertices; ++i)
Ritor1
parents:
diff changeset
187 {
Ritor1
parents:
diff changeset
188 float st0, st1, st2;
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2152
diff changeset
189 //if ( pRenderer->pRenderD3D )
0
Ritor1
parents:
diff changeset
190 {
Ritor1
parents:
diff changeset
191 /*__asm
Ritor1
parents:
diff changeset
192 {
Ritor1
parents:
diff changeset
193 fld [ebp+uNumVertices] // [(a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
194 fmul st, st(3) // [pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
195 fld [ebp+a1] // [(a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
196 fmul st, st(5) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
197 // 1[pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
198 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
199 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
200 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
201 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
202 faddp st(1), st // [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
203 fld [ebp+a1] // [(a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
204 fmul st, st(4) // [pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)] [pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)] [(a1a[i].z - pIndoorCamera->pos.z)] [pIndoorCamera->fRotationXCosine] [pIndoorCamera->fRotationYSine] [pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
205
Ritor1
parents:
diff changeset
206 fld [ebp+uNumVertices] // 0[a1a[i].y - pIndoorCamera->pos.y]
Ritor1
parents:
diff changeset
207 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
208 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
209 // 3[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
210 // 4[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
211 // 5[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
212 // 6[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
213
Ritor1
parents:
diff changeset
214 fmul st, st(6) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
215 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
216 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
217 // 3[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
218 // 4[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
219 // 5[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
220 // 6[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
221
Ritor1
parents:
diff changeset
222 fsubp st(1), st // 0[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
223 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) + pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
224 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
225 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
226 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
227 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
228 }*/
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
229 st0 = sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
230 st1 = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
231 st2 = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z);
0
Ritor1
parents:
diff changeset
232 }
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2152
diff changeset
233 if (false)//else
0
Ritor1
parents:
diff changeset
234 {
Ritor1
parents:
diff changeset
235 /*__asm
Ritor1
parents:
diff changeset
236 {
Ritor1
parents:
diff changeset
237 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
238 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
239 // 2[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
240 // 3[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
241 // 4[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
242 fmul st, st(4) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
243 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
244 // 2[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
245 // 3[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
246 // 4[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
247 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
248 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
249 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
250 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
251 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
252 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
253 fmul st, st(4) // 0[pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
254 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
255 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
256 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
257 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
258 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
259 fsubp st(1), st // 0[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
260 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
261 // 2[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
262 // 3[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
263 // 4[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
264 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
265 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
266 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
267 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
268 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
269 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
270 fmul st, st(4) // 0[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
271 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
272 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
273 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
274 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
275 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
276 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
277 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
278 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
279 // 3[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
280 // 4[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
281 // 5[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
282 // 6[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
283 fmul st, st(6) // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
284 // 1[pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
285 // 2[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
286 // 3[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
287 // 4[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
288 // 5[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
289 // 6[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
290 faddp st(1), st // 0[pIndoorCamera->fRotationYCosine * (a1a[i].y - pIndoorCamera->pos.y) + pIndoorCamera->fRotationYSine * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
291 // 1[pIndoorCamera->fRotationYCosine * (a1a[i].x - pIndoorCamera->pos.x) - pIndoorCamera->fRotationYSine * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
292 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
293 // 3[pIndoorCamera->fRotationXCosine]
Ritor1
parents:
diff changeset
294 // 4[pIndoorCamera->fRotationYSine]
Ritor1
parents:
diff changeset
295 // 5[pIndoorCamera->fRotationYCosine]
Ritor1
parents:
diff changeset
296 }*/
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
297 st0 = cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
298 st1 = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
299 st2 = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z);
0
Ritor1
parents:
diff changeset
300 }
Ritor1
parents:
diff changeset
301
Ritor1
parents:
diff changeset
302 a1a[i].vWorldViewPosition.x = st1*cos_x - st2*sin_x;
Ritor1
parents:
diff changeset
303 a1a[i].vWorldViewPosition.y = st0;
Ritor1
parents:
diff changeset
304 a1a[i].vWorldViewPosition.z = st2*cos_x + st1*sin_x;
Ritor1
parents:
diff changeset
305 }
Ritor1
parents:
diff changeset
306 }
Ritor1
parents:
diff changeset
307 else
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 for (uint i = 0; i < uNumVertices; ++i)
Ritor1
parents:
diff changeset
310 {
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2152
diff changeset
311 //if ( pRenderer->pRenderD3D )
0
Ritor1
parents:
diff changeset
312 {
Ritor1
parents:
diff changeset
313 /*__asm
Ritor1
parents:
diff changeset
314 {
Ritor1
parents:
diff changeset
315 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
316 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
317 // 2[sin_y]
Ritor1
parents:
diff changeset
318 // 3[cos_y]
Ritor1
parents:
diff changeset
319 fmul st, st(2) // 0[sin_y * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
320 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
321 // 2[sin_y]
Ritor1
parents:
diff changeset
322 // 3[cos_y]
Ritor1
parents:
diff changeset
323 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
324 // 1[sin_y * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
325 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
326 // 3[sin_y]
Ritor1
parents:
diff changeset
327 // 4[cos_y]
Ritor1
parents:
diff changeset
328 fmul st, st(4) // 0[cos_y * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
329 // 1[sin_y * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
330 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
331 // 3[sin_y]
Ritor1
parents:
diff changeset
332 // 4[cos_y]
Ritor1
parents:
diff changeset
333 faddp st(1), st // 0[cos_y * (a1a[i].x - pIndoorCamera->pos.x) + sin_y * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
334 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
335 // 2[sin_y]
Ritor1
parents:
diff changeset
336 // 3[cos_y]
Ritor1
parents:
diff changeset
337 fstp dword ptr [eax+0Ch]
Ritor1
parents:
diff changeset
338 fld [ebp+a1] // 0[(a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
339 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
340 // 2[sin_y]
Ritor1
parents:
diff changeset
341 // 3[cos_y]
Ritor1
parents:
diff changeset
342 fmul st, st(2) // 0[sin_y * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
343 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
344 // 2[sin_y]
Ritor1
parents:
diff changeset
345 // 3[cos_y]
Ritor1
parents:
diff changeset
346 fld [ebp+uNumVertices] // 0[(a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
347 // 1[sin_y * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
348 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
349 // 3[sin_y]
Ritor1
parents:
diff changeset
350 // 4[cos_y]
Ritor1
parents:
diff changeset
351 fmul st, st(4) // 0[cos_y * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
352 // 1[sin_y * (a1a[i].x - pIndoorCamera->pos.x)]
Ritor1
parents:
diff changeset
353 // 2[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
354 // 3[sin_y]
Ritor1
parents:
diff changeset
355 // 4[cos_y]
Ritor1
parents:
diff changeset
356 fsubp st(1), st // 0[sin_y * (a1a[i].x - pIndoorCamera->pos.x) - cos_y * (a1a[i].y - pIndoorCamera->pos.y)]
Ritor1
parents:
diff changeset
357 // 1[(a1a[i].z - pIndoorCamera->pos.z)]
Ritor1
parents:
diff changeset
358 // 2[sin_y]
Ritor1
parents:
diff changeset
359 // 3[cos_y]
Ritor1
parents:
diff changeset
360 fstp dword ptr [eax+10h]
Ritor1
parents:
diff changeset
361 fstp dword ptr [eax+14h]
Ritor1
parents:
diff changeset
362 }*/
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
363 a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
364 a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
365 a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z);
0
Ritor1
parents:
diff changeset
366 }
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2152
diff changeset
367 if (false)//else
0
Ritor1
parents:
diff changeset
368 {
Ritor1
parents:
diff changeset
369 __debugbreak();
Ritor1
parents:
diff changeset
370 /*__asm
Ritor1
parents:
diff changeset
371 {
Ritor1
parents:
diff changeset
372 fld [ebp+a1]
Ritor1
parents:
diff changeset
373 fmul st, st(3)
Ritor1
parents:
diff changeset
374 fld [ebp+uNumVertices]
Ritor1
parents:
diff changeset
375 fmul st, st(3)
Ritor1
parents:
diff changeset
376 fsubp st(1), st
Ritor1
parents:
diff changeset
377 fstp dword ptr [eax+0Ch]
Ritor1
parents:
diff changeset
378 fld [ebp+a1]
Ritor1
parents:
diff changeset
379 fmul st, st(2)
Ritor1
parents:
diff changeset
380 fld [ebp+uNumVertices]
Ritor1
parents:
diff changeset
381 fmul st, st(4)
Ritor1
parents:
diff changeset
382 faddp st(1), st
Ritor1
parents:
diff changeset
383
Ritor1
parents:
diff changeset
384 fstp dword ptr [eax+10h]
Ritor1
parents:
diff changeset
385 fstp dword ptr [eax+14h]
Ritor1
parents:
diff changeset
386 }*/
Ritor1
parents:
diff changeset
387 }
Ritor1
parents:
diff changeset
388 }
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390 }
Ritor1
parents:
diff changeset
391 else for (uint i = 0; i < uNumVertices; ++i)
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
392 //pIndoorCamera->ViewTransform_ODM(a1a + i);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
393 {
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
394 //ViewTransform_ODM(a1a + i);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
395
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1642
diff changeset
396 RenderVertexSoft* a1 = &a1a[i];
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
397 //----- (00481CCE) --------------------------------------------------------
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
398 //void ViewTransform_ODM(RenderVertexSoft *a1)
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
399 {
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
400 float result; // eax@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
401 double vCamToVertexZ; // st7@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
402 double v3; // st6@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
403 double v4; // st5@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
404 double v5; // st4@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
405 float v6; // ST04_4@3
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
406 float v7; // [sp+0h] [bp-14h]@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
407 float v8; // [sp+8h] [bp-Ch]@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
408 float vCamToVertexX; // [sp+Ch] [bp-8h]@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
409 float vCamToVertexY; // [sp+10h] [bp-4h]@1
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
410
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
411 v8 = fRotationXCosine;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
412 result = fRotationXSine;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
413 v7 = fRotationXSine;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
414 vCamToVertexX = a1->vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
415 vCamToVertexY = a1->vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
416 vCamToVertexZ = a1->vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
417 v3 = fRotationYCosine;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
418 v4 = fRotationYSine;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
419 v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
420 if (pGame->pIndoorCameraD3D->sRotationX)
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
421 {
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
422 v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
423 a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
424 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
425 a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
426 }
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
427 else
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
428 {
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
429 a1->vWorldViewPosition.x = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
430 a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
431 a1->vWorldViewPosition.z = vCamToVertexZ;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
432 }
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
433 }
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
434 }
0
Ritor1
parents:
diff changeset
435 }
Ritor1
parents:
diff changeset
436
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
437
0
Ritor1
parents:
diff changeset
438 //----- (00436932) --------------------------------------------------------
Ritor1
parents:
diff changeset
439 bool IndoorCameraD3D::GetFacetOrientation(char polyType, Vec3_float_ *a2, Vec3_float_ *a3, Vec3_float_ *a4)
Ritor1
parents:
diff changeset
440 {
Ritor1
parents:
diff changeset
441 switch ((PolygonType)polyType)
Ritor1
parents:
diff changeset
442 {
Ritor1
parents:
diff changeset
443 case POLYGON_VerticalWall:
Ritor1
parents:
diff changeset
444 {
Ritor1
parents:
diff changeset
445 a4->x = -a2->y;
Ritor1
parents:
diff changeset
446 a4->y = a2->x;
Ritor1
parents:
diff changeset
447 a4->z = 0.0;
Ritor1
parents:
diff changeset
448
Ritor1
parents:
diff changeset
449 a3->x = 0.0;
Ritor1
parents:
diff changeset
450 a3->y = 0.0;
Ritor1
parents:
diff changeset
451 a3->z = 1.0f;
Ritor1
parents:
diff changeset
452 }
Ritor1
parents:
diff changeset
453 return true;
Ritor1
parents:
diff changeset
454
Ritor1
parents:
diff changeset
455 case POLYGON_Floor:
Ritor1
parents:
diff changeset
456 case POLYGON_Ceiling:
Ritor1
parents:
diff changeset
457 {
Ritor1
parents:
diff changeset
458 a4->x = 1.0;
Ritor1
parents:
diff changeset
459 a4->y = 0.0;
Ritor1
parents:
diff changeset
460 a4->z = 0.0;
Ritor1
parents:
diff changeset
461
Ritor1
parents:
diff changeset
462 a3->x = 0.0;
Ritor1
parents:
diff changeset
463 a3->y = 1.0;
Ritor1
parents:
diff changeset
464 a3->z = 0.0;
Ritor1
parents:
diff changeset
465 }
Ritor1
parents:
diff changeset
466 return true;
Ritor1
parents:
diff changeset
467
Ritor1
parents:
diff changeset
468 case POLYGON_InBetweenFloorAndWall:
Ritor1
parents:
diff changeset
469 case POLYGON_InBetweenCeilingAndWall:
Ritor1
parents:
diff changeset
470 {
Ritor1
parents:
diff changeset
471 if (fabs(a2->z) < 0.70811361)
Ritor1
parents:
diff changeset
472 {
Ritor1
parents:
diff changeset
473 a4->x = -a2->y;
Ritor1
parents:
diff changeset
474 a4->y = a2->x;
Ritor1
parents:
diff changeset
475 a4->z = 0.0;
Ritor1
parents:
diff changeset
476 a4->Normalize();
Ritor1
parents:
diff changeset
477
Ritor1
parents:
diff changeset
478 a3->x = 0.0;
Ritor1
parents:
diff changeset
479 a3->y = 0.0;
Ritor1
parents:
diff changeset
480 a3->z = 1.0;
Ritor1
parents:
diff changeset
481 }
Ritor1
parents:
diff changeset
482 else
Ritor1
parents:
diff changeset
483 {
Ritor1
parents:
diff changeset
484 a4->x = 1.0;
Ritor1
parents:
diff changeset
485 a4->y = 0.0;
Ritor1
parents:
diff changeset
486 a4->z = 0.0;
Ritor1
parents:
diff changeset
487
Ritor1
parents:
diff changeset
488 a3->x = 0.0;
Ritor1
parents:
diff changeset
489 a3->y = 1.0;
Ritor1
parents:
diff changeset
490 a3->z = 0.0;
Ritor1
parents:
diff changeset
491 }
Ritor1
parents:
diff changeset
492 }
Ritor1
parents:
diff changeset
493 return true;
Ritor1
parents:
diff changeset
494
Ritor1
parents:
diff changeset
495 default:
Ritor1
parents:
diff changeset
496 return false;
Ritor1
parents:
diff changeset
497 }
Ritor1
parents:
diff changeset
498 }
Ritor1
parents:
diff changeset
499
Ritor1
parents:
diff changeset
500 //----- (00438258) --------------------------------------------------------
Ritor1
parents:
diff changeset
501 bool IndoorCameraD3D::is_face_faced_to_camera(BLVFace *pFace, RenderVertexSoft *a2)
Ritor1
parents:
diff changeset
502 {
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 168
diff changeset
503 if (pFace->Portal())
0
Ritor1
parents:
diff changeset
504 return false;
Ritor1
parents:
diff changeset
505
Ritor1
parents:
diff changeset
506 //really strange cull; dot(to_cam, normal) < 0 means we see the BACK face, not font %_%
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
507 if ( (a2->vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
508 + (a2->vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
509 + (a2->vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0)
0
Ritor1
parents:
diff changeset
510 return false;
Ritor1
parents:
diff changeset
511
Ritor1
parents:
diff changeset
512 return true;
Ritor1
parents:
diff changeset
513 }
Ritor1
parents:
diff changeset
514
Ritor1
parents:
diff changeset
515
Ritor1
parents:
diff changeset
516 //----- (00437AB5) --------------------------------------------------------
2006
30c2b575d25c signed fixes
zipi
parents: 1980
diff changeset
517 void IndoorCameraD3D::do_draw_debug_line_sw(RenderVertexSoft *pLineBegin, signed int sStartDiffuse, RenderVertexSoft *pLineEnd, signed int sEndDiffuse, unsigned int uOutNumVertices, float z_stuff)
0
Ritor1
parents:
diff changeset
518 {
Ritor1
parents:
diff changeset
519 RenderVertexSoft a1[20]; // [sp+8h] [bp-7C4h]@6
Ritor1
parents:
diff changeset
520 RenderVertexSoft pVertices[20]; // [sp+3C8h] [bp-404h]@2
Ritor1
parents:
diff changeset
521 RenderVertexD3D3 v24[2]; // [sp+788h] [bp-44h]@11
Ritor1
parents:
diff changeset
522
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2152
diff changeset
523 //if ( pRenderer->pRenderD3D )
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
524 //{
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
525 for ( uint i = 0; i < 20; i++ )
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
526 pVertices[i].flt_2C = 0.0;
0
Ritor1
parents:
diff changeset
527 if ( (char)uOutNumVertices )
Ritor1
parents:
diff changeset
528 {
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
529 pVertices[0].vWorldViewProjX = pLineBegin->vWorldViewProjX;
0
Ritor1
parents:
diff changeset
530 pVertices[0].vWorldViewProjY = pLineBegin->vWorldViewProjY;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
531
0
Ritor1
parents:
diff changeset
532 pVertices[1].vWorldViewProjX = pLineEnd->vWorldViewProjX;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
533 pVertices[1].vWorldViewProjY = pLineEnd->vWorldViewProjY;
0
Ritor1
parents:
diff changeset
534 v24[0].specular = 0;
Ritor1
parents:
diff changeset
535 v24[0].pos.x = pVertices[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
536 v24[0].pos.y = pVertices[0].vWorldViewProjY;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
537 v24[0].pos.z = 0.001 - z_stuff;
2006
30c2b575d25c signed fixes
zipi
parents: 1980
diff changeset
538 v24[0].diffuse = sStartDiffuse;
0
Ritor1
parents:
diff changeset
539 v24[0].rhw = 0.001;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
540 v24[0].texcoord.x = 0.0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
541 v24[0].texcoord.y = 0.0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
542
0
Ritor1
parents:
diff changeset
543 v24[1].pos.x = pVertices[1].vWorldViewProjX;
Ritor1
parents:
diff changeset
544 v24[1].pos.y = pVertices[1].vWorldViewProjY;
2006
30c2b575d25c signed fixes
zipi
parents: 1980
diff changeset
545 v24[1].diffuse = sEndDiffuse;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
546 v24[1].pos.z = 0.001 - z_stuff;
0
Ritor1
parents:
diff changeset
547 v24[1].specular = 0;
Ritor1
parents:
diff changeset
548 v24[1].rhw = 0.001;
Ritor1
parents:
diff changeset
549 v24[1].texcoord.x = 0.0;
Ritor1
parents:
diff changeset
550 v24[1].texcoord.y = 0.0;
Ritor1
parents:
diff changeset
551 //v19 = pRenderer->pRenderD3D->pDevice;
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
552 pRenderer->DrawLines(v24, 2);
0
Ritor1
parents:
diff changeset
553 return;
Ritor1
parents:
diff changeset
554 }
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
555 for ( uint i = 0; i < 20; i++ )
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
556 a1[i].flt_2C = 0.0;
0
Ritor1
parents:
diff changeset
557 uOutNumVertices = 2;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
558 a1[0].vWorldPosition.x = pLineBegin->vWorldPosition.x;
0
Ritor1
parents:
diff changeset
559 a1[0].vWorldPosition.y = pLineBegin->vWorldPosition.y;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
560 a1[0].vWorldPosition.z = pLineBegin->vWorldPosition.z;
0
Ritor1
parents:
diff changeset
561 a1[1].vWorldPosition.x = pLineEnd->vWorldPosition.x;
Ritor1
parents:
diff changeset
562 a1[1].vWorldPosition.y = pLineEnd->vWorldPosition.y;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
563 a1[1].vWorldPosition.z = pLineEnd->vWorldPosition.z;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
564 if ( CalcPortalShape(a1, &uOutNumVertices, pVertices, this->std__vector_000034_prolly_frustrum, 4, 1, 0) != 1 || (signed int)uOutNumVertices >= 2 )
0
Ritor1
parents:
diff changeset
565 {
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
566 ViewTransform(pVertices, 2);
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
567 Project(pVertices, 2, 0);
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
568 v24[0].specular = 0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
569 v24[0].pos.x = pVertices[0].vWorldViewProjX;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
570 v24[0].pos.y = pVertices[0].vWorldViewProjY;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
571 v24[0].pos.z = 0.001 - z_stuff;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
572 v24[0].diffuse = sStartDiffuse;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
573 v24[0].rhw = 0.001;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
574 v24[0].texcoord.x = 0.0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
575 v24[0].texcoord.y = 0.0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
576
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
577 v24[1].pos.x = pVertices[1].vWorldViewProjX;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
578 v24[1].pos.y = pVertices[1].vWorldViewProjY;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
579 v24[1].diffuse = sEndDiffuse;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
580 v24[1].pos.z = 0.001 - z_stuff;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
581 v24[1].specular = 0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
582 v24[1].rhw = 0.001;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
583 v24[1].texcoord.x = 0.0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
584 v24[1].texcoord.y = 0.0;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
585 //v19 = pRenderer->pRenderD3D->pDevice;
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
586 pRenderer->DrawLines(v24, 2);
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
587 return;
0
Ritor1
parents:
diff changeset
588 }
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
589 //}
0
Ritor1
parents:
diff changeset
590 }
Ritor1
parents:
diff changeset
591
Ritor1
parents:
diff changeset
592 //----- (00437A55) --------------------------------------------------------
Ritor1
parents:
diff changeset
593 void IndoorCameraD3D::debug_outline_d3d(const RenderVertexD3D3 *pLineVertices, unsigned int uNumLines, int uDiffuse, float z_stuff)
Ritor1
parents:
diff changeset
594 {
Ritor1
parents:
diff changeset
595 unsigned int v5; // esi@1
Ritor1
parents:
diff changeset
596 const RenderVertexD3D3 *v6; // ecx@2
Ritor1
parents:
diff changeset
597 unsigned int v7; // ebx@2
Ritor1
parents:
diff changeset
598 const RenderVertexD3D3 *v8; // edi@3
Ritor1
parents:
diff changeset
599
Ritor1
parents:
diff changeset
600 v5 = 0;
Ritor1
parents:
diff changeset
601 if ( (signed int)(uNumLines - 1) > 0 )
Ritor1
parents:
diff changeset
602 {
Ritor1
parents:
diff changeset
603 v6 = pLineVertices;
Ritor1
parents:
diff changeset
604 v5 = uNumLines - 1;
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
605 for ( v7 = uNumLines - 1; v7; --v7 )
0
Ritor1
parents:
diff changeset
606 {
Ritor1
parents:
diff changeset
607 v8 = v6 + 1;
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
608 pRenderer->do_draw_debug_line_d3d(v6, uDiffuse, v6 + 1, uDiffuse, z_stuff);
0
Ritor1
parents:
diff changeset
609 v6 = v8;
Ritor1
parents:
diff changeset
610 }
Ritor1
parents:
diff changeset
611 }
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
612 pRenderer->do_draw_debug_line_d3d(&pLineVertices[v5], uDiffuse, pLineVertices, uDiffuse, z_stuff);
0
Ritor1
parents:
diff changeset
613 }
Ritor1
parents:
diff changeset
614
Ritor1
parents:
diff changeset
615 //----- (004379EE) --------------------------------------------------------
Ritor1
parents:
diff changeset
616 void IndoorCameraD3D::debug_outline_sw(RenderVertexSoft *a2, unsigned int uNumVertices, unsigned int uDiffuse, float a5)
Ritor1
parents:
diff changeset
617 {
2281
d8b4a36f54a4 AI_RandomMove cleaned
Ritor1
parents: 2277
diff changeset
618 if ( !uNumVertices )
d8b4a36f54a4 AI_RandomMove cleaned
Ritor1
parents: 2277
diff changeset
619 return;
0
Ritor1
parents:
diff changeset
620 if ( (signed int)(uNumVertices - 1) > 0 )
Ritor1
parents:
diff changeset
621 {
2281
d8b4a36f54a4 AI_RandomMove cleaned
Ritor1
parents: 2277
diff changeset
622 for ( uint i = 0; i < uNumVertices - 1; i++ )
d8b4a36f54a4 AI_RandomMove cleaned
Ritor1
parents: 2277
diff changeset
623 do_draw_debug_line_sw(&a2[i], uDiffuse, &a2[i + 1], uDiffuse, 0, a5);
0
Ritor1
parents:
diff changeset
624 }
2281
d8b4a36f54a4 AI_RandomMove cleaned
Ritor1
parents: 2277
diff changeset
625 do_draw_debug_line_sw(&a2[uNumVertices - 1], uDiffuse, a2, uDiffuse, 0, a5);
0
Ritor1
parents:
diff changeset
626 }
Ritor1
parents:
diff changeset
627
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
628
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
629 void IndoorCameraD3D::DebugDrawPortal(BLVFace *pFace)
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
630 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1507
diff changeset
631 Assert(pFace->uNumVertices <= 32);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
632
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
633 RenderVertexSoft sw[32];
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
634 for (uint i = 0; i < pFace->uNumVertices; ++i)
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
635 {
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
636 sw[i].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[i]].x;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
637 sw[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
638 sw[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
639 }
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
640 ViewTransform(sw, pFace->uNumVertices);
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
641 Project(sw, pFace->uNumVertices, 0);
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
642
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
643
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
644
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
645 RenderVertexD3D3 v[32];
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
646 for (uint i = 0; i < pFace->uNumVertices; ++i)
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
647 {
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
648 v[i].pos.x = sw[i].vWorldViewProjX;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
649 v[i].pos.y = sw[i].vWorldViewProjY;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
650 v[i].pos.z = 1.0 - 1.0 / (sw[i].vWorldViewPosition.x * 0.061758894);
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
651 v[i].rhw = 1.0 / sw[i].vWorldViewPosition.x;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
652 v[i].diffuse = 0x80F020F0;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
653 v[i].specular = 0;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
654 //v[i].texcoord.x = pFace->pVertexUIDs[i] / (double)pTex->uTextureWidth;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
655 //v[i].texcoord.y = pFace->pVertexUIDs[i] / (double)pTex->uTextureHeight;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
656 v[i].texcoord.x = 0;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
657 v[i].texcoord.y = 0;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
658 }
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
659
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
660 pRenderer->DrawFansTransparent(v, pFace->uNumVertices);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
661 }
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 781
diff changeset
662
0
Ritor1
parents:
diff changeset
663 //----- (00437906) --------------------------------------------------------
Ritor1
parents:
diff changeset
664 void IndoorCameraD3D::PrepareAndDrawDebugOutline(BLVFace *pFace, unsigned int uDiffuse)
Ritor1
parents:
diff changeset
665 {
Ritor1
parents:
diff changeset
666 static RenderVertexSoft static_sub_437906_array_50CDD0[64];
Ritor1
parents:
diff changeset
667 static bool __init_flag1 = false;
Ritor1
parents:
diff changeset
668 if (!__init_flag1)
Ritor1
parents:
diff changeset
669 {
Ritor1
parents:
diff changeset
670 __init_flag1 = true;
Ritor1
parents:
diff changeset
671
Ritor1
parents:
diff changeset
672 for (uint i = 0; i < 64; ++i)
Ritor1
parents:
diff changeset
673 static_sub_437906_array_50CDD0[i].flt_2C = 0.0f;
Ritor1
parents:
diff changeset
674 }
Ritor1
parents:
diff changeset
675 if ( pFace->uNumVertices )
Ritor1
parents:
diff changeset
676 {
1507
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
677 for ( uint i = 0; i < pFace->uNumVertices; i++ )
0
Ritor1
parents:
diff changeset
678 {
1507
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
679 static_sub_437906_array_50CDD0[i].vWorldPosition.x = (double)pIndoor->pVertices[pFace->pVertexIDs[i]].x;
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
680 static_sub_437906_array_50CDD0[i].vWorldPosition.y = (double)pIndoor->pVertices[pFace->pVertexIDs[i]].y;
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
681 static_sub_437906_array_50CDD0[i].vWorldPosition.z = (double)pIndoor->pVertices[pFace->pVertexIDs[i]].z;
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
682 static_sub_437906_array_50CDD0[i].u = (double)pFace->pVertexUIDs[i];
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
683 static_sub_437906_array_50CDD0[i].v = (double)pFace->pVertexVIDs[i];
0
Ritor1
parents:
diff changeset
684 }
Ritor1
parents:
diff changeset
685 }
2277
b9adf4f414f6 submenu Other
Ritor1
parents: 2253
diff changeset
686 if ( draw_portals_loops )
1507
a109bb203e28 UIGame.cpp cleaning(continue) GameUI_DrawMinimap
Ritor1
parents: 1458
diff changeset
687 debug_outline_sw(static_sub_437906_array_50CDD0, pFace->uNumVertices, uDiffuse, 0.0);
0
Ritor1
parents:
diff changeset
688 }
Ritor1
parents:
diff changeset
689 // 50D9D0: using guessed type char static_sub_437906_byte_50D9D0_init_flag;
Ritor1
parents:
diff changeset
690
Ritor1
parents:
diff changeset
691 //----- (004378BA) --------------------------------------------------------
Ritor1
parents:
diff changeset
692 void IndoorCameraD3D::MatrixMultiply(Matrix3x3_float_ *a1, Matrix3x3_float_ *a2, Matrix3x3_float_ *out)
Ritor1
parents:
diff changeset
693 {
Ritor1
parents:
diff changeset
694 float *v4; // ecx@1
Ritor1
parents:
diff changeset
695 double v10; // st7@3
Ritor1
parents:
diff changeset
696 double v11; // st6@3
Ritor1
parents:
diff changeset
697
Ritor1
parents:
diff changeset
698 v4 = (float *)out;
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
699 for ( uint i = 0; i < 3; i++ )
0
Ritor1
parents:
diff changeset
700 {
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
701 for ( uint j = 0; j < 3; j++ )
0
Ritor1
parents:
diff changeset
702 {
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
703 v10 = a2->v[2][j] * a1->v[i][2] + a2->v[0][j] * a1->v[i][0];
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
704 v11 = a2->v[1][j] * a1->v[i][1];
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
705 *v4 = v10 + v11;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
706 ++v4;
0
Ritor1
parents:
diff changeset
707 }
Ritor1
parents:
diff changeset
708 }
Ritor1
parents:
diff changeset
709 }
Ritor1
parents:
diff changeset
710
Ritor1
parents:
diff changeset
711 //----- (004376E7) --------------------------------------------------------
Ritor1
parents:
diff changeset
712 void IndoorCameraD3D::CreateWorldMatrixAndSomeStuff()
Ritor1
parents:
diff changeset
713 {
Ritor1
parents:
diff changeset
714 //IndoorCameraD3D *v1; // esi@1
Ritor1
parents:
diff changeset
715 double v2; // st7@1
Ritor1
parents:
diff changeset
716 //signed int v3; // edi@1
Ritor1
parents:
diff changeset
717 //int v4; // eax@1
Ritor1
parents:
diff changeset
718 //double v5; // st7@2
Ritor1
parents:
diff changeset
719 //double v6; // st7@3
Ritor1
parents:
diff changeset
720 Matrix3x3_float_ m1; // [sp+10h] [bp-B8h]@1
Ritor1
parents:
diff changeset
721 Matrix3x3_float_ m2; // [sp+34h] [bp-94h]@1
Ritor1
parents:
diff changeset
722 Matrix3x3_float_ m3; // [sp+58h] [bp-70h]@1
Ritor1
parents:
diff changeset
723 Matrix3x3_float_ m4; // [sp+7Ch] [bp-4Ch]@1
Ritor1
parents:
diff changeset
724 Matrix3x3_float_ m5; // [sp+A0h] [bp-28h]@1
Ritor1
parents:
diff changeset
725 float v12; // [sp+C4h] [bp-4h]@1
Ritor1
parents:
diff changeset
726
Ritor1
parents:
diff changeset
727 //RotationZ(0)
Ritor1
parents:
diff changeset
728 m5._11 = cosf(0); m5._12 = sinf(0); m5._13 = 0;
Ritor1
parents:
diff changeset
729 m5._21 = -sinf(0); m5._22 = cosf(0); m5._23 = 0;
Ritor1
parents:
diff changeset
730 m5._31 = 0; m5._32 = 0; m5._33 = 1;
Ritor1
parents:
diff changeset
731
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
732 float cos_x1 = fRotationXCosine,
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
733 sin_x1 = fRotationXSine;
0
Ritor1
parents:
diff changeset
734 //RotationX(x)
Ritor1
parents:
diff changeset
735 m4._11 = 1; m4._12 = 0; m4._13 = 0;
Ritor1
parents:
diff changeset
736 m4._21 = 0; m4._22 = cos_x1; m4._23 = sin_x1;
Ritor1
parents:
diff changeset
737 m4._31 = 0; m4._32 = -sin_x1; m4._33 = cos_x1;
Ritor1
parents:
diff changeset
738
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
739 float cos_y1 = fRotationYCosine,
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
740 sin_y1 = fRotationYSine;
0
Ritor1
parents:
diff changeset
741 //RotationY(some_angle)
Ritor1
parents:
diff changeset
742 m3._11 = cos_y1; m3._12 = 0; m3._13 = -sin_y1;
Ritor1
parents:
diff changeset
743 m3._21 = 0; m3._22 = 1; m3._23 = 0;
Ritor1
parents:
diff changeset
744 m3._31 = sin_y1; m3._32 = 0; m3._33 = cos_y1;
Ritor1
parents:
diff changeset
745
Ritor1
parents:
diff changeset
746 MatrixMultiply(&m5, &m3, &m1);
Ritor1
parents:
diff changeset
747 MatrixMultiply(&m4, &m1, &m2);
Ritor1
parents:
diff changeset
748
Ritor1
parents:
diff changeset
749 for (uint i = 0; i < 3; ++i)
Ritor1
parents:
diff changeset
750 {
Ritor1
parents:
diff changeset
751 field_4[0].v[i] = m2.v[1][i];
Ritor1
parents:
diff changeset
752 field_4[1].v[i] = m2.v[0][i];
Ritor1
parents:
diff changeset
753 field_4[2].v[i] = m2.v[2][i];
Ritor1
parents:
diff changeset
754 }
Ritor1
parents:
diff changeset
755
Ritor1
parents:
diff changeset
756 inv_fov = 1.1344639;
Ritor1
parents:
diff changeset
757 fov_x = (double)pViewport->uScreenWidth * 0.8814736;
Ritor1
parents:
diff changeset
758
Ritor1
parents:
diff changeset
759 fov_y = 0.8814736 * (double)pViewport->uScreenHeight;
Ritor1
parents:
diff changeset
760 fov = fov_y;
Ritor1
parents:
diff changeset
761 if ( fov_x > fov )
Ritor1
parents:
diff changeset
762 fov = fov_x;
Ritor1
parents:
diff changeset
763 screenCenterX = (double)pViewport->uScreenCenterX;
692
066e2b29b30f viewport.cpp added
Gloval
parents: 676
diff changeset
764 screenCenterY = (double)(pViewport->uScreenCenterY - pViewport->uScreen_TL_Y);
0
Ritor1
parents:
diff changeset
765 }
Ritor1
parents:
diff changeset
766
Ritor1
parents:
diff changeset
767 //----- (00437691) --------------------------------------------------------
Ritor1
parents:
diff changeset
768 void IndoorCameraD3D::Vec3Transform(const IndoorCameraD3D_Vec3 *pVector, IndoorCameraD3D_Vec3 *pOut)
Ritor1
parents:
diff changeset
769 {
Ritor1
parents:
diff changeset
770 pOut->y = field_4[1].x * pVector->x + field_4[0].x * pVector->y + field_4[2].x * pVector->z;
Ritor1
parents:
diff changeset
771 pOut->z = field_4[1].y * pVector->x + field_4[0].y * pVector->y + field_4[2].y * pVector->z;
Ritor1
parents:
diff changeset
772 pOut->x = field_4[1].z * pVector->x + field_4[0].z * pVector->y + field_4[2].z * pVector->z;
Ritor1
parents:
diff changeset
773 }
Ritor1
parents:
diff changeset
774
Ritor1
parents:
diff changeset
775 //----- (00437607) --------------------------------------------------------
Ritor1
parents:
diff changeset
776 void IndoorCameraD3D::_437607(IndoorCameraD3D_Vec3 *a1, IndoorCameraD3D_Vec4 *a2)
Ritor1
parents:
diff changeset
777 {
Ritor1
parents:
diff changeset
778 double v4; // st7@1
Ritor1
parents:
diff changeset
779 IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
780
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
781 v8.x = (double)pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
782 v8.y = (double)pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
783 v8.z = (double)pGame->pIndoorCameraD3D->vPartyPos.z;
0
Ritor1
parents:
diff changeset
784 Vec3Transform(a1, a2);
Ritor1
parents:
diff changeset
785
Ritor1
parents:
diff changeset
786 v4 = v8.x * a2->x + v8.y * a2->y + v8.z * a2->z;
Ritor1
parents:
diff changeset
787 a2->dot = v4 + 0.000099999997;
Ritor1
parents:
diff changeset
788 }
Ritor1
parents:
diff changeset
789
Ritor1
parents:
diff changeset
790 //----- (004374E8) --------------------------------------------------------
Ritor1
parents:
diff changeset
791 void IndoorCameraD3D::_4374E8_ProllyBuildFrustrum()
Ritor1
parents:
diff changeset
792 {
Ritor1
parents:
diff changeset
793 //IndoorCameraD3D *v1; // esi@1
Ritor1
parents:
diff changeset
794 //double v2; // st7@1
Ritor1
parents:
diff changeset
795 double v3; // st7@1
Ritor1
parents:
diff changeset
796 //double v4; // st7@1
Ritor1
parents:
diff changeset
797 double v5; // st7@1
Ritor1
parents:
diff changeset
798 //double v6; // st7@1
Ritor1
parents:
diff changeset
799 IndoorCameraD3D_Vec3 v7; // [sp+Ch] [bp-24h]@1
Ritor1
parents:
diff changeset
800 //float v8; // [sp+10h] [bp-20h]@1
Ritor1
parents:
diff changeset
801 //float v9; // [sp+14h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
802 //float v10; // [sp+18h] [bp-18h]@1
Ritor1
parents:
diff changeset
803 //float v11; // [sp+1Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
804 //float v12; // [sp+20h] [bp-10h]@1
Ritor1
parents:
diff changeset
805 //int v13; // [sp+2Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
806
Ritor1
parents:
diff changeset
807 //v1 = this;
Ritor1
parents:
diff changeset
808 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v7);
Ritor1
parents:
diff changeset
809 //v2 = 2.0 / inv_fov;
Ritor1
parents:
diff changeset
810 //v13 = 0;
Ritor1
parents:
diff changeset
811 v3 = atan(2.0 / inv_fov * fov / fov_x);
Ritor1
parents:
diff changeset
812 //v12 = v3;
Ritor1
parents:
diff changeset
813 //v11 = sin(v3);
Ritor1
parents:
diff changeset
814 //v4 = cos(v3);
Ritor1
parents:
diff changeset
815 v7.x = -sin(v3);
Ritor1
parents:
diff changeset
816 v7.y = 0.0;
Ritor1
parents:
diff changeset
817 v7.z = cos(v3);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
818 _437607(&v7, std__vector_000034_prolly_frustrum + 0);
0
Ritor1
parents:
diff changeset
819 v7.x = sin(v3);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
820 _437607(&v7, std__vector_000034_prolly_frustrum + 1);
0
Ritor1
parents:
diff changeset
821 v5 = atan(2.0 / inv_fov * fov / (fov_y + 0.5));
Ritor1
parents:
diff changeset
822 //v12 = v5;
Ritor1
parents:
diff changeset
823 //v11 = sin(v5);
Ritor1
parents:
diff changeset
824 //v6 = cos(v5);
Ritor1
parents:
diff changeset
825 v7.y = sin(v5);
Ritor1
parents:
diff changeset
826 v7.x = 0.0;
Ritor1
parents:
diff changeset
827 v7.z = cos(v5);
Ritor1
parents:
diff changeset
828 _437607(&v7, &std__vector_000034_prolly_frustrum[2]);
Ritor1
parents:
diff changeset
829 v7.y = -sin(v5);
Ritor1
parents:
diff changeset
830 _437607(&v7, &std__vector_000034_prolly_frustrum[3]);
Ritor1
parents:
diff changeset
831 //v13 = -1;
Ritor1
parents:
diff changeset
832 //IndoorCameraD3D_Vec3::dtor(&v7);
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834
Ritor1
parents:
diff changeset
835 //----- (00437376) --------------------------------------------------------
Ritor1
parents:
diff changeset
836 char IndoorCameraD3D::_437376(stru154 *thisa, RenderVertexSoft *a2, unsigned int *pOutNumVertices)
Ritor1
parents:
diff changeset
837 {
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
838 //unsigned int v4; // ebx@1
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
839 //RenderVertexSoft *v5; // edx@2
0
Ritor1
parents:
diff changeset
840 double v6; // st7@3
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
841 //unsigned int v7; // edi@5
0
Ritor1
parents:
diff changeset
842 signed int v8; // esi@6
Ritor1
parents:
diff changeset
843 int v9; // ebx@8
Ritor1
parents:
diff changeset
844 int v10; // eax@8
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
845 //int v11; // ecx@14
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
846 //int v12; // eax@14
0
Ritor1
parents:
diff changeset
847 int v13; // eax@15
Ritor1
parents:
diff changeset
848 signed int v14; // ebx@17
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
849 //RenderVertexSoft *v15; // eax@18
0
Ritor1
parents:
diff changeset
850 unsigned int *v16; // eax@20
Ritor1
parents:
diff changeset
851 char result; // al@24
Ritor1
parents:
diff changeset
852 RenderVertexSoft v18; // [sp+Ch] [bp-34h]@2
Ritor1
parents:
diff changeset
853 int v19; // [sp+3Ch] [bp-4h]@8
Ritor1
parents:
diff changeset
854 signed int thisb; // [sp+48h] [bp+8h]@6
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
855 bool a2_3; // [sp+4Fh] [bp+Fh]@5
0
Ritor1
parents:
diff changeset
856
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
857 //v4 = *pOutNumVertices;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
858 //v5 = a2;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
859 memcpy(&v18, a2, sizeof(v18));
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
860 a2_3 = false;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
861 memcpy(&a2[*pOutNumVertices], a2, sizeof(a2[*pOutNumVertices]));
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
862 memcpy(&a2[*pOutNumVertices + 1], &a2[1], sizeof(a2[*pOutNumVertices + 1]));
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
863 //v7 = *pOutNumVertices;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
864
0
Ritor1
parents:
diff changeset
865 if ( (signed int)*pOutNumVertices <= 3
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
866 || (((v18.vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
867 + (v18.vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
868 + (v18.vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0),
0
Ritor1
parents:
diff changeset
869 (signed int)*pOutNumVertices <= 0) )
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
870 return 0;
0
Ritor1
parents:
diff changeset
871 v8 = 1;
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
872 for ( thisb = 1; thisb - 1 < (signed int)*pOutNumVertices; v8 = thisb )
0
Ritor1
parents:
diff changeset
873 {
Ritor1
parents:
diff changeset
874 v9 = v8 - 1;
Ritor1
parents:
diff changeset
875 v10 = v8 + 1;
Ritor1
parents:
diff changeset
876 v19 = v8 + 1;
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
877 if ( v8 - 1 >= (signed int)*pOutNumVertices )
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
878 v9 -= *pOutNumVertices;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
879 if ( v8 >= (signed int)*pOutNumVertices )
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
880 v8 -= *pOutNumVertices;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
881 if ( v19 >= (signed int)*pOutNumVertices )
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
882 v10 = v19 - *pOutNumVertices;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
883 //v11 = (int)&a2[v10];
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
884 //v12 = (int)&a2[v9];
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
885 if ( -0.009999999776482582 > ((a2[v8].vWorldViewProjX - a2[v9].vWorldViewProjX)
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
886 * (a2[v10].vWorldViewProjY - a2[v9].vWorldViewProjY)
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
887 - (a2[v8].vWorldViewProjY - a2[v9].vWorldViewProjY)
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
888 * (a2[v10].vWorldViewProjX - a2[v9].vWorldViewProjX))
0
Ritor1
parents:
diff changeset
889 * v6 )
Ritor1
parents:
diff changeset
890 {
Ritor1
parents:
diff changeset
891 thisb = v19;
Ritor1
parents:
diff changeset
892 v16 = pOutNumVertices;
Ritor1
parents:
diff changeset
893 }
Ritor1
parents:
diff changeset
894 else
Ritor1
parents:
diff changeset
895 {
Ritor1
parents:
diff changeset
896 v13 = thisb;
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
897 if ( thisb >= (signed int)*pOutNumVertices )
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
898 v13 = thisb - *pOutNumVertices;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
899 if ( v13 < (signed int)*pOutNumVertices )
0
Ritor1
parents:
diff changeset
900 {
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
901 for ( v14 = v13; v14 < (signed int)*pOutNumVertices; ++v14 )
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
902 memcpy(&a2[v14], &a2[v14 + 1], sizeof(a2[v14]));
0
Ritor1
parents:
diff changeset
903 }
Ritor1
parents:
diff changeset
904 v16 = pOutNumVertices;
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
905 a2_3 = true;
0
Ritor1
parents:
diff changeset
906 --*v16;
Ritor1
parents:
diff changeset
907 }
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
908 *pOutNumVertices = *v16;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
909 //if ( thisb - 1 >= (signed int)*v16 )
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
910 //break;
0
Ritor1
parents:
diff changeset
911 }
Ritor1
parents:
diff changeset
912 if ( a2_3 )
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
913 return true;
0
Ritor1
parents:
diff changeset
914 else
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
915 return false;
0
Ritor1
parents:
diff changeset
916 }
Ritor1
parents:
diff changeset
917
Ritor1
parents:
diff changeset
918 //----- (00437285) --------------------------------------------------------
795
472ca68386d4 more stru10 & stru9
Nomad
parents: 791
diff changeset
919 bool IndoorCameraD3D::CalcPortalShape(RenderVertexSoft *a1, unsigned int *pOutNumVertices, RenderVertexSoft *pVertices, IndoorCameraD3D_Vec4 *a4, signed int uNumVertices, char a6, int _unused)
0
Ritor1
parents:
diff changeset
920 {
Ritor1
parents:
diff changeset
921 char *v8; // eax@2
Ritor1
parents:
diff changeset
922 signed int v9; // ecx@2
Ritor1
parents:
diff changeset
923 //bool result; // eax@5
Ritor1
parents:
diff changeset
924 int v11; // ecx@5
Ritor1
parents:
diff changeset
925 //signed int v12; // ecx@6
Ritor1
parents:
diff changeset
926 //char *v13; // esi@6
Ritor1
parents:
diff changeset
927 RenderVertexSoft *v14; // eax@8
Ritor1
parents:
diff changeset
928 RenderVertexSoft *v15; // edx@8
Ritor1
parents:
diff changeset
929 Vec3_float_ a5; // [sp+18h] [bp-3Ch]@12
1317
Ritor1
parents: 1016
diff changeset
930 //float v17; // [sp+44h] [bp-10h]@1
Ritor1
parents: 1016
diff changeset
931 //int v18; // [sp+48h] [bp-Ch]@5
0
Ritor1
parents:
diff changeset
932 //stru9 *thisa; // [sp+4Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
933 int a7a; // [sp+53h] [bp-1h]@5
Ritor1
parents:
diff changeset
934 //bool a6a; // [sp+70h] [bp+1Ch]@5
Ritor1
parents:
diff changeset
935
1317
Ritor1
parents: 1016
diff changeset
936 //v17 = 0.0;
0
Ritor1
parents:
diff changeset
937 //thisa = pGame->pStru9Instance;
Ritor1
parents:
diff changeset
938
Ritor1
parents:
diff changeset
939 static RenderVertexSoft sr_vertices_50D9D8[64];
Ritor1
parents:
diff changeset
940
Ritor1
parents:
diff changeset
941 //result = 0;
Ritor1
parents:
diff changeset
942 a7a = 0;
Ritor1
parents:
diff changeset
943 v11 = 2 * (a6 == 0) + 1;
Ritor1
parents:
diff changeset
944 //a6a = 0;
1317
Ritor1
parents: 1016
diff changeset
945 //v18 = v11;
0
Ritor1
parents:
diff changeset
946 if (uNumVertices <= 0)
Ritor1
parents:
diff changeset
947 return false;
Ritor1
parents:
diff changeset
948
Ritor1
parents:
diff changeset
949 //v12 = *pOutNumVertices;
Ritor1
parents:
diff changeset
950 //v13 = (char *)&a4->y;
1317
Ritor1
parents: 1016
diff changeset
951
Ritor1
parents: 1016
diff changeset
952 //while ( 1 )
Ritor1
parents: 1016
diff changeset
953 for ( uint i = 0; i < uNumVertices; ++i )
Ritor1
parents: 1016
diff changeset
954 {
Ritor1
parents: 1016
diff changeset
955 if (i % 2)
Ritor1
parents: 1016
diff changeset
956 {
Ritor1
parents: 1016
diff changeset
957 v14 = a1;
Ritor1
parents: 1016
diff changeset
958 v15 = sr_vertices_50D9D8;
Ritor1
parents: 1016
diff changeset
959 }
Ritor1
parents: 1016
diff changeset
960 else
0
Ritor1
parents:
diff changeset
961 {
1317
Ritor1
parents: 1016
diff changeset
962 v15 = a1;
Ritor1
parents: 1016
diff changeset
963 v14 = sr_vertices_50D9D8;
0
Ritor1
parents:
diff changeset
964 }
1317
Ritor1
parents: 1016
diff changeset
965 if (i == uNumVertices - 1)
Ritor1
parents: 1016
diff changeset
966 v14 = pVertices;
Ritor1
parents: 1016
diff changeset
967 a5.x = a4[i].x;
Ritor1
parents: 1016
diff changeset
968 a5.y = a4[i].y;
Ritor1
parents: 1016
diff changeset
969 a5.z = a4[i].z;
Ritor1
parents: 1016
diff changeset
970 pGame->pStru9Instance->CalcPortalShape(v15, *pOutNumVertices, v14, pOutNumVertices, &a5, a4[i].dot, (char *)&a7a, _unused);
Ritor1
parents: 1016
diff changeset
971 //v12 = *pOutNumVertices;
Ritor1
parents: 1016
diff changeset
972 if (*pOutNumVertices < v11)
Ritor1
parents: 1016
diff changeset
973 {
Ritor1
parents: 1016
diff changeset
974 *pOutNumVertices = 0;
Ritor1
parents: 1016
diff changeset
975 return true;
Ritor1
parents: 1016
diff changeset
976 }
Ritor1
parents: 1016
diff changeset
977 //result = a6a;
Ritor1
parents: 1016
diff changeset
978 //v13 += 24;
Ritor1
parents: 1016
diff changeset
979 //if (++i >= uNumVertices)
Ritor1
parents: 1016
diff changeset
980 //
Ritor1
parents: 1016
diff changeset
981 }
Ritor1
parents: 1016
diff changeset
982 return a7a;
0
Ritor1
parents:
diff changeset
983 }
Ritor1
parents:
diff changeset
984
Ritor1
parents:
diff changeset
985 //----- (004371C3) --------------------------------------------------------
Ritor1
parents:
diff changeset
986 bool IndoorCameraD3D::_4371C3(RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, int _unused)
Ritor1
parents:
diff changeset
987 {
Ritor1
parents:
diff changeset
988 char *v4; // eax@2
Ritor1
parents:
diff changeset
989 signed int v5; // ecx@2
Ritor1
parents:
diff changeset
990 RenderVertexSoft *v6; // esi@5
Ritor1
parents:
diff changeset
991 unsigned int *v7; // edi@5
Ritor1
parents:
diff changeset
992 char *v8; // ecx@6
Ritor1
parents:
diff changeset
993 int v9; // eax@6
Ritor1
parents:
diff changeset
994 IndoorCameraD3D *thisa; // [sp+0h] [bp-Ch]@1
Ritor1
parents:
diff changeset
995 signed int v12; // [sp+4h] [bp-8h]@5
Ritor1
parents:
diff changeset
996 unsigned int pVerticesa; // [sp+14h] [bp+8h]@6
Ritor1
parents:
diff changeset
997 unsigned int pOutNumVerticesa; // [sp+18h] [bp+Ch]@6
Ritor1
parents:
diff changeset
998
Ritor1
parents:
diff changeset
999 thisa = this;
Ritor1
parents:
diff changeset
1000
Ritor1
parents:
diff changeset
1001
Ritor1
parents:
diff changeset
1002 static RenderVertexSoft static_4371C3_array_50E5E0[64];
Ritor1
parents:
diff changeset
1003 static bool __init_flag1 = false;
Ritor1
parents:
diff changeset
1004 if (!__init_flag1)
Ritor1
parents:
diff changeset
1005 {
Ritor1
parents:
diff changeset
1006 __init_flag1 = true;
Ritor1
parents:
diff changeset
1007
Ritor1
parents:
diff changeset
1008 for (uint i = 0; i < 64; ++i)
Ritor1
parents:
diff changeset
1009 static_4371C3_array_50E5E0[i].flt_2C = 0.0f;
Ritor1
parents:
diff changeset
1010 }
Ritor1
parents:
diff changeset
1011
Ritor1
parents:
diff changeset
1012 v12 = 0;
Ritor1
parents:
diff changeset
1013 v6 = pVertices;
Ritor1
parents:
diff changeset
1014 v7 = pOutNumVertices;
Ritor1
parents:
diff changeset
1015 if ( (signed int)*pOutNumVertices > 0 )
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 pOutNumVerticesa = (char *)static_4371C3_array_50E5E0 - (char *)pVertices;
Ritor1
parents:
diff changeset
1018 pVerticesa = (char *)&static_4371C3_array_50E5E0[0].vWorldViewProjY - (char *)pVertices;
Ritor1
parents:
diff changeset
1019 v8 = (char *)&static_4371C3_array_50E5E0[0].vWorldPosition.y;
Ritor1
parents:
diff changeset
1020 v9 = (int)&v6->vWorldPosition.z;
Ritor1
parents:
diff changeset
1021 do
Ritor1
parents:
diff changeset
1022 {
Ritor1
parents:
diff changeset
1023 ++v12;
Ritor1
parents:
diff changeset
1024 *((int *)v8 - 1) = *(int *)(v9 - 8);
Ritor1
parents:
diff changeset
1025 *(int *)v8 = *(int *)(v9 - 4);
Ritor1
parents:
diff changeset
1026 v8 += 48;
Ritor1
parents:
diff changeset
1027 *(float *)(pOutNumVerticesa + v9) = *(float *)v9;
Ritor1
parents:
diff changeset
1028 *(float *)(pVerticesa + v9) = *(float *)(v9 + 28);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 96
diff changeset
1029 *(float *)((char *)&static_4371C3_array_50E5E0[0]._rhw - (char *)v6 + v9) = *(float *)(v9 + 32);
0
Ritor1
parents:
diff changeset
1030 v9 += 48;
Ritor1
parents:
diff changeset
1031 }
Ritor1
parents:
diff changeset
1032 while ( v12 < (signed int)*v7 );
Ritor1
parents:
diff changeset
1033 }
795
472ca68386d4 more stru10 & stru9
Nomad
parents: 791
diff changeset
1034 return CalcPortalShape(
0
Ritor1
parents:
diff changeset
1035 static_4371C3_array_50E5E0,
Ritor1
parents:
diff changeset
1036 v7,
Ritor1
parents:
diff changeset
1037 v6,
Ritor1
parents:
diff changeset
1038 thisa->std__vector_000034_prolly_frustrum,
Ritor1
parents:
diff changeset
1039 4,
Ritor1
parents:
diff changeset
1040 0,
Ritor1
parents:
diff changeset
1041 _unused);
Ritor1
parents:
diff changeset
1042 }
Ritor1
parents:
diff changeset
1043 // 50F1E0: using guessed type char static_sub_4371C3_byte_50F1E0_init_flags;
Ritor1
parents:
diff changeset
1044
Ritor1
parents:
diff changeset
1045 //----- (00437143) --------------------------------------------------------
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1046 void IndoorCameraD3D::_437143(unsigned int uNumInVertices, RenderVertexSoft *pOutVertices, RenderVertexSoft *pInVertices, unsigned int *pOutNumVertices)
0
Ritor1
parents:
diff changeset
1047 {
Ritor1
parents:
diff changeset
1048 double v9; // st7@3
Ritor1
parents:
diff changeset
1049
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1050 uint i = 0;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1051
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1052 for ( i; i < uNumInVertices; ++i )
0
Ritor1
parents:
diff changeset
1053 {
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1054 pInVertices[i]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001);
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1055 memcpy(&pOutVertices[i], &pInVertices[i], sizeof(pOutVertices[i]));
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1056 v9 = (double)pODMRenderParams->int_fov_rad * pInVertices[i]._rhw;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1057 pOutVertices[i].vWorldViewProjX = (double)pViewport->uScreenCenterX - v9 * pInVertices[i].vWorldViewPosition.y;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1058 pOutVertices[i].vWorldViewProjY = (double)pViewport->uScreenCenterY - v9 * pInVertices[i].vWorldViewPosition.z;
0
Ritor1
parents:
diff changeset
1059 }
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1060 *pOutNumVertices = i;
8817c398b792 for RasterLine2D
Ritor1
parents: 2216
diff changeset
1061 return;
0
Ritor1
parents:
diff changeset
1062 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 693
diff changeset
1063
0
Ritor1
parents:
diff changeset
1064 //----- (00436F09) --------------------------------------------------------
Ritor1
parents:
diff changeset
1065 void IndoorCameraD3D::_436F09_mess_with_lightmap__clipflag_4(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
Ritor1
parents:
diff changeset
1066 {
Ritor1
parents:
diff changeset
1067 unsigned int *pOutNumVertices_; // ebx@1
Ritor1
parents:
diff changeset
1068 double v6; // st7@2
Ritor1
parents:
diff changeset
1069 signed int v7; // esi@2
Ritor1
parents:
diff changeset
1070 char *v8; // edx@5
Ritor1
parents:
diff changeset
1071 unsigned int v9; // eax@10
Ritor1
parents:
diff changeset
1072 RenderVertexSoft *v10; // ecx@11
Ritor1
parents:
diff changeset
1073 double v11; // st6@11
Ritor1
parents:
diff changeset
1074 double v12; // st6@12
Ritor1
parents:
diff changeset
1075 unsigned int v13; // edi@14
Ritor1
parents:
diff changeset
1076 unsigned __int8 v14; // c2@16
Ritor1
parents:
diff changeset
1077 unsigned __int8 v15; // c3@16
Ritor1
parents:
diff changeset
1078 unsigned int v16; // edi@17
Ritor1
parents:
diff changeset
1079 bool a1a; // [sp+Ch] [bp+8h]@7
Ritor1
parents:
diff changeset
1080 int a4a; // [sp+18h] [bp+14h]@5
Ritor1
parents:
diff changeset
1081
Ritor1
parents:
diff changeset
1082 pOutNumVertices_ = pOutNumVertices;
Ritor1
parents:
diff changeset
1083 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
1084 if ( uNumInVertices )
Ritor1
parents:
diff changeset
1085 {
Ritor1
parents:
diff changeset
1086 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1545
diff changeset
1087 v6 = (double)pODMRenderParams->shading_dist_mist;
0
Ritor1
parents:
diff changeset
1088 v7 = 0;
Ritor1
parents:
diff changeset
1089 if ( v6 >= pInVertices->vWorldViewPosition.x )
Ritor1
parents:
diff changeset
1090 v7 = 1;
Ritor1
parents:
diff changeset
1091 if ( uNumInVertices + 1 > 1 )
Ritor1
parents:
diff changeset
1092 {
Ritor1
parents:
diff changeset
1093 a4a = uNumInVertices;
Ritor1
parents:
diff changeset
1094 v8 = (char *)&pInVertices[1].u;
Ritor1
parents:
diff changeset
1095 do
Ritor1
parents:
diff changeset
1096 {
Ritor1
parents:
diff changeset
1097 a1a = v6 >= *((float *)v8 - 6);
Ritor1
parents:
diff changeset
1098 if ( v7 == a1a )
Ritor1
parents:
diff changeset
1099 {
Ritor1
parents:
diff changeset
1100 v10 = pOutVertices;
Ritor1
parents:
diff changeset
1101 goto LABEL_23;
Ritor1
parents:
diff changeset
1102 }
Ritor1
parents:
diff changeset
1103 v9 = *pOutNumVertices_;
Ritor1
parents:
diff changeset
1104 if ( a1a )
Ritor1
parents:
diff changeset
1105 {
Ritor1
parents:
diff changeset
1106 v10 = pOutVertices;
Ritor1
parents:
diff changeset
1107 v11 = (v6 - *((float *)v8 - 18)) / (*((float *)v8 - 6) - *((float *)v8 - 18));
Ritor1
parents:
diff changeset
1108 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 5) - *((float *)v8 - 17)) * v11 + *((float *)v8 - 17);
Ritor1
parents:
diff changeset
1109 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 4) - *((float *)v8 - 16)) * v11
Ritor1
parents:
diff changeset
1110 + *((float *)v8 - 16);
Ritor1
parents:
diff changeset
1111 pOutVertices[*pOutNumVertices_].u = (*(float *)v8 - *((float *)v8 - 12)) * v11 + *((float *)v8 - 12);
Ritor1
parents:
diff changeset
1112 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 + 1) - *((float *)v8 - 11)) * v11 + *((float *)v8 - 11);
Ritor1
parents:
diff changeset
1113 }
Ritor1
parents:
diff changeset
1114 else
Ritor1
parents:
diff changeset
1115 {
Ritor1
parents:
diff changeset
1116 v12 = (v6 - *((float *)v8 - 6)) / (*((float *)v8 - 18) - *((float *)v8 - 6));
Ritor1
parents:
diff changeset
1117 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 17) - *((float *)v8 - 5)) * v12 + *((float *)v8 - 5);
Ritor1
parents:
diff changeset
1118 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 16) - *((float *)v8 - 4)) * v12
Ritor1
parents:
diff changeset
1119 + *((float *)v8 - 4);
Ritor1
parents:
diff changeset
1120 pOutVertices[*pOutNumVertices_].u = (*((float *)v8 - 12) - *(float *)v8) * v12 + *(float *)v8;
Ritor1
parents:
diff changeset
1121 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 - 11) - *((float *)v8 + 1)) * v12 + *((float *)v8 + 1);
Ritor1
parents:
diff changeset
1122 v10 = pOutVertices;
Ritor1
parents:
diff changeset
1123 }
Ritor1
parents:
diff changeset
1124 v10[*pOutNumVertices_].vWorldViewPosition.x = v6;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 96
diff changeset
1125 v10[*pOutNumVertices_]._rhw = 1.0 / v6;
0
Ritor1
parents:
diff changeset
1126 if ( v7 )
Ritor1
parents:
diff changeset
1127 {
Ritor1
parents:
diff changeset
1128 v13 = (unsigned int)&v10[*pOutNumVertices_];
Ritor1
parents:
diff changeset
1129 if ( *(float *)(v13 + 12) != *((float *)v8 - 18) || *(float *)(v13 + 16) != *((float *)v8 - 17) )
Ritor1
parents:
diff changeset
1130 goto LABEL_21;
Ritor1
parents:
diff changeset
1131 v14 = 0;
Ritor1
parents:
diff changeset
1132 v15 = *(float *)(v13 + 20) == *((float *)v8 - 16);
Ritor1
parents:
diff changeset
1133 }
Ritor1
parents:
diff changeset
1134 else
Ritor1
parents:
diff changeset
1135 {
Ritor1
parents:
diff changeset
1136 v16 = (unsigned int)&v10[*pOutNumVertices_];
Ritor1
parents:
diff changeset
1137 if ( *(float *)(v16 + 12) != *((float *)v8 - 6) || *(float *)(v16 + 16) != *((float *)v8 - 5) )
Ritor1
parents:
diff changeset
1138 {
Ritor1
parents:
diff changeset
1139 LABEL_21:
Ritor1
parents:
diff changeset
1140 ++*pOutNumVertices_;
Ritor1
parents:
diff changeset
1141 goto LABEL_23;
Ritor1
parents:
diff changeset
1142 }
Ritor1
parents:
diff changeset
1143 v14 = 0;
Ritor1
parents:
diff changeset
1144 v15 = *(float *)(v16 + 20) == *((float *)v8 - 4);
Ritor1
parents:
diff changeset
1145 }
Ritor1
parents:
diff changeset
1146 if ( !(v15 | v14) )
Ritor1
parents:
diff changeset
1147 goto LABEL_21;
Ritor1
parents:
diff changeset
1148 LABEL_23:
Ritor1
parents:
diff changeset
1149 if ( a1a )
Ritor1
parents:
diff changeset
1150 {
Ritor1
parents:
diff changeset
1151 memcpy(&v10[*pOutNumVertices_], v8 - 36, sizeof(v10[*pOutNumVertices_]));
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 96
diff changeset
1152 pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (*((float *)v8 - 6) + 0.0000001);
0
Ritor1
parents:
diff changeset
1153 pOutVertices[(*pOutNumVertices_)++].flt_2C = *((float *)v8 + 2);
Ritor1
parents:
diff changeset
1154 }
Ritor1
parents:
diff changeset
1155 v7 = a1a;
Ritor1
parents:
diff changeset
1156 v8 += 48;
Ritor1
parents:
diff changeset
1157 --a4a;
Ritor1
parents:
diff changeset
1158 }
Ritor1
parents:
diff changeset
1159 while ( a4a );
Ritor1
parents:
diff changeset
1160 }
Ritor1
parents:
diff changeset
1161 if ( (signed int)*pOutNumVertices_ < 3 )
Ritor1
parents:
diff changeset
1162 *pOutNumVertices_ = 0;
Ritor1
parents:
diff changeset
1163 }
Ritor1
parents:
diff changeset
1164 }
Ritor1
parents:
diff changeset
1165
Ritor1
parents:
diff changeset
1166 //----- (00436CDC) --------------------------------------------------------
Ritor1
parents:
diff changeset
1167 void IndoorCameraD3D::_436CDC_mess_with_lightmap__clipflag_2(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
Ritor1
parents:
diff changeset
1168 {
Ritor1
parents:
diff changeset
1169 signed int v5; // esi@2
Ritor1
parents:
diff changeset
1170 char *v6; // edx@5
Ritor1
parents:
diff changeset
1171 unsigned int v7; // eax@10
Ritor1
parents:
diff changeset
1172 RenderVertexSoft *v8; // ecx@11
Ritor1
parents:
diff changeset
1173 double v9; // st6@11
Ritor1
parents:
diff changeset
1174 double v10; // st6@12
Ritor1
parents:
diff changeset
1175 unsigned int v11; // edi@14
Ritor1
parents:
diff changeset
1176 unsigned __int8 v12; // c2@16
Ritor1
parents:
diff changeset
1177 unsigned __int8 v13; // c3@16
Ritor1
parents:
diff changeset
1178 unsigned int v14; // edi@17
Ritor1
parents:
diff changeset
1179 bool a1a; // [sp+Ch] [bp+8h]@7
Ritor1
parents:
diff changeset
1180
Ritor1
parents:
diff changeset
1181 if ( uNumInVertices )
Ritor1
parents:
diff changeset
1182 {
Ritor1
parents:
diff changeset
1183 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
1184 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
Ritor1
parents:
diff changeset
1185 v5 = 0;
Ritor1
parents:
diff changeset
1186 if ( pInVertices->vWorldViewPosition.x >= 8.0 )
Ritor1
parents:
diff changeset
1187 v5 = 1;
Ritor1
parents:
diff changeset
1188 if ( uNumInVertices + 1 > 1 )
Ritor1
parents:
diff changeset
1189 {
Ritor1
parents:
diff changeset
1190 v6 = (char *)&pInVertices[1].u;
Ritor1
parents:
diff changeset
1191 do
Ritor1
parents:
diff changeset
1192 {
Ritor1
parents:
diff changeset
1193 a1a = *((float *)v6 - 6) >= 8.0;
Ritor1
parents:
diff changeset
1194 if ( v5 == a1a )
Ritor1
parents:
diff changeset
1195 {
Ritor1
parents:
diff changeset
1196 v8 = pOutVertices;
Ritor1
parents:
diff changeset
1197 goto LABEL_23;
Ritor1
parents:
diff changeset
1198 }
Ritor1
parents:
diff changeset
1199 v7 = *pOutNumVertices;
Ritor1
parents:
diff changeset
1200 if ( a1a )
Ritor1
parents:
diff changeset
1201 {
Ritor1
parents:
diff changeset
1202 v8 = pOutVertices;
Ritor1
parents:
diff changeset
1203 v9 = (8.0 - *((float *)v6 - 18)) / (*((float *)v6 - 6) - *((float *)v6 - 18));
Ritor1
parents:
diff changeset
1204 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 5) - *((float *)v6 - 17)) * v9 + *((float *)v6 - 17);
Ritor1
parents:
diff changeset
1205 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 4) - *((float *)v6 - 16)) * v9
Ritor1
parents:
diff changeset
1206 + *((float *)v6 - 16);
Ritor1
parents:
diff changeset
1207 pOutVertices[*pOutNumVertices].u = (*(float *)v6 - *((float *)v6 - 12)) * v9 + *((float *)v6 - 12);
Ritor1
parents:
diff changeset
1208 pOutVertices[*pOutNumVertices].v = (*((float *)v6 + 1) - *((float *)v6 - 11)) * v9 + *((float *)v6 - 11);
Ritor1
parents:
diff changeset
1209 }
Ritor1
parents:
diff changeset
1210 else
Ritor1
parents:
diff changeset
1211 {
Ritor1
parents:
diff changeset
1212 v10 = (8.0 - *((float *)v6 - 6)) / (*((float *)v6 - 18) - *((float *)v6 - 6));
Ritor1
parents:
diff changeset
1213 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 17) - *((float *)v6 - 5)) * v10 + *((float *)v6 - 5);
Ritor1
parents:
diff changeset
1214 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 16) - *((float *)v6 - 4)) * v10
Ritor1
parents:
diff changeset
1215 + *((float *)v6 - 4);
Ritor1
parents:
diff changeset
1216 pOutVertices[*pOutNumVertices].u = (*((float *)v6 - 12) - *(float *)v6) * v10 + *(float *)v6;
Ritor1
parents:
diff changeset
1217 pOutVertices[*pOutNumVertices].v = (*((float *)v6 - 11) - *((float *)v6 + 1)) * v10 + *((float *)v6 + 1);
Ritor1
parents:
diff changeset
1218 v8 = pOutVertices;
Ritor1
parents:
diff changeset
1219 }
Ritor1
parents:
diff changeset
1220 v8[*pOutNumVertices].vWorldViewPosition.x = 8.0;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 96
diff changeset
1221 v8[*pOutNumVertices]._rhw = 0.125;
0
Ritor1
parents:
diff changeset
1222 if ( v5 )
Ritor1
parents:
diff changeset
1223 {
Ritor1
parents:
diff changeset
1224 v11 = (unsigned int)&v8[*pOutNumVertices];
Ritor1
parents:
diff changeset
1225 if ( *(float *)(v11 + 12) != *((float *)v6 - 18) || *(float *)(v11 + 16) != *((float *)v6 - 17) )
Ritor1
parents:
diff changeset
1226 goto LABEL_21;
Ritor1
parents:
diff changeset
1227 v12 = 0;
Ritor1
parents:
diff changeset
1228 v13 = *(float *)(v11 + 20) == *((float *)v6 - 16);
Ritor1
parents:
diff changeset
1229 }
Ritor1
parents:
diff changeset
1230 else
Ritor1
parents:
diff changeset
1231 {
Ritor1
parents:
diff changeset
1232 v14 = (unsigned int)&v8[*pOutNumVertices];
Ritor1
parents:
diff changeset
1233 if ( *(float *)(v14 + 12) != *((float *)v6 - 6) || *(float *)(v14 + 16) != *((float *)v6 - 5) )
Ritor1
parents:
diff changeset
1234 {
Ritor1
parents:
diff changeset
1235 LABEL_21:
Ritor1
parents:
diff changeset
1236 ++*pOutNumVertices;
Ritor1
parents:
diff changeset
1237 goto LABEL_23;
Ritor1
parents:
diff changeset
1238 }
Ritor1
parents:
diff changeset
1239 v12 = 0;
Ritor1
parents:
diff changeset
1240 v13 = *(float *)(v14 + 20) == *((float *)v6 - 4);
Ritor1
parents:
diff changeset
1241 }
Ritor1
parents:
diff changeset
1242 if ( !(v13 | v12) )
Ritor1
parents:
diff changeset
1243 goto LABEL_21;
Ritor1
parents:
diff changeset
1244 LABEL_23:
Ritor1
parents:
diff changeset
1245 if ( a1a )
Ritor1
parents:
diff changeset
1246 {
Ritor1
parents:
diff changeset
1247 memcpy(&v8[*pOutNumVertices], v6 - 36, sizeof(v8[*pOutNumVertices]));
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 96
diff changeset
1248 pOutVertices[(*pOutNumVertices)++]._rhw = 1.0 / (*((float *)v6 - 6) + 0.0000001);
0
Ritor1
parents:
diff changeset
1249 }
Ritor1
parents:
diff changeset
1250 v5 = a1a;
Ritor1
parents:
diff changeset
1251 v6 += 48;
Ritor1
parents:
diff changeset
1252 --uNumInVertices;
Ritor1
parents:
diff changeset
1253 }
Ritor1
parents:
diff changeset
1254 while ( uNumInVertices );
Ritor1
parents:
diff changeset
1255 }
Ritor1
parents:
diff changeset
1256 if ( (signed int)*pOutNumVertices < 3 )
Ritor1
parents:
diff changeset
1257 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
1258 }
Ritor1
parents:
diff changeset
1259 }
Ritor1
parents:
diff changeset
1260
Ritor1
parents:
diff changeset
1261 //----- (00436BB7) --------------------------------------------------------
Ritor1
parents:
diff changeset
1262 void IndoorCameraD3D::Project(RenderVertexSoft *pVertices, unsigned int uNumVertices, char a4)
Ritor1
parents:
diff changeset
1263 {
Ritor1
parents:
diff changeset
1264 double v7; // st7@7
Ritor1
parents:
diff changeset
1265 double v8; // st7@9
Ritor1
parents:
diff changeset
1266 double v9; // st6@10
Ritor1
parents:
diff changeset
1267 double v10; // st5@12
Ritor1
parents:
diff changeset
1268 double v11; // st7@16
Ritor1
parents:
diff changeset
1269 double v12; // st6@17
Ritor1
parents:
diff changeset
1270 double v13; // st5@19
Ritor1
parents:
diff changeset
1271 float uNumVerticesa; // [sp+14h] [bp+Ch]@13
Ritor1
parents:
diff changeset
1272 float uNumVerticesb; // [sp+14h] [bp+Ch]@20
Ritor1
parents:
diff changeset
1273
Ritor1
parents:
diff changeset
1274 for (uint i = 0; i < uNumVertices; ++i)
Ritor1
parents:
diff changeset
1275 {
Ritor1
parents:
diff changeset
1276 if (byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
1277 {
Ritor1
parents:
diff changeset
1278 v7 = 1.0 / pVertices[i].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1279
Ritor1
parents:
diff changeset
1280 pVertices[i].vWorldViewProjX = pVertices[i].vWorldViewPosition.y * fov * v7 + screenCenterX;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1281 pVertices[i].vWorldViewProjY = (signed int)pViewport->uViewportBR_Y - (pVertices[i].vWorldViewPosition.z * fov * v7 + screenCenterY);
0
Ritor1
parents:
diff changeset
1282 }
Ritor1
parents:
diff changeset
1283 else
Ritor1
parents:
diff changeset
1284 {
Ritor1
parents:
diff changeset
1285 extern void _outdoor_project(RenderVertexSoft *v);
Ritor1
parents:
diff changeset
1286 _outdoor_project(pVertices + i);
Ritor1
parents:
diff changeset
1287 }
Ritor1
parents:
diff changeset
1288
Ritor1
parents:
diff changeset
1289 if ( a4 )
Ritor1
parents:
diff changeset
1290 {
96
bb449743ee81 7.01.13(work)
Ritor1
parents: 86
diff changeset
1291 // __debugbreak();
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1292 v8 = (double)(signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
1293 if ( v8 >= pVertices[i].vWorldViewProjX )
Ritor1
parents:
diff changeset
1294 v9 = pVertices[i].vWorldViewProjX;
Ritor1
parents:
diff changeset
1295 else
Ritor1
parents:
diff changeset
1296 v9 = v8;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1297 v10 = (double)(signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
1298 if ( v10 <= v9 )
Ritor1
parents:
diff changeset
1299 {
Ritor1
parents:
diff changeset
1300 if ( v8 >= pVertices[i].vWorldViewProjX)
Ritor1
parents:
diff changeset
1301 v8 = pVertices[i].vWorldViewProjX;
Ritor1
parents:
diff changeset
1302 }
Ritor1
parents:
diff changeset
1303 else
Ritor1
parents:
diff changeset
1304 {
Ritor1
parents:
diff changeset
1305 uNumVerticesa = v10;
Ritor1
parents:
diff changeset
1306 v8 = uNumVerticesa;
Ritor1
parents:
diff changeset
1307 }
Ritor1
parents:
diff changeset
1308 pVertices[i].vWorldViewProjX = v8;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1309 v11 = (double)(signed int)pViewport->uViewportBR_Y;
0
Ritor1
parents:
diff changeset
1310 if ( v11 >= pVertices[i].vWorldViewProjY)
Ritor1
parents:
diff changeset
1311 v12 = pVertices[i].vWorldViewProjY;
Ritor1
parents:
diff changeset
1312 else
Ritor1
parents:
diff changeset
1313 v12 = v11;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1314 v13 = (double)(signed int)pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
1315 if ( v13 <= v12 )
Ritor1
parents:
diff changeset
1316 {
Ritor1
parents:
diff changeset
1317 if ( v11 >= pVertices[i].vWorldViewProjY)
Ritor1
parents:
diff changeset
1318 v11 = pVertices[i].vWorldViewProjY;
Ritor1
parents:
diff changeset
1319 }
Ritor1
parents:
diff changeset
1320 else
Ritor1
parents:
diff changeset
1321 {
Ritor1
parents:
diff changeset
1322 uNumVerticesb = v13;
Ritor1
parents:
diff changeset
1323 v11 = uNumVerticesb;
Ritor1
parents:
diff changeset
1324 }
Ritor1
parents:
diff changeset
1325 pVertices[i].vWorldViewProjY = v11;
Ritor1
parents:
diff changeset
1326 }
Ritor1
parents:
diff changeset
1327 }
Ritor1
parents:
diff changeset
1328 }
Ritor1
parents:
diff changeset
1329
Ritor1
parents:
diff changeset
1330 //----- (00436A9A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1331 void IndoorCameraD3D::Project(signed int x, signed int y, signed int z, int *a5, int *a6)
Ritor1
parents:
diff changeset
1332 {
Ritor1
parents:
diff changeset
1333 double v6; // ST00_8@2
Ritor1
parents:
diff changeset
1334 //double v7; // ST08_8@2
Ritor1
parents:
diff changeset
1335 //double v8; // ST00_8@2
Ritor1
parents:
diff changeset
1336 signed __int64 v9; // qtt@3
Ritor1
parents:
diff changeset
1337 int v10; // ST04_4@3
Ritor1
parents:
diff changeset
1338 float a2a; // [sp+18h] [bp+8h]@2
Ritor1
parents:
diff changeset
1339 float a2b; // [sp+18h] [bp+8h]@2
Ritor1
parents:
diff changeset
1340
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2152
diff changeset
1341 //if ( pRenderer->pRenderD3D )
0
Ritor1
parents:
diff changeset
1342 {
Ritor1
parents:
diff changeset
1343 v6 = 1.0 / (double)x;
Ritor1
parents:
diff changeset
1344 a2a = (double)y * fov * v6 + screenCenterX;
Ritor1
parents:
diff changeset
1345 //v7 = a2a + 6.7553994e15;
Ritor1
parents:
diff changeset
1346 *a5 = floorf(a2a + 0.5f);
Ritor1
parents:
diff changeset
1347 a2b = (double)z * fov * v6 + screenCenterY;
Ritor1
parents:
diff changeset
1348 //v8 = a2b + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1349 *a6 = pViewport->uViewportBR_Y - floorf(a2b + 0.5f);
0
Ritor1
parents:
diff changeset
1350 }
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
1351 /*else
0
Ritor1
parents:
diff changeset
1352 {
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
1353 LODWORD(v9) = pBLVRenderParams->fov_rad_fixpoint << 16;
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
1354 HIDWORD(v9) = pBLVRenderParams->fov_rad_fixpoint >> 16;
0
Ritor1
parents:
diff changeset
1355 v10 = v9 / x;
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
1356 LODWORD(v9) = pBLVRenderParams->fov_rad_fixpoint << 16;
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
1357 HIDWORD(v9) = pBLVRenderParams->fov_rad_fixpoint >> 16;
0
Ritor1
parents:
diff changeset
1358 *a5 = pBLVRenderParams->uViewportCenterX
Ritor1
parents:
diff changeset
1359 - ((signed int)(((unsigned __int64)(v10 * (signed __int64)y) >> 16) + 32768) >> 16);
Ritor1
parents:
diff changeset
1360 *a6 = pBLVRenderParams->uViewportCenterY - ((signed int)(((unsigned __int64)(v9 / x * z) >> 16) + 32768) >> 16);
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
1361 }*/
0
Ritor1
parents:
diff changeset
1362 }
Ritor1
parents:
diff changeset
1363
Ritor1
parents:
diff changeset
1364 //----- (00436A6D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1365 double IndoorCameraD3D::GetPolygonMinZ(RenderVertexSoft *pVertices, unsigned int uStripType)
Ritor1
parents:
diff changeset
1366 {
Ritor1
parents:
diff changeset
1367 unsigned int v3; // edx@1
Ritor1
parents:
diff changeset
1368 double result; // st7@1
Ritor1
parents:
diff changeset
1369 float *v5; // ecx@2
Ritor1
parents:
diff changeset
1370
Ritor1
parents:
diff changeset
1371 v3 = uStripType;
86
ec84db4c8f9d 4.01.13
Ritor1
parents: 0
diff changeset
1372 result = 3.402823466385289e38;
0
Ritor1
parents:
diff changeset
1373 if ( (signed int)uStripType > 0 )
Ritor1
parents:
diff changeset
1374 {
Ritor1
parents:
diff changeset
1375 v5 = &pVertices->vWorldPosition.z;
Ritor1
parents:
diff changeset
1376 do
Ritor1
parents:
diff changeset
1377 {
Ritor1
parents:
diff changeset
1378 if ( *v5 < result )
Ritor1
parents:
diff changeset
1379 result = *v5;
Ritor1
parents:
diff changeset
1380 v5 += 12;
Ritor1
parents:
diff changeset
1381 --v3;
Ritor1
parents:
diff changeset
1382 }
Ritor1
parents:
diff changeset
1383 while ( v3 );
Ritor1
parents:
diff changeset
1384 }
Ritor1
parents:
diff changeset
1385 return result;
Ritor1
parents:
diff changeset
1386 }
Ritor1
parents:
diff changeset
1387
Ritor1
parents:
diff changeset
1388 //----- (00436A24) --------------------------------------------------------
Ritor1
parents:
diff changeset
1389 struct IDirect3DTexture2 *IndoorCameraD3D::LoadTextureAndGetHardwarePtr(char *Str1)
Ritor1
parents:
diff changeset
1390 {
Ritor1
parents:
diff changeset
1391 return pBitmaps_LOD->pHardwareTextures[pBitmaps_LOD->LoadTexture(Str1)];
Ritor1
parents:
diff changeset
1392 }
Ritor1
parents:
diff changeset
1393
Ritor1
parents:
diff changeset
1394 //----- (00436A40) --------------------------------------------------------
Ritor1
parents:
diff changeset
1395 double IndoorCameraD3D::GetPolygonMaxZ(RenderVertexSoft *pVertex, unsigned int uStripType)
Ritor1
parents:
diff changeset
1396 {
Ritor1
parents:
diff changeset
1397 double result; // st7@1
Ritor1
parents:
diff changeset
1398
Ritor1
parents:
diff changeset
1399 result = 1.1754944e-38;
2320
847aba0b7f82 draw terrain distance
Ritor1
parents: 2281
diff changeset
1400 for ( uint i = 0; i < uStripType; i++ )
0
Ritor1
parents:
diff changeset
1401 {
2320
847aba0b7f82 draw terrain distance
Ritor1
parents: 2281
diff changeset
1402 if ( pVertex[i].vWorldPosition.z > result )
847aba0b7f82 draw terrain distance
Ritor1
parents: 2281
diff changeset
1403 result = pVertex[i].vWorldPosition.z;
0
Ritor1
parents:
diff changeset
1404 }
Ritor1
parents:
diff changeset
1405 return result;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1406 }
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1407
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1408 // -- new
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1409 // merged from IndoorCamera::Initialize2
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1410 // and ODMRenderParams::RotationToInts
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1411 // and BLVRenderParams::Reset
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1412 void IndoorCameraD3D::CalculateRotations(int camera_rot_x, int camera_rot_y)
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1413 {
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1414 sRotationX = camera_rot_x;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1415 sRotationY = camera_rot_y;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1416
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1417 fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationY / 2048.0);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1418 fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationY / 2048.0);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1419 if (byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1420 {
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1421 fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-sRotationX / 2048.0);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1422 fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)-sRotationX / 2048.0);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1423
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1424 int_sine_y = stru_5C6E00->Sin( pGame->pIndoorCameraD3D->sRotationY);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1425 int_cosine_y = stru_5C6E00->Cos( pGame->pIndoorCameraD3D->sRotationY);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1426 int_sine_x = stru_5C6E00->Sin(-pGame->pIndoorCameraD3D->sRotationX);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1427 int_cosine_x = stru_5C6E00->Cos(-pGame->pIndoorCameraD3D->sRotationX);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1428 }
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1429 else
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1430 {
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1431 fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)sRotationX / 2048.0);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1432 fRotationXCosine = cos((3.141592653589793 + 3.141592653589793) * (double)sRotationX / 2048.0);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1433
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1434 int_sine_y = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1435 int_cosine_y = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1436 int_sine_x = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1437 int_cosine_x = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX);
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
1438 }
0
Ritor1
parents:
diff changeset
1439 }