Mercurial > mm7
annotate mm7_6.cpp @ 1347:84db43e7db93
Merge
author | Grumpy7 |
---|---|
date | Fri, 12 Jul 2013 23:08:35 +0200 |
parents | 22cb507446a4 |
children | b51332ab228f 5a5d0c713d47 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
0 | 5 #include "MM7.h" |
6 | |
1016 | 7 |
8 | |
1323 | 9 #include "Weather.h" |
1016 | 10 #include "Sprites.h" |
11 #include "BSPModel.h" | |
12 #include "OutdoorCamera.h" | |
13 #include "Mouse.h" | |
14 #include "Keyboard.h" | |
15 #include "stru6.h" | |
16 | |
17 #include "Vis.h" | |
0 | 18 #include "Game.h" |
19 #include "GUIWindow.h" | |
20 #include "GUIFont.h" | |
21 #include "Party.h" | |
22 #include "AudioPlayer.h" | |
23 #include "Outdoor.h" | |
1277 | 24 #include "Outdoor_stuff.h" |
0 | 25 #include "Overlays.h" |
26 #include "LOD.h" | |
27 #include "Actor.h" | |
28 #include "Events.h" | |
29 #include "Viewport.h" | |
30 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
31 #include "SpriteObject.h" |
0 | 32 #include "ObjectList.h" |
33 #include "stru123.h" | |
34 #include "Time.h" | |
35 #include "IconFrameTable.h" | |
36 #include "Awards.h" | |
37 #include "TurnEngine.h" | |
924 | 38 #include "CastSpellInfo.h" |
0 | 39 #include "stru298.h" |
189 | 40 #include "texts.h" |
0 | 41 |
42 #include "mm7_data.h" | |
43 | |
44 | |
45 | |
46 //----- (00424EE0) -------------------------------------------------------- | |
47 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
48 { | |
49 unsigned int v1; // edx@1 | |
50 double v2; // st7@1 | |
51 signed int v3; // edi@1 | |
52 char *v4; // esi@4 | |
53 char *v5; // ecx@4 | |
54 unsigned int v6; // eax@4 | |
55 char *v7; // edx@4 | |
56 double v8; // st6@10 | |
57 double v9; // st5@10 | |
58 double v10; // st6@11 | |
59 unsigned __int8 v11; // c2@15 | |
60 unsigned __int8 v12; // c3@15 | |
61 void *v13; // edi@22 | |
62 char *v14; // eax@22 | |
63 double v15; // st6@22 | |
64 char *v16; // ecx@22 | |
65 signed int result; // eax@24 | |
66 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
67 bool v19; // [sp+Ch] [bp-28h]@6 | |
68 char *v20; // [sp+10h] [bp-24h]@4 | |
69 char *v21; // [sp+14h] [bp-20h]@4 | |
70 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
71 char *v23; // [sp+1Ch] [bp-18h]@4 | |
72 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
73 char *v25; // [sp+24h] [bp-10h]@4 | |
74 char *v26; // [sp+28h] [bp-Ch]@4 | |
75 char *v27; // [sp+2Ch] [bp-8h]@4 | |
76 char *v28; // [sp+30h] [bp-4h]@4 | |
77 | |
78 v1 = uVertexID; | |
79 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
80 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); |
0 | 81 v3 = 0; |
82 v22 = 0; | |
83 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
84 v3 = 1; | |
85 if ( (signed int)(uVertexID + 1) <= 1 ) | |
86 return 0; | |
87 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
88 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
89 v6 = v1; | |
90 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 91 v26 = (char *)&array_507D30[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
92 v24 = array_507D30; |
0 | 93 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; |
94 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
95 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
96 v27 = (char *)&array_507D30[0].v; | |
97 v28 = (char *)&array_507D30[0].u; | |
98 v7 = (char *)&array_50AC10[0].v; | |
99 v18 = v6; | |
100 do | |
101 { | |
102 v19 = v2 >= *((float *)v7 + 5); | |
103 if ( v3 != v19 ) | |
104 { | |
105 if ( v19 ) | |
106 { | |
107 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
108 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
109 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
110 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
111 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
112 } | |
113 else | |
114 { | |
115 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
116 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
117 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
118 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
119 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
120 } | |
121 *(float *)v27 = v9; | |
122 *(float *)v25 = v2; | |
123 *(float *)v26 = 1.0 / v2; | |
124 if ( v3 ) | |
125 { | |
126 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
127 { | |
128 v11 = 0; | |
129 v12 = *(float *)v4 == *((float *)v7 - 5); | |
130 goto LABEL_19; | |
131 } | |
132 } | |
133 else | |
134 { | |
135 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
136 { | |
137 v11 = 0; | |
138 v12 = *(float *)v4 == *((float *)v7 + 7); | |
139 LABEL_19: | |
140 if ( v12 | v11 ) | |
141 goto LABEL_21; | |
142 goto LABEL_20; | |
143 } | |
144 } | |
145 LABEL_20: | |
146 v26 += 48; | |
147 ++v24; | |
148 v25 += 48; | |
149 v27 += 48; | |
150 v28 += 48; | |
151 v5 += 48; | |
152 v4 += 48; | |
153 ++v22; | |
154 v23 += 48; | |
155 v21 = v5; | |
156 v20 = v4; | |
157 } | |
158 LABEL_21: | |
159 if ( v19 ) | |
160 { | |
161 v13 = v24; | |
162 v14 = v26; | |
163 v21 += 48; | |
164 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
165 v20 += 48; | |
166 ++v22; | |
167 v28 += 48; | |
168 v27 += 48; | |
169 v25 += 48; | |
170 ++v24; | |
171 v26 += 48; | |
172 memcpy(v13, v7 + 8, 0x30u); | |
173 v16 = v23; | |
174 v23 += 48; | |
175 v4 = v20; | |
176 *(float *)v14 = v15; | |
177 *(int *)v16 = *((int *)v7 + 13); | |
178 v5 = v21; | |
179 } | |
180 v3 = v19; | |
181 v7 += 48; | |
182 --v18; | |
183 } | |
184 while ( v18 ); | |
185 result = v22; | |
186 if ( v22 < 3 ) | |
187 return 0; | |
188 return result; | |
189 } | |
190 | |
191 //----- (004250FE) -------------------------------------------------------- | |
192 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
193 { | |
194 unsigned int v1; // edx@1 | |
195 char *v2; // edi@5 | |
196 char *v3; // esi@5 | |
197 char *v4; // ecx@5 | |
198 int v5; // ebx@6 | |
199 double v6; // st6@11 | |
200 double v7; // st5@11 | |
201 double v8; // st6@12 | |
202 unsigned __int8 v9; // c2@16 | |
203 unsigned __int8 v10; // c3@16 | |
204 void *v11; // edi@23 | |
205 double v12; // st6@23 | |
206 char *v13; // ecx@23 | |
207 char v14; // zf@24 | |
208 signed int result; // eax@25 | |
209 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
210 bool v17; // [sp+Ch] [bp-24h]@2 | |
211 bool v18; // [sp+10h] [bp-20h]@7 | |
212 char *v19; // [sp+14h] [bp-1Ch]@5 | |
213 char *v20; // [sp+18h] [bp-18h]@5 | |
214 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
215 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
216 char *v23; // [sp+24h] [bp-Ch]@5 | |
217 char *v24; // [sp+28h] [bp-8h]@5 | |
218 char *v25; // [sp+2Ch] [bp-4h]@5 | |
219 | |
220 v1 = uVertexID; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
221 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); |
0 | 222 v21 = 0; |
223 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
224 if ( (signed int)(uVertexID + 1) <= 1 ) | |
225 return 0; | |
226 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
227 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 228 v24 = (char *)&array_507D30[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
229 v22 = array_507D30; |
0 | 230 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; |
231 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
232 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
233 v25 = (char *)&array_507D30[0].flt_2C; | |
234 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
235 v16 = v1; | |
236 do | |
237 { | |
238 v5 = (int)(v4 + 48); | |
239 v18 = *((float *)v4 + 12) >= 8.0; | |
240 if ( v17 != v18 ) | |
241 { | |
242 if ( v18 ) | |
243 { | |
244 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
245 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
246 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
247 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
248 } | |
249 else | |
250 { | |
251 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
252 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
253 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
254 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
255 } | |
256 *(float *)v25 = v7; | |
257 *(float *)v23 = 8.0; | |
258 *(int *)v24 = 0x3E000000u; | |
259 if ( v17 ) | |
260 { | |
261 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
262 { | |
263 v9 = 0; | |
264 v10 = *(float *)v2 == *((float *)v4 + 2); | |
265 goto LABEL_20; | |
266 } | |
267 } | |
268 else | |
269 { | |
270 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
271 { | |
272 v9 = 0; | |
273 v10 = *(float *)v2 == *((float *)v4 + 14); | |
274 LABEL_20: | |
275 if ( v10 | v9 ) | |
276 goto LABEL_22; | |
277 goto LABEL_21; | |
278 } | |
279 } | |
280 LABEL_21: | |
281 ++v22; | |
282 v23 += 48; | |
283 v25 += 48; | |
284 v3 += 48; | |
285 v2 += 48; | |
286 ++v21; | |
287 v24 += 48; | |
288 v20 = v3; | |
289 v19 = v2; | |
290 } | |
291 LABEL_22: | |
292 if ( v18 ) | |
293 { | |
294 v11 = v22; | |
295 v20 += 48; | |
296 v19 += 48; | |
297 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
298 ++v21; | |
299 v25 += 48; | |
300 v23 += 48; | |
301 ++v22; | |
302 memcpy(v11, v4 + 36, 0x30u); | |
303 v13 = v24; | |
304 v24 += 48; | |
305 v3 = v20; | |
306 v2 = v19; | |
307 *(float *)v13 = v12; | |
308 } | |
309 v14 = v16-- == 1; | |
310 v17 = v18; | |
311 v4 = (char *)v5; | |
312 } | |
313 while ( !v14 ); | |
314 result = v21; | |
315 if ( v21 < 3 ) | |
316 return 0; | |
317 return result; | |
318 } | |
319 | |
320 //----- (004252E8) -------------------------------------------------------- | |
321 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
322 { | |
323 unsigned int v1; // edx@1 | |
324 double v2; // st7@1 | |
325 char *v3; // edi@5 | |
326 char *v4; // esi@5 | |
327 char *v5; // ecx@5 | |
328 int v6; // ebx@6 | |
329 double v7; // st6@11 | |
330 double v8; // st5@11 | |
331 double v9; // st6@12 | |
332 unsigned __int8 v10; // c2@16 | |
333 unsigned __int8 v11; // c3@16 | |
334 void *v12; // edi@23 | |
335 double v13; // st6@23 | |
336 char *v14; // ecx@23 | |
337 char v15; // zf@24 | |
338 signed int result; // eax@25 | |
339 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
340 bool v18; // [sp+Ch] [bp-24h]@2 | |
341 bool v19; // [sp+10h] [bp-20h]@7 | |
342 char *v20; // [sp+14h] [bp-1Ch]@5 | |
343 char *v21; // [sp+18h] [bp-18h]@5 | |
344 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
345 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
346 char *v24; // [sp+24h] [bp-Ch]@5 | |
347 char *v25; // [sp+28h] [bp-8h]@5 | |
348 char *v26; // [sp+2Ch] [bp-4h]@5 | |
349 | |
350 v1 = uVertexID; | |
351 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
352 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); |
0 | 353 v22 = 0; |
354 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
355 if ( (signed int)(uVertexID + 1) <= 1 ) | |
356 return 0; | |
357 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
358 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 359 v25 = (char *)&array_507D30[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
360 v23 = array_507D30; |
0 | 361 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; |
362 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
363 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
364 v26 = (char *)&array_507D30[0].flt_2C; | |
365 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
366 v17 = v1; | |
367 do | |
368 { | |
369 v6 = (int)(v5 + 48); | |
370 v19 = v2 >= *((float *)v5 + 12); | |
371 if ( v18 != v19 ) | |
372 { | |
373 if ( v19 ) | |
374 { | |
375 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
376 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
377 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
378 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
379 } | |
380 else | |
381 { | |
382 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
383 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
384 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
385 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
386 } | |
387 *(float *)v26 = v8; | |
388 *(float *)v24 = v2; | |
389 *(float *)v25 = 1.0 / v2; | |
390 if ( v18 ) | |
391 { | |
392 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
393 { | |
394 v10 = 0; | |
395 v11 = *(float *)v3 == *((float *)v5 + 2); | |
396 goto LABEL_20; | |
397 } | |
398 } | |
399 else | |
400 { | |
401 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
402 { | |
403 v10 = 0; | |
404 v11 = *(float *)v3 == *((float *)v5 + 14); | |
405 LABEL_20: | |
406 if ( v11 | v10 ) | |
407 goto LABEL_22; | |
408 goto LABEL_21; | |
409 } | |
410 } | |
411 LABEL_21: | |
412 ++v23; | |
413 v24 += 48; | |
414 v26 += 48; | |
415 v4 += 48; | |
416 v3 += 48; | |
417 ++v22; | |
418 v25 += 48; | |
419 v21 = v4; | |
420 v20 = v3; | |
421 } | |
422 LABEL_22: | |
423 if ( v19 ) | |
424 { | |
425 v12 = v23; | |
426 v21 += 48; | |
427 v20 += 48; | |
428 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
429 ++v22; | |
430 v26 += 48; | |
431 v24 += 48; | |
432 ++v23; | |
433 memcpy(v12, v5 + 36, 0x30u); | |
434 v14 = v25; | |
435 v25 += 48; | |
436 v4 = v21; | |
437 v3 = v20; | |
438 *(float *)v14 = v13; | |
439 } | |
440 v15 = v17-- == 1; | |
441 v18 = v19; | |
442 v5 = (char *)v6; | |
443 } | |
444 while ( !v15 ); | |
445 result = v22; | |
446 if ( v22 < 3 ) | |
447 return 0; | |
448 return result; | |
449 } | |
450 | |
451 //----- (004254D2) -------------------------------------------------------- | |
452 int __fastcall sr_4254D2(signed int a1) | |
453 { | |
454 signed int v1; // ebx@2 | |
455 int v2; // ecx@2 | |
456 int result; // eax@11 | |
457 double v4; // ST74_8@12 | |
458 bool v5; // edi@12 | |
459 char *v6; // esi@13 | |
460 char *v7; // ebx@13 | |
461 double v8; // st7@15 | |
462 double v9; // st7@16 | |
463 double v10; // st6@16 | |
464 double v11; // st7@17 | |
465 float v12; // eax@18 | |
466 double v13; // ST4C_8@19 | |
467 double v14; // ST10_8@19 | |
468 double v15; // ST28_8@20 | |
469 double v16; // ST34_8@20 | |
470 char v17; // zf@20 | |
471 double v18; // ST18_8@21 | |
472 double v19; // ST3C_8@21 | |
473 double v20; // ST44_8@22 | |
474 double v21; // ST54_8@22 | |
475 void *v22; // edi@26 | |
476 double v23; // ST54_8@29 | |
477 bool v24; // esi@29 | |
478 char *v25; // edi@30 | |
479 char *v26; // ebx@30 | |
480 bool v27; // ecx@32 | |
481 double v28; // st7@33 | |
482 double v29; // st7@34 | |
483 double v30; // st6@34 | |
484 double v31; // st7@35 | |
485 double v32; // ST44_8@37 | |
486 double v33; // ST3C_8@37 | |
487 double v34; // ST18_8@38 | |
488 double v35; // ST34_8@38 | |
489 char v36; // zf@38 | |
490 double v37; // ST28_8@39 | |
491 double v38; // ST10_8@39 | |
492 double v39; // ST20_8@40 | |
493 double v40; // ST5C_8@40 | |
494 void *v41; // edi@44 | |
495 double v42; // ST5C_8@47 | |
496 bool v43; // edi@47 | |
497 char *v44; // esi@48 | |
498 char *v45; // ebx@48 | |
499 bool v46; // ecx@49 | |
500 double v47; // st6@50 | |
501 double v48; // st6@51 | |
502 double v49; // st5@51 | |
503 double v50; // st6@52 | |
504 double v51; // ST20_8@54 | |
505 double v52; // ST54_8@54 | |
506 double v53; // ST44_8@55 | |
507 double v54; // ST3C_8@55 | |
508 char v55; // zf@55 | |
509 double v56; // ST18_8@56 | |
510 double v57; // ST34_8@56 | |
511 double v58; // ST28_8@57 | |
512 double v59; // ST10_8@57 | |
513 void *v60; // edi@61 | |
514 double v61; // ST5C_8@64 | |
515 bool v62; // edi@64 | |
516 char *v63; // esi@65 | |
517 char *v64; // ebx@65 | |
518 bool v65; // ecx@66 | |
519 double v66; // st6@67 | |
520 double v67; // st6@68 | |
521 double v68; // st5@68 | |
522 double v69; // st6@69 | |
523 double v70; // ST20_8@71 | |
524 double v71; // ST54_8@71 | |
525 double v72; // ST44_8@72 | |
526 double v73; // ST3C_8@72 | |
527 char v74; // zf@72 | |
528 double v75; // ST18_8@73 | |
529 double v76; // ST34_8@73 | |
530 double v77; // ST28_8@74 | |
531 double v78; // ST10_8@74 | |
532 void *v79; // edi@78 | |
533 int v80; // ebx@81 | |
534 char *v81; // ecx@82 | |
535 signed int v82; // esi@82 | |
536 float v83; // ST78_4@83 | |
537 double v84; // ST5C_8@83 | |
538 float v85; // eax@84 | |
539 double v86; // ST20_8@85 | |
540 double v87; // ST54_8@88 | |
541 float v88; // eax@89 | |
542 double v89; // ST44_8@90 | |
543 unsigned __int8 v90; // sf@94 | |
544 unsigned __int8 v91; // of@94 | |
545 int v92; // edx@97 | |
546 int v93; // esi@97 | |
547 int v94; // edi@97 | |
548 int v95; // eax@97 | |
549 int v96; // eax@104 | |
550 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
551 double v98; // [sp+54h] [bp-84h]@49 | |
552 double v99; // [sp+54h] [bp-84h]@66 | |
553 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
554 float v101; // [sp+60h] [bp-78h]@1 | |
555 float v102; // [sp+64h] [bp-74h]@1 | |
556 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
557 float v104; // [sp+A8h] [bp-30h]@1 | |
558 signed int v105; // [sp+A8h] [bp-30h]@96 | |
559 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
560 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
561 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
562 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
563 signed int v110; // [sp+B0h] [bp-28h]@12 | |
564 char *v111; // [sp+B8h] [bp-20h]@30 | |
565 signed int v112; // [sp+B8h] [bp-20h]@48 | |
566 signed int v113; // [sp+B8h] [bp-20h]@65 | |
567 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
568 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
569 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
570 signed int v117; // [sp+C0h] [bp-18h]@1 | |
571 char *v118; // [sp+C0h] [bp-18h]@30 | |
572 char *v119; // [sp+C0h] [bp-18h]@48 | |
573 char *v120; // [sp+C0h] [bp-18h]@65 | |
574 char *v121; // [sp+C4h] [bp-14h]@13 | |
575 char *v122; // [sp+C4h] [bp-14h]@30 | |
576 signed int v123; // [sp+C4h] [bp-14h]@47 | |
577 char *v124; // [sp+C8h] [bp-10h]@30 | |
578 char *v125; // [sp+C8h] [bp-10h]@48 | |
579 char *v126; // [sp+C8h] [bp-10h]@65 | |
580 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
581 char *v128; // [sp+CCh] [bp-Ch]@13 | |
582 char *v129; // [sp+CCh] [bp-Ch]@30 | |
583 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
584 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
585 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
586 char *v133; // [sp+D0h] [bp-8h]@30 | |
587 char *v134; // [sp+D0h] [bp-8h]@48 | |
588 char *v135; // [sp+D0h] [bp-8h]@65 | |
589 signed int v136; // [sp+D4h] [bp-4h]@1 | |
590 char *v137; // [sp+D4h] [bp-4h]@13 | |
591 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
592 char *v139; // [sp+D4h] [bp-4h]@48 | |
593 char *v140; // [sp+D4h] [bp-4h]@65 | |
594 | |
693 | 595 v101 = (double)(signed int)pViewport->uViewportTL_X; |
596 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 597 v117 = a1; |
598 v136 = 1; | |
693 | 599 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
600 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 601 if ( a1 <= 0 ) |
602 return v117; | |
603 v127 = a1; | |
604 v1 = a1; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
605 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); |
0 | 606 v2 = 0; |
607 do | |
608 { | |
609 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
610 v136 = 0; | |
611 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
612 v136 = 0; | |
613 ++v2; | |
614 --v127; | |
615 } | |
616 while ( v127 ); | |
617 if ( v136 ) | |
618 return v117; | |
619 v110 = 0; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
620 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); |
0 | 621 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; |
693 | 622 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 623 if ( v117 < 1 ) |
624 goto LABEL_112; | |
625 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
626 v132 = array_50A2B0; |
0 | 627 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; |
628 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
629 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 630 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 631 v7 = (char *)&array_50AC10[0].flt_2C; |
632 do | |
633 { | |
634 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 635 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 636 if ( !(v5 ^ v106) ) |
637 goto LABEL_25; | |
638 v8 = v101; | |
693 | 639 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 640 { |
641 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
642 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
643 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
644 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
645 } | |
646 else | |
647 { | |
648 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
649 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
650 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
651 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
652 } | |
653 *(float *)v121 = v10; | |
654 *(int *)v137 = LODWORD(v101); | |
655 LODWORD(v12) = *(int *)v6; | |
656 if ( v5 ) | |
657 { | |
658 v13 = v12 + 6.7553994e15; | |
659 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
660 if ( LODWORD(v13) == LODWORD(v14) ) | |
661 { | |
662 v15 = *(float *)v137 + 6.7553994e15; | |
663 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
664 v17 = LODWORD(v15) == LODWORD(v16); | |
665 goto LABEL_23; | |
666 } | |
667 } | |
668 else | |
669 { | |
670 v18 = v12 + 6.7553994e15; | |
671 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
672 if ( LODWORD(v18) == LODWORD(v19) ) | |
673 { | |
674 v20 = *(float *)v137 + 6.7553994e15; | |
675 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
676 v17 = LODWORD(v20) == LODWORD(v21); | |
677 LABEL_23: | |
678 if ( v17 ) | |
679 goto LABEL_25; | |
680 goto LABEL_24; | |
681 } | |
682 } | |
683 LABEL_24: | |
684 v121 += 48; | |
685 v114 += 48; | |
686 v6 += 48; | |
687 ++v110; | |
688 ++v132; | |
689 v128 = v6; | |
690 v137 += 48; | |
691 LABEL_25: | |
692 if ( v106 ) | |
693 { | |
694 v22 = v132; | |
695 v128 += 48; | |
696 ++v110; | |
697 v114 += 48; | |
698 v121 += 48; | |
699 v137 += 48; | |
700 ++v132; | |
701 memcpy(v22, v7 + 4, 0x30u); | |
702 v6 = v128; | |
703 } | |
704 v5 = v106; | |
705 v7 += 48; | |
706 --v117; | |
707 } | |
708 while ( v117 ); | |
709 if ( v110 < 3 | |
710 || (v115 = 0, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
711 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), |
0 | 712 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, |
693 | 713 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 714 v110 < 1) ) |
715 goto LABEL_112; | |
168 | 716 v25 = (char *)&array_509950[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
717 v138 = array_509950; |
0 | 718 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; |
719 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
720 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
721 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
722 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 723 v111 = (char *)&array_509950[0]._rhw; |
0 | 724 v26 = (char *)&array_50A2B0[0].flt_2C; |
725 while ( 2 ) | |
726 { | |
727 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 728 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
729 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 730 if ( v24 != v27 ) |
731 { | |
732 v28 = v100; | |
693 | 733 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 734 { |
735 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
736 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
737 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
738 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
739 } | |
740 else | |
741 { | |
742 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
743 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
744 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
745 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
746 } | |
747 *(float *)v124 = v30; | |
748 *(int *)v133 = LODWORD(v100); | |
749 if ( v24 ) | |
750 { | |
751 v32 = *(float *)v122 + 6.7553994e15; | |
752 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
753 if ( LODWORD(v32) == LODWORD(v33) ) | |
754 { | |
755 v34 = *(float *)v133 + 6.7553994e15; | |
756 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
757 v36 = LODWORD(v34) == LODWORD(v35); | |
758 goto LABEL_41; | |
759 } | |
760 goto LABEL_42; | |
761 } | |
762 v37 = *(float *)v118 + 6.7553994e15; | |
763 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
764 if ( LODWORD(v37) != LODWORD(v38) ) | |
765 goto LABEL_42; | |
766 v39 = *(float *)v129 + 6.7553994e15; | |
767 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
768 v36 = LODWORD(v39) == LODWORD(v40); | |
769 LABEL_41: | |
770 if ( !v36 ) | |
771 { | |
772 LABEL_42: | |
773 v129 += 48; | |
774 v118 += 48; | |
775 v133 += 48; | |
776 v122 += 48; | |
777 v124 += 48; | |
778 v111 += 48; | |
779 ++v115; | |
780 ++v138; | |
781 } | |
782 } | |
783 if ( v27 ) | |
784 { | |
785 v41 = v138; | |
786 ++v115; | |
787 v111 += 48; | |
788 v124 += 48; | |
789 v122 += 48; | |
790 v133 += 48; | |
791 v118 += 48; | |
792 v129 += 48; | |
793 ++v138; | |
794 memcpy(v41, v26 + 4, 0x30u); | |
795 } | |
796 v24 = v107; | |
797 v26 += 48; | |
798 --v110; | |
799 if ( v110 ) | |
800 { | |
801 v25 = v111; | |
802 continue; | |
803 } | |
804 break; | |
805 } | |
806 if ( v115 < 3 | |
807 || (v123 = 0, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
808 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), |
0 | 809 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, |
693 | 810 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 811 v115 < 1) ) |
812 goto LABEL_112; | |
813 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
814 v130 = array_508FF0; |
0 | 815 v119 = (char *)&array_508FF0[0].vWorldViewProjX; |
816 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
817 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 818 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 819 v45 = (char *)&array_509950[0].flt_2C; |
820 v112 = v115; | |
821 while ( 2 ) | |
822 { | |
823 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 824 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
825 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 826 if ( v43 != v46 ) |
827 { | |
828 v47 = v104; | |
693 | 829 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 830 { |
831 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
832 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
833 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
834 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
835 } | |
836 else | |
837 { | |
838 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
839 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
840 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
841 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
842 } | |
843 *(float *)v125 = v49; | |
844 *(float *)v139 = v104; | |
845 if ( v43 ) | |
846 { | |
847 v51 = v104 + 6.7553994e15; | |
848 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
849 if ( LODWORD(v51) == LODWORD(v52) ) | |
850 { | |
851 v53 = *(float *)v44 + 6.7553994e15; | |
852 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
853 v55 = LODWORD(v53) == LODWORD(v54); | |
854 goto LABEL_58; | |
855 } | |
856 goto LABEL_59; | |
857 } | |
858 v56 = v104 + 6.7553994e15; | |
859 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
860 if ( LODWORD(v56) != LODWORD(v57) ) | |
861 goto LABEL_59; | |
862 v58 = *(float *)v44 + 6.7553994e15; | |
863 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
864 v55 = LODWORD(v58) == LODWORD(v59); | |
865 LABEL_58: | |
866 if ( !v55 ) | |
867 { | |
868 LABEL_59: | |
869 v139 += 48; | |
870 v125 += 48; | |
871 v134 += 48; | |
872 v44 += 48; | |
873 ++v123; | |
874 ++v130; | |
875 v119 = v44; | |
876 } | |
877 } | |
878 if ( v46 ) | |
879 { | |
880 v60 = v130; | |
881 v119 += 48; | |
882 ++v123; | |
883 v134 += 48; | |
884 v125 += 48; | |
885 v139 += 48; | |
886 ++v130; | |
887 memcpy(v60, v45 + 4, 0x30u); | |
888 v44 = v119; | |
889 } | |
890 v43 = v108; | |
891 v45 += 48; | |
892 --v112; | |
893 if ( v112 ) | |
894 continue; | |
895 break; | |
896 } | |
897 if ( v123 < 3 | |
898 || (v116 = 0, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
899 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), |
0 | 900 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, |
693 | 901 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 902 v123 < 1) ) |
903 goto LABEL_112; | |
904 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
905 v131 = array_508690; |
0 | 906 v120 = (char *)&array_508690[0].vWorldViewProjX; |
907 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
908 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 909 v135 = (char *)&array_508690[0]._rhw; |
0 | 910 v64 = (char *)&array_508FF0[0].flt_2C; |
911 v113 = v123; | |
912 while ( 2 ) | |
913 { | |
914 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 915 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
916 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 917 if ( v62 != v65 ) |
918 { | |
919 v66 = v102; | |
693 | 920 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 921 { |
922 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
923 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
924 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
925 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
926 } | |
927 else | |
928 { | |
929 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
930 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
931 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
932 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
933 } | |
934 *(float *)v126 = v68; | |
935 *(float *)v140 = v102; | |
936 if ( v62 ) | |
937 { | |
938 v70 = v102 + 6.7553994e15; | |
939 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
940 if ( LODWORD(v70) == LODWORD(v71) ) | |
941 { | |
942 v72 = *(float *)v63 + 6.7553994e15; | |
943 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
944 v74 = LODWORD(v72) == LODWORD(v73); | |
945 goto LABEL_75; | |
946 } | |
947 goto LABEL_76; | |
948 } | |
949 v75 = v102 + 6.7553994e15; | |
950 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
951 if ( LODWORD(v75) != LODWORD(v76) ) | |
952 goto LABEL_76; | |
953 v77 = *(float *)v63 + 6.7553994e15; | |
954 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
955 v74 = LODWORD(v77) == LODWORD(v78); | |
956 LABEL_75: | |
957 if ( !v74 ) | |
958 { | |
959 LABEL_76: | |
960 v140 += 48; | |
961 v126 += 48; | |
962 v135 += 48; | |
963 v63 += 48; | |
964 ++v116; | |
965 ++v131; | |
966 v120 = v63; | |
967 } | |
968 } | |
969 if ( v65 ) | |
970 { | |
971 v79 = v131; | |
972 v120 += 48; | |
973 ++v116; | |
974 v135 += 48; | |
975 v126 += 48; | |
976 v140 += 48; | |
977 ++v131; | |
978 memcpy(v79, v64 + 4, 0x30u); | |
979 v63 = v120; | |
980 } | |
981 v62 = v109; | |
982 v64 += 48; | |
983 --v113; | |
984 if ( v113 ) | |
985 continue; | |
986 break; | |
987 } | |
988 if ( v116 < 3 ) | |
989 goto LABEL_112; | |
990 v80 = v116; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
991 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); |
0 | 992 if ( v116 > 0 ) |
993 { | |
994 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
995 v82 = v116; | |
996 do | |
997 { | |
998 LODWORD(v83) = *(int *)v81; | |
999 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1000 v84 = v83 + 6.7553994e15; | |
693 | 1001 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1002 { |
1003 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1004 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1005 goto LABEL_88; |
1006 v85 = v101; | |
1007 } | |
1008 else | |
1009 { | |
1010 v85 = v100; | |
1011 } | |
1012 *(int *)v81 = LODWORD(v85); | |
1013 LABEL_88: | |
1014 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1015 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1016 { |
1017 v88 = v102; | |
1018 LABEL_92: | |
1019 *((int *)v81 + 1) = LODWORD(v88); | |
1020 goto LABEL_93; | |
1021 } | |
1022 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1023 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1024 { |
1025 v88 = v104; | |
1026 goto LABEL_92; | |
1027 } | |
1028 LABEL_93: | |
1029 v81 += 48; | |
1030 --v82; | |
1031 } | |
1032 while ( v82 ); | |
1033 } | |
1034 v91 = __OFSUB__(v116, 3); | |
1035 v90 = v116 - 3 < 0; | |
1036 if ( v116 > 3 ) | |
1037 { | |
1038 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1039 if ( v116 > 0 ) | |
1040 { | |
1041 v105 = 1; | |
1042 do | |
1043 { | |
1044 v92 = v105; | |
1045 v93 = v105 - 1; | |
1046 v94 = v105 + 1; | |
1047 v95 = v105 + 1; | |
1048 if ( v105 - 1 >= v80 ) | |
1049 v93 -= v80; | |
1050 if ( v105 >= v80 ) | |
1051 v92 = v105 - v80; | |
1052 if ( v94 >= v80 ) | |
1053 v95 = v94 - v80; | |
1054 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1055 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1056 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1057 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1058 { | |
1059 ++v105; | |
1060 } | |
1061 else | |
1062 { | |
1063 v96 = v105; | |
1064 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1065 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1066 --v80; | |
1067 } | |
1068 } | |
1069 while ( v105 - 1 < v80 ); | |
1070 } | |
1071 v91 = __OFSUB__(v80, 3); | |
1072 v90 = v80 - 3 < 0; | |
1073 } | |
1074 if ( v90 ^ v91 ) | |
1075 LABEL_112: | |
1076 result = 0; | |
1077 else | |
1078 result = v80; | |
1079 return result; | |
1080 } | |
1081 | |
1082 //----- (0042620A) -------------------------------------------------------- | |
1083 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1084 { | |
1085 __int16 v1; // fps@1 | |
1086 unsigned __int8 v2; // c0@2 | |
1087 char v3; // c2@2 | |
1088 unsigned __int8 v4; // c3@2 | |
1089 bool result; // eax@2 | |
1090 unsigned __int8 v6; // c0@4 | |
1091 char v7; // c2@4 | |
1092 unsigned __int8 v8; // c3@4 | |
1093 unsigned __int8 v9; // c0@6 | |
1094 char v10; // c2@6 | |
1095 unsigned __int8 v11; // c3@6 | |
1096 double v12; // st6@7 | |
1097 float v13; // ST04_4@7 | |
1098 float v14; // ST00_4@7 | |
1099 double v15; // st7@7 | |
1100 double v16; // st6@8 | |
1101 float v17; // ST04_4@8 | |
1102 float v18; // ST00_4@8 | |
1103 double v19; // st7@8 | |
1104 | |
1105 //UNDEF(v1); | |
1106 if ( p->vWorldViewPosition.x < 300.0 | |
1107 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1108 v3 = 0, | |
1109 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1110 //BYTE1(result) = HIBYTE(v1), |
0 | 1111 !(v2 | v4)) ) |
1112 { | |
1113 if ( p->vWorldViewPosition.x < 300.0 ) | |
1114 { | |
1115 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1116 v7 = 0; | |
1117 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1118 //BYTE1(result) = HIBYTE(v1); |
0 | 1119 if ( !(v6 | v8) ) |
1120 { | |
921 | 1121 //LOBYTE(result) = 0; |
1122 return false; | |
0 | 1123 } |
1124 } | |
1125 v9 = 300.0 < p->vWorldViewPosition.x; | |
1126 v10 = 0; | |
1127 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1128 //BYTE1(result) = HIBYTE(v1); |
0 | 1129 if ( v9 | v11 ) |
1130 { | |
1131 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1132 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1133 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1134 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1135 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1136 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1137 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1138 } | |
1139 else | |
1140 { | |
1141 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1142 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1143 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1144 v15 = 300.0 - p->vWorldViewPosition.x; | |
1145 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1146 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1147 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1148 } | |
1149 } | |
921 | 1150 //LOBYTE(result) = 1; |
1151 return true; | |
0 | 1152 } |
1153 | |
1154 //----- (004268E3) -------------------------------------------------------- | |
1155 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1156 { | |
1157 unsigned int v1; // eax@1 | |
1158 unsigned int v2; // edx@1 | |
1159 int v3; // eax@1 | |
1160 int v4; // edx@1 | |
1161 unsigned int v5; // ecx@1 | |
1162 | |
1163 v1 = uColor >> 9; | |
1164 v2 = uColor >> 6; | |
1165 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1166 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1167 v3 = v2 | v1; | |
1168 v4 = (unsigned __int8)uColor >> 3; | |
1169 v5 = uColor >> 16; | |
1170 LOWORD(v5) = v5 & 0x8000; | |
1171 return v5 | v4 | v3; | |
1172 } | |
1173 | |
1174 //----- (0042690D) -------------------------------------------------------- | |
1175 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1176 { | |
1177 unsigned int v1; // eax@1 | |
1178 unsigned int v2; // edx@1 | |
1179 | |
1180 v1 = a1 >> 8; | |
1181 v2 = a1 >> 5; | |
1182 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1183 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1184 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1185 } | |
1186 //----- (00426947) -------------------------------------------------------- | |
1187 void __cdecl sub_426947() | |
1188 { | |
893 | 1189 stru_50C198.field_0 = 0; |
0 | 1190 dword_50C994 = 0; |
1191 dword_50C998_turnbased_icon_1A = 0; | |
1192 } | |
1193 // 50C968: using guessed type int dword_50C968; | |
1194 // 50C994: using guessed type int dword_50C994; | |
1195 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1196 | |
1197 //----- (00426A5A) -------------------------------------------------------- | |
1198 void stru319::LootActor(Actor *pActor) | |
1199 { | |
1200 signed int v2; // edi@1 | |
1201 char v3; // zf@1 | |
1202 unsigned int v4; // eax@13 | |
1203 unsigned int v5; // esi@13 | |
1204 int v6; // eax@14 | |
1205 unsigned __int8 v7; // al@30 | |
1206 Party *v8; // esi@34 | |
1207 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1208 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1209 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1210 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1211 int v13; // [sp+30h] [bp-8h]@1 | |
1212 int v14; // [sp+34h] [bp-4h]@1 | |
1213 | |
1214 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1215 Dst.Reset(); | |
1216 v2 = 0; | |
1217 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1218 v13 = 0; | |
1219 v14 = 0; | |
1220 if ( v3 ) | |
1221 { | |
1222 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1223 goto LABEL_9; | |
1224 do | |
1225 { | |
1226 ++v2; | |
1227 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1228 } | |
1229 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1230 } | |
1231 else | |
1232 { | |
1233 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1234 goto LABEL_9; | |
377 | 1235 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1236 pActor->array_000234[3].Reset(); |
1237 } | |
1238 if ( v14 ) | |
1239 { | |
1240 party_finds_gold(v14, 0); | |
1241 viewparams->bRedrawGameUI = 1; | |
1242 } | |
1243 LABEL_9: | |
1244 if ( pActor->uCarriedItemID ) | |
1245 { | |
1246 Dst.Reset(); | |
1247 Dst.uItemID = pActor->uCarriedItemID; | |
1248 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1249 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1250 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1251 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1252 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[471], v9); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1253 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 1254 v4 = Dst.uItemID; |
1255 v5 = Dst.uItemID; | |
1256 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1257 { | |
1258 v5 = Dst.uItemID; | |
1259 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1260 Dst.uNumCharges = v6; | |
1261 Dst.uMaxCharges = v6; | |
1262 v4 = Dst.uItemID; | |
1263 } | |
1264 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1265 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1266 pItemsTable->SetSpecialBonus(&Dst); |
1267 if ( !pParty->AddItem(&Dst) ) | |
1268 pParty->SetHoldingItem(&Dst); | |
1269 pActor->uCarriedItemID = 0; | |
1270 if ( pActor->array_000234[0].uItemID ) | |
1271 { | |
1272 if ( !pParty->AddItem(pActor->array_000234) ) | |
1273 { | |
1274 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1275 pParty->SetHoldingItem(pActor->array_000234); | |
1276 } | |
1277 pActor->array_000234[0].Reset(); | |
1278 } | |
1279 if ( pActor->array_000234[1].uItemID ) | |
1280 { | |
1281 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1282 { | |
1283 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1284 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1285 } | |
1286 pActor->array_000234[1].Reset(); | |
1287 } | |
1288 LABEL_55: | |
1289 pActor->Remove(); | |
1290 return; | |
1291 } | |
1292 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1293 { | |
1294 if ( pActor->array_000234[3].uItemID ) | |
1295 { | |
1296 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1297 pActor->array_000234[3].Reset(); | |
1298 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1299 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1300 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1301 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1302 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1303 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 1304 if ( !pParty->AddItem(&Dst) ) |
1305 pParty->SetHoldingItem(&Dst); | |
1306 v13 = 1; | |
1307 } | |
1308 goto LABEL_44; | |
1309 } | |
1310 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1311 { | |
1312 LABEL_44: | |
1313 v8 = pParty; | |
1314 goto LABEL_45; | |
1315 } | |
1316 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1317 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1318 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1319 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1320 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1321 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1322 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 1323 v8 = pParty; |
1324 if ( !pParty->AddItem(&Dst) ) | |
1325 pParty->SetHoldingItem(&Dst); | |
1326 v13 = 1; | |
1327 LABEL_45: | |
1328 if ( pActor->array_000234[0].uItemID ) | |
1329 { | |
1330 if ( !v8->AddItem(pActor->array_000234) ) | |
1331 { | |
1332 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1333 v8->SetHoldingItem(pActor->array_000234); | |
1334 v13 = 1; | |
1335 } | |
1336 pActor->array_000234[0].Reset(); | |
1337 } | |
1338 if ( pActor->array_000234[1].uItemID ) | |
1339 { | |
1340 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1341 { | |
1342 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1343 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1344 v13 = 1; | |
1345 } | |
1346 pActor->array_000234[1].Reset(); | |
1347 } | |
1348 if ( !v13 || rand() % 100 < 90 ) | |
1349 goto LABEL_55; | |
1350 } | |
1351 | |
1352 //----- (00426E10) -------------------------------------------------------- | |
1353 int stru319::which_player_would_attack(Actor *pActor) | |
1354 { | |
1355 signed int v2; // ebx@1 | |
1356 int v3; // ecx@2 | |
1357 signed int v4; // edx@3 | |
1358 char v5; // zf@3 | |
1359 unsigned int v6; // eax@3 | |
1360 int v7; // eax@6 | |
1361 int v8; // eax@7 | |
1362 int v9; // eax@8 | |
1363 int v10; // eax@9 | |
1364 int v11; // eax@10 | |
1365 int v12; // eax@11 | |
1366 int v13; // esi@35 | |
1367 signed int v14; // edi@37 | |
1368 enum CHARACTER_RACE v15; // eax@44 | |
1369 Player *v16; // ecx@47 | |
1370 unsigned __int8 v17; // sf@50 | |
1371 unsigned __int8 v18; // of@50 | |
1372 int v19; // esi@52 | |
1373 Player *v20; // ecx@53 | |
1374 int result; // eax@57 | |
1375 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1376 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1377 int v24; // [sp+138h] [bp-10h]@2 | |
1378 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1379 int v26; // [sp+140h] [bp-8h]@1 | |
1380 int v27; // [sp+144h] [bp-4h]@1 | |
1381 | |
1382 v27 = -1; | |
1383 v26 = -1; | |
1384 v25 = -1; | |
1385 v2 = 0; | |
1386 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1387 { | |
1388 v3 = 0; | |
1389 v24 = 0; | |
1390 do | |
1391 { | |
1392 v4 = 1; | |
1393 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1394 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1395 v22[v3] = v6; | |
1396 if ( !v5 ) | |
1397 { | |
1398 if ( (signed int)v6 > 128 ) | |
1399 { | |
1400 switch ( v6 ) | |
1401 { | |
1402 case 0x100u: | |
1403 v27 = 8; | |
1404 break; | |
1405 case 0x200u: | |
1406 v25 = 0; | |
1407 break; | |
1408 case 0x400u: | |
1409 v25 = 1; | |
1410 break; | |
1411 case 0x800u: | |
1412 v26 = 0; | |
1413 break; | |
1414 case 0x1000u: | |
1415 v26 = 1; | |
1416 break; | |
1417 case 0x2000u: | |
1418 v26 = 3; | |
1419 break; | |
1420 case 0x4000u: | |
1421 v26 = 2; | |
1422 break; | |
1423 } | |
1424 } | |
1425 else | |
1426 { | |
1427 if ( v6 == 128 ) | |
1428 { | |
1429 v27 = 4; | |
1430 } | |
1431 else | |
1432 { | |
1433 v7 = v6 - 1; | |
1434 if ( v7 ) | |
1435 { | |
1436 v8 = v7 - 1; | |
1437 if ( v8 ) | |
1438 { | |
1439 v9 = v8 - 2; | |
1440 if ( v9 ) | |
1441 { | |
1442 v10 = v9 - 4; | |
1443 if ( v10 ) | |
1444 { | |
1445 v11 = v10 - 8; | |
1446 if ( v11 ) | |
1447 { | |
1448 v12 = v11 - 16; | |
1449 if ( v12 ) | |
1450 { | |
1451 if ( v12 == 32 ) | |
1452 v27 = 20; | |
1453 } | |
1454 else | |
1455 { | |
1456 v27 = 32; | |
1457 } | |
1458 } | |
1459 else | |
1460 { | |
1461 v27 = 24; | |
1462 } | |
1463 } | |
1464 else | |
1465 { | |
1466 v27 = 28; | |
1467 } | |
1468 } | |
1469 else | |
1470 { | |
1471 v27 = 16; | |
1472 } | |
1473 } | |
1474 else | |
1475 { | |
1476 v27 = 12; | |
1477 } | |
1478 } | |
1479 else | |
1480 { | |
1481 v27 = 0; | |
1482 } | |
1483 } | |
1484 } | |
1485 v2 = 0; | |
1486 v13 = 0; | |
1487 while ( 1 ) | |
1488 { | |
1489 v14 = 0; | |
135 | 1490 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1491 v14 = v4; |
1492 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1493 v14 = v4; | |
1494 if ( v26 != -1 ) | |
1495 { | |
1496 v15 = pPlayers[v13 + 1]->GetRace(); | |
1497 if ( v26 == v15 ) | |
1498 v14 = 1; | |
1499 } | |
1500 if ( v14 == 1 ) | |
1501 { | |
1502 v16 = pPlayers[v13 + 1]; | |
1503 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1504 v23[v2++] = v13; | |
1505 } | |
1506 ++v13; | |
1507 if ( v13 >= 4 ) | |
1508 break; | |
1509 v4 = 1; | |
1510 } | |
1511 } | |
1512 v3 = v24 + 1; | |
1513 v18 = __OFSUB__(v24 + 1, 15); | |
1514 v17 = v24++ - 14 < 0; | |
1515 } | |
1516 while ( v17 ^ v18 ); | |
1517 if ( v2 ) | |
1518 goto LABEL_61; | |
1519 } | |
1520 v19 = 0; | |
1521 do | |
1522 { | |
1523 v20 = pPlayers[v19 + 1]; | |
1524 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1525 v23[v2++] = v19; | |
1526 ++v19; | |
1527 } | |
1528 while ( v19 < 4 ); | |
1529 if ( v2 ) | |
1530 LABEL_61: | |
1531 result = v23[rand() % v2]; | |
1532 else | |
1533 result = 0; | |
1534 return result; | |
1535 } | |
1536 | |
1537 //----- (0042704B) -------------------------------------------------------- | |
1538 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1539 { | |
1540 stru319 *v3; // edi@1 | |
1541 signed int v4; // ebx@5 | |
1542 signed int v5; // edi@5 | |
1543 | |
1544 v3 = this; | |
1545 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1546 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1547 && rand() % 100 < 5 ) | |
1548 pActor->_44FD29(a2); | |
1549 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1550 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1551 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1552 return 2; | |
1553 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1554 return 3; | |
1555 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1556 } | |
1557 | |
1558 //----- (00427102) -------------------------------------------------------- | |
1559 int stru319::_427102(Actor *pActor, signed int a2) | |
1560 { | |
1561 unsigned __int8 v3; // cf@11 | |
1562 unsigned __int8 v4; // zf@11 | |
1563 SpellBuff *v6; // ecx@46 | |
89 | 1564 Player *v7; // esi@49 |
0 | 1565 signed int v8; // edx@50 |
89 | 1566 SpellBuff *v9; // ecx@50 |
0 | 1567 |
597 | 1568 switch(a2) |
0 | 1569 { |
597 | 1570 case 77: |
1571 { | |
1572 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1573 return 0; | |
1574 return 1; | |
1575 } | |
1576 case 80: | |
1577 { | |
1578 v6 = pParty->pPartyBuffs; | |
1579 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1580 { | |
1581 ++v6; | |
1167 | 1582 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] ) |
597 | 1583 { |
1584 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1585 v8 = 0; | |
1586 v9 = v7->pPlayerBuffs; | |
1587 while ( v9->uExpireTime <= 0i64 ) | |
1588 { | |
1589 ++v8; | |
1590 ++v9; | |
1591 if ( v8 >= 24 ) | |
1592 { | |
1593 ++v7; | |
1594 if ( v7 <= &pParty->pPlayers[3] ) | |
1595 { | |
1596 v8 = 0; | |
1597 v9 = v7->pPlayerBuffs; | |
1598 } | |
1599 else | |
1600 return 0; | |
1601 } | |
1602 } | |
1603 return 1; | |
1604 } | |
1605 } | |
1606 return 1; | |
1607 } | |
1608 case 85: | |
1609 { | |
1610 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1611 return 1; | |
1612 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1613 return 0; | |
1614 v3 = 0; | |
1615 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1616 break; | |
1617 } | |
1618 case 86: | |
1619 { | |
0 | 1620 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1621 return 1; |
0 | 1622 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1623 return 0; |
0 | 1624 v3 = 0; |
1625 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1626 break; |
1627 } | |
1628 case 95: | |
1629 { | |
1630 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1631 return 1; | |
0 | 1632 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1633 return 0; |
0 | 1634 v3 = 0; |
1635 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1636 break; |
1637 } | |
1638 case 73: | |
1639 { | |
1640 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1641 return 1; | |
1642 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1643 return 0; | |
1644 v3 = 0; | |
1645 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1646 break; | |
1647 } | |
1648 case 5: | |
1649 { | |
1650 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1651 return 1; | |
1652 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1653 return 0; | |
1654 v3 = 0; | |
1655 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1656 break; | |
1657 } | |
1658 case 17: | |
1659 { | |
1660 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1661 return 1; | |
1662 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1663 return 0; | |
1664 v3 = 0; | |
1665 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1666 break; | |
1667 } | |
1668 case 38: | |
89 | 1669 { |
597 | 1670 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1671 return 1; | |
1672 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1673 return 0; | |
1674 v3 = 0; | |
1675 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1676 } | |
1677 case 46: | |
1678 { | |
1679 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1680 return 1; |
597 | 1681 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1682 return 0; | |
1683 v3 = 0; | |
1684 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1685 break; | |
1686 } | |
1687 case 47: | |
1688 { | |
1689 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1690 return 1; | |
1691 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1692 return 0; | |
1693 v3 = 0; | |
1694 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1695 break; | |
1696 } | |
1697 case 51: | |
1698 { | |
1699 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1700 return 1; | |
1701 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1702 { | |
89 | 1703 v3 = 0; |
1704 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1705 } | |
1706 else | |
597 | 1707 return 0; |
1708 break; | |
1709 } | |
1710 default: | |
89 | 1711 { |
597 | 1712 return 1; |
89 | 1713 } |
0 | 1714 } |
1715 if ( !(v3 | v4) ) | |
1716 return 0; | |
1717 return 1; | |
1718 } | |
1719 | |
1720 //----- (004272F5) -------------------------------------------------------- | |
1721 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1722 { | |
1723 signed int v5; // esi@1 | |
1724 signed int v6; // edi@1 | |
1725 int v7; // esi@8 | |
1726 int v8; // eax@9 | |
1727 int v9; // edx@11 | |
1728 int v10; // edx@13 | |
1729 int v11; // esi@13 | |
1730 unsigned __int8 v12; // sf@13 | |
1731 unsigned __int8 v13; // of@13 | |
1732 int v14; // edx@14 | |
1733 int v15; // eax@14 | |
1734 signed int result; // eax@17 | |
1735 | |
1736 v5 = pActor->pMonsterInfo.uAC; | |
1737 v6 = 0; | |
1738 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1739 v5 /= 2; | |
1740 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1741 v6 = pActor->pActorBuffs[15].uPower; | |
1742 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1743 v6 = pActor->pActorBuffs[16].uPower; | |
1744 v7 = v6 + v5; | |
1745 if ( a3 ) | |
1746 v8 = pPlayer->GetRangedAttack(); | |
1747 else | |
1748 v8 = pPlayer->GetActualAttack(0); | |
1749 v9 = rand() % (v7 + 2 * v8 + 30); | |
1750 if ( a3 == 2 ) | |
1751 { | |
1752 v14 = a4 + v9; | |
1753 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1754 } | |
1755 else | |
1756 { | |
1757 if ( a3 != 3 ) | |
1758 { | |
1759 v10 = a4 + v9; | |
1760 v11 = v7 + 15; | |
1761 v13 = __OFSUB__(v10, v11); | |
1762 v12 = v10 - v11 < 0; | |
1763 goto LABEL_16; | |
1764 } | |
1765 v14 = a4 + v9; | |
1766 v15 = 2 * v7 + 30; | |
1767 } | |
1768 v13 = __OFSUB__(v14, v15); | |
1769 v12 = v14 - v15 < 0; | |
1770 LABEL_16: | |
1771 if ( v12 ^ v13 ) | |
1772 result = 0; | |
1773 else | |
1774 result = 1; | |
1775 return result; | |
1776 } | |
1777 | |
1778 //----- (004273BB) -------------------------------------------------------- | |
1779 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1780 { | |
1781 Actor *v5; // ecx@1 | |
1782 signed int v6; // ebx@1 | |
1783 signed int v7; // esi@1 | |
1784 unsigned __int8 v8; // zf@1 | |
1785 unsigned __int8 v9; // sf@1 | |
1786 int v10; // ebx@10 | |
1787 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1788 | |
1789 v5 = a2; | |
1790 v6 = a2->pMonsterInfo.uAC; | |
1791 v7 = 0; | |
1792 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1793 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1794 a2a = 0; | |
1795 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1796 v6 /= 2; | |
1797 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1798 v7 = v5->pActorBuffs[14].uPower; | |
1799 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1800 v7 = v5->pActorBuffs[16].uPower; | |
1801 v10 = v7 + v6; | |
1802 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1803 a2a = pActor->pActorBuffs[14].uPower; | |
1804 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1805 a2a = pActor->pActorBuffs[17].uPower; | |
1806 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1807 { | |
1808 a2a += pActor->pActorBuffs[11].uPower; | |
1809 pActor->pActorBuffs[11].Reset(); | |
1810 } | |
1811 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1812 } | |
1813 | |
1814 //----- (004274AD) -------------------------------------------------------- | |
1815 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1816 { | |
1817 signed int v3; // edi@1 | |
1818 signed int v4; // esi@8 | |
1819 int v5; // esi@8 | |
1820 | |
1821 v3 = 0; | |
1822 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1823 v3 = pActor->pActorBuffs[14].uPower; | |
1824 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1825 v3 = pActor->pActorBuffs[17].uPower; | |
1826 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1827 { | |
1828 v3 += pActor->pActorBuffs[11].uPower; | |
1829 pActor->pActorBuffs[11].Reset(); | |
1830 } | |
1831 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1832 v5 = rand() % v4 + 1; | |
1833 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1834 } | |
1835 | |
1836 //----- (00427546) -------------------------------------------------------- | |
1837 int stru319::_427546(int a2) | |
1838 { | |
1839 int result; // eax@2 | |
1840 | |
1841 if ( a2 >= 0 ) | |
1842 { | |
1843 if ( a2 >= 1 ) | |
1844 result = (a2 >= 2) + 2; | |
1845 else | |
1846 result = 1; | |
1847 } | |
1848 else | |
1849 { | |
1850 result = 0; | |
1851 } | |
1852 return result; | |
1853 } | |
1854 | |
1855 //----- (0042756B) -------------------------------------------------------- | |
1856 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1857 { | |
1858 int v4; // edx@1 | |
1859 int v5; // ecx@1 | |
1860 signed int v6; // eax@4 | |
1861 signed int result; // eax@17 | |
1862 signed int v8; // esi@18 | |
1863 | |
1864 v4 = 0; | |
1865 v5 = 0; | |
1866 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1867 v5 = pActor->pActorBuffs[14].uPower; | |
1868 switch ( a2 ) | |
1869 { | |
1870 case 4: | |
1871 v6 = pActor->pMonsterInfo.uResPhysical; | |
1872 break; | |
1873 case 0: | |
1874 v6 = pActor->pMonsterInfo.uResFire; | |
1875 goto LABEL_12; | |
1876 case 1: | |
1877 v6 = pActor->pMonsterInfo.uResAir; | |
1878 goto LABEL_12; | |
1879 case 2: | |
1880 v6 = pActor->pMonsterInfo.uResWater; | |
1881 goto LABEL_12; | |
1882 case 3: | |
1883 v6 = pActor->pMonsterInfo.uResEarth; | |
1884 goto LABEL_12; | |
1885 case 6: | |
1886 v6 = pActor->pMonsterInfo.uResSpirit; | |
1887 break; | |
1888 case 7: | |
1889 v6 = pActor->pMonsterInfo.uResMind; | |
1890 goto LABEL_12; | |
1891 case 8: | |
1892 v6 = pActor->pMonsterInfo.uResBody; | |
1893 LABEL_12: | |
1894 v4 = v5; | |
1895 break; | |
1896 case 9: | |
1897 v6 = pActor->pMonsterInfo.uResLight; | |
1898 break; | |
1899 case 10: | |
1900 v6 = pActor->pMonsterInfo.uResDark; | |
1901 break; | |
1902 default: | |
1903 v6 = 0; | |
1904 break; | |
1905 } | |
1906 if ( v6 < 200 ) | |
1907 { | |
1908 v8 = v4 + v6 + 30; | |
1909 if ( rand() % v8 >= 30 ) | |
1910 { | |
1911 a3 >>= 1; | |
1912 if ( rand() % v8 >= 30 ) | |
1913 { | |
1914 a3 >>= 1; | |
1915 if ( rand() % v8 >= 30 ) | |
1916 { | |
1917 a3 >>= 1; | |
1918 if ( rand() % v8 >= 30 ) | |
1919 a3 >>= 1; | |
1920 } | |
1921 } | |
1922 } | |
1923 result = a3; | |
1924 } | |
1925 else | |
1926 { | |
1927 result = 0; | |
1928 } | |
1929 return result; | |
1930 } | |
1931 | |
1932 //----- (00427662) -------------------------------------------------------- | |
1933 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
1934 { | |
1935 Actor *v3; // edi@2 | |
1936 signed int v4; // esi@2 | |
1937 bool result; // eax@13 | |
1938 | |
1939 switch ( uType ) | |
1940 { | |
1941 case 0u: | |
1942 v3 = pActor; | |
1943 v4 = pActor->pMonsterInfo.uResFire; | |
1944 goto LABEL_12; | |
1945 case 1u: | |
1946 v3 = pActor; | |
1947 v4 = pActor->pMonsterInfo.uResAir; | |
1948 goto LABEL_12; | |
1949 case 2u: | |
1950 v3 = pActor; | |
1951 v4 = pActor->pMonsterInfo.uResWater; | |
1952 goto LABEL_12; | |
1953 case 3u: | |
1954 v3 = pActor; | |
1955 v4 = pActor->pMonsterInfo.uResEarth; | |
1956 goto LABEL_12; | |
1957 case 7u: | |
1958 v3 = pActor; | |
1959 v4 = pActor->pMonsterInfo.uResMind; | |
1960 goto LABEL_12; | |
1961 case 6u: | |
1962 v3 = pActor; | |
1963 v4 = pActor->pMonsterInfo.uResSpirit; | |
1964 goto LABEL_12; | |
1965 case 8u: | |
1966 v3 = pActor; | |
1967 v4 = pActor->pMonsterInfo.uResBody; | |
1968 goto LABEL_12; | |
1969 case 9u: | |
1970 v3 = pActor; | |
1971 v4 = pActor->pMonsterInfo.uResLight; | |
1972 goto LABEL_12; | |
1973 case 0xAu: | |
1974 v3 = pActor; | |
1975 v4 = pActor->pMonsterInfo.uResDark; | |
1976 goto LABEL_12; | |
1977 case 4u: | |
1978 v3 = pActor; | |
1979 v4 = pActor->pMonsterInfo.uResPhysical; | |
1980 LABEL_12: | |
1981 if ( v4 < 200 ) | |
1982 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
1983 else | |
1984 result = 0; | |
1985 break; | |
1986 default: | |
1987 result = 1; | |
1988 break; | |
1989 } | |
1990 return result; | |
1991 } | |
1992 | |
1993 //----- (0042EB8D) -------------------------------------------------------- | |
437 | 1994 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 1995 { |
482 | 1996 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 1997 if (uNumMessages < 40) |
1998 { | |
437 | 1999 files[uNumMessages] = file; |
2000 lines[uNumMessages] = line; | |
2001 | |
0 | 2002 pMessages[uNumMessages].eType = msg; |
2003 pMessages[uNumMessages].param = param; | |
2004 pMessages[uNumMessages++].field_8 = a4; | |
2005 } | |
2006 } | |
2007 | |
2008 //----- (0042EBBE) -------------------------------------------------------- | |
2009 int __fastcall sub_42EBBE(int a1, int a2) | |
2010 { | |
2011 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
2012 } | |
2013 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
2014 | |
2015 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 2016 int stru193_math::Sin(int angle) |
0 | 2017 { |
323 | 2018 return Cos(angle - this->uIntegerHalfPi); |
0 | 2019 } |
2020 | |
2021 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 2022 void _42ECB5_PlayerAttacksActor() |
0 | 2023 { |
271 | 2024 //unsigned int v0; // ebx@1 |
2025 //Player *v1; // esi@1 | |
2026 //bool result; // eax@1 | |
295 | 2027 //int v3; // edi@2 |
271 | 2028 //unsigned int v4; // eax@7 |
0 | 2029 char *v5; // eax@8 |
271 | 2030 //int v6; // ecx@9 |
2031 //signed int v7; // eax@16 | |
295 | 2032 //Actor *v8; // edi@20 |
0 | 2033 unsigned int v9; // ecx@21 |
295 | 2034 //char *v10; // eax@26 |
0 | 2035 char *v11; // eax@26 |
2036 unsigned int v12; // eax@47 | |
295 | 2037 //char *v13; // eax@47 |
2038 //char *v14; // eax@47 | |
2039 //unsigned int v15; // ebx@54 | |
2040 //int v16; // [sp-10h] [bp-4Ch]@24 | |
2041 //int v17; // [sp-10h] [bp-4Ch]@44 | |
2042 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
2043 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
2044 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
2045 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
2046 //int v22; // [sp-4h] [bp-40h]@24 | |
2047 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 2048 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 2049 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 2050 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
2051 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 2052 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 2053 //unsigned int *v28b; |
295 | 2054 //int v29; // [sp+24h] [bp-18h]@16 |
2055 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 2056 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 2057 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 2058 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 2059 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 2060 |
271 | 2061 //v0 = uActiveCharacter; |
2062 //v27 = 6972 * uActiveCharacter; | |
2063 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
2064 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
2065 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
2066 if (!player->CanAct()) | |
2067 return; | |
2068 | |
1202 | 2069 pCastSpellInfo.data()->_427D48(uActiveCharacter); |
295 | 2070 //v3 = 0; |
271 | 2071 if (pParty->Invisible()) |
2072 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
2073 | |
2074 //v31 = player->pEquipment.uBow; | |
2075 int bow_idx = player->pEquipment.uBow; | |
2076 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
2077 bow_idx = 0; | |
2078 | |
295 | 2079 //v32 = 0; |
2080 int wand_item_id = 0; | |
271 | 2081 //v33 = 0; |
2082 //v4 = v1->pEquipment.uMainHand; | |
2083 int laser_weapon_item_id = 0; | |
2084 | |
2085 int main_hand_idx = player->pEquipment.uMainHand; | |
2086 if (main_hand_idx) | |
0 | 2087 { |
271 | 2088 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 2089 //v5 = (char *)v1 + 36 * v4; |
271 | 2090 if (!item->Broken()) |
2091 { | |
2092 //v28b = &v1->pInventoryItems[v4].uItemID; | |
2093 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 2094 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 2095 { |
295 | 2096 if (item->uNumCharges <= 0) |
2097 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 2098 else |
295 | 2099 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 2100 } |
271 | 2101 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
2102 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 2103 } |
271 | 2104 } |
2105 | |
295 | 2106 //v30 = 0; |
2107 //v29 = 0; | |
2108 //v28 = 0; | |
271 | 2109 //v7 = pMouse->uPointingObjectID; |
2110 | |
2111 int target_pid = pMouse->uPointingObjectID; | |
848 | 2112 int target_type = PID_TYPE(target_pid), |
2113 target_id = PID_ID(target_pid); | |
271 | 2114 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
2115 { | |
2116 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 2117 target_type = PID_TYPE(target_pid); |
2118 target_id = PID_ID(target_pid); | |
271 | 2119 } |
295 | 2120 |
2121 auto actor = &pActors[target_id]; | |
2122 int actor_distance = 0; | |
271 | 2123 if (target_type == OBJECT_Actor) |
2124 { | |
295 | 2125 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
2126 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
2127 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
2128 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
2129 if (actor_distance < 0) | |
2130 actor_distance = 0; | |
2131 } | |
2132 | |
2133 bool shooting_bow = false, | |
2134 shotting_laser = false, | |
816 | 2135 shooting_wand = false, |
2136 melee_attack = false; | |
295 | 2137 if (laser_weapon_item_id) |
2138 { | |
2139 shotting_laser = true; | |
490 | 2140 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 2141 } |
2142 else if (wand_item_id) | |
2143 { | |
2144 shooting_wand = true; | |
2145 | |
2146 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 2147 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 2148 |
2149 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
2150 player->pEquipment.uMainHand = 0; | |
2151 } | |
303 | 2152 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 2153 { |
816 | 2154 melee_attack = true; |
2155 | |
303 | 2156 Vec3_int_ a3; |
2157 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
2158 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
2159 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
2160 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
2161 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2162 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
1080 | 2163 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) |
295 | 2164 _42FA66_do_explosive_impact( |
2165 actor->vPosition.x, | |
2166 actor->vPosition.y, | |
2167 actor->vPosition.z + actor->uActorHeight / 2, | |
2168 0, 512, uActiveCharacter); | |
303 | 2169 } |
2170 else if (bow_idx) | |
2171 { | |
2172 shooting_bow = true; | |
490 | 2173 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 2174 } |
2175 else | |
2176 { | |
816 | 2177 melee_attack = true; |
303 | 2178 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
2179 } | |
2180 | |
816 | 2181 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 2182 { |
816 | 2183 int recovery = player->GetAttackRecoveryTime(false); |
303 | 2184 if (recovery < 30 ) |
2185 recovery = 30; | |
816 | 2186 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 2187 } |
2188 | |
2189 | |
2190 int v34 = 0; | |
2191 if (shooting_wand) | |
2192 return; | |
2193 else if (shooting_bow) | |
2194 { | |
2195 v34 = 5; | |
2196 player->PlaySound(SPEECH_50, 0); | |
2197 } | |
2198 if (shotting_laser) | |
2199 v34 = 7; | |
2200 else | |
2201 { | |
2202 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 2203 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 2204 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
2205 pTurnEngine->_40471C(); | |
2206 } | |
2207 | |
2208 switch (v34) | |
2209 { | |
2210 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
2211 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
2212 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
2213 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
2214 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
2215 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
2216 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
2217 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
2218 } | |
0 | 2219 } |
2220 | |
2221 //----- (0042F184) -------------------------------------------------------- | |
295 | 2222 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 2223 { |
2224 int v4; // edi@1 | |
2225 stru319 *v5; // esi@1 | |
2226 int v6; // eax@2 | |
2227 int v7; // eax@4 | |
2228 int result; // eax@5 | |
2229 int *v9; // edx@8 | |
2230 signed int v10; // ebx@10 | |
2231 int v11; // edi@11 | |
2232 Actor *v12; // esi@12 | |
2233 unsigned __int16 v13; // ax@12 | |
2234 int v14; // eax@22 | |
2235 char v15; // zf@30 | |
2236 int v16; // esi@32 | |
2237 int v17; // ecx@34 | |
2238 stru319 *v18; // eax@39 | |
2239 int v19; // edx@39 | |
2240 int v20; // ecx@41 | |
2241 unsigned __int16 v21; // ax@42 | |
2242 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
2243 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
2244 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
2245 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
2246 int *v26; // [sp+18h] [bp-14h]@8 | |
2247 int v27; // [sp+1Ch] [bp-10h]@10 | |
2248 int *v28; // [sp+20h] [bp-Ch]@10 | |
2249 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
2250 int v30; // [sp+28h] [bp-4h]@6 | |
2251 int i; // [sp+38h] [bp+Ch]@33 | |
2252 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
2253 | |
2254 v4 = 0; | |
2255 v5 = this; | |
2256 v24 = this; | |
2257 if ( pRenderer->pRenderD3D ) | |
2258 { | |
2259 v6 = a3 != 0; | |
2260 if ( a4 ) | |
2261 LOBYTE(v6) = v6 | 8; | |
295 | 2262 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 2263 if ( v7 != -1 ) |
2264 return (unsigned __int16)v7; | |
295 | 2265 else return 0; |
0 | 2266 } |
2267 else | |
2268 { | |
2269 v30 = 0; | |
2270 if ( pRenderer->pActiveZBuffer ) | |
2271 { | |
692 | 2272 v29 = viewparams->uScreen_topL_X; |
2273 v23 = viewparams->uScreen_BttmR_X; | |
2274 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 2275 { |
692 | 2276 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
2277 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
2278 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 2279 do |
2280 { | |
2281 if ( (signed int)v29 < (signed int)v23 ) | |
2282 { | |
2283 v28 = v9; | |
2284 v10 = v4; | |
2285 v27 = v23 - v29; | |
2286 do | |
2287 { | |
2288 v22 = *v28; | |
2289 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2290 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 2291 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2292 v12 = &pActors[PID_ID(v11)]; |
0 | 2293 v13 = v12->uAIState; |
2294 if ( v13 != 5 ) | |
2295 { | |
2296 if ( v13 != 4 | |
2297 && v13 != 11 | |
2298 && v13 != 19 | |
2299 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2300 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 2301 { |
2302 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 2303 && v22 <= pick_depth << 16 ) |
0 | 2304 { |
2305 v14 = 0; | |
2306 if ( v10 > 0 ) | |
2307 { | |
2308 do | |
2309 { | |
2310 if ( dword_50BDA0[v14] == v11 ) | |
2311 break; | |
2312 ++v14; | |
2313 } | |
2314 while ( v14 < v30 ); | |
2315 } | |
2316 if ( v14 == v30 && v10 < 100 ) | |
2317 { | |
2318 ++v30; | |
2319 dword_50BC10[v10] = v22; | |
2320 dword_50BDA0[v10] = v11; | |
2321 ++v10; | |
2322 } | |
2323 } | |
2324 } | |
2325 } | |
2326 } | |
2327 ++v28; | |
2328 --v27; | |
2329 } | |
2330 while ( v27 ); | |
2331 v4 = v30; | |
2332 v5 = v24; | |
2333 } | |
2334 v9 = v26 + 640; | |
2335 v15 = v25-- == 1; | |
2336 v26 += 640; | |
2337 } | |
2338 while ( !v15 ); | |
2339 } | |
2340 if ( v4 > 0 ) | |
2341 { | |
2342 v32 = 1; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2343 v16 = (int)dword_50BC10.data(); |
0 | 2344 do |
2345 { | |
2346 for ( i = v32; i < v4; ++i ) | |
2347 { | |
2348 v17 = dword_50BC10[i]; | |
2349 if ( v17 < *(int *)v16 ) | |
2350 { | |
2351 dword_50BC10[i] = *(int *)v16; | |
2352 *(int *)v16 = v17; | |
2353 } | |
2354 } | |
2355 ++v32; | |
2356 v16 += 4; | |
2357 } | |
2358 while ( v32 - 1 < v4 ); | |
2359 v5 = v24; | |
2360 if ( v4 > 0 ) | |
2361 { | |
2362 v18 = v24; | |
2363 v19 = v4; | |
2364 do | |
2365 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2366 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF; |
0 | 2367 v18 += 4; |
2368 --v19; | |
2369 } | |
2370 while ( v19 ); | |
2371 } | |
2372 } | |
2373 v20 = 0; | |
2374 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
2375 { | |
2376 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
2377 if ( v21 != 4 && v21 != 5 ) | |
2378 break; | |
2379 } | |
2380 if ( v20 != v4 ) | |
2381 { | |
2382 result = 8 * *(int *)&v5[4 * v20].field_0; | |
2383 LOBYTE(result) = result | 3; | |
2384 return result; | |
2385 } | |
2386 } | |
2387 } | |
2388 return 0; | |
2389 } | |
2390 | |
2391 //----- (0042F3D6) -------------------------------------------------------- | |
2392 void InitializeTurnBasedAnimations(void *_this) | |
2393 { | |
2394 unsigned int *v1; // edi@1 | |
2395 | |
2396 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
2397 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
2398 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
2399 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
2400 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
2401 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
2402 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
2403 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
2404 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
2405 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2406 v1 = pIconIDs_Turn.data(); |
0 | 2407 do |
2408 { | |
2409 pIconsFrameTable->InitializeAnimation(*v1); | |
2410 ++v1; | |
2411 } | |
2412 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
2413 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
2414 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
2415 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
2416 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
2417 } | |
2418 | |
2419 //----- (0042F4DA) -------------------------------------------------------- | |
2420 signed int __cdecl sub_42F4DA() | |
2421 { | |
2422 signed int v0; // edi@1 | |
82 | 2423 Actor *v1; // esi@4 |
0 | 2424 int v2; // ebx@5 |
2425 int v3; // eax@5 | |
2426 int v4; // ebx@5 | |
2427 unsigned int v5; // ecx@5 | |
2428 int v6; // edx@6 | |
2429 unsigned int v7; // edx@8 | |
2430 unsigned int v8; // edx@10 | |
2431 __int16 v9; // ax@12 | |
2432 signed int result; // eax@20 | |
2433 int v11; // [sp+Ch] [bp-10h]@5 | |
2434 int v12; // [sp+10h] [bp-Ch]@5 | |
2435 signed int v13; // [sp+14h] [bp-8h]@3 | |
2436 | |
2437 v0 = 5120; | |
2438 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2439 v0 = 2560; | |
2440 v13 = 0; | |
2441 if ( (signed int)uNumActors <= 0 ) | |
2442 { | |
2443 LABEL_20: | |
2444 result = 0; | |
2445 } | |
2446 else | |
2447 { | |
1202 | 2448 v1 = pActors.data(); |
0 | 2449 while ( 1 ) |
2450 { | |
82 | 2451 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
2452 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
2453 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 2454 v3 = v2; |
2455 v4 = v11; | |
2456 v5 = v12; | |
2457 if ( v3 < v11 ) | |
2458 { | |
2459 v6 = v3; | |
2460 v3 = v11; | |
2461 v4 = v6; | |
2462 } | |
2463 if ( v3 < v12 ) | |
2464 { | |
2465 v7 = v3; | |
2466 v3 = v12; | |
2467 v5 = v7; | |
2468 } | |
2469 if ( v4 < (signed int)v5 ) | |
2470 { | |
2471 v8 = v5; | |
2472 v5 = v4; | |
2473 v4 = v8; | |
2474 } | |
2475 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
2476 { | |
82 | 2477 v9 = v1->uAIState; |
2478 if ( v1->uAIState != 5 ) | |
0 | 2479 { |
2480 if ( v9 != 4 | |
2481 && v9 != 11 | |
2482 && v9 != 19 | |
2483 && v9 != 17 | |
82 | 2484 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 2485 break; |
2486 } | |
2487 } | |
2488 ++v13; | |
82 | 2489 ++v1; |
0 | 2490 if ( v13 >= (signed int)uNumActors ) |
2491 goto LABEL_20; | |
2492 } | |
2493 result = 1; | |
2494 } | |
2495 return result; | |
2496 } | |
2497 | |
2498 //----- (0042F7EB) -------------------------------------------------------- | |
2499 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) | |
2500 { | |
2501 unsigned int v9; // edi@1 | |
2502 signed int v10; // edx@3 | |
2503 char *v11; // ecx@4 | |
2504 unsigned __int16 v12; // ax@7 | |
2505 unsigned int v13; // edx@9 | |
2506 char *v14; // ecx@10 | |
2507 int v15; // esi@17 | |
2508 int v16; // eax@18 | |
2509 int v17; // edi@20 | |
2510 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2511 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 2512 int v21; // [sp+7Ch] [bp-8h]@1 |
2513 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
2514 | |
2515 v9 = uSpriteID; | |
2516 v21 = x; | |
2517 v22 = uSpriteID; | |
2518 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2519 SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2520 //SpriteObject::SpriteObject(&a1a); |
0 | 2521 a1a.stru_24.Reset(); |
2522 | |
2523 if ( a9 ) | |
2524 { | |
2525 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
2526 v9 = v22; | |
2527 } | |
2528 v10 = 0; | |
822 | 2529 a1a.spell_skill = 0; |
2530 a1a.spell_level = 0; | |
2531 a1a.spell_id = 0; | |
0 | 2532 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2533 a1a.uType = v9; |
0 | 2534 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2535 { | |
2536 LABEL_7: | |
2537 v12 = 0; | |
2538 } | |
2539 else | |
2540 { | |
2541 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
2542 while ( (short)v9 != *(short *)v11 ) | |
2543 { | |
2544 ++v10; | |
2545 v11 += 56; | |
2546 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2547 goto LABEL_7; | |
2548 } | |
2549 v12 = v10; | |
2550 } | |
2551 a1a.uObjectDescID = v12; | |
2552 a1a.vPosition.z = z; | |
2553 a1a.vPosition.x = v21; | |
2554 a1a.vPosition.y = y; | |
2555 a1a.uSoundID = 0; | |
2556 a1a.uAttributes = attributes; | |
2557 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
2558 a1a.uSpriteFrameID = 0; | |
822 | 2559 a1a.spell_caster_pid = 0; |
823 | 2560 a1a.spell_target_pid = 0; |
0 | 2561 if ( !(a1a.uAttributes & 0x10) ) |
2562 { | |
2563 v13 = 0; | |
222 | 2564 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 2565 { |
2566 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
2567 while ( *(short *)v14 != v9 ) | |
2568 { | |
2569 ++v13; | |
2570 v14 += 48; | |
222 | 2571 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 2572 goto LABEL_16; |
2573 } | |
2574 a1a.stru_24.uItemID = v13; | |
2575 } | |
2576 } | |
2577 LABEL_16: | |
2578 if ( a7 ) | |
2579 { | |
2580 v15 = count; | |
2581 if ( count > 0 ) | |
2582 { | |
2583 do | |
2584 { | |
2585 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
2586 v16 = rand(); | |
2587 a1a.Create( | |
2588 (signed __int16)a1a.uFacing, | |
2589 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
2590 a4, | |
2591 0); | |
2592 --v15; | |
2593 } | |
2594 while ( v15 ); | |
2595 } | |
2596 } | |
2597 else | |
2598 { | |
2599 v17 = count; | |
2600 v18 = stru_5C6E00->uIntegerHalfPi; | |
2601 a1a.uFacing = 0; | |
2602 if ( count > 0 ) | |
2603 { | |
2604 do | |
2605 { | |
2606 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
2607 --v17; | |
2608 } | |
2609 while ( v17 ); | |
2610 } | |
2611 } | |
2612 return 1; | |
2613 } | |
2614 | |
2615 //----- (0042F960) -------------------------------------------------------- | |
2616 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
2617 { | |
2618 int v3; // ebx@1 | |
2619 int v4; // edi@1 | |
2620 signed int v5; // edx@1 | |
2621 char *v6; // ecx@2 | |
2622 unsigned __int16 v7; // ax@5 | |
2623 signed int v8; // eax@6 | |
2624 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2625 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 2626 |
2627 v3 = x; | |
2628 v4 = y; | |
2629 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2630 SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2631 //SpriteObject::SpriteObject(&a1); |
0 | 2632 a1.stru_24.Reset(); |
2633 | |
2634 v5 = 0; | |
822 | 2635 a1.spell_skill = 0; |
2636 a1.spell_level = 0; | |
2637 a1.spell_id = 0; | |
0 | 2638 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2639 a1.uType = 800; |
0 | 2640 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2641 { | |
2642 LABEL_5: | |
2643 v7 = 0; | |
2644 } | |
2645 else | |
2646 { | |
2647 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
2648 while ( *(short *)v6 != 800 ) | |
2649 { | |
2650 ++v5; | |
2651 v6 += 56; | |
2652 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
2653 goto LABEL_5; | |
2654 } | |
2655 v7 = v5; | |
2656 } | |
2657 a1.uObjectDescID = v7; | |
2658 a1.vPosition.x = v3; | |
2659 a1.vPosition.y = v4; | |
2660 a1.vPosition.z = z; | |
2661 a1.uSoundID = 0; | |
2662 a1.uAttributes = 0; | |
2663 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
2664 a1.uSpriteFrameID = 0; | |
822 | 2665 a1.spell_caster_pid = 0; |
823 | 2666 a1.spell_target_pid = 0; |
0 | 2667 v8 = a1.Create(0, 0, 0, 0); |
2668 if ( v8 != -1 ) | |
2669 { | |
2670 v9 = 8 * v8; | |
2671 LOBYTE(v9) = v9 | 2; | |
2672 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
2673 } | |
2674 } | |
2675 | |
810 | 2676 |
0 | 2677 |
2678 //----- (0042FA66) -------------------------------------------------------- | |
2679 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
2680 { | |
2681 int v6; // edi@1 | |
2682 int v7; // esi@1 | |
2683 char *v8; // ecx@2 | |
2684 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2685 //int v10; // eax@10 |
0 | 2686 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2687 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2688 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 2689 int v14; // [sp+7Ch] [bp-4h]@1 |
2690 | |
2691 v6 = a1; | |
2692 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2693 SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2694 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2695 a1a.uType = 600; |
0 | 2696 a1a.stru_24.Reset(); |
2697 | |
822 | 2698 a1a.spell_id = SPELL_FIRE_FIREBALL; |
2699 a1a.spell_level = 8; | |
2700 a1a.spell_skill = 3; | |
0 | 2701 v14 = 0; |
2702 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
2703 { | |
2704 LABEL_5: | |
2705 v9 = 0; | |
2706 } | |
2707 else | |
2708 { | |
2709 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2710 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 2711 { |
2712 ++v14; | |
2713 v8 += 56; | |
2714 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
2715 goto LABEL_5; | |
2716 } | |
2717 v9 = v14; | |
2718 } | |
2719 a1a.uObjectDescID = v9; | |
2720 a1a.vPosition.x = v6; | |
2721 a1a.vPosition.y = v7; | |
2722 a1a.vPosition.z = a3; | |
2723 a1a.uAttributes = 0; | |
2724 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
2725 a1a.uSpriteFrameID = 0; | |
823 | 2726 a1a.spell_target_pid = 0; |
0 | 2727 a1a.field_60_distance_related_prolly_lod = 0; |
2728 a1a.uFacing = 0; | |
2729 a1a.uSoundID = 0; | |
2730 if ( a6 >= 1 || a6 <= 4 ) | |
2731 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2732 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 2733 } |
2734 else | |
2735 { | |
822 | 2736 a1a.spell_caster_pid = 0; |
0 | 2737 } |
2738 result = a1a.Create(0, 0, 0, 0); | |
2739 if ( result != -1 ) | |
2740 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2741 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 2742 a5, |
2743 SLOWORD(a1a.vPosition.x), | |
2744 SLOWORD(a1a.vPosition.y), | |
2745 SLOWORD(a1a.vPosition.z), | |
2746 0, | |
2747 0); | |
2748 } | |
2749 return result; | |
2750 } | |
2751 | |
2752 //----- (0042FB5C) -------------------------------------------------------- | |
2753 bool __fastcall sub_42FB5C(signed int a1) | |
2754 { | |
2755 int v1; // ecx@3 | |
2756 int v2; // ecx@4 | |
2757 int v3; // ecx@5 | |
2758 int v4; // ecx@6 | |
2759 int v5; // ecx@7 | |
2760 int v6; // ecx@8 | |
2761 char v7; // zf@9 | |
2762 | |
2763 if ( a1 > 39 ) | |
2764 { | |
2765 if ( a1 > 77 ) | |
2766 { | |
2767 if ( a1 == 80 ) | |
2768 return 0; | |
2769 if ( a1 > 84 ) | |
2770 { | |
2771 if ( a1 <= 86 ) | |
2772 return 0; | |
2773 v7 = a1 == 95; | |
2774 goto LABEL_20; | |
2775 } | |
2776 } | |
2777 else | |
2778 { | |
2779 if ( a1 == 77 ) | |
2780 return 0; | |
2781 if ( a1 >= 46 ) | |
2782 { | |
2783 if ( a1 <= 47 || a1 == 51 ) | |
2784 return 0; | |
2785 v7 = a1 == 73; | |
2786 goto LABEL_20; | |
2787 } | |
2788 } | |
2789 return 1; | |
2790 } | |
2791 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
2792 return 1; | |
2793 v2 = v1 - 3; | |
2794 if ( !v2 ) | |
2795 return 0; | |
2796 v3 = v2 - 1; | |
2797 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
2798 return 1; | |
2799 v5 = v4 - 8; | |
2800 if ( !v5 ) | |
2801 return 0; | |
2802 v6 = v5 - 1; | |
2803 if ( !v6 ) | |
2804 return 1; | |
2805 v7 = v6 == 20; | |
2806 LABEL_20: | |
2807 if ( !v7 ) | |
2808 return 1; | |
2809 return 0; | |
2810 } | |
2811 | |
2812 //----- (0042FBDD) -------------------------------------------------------- | |
2813 void __cdecl sub_42FBDD() | |
2814 { | |
388 | 2815 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 2816 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
2817 pRenderer->Present(); | |
2818 } | |
2819 | |
2820 //----- (0042FC15) -------------------------------------------------------- | |
11 | 2821 void __cdecl CloseWindowBackground() |
0 | 2822 { |
388 | 2823 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 2824 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
2825 pRenderer->Present(); | |
2826 } | |
2827 | |
2828 //----- (0042FC4E) -------------------------------------------------------- | |
2829 void __cdecl ProcessInputActions() | |
2830 { | |
2831 char v4; // al@9 | |
2832 char v8; // bl@100 | |
2833 unsigned __int16 v9; // ax@102 | |
2834 int v10; // eax@103 | |
2835 char v14; // al@159 | |
2836 unsigned int v15; // eax@168 | |
2837 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
2838 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
2839 int v24; // [sp+4h] [bp-4h]@87 | |
2840 | |
2841 pGame->pKeyboardInstance->EnterCriticalSection(); | |
2842 auto pKeyboard = pGame->pKeyboardInstance; | |
2843 if (!bAlwaysRun) | |
2844 { | |
2845 if (pKeyboard->IsShiftHeld()) | |
2846 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
2847 else | |
2848 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
2849 } | |
2850 else | |
2851 { | |
2852 if (pKeyboard->IsShiftHeld()) | |
2853 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
2854 else | |
2855 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
2856 } | |
2857 | |
140 | 2858 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
1052 | 2859 |
2860 | |
2861 // WUT? double event trigger | |
2862 /*for ( uint i = 0; i < 30; ++i ) | |
998 | 2863 { |
2864 if ( pKeyActionMap->pToggleTypes[i] ) | |
2865 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
2866 else | |
2867 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1052 | 2868 if ( v14 ) |
998 | 2869 { |
1052 | 2870 if (pCurrentScreen == SCREEN_GAME) |
998 | 2871 { |
2872 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
2873 continue; | |
2874 } | |
2875 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
2876 { | |
2877 v15 = pMessageQueue_50CBD0->uNumMessages; | |
2878 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2879 { | |
2880 v15 = 0; | |
2881 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
2882 { | |
2883 v15 = 1; | |
2884 pMessageQueue_50CBD0->uNumMessages = 0; | |
2885 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
2886 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2887 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2888 ++pMessageQueue_50CBD0->uNumMessages; | |
2889 continue; | |
2890 } | |
2891 pMessageQueue_50CBD0->uNumMessages = 0; | |
2892 } | |
2893 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
2894 } | |
2895 } | |
1052 | 2896 }*/ |
0 | 2897 if ( !pEventTimer->bPaused ) |
2898 { | |
998 | 2899 for ( uint i = 0; i < 30; ++i ) |
0 | 2900 { |
998 | 2901 inputAction = (InputAction)i; |
2902 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
2903 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 2904 else |
998 | 2905 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 2906 if ( v4 ) |
2907 { | |
2908 switch ( inputAction ) | |
2909 { | |
2910 case INPUT_MoveForward: | |
271 | 2911 if (pCurrentScreen != SCREEN_GAME) |
0 | 2912 break; |
2913 if (!pParty->bTurnBasedModeOn) | |
2914 { | |
140 | 2915 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 2916 partyAction = PARTY_RunForward; |
2917 else | |
2918 partyAction = PARTY_WalkForward; | |
998 | 2919 pPartyActionQueue->Add(partyAction); |
163 | 2920 break; |
2921 } | |
1340 | 2922 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
163 | 2923 { |
2924 pTurnEngine->uActionPointsLeft -= 26; | |
2925 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
2926 partyAction = PARTY_RunForward; | |
2927 else | |
2928 partyAction = PARTY_WalkForward; | |
998 | 2929 pPartyActionQueue->Add(partyAction); |
163 | 2930 break; |
0 | 2931 } |
2932 break; | |
2933 case INPUT_MoveBackwards: | |
271 | 2934 if (pCurrentScreen != SCREEN_GAME) |
0 | 2935 break; |
2936 if (!pParty->bTurnBasedModeOn) | |
17 | 2937 { |
2938 if ( pParty->uFlags2 & 2 ) | |
2939 partyAction = PARTY_RunBackward; | |
2940 else | |
2941 partyAction = PARTY_WalkBackward; | |
998 | 2942 pPartyActionQueue->Add(partyAction); |
163 | 2943 break; |
17 | 2944 } |
1340 | 2945 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
0 | 2946 { |
2947 pTurnEngine->uActionPointsLeft -= 26; | |
2948 if ( pParty->uFlags2 & 2 ) | |
2949 partyAction = PARTY_RunBackward; | |
2950 else | |
2951 partyAction = PARTY_WalkBackward; | |
998 | 2952 pPartyActionQueue->Add(partyAction); |
163 | 2953 break; |
0 | 2954 } |
2955 break; | |
2956 case INPUT_StrafeLeft: | |
271 | 2957 if (pCurrentScreen != SCREEN_GAME) |
0 | 2958 break; |
2959 if (!pParty->bTurnBasedModeOn) | |
17 | 2960 { |
2961 partyAction = PARTY_StrafeLeft; | |
998 | 2962 pPartyActionQueue->Add(partyAction); |
163 | 2963 break; |
17 | 2964 } |
1340 | 2965 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 2966 break; |
2967 pTurnEngine->uActionPointsLeft -= 26; | |
2968 partyAction = PARTY_StrafeLeft; | |
998 | 2969 pPartyActionQueue->Add(partyAction); |
2970 break; | |
0 | 2971 case INPUT_StrafeRight: |
271 | 2972 if (pCurrentScreen != SCREEN_GAME) |
0 | 2973 break; |
2974 if (!pParty->bTurnBasedModeOn) | |
17 | 2975 { |
2976 partyAction = PARTY_StrafeRight; | |
998 | 2977 pPartyActionQueue->Add(partyAction); |
163 | 2978 break; |
17 | 2979 } |
1340 | 2980 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 2981 break; |
2982 pTurnEngine->uActionPointsLeft -= 26; | |
2983 partyAction = PARTY_StrafeRight; | |
998 | 2984 pPartyActionQueue->Add(partyAction); |
163 | 2985 break; |
0 | 2986 case INPUT_TurnLeft: |
271 | 2987 if (pCurrentScreen != SCREEN_GAME) |
0 | 2988 break; |
2989 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
2990 { | |
2991 if (pParty->bTurnBasedModeOn) | |
2992 { | |
1340 | 2993 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 2994 break; |
2995 pTurnEngine->uActionPointsLeft -= 26; | |
2996 } | |
998 | 2997 partyAction = PARTY_StrafeLeft; |
0 | 2998 } |
2999 else | |
3000 { | |
3001 if ( pParty->uFlags2 & 2 ) | |
998 | 3002 partyAction = PARTY_FastTurnLeft; |
0 | 3003 else |
998 | 3004 partyAction = PARTY_TurnLeft; |
0 | 3005 } |
998 | 3006 pPartyActionQueue->Add(partyAction); |
0 | 3007 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
3008 { | |
271 | 3009 pWeather->OnPlayerTurn(10); |
0 | 3010 } |
3011 break; | |
3012 case INPUT_TurnRight: | |
271 | 3013 if (pCurrentScreen != SCREEN_GAME) |
0 | 3014 break; |
3015 if ( GetAsyncKeyState(17) ) // strafing | |
3016 { | |
3017 if (pParty->bTurnBasedModeOn) | |
3018 { | |
1340 | 3019 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 3020 break; |
3021 pTurnEngine->uActionPointsLeft -= 26; | |
3022 } | |
998 | 3023 partyAction = PARTY_StrafeRight; |
0 | 3024 } |
3025 else | |
3026 { | |
3027 if ( pParty->uFlags2 & 2 ) | |
998 | 3028 partyAction = PARTY_FastTurnRight; |
0 | 3029 else |
998 | 3030 partyAction = PARTY_TurnRight; |
0 | 3031 } |
998 | 3032 pPartyActionQueue->Add(partyAction); |
0 | 3033 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
3034 { | |
271 | 3035 pWeather->OnPlayerTurn(-10); |
0 | 3036 } |
3037 break; | |
3038 case INPUT_Jump: | |
271 | 3039 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 3040 break; |
3041 partyAction = (PartyAction)12; | |
998 | 3042 pPartyActionQueue->Add(partyAction); |
163 | 3043 break; |
0 | 3044 case INPUT_Yell: |
187 | 3045 if (!pCurrentScreen && uActiveCharacter) |
0 | 3046 { |
3047 pParty->Yell(); | |
187 | 3048 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 3049 } |
187 | 3050 break; |
0 | 3051 case INPUT_Pass: |
3052 if ( pCurrentScreen ) | |
3053 break; | |
1340 | 3054 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3) |
17 | 3055 { |
1332 | 3056 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 3057 break; |
3058 } | |
0 | 3059 if ( uActiveCharacter ) |
3060 { | |
998 | 3061 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 3062 { |
998 | 3063 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 3064 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3065 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
1202 | 3066 pCastSpellInfo.data()->_427D48(uActiveCharacter); |
0 | 3067 pTurnEngine->_40471C(); |
3068 } | |
3069 } | |
3070 break; | |
998 | 3071 case INPUT_Combat://if press ENTER |
271 | 3072 if (pCurrentScreen == SCREEN_GAME) |
0 | 3073 { |
3074 if (pParty->bTurnBasedModeOn) | |
3075 { | |
1340 | 3076 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 3077 { |
3078 pParty->bTurnBasedModeOn = 0; | |
3079 pTurnEngine->End(true); | |
3080 } | |
3081 } | |
3082 else | |
3083 { | |
3084 pTurnEngine->Start(); | |
3085 pParty->bTurnBasedModeOn = true; | |
3086 } | |
3087 } | |
3088 break; | |
3089 case INPUT_CastReady: | |
271 | 3090 if (pCurrentScreen != SCREEN_GAME) |
0 | 3091 break; |
1340 | 3092 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3) |
17 | 3093 { |
1332 | 3094 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 3095 break; |
3096 } | |
0 | 3097 if ( !uActiveCharacter ) |
3098 break; | |
998 | 3099 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 3100 if ( !v8 |
3101 || bUnderwater | |
998 | 3102 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
3103 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
3104 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
3105 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
3106 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
3107 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 3108 { |
998 | 3109 pPartyActionQueue = pPartyActionQueue; |
437 | 3110 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
3111 break; | |
0 | 3112 } |
3113 else | |
3114 { | |
1012 | 3115 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); |
0 | 3116 } |
3117 break; | |
3118 case INPUT_Attack: | |
271 | 3119 if (pCurrentScreen != SCREEN_GAME) |
0 | 3120 break; |
1340 | 3121 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3) |
998 | 3122 { |
1332 | 3123 pTurnEngine->field_18 |= TE_FLAG_8; |
998 | 3124 break; |
3125 } | |
3126 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 3127 break; |
3128 case INPUT_EventTrigger: | |
271 | 3129 if (pCurrentScreen == SCREEN_GAME) |
0 | 3130 { |
437 | 3131 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 3132 break; |
0 | 3133 } |
151 | 3134 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 3135 { |
3136 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3137 { | |
437 | 3138 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 3139 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
3140 { | |
3141 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 3142 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 3143 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3144 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3145 ++pMessageQueue_50CBD0->uNumMessages; | |
3146 break; | |
3147 } | |
437 | 3148 break; |
0 | 3149 } |
437 | 3150 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 3151 } |
3152 break; | |
3153 case INPUT_CharCycle: | |
1012 | 3154 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 3155 break; |
1012 | 3156 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40 |
437 | 3157 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
3158 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 3159 ++dword_50C9E8;*/ |
3160 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); | |
163 | 3161 break; |
0 | 3162 case INPUT_LookUp: |
3163 if ( pEventTimer->bPaused ) | |
3164 break; | |
3165 partyAction = (PartyAction)7; | |
998 | 3166 pPartyActionQueue->Add(partyAction); |
163 | 3167 break; |
0 | 3168 case INPUT_CenterView: |
3169 if ( pEventTimer->bPaused ) | |
3170 break; | |
3171 partyAction = (PartyAction)9; | |
998 | 3172 pPartyActionQueue->Add(partyAction); |
163 | 3173 break; |
0 | 3174 case INPUT_LookDown: |
3175 if ( pEventTimer->bPaused ) | |
3176 break; | |
3177 partyAction = (PartyAction)8; | |
998 | 3178 pPartyActionQueue->Add(partyAction); |
163 | 3179 break; |
0 | 3180 case INPUT_FlyUp: |
998 | 3181 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 3182 break; |
3183 partyAction = (PartyAction)13; | |
998 | 3184 pPartyActionQueue->Add(partyAction); |
163 | 3185 break; |
0 | 3186 case INPUT_Land: |
998 | 3187 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 3188 break; |
3189 partyAction = (PartyAction)15; | |
998 | 3190 pPartyActionQueue->Add(partyAction); |
163 | 3191 break; |
0 | 3192 case INPUT_FlyDown: |
3193 if ( !pCurrentScreen | |
3194 && !pEventTimer->bPaused ) | |
3195 { | |
3196 partyAction = (PartyAction)14; | |
998 | 3197 pPartyActionQueue->Add(partyAction); |
0 | 3198 } |
3199 break; | |
3200 case INPUT_ZoomIn: | |
1012 | 3201 /*if ( dword_50C9E8 >= 40 ) |
0 | 3202 break; |
3203 dword_50C9EC[3 * dword_50C9E8] = 367; | |
437 | 3204 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
3205 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 3206 ++dword_50C9E8;*/ |
3207 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); | |
163 | 3208 break; |
0 | 3209 case INPUT_ZoomOut: |
1012 | 3210 /*if ( dword_50C9E8 < 40 ) |
0 | 3211 { |
3212 dword_50C9EC[3 * dword_50C9E8] = 368; | |
437 | 3213 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
3214 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 3215 ++dword_50C9E8; |
1012 | 3216 }*/ |
3217 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); | |
0 | 3218 break; |
3219 case INPUT_AlwaysRun: | |
3220 bAlwaysRun = bAlwaysRun == 0; | |
3221 break; | |
17 | 3222 default: |
3223 break; | |
0 | 3224 } |
3225 } | |
3226 } | |
3227 } | |
3228 } |