annotate stru9.cpp @ 690:26dfde53decd

ui fixing
author Gloval
date Sat, 16 Mar 2013 01:25:15 +0400
parents 687b4365ee84
children c93f29773f84 1ea7dfa782cd
rev   line source
0
Ritor1
parents:
diff changeset
1 #include "stru9.h"
Ritor1
parents:
diff changeset
2 #include "IndoorCameraD3D.h"
Ritor1
parents:
diff changeset
3
Ritor1
parents:
diff changeset
4 #include "mm7_data.h"
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8 //----- (00498377) --------------------------------------------------------
Ritor1
parents:
diff changeset
9 bool stru9::_498377(struct RenderVertexSoft *a1, unsigned int uNumVertices, struct IndoorCameraD3D_Vec4 *a3, struct RenderVertexSoft *pVertices, unsigned int *pOutNumVertices)
Ritor1
parents:
diff changeset
10 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
11 int result; // eax@7
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
12 //unsigned int *v7; // ebx@7
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
13 //char *v8; // esi@8
0
Ritor1
parents:
diff changeset
14 RenderVertexSoft *v9; // ecx@9
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
15 //double v10; // st7@12
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
16 //double v11; // st6@12
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
17 //RenderVertexSoft *v12; // esi@13
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
18 //int v13; // ecx@25
0
Ritor1
parents:
diff changeset
19 VertexBuffer *v14; // edx@26
Ritor1
parents:
diff changeset
20 char *v15; // eax@26
Ritor1
parents:
diff changeset
21 unsigned int i; // ecx@26
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
22 int v17; // [sp+0h] [bp-28h]@9
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
23 //char *v18; // [sp+10h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
24 RenderVertexSoft *v19; // [sp+14h] [bp-14h]@0
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
25 //RenderVertexSoft *v20; // [sp+18h] [bp-10h]@0
0
Ritor1
parents:
diff changeset
26 signed int v21; // [sp+1Ch] [bp-Ch]@7
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
27 //RenderVertexSoft *a2; // [sp+20h] [bp-8h]@8
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
28 //stru9 *thisa; // [sp+24h] [bp-4h]@1
0
Ritor1
parents:
diff changeset
29 signed int a3a; // [sp+38h] [bp+10h]@12
Ritor1
parents:
diff changeset
30 int a3b; // [sp+38h] [bp+10h]@25
Ritor1
parents:
diff changeset
31
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
32 //__debugbreak();
0
Ritor1
parents:
diff changeset
33
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
34 //thisa = this;
0
Ritor1
parents:
diff changeset
35
Ritor1
parents:
diff changeset
36 static RenderVertexSoft static_AE3FB4;
Ritor1
parents:
diff changeset
37 static bool __init_flag1 = false;
Ritor1
parents:
diff changeset
38 if (!__init_flag1)
Ritor1
parents:
diff changeset
39 {
Ritor1
parents:
diff changeset
40 __init_flag1 = true;
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42 static_AE3FB4.flt_2C = 0.0;
Ritor1
parents:
diff changeset
43 }
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45 static stru312 static_AE3FA4; // idb
Ritor1
parents:
diff changeset
46 static bool __init_flag2 = false;
Ritor1
parents:
diff changeset
47 if (!__init_flag2)
Ritor1
parents:
diff changeset
48 {
Ritor1
parents:
diff changeset
49 __init_flag2 = true;
Ritor1
parents:
diff changeset
50
Ritor1
parents:
diff changeset
51 //stru312::stru312(&static_AE3FA4);
Ritor1
parents:
diff changeset
52 }
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54 static VertexBuffer static_AE33A0; // idb
Ritor1
parents:
diff changeset
55 static bool __init_flag3 = false;
Ritor1
parents:
diff changeset
56 if (!__init_flag3)
Ritor1
parents:
diff changeset
57 {
Ritor1
parents:
diff changeset
58 __init_flag3 = true;
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60 //VertexBuffer::VertexBuffer(&static_AE33A0);
Ritor1
parents:
diff changeset
61 }
Ritor1
parents:
diff changeset
62
Ritor1
parents:
diff changeset
63 result = 0;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
64 //v7 = pOutNumVertices;
0
Ritor1
parents:
diff changeset
65 v21 = 0;
Ritor1
parents:
diff changeset
66 if ( (signed int)uNumVertices <= 0 )
Ritor1
parents:
diff changeset
67 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
68 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
69 return true;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
70 }
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
71 //a2 = a1;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
72 //v8 = (char *)&a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
73 //v18 = (char *)&a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
74 //do
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
75 for (v17 = 0; v17 < uNumVertices; v17++ )
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
76 {
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
77 //v17 = result + 1;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
78 result = v17;
0
Ritor1
parents:
diff changeset
79 v9 = &a1[(result + 1) % (signed int)uNumVertices];
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
80 if ( a1->vWorldPosition.x != v9->vWorldPosition.x
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
81 || a1->vWorldPosition.y != v9->vWorldPosition.y
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
82 || a1->vWorldPosition.z != v9->vWorldPosition.z )
0
Ritor1
parents:
diff changeset
83 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
84 //v10 = a3->z;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
85 //v11 = a3->y;
0
Ritor1
parents:
diff changeset
86 ++v21;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
87 //result = 0;
0
Ritor1
parents:
diff changeset
88 static_AE33A0.uNumVertices = 0;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
89 //a3a = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
90 static_AE3FA4.x = a3->x;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
91 static_AE3FA4.y = a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
92 static_AE3FA4.z = a3->z;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
93 if ( (signed int)*pOutNumVertices <= 0 )
0
Ritor1
parents:
diff changeset
94 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
95 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
96 return true;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
97 }
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
98 //do
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
99 for ( int i = 0; i < (signed int)*pOutNumVertices; i++ )
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
100 {
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
101 //v12 = &pVertices[result];
0
Ritor1
parents:
diff changeset
102 if ( result )
Ritor1
parents:
diff changeset
103 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
104 if ( _4989E1(&pVertices[i], &pVertices[i], a1, &static_AE3FA4)
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
105 && _498774(&pVertices[i], &pVertices[i], a1, &static_AE3FA4, &static_AE3FB4) )
0
Ritor1
parents:
diff changeset
106 AddVertex(&static_AE33A0, &static_AE3FB4);
Ritor1
parents:
diff changeset
107 }
Ritor1
parents:
diff changeset
108 else
Ritor1
parents:
diff changeset
109 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
110 v19 = &pVertices[i];
0
Ritor1
parents:
diff changeset
111 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
112 //v20 = v12;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
113 if ( AreVectorsCollinear(&pVertices[i], a1, &static_AE3FA4) )//
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
114 AddVertex(&static_AE33A0, &pVertices[i]);
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
115 //pOutNumVertices = pOutNumVertices;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
116 //a3a++;
0
Ritor1
parents:
diff changeset
117 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
118 //while ( a3a < (signed int)*pOutNumVertices );
0
Ritor1
parents:
diff changeset
119 if ( !static_AE33A0.uNumVertices )
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
120 {
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
121 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
122 return true;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
123 }
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
124 if ( _4989E1(&pVertices[result], v19, a1, &static_AE3FA4)
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
125 && _498774(&pVertices[result], v19, a1, &static_AE3FA4, &static_AE3FB4) )
0
Ritor1
parents:
diff changeset
126 AddVertex(&static_AE33A0, &static_AE3FB4);
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
127 //v13 = static_AE33A0.uNumVertices;
0
Ritor1
parents:
diff changeset
128 a3b = 0;
Ritor1
parents:
diff changeset
129 if ( static_AE33A0.uNumVertices > 0 )
Ritor1
parents:
diff changeset
130 {
Ritor1
parents:
diff changeset
131 v14 = &static_AE33A0;
Ritor1
parents:
diff changeset
132 v15 = (char *)&pVertices->vWorldPosition.y;
Ritor1
parents:
diff changeset
133 for ( i = (char *)&static_AE33A0.pVertices[0].vWorldPosition.y - (char *)pVertices;
Ritor1
parents:
diff changeset
134 ;
Ritor1
parents:
diff changeset
135 i = (char *)&static_AE33A0.pVertices[0].vWorldPosition.y - (char *)pVertices )
Ritor1
parents:
diff changeset
136 {
Ritor1
parents:
diff changeset
137 ++a3b;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
138 pVertices->vWorldPosition.x = v14->pVertices[0].vWorldPosition.x;
0
Ritor1
parents:
diff changeset
139 v14 = (VertexBuffer *)((char *)v14 + 48);
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
140 pVertices->vWorldPosition.y = *(float *)&v15[(char *)&static_AE33A0 - (char *)pVertices];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
141 pVertices->vWorldPosition.z = *(float *)&v15[i];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
142 pVertices->u = *(float *)&v15[(char *)&static_AE33A0.pVertices[0]._rhw - (char *)pVertices];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
143 pVertices->v = *(float *)&v15[(char *)&static_AE33A0.pVertices[0].u - (char *)pVertices];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
144 //static_AE33A0.uNumVertices = static_AE33A0.uNumVertices;
0
Ritor1
parents:
diff changeset
145 v15 += 48;
Ritor1
parents:
diff changeset
146 if ( a3b >= static_AE33A0.uNumVertices )
Ritor1
parents:
diff changeset
147 break;
Ritor1
parents:
diff changeset
148 }
Ritor1
parents:
diff changeset
149 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
150 //v7 = pOutNumVertices;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
151 //a3->y = a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
152 *pOutNumVertices = static_AE33A0.uNumVertices;
0
Ritor1
parents:
diff changeset
153 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
154 //result = v17;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
155 ++a1;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
156 a3++;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
157 //v18 = (char *)&a3->y;
0
Ritor1
parents:
diff changeset
158 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
159 //while ( v17 < (signed int)uNumVertices );
0
Ritor1
parents:
diff changeset
160 if ( v21 < 3 )
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
161 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
162 return true;
0
Ritor1
parents:
diff changeset
163 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
164
0
Ritor1
parents:
diff changeset
165 // AE3FE4: using guessed type char static_init_flag__AE3FB4_bit1__AE3FA4_bit2__AE33A0_bit3;
Ritor1
parents:
diff changeset
166
Ritor1
parents:
diff changeset
167 //----- (004985FB) --------------------------------------------------------
Ritor1
parents:
diff changeset
168 bool stru9::_4985FB(struct RenderVertexSoft *a1, signed int a2, struct RenderVertexSoft *a3, unsigned int *pOutNumVertices, struct Vec3_float_ *a5, float a6, char *a7, int unused)
Ritor1
parents:
diff changeset
169 {
Ritor1
parents:
diff changeset
170 RenderVertexSoft *v9; // ecx@1
Ritor1
parents:
diff changeset
171 Vec3_float_ *v10; // esi@1
Ritor1
parents:
diff changeset
172 //char *v11; // ebx@1
Ritor1
parents:
diff changeset
173 RenderVertexSoft *v12; // edi@1
Ritor1
parents:
diff changeset
174 double v13; // st7@1
Ritor1
parents:
diff changeset
175 //bool result; // eax@4
Ritor1
parents:
diff changeset
176 signed int v15; // edx@9
Ritor1
parents:
diff changeset
177 RenderVertexSoft *v16; // ecx@9
Ritor1
parents:
diff changeset
178 double v17; // st7@9
Ritor1
parents:
diff changeset
179 double v18; // st6@12
Ritor1
parents:
diff changeset
180 signed int v19; // [sp+Ch] [bp-Ch]@7
Ritor1
parents:
diff changeset
181 float v20; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
182 bool v21; // [sp+14h] [bp-4h]@2
Ritor1
parents:
diff changeset
183
Ritor1
parents:
diff changeset
184 v9 = a1;
Ritor1
parents:
diff changeset
185 v10 = a5;
Ritor1
parents:
diff changeset
186 //v11 = (char *)&a1->vWorldPosition.z;
Ritor1
parents:
diff changeset
187 auto v11 = a1;
Ritor1
parents:
diff changeset
188 v12 = a3;
Ritor1
parents:
diff changeset
189 v13 = a1->vWorldPosition.y * a5->y + a5->x * a1->vWorldPosition.x + a1->vWorldPosition.z * a5->z;
Ritor1
parents:
diff changeset
190 v20 = v13;
Ritor1
parents:
diff changeset
191 v21 = v13 >= a6;
Ritor1
parents:
diff changeset
192
Ritor1
parents:
diff changeset
193 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
194 if ( a2 <= 0 )
Ritor1
parents:
diff changeset
195 return false;
Ritor1
parents:
diff changeset
196 v19 = 1;
Ritor1
parents:
diff changeset
197 while ( 1 )
Ritor1
parents:
diff changeset
198 {
Ritor1
parents:
diff changeset
199 if ( v21 )
Ritor1
parents:
diff changeset
200 {
Ritor1
parents:
diff changeset
201 ++a3;
Ritor1
parents:
diff changeset
202 memcpy(v12, v11, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
203 ++*pOutNumVertices;
Ritor1
parents:
diff changeset
204 v10 = a5;
Ritor1
parents:
diff changeset
205 v12 = a3;
Ritor1
parents:
diff changeset
206 v9 = a1;
Ritor1
parents:
diff changeset
207 }
Ritor1
parents:
diff changeset
208 v15 = 0;
Ritor1
parents:
diff changeset
209 v16 = &v9[v19 % a2];
Ritor1
parents:
diff changeset
210 v17 = v16->vWorldPosition.z * v10->z + v16->vWorldPosition.y * v10->y + v10->x * v16->vWorldPosition.x;
Ritor1
parents:
diff changeset
211 if ( v17 >= a6 )
Ritor1
parents:
diff changeset
212 v15 = 1;
Ritor1
parents:
diff changeset
213 if ( v21 != v15 )
Ritor1
parents:
diff changeset
214 {
Ritor1
parents:
diff changeset
215 v18 = (a6 - v20) / (v17 - v20);
Ritor1
parents:
diff changeset
216 v12->vWorldPosition.x = (v16->vWorldPosition.x - v11->vWorldPosition.x) * v18 + v11->vWorldPosition.x;
Ritor1
parents:
diff changeset
217 v12->vWorldPosition.y = (v16->vWorldPosition.y - v11->vWorldPosition.y) * v18 + v11->vWorldPosition.y;
Ritor1
parents:
diff changeset
218 v12->vWorldPosition.z = (v16->vWorldPosition.z - v11->vWorldPosition.z) * v18 + v11->vWorldPosition.z;
Ritor1
parents:
diff changeset
219 v12->u = (v16->u - v11->u) * v18 + v11->u;
Ritor1
parents:
diff changeset
220 v12->v = (v16->v - v11->v) * v18 + v11->v;
Ritor1
parents:
diff changeset
221 ++v12;
Ritor1
parents:
diff changeset
222 a3 = v12;
Ritor1
parents:
diff changeset
223 ++*pOutNumVertices;
Ritor1
parents:
diff changeset
224 *a7 = 1;
Ritor1
parents:
diff changeset
225 }
Ritor1
parents:
diff changeset
226
Ritor1
parents:
diff changeset
227 v11++;
Ritor1
parents:
diff changeset
228 v21 = v15;
Ritor1
parents:
diff changeset
229 v20 = v17;
Ritor1
parents:
diff changeset
230 if ( v19 >= a2 )
Ritor1
parents:
diff changeset
231 break;
Ritor1
parents:
diff changeset
232 v9 = a1;
Ritor1
parents:
diff changeset
233 v19++;
Ritor1
parents:
diff changeset
234 }
Ritor1
parents:
diff changeset
235
Ritor1
parents:
diff changeset
236 return *pOutNumVertices >= 3;
Ritor1
parents:
diff changeset
237 }
Ritor1
parents:
diff changeset
238
Ritor1
parents:
diff changeset
239 //----- (00498737) --------------------------------------------------------
Ritor1
parents:
diff changeset
240 void stru9::AddVertex(struct VertexBuffer *pVertexBuffer, struct RenderVertexSoft *pVertex)
Ritor1
parents:
diff changeset
241 {
436
4a42c2f97aa2 some itemgen crashes fixed
Gloval
parents: 168
diff changeset
242 // __debugbreak();
0
Ritor1
parents:
diff changeset
243 RenderVertexSoft *v3; // eax@1
Ritor1
parents:
diff changeset
244
Ritor1
parents:
diff changeset
245 v3 = &pVertexBuffer->pVertices[pVertexBuffer->uNumVertices];
Ritor1
parents:
diff changeset
246 v3->vWorldPosition.x = pVertex->vWorldPosition.x;
Ritor1
parents:
diff changeset
247 v3->vWorldPosition.y = pVertex->vWorldPosition.y;
Ritor1
parents:
diff changeset
248 v3->vWorldPosition.z = pVertex->vWorldPosition.z;
Ritor1
parents:
diff changeset
249 v3->u = pVertex->u;
Ritor1
parents:
diff changeset
250 v3->v = pVertex->v;
Ritor1
parents:
diff changeset
251 ++pVertexBuffer->uNumVertices;
Ritor1
parents:
diff changeset
252 }
Ritor1
parents:
diff changeset
253
Ritor1
parents:
diff changeset
254 //----- (00498774) --------------------------------------------------------
Ritor1
parents:
diff changeset
255 bool stru9::_498774(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct RenderVertexSoft *a3, struct stru312 *a4, struct RenderVertexSoft *a5)
Ritor1
parents:
diff changeset
256 {
Ritor1
parents:
diff changeset
257 RenderVertexSoft *v6; // ecx@5
Ritor1
parents:
diff changeset
258 bool result; // eax@5
Ritor1
parents:
diff changeset
259 double v8; // st7@5
Ritor1
parents:
diff changeset
260 __int16 v9; // fps@5
Ritor1
parents:
diff changeset
261 double v10; // st7@6
Ritor1
parents:
diff changeset
262 double v11; // st6@8
Ritor1
parents:
diff changeset
263 double v12; // st6@18
Ritor1
parents:
diff changeset
264 char v13; // c0@24
Ritor1
parents:
diff changeset
265 char v14; // c2@24
Ritor1
parents:
diff changeset
266 char v15; // c3@24
Ritor1
parents:
diff changeset
267 float a1a; // [sp+10h] [bp+8h]@5
Ritor1
parents:
diff changeset
268
Ritor1
parents:
diff changeset
269 __debugbreak();
Ritor1
parents:
diff changeset
270
Ritor1
parents:
diff changeset
271 static stru312 static_AE3388;
Ritor1
parents:
diff changeset
272 static stru312 static_AE3378;
Ritor1
parents:
diff changeset
273
Ritor1
parents:
diff changeset
274 v6 = a1;
Ritor1
parents:
diff changeset
275 static_AE3378.x = a1->vWorldPosition.x - a3->vWorldPosition.x;
Ritor1
parents:
diff changeset
276 static_AE3378.y = a1->vWorldPosition.y - a3->vWorldPosition.y;
Ritor1
parents:
diff changeset
277 HIWORD(result) = HIWORD(a4);
Ritor1
parents:
diff changeset
278 static_AE3378.z = a1->vWorldPosition.z - a3->vWorldPosition.z;
Ritor1
parents:
diff changeset
279 static_AE3388.x = a2->vWorldPosition.x - a1->vWorldPosition.x;
Ritor1
parents:
diff changeset
280 static_AE3388.y = a2->vWorldPosition.y - a1->vWorldPosition.y;
Ritor1
parents:
diff changeset
281 static_AE3388.z = a2->vWorldPosition.z - a1->vWorldPosition.z;
Ritor1
parents:
diff changeset
282 a1a = static_AE3388.x * a4->x + static_AE3388.z * a4->z + static_AE3388.y * a4->y;
Ritor1
parents:
diff changeset
283 v8 = static_AE3378.x * a4->x + static_AE3378.z * a4->z + static_AE3378.y * a4->y;
Ritor1
parents:
diff changeset
284 //UNDEF(v9);
Ritor1
parents:
diff changeset
285 if ( a1a != 0.0 )
Ritor1
parents:
diff changeset
286 {
Ritor1
parents:
diff changeset
287 v10 = -(v8 / a1a);
Ritor1
parents:
diff changeset
288 if ( a1a <= 0.0 )
Ritor1
parents:
diff changeset
289 {
Ritor1
parents:
diff changeset
290 if ( v10 <= 0.0 )
Ritor1
parents:
diff changeset
291 v12 = 0.0;
Ritor1
parents:
diff changeset
292 else
Ritor1
parents:
diff changeset
293 v12 = v10;
Ritor1
parents:
diff changeset
294 if ( v12 <= 1.0 )
Ritor1
parents:
diff changeset
295 {
Ritor1
parents:
diff changeset
296 if ( v10 <= 0.0 )
Ritor1
parents:
diff changeset
297 v10 = (float)0.0;
Ritor1
parents:
diff changeset
298 }
Ritor1
parents:
diff changeset
299 else
Ritor1
parents:
diff changeset
300 {
Ritor1
parents:
diff changeset
301 v10 = 1.0;
Ritor1
parents:
diff changeset
302 }
Ritor1
parents:
diff changeset
303 }
Ritor1
parents:
diff changeset
304 else
Ritor1
parents:
diff changeset
305 {
Ritor1
parents:
diff changeset
306 if ( v10 >= 1.0 )
Ritor1
parents:
diff changeset
307 v11 = 1.0;
Ritor1
parents:
diff changeset
308 else
Ritor1
parents:
diff changeset
309 v11 = v10;
Ritor1
parents:
diff changeset
310 if ( v11 >= 0.0 )
Ritor1
parents:
diff changeset
311 {
Ritor1
parents:
diff changeset
312 if ( v10 >= 1.0 )
Ritor1
parents:
diff changeset
313 v10 = (float)1.0;
Ritor1
parents:
diff changeset
314 }
Ritor1
parents:
diff changeset
315 else
Ritor1
parents:
diff changeset
316 {
Ritor1
parents:
diff changeset
317 v10 = 0.0;
Ritor1
parents:
diff changeset
318 }
Ritor1
parents:
diff changeset
319 }
Ritor1
parents:
diff changeset
320 result = (bool)a5;
Ritor1
parents:
diff changeset
321 a5->vWorldPosition.x = (a2->vWorldPosition.x - v6->vWorldPosition.x) * v10 + v6->vWorldPosition.x;
Ritor1
parents:
diff changeset
322 a5->vWorldPosition.y = (a2->vWorldPosition.y - v6->vWorldPosition.y) * v10 + v6->vWorldPosition.y;
Ritor1
parents:
diff changeset
323 a5->vWorldPosition.z = (a2->vWorldPosition.z - v6->vWorldPosition.z) * v10 + v6->vWorldPosition.z;
Ritor1
parents:
diff changeset
324 a5->u = (a2->u - v6->u) * v10 + v6->u;
Ritor1
parents:
diff changeset
325 a5->v = (a2->v - v6->v) * v10 + v6->v;
Ritor1
parents:
diff changeset
326 goto LABEL_15;
Ritor1
parents:
diff changeset
327 }
Ritor1
parents:
diff changeset
328 v13 = v8 < 0.0;
Ritor1
parents:
diff changeset
329 v14 = 0;
Ritor1
parents:
diff changeset
330 v15 = v8 == 0.0;
Ritor1
parents:
diff changeset
331 BYTE1(result) = HIBYTE(v9);
Ritor1
parents:
diff changeset
332 if ( v8 < 0.0 )
Ritor1
parents:
diff changeset
333 {
Ritor1
parents:
diff changeset
334 LABEL_15:
Ritor1
parents:
diff changeset
335 LOBYTE(result) = 1;
Ritor1
parents:
diff changeset
336 return result;
Ritor1
parents:
diff changeset
337 }
Ritor1
parents:
diff changeset
338 LOBYTE(result) = 0;
Ritor1
parents:
diff changeset
339 return result;
Ritor1
parents:
diff changeset
340 }
Ritor1
parents:
diff changeset
341 // AE3398: using guessed type char static_init_flag__AE3388_bit1__AE3378_bit2;
Ritor1
parents:
diff changeset
342
Ritor1
parents:
diff changeset
343 //----- (0049895A) --------------------------------------------------------
Ritor1
parents:
diff changeset
344 bool stru9::AreVectorsCollinear(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct stru312 *a3)
Ritor1
parents:
diff changeset
345 {
Ritor1
parents:
diff changeset
346 static stru312 static_F942A0;
Ritor1
parents:
diff changeset
347
Ritor1
parents:
diff changeset
348 static_F942A0.x = a1->vWorldPosition.x - a2->vWorldPosition.x;
Ritor1
parents:
diff changeset
349 static_F942A0.y = a1->vWorldPosition.y - a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
350 static_F942A0.z = a1->vWorldPosition.z - a2->vWorldPosition.z;
Ritor1
parents:
diff changeset
351
Ritor1
parents:
diff changeset
352 static float flt_F942B4 = static_F942A0.z * a3->z + static_F942A0.y * a3->y + static_F942A0.x * a3->x;
Ritor1
parents:
diff changeset
353 if (flt_F942B4 >= 0)
Ritor1
parents:
diff changeset
354 return true;
Ritor1
parents:
diff changeset
355 return false;
Ritor1
parents:
diff changeset
356 }
Ritor1
parents:
diff changeset
357
Ritor1
parents:
diff changeset
358
Ritor1
parents:
diff changeset
359 //----- (004989E1) --------------------------------------------------------
Ritor1
parents:
diff changeset
360 bool stru9::_4989E1(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct RenderVertexSoft *a3, struct stru312 *a4)
Ritor1
parents:
diff changeset
361 {
Ritor1
parents:
diff changeset
362 bool r1;
Ritor1
parents:
diff changeset
363 bool r2;
Ritor1
parents:
diff changeset
364
Ritor1
parents:
diff changeset
365 r1 = AreVectorsCollinear(a1, a3, a4);
Ritor1
parents:
diff changeset
366 r2 = AreVectorsCollinear(a2, a3, a4);
Ritor1
parents:
diff changeset
367 return !r1 && r2 == 1 ||
Ritor1
parents:
diff changeset
368 r1 == 1 && !r2;
Ritor1
parents:
diff changeset
369 }
Ritor1
parents:
diff changeset
370
Ritor1
parents:
diff changeset
371 //----- (004980B9) --------------------------------------------------------
Ritor1
parents:
diff changeset
372 bool stru9::_4980B9(RenderVertexSoft *a1, unsigned int uNumVertices, float a3, float a4, float a5, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
Ritor1
parents:
diff changeset
373 {
Ritor1
parents:
diff changeset
374 RenderVertexSoft *v12; // ecx@9
Ritor1
parents:
diff changeset
375 double v13; // st7@12
Ritor1
parents:
diff changeset
376 double v14; // st6@12
Ritor1
parents:
diff changeset
377 double v15; // st5@12
Ritor1
parents:
diff changeset
378 signed int v25; // [sp+18h] [bp-Ch]@7
Ritor1
parents:
diff changeset
379
Ritor1
parents:
diff changeset
380 static RenderVertexSoft stru_AE4BFC;
Ritor1
parents:
diff changeset
381 static stru312 static_sub_4980B9_stru_AE4BEC; // idb
Ritor1
parents:
diff changeset
382 static VertexBuffer static_sub_4980B9_stru_AE3FE8; // idb
Ritor1
parents:
diff changeset
383
Ritor1
parents:
diff changeset
384 v25 = 0;
Ritor1
parents:
diff changeset
385 if (uNumVertices <= 0)
Ritor1
parents:
diff changeset
386 {
Ritor1
parents:
diff changeset
387 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
388 return true;
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390
Ritor1
parents:
diff changeset
391 for (uint i = 0; i < uNumVertices; ++i)
Ritor1
parents:
diff changeset
392 {
Ritor1
parents:
diff changeset
393 v12 = &a1[(i + 1) % uNumVertices];
Ritor1
parents:
diff changeset
394 if (a1[i].vWorldPosition.x != v12->vWorldPosition.x ||
Ritor1
parents:
diff changeset
395 a1[i].vWorldPosition.y != v12->vWorldPosition.y ||
Ritor1
parents:
diff changeset
396 a1[i].vWorldPosition.z!= v12->vWorldPosition.z)
Ritor1
parents:
diff changeset
397 {
Ritor1
parents:
diff changeset
398 v13 = v12->vWorldPosition.x - a1[i].vWorldPosition.x;
Ritor1
parents:
diff changeset
399 v14 = v12->vWorldPosition.y - a1[i].vWorldPosition.y;
Ritor1
parents:
diff changeset
400 v15 = v12->vWorldPosition.z - a1[i].vWorldPosition.z;
Ritor1
parents:
diff changeset
401 ++v25;
Ritor1
parents:
diff changeset
402
Ritor1
parents:
diff changeset
403 static_sub_4980B9_stru_AE3FE8.uNumVertices = 0;
Ritor1
parents:
diff changeset
404 static_sub_4980B9_stru_AE4BEC.x = a4 * v15 - v14 * a5;
Ritor1
parents:
diff changeset
405 static_sub_4980B9_stru_AE4BEC.y = v13 * a5 - v15 * a3;
Ritor1
parents:
diff changeset
406 static_sub_4980B9_stru_AE4BEC.z = v14 * a3 - v13 * a4;
Ritor1
parents:
diff changeset
407 if (*pOutNumVertices == 0)
Ritor1
parents:
diff changeset
408 return true;
Ritor1
parents:
diff changeset
409
Ritor1
parents:
diff changeset
410 for (uint j = 0; j < *pOutNumVertices; ++j)
Ritor1
parents:
diff changeset
411 {
Ritor1
parents:
diff changeset
412 if (j)
Ritor1
parents:
diff changeset
413 {
Ritor1
parents:
diff changeset
414 if (_4989E1(&pOutVertices[j - 1], &pOutVertices[j], &a1[i], &static_sub_4980B9_stru_AE4BEC) &&
Ritor1
parents:
diff changeset
415 _498774(&pOutVertices[j - 1], &pOutVertices[j], &a1[i], &static_sub_4980B9_stru_AE4BEC, &stru_AE4BFC))
Ritor1
parents:
diff changeset
416 AddVertex(&static_sub_4980B9_stru_AE3FE8, &stru_AE4BFC);
Ritor1
parents:
diff changeset
417 }
Ritor1
parents:
diff changeset
418
Ritor1
parents:
diff changeset
419 if (AreVectorsCollinear(&pOutVertices[j], &a1[i], &static_sub_4980B9_stru_AE4BEC))
Ritor1
parents:
diff changeset
420 AddVertex(&static_sub_4980B9_stru_AE3FE8, &pOutVertices[j]);
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422
Ritor1
parents:
diff changeset
423 if (!static_sub_4980B9_stru_AE3FE8.uNumVertices)
Ritor1
parents:
diff changeset
424 {
Ritor1
parents:
diff changeset
425 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
426 return true;
Ritor1
parents:
diff changeset
427 }
Ritor1
parents:
diff changeset
428 if (_4989E1(&pOutVertices[*pOutNumVertices - 1], &pOutVertices[0], &a1[i], &static_sub_4980B9_stru_AE4BEC) &&
Ritor1
parents:
diff changeset
429 _498774(&pOutVertices[*pOutNumVertices - 1], &pOutVertices[0], &a1[i], &static_sub_4980B9_stru_AE4BEC, &stru_AE4BFC) )
Ritor1
parents:
diff changeset
430 AddVertex(&static_sub_4980B9_stru_AE3FE8, &stru_AE4BFC);
Ritor1
parents:
diff changeset
431
Ritor1
parents:
diff changeset
432 for (uint j = 0; j < static_sub_4980B9_stru_AE3FE8.uNumVertices; ++j)
Ritor1
parents:
diff changeset
433 {
Ritor1
parents:
diff changeset
434 pOutVertices[j].vWorldPosition.y = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.x;
Ritor1
parents:
diff changeset
435 pOutVertices[j].vWorldPosition.y = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.y;
Ritor1
parents:
diff changeset
436 pOutVertices[j].vWorldPosition.z = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.z;
Ritor1
parents:
diff changeset
437 pOutVertices[j].u = static_sub_4980B9_stru_AE3FE8.pVertices[j].u;
Ritor1
parents:
diff changeset
438 pOutVertices[j].v = static_sub_4980B9_stru_AE3FE8.pVertices[j].v;
Ritor1
parents:
diff changeset
439 }
Ritor1
parents:
diff changeset
440 *pOutNumVertices = static_sub_4980B9_stru_AE3FE8.uNumVertices;
Ritor1
parents:
diff changeset
441 }
Ritor1
parents:
diff changeset
442 }
Ritor1
parents:
diff changeset
443
Ritor1
parents:
diff changeset
444 if (v25 < 3)
Ritor1
parents:
diff changeset
445 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
446
Ritor1
parents:
diff changeset
447 return true;
Ritor1
parents:
diff changeset
448 }
Ritor1
parents:
diff changeset
449 // AE4C2C: using guessed type char static_sub_4980B9_byte_AE4C2C_init_flag;