annotate stru10.cpp @ 495:90fdb47bfcba

guilds ...
author Gloval
date Thu, 28 Feb 2013 21:45:39 +0400
parents 9c0607679772
children ecfb1b3c9a39 d4497b76a863
rev   line source
0
Ritor1
parents:
diff changeset
1 #include "stru10.h"
Ritor1
parents:
diff changeset
2 #include "Render.h"
Ritor1
parents:
diff changeset
3 #include "Indoor.h"
Ritor1
parents:
diff changeset
4 #include "Game.h"
Ritor1
parents:
diff changeset
5 #include "Party.h"
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7 #include "mm7_data.h"
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12 //----- (0049CE9E) --------------------------------------------------------
Ritor1
parents:
diff changeset
13 void stru10::_49CE9E(BLVFace *pFace, RenderVertexSoft *a2, signed int a3, RenderVertexSoft *a4)
Ritor1
parents:
diff changeset
14 {
Ritor1
parents:
diff changeset
15 char *v5; // eax@1
Ritor1
parents:
diff changeset
16 signed int v6; // edx@1
Ritor1
parents:
diff changeset
17 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
18 signed int v8; // ecx@11
Ritor1
parents:
diff changeset
19 signed int v9; // esi@11
Ritor1
parents:
diff changeset
20 RenderVertexSoft *v10; // edx@12
Ritor1
parents:
diff changeset
21 double v11; // st6@14
Ritor1
parents:
diff changeset
22 RenderVertexSoft *v12; // edx@19
Ritor1
parents:
diff changeset
23 signed int v13; // ecx@19
Ritor1
parents:
diff changeset
24 signed int v14; // esi@19
Ritor1
parents:
diff changeset
25 RenderVertexSoft *v15; // edi@20
Ritor1
parents:
diff changeset
26 double v16; // st6@22
Ritor1
parents:
diff changeset
27 signed int v17; // ecx@27
Ritor1
parents:
diff changeset
28 signed int v18; // edi@27
Ritor1
parents:
diff changeset
29 char *v19; // esi@28
Ritor1
parents:
diff changeset
30 double v20; // st6@30
Ritor1
parents:
diff changeset
31 signed int v21; // ecx@35
Ritor1
parents:
diff changeset
32 signed int v22; // edi@35
Ritor1
parents:
diff changeset
33 char *v23; // esi@36
Ritor1
parents:
diff changeset
34 double v24; // st7@38
Ritor1
parents:
diff changeset
35 signed int v25; // ecx@45
Ritor1
parents:
diff changeset
36 signed int v26; // esi@45
Ritor1
parents:
diff changeset
37 RenderVertexSoft *v27; // edx@46
Ritor1
parents:
diff changeset
38 double v28; // st6@48
Ritor1
parents:
diff changeset
39 signed int v29; // ecx@53
Ritor1
parents:
diff changeset
40 signed int v30; // esi@53
Ritor1
parents:
diff changeset
41 RenderVertexSoft *v31; // edi@54
Ritor1
parents:
diff changeset
42 double v32; // st6@56
Ritor1
parents:
diff changeset
43 signed int v33; // ecx@61
Ritor1
parents:
diff changeset
44 signed int v34; // edi@61
Ritor1
parents:
diff changeset
45 char *v35; // esi@62
Ritor1
parents:
diff changeset
46 double v36; // st6@64
Ritor1
parents:
diff changeset
47 signed int v37; // edi@69
Ritor1
parents:
diff changeset
48 char *v38; // esi@70
Ritor1
parents:
diff changeset
49 double v39; // st7@72
Ritor1
parents:
diff changeset
50 RenderVertexSoft *v40; // esi@77
Ritor1
parents:
diff changeset
51 signed int v41; // ecx@79
Ritor1
parents:
diff changeset
52 signed int v42; // esi@79
Ritor1
parents:
diff changeset
53 char *v43; // edx@80
Ritor1
parents:
diff changeset
54 double v44; // st6@82
Ritor1
parents:
diff changeset
55 RenderVertexSoft *v45; // eax@87
Ritor1
parents:
diff changeset
56 signed int v46; // ecx@87
Ritor1
parents:
diff changeset
57 signed int v47; // edi@87
Ritor1
parents:
diff changeset
58 char *v48; // esi@88
Ritor1
parents:
diff changeset
59 double v49; // st6@90
Ritor1
parents:
diff changeset
60 signed int v50; // ecx@96
Ritor1
parents:
diff changeset
61 signed int v51; // edi@96
Ritor1
parents:
diff changeset
62 char *v52; // esi@97
Ritor1
parents:
diff changeset
63 double v53; // st6@99
Ritor1
parents:
diff changeset
64 signed int v54; // ecx@105
Ritor1
parents:
diff changeset
65 signed int v55; // edi@105
Ritor1
parents:
diff changeset
66 char *v56; // esi@106
Ritor1
parents:
diff changeset
67 double v57; // st7@108
Ritor1
parents:
diff changeset
68 RenderVertexSoft a2a[64]; // [sp+0h] [bp-C18h]@1
Ritor1
parents:
diff changeset
69 float v59; // [sp+C00h] [bp-18h]@4
Ritor1
parents:
diff changeset
70 float v60; // [sp+C04h] [bp-14h]@9
Ritor1
parents:
diff changeset
71 float v61; // [sp+C08h] [bp-10h]@4
Ritor1
parents:
diff changeset
72 float v62; // [sp+C0Ch] [bp-Ch]@9
Ritor1
parents:
diff changeset
73 float v63; // [sp+C10h] [bp-8h]@4
Ritor1
parents:
diff changeset
74 float v64; // [sp+C14h] [bp-4h]@4
Ritor1
parents:
diff changeset
75 float a1a; // [sp+C20h] [bp+8h]@11
Ritor1
parents:
diff changeset
76 float a1b; // [sp+C20h] [bp+8h]@19
Ritor1
parents:
diff changeset
77 float a1c; // [sp+C20h] [bp+8h]@27
Ritor1
parents:
diff changeset
78 float a1d; // [sp+C20h] [bp+8h]@35
Ritor1
parents:
diff changeset
79 float a1e; // [sp+C20h] [bp+8h]@45
Ritor1
parents:
diff changeset
80 float a1f; // [sp+C20h] [bp+8h]@53
Ritor1
parents:
diff changeset
81 float a1g; // [sp+C20h] [bp+8h]@61
Ritor1
parents:
diff changeset
82 float a1h; // [sp+C20h] [bp+8h]@69
Ritor1
parents:
diff changeset
83 float a1i; // [sp+C20h] [bp+8h]@79
Ritor1
parents:
diff changeset
84 float a1j; // [sp+C20h] [bp+8h]@87
Ritor1
parents:
diff changeset
85 float a1k; // [sp+C20h] [bp+8h]@96
Ritor1
parents:
diff changeset
86 float a1l; // [sp+C20h] [bp+8h]@105
Ritor1
parents:
diff changeset
87
Ritor1
parents:
diff changeset
88 v5 = (char *)&a2a[0].flt_2C;
Ritor1
parents:
diff changeset
89 v6 = 64;
Ritor1
parents:
diff changeset
90 do
Ritor1
parents:
diff changeset
91 {
Ritor1
parents:
diff changeset
92 *(float *)v5 = 0.0;
Ritor1
parents:
diff changeset
93 v5 += 48;
Ritor1
parents:
diff changeset
94 --v6;
Ritor1
parents:
diff changeset
95 }
Ritor1
parents:
diff changeset
96 while ( v6 );
Ritor1
parents:
diff changeset
97 stru10::CalcPolygonBoundingBox(pFace, a2a);
Ritor1
parents:
diff changeset
98 v7 = pFace->uAttributes;
Ritor1
parents:
diff changeset
99 if ( v7 & 0x100 )
Ritor1
parents:
diff changeset
100 {
Ritor1
parents:
diff changeset
101 v63 = a2a[0].vWorldPosition.x;
Ritor1
parents:
diff changeset
102 v59 = a2a[2].vWorldPosition.x;
Ritor1
parents:
diff changeset
103 v61 = a2a[1].vWorldPosition.y;
Ritor1
parents:
diff changeset
104 v64 = a2a[3].vWorldPosition.y;
Ritor1
parents:
diff changeset
105 goto LABEL_10;
Ritor1
parents:
diff changeset
106 }
Ritor1
parents:
diff changeset
107 if ( v7 & 0x200 )
Ritor1
parents:
diff changeset
108 {
Ritor1
parents:
diff changeset
109 v63 = a2a[0].vWorldPosition.x;
Ritor1
parents:
diff changeset
110 v59 = a2a[2].vWorldPosition.x;
Ritor1
parents:
diff changeset
111 }
Ritor1
parents:
diff changeset
112 else
Ritor1
parents:
diff changeset
113 {
Ritor1
parents:
diff changeset
114 if ( !(v7 & 0x400) )
Ritor1
parents:
diff changeset
115 goto LABEL_10;
Ritor1
parents:
diff changeset
116 v61 = a2a[0].vWorldPosition.y;
Ritor1
parents:
diff changeset
117 v64 = a2a[2].vWorldPosition.y;
Ritor1
parents:
diff changeset
118 }
Ritor1
parents:
diff changeset
119 v62 = a2a[1].vWorldPosition.z;
Ritor1
parents:
diff changeset
120 v60 = a2a[3].vWorldPosition.z;
Ritor1
parents:
diff changeset
121 LABEL_10:
Ritor1
parents:
diff changeset
122 if ( v7 & 0x100 )
Ritor1
parents:
diff changeset
123 {
Ritor1
parents:
diff changeset
124 v8 = -1;
Ritor1
parents:
diff changeset
125 a1a = 3.4028235e38;
Ritor1
parents:
diff changeset
126 v9 = 0;
Ritor1
parents:
diff changeset
127 if ( a3 > 0 )
Ritor1
parents:
diff changeset
128 {
Ritor1
parents:
diff changeset
129 v10 = a2;
Ritor1
parents:
diff changeset
130 do
Ritor1
parents:
diff changeset
131 {
Ritor1
parents:
diff changeset
132 if ( v10->vWorldPosition.x <= (double)v63 )
Ritor1
parents:
diff changeset
133 v11 = v63 - v10->vWorldPosition.x;
Ritor1
parents:
diff changeset
134 else
Ritor1
parents:
diff changeset
135 v11 = v10->vWorldPosition.x - v63;
Ritor1
parents:
diff changeset
136 if ( v11 < a1a )
Ritor1
parents:
diff changeset
137 {
Ritor1
parents:
diff changeset
138 a1a = v11;
Ritor1
parents:
diff changeset
139 v8 = v9;
Ritor1
parents:
diff changeset
140 }
Ritor1
parents:
diff changeset
141 ++v9;
Ritor1
parents:
diff changeset
142 ++v10;
Ritor1
parents:
diff changeset
143 }
Ritor1
parents:
diff changeset
144 while ( v9 < a3 );
Ritor1
parents:
diff changeset
145 }
Ritor1
parents:
diff changeset
146 v12 = a4;
Ritor1
parents:
diff changeset
147 a1b = 3.4028235e38;
Ritor1
parents:
diff changeset
148 memcpy(a4, &a2[v8], 0x30u);
Ritor1
parents:
diff changeset
149 v13 = -1;
Ritor1
parents:
diff changeset
150 v14 = 0;
Ritor1
parents:
diff changeset
151 if ( a3 > 0 )
Ritor1
parents:
diff changeset
152 {
Ritor1
parents:
diff changeset
153 v15 = a2;
Ritor1
parents:
diff changeset
154 do
Ritor1
parents:
diff changeset
155 {
Ritor1
parents:
diff changeset
156 if ( v15->vWorldPosition.x <= (double)v59 )
Ritor1
parents:
diff changeset
157 v16 = v59 - v15->vWorldPosition.x;
Ritor1
parents:
diff changeset
158 else
Ritor1
parents:
diff changeset
159 v16 = v15->vWorldPosition.x - v59;
Ritor1
parents:
diff changeset
160 if ( v16 < a1b )
Ritor1
parents:
diff changeset
161 {
Ritor1
parents:
diff changeset
162 a1b = v16;
Ritor1
parents:
diff changeset
163 v13 = v14;
Ritor1
parents:
diff changeset
164 }
Ritor1
parents:
diff changeset
165 ++v14;
Ritor1
parents:
diff changeset
166 ++v15;
Ritor1
parents:
diff changeset
167 }
Ritor1
parents:
diff changeset
168 while ( v14 < a3 );
Ritor1
parents:
diff changeset
169 }
Ritor1
parents:
diff changeset
170 a1c = 3.4028235e38;
Ritor1
parents:
diff changeset
171 memcpy(&a4[2], &a2[v13], sizeof(a4[2]));
Ritor1
parents:
diff changeset
172 v17 = -1;
Ritor1
parents:
diff changeset
173 v18 = 0;
Ritor1
parents:
diff changeset
174 if ( a3 > 0 )
Ritor1
parents:
diff changeset
175 {
Ritor1
parents:
diff changeset
176 v19 = (char *)&a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
177 do
Ritor1
parents:
diff changeset
178 {
Ritor1
parents:
diff changeset
179 if ( *(float *)v19 <= (double)v61 )
Ritor1
parents:
diff changeset
180 v20 = v61 - *(float *)v19;
Ritor1
parents:
diff changeset
181 else
Ritor1
parents:
diff changeset
182 v20 = *(float *)v19 - v61;
Ritor1
parents:
diff changeset
183 if ( v20 < a1c )
Ritor1
parents:
diff changeset
184 {
Ritor1
parents:
diff changeset
185 a1c = v20;
Ritor1
parents:
diff changeset
186 v17 = v18;
Ritor1
parents:
diff changeset
187 }
Ritor1
parents:
diff changeset
188 ++v18;
Ritor1
parents:
diff changeset
189 v19 += 48;
Ritor1
parents:
diff changeset
190 }
Ritor1
parents:
diff changeset
191 while ( v18 < a3 );
Ritor1
parents:
diff changeset
192 }
Ritor1
parents:
diff changeset
193 a1d = 3.4028235e38;
Ritor1
parents:
diff changeset
194 memcpy(&a4[1], &a2[v17], sizeof(a4[1]));
Ritor1
parents:
diff changeset
195 v21 = -1;
Ritor1
parents:
diff changeset
196 v22 = 0;
Ritor1
parents:
diff changeset
197 if ( a3 > 0 )
Ritor1
parents:
diff changeset
198 {
Ritor1
parents:
diff changeset
199 v23 = (char *)&a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
200 do
Ritor1
parents:
diff changeset
201 {
Ritor1
parents:
diff changeset
202 if ( *(float *)v23 <= (double)v64 )
Ritor1
parents:
diff changeset
203 v24 = v64 - *(float *)v23;
Ritor1
parents:
diff changeset
204 else
Ritor1
parents:
diff changeset
205 v24 = *(float *)v23 - v64;
Ritor1
parents:
diff changeset
206 if ( v24 < a1d )
Ritor1
parents:
diff changeset
207 {
Ritor1
parents:
diff changeset
208 a1d = v24;
Ritor1
parents:
diff changeset
209 v21 = v22;
Ritor1
parents:
diff changeset
210 }
Ritor1
parents:
diff changeset
211 ++v22;
Ritor1
parents:
diff changeset
212 v23 += 48;
Ritor1
parents:
diff changeset
213 }
Ritor1
parents:
diff changeset
214 while ( v22 < a3 );
Ritor1
parents:
diff changeset
215 }
Ritor1
parents:
diff changeset
216 LABEL_77:
Ritor1
parents:
diff changeset
217 v40 = &a2[v21];
Ritor1
parents:
diff changeset
218 goto LABEL_115;
Ritor1
parents:
diff changeset
219 }
Ritor1
parents:
diff changeset
220 if ( v7 & 0x200 )
Ritor1
parents:
diff changeset
221 {
Ritor1
parents:
diff changeset
222 v25 = -1;
Ritor1
parents:
diff changeset
223 a1e = 3.4028235e38;
Ritor1
parents:
diff changeset
224 v26 = 0;
Ritor1
parents:
diff changeset
225 if ( a3 > 0 )
Ritor1
parents:
diff changeset
226 {
Ritor1
parents:
diff changeset
227 v27 = a2;
Ritor1
parents:
diff changeset
228 do
Ritor1
parents:
diff changeset
229 {
Ritor1
parents:
diff changeset
230 if ( v27->vWorldPosition.x <= (double)v63 )
Ritor1
parents:
diff changeset
231 v28 = v63 - v27->vWorldPosition.x;
Ritor1
parents:
diff changeset
232 else
Ritor1
parents:
diff changeset
233 v28 = v27->vWorldPosition.x - v63;
Ritor1
parents:
diff changeset
234 if ( v28 < a1e )
Ritor1
parents:
diff changeset
235 {
Ritor1
parents:
diff changeset
236 a1e = v28;
Ritor1
parents:
diff changeset
237 v25 = v26;
Ritor1
parents:
diff changeset
238 }
Ritor1
parents:
diff changeset
239 ++v26;
Ritor1
parents:
diff changeset
240 ++v27;
Ritor1
parents:
diff changeset
241 }
Ritor1
parents:
diff changeset
242 while ( v26 < a3 );
Ritor1
parents:
diff changeset
243 }
Ritor1
parents:
diff changeset
244 v12 = a4;
Ritor1
parents:
diff changeset
245 a1f = 3.4028235e38;
Ritor1
parents:
diff changeset
246 memcpy(a4, &a2[v25], 0x30u);
Ritor1
parents:
diff changeset
247 v29 = -1;
Ritor1
parents:
diff changeset
248 v30 = 0;
Ritor1
parents:
diff changeset
249 if ( a3 > 0 )
Ritor1
parents:
diff changeset
250 {
Ritor1
parents:
diff changeset
251 v31 = a2;
Ritor1
parents:
diff changeset
252 do
Ritor1
parents:
diff changeset
253 {
Ritor1
parents:
diff changeset
254 if ( v31->vWorldPosition.x <= (double)v59 )
Ritor1
parents:
diff changeset
255 v32 = v59 - v31->vWorldPosition.x;
Ritor1
parents:
diff changeset
256 else
Ritor1
parents:
diff changeset
257 v32 = v31->vWorldPosition.x - v59;
Ritor1
parents:
diff changeset
258 if ( v32 < a1f )
Ritor1
parents:
diff changeset
259 {
Ritor1
parents:
diff changeset
260 a1f = v32;
Ritor1
parents:
diff changeset
261 v29 = v30;
Ritor1
parents:
diff changeset
262 }
Ritor1
parents:
diff changeset
263 ++v30;
Ritor1
parents:
diff changeset
264 ++v31;
Ritor1
parents:
diff changeset
265 }
Ritor1
parents:
diff changeset
266 while ( v30 < a3 );
Ritor1
parents:
diff changeset
267 }
Ritor1
parents:
diff changeset
268 a1g = 3.4028235e38;
Ritor1
parents:
diff changeset
269 memcpy(&a4[2], &a2[v29], sizeof(a4[2]));
Ritor1
parents:
diff changeset
270 v33 = -1;
Ritor1
parents:
diff changeset
271 v34 = 0;
Ritor1
parents:
diff changeset
272 if ( a3 > 0 )
Ritor1
parents:
diff changeset
273 {
Ritor1
parents:
diff changeset
274 v35 = (char *)&a2->vWorldPosition.z;
Ritor1
parents:
diff changeset
275 do
Ritor1
parents:
diff changeset
276 {
Ritor1
parents:
diff changeset
277 if ( *(float *)v35 <= (double)v62 )
Ritor1
parents:
diff changeset
278 v36 = v62 - *(float *)v35;
Ritor1
parents:
diff changeset
279 else
Ritor1
parents:
diff changeset
280 v36 = *(float *)v35 - v62;
Ritor1
parents:
diff changeset
281 if ( v36 < a1g )
Ritor1
parents:
diff changeset
282 {
Ritor1
parents:
diff changeset
283 a1g = v36;
Ritor1
parents:
diff changeset
284 v33 = v34;
Ritor1
parents:
diff changeset
285 }
Ritor1
parents:
diff changeset
286 ++v34;
Ritor1
parents:
diff changeset
287 v35 += 48;
Ritor1
parents:
diff changeset
288 }
Ritor1
parents:
diff changeset
289 while ( v34 < a3 );
Ritor1
parents:
diff changeset
290 }
Ritor1
parents:
diff changeset
291 a1h = 3.4028235e38;
Ritor1
parents:
diff changeset
292 memcpy(&a4[1], &a2[v33], sizeof(a4[1]));
Ritor1
parents:
diff changeset
293 v21 = -1;
Ritor1
parents:
diff changeset
294 v37 = 0;
Ritor1
parents:
diff changeset
295 if ( a3 > 0 )
Ritor1
parents:
diff changeset
296 {
Ritor1
parents:
diff changeset
297 v38 = (char *)&a2->vWorldPosition.z;
Ritor1
parents:
diff changeset
298 do
Ritor1
parents:
diff changeset
299 {
Ritor1
parents:
diff changeset
300 if ( *(float *)v38 <= (double)v60 )
Ritor1
parents:
diff changeset
301 v39 = v60 - *(float *)v38;
Ritor1
parents:
diff changeset
302 else
Ritor1
parents:
diff changeset
303 v39 = *(float *)v38 - v60;
Ritor1
parents:
diff changeset
304 if ( v39 < a1h )
Ritor1
parents:
diff changeset
305 {
Ritor1
parents:
diff changeset
306 a1h = v39;
Ritor1
parents:
diff changeset
307 v21 = v37;
Ritor1
parents:
diff changeset
308 }
Ritor1
parents:
diff changeset
309 ++v37;
Ritor1
parents:
diff changeset
310 v38 += 48;
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 while ( v37 < a3 );
Ritor1
parents:
diff changeset
313 }
Ritor1
parents:
diff changeset
314 goto LABEL_77;
Ritor1
parents:
diff changeset
315 }
Ritor1
parents:
diff changeset
316 if ( !(v7 & 0x400) )
Ritor1
parents:
diff changeset
317 return;
Ritor1
parents:
diff changeset
318 v41 = -1;
Ritor1
parents:
diff changeset
319 a1i = 3.4028235e38;
Ritor1
parents:
diff changeset
320 v42 = 0;
Ritor1
parents:
diff changeset
321 if ( a3 > 0 )
Ritor1
parents:
diff changeset
322 {
Ritor1
parents:
diff changeset
323 v43 = (char *)&a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
324 do
Ritor1
parents:
diff changeset
325 {
Ritor1
parents:
diff changeset
326 if ( *(float *)v43 <= (double)v61 )
Ritor1
parents:
diff changeset
327 v44 = v61 - *(float *)v43;
Ritor1
parents:
diff changeset
328 else
Ritor1
parents:
diff changeset
329 v44 = *(float *)v43 - v61;
Ritor1
parents:
diff changeset
330 if ( v44 < a1i )
Ritor1
parents:
diff changeset
331 {
Ritor1
parents:
diff changeset
332 a1i = v44;
Ritor1
parents:
diff changeset
333 v41 = v42;
Ritor1
parents:
diff changeset
334 }
Ritor1
parents:
diff changeset
335 ++v42;
Ritor1
parents:
diff changeset
336 v43 += 48;
Ritor1
parents:
diff changeset
337 }
Ritor1
parents:
diff changeset
338 while ( v42 < a3 );
Ritor1
parents:
diff changeset
339 }
Ritor1
parents:
diff changeset
340 v45 = a2;
Ritor1
parents:
diff changeset
341 v12 = a4;
Ritor1
parents:
diff changeset
342 a1j = 3.4028235e38;
Ritor1
parents:
diff changeset
343 memcpy(a4, &a2[v41], 0x30u);
Ritor1
parents:
diff changeset
344 v46 = -1;
Ritor1
parents:
diff changeset
345 v47 = 0;
Ritor1
parents:
diff changeset
346 if ( a3 > 0 )
Ritor1
parents:
diff changeset
347 {
Ritor1
parents:
diff changeset
348 v48 = (char *)&a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
349 do
Ritor1
parents:
diff changeset
350 {
Ritor1
parents:
diff changeset
351 if ( *(float *)v48 <= (double)v64 )
Ritor1
parents:
diff changeset
352 v49 = v64 - *(float *)v48;
Ritor1
parents:
diff changeset
353 else
Ritor1
parents:
diff changeset
354 v49 = *(float *)v48 - v64;
Ritor1
parents:
diff changeset
355 if ( v49 < a1j )
Ritor1
parents:
diff changeset
356 {
Ritor1
parents:
diff changeset
357 a1j = v49;
Ritor1
parents:
diff changeset
358 v46 = v47;
Ritor1
parents:
diff changeset
359 }
Ritor1
parents:
diff changeset
360 ++v47;
Ritor1
parents:
diff changeset
361 v48 += 48;
Ritor1
parents:
diff changeset
362 }
Ritor1
parents:
diff changeset
363 while ( v47 < a3 );
Ritor1
parents:
diff changeset
364 v45 = a2;
Ritor1
parents:
diff changeset
365 }
Ritor1
parents:
diff changeset
366 a1k = 3.4028235e38;
Ritor1
parents:
diff changeset
367 memcpy(&a4[2], &v45[v46], sizeof(a4[2]));
Ritor1
parents:
diff changeset
368 v50 = -1;
Ritor1
parents:
diff changeset
369 v51 = 0;
Ritor1
parents:
diff changeset
370 if ( a3 > 0 )
Ritor1
parents:
diff changeset
371 {
Ritor1
parents:
diff changeset
372 v52 = (char *)&v45->vWorldPosition.z;
Ritor1
parents:
diff changeset
373 do
Ritor1
parents:
diff changeset
374 {
Ritor1
parents:
diff changeset
375 if ( *(float *)v52 <= (double)v62 )
Ritor1
parents:
diff changeset
376 v53 = v62 - *(float *)v52;
Ritor1
parents:
diff changeset
377 else
Ritor1
parents:
diff changeset
378 v53 = *(float *)v52 - v62;
Ritor1
parents:
diff changeset
379 if ( v53 < a1k )
Ritor1
parents:
diff changeset
380 {
Ritor1
parents:
diff changeset
381 a1k = v53;
Ritor1
parents:
diff changeset
382 v50 = v51;
Ritor1
parents:
diff changeset
383 }
Ritor1
parents:
diff changeset
384 ++v51;
Ritor1
parents:
diff changeset
385 v52 += 48;
Ritor1
parents:
diff changeset
386 }
Ritor1
parents:
diff changeset
387 while ( v51 < a3 );
Ritor1
parents:
diff changeset
388 v45 = a2;
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390 a1l = 3.4028235e38;
Ritor1
parents:
diff changeset
391 memcpy(&a4[1], &v45[v50], sizeof(a4[1]));
Ritor1
parents:
diff changeset
392 v54 = -1;
Ritor1
parents:
diff changeset
393 v55 = 0;
Ritor1
parents:
diff changeset
394 if ( a3 > 0 )
Ritor1
parents:
diff changeset
395 {
Ritor1
parents:
diff changeset
396 v56 = (char *)&v45->vWorldPosition.z;
Ritor1
parents:
diff changeset
397 do
Ritor1
parents:
diff changeset
398 {
Ritor1
parents:
diff changeset
399 if ( *(float *)v56 <= (double)v60 )
Ritor1
parents:
diff changeset
400 v57 = v60 - *(float *)v56;
Ritor1
parents:
diff changeset
401 else
Ritor1
parents:
diff changeset
402 v57 = *(float *)v56 - v60;
Ritor1
parents:
diff changeset
403 if ( v57 < a1l )
Ritor1
parents:
diff changeset
404 {
Ritor1
parents:
diff changeset
405 a1l = v57;
Ritor1
parents:
diff changeset
406 v54 = v55;
Ritor1
parents:
diff changeset
407 }
Ritor1
parents:
diff changeset
408 ++v55;
Ritor1
parents:
diff changeset
409 v56 += 48;
Ritor1
parents:
diff changeset
410 }
Ritor1
parents:
diff changeset
411 while ( v55 < a3 );
Ritor1
parents:
diff changeset
412 v45 = a2;
Ritor1
parents:
diff changeset
413 }
Ritor1
parents:
diff changeset
414 v40 = &v45[v54];
Ritor1
parents:
diff changeset
415 LABEL_115:
Ritor1
parents:
diff changeset
416 memcpy(&v12[3], v40, sizeof(v12[3]));
Ritor1
parents:
diff changeset
417 }
Ritor1
parents:
diff changeset
418
Ritor1
parents:
diff changeset
419 //----- (0049D379) --------------------------------------------------------
Ritor1
parents:
diff changeset
420 void stru10::CalcPolygonBoundingBox(BLVFace *pFace, RenderVertexSoft *pOutVertices)
Ritor1
parents:
diff changeset
421 {
Ritor1
parents:
diff changeset
422 struct
Ritor1
parents:
diff changeset
423 {
Ritor1
parents:
diff changeset
424 float x;
Ritor1
parents:
diff changeset
425 float y;
Ritor1
parents:
diff changeset
426 int c;
Ritor1
parents:
diff changeset
427 } v46[40]; //[sp+0C];
Ritor1
parents:
diff changeset
428
Ritor1
parents:
diff changeset
429 if (pFace->uAttributes & 0x0100)
Ritor1
parents:
diff changeset
430 {
Ritor1
parents:
diff changeset
431 for (uint i = 0; i < pFace->uNumVertices; ++i)
Ritor1
parents:
diff changeset
432 {
Ritor1
parents:
diff changeset
433 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].x + pFace->pXInterceptDisplacements[i];
Ritor1
parents:
diff changeset
434 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].y + pFace->pYInterceptDisplacements[i];
Ritor1
parents:
diff changeset
435 v46[i].c = i;
Ritor1
parents:
diff changeset
436 }
Ritor1
parents:
diff changeset
437 }
Ritor1
parents:
diff changeset
438 if (pFace->uAttributes & 0x0200)
Ritor1
parents:
diff changeset
439 {
Ritor1
parents:
diff changeset
440 for (uint i = 0; i < pFace->uNumVertices; ++i)
Ritor1
parents:
diff changeset
441 {
Ritor1
parents:
diff changeset
442 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].x + pFace->pXInterceptDisplacements[i];
Ritor1
parents:
diff changeset
443 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].y + pFace->pZInterceptDisplacements[i];
Ritor1
parents:
diff changeset
444 v46[i].c = i;
Ritor1
parents:
diff changeset
445 }
Ritor1
parents:
diff changeset
446 }
Ritor1
parents:
diff changeset
447 if (pFace->uAttributes & 0x0400)
Ritor1
parents:
diff changeset
448 {
Ritor1
parents:
diff changeset
449 for (uint i = 0; i < pFace->uNumVertices; ++i)
Ritor1
parents:
diff changeset
450 {
Ritor1
parents:
diff changeset
451 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].x + pFace->pYInterceptDisplacements[i];
Ritor1
parents:
diff changeset
452 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].y + pFace->pZInterceptDisplacements[i];
Ritor1
parents:
diff changeset
453 v46[i].c = i;
Ritor1
parents:
diff changeset
454 }
Ritor1
parents:
diff changeset
455 }
Ritor1
parents:
diff changeset
456
Ritor1
parents:
diff changeset
457 float x_min = FLT_MAX;
Ritor1
parents:
diff changeset
458 uint x_min_idx = 0;
Ritor1
parents:
diff changeset
459
Ritor1
parents:
diff changeset
460 float x_max = FLT_MIN;
Ritor1
parents:
diff changeset
461 uint x_max_idx = 0;
Ritor1
parents:
diff changeset
462
Ritor1
parents:
diff changeset
463 float y_min = FLT_MAX;
Ritor1
parents:
diff changeset
464 uint y_min_idx = 0;
Ritor1
parents:
diff changeset
465
Ritor1
parents:
diff changeset
466 float y_max = FLT_MIN;
Ritor1
parents:
diff changeset
467 uint y_max_idx = 0;
Ritor1
parents:
diff changeset
468
Ritor1
parents:
diff changeset
469 for (uint i = 0; i < pFace->uNumVertices; ++i)
Ritor1
parents:
diff changeset
470 {
Ritor1
parents:
diff changeset
471 if (v46[i].x < x_min)
Ritor1
parents:
diff changeset
472 {
Ritor1
parents:
diff changeset
473 x_min = v46[i].x;
Ritor1
parents:
diff changeset
474 x_min_idx = v46[i].c;
Ritor1
parents:
diff changeset
475 }
Ritor1
parents:
diff changeset
476 if (v46[i].x > x_max)
Ritor1
parents:
diff changeset
477 {
Ritor1
parents:
diff changeset
478 x_max = v46[i].x;
Ritor1
parents:
diff changeset
479 x_max_idx = v46[i].c;
Ritor1
parents:
diff changeset
480 }
Ritor1
parents:
diff changeset
481
Ritor1
parents:
diff changeset
482 if (v46[i].y < y_min)
Ritor1
parents:
diff changeset
483 {
Ritor1
parents:
diff changeset
484 y_min = v46[i].y;
Ritor1
parents:
diff changeset
485 y_min_idx = v46[i].c;
Ritor1
parents:
diff changeset
486 }
Ritor1
parents:
diff changeset
487 if (v46[i].y > y_max)
Ritor1
parents:
diff changeset
488 {
Ritor1
parents:
diff changeset
489 y_max = v46[i].y;
Ritor1
parents:
diff changeset
490 y_max_idx = v46[i].c;
Ritor1
parents:
diff changeset
491 }
Ritor1
parents:
diff changeset
492 }
Ritor1
parents:
diff changeset
493
Ritor1
parents:
diff changeset
494
Ritor1
parents:
diff changeset
495
Ritor1
parents:
diff changeset
496 auto p1 = &pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]];
Ritor1
parents:
diff changeset
497 RenderVertexSoft v1; // [sp+30Ch] [bp-54h]@24
Ritor1
parents:
diff changeset
498 v1.vWorldPosition.x = (float)p1->x;
Ritor1
parents:
diff changeset
499 v1.vWorldPosition.y = (float)p1->y;
Ritor1
parents:
diff changeset
500 v1.vWorldPosition.z = (float)p1->z;
Ritor1
parents:
diff changeset
501 memcpy(pOutVertices + 0, &v1, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
502
Ritor1
parents:
diff changeset
503 auto p2 = &pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]];
Ritor1
parents:
diff changeset
504 RenderVertexSoft v2; // [sp+30Ch] [bp-54h]@24
Ritor1
parents:
diff changeset
505 v2.vWorldPosition.x = (float)p2->x;
Ritor1
parents:
diff changeset
506 v2.vWorldPosition.y = (float)p2->y;
Ritor1
parents:
diff changeset
507 v2.vWorldPosition.z = (float)p2->z;
Ritor1
parents:
diff changeset
508 memcpy(pOutVertices + 1, &v2, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
509
Ritor1
parents:
diff changeset
510 auto p3 = &pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]];
Ritor1
parents:
diff changeset
511 RenderVertexSoft v3; // [sp+30Ch] [bp-54h]@24
Ritor1
parents:
diff changeset
512 v3.vWorldPosition.x = (float)p3->x;
Ritor1
parents:
diff changeset
513 v3.vWorldPosition.y = (float)p3->y;
Ritor1
parents:
diff changeset
514 v3.vWorldPosition.z = (float)p3->z;
Ritor1
parents:
diff changeset
515 memcpy(pOutVertices + 2, &v3, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
516
Ritor1
parents:
diff changeset
517 auto p4 = &pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]];
Ritor1
parents:
diff changeset
518 RenderVertexSoft v4; // [sp+30Ch] [bp-54h]@24
Ritor1
parents:
diff changeset
519 v4.vWorldPosition.x = (double)p4->x;
Ritor1
parents:
diff changeset
520 v4.vWorldPosition.y = (double)p4->y;
Ritor1
parents:
diff changeset
521 v4.vWorldPosition.z = (double)p4->z;
Ritor1
parents:
diff changeset
522 memcpy(pOutVertices + 3, &v4, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
523 }
Ritor1
parents:
diff changeset
524
Ritor1
parents:
diff changeset
525
Ritor1
parents:
diff changeset
526 //----- (0049C9E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
527 bool stru10::_49C9E3(BLVFace *pFace, RenderVertexSoft *pFaceBounding, unsigned int uNumVertices, RenderVertexSoft *arg0)
Ritor1
parents:
diff changeset
528 {
Ritor1
parents:
diff changeset
529 //IndoorCameraD3D *v6; // edi@1
Ritor1
parents:
diff changeset
530 //PolygonType v7; // al@1
Ritor1
parents:
diff changeset
531 //unsigned int v8; // edx@7
Ritor1
parents:
diff changeset
532 //char v10; // zf@10
Ritor1
parents:
diff changeset
533 //float v13; // ST14_4@20
Ritor1
parents:
diff changeset
534 //stru10 *v15; // ecx@21
Ritor1
parents:
diff changeset
535 //RenderVertexSoft *v16; // ST0C_4@21
Ritor1
parents:
diff changeset
536 //bool result; // eax@21
Ritor1
parents:
diff changeset
537 //float v18; // ST14_4@24
Ritor1
parents:
diff changeset
538 //stru10 *v19; // edi@29
Ritor1
parents:
diff changeset
539 //float v20; // ST14_4@30
Ritor1
parents:
diff changeset
540 //float v21; // ST14_4@30
Ritor1
parents:
diff changeset
541 //float v22; // ST14_4@30
Ritor1
parents:
diff changeset
542 //float v23; // ST14_4@30
Ritor1
parents:
diff changeset
543 //float v24; // ST14_4@31
Ritor1
parents:
diff changeset
544 //RenderVertexSoft v25; // [sp+10h] [bp-90h]@24
Ritor1
parents:
diff changeset
545 //RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
Ritor1
parents:
diff changeset
546 //IndoorCameraD3D *thisa; // [sp+70h] [bp-30h]@1
Ritor1
parents:
diff changeset
547 //stru10 *v31; // [sp+84h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
548 float v32; // [sp+88h] [bp-18h]@8
Ritor1
parents:
diff changeset
549 Vec3_float_ a1; // [sp+8Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
550 float v35; // [sp+9Ch] [bp-4h]@8
Ritor1
parents:
diff changeset
551
Ritor1
parents:
diff changeset
552 //auto a3 = pFace;
Ritor1
parents:
diff changeset
553 //auto arg4 = pFaceBounding;
Ritor1
parents:
diff changeset
554
Ritor1
parents:
diff changeset
555 //_ESI = a3;
Ritor1
parents:
diff changeset
556 //v31 = this;
Ritor1
parents:
diff changeset
557 //v6 = pGame->pIndoorCameraD3D;
Ritor1
parents:
diff changeset
558 //v7 = a3->uPolygonType;
Ritor1
parents:
diff changeset
559
Ritor1
parents:
diff changeset
560 a1.x = 0.0f;
Ritor1
parents:
diff changeset
561 a1.y = 0.0f;
Ritor1
parents:
diff changeset
562 a1.z = 0.0f;
Ritor1
parents:
diff changeset
563
Ritor1
parents:
diff changeset
564 float var_28;
Ritor1
parents:
diff changeset
565 float var_24;
Ritor1
parents:
diff changeset
566 if (pFace->uPolygonType == POLYGON_VerticalWall)
Ritor1
parents:
diff changeset
567 {
Ritor1
parents:
diff changeset
568 a1.x = -pFace->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
569 a1.y = pFace->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
570 a1.z = 0.0f;
Ritor1
parents:
diff changeset
571 a1.Normalize();
Ritor1
parents:
diff changeset
572
Ritor1
parents:
diff changeset
573 var_28 = 0;
Ritor1
parents:
diff changeset
574 var_24 = 1;
Ritor1
parents:
diff changeset
575 }
Ritor1
parents:
diff changeset
576 else if (pFace->uPolygonType == POLYGON_Floor ||
Ritor1
parents:
diff changeset
577 pFace->uPolygonType == POLYGON_Ceiling)
Ritor1
parents:
diff changeset
578 {
Ritor1
parents:
diff changeset
579 a1.x = 1;
Ritor1
parents:
diff changeset
580 a1.y = 0;
Ritor1
parents:
diff changeset
581 a1.z = 0.0f;
Ritor1
parents:
diff changeset
582
Ritor1
parents:
diff changeset
583 var_28 = 1;
Ritor1
parents:
diff changeset
584 var_24 = 0;
Ritor1
parents:
diff changeset
585 }
Ritor1
parents:
diff changeset
586
Ritor1
parents:
diff changeset
587
Ritor1
parents:
diff changeset
588 float arg_4;
Ritor1
parents:
diff changeset
589 float var_18;
Ritor1
parents:
diff changeset
590 float var_4;
Ritor1
parents:
diff changeset
591 float a3;
Ritor1
parents:
diff changeset
592 float var_8;
Ritor1
parents:
diff changeset
593 //v8 = _ESI->uAttributes;
Ritor1
parents:
diff changeset
594 //_ECX = pFaceBounding;
Ritor1
parents:
diff changeset
595 //__asm { fld 0.5 }
Ritor1
parents:
diff changeset
596 if (pFace->uAttributes & 0x0100)
Ritor1
parents:
diff changeset
597 {
Ritor1
parents:
diff changeset
598 arg_4 = (pFaceBounding[0].vWorldPosition.x + pFaceBounding[2].vWorldPosition.x) / 2;
Ritor1
parents:
diff changeset
599 var_18 = (pFaceBounding[3].vWorldPosition.y + pFaceBounding[1].vWorldPosition.y) / 2;
Ritor1
parents:
diff changeset
600 var_4 = (pFaceBounding[0].vWorldPosition.z + pFaceBounding[2].vWorldPosition.z) / 2;
Ritor1
parents:
diff changeset
601
Ritor1
parents:
diff changeset
602 a3 = arg_4 - pFaceBounding[0].vWorldPosition.x;
Ritor1
parents:
diff changeset
603 var_8 = var_18 - pFaceBounding[1].vWorldPosition.y;
Ritor1
parents:
diff changeset
604 }
Ritor1
parents:
diff changeset
605 if (pFace->uAttributes & 0x0200)
Ritor1
parents:
diff changeset
606 {
Ritor1
parents:
diff changeset
607 arg_4 = (pFaceBounding[0].vWorldPosition.x + pFaceBounding[2].vWorldPosition.x) / 2;
Ritor1
parents:
diff changeset
608 var_18 = (pFaceBounding[0].vWorldPosition.y + pFaceBounding[2].vWorldPosition.y) / 2;
Ritor1
parents:
diff changeset
609 var_4 = (pFaceBounding[1].vWorldPosition.z + pFaceBounding[3].vWorldPosition.z) / 2;
Ritor1
parents:
diff changeset
610
Ritor1
parents:
diff changeset
611 a3 = arg_4 - pFaceBounding[0].vWorldPosition.x;
Ritor1
parents:
diff changeset
612 var_8 = var_4 - pFaceBounding[1].vWorldPosition.z;
Ritor1
parents:
diff changeset
613
Ritor1
parents:
diff changeset
614 if (pFace->uPolygonType == POLYGON_VerticalWall)
Ritor1
parents:
diff changeset
615 a3 /= a1.x;
Ritor1
parents:
diff changeset
616 }
Ritor1
parents:
diff changeset
617 if (pFace->uAttributes & 0x0400)
Ritor1
parents:
diff changeset
618 {
Ritor1
parents:
diff changeset
619 arg_4 = (pFaceBounding[0].vWorldPosition.x + pFaceBounding[2].vWorldPosition.x) / 2;
Ritor1
parents:
diff changeset
620 var_18 = (pFaceBounding[0].vWorldPosition.y + pFaceBounding[2].vWorldPosition.y) / 2;
Ritor1
parents:
diff changeset
621 var_4 = (pFaceBounding[1].vWorldPosition.z + pFaceBounding[3].vWorldPosition.z) / 2;
Ritor1
parents:
diff changeset
622
Ritor1
parents:
diff changeset
623 a3 = var_18 - pFaceBounding[0].vWorldPosition.y;
Ritor1
parents:
diff changeset
624 var_8 = var_4 - pFaceBounding[1].vWorldPosition.z;
Ritor1
parents:
diff changeset
625 // [0.5]
Ritor1
parents:
diff changeset
626 if (pFace->uPolygonType == POLYGON_VerticalWall)
Ritor1
parents:
diff changeset
627 {
Ritor1
parents:
diff changeset
628 if (a1.x != 1.0f)
Ritor1
parents:
diff changeset
629 a3 /= a1.y;
Ritor1
parents:
diff changeset
630 }
Ritor1
parents:
diff changeset
631 }
Ritor1
parents:
diff changeset
632
Ritor1
parents:
diff changeset
633
Ritor1
parents:
diff changeset
634 if ( byte_4D864C && pGame->uFlags & 8 )
Ritor1
parents:
diff changeset
635 {
Ritor1
parents:
diff changeset
636 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
Ritor1
parents:
diff changeset
637 v26.vWorldPosition.x = arg_4;
Ritor1
parents:
diff changeset
638 v26.vWorldPosition.y = v32;
Ritor1
parents:
diff changeset
639 v26.vWorldPosition.z = v35;
Ritor1
parents:
diff changeset
640
Ritor1
parents:
diff changeset
641 pGame->pIndoorCameraD3D->do_draw_debug_line_sw(pFaceBounding, 0xFF00u, &v26, 0xFF0000u, 0, 0);
Ritor1
parents:
diff changeset
642 }
Ritor1
parents:
diff changeset
643
Ritor1
parents:
diff changeset
644 //_EBX = arg0;
Ritor1
parents:
diff changeset
645 //v15 = v31;
Ritor1
parents:
diff changeset
646 //v16 = arg0;
Ritor1
parents:
diff changeset
647 float var_20 = var_8 * var_24;
Ritor1
parents:
diff changeset
648 var_8 = a3 * a1.z;
Ritor1
parents:
diff changeset
649 float arg_0 = var_8 + var_4;
Ritor1
parents:
diff changeset
650
Ritor1
parents:
diff changeset
651 arg0[0].vWorldPosition.x = arg_4 - a3 * a1.x + var_8 * flt_4D84E8;
Ritor1
parents:
diff changeset
652 arg0[0].vWorldPosition.y = var_18 - a3 * a1.y + var_8 * var_28;
Ritor1
parents:
diff changeset
653 arg0[0].vWorldPosition.z = var_4 - var_8 + var_8 * var_24;
Ritor1
parents:
diff changeset
654 arg0[1].vWorldPosition.x = arg_4 - a3 * a1.x - var_8 * flt_4D84E8;
Ritor1
parents:
diff changeset
655 arg0[1].vWorldPosition.y = var_18 - a3 * a1.y - var_8 * var_28;
Ritor1
parents:
diff changeset
656 arg0[1].vWorldPosition.z = (var_4 - var_8) - var_8 * var_24;
Ritor1
parents:
diff changeset
657 arg0[2].vWorldPosition.x = a3 * a1.x + arg_4 - var_8 * flt_4D84E8;
Ritor1
parents:
diff changeset
658 arg0[2].vWorldPosition.y = a3 * a1.y + var_18 - var_8 * var_28;
Ritor1
parents:
diff changeset
659 arg0[2].vWorldPosition.z = var_8 + var_4 - var_20;
Ritor1
parents:
diff changeset
660 arg0[3].vWorldPosition.x = (a3 * a1.x + arg_4) + var_8 * flt_4D84E8;
Ritor1
parents:
diff changeset
661 arg0[3].vWorldPosition.y = a3 * a1.y + var_18 + var_8 * var_28;
Ritor1
parents:
diff changeset
662 arg0[3].vWorldPosition.z = arg_0 + var_20;
Ritor1
parents:
diff changeset
663
Ritor1
parents:
diff changeset
664 a3 = (var_4 - var_8);
Ritor1
parents:
diff changeset
665 a3 = (a3 * a1.x + arg_4);
Ritor1
parents:
diff changeset
666
Ritor1
parents:
diff changeset
667 a1.x = 0.0f;
Ritor1
parents:
diff changeset
668 a1.y = 0.0f;
Ritor1
parents:
diff changeset
669 a1.z = 0.0f;
Ritor1
parents:
diff changeset
670
Ritor1
parents:
diff changeset
671 if (!_49C8DC(arg0, &a1, &a3))
Ritor1
parents:
diff changeset
672 return false;
Ritor1
parents:
diff changeset
673
Ritor1
parents:
diff changeset
674
Ritor1
parents:
diff changeset
675 if ( byte_4D864C )
Ritor1
parents:
diff changeset
676 {
Ritor1
parents:
diff changeset
677 if ( pGame->uFlags & 8 )
Ritor1
parents:
diff changeset
678 {
Ritor1
parents:
diff changeset
679 RenderVertexSoft v25; // [sp+10h] [bp-90h]@20
Ritor1
parents:
diff changeset
680 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
Ritor1
parents:
diff changeset
681
Ritor1
parents:
diff changeset
682 v25.vWorldPosition.x = arg_4;
Ritor1
parents:
diff changeset
683 v25.vWorldPosition.y = v32;
Ritor1
parents:
diff changeset
684 v25.vWorldPosition.z = v35;
Ritor1
parents:
diff changeset
685
Ritor1
parents:
diff changeset
686 v26.vWorldPosition.x = a1.x * 30.0f;
Ritor1
parents:
diff changeset
687 v26.vWorldPosition.y = a1.y * 30.0f;
Ritor1
parents:
diff changeset
688 v26.vWorldPosition.z = a1.z * 30.0f;
Ritor1
parents:
diff changeset
689
Ritor1
parents:
diff changeset
690 pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v25, 0xFFFFFFFFu, &v26, 0xFFFF00u, 0, 0);
Ritor1
parents:
diff changeset
691 }
Ritor1
parents:
diff changeset
692 }
Ritor1
parents:
diff changeset
693
Ritor1
parents:
diff changeset
694
Ritor1
parents:
diff changeset
695 RenderVertexSoft v25; // [sp+10h] [bp-90h]@20
Ritor1
parents:
diff changeset
696 memcpy(&v25, arg0, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
697
Ritor1
parents:
diff changeset
698 float _dp = (v25.vWorldPosition.x - pBLVRenderParams->vPartyPos.x) * a1.x +
Ritor1
parents:
diff changeset
699 (v25.vWorldPosition.y - pBLVRenderParams->vPartyPos.y) * a1.y +
Ritor1
parents:
diff changeset
700 (v25.vWorldPosition.z - pBLVRenderParams->vPartyPos.z) * a1.z;
Ritor1
parents:
diff changeset
701 if (fabs(_dp) < 1e-6f)
Ritor1
parents:
diff changeset
702 {
Ritor1
parents:
diff changeset
703 memcpy(&v25, arg0 + 1, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
704 memcpy(arg0 + 1, arg0 + 3, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
705 memcpy(arg0 + 3, &v25, sizeof(RenderVertexSoft));
Ritor1
parents:
diff changeset
706 }
Ritor1
parents:
diff changeset
707
Ritor1
parents:
diff changeset
708 if ( byte_4D864C && pGame->uFlags & 8 )
Ritor1
parents:
diff changeset
709 {
Ritor1
parents:
diff changeset
710 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
Ritor1
parents:
diff changeset
711 if ( !LOBYTE(field_4) )
Ritor1
parents:
diff changeset
712 {
Ritor1
parents:
diff changeset
713 v26.vWorldPosition.x = pParty->vPosition.x;
Ritor1
parents:
diff changeset
714 v26.vWorldPosition.y = pParty->vPosition.y;
Ritor1
parents:
diff changeset
715 v26.vWorldPosition.z = pParty->vPosition.z + pParty->sEyelevel;
Ritor1
parents:
diff changeset
716
Ritor1
parents:
diff changeset
717 pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF0000u, arg0, 0xFF0000u, 0, 0);
Ritor1
parents:
diff changeset
718 pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF00u, arg0 + 1, 0xFF00u, 0, 0);
Ritor1
parents:
diff changeset
719 pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFu, arg0 + 2, 0xFFu, 0, 0);
Ritor1
parents:
diff changeset
720 pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFFFFFu, arg0 + 3, 0xFFFFFFu, 0, 0);
Ritor1
parents:
diff changeset
721 LOBYTE(field_4) = 1;
Ritor1
parents:
diff changeset
722 }
Ritor1
parents:
diff changeset
723 pGame->pIndoorCameraD3D->debug_outline_sw(arg0, uNumVertices, 0x1EFF1Eu, 0.00019999999);
Ritor1
parents:
diff changeset
724 }
Ritor1
parents:
diff changeset
725 return true;
Ritor1
parents:
diff changeset
726 }
Ritor1
parents:
diff changeset
727
Ritor1
parents:
diff changeset
728
Ritor1
parents:
diff changeset
729
Ritor1
parents:
diff changeset
730 //----- (0049C5B0) --------------------------------------------------------
Ritor1
parents:
diff changeset
731 stru10::stru10()
Ritor1
parents:
diff changeset
732 {
Ritor1
parents:
diff changeset
733 LOBYTE(this->field_4) = 0;
Ritor1
parents:
diff changeset
734 }
Ritor1
parents:
diff changeset
735
Ritor1
parents:
diff changeset
736 //----- (0049C5BD) --------------------------------------------------------
Ritor1
parents:
diff changeset
737 stru10::~stru10()
Ritor1
parents:
diff changeset
738 {
Ritor1
parents:
diff changeset
739 }
Ritor1
parents:
diff changeset
740
Ritor1
parents:
diff changeset
741 //----- (0049C5DA) --------------------------------------------------------
Ritor1
parents:
diff changeset
742 char stru10::_49C5DA(BLVFace *a2, RenderVertexSoft *a3, int *a4, IndoorCameraD3D_Vec4 *a5, RenderVertexSoft *a6)
Ritor1
parents:
diff changeset
743 {
Ritor1
parents:
diff changeset
744 stru10 *v6; // edi@1
Ritor1
parents:
diff changeset
745 char *v7; // eax@1
Ritor1
parents:
diff changeset
746 signed int v8; // ecx@1
Ritor1
parents:
diff changeset
747 IndoorCameraD3D *v9; // esi@3
Ritor1
parents:
diff changeset
748 char result; // al@6
Ritor1
parents:
diff changeset
749 RenderVertexSoft a4a[4]; // [sp+Ch] [bp-C0h]@1
Ritor1
parents:
diff changeset
750
Ritor1
parents:
diff changeset
751 v6 = this;
Ritor1
parents:
diff changeset
752 v7 = (char *)&a4a[0].flt_2C;
Ritor1
parents:
diff changeset
753 v8 = 4;
Ritor1
parents:
diff changeset
754 do
Ritor1
parents:
diff changeset
755 {
Ritor1
parents:
diff changeset
756 *(float *)v7 = 0.0;
Ritor1
parents:
diff changeset
757 v7 += 48;
Ritor1
parents:
diff changeset
758 --v8;
Ritor1
parents:
diff changeset
759 }
Ritor1
parents:
diff changeset
760 while ( v8 );
Ritor1
parents:
diff changeset
761 v9 = pGame->pIndoorCameraD3D;
Ritor1
parents:
diff changeset
762 _49CE9E(a2, a3, *a4, a4a);
Ritor1
parents:
diff changeset
763 if ( byte_4D864C && pGame->uFlags & 8 )
Ritor1
parents:
diff changeset
764 pGame->pIndoorCameraD3D->debug_outline_sw(a4a, 4u, 0xFF1E1Eu, 0.000099999997);
Ritor1
parents:
diff changeset
765 result = _49C9E3(a2, a4a, 4u, a6);
Ritor1
parents:
diff changeset
766 if ( result )
Ritor1
parents:
diff changeset
767 result = _49C720(a6, a5);
Ritor1
parents:
diff changeset
768 return result;
Ritor1
parents:
diff changeset
769 }
Ritor1
parents:
diff changeset
770 // 4D864C: using guessed type char byte_4D864C;
Ritor1
parents:
diff changeset
771
Ritor1
parents:
diff changeset
772 //----- (0049C681) --------------------------------------------------------
Ritor1
parents:
diff changeset
773 char stru10::_49C681_DrawDebugStuff(BLVFace *pFace, IndoorCameraD3D_Vec4 *a3, RenderVertexSoft *pArrayOf4)
Ritor1
parents:
diff changeset
774 {
Ritor1
parents:
diff changeset
775 RenderVertexSoft pBounding[4]; // [sp+Ch] [bp-C0h]@1
Ritor1
parents:
diff changeset
776
Ritor1
parents:
diff changeset
777 CalcPolygonBoundingBox(pFace, pBounding);
Ritor1
parents:
diff changeset
778 if ( byte_4D864C && pGame->uFlags & 8 )
Ritor1
parents:
diff changeset
779 pGame->pIndoorCameraD3D->debug_outline_sw(pBounding, 4, 0xFF1E1E, 0.000099999997);
Ritor1
parents:
diff changeset
780 if (_49C9E3(pFace, pBounding, 4, pArrayOf4))
Ritor1
parents:
diff changeset
781 return _49C720(pArrayOf4, a3);
Ritor1
parents:
diff changeset
782 return false;
Ritor1
parents:
diff changeset
783 }
Ritor1
parents:
diff changeset
784 // 4D864C: using guessed type char byte_4D864C;
Ritor1
parents:
diff changeset
785
Ritor1
parents:
diff changeset
786 //----- (0049C720) --------------------------------------------------------
Ritor1
parents:
diff changeset
787 char stru10::_49C720(RenderVertexSoft *a2, IndoorCameraD3D_Vec4 *a4)
Ritor1
parents:
diff changeset
788 {
Ritor1
parents:
diff changeset
789 char result; // al@2
Ritor1
parents:
diff changeset
790 Vec3_float_ a3; // [sp+4h] [bp-34h]@1
Ritor1
parents:
diff changeset
791 float v5; // [sp+30h] [bp-8h]@1
Ritor1
parents:
diff changeset
792 stru10 *thisa; // [sp+34h] [bp-4h]@1
Ritor1
parents:
diff changeset
793
Ritor1
parents:
diff changeset
794 v5 = 0.0;
Ritor1
parents:
diff changeset
795 a3.x = (double)pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
796 a3.y = (double)pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
797 thisa = this;
Ritor1
parents:
diff changeset
798 a3.z = (double)pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
799 if ( _49C7C5(a2, a2 + 1, &a3, a4)
Ritor1
parents:
diff changeset
800 && _49C7C5(a2 + 1, a2 + 2, &a3, a4 + 1)
Ritor1
parents:
diff changeset
801 && _49C7C5(a2 + 2, a2 + 3, &a3, a4 + 2) )
Ritor1
parents:
diff changeset
802 result = _49C7C5(a2 + 3, a2, &a3, a4 + 3) != 0;
Ritor1
parents:
diff changeset
803 else
Ritor1
parents:
diff changeset
804 result = 0;
Ritor1
parents:
diff changeset
805 return result;
Ritor1
parents:
diff changeset
806 }
Ritor1
parents:
diff changeset
807
Ritor1
parents:
diff changeset
808 //----- (0049C7C5) --------------------------------------------------------
Ritor1
parents:
diff changeset
809 bool stru10::_49C7C5(RenderVertexSoft *a1, RenderVertexSoft *a2, Vec3_float_ *a3, IndoorCameraD3D_Vec4 *a4)
Ritor1
parents:
diff changeset
810 {
Ritor1
parents:
diff changeset
811 double v5; // st7@1
Ritor1
parents:
diff changeset
812 double v6; // st6@1
Ritor1
parents:
diff changeset
813 double v7; // st5@1
Ritor1
parents:
diff changeset
814 Vec3_float_ *result; // eax@1
Ritor1
parents:
diff changeset
815 __int16 v9; // fps@3
Ritor1
parents:
diff changeset
816 char v10; // c0@3
Ritor1
parents:
diff changeset
817 char v11; // c2@3
Ritor1
parents:
diff changeset
818 char v12; // c3@3
Ritor1
parents:
diff changeset
819 float v13; // ecx@5
Ritor1
parents:
diff changeset
820 double v14; // st7@5
Ritor1
parents:
diff changeset
821 double v15; // st6@5
Ritor1
parents:
diff changeset
822 Vec3_float_ v1; // [sp+4h] [bp-48h]@1
Ritor1
parents:
diff changeset
823 Vec3_float_ v2; // [sp+10h] [bp-3Ch]@1
Ritor1
parents:
diff changeset
824 float v18; // [sp+20h] [bp-2Ch]@1
Ritor1
parents:
diff changeset
825 float v19; // [sp+24h] [bp-28h]@1
Ritor1
parents:
diff changeset
826 Vec3_float_ v20; // [sp+28h] [bp-24h]@1
Ritor1
parents:
diff changeset
827 Vec3_float_ v21; // [sp+34h] [bp-18h]@1
Ritor1
parents:
diff changeset
828 Vec3_float_ a1a; // [sp+40h] [bp-Ch]@1
Ritor1
parents:
diff changeset
829
Ritor1
parents:
diff changeset
830 a1a.x = 0.0;
Ritor1
parents:
diff changeset
831 a1a.y = 0.0;
Ritor1
parents:
diff changeset
832 a1a.z = 0.0;
Ritor1
parents:
diff changeset
833 v21.x = a3->x;
Ritor1
parents:
diff changeset
834 v21.y = a3->y;
Ritor1
parents:
diff changeset
835 v21.z = a3->z;
Ritor1
parents:
diff changeset
836 v5 = a1->vWorldPosition.x;
Ritor1
parents:
diff changeset
837 v6 = a1->vWorldPosition.y;
Ritor1
parents:
diff changeset
838 v2.z = a1->vWorldPosition.z;
Ritor1
parents:
diff changeset
839 v7 = a2->vWorldPosition.x;
Ritor1
parents:
diff changeset
840 v18 = a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
841 v19 = a2->vWorldPosition.z;
Ritor1
parents:
diff changeset
842 v20.x = v5 - v21.x;
Ritor1
parents:
diff changeset
843 v20.y = v6 - v21.y;
Ritor1
parents:
diff changeset
844 v20.z = v2.z - v21.z;
Ritor1
parents:
diff changeset
845 LODWORD(v1.x) = (int)v20.x;
Ritor1
parents:
diff changeset
846 v1.y = v20.y;
Ritor1
parents:
diff changeset
847 v1.z = v20.z;
Ritor1
parents:
diff changeset
848 v20.x = v7 - v5;
Ritor1
parents:
diff changeset
849 v20.y = v18 - v6;
Ritor1
parents:
diff changeset
850 v20.z = v19 - v2.z;
Ritor1
parents:
diff changeset
851 result = Vec3_float_::Cross(&v1, &v2, v20.x, v20.y, v20.z);
Ritor1
parents:
diff changeset
852 a1a.x = result->x;
Ritor1
parents:
diff changeset
853 a1a.y = result->y;
Ritor1
parents:
diff changeset
854 a1a.z = result->z;
Ritor1
parents:
diff changeset
855 if ( a1a.x != 0.0
Ritor1
parents:
diff changeset
856 || a1a.y != 0.0
Ritor1
parents:
diff changeset
857 || (/*UNDEF(v9),*/ v10 = a1a.z < 0.0, v11 = 0, v12 = a1a.z == 0.0, BYTE1(result) = HIBYTE(v9), a1a.z != 0.0) )
Ritor1
parents:
diff changeset
858 {
Ritor1
parents:
diff changeset
859 a1a.Normalize();
Ritor1
parents:
diff changeset
860 result = (Vec3_float_ *)a4;
Ritor1
parents:
diff changeset
861 v13 = a1a.y;
Ritor1
parents:
diff changeset
862 a4->x = a1a.x;
Ritor1
parents:
diff changeset
863 v14 = v21.z * a1a.z;
Ritor1
parents:
diff changeset
864 v15 = v21.y * a1a.y;
Ritor1
parents:
diff changeset
865 a4->y = v13;
Ritor1
parents:
diff changeset
866 a4->z = a1a.z;
Ritor1
parents:
diff changeset
867 a4->dot = v14 + v15 + v21.x * a1a.x;
Ritor1
parents:
diff changeset
868 LOBYTE(result) = 1;
Ritor1
parents:
diff changeset
869 }
Ritor1
parents:
diff changeset
870 else
Ritor1
parents:
diff changeset
871 {
Ritor1
parents:
diff changeset
872 LOBYTE(result) = 0;
Ritor1
parents:
diff changeset
873 }
Ritor1
parents:
diff changeset
874 return (bool)result;
Ritor1
parents:
diff changeset
875 }
Ritor1
parents:
diff changeset
876
Ritor1
parents:
diff changeset
877 //----- (0049C8DC) --------------------------------------------------------
Ritor1
parents:
diff changeset
878 bool stru10::_49C8DC(RenderVertexSoft *arg0, Vec3_float_ *a2, float *a3)
Ritor1
parents:
diff changeset
879 {
Ritor1
parents:
diff changeset
880 double v4; // st7@1
Ritor1
parents:
diff changeset
881 double v5; // st6@1
Ritor1
parents:
diff changeset
882 double v6; // st5@1
Ritor1
parents:
diff changeset
883 Vec3_float_ *result; // eax@1
Ritor1
parents:
diff changeset
884 __int16 v8; // fps@3
Ritor1
parents:
diff changeset
885 char v9; // c0@3
Ritor1
parents:
diff changeset
886 char v10; // c2@3
Ritor1
parents:
diff changeset
887 char v11; // c3@3
Ritor1
parents:
diff changeset
888 float v12; // ecx@5
Ritor1
parents:
diff changeset
889 double v13; // st7@5
Ritor1
parents:
diff changeset
890 double v14; // st6@5
Ritor1
parents:
diff changeset
891 Vec3_float_ v1; // [sp+8h] [bp-3Ch]@1
Ritor1
parents:
diff changeset
892 Vec3_float_ v2; // [sp+14h] [bp-30h]@1
Ritor1
parents:
diff changeset
893 float v17; // [sp+24h] [bp-20h]@1
Ritor1
parents:
diff changeset
894 float v18; // [sp+28h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
895 float v19; // [sp+2Ch] [bp-18h]@1
Ritor1
parents:
diff changeset
896 float v20; // [sp+30h] [bp-14h]@1
Ritor1
parents:
diff changeset
897 float v21; // [sp+34h] [bp-10h]@1
Ritor1
parents:
diff changeset
898 Vec3_float_ a1; // [sp+38h] [bp-Ch]@1
Ritor1
parents:
diff changeset
899
Ritor1
parents:
diff changeset
900 v19 = arg0->vWorldPosition.x;
Ritor1
parents:
diff changeset
901 v20 = arg0->vWorldPosition.y;
Ritor1
parents:
diff changeset
902 v21 = arg0->vWorldPosition.z;
Ritor1
parents:
diff changeset
903 v4 = arg0[1].vWorldPosition.x;
Ritor1
parents:
diff changeset
904 v5 = arg0[1].vWorldPosition.y;
Ritor1
parents:
diff changeset
905 v2.z = arg0[1].vWorldPosition.z;
Ritor1
parents:
diff changeset
906 v6 = arg0[2].vWorldPosition.x;
Ritor1
parents:
diff changeset
907 v17 = arg0[2].vWorldPosition.y;
Ritor1
parents:
diff changeset
908 v18 = arg0[2].vWorldPosition.z;
Ritor1
parents:
diff changeset
909 a1.x = v4 - v19;
Ritor1
parents:
diff changeset
910 a1.y = v5 - v20;
Ritor1
parents:
diff changeset
911 a1.z = v2.z - v21;
Ritor1
parents:
diff changeset
912 LODWORD(v1.x) = (int)a1.x;
Ritor1
parents:
diff changeset
913 v1.y = a1.y;
Ritor1
parents:
diff changeset
914 v1.z = a1.z;
Ritor1
parents:
diff changeset
915 a1.x = v6 - v4;
Ritor1
parents:
diff changeset
916 a1.y = v17 - v5;
Ritor1
parents:
diff changeset
917 a1.z = v18 - v2.z;
Ritor1
parents:
diff changeset
918 result = Vec3_float_::Cross(&v1, &v2, a1.x, a1.y, a1.z);
Ritor1
parents:
diff changeset
919 a1.x = result->x;
Ritor1
parents:
diff changeset
920 a1.y = result->y;
Ritor1
parents:
diff changeset
921 a1.z = result->z;
Ritor1
parents:
diff changeset
922 if ( a1.x != 0.0
Ritor1
parents:
diff changeset
923 || a1.y != 0.0
Ritor1
parents:
diff changeset
924 || (/*UNDEF(v8),*/ v9 = a1.z < 0.0, v10 = 0, v11 = a1.z == 0.0, /*BYTE1(result) = HIBYTE(v8),*/ a1.z != 0.0) )
Ritor1
parents:
diff changeset
925 {
Ritor1
parents:
diff changeset
926 a1.Normalize();
Ritor1
parents:
diff changeset
927 v12 = a1.y;
Ritor1
parents:
diff changeset
928 a2->x = a1.x;
Ritor1
parents:
diff changeset
929 v13 = v21 * a1.z;
Ritor1
parents:
diff changeset
930 v14 = v20 * a1.y;
Ritor1
parents:
diff changeset
931 a2->y = v12;
Ritor1
parents:
diff changeset
932 a2->z = a1.z;
Ritor1
parents:
diff changeset
933 result = (Vec3_float_ *)a3;
Ritor1
parents:
diff changeset
934 *a3 = -(v13 + v14 + v19 * a1.x);
Ritor1
parents:
diff changeset
935 return true;
Ritor1
parents:
diff changeset
936 }
Ritor1
parents:
diff changeset
937 return false;
Ritor1
parents:
diff changeset
938 }