Mercurial > mm7
annotate mm7_6.cpp @ 1016:c45d51b3f4f4
Included header files cleanup
author | Grumpy7 |
---|---|
date | Sun, 19 May 2013 17:55:19 +0200 |
parents | 9318dd3f3711 |
children | 9ac94d00012e |
rev | line source |
---|---|
0 | 1 #include "MM7.h" |
2 | |
1016 | 3 |
4 | |
5 #include "Sprites.h" | |
6 #include "BSPModel.h" | |
7 #include "OutdoorCamera.h" | |
8 #include "Mouse.h" | |
9 #include "Keyboard.h" | |
10 #include "stru6.h" | |
11 | |
12 #include "Vis.h" | |
0 | 13 #include "Game.h" |
14 #include "GUIWindow.h" | |
15 #include "GUIFont.h" | |
16 #include "Party.h" | |
17 #include "AudioPlayer.h" | |
18 #include "Outdoor.h" | |
19 #include "Overlays.h" | |
20 #include "LOD.h" | |
21 #include "Actor.h" | |
22 #include "Events.h" | |
23 #include "Viewport.h" | |
24 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
25 #include "SpriteObject.h" |
0 | 26 #include "ObjectList.h" |
27 #include "stru123.h" | |
28 #include "Time.h" | |
29 #include "IconFrameTable.h" | |
30 #include "Awards.h" | |
31 #include "TurnEngine.h" | |
924 | 32 #include "CastSpellInfo.h" |
0 | 33 #include "stru298.h" |
189 | 34 #include "texts.h" |
0 | 35 |
36 #include "mm7_data.h" | |
37 | |
38 | |
39 | |
40 //----- (00424EE0) -------------------------------------------------------- | |
41 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
42 { | |
43 unsigned int v1; // edx@1 | |
44 double v2; // st7@1 | |
45 signed int v3; // edi@1 | |
46 char *v4; // esi@4 | |
47 char *v5; // ecx@4 | |
48 unsigned int v6; // eax@4 | |
49 char *v7; // edx@4 | |
50 double v8; // st6@10 | |
51 double v9; // st5@10 | |
52 double v10; // st6@11 | |
53 unsigned __int8 v11; // c2@15 | |
54 unsigned __int8 v12; // c3@15 | |
55 void *v13; // edi@22 | |
56 char *v14; // eax@22 | |
57 double v15; // st6@22 | |
58 char *v16; // ecx@22 | |
59 signed int result; // eax@24 | |
60 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
61 bool v19; // [sp+Ch] [bp-28h]@6 | |
62 char *v20; // [sp+10h] [bp-24h]@4 | |
63 char *v21; // [sp+14h] [bp-20h]@4 | |
64 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
65 char *v23; // [sp+1Ch] [bp-18h]@4 | |
66 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
67 char *v25; // [sp+24h] [bp-10h]@4 | |
68 char *v26; // [sp+28h] [bp-Ch]@4 | |
69 char *v27; // [sp+2Ch] [bp-8h]@4 | |
70 char *v28; // [sp+30h] [bp-4h]@4 | |
71 | |
72 v1 = uVertexID; | |
73 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
74 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
75 v3 = 0; | |
76 v22 = 0; | |
77 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
78 v3 = 1; | |
79 if ( (signed int)(uVertexID + 1) <= 1 ) | |
80 return 0; | |
81 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
82 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
83 v6 = v1; | |
84 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 85 v26 = (char *)&array_507D30[0]._rhw; |
0 | 86 v24 = array_507D30; |
87 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
88 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
89 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
90 v27 = (char *)&array_507D30[0].v; | |
91 v28 = (char *)&array_507D30[0].u; | |
92 v7 = (char *)&array_50AC10[0].v; | |
93 v18 = v6; | |
94 do | |
95 { | |
96 v19 = v2 >= *((float *)v7 + 5); | |
97 if ( v3 != v19 ) | |
98 { | |
99 if ( v19 ) | |
100 { | |
101 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
102 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
103 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
104 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
105 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
106 } | |
107 else | |
108 { | |
109 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
110 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
111 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
112 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
113 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
114 } | |
115 *(float *)v27 = v9; | |
116 *(float *)v25 = v2; | |
117 *(float *)v26 = 1.0 / v2; | |
118 if ( v3 ) | |
119 { | |
120 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
121 { | |
122 v11 = 0; | |
123 v12 = *(float *)v4 == *((float *)v7 - 5); | |
124 goto LABEL_19; | |
125 } | |
126 } | |
127 else | |
128 { | |
129 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
130 { | |
131 v11 = 0; | |
132 v12 = *(float *)v4 == *((float *)v7 + 7); | |
133 LABEL_19: | |
134 if ( v12 | v11 ) | |
135 goto LABEL_21; | |
136 goto LABEL_20; | |
137 } | |
138 } | |
139 LABEL_20: | |
140 v26 += 48; | |
141 ++v24; | |
142 v25 += 48; | |
143 v27 += 48; | |
144 v28 += 48; | |
145 v5 += 48; | |
146 v4 += 48; | |
147 ++v22; | |
148 v23 += 48; | |
149 v21 = v5; | |
150 v20 = v4; | |
151 } | |
152 LABEL_21: | |
153 if ( v19 ) | |
154 { | |
155 v13 = v24; | |
156 v14 = v26; | |
157 v21 += 48; | |
158 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
159 v20 += 48; | |
160 ++v22; | |
161 v28 += 48; | |
162 v27 += 48; | |
163 v25 += 48; | |
164 ++v24; | |
165 v26 += 48; | |
166 memcpy(v13, v7 + 8, 0x30u); | |
167 v16 = v23; | |
168 v23 += 48; | |
169 v4 = v20; | |
170 *(float *)v14 = v15; | |
171 *(int *)v16 = *((int *)v7 + 13); | |
172 v5 = v21; | |
173 } | |
174 v3 = v19; | |
175 v7 += 48; | |
176 --v18; | |
177 } | |
178 while ( v18 ); | |
179 result = v22; | |
180 if ( v22 < 3 ) | |
181 return 0; | |
182 return result; | |
183 } | |
184 | |
185 //----- (004250FE) -------------------------------------------------------- | |
186 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
187 { | |
188 unsigned int v1; // edx@1 | |
189 char *v2; // edi@5 | |
190 char *v3; // esi@5 | |
191 char *v4; // ecx@5 | |
192 int v5; // ebx@6 | |
193 double v6; // st6@11 | |
194 double v7; // st5@11 | |
195 double v8; // st6@12 | |
196 unsigned __int8 v9; // c2@16 | |
197 unsigned __int8 v10; // c3@16 | |
198 void *v11; // edi@23 | |
199 double v12; // st6@23 | |
200 char *v13; // ecx@23 | |
201 char v14; // zf@24 | |
202 signed int result; // eax@25 | |
203 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
204 bool v17; // [sp+Ch] [bp-24h]@2 | |
205 bool v18; // [sp+10h] [bp-20h]@7 | |
206 char *v19; // [sp+14h] [bp-1Ch]@5 | |
207 char *v20; // [sp+18h] [bp-18h]@5 | |
208 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
209 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
210 char *v23; // [sp+24h] [bp-Ch]@5 | |
211 char *v24; // [sp+28h] [bp-8h]@5 | |
212 char *v25; // [sp+2Ch] [bp-4h]@5 | |
213 | |
214 v1 = uVertexID; | |
215 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
216 v21 = 0; | |
217 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
218 if ( (signed int)(uVertexID + 1) <= 1 ) | |
219 return 0; | |
220 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
221 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 222 v24 = (char *)&array_507D30[0]._rhw; |
0 | 223 v22 = array_507D30; |
224 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
225 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
226 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
227 v25 = (char *)&array_507D30[0].flt_2C; | |
228 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
229 v16 = v1; | |
230 do | |
231 { | |
232 v5 = (int)(v4 + 48); | |
233 v18 = *((float *)v4 + 12) >= 8.0; | |
234 if ( v17 != v18 ) | |
235 { | |
236 if ( v18 ) | |
237 { | |
238 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
239 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
240 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
241 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
242 } | |
243 else | |
244 { | |
245 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
246 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
247 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
248 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
249 } | |
250 *(float *)v25 = v7; | |
251 *(float *)v23 = 8.0; | |
252 *(int *)v24 = 0x3E000000u; | |
253 if ( v17 ) | |
254 { | |
255 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
256 { | |
257 v9 = 0; | |
258 v10 = *(float *)v2 == *((float *)v4 + 2); | |
259 goto LABEL_20; | |
260 } | |
261 } | |
262 else | |
263 { | |
264 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
265 { | |
266 v9 = 0; | |
267 v10 = *(float *)v2 == *((float *)v4 + 14); | |
268 LABEL_20: | |
269 if ( v10 | v9 ) | |
270 goto LABEL_22; | |
271 goto LABEL_21; | |
272 } | |
273 } | |
274 LABEL_21: | |
275 ++v22; | |
276 v23 += 48; | |
277 v25 += 48; | |
278 v3 += 48; | |
279 v2 += 48; | |
280 ++v21; | |
281 v24 += 48; | |
282 v20 = v3; | |
283 v19 = v2; | |
284 } | |
285 LABEL_22: | |
286 if ( v18 ) | |
287 { | |
288 v11 = v22; | |
289 v20 += 48; | |
290 v19 += 48; | |
291 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
292 ++v21; | |
293 v25 += 48; | |
294 v23 += 48; | |
295 ++v22; | |
296 memcpy(v11, v4 + 36, 0x30u); | |
297 v13 = v24; | |
298 v24 += 48; | |
299 v3 = v20; | |
300 v2 = v19; | |
301 *(float *)v13 = v12; | |
302 } | |
303 v14 = v16-- == 1; | |
304 v17 = v18; | |
305 v4 = (char *)v5; | |
306 } | |
307 while ( !v14 ); | |
308 result = v21; | |
309 if ( v21 < 3 ) | |
310 return 0; | |
311 return result; | |
312 } | |
313 | |
314 //----- (004252E8) -------------------------------------------------------- | |
315 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
316 { | |
317 unsigned int v1; // edx@1 | |
318 double v2; // st7@1 | |
319 char *v3; // edi@5 | |
320 char *v4; // esi@5 | |
321 char *v5; // ecx@5 | |
322 int v6; // ebx@6 | |
323 double v7; // st6@11 | |
324 double v8; // st5@11 | |
325 double v9; // st6@12 | |
326 unsigned __int8 v10; // c2@16 | |
327 unsigned __int8 v11; // c3@16 | |
328 void *v12; // edi@23 | |
329 double v13; // st6@23 | |
330 char *v14; // ecx@23 | |
331 char v15; // zf@24 | |
332 signed int result; // eax@25 | |
333 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
334 bool v18; // [sp+Ch] [bp-24h]@2 | |
335 bool v19; // [sp+10h] [bp-20h]@7 | |
336 char *v20; // [sp+14h] [bp-1Ch]@5 | |
337 char *v21; // [sp+18h] [bp-18h]@5 | |
338 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
339 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
340 char *v24; // [sp+24h] [bp-Ch]@5 | |
341 char *v25; // [sp+28h] [bp-8h]@5 | |
342 char *v26; // [sp+2Ch] [bp-4h]@5 | |
343 | |
344 v1 = uVertexID; | |
345 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
346 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
347 v22 = 0; | |
348 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
349 if ( (signed int)(uVertexID + 1) <= 1 ) | |
350 return 0; | |
351 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
352 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 353 v25 = (char *)&array_507D30[0]._rhw; |
0 | 354 v23 = array_507D30; |
355 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
356 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
357 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
358 v26 = (char *)&array_507D30[0].flt_2C; | |
359 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
360 v17 = v1; | |
361 do | |
362 { | |
363 v6 = (int)(v5 + 48); | |
364 v19 = v2 >= *((float *)v5 + 12); | |
365 if ( v18 != v19 ) | |
366 { | |
367 if ( v19 ) | |
368 { | |
369 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
370 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
371 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
372 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
373 } | |
374 else | |
375 { | |
376 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
377 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
378 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
379 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
380 } | |
381 *(float *)v26 = v8; | |
382 *(float *)v24 = v2; | |
383 *(float *)v25 = 1.0 / v2; | |
384 if ( v18 ) | |
385 { | |
386 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
387 { | |
388 v10 = 0; | |
389 v11 = *(float *)v3 == *((float *)v5 + 2); | |
390 goto LABEL_20; | |
391 } | |
392 } | |
393 else | |
394 { | |
395 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
396 { | |
397 v10 = 0; | |
398 v11 = *(float *)v3 == *((float *)v5 + 14); | |
399 LABEL_20: | |
400 if ( v11 | v10 ) | |
401 goto LABEL_22; | |
402 goto LABEL_21; | |
403 } | |
404 } | |
405 LABEL_21: | |
406 ++v23; | |
407 v24 += 48; | |
408 v26 += 48; | |
409 v4 += 48; | |
410 v3 += 48; | |
411 ++v22; | |
412 v25 += 48; | |
413 v21 = v4; | |
414 v20 = v3; | |
415 } | |
416 LABEL_22: | |
417 if ( v19 ) | |
418 { | |
419 v12 = v23; | |
420 v21 += 48; | |
421 v20 += 48; | |
422 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
423 ++v22; | |
424 v26 += 48; | |
425 v24 += 48; | |
426 ++v23; | |
427 memcpy(v12, v5 + 36, 0x30u); | |
428 v14 = v25; | |
429 v25 += 48; | |
430 v4 = v21; | |
431 v3 = v20; | |
432 *(float *)v14 = v13; | |
433 } | |
434 v15 = v17-- == 1; | |
435 v18 = v19; | |
436 v5 = (char *)v6; | |
437 } | |
438 while ( !v15 ); | |
439 result = v22; | |
440 if ( v22 < 3 ) | |
441 return 0; | |
442 return result; | |
443 } | |
444 | |
445 //----- (004254D2) -------------------------------------------------------- | |
446 int __fastcall sr_4254D2(signed int a1) | |
447 { | |
448 signed int v1; // ebx@2 | |
449 int v2; // ecx@2 | |
450 int result; // eax@11 | |
451 double v4; // ST74_8@12 | |
452 bool v5; // edi@12 | |
453 char *v6; // esi@13 | |
454 char *v7; // ebx@13 | |
455 double v8; // st7@15 | |
456 double v9; // st7@16 | |
457 double v10; // st6@16 | |
458 double v11; // st7@17 | |
459 float v12; // eax@18 | |
460 double v13; // ST4C_8@19 | |
461 double v14; // ST10_8@19 | |
462 double v15; // ST28_8@20 | |
463 double v16; // ST34_8@20 | |
464 char v17; // zf@20 | |
465 double v18; // ST18_8@21 | |
466 double v19; // ST3C_8@21 | |
467 double v20; // ST44_8@22 | |
468 double v21; // ST54_8@22 | |
469 void *v22; // edi@26 | |
470 double v23; // ST54_8@29 | |
471 bool v24; // esi@29 | |
472 char *v25; // edi@30 | |
473 char *v26; // ebx@30 | |
474 bool v27; // ecx@32 | |
475 double v28; // st7@33 | |
476 double v29; // st7@34 | |
477 double v30; // st6@34 | |
478 double v31; // st7@35 | |
479 double v32; // ST44_8@37 | |
480 double v33; // ST3C_8@37 | |
481 double v34; // ST18_8@38 | |
482 double v35; // ST34_8@38 | |
483 char v36; // zf@38 | |
484 double v37; // ST28_8@39 | |
485 double v38; // ST10_8@39 | |
486 double v39; // ST20_8@40 | |
487 double v40; // ST5C_8@40 | |
488 void *v41; // edi@44 | |
489 double v42; // ST5C_8@47 | |
490 bool v43; // edi@47 | |
491 char *v44; // esi@48 | |
492 char *v45; // ebx@48 | |
493 bool v46; // ecx@49 | |
494 double v47; // st6@50 | |
495 double v48; // st6@51 | |
496 double v49; // st5@51 | |
497 double v50; // st6@52 | |
498 double v51; // ST20_8@54 | |
499 double v52; // ST54_8@54 | |
500 double v53; // ST44_8@55 | |
501 double v54; // ST3C_8@55 | |
502 char v55; // zf@55 | |
503 double v56; // ST18_8@56 | |
504 double v57; // ST34_8@56 | |
505 double v58; // ST28_8@57 | |
506 double v59; // ST10_8@57 | |
507 void *v60; // edi@61 | |
508 double v61; // ST5C_8@64 | |
509 bool v62; // edi@64 | |
510 char *v63; // esi@65 | |
511 char *v64; // ebx@65 | |
512 bool v65; // ecx@66 | |
513 double v66; // st6@67 | |
514 double v67; // st6@68 | |
515 double v68; // st5@68 | |
516 double v69; // st6@69 | |
517 double v70; // ST20_8@71 | |
518 double v71; // ST54_8@71 | |
519 double v72; // ST44_8@72 | |
520 double v73; // ST3C_8@72 | |
521 char v74; // zf@72 | |
522 double v75; // ST18_8@73 | |
523 double v76; // ST34_8@73 | |
524 double v77; // ST28_8@74 | |
525 double v78; // ST10_8@74 | |
526 void *v79; // edi@78 | |
527 int v80; // ebx@81 | |
528 char *v81; // ecx@82 | |
529 signed int v82; // esi@82 | |
530 float v83; // ST78_4@83 | |
531 double v84; // ST5C_8@83 | |
532 float v85; // eax@84 | |
533 double v86; // ST20_8@85 | |
534 double v87; // ST54_8@88 | |
535 float v88; // eax@89 | |
536 double v89; // ST44_8@90 | |
537 unsigned __int8 v90; // sf@94 | |
538 unsigned __int8 v91; // of@94 | |
539 int v92; // edx@97 | |
540 int v93; // esi@97 | |
541 int v94; // edi@97 | |
542 int v95; // eax@97 | |
543 int v96; // eax@104 | |
544 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
545 double v98; // [sp+54h] [bp-84h]@49 | |
546 double v99; // [sp+54h] [bp-84h]@66 | |
547 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
548 float v101; // [sp+60h] [bp-78h]@1 | |
549 float v102; // [sp+64h] [bp-74h]@1 | |
550 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
551 float v104; // [sp+A8h] [bp-30h]@1 | |
552 signed int v105; // [sp+A8h] [bp-30h]@96 | |
553 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
554 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
555 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
556 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
557 signed int v110; // [sp+B0h] [bp-28h]@12 | |
558 char *v111; // [sp+B8h] [bp-20h]@30 | |
559 signed int v112; // [sp+B8h] [bp-20h]@48 | |
560 signed int v113; // [sp+B8h] [bp-20h]@65 | |
561 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
562 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
563 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
564 signed int v117; // [sp+C0h] [bp-18h]@1 | |
565 char *v118; // [sp+C0h] [bp-18h]@30 | |
566 char *v119; // [sp+C0h] [bp-18h]@48 | |
567 char *v120; // [sp+C0h] [bp-18h]@65 | |
568 char *v121; // [sp+C4h] [bp-14h]@13 | |
569 char *v122; // [sp+C4h] [bp-14h]@30 | |
570 signed int v123; // [sp+C4h] [bp-14h]@47 | |
571 char *v124; // [sp+C8h] [bp-10h]@30 | |
572 char *v125; // [sp+C8h] [bp-10h]@48 | |
573 char *v126; // [sp+C8h] [bp-10h]@65 | |
574 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
575 char *v128; // [sp+CCh] [bp-Ch]@13 | |
576 char *v129; // [sp+CCh] [bp-Ch]@30 | |
577 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
578 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
579 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
580 char *v133; // [sp+D0h] [bp-8h]@30 | |
581 char *v134; // [sp+D0h] [bp-8h]@48 | |
582 char *v135; // [sp+D0h] [bp-8h]@65 | |
583 signed int v136; // [sp+D4h] [bp-4h]@1 | |
584 char *v137; // [sp+D4h] [bp-4h]@13 | |
585 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
586 char *v139; // [sp+D4h] [bp-4h]@48 | |
587 char *v140; // [sp+D4h] [bp-4h]@65 | |
588 | |
693 | 589 v101 = (double)(signed int)pViewport->uViewportTL_X; |
590 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 591 v117 = a1; |
592 v136 = 1; | |
693 | 593 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
594 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 595 if ( a1 <= 0 ) |
596 return v117; | |
597 v127 = a1; | |
598 v1 = a1; | |
599 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
600 v2 = 0; | |
601 do | |
602 { | |
603 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
604 v136 = 0; | |
605 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
606 v136 = 0; | |
607 ++v2; | |
608 --v127; | |
609 } | |
610 while ( v127 ); | |
611 if ( v136 ) | |
612 return v117; | |
613 v110 = 0; | |
614 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
615 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 616 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 617 if ( v117 < 1 ) |
618 goto LABEL_112; | |
619 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
620 v132 = array_50A2B0; | |
621 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
622 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
623 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 624 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 625 v7 = (char *)&array_50AC10[0].flt_2C; |
626 do | |
627 { | |
628 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 629 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 630 if ( !(v5 ^ v106) ) |
631 goto LABEL_25; | |
632 v8 = v101; | |
693 | 633 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 634 { |
635 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
636 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
637 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
638 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
639 } | |
640 else | |
641 { | |
642 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
643 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
644 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
645 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
646 } | |
647 *(float *)v121 = v10; | |
648 *(int *)v137 = LODWORD(v101); | |
649 LODWORD(v12) = *(int *)v6; | |
650 if ( v5 ) | |
651 { | |
652 v13 = v12 + 6.7553994e15; | |
653 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
654 if ( LODWORD(v13) == LODWORD(v14) ) | |
655 { | |
656 v15 = *(float *)v137 + 6.7553994e15; | |
657 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
658 v17 = LODWORD(v15) == LODWORD(v16); | |
659 goto LABEL_23; | |
660 } | |
661 } | |
662 else | |
663 { | |
664 v18 = v12 + 6.7553994e15; | |
665 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
666 if ( LODWORD(v18) == LODWORD(v19) ) | |
667 { | |
668 v20 = *(float *)v137 + 6.7553994e15; | |
669 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
670 v17 = LODWORD(v20) == LODWORD(v21); | |
671 LABEL_23: | |
672 if ( v17 ) | |
673 goto LABEL_25; | |
674 goto LABEL_24; | |
675 } | |
676 } | |
677 LABEL_24: | |
678 v121 += 48; | |
679 v114 += 48; | |
680 v6 += 48; | |
681 ++v110; | |
682 ++v132; | |
683 v128 = v6; | |
684 v137 += 48; | |
685 LABEL_25: | |
686 if ( v106 ) | |
687 { | |
688 v22 = v132; | |
689 v128 += 48; | |
690 ++v110; | |
691 v114 += 48; | |
692 v121 += 48; | |
693 v137 += 48; | |
694 ++v132; | |
695 memcpy(v22, v7 + 4, 0x30u); | |
696 v6 = v128; | |
697 } | |
698 v5 = v106; | |
699 v7 += 48; | |
700 --v117; | |
701 } | |
702 while ( v117 ); | |
703 if ( v110 < 3 | |
704 || (v115 = 0, | |
705 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
706 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 707 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 708 v110 < 1) ) |
709 goto LABEL_112; | |
168 | 710 v25 = (char *)&array_509950[0]._rhw; |
0 | 711 v138 = array_509950; |
712 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
713 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
714 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
715 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
716 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 717 v111 = (char *)&array_509950[0]._rhw; |
0 | 718 v26 = (char *)&array_50A2B0[0].flt_2C; |
719 while ( 2 ) | |
720 { | |
721 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 722 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
723 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 724 if ( v24 != v27 ) |
725 { | |
726 v28 = v100; | |
693 | 727 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 728 { |
729 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
730 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
731 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
732 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
733 } | |
734 else | |
735 { | |
736 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
737 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
738 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
739 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
740 } | |
741 *(float *)v124 = v30; | |
742 *(int *)v133 = LODWORD(v100); | |
743 if ( v24 ) | |
744 { | |
745 v32 = *(float *)v122 + 6.7553994e15; | |
746 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
747 if ( LODWORD(v32) == LODWORD(v33) ) | |
748 { | |
749 v34 = *(float *)v133 + 6.7553994e15; | |
750 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
751 v36 = LODWORD(v34) == LODWORD(v35); | |
752 goto LABEL_41; | |
753 } | |
754 goto LABEL_42; | |
755 } | |
756 v37 = *(float *)v118 + 6.7553994e15; | |
757 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
758 if ( LODWORD(v37) != LODWORD(v38) ) | |
759 goto LABEL_42; | |
760 v39 = *(float *)v129 + 6.7553994e15; | |
761 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
762 v36 = LODWORD(v39) == LODWORD(v40); | |
763 LABEL_41: | |
764 if ( !v36 ) | |
765 { | |
766 LABEL_42: | |
767 v129 += 48; | |
768 v118 += 48; | |
769 v133 += 48; | |
770 v122 += 48; | |
771 v124 += 48; | |
772 v111 += 48; | |
773 ++v115; | |
774 ++v138; | |
775 } | |
776 } | |
777 if ( v27 ) | |
778 { | |
779 v41 = v138; | |
780 ++v115; | |
781 v111 += 48; | |
782 v124 += 48; | |
783 v122 += 48; | |
784 v133 += 48; | |
785 v118 += 48; | |
786 v129 += 48; | |
787 ++v138; | |
788 memcpy(v41, v26 + 4, 0x30u); | |
789 } | |
790 v24 = v107; | |
791 v26 += 48; | |
792 --v110; | |
793 if ( v110 ) | |
794 { | |
795 v25 = v111; | |
796 continue; | |
797 } | |
798 break; | |
799 } | |
800 if ( v115 < 3 | |
801 || (v123 = 0, | |
802 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
803 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 804 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 805 v115 < 1) ) |
806 goto LABEL_112; | |
807 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
808 v130 = array_508FF0; | |
809 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
810 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
811 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 812 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 813 v45 = (char *)&array_509950[0].flt_2C; |
814 v112 = v115; | |
815 while ( 2 ) | |
816 { | |
817 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 818 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
819 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 820 if ( v43 != v46 ) |
821 { | |
822 v47 = v104; | |
693 | 823 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 824 { |
825 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
826 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
827 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
828 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
829 } | |
830 else | |
831 { | |
832 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
833 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
834 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
835 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
836 } | |
837 *(float *)v125 = v49; | |
838 *(float *)v139 = v104; | |
839 if ( v43 ) | |
840 { | |
841 v51 = v104 + 6.7553994e15; | |
842 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
843 if ( LODWORD(v51) == LODWORD(v52) ) | |
844 { | |
845 v53 = *(float *)v44 + 6.7553994e15; | |
846 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
847 v55 = LODWORD(v53) == LODWORD(v54); | |
848 goto LABEL_58; | |
849 } | |
850 goto LABEL_59; | |
851 } | |
852 v56 = v104 + 6.7553994e15; | |
853 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
854 if ( LODWORD(v56) != LODWORD(v57) ) | |
855 goto LABEL_59; | |
856 v58 = *(float *)v44 + 6.7553994e15; | |
857 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
858 v55 = LODWORD(v58) == LODWORD(v59); | |
859 LABEL_58: | |
860 if ( !v55 ) | |
861 { | |
862 LABEL_59: | |
863 v139 += 48; | |
864 v125 += 48; | |
865 v134 += 48; | |
866 v44 += 48; | |
867 ++v123; | |
868 ++v130; | |
869 v119 = v44; | |
870 } | |
871 } | |
872 if ( v46 ) | |
873 { | |
874 v60 = v130; | |
875 v119 += 48; | |
876 ++v123; | |
877 v134 += 48; | |
878 v125 += 48; | |
879 v139 += 48; | |
880 ++v130; | |
881 memcpy(v60, v45 + 4, 0x30u); | |
882 v44 = v119; | |
883 } | |
884 v43 = v108; | |
885 v45 += 48; | |
886 --v112; | |
887 if ( v112 ) | |
888 continue; | |
889 break; | |
890 } | |
891 if ( v123 < 3 | |
892 || (v116 = 0, | |
893 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
894 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 895 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 896 v123 < 1) ) |
897 goto LABEL_112; | |
898 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
899 v131 = array_508690; | |
900 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
901 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
902 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 903 v135 = (char *)&array_508690[0]._rhw; |
0 | 904 v64 = (char *)&array_508FF0[0].flt_2C; |
905 v113 = v123; | |
906 while ( 2 ) | |
907 { | |
908 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 909 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
910 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 911 if ( v62 != v65 ) |
912 { | |
913 v66 = v102; | |
693 | 914 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 915 { |
916 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
917 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
918 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
919 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
920 } | |
921 else | |
922 { | |
923 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
924 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
925 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
926 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
927 } | |
928 *(float *)v126 = v68; | |
929 *(float *)v140 = v102; | |
930 if ( v62 ) | |
931 { | |
932 v70 = v102 + 6.7553994e15; | |
933 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
934 if ( LODWORD(v70) == LODWORD(v71) ) | |
935 { | |
936 v72 = *(float *)v63 + 6.7553994e15; | |
937 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
938 v74 = LODWORD(v72) == LODWORD(v73); | |
939 goto LABEL_75; | |
940 } | |
941 goto LABEL_76; | |
942 } | |
943 v75 = v102 + 6.7553994e15; | |
944 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
945 if ( LODWORD(v75) != LODWORD(v76) ) | |
946 goto LABEL_76; | |
947 v77 = *(float *)v63 + 6.7553994e15; | |
948 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
949 v74 = LODWORD(v77) == LODWORD(v78); | |
950 LABEL_75: | |
951 if ( !v74 ) | |
952 { | |
953 LABEL_76: | |
954 v140 += 48; | |
955 v126 += 48; | |
956 v135 += 48; | |
957 v63 += 48; | |
958 ++v116; | |
959 ++v131; | |
960 v120 = v63; | |
961 } | |
962 } | |
963 if ( v65 ) | |
964 { | |
965 v79 = v131; | |
966 v120 += 48; | |
967 ++v116; | |
968 v135 += 48; | |
969 v126 += 48; | |
970 v140 += 48; | |
971 ++v131; | |
972 memcpy(v79, v64 + 4, 0x30u); | |
973 v63 = v120; | |
974 } | |
975 v62 = v109; | |
976 v64 += 48; | |
977 --v113; | |
978 if ( v113 ) | |
979 continue; | |
980 break; | |
981 } | |
982 if ( v116 < 3 ) | |
983 goto LABEL_112; | |
984 v80 = v116; | |
985 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
986 if ( v116 > 0 ) | |
987 { | |
988 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
989 v82 = v116; | |
990 do | |
991 { | |
992 LODWORD(v83) = *(int *)v81; | |
993 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
994 v84 = v83 + 6.7553994e15; | |
693 | 995 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 996 { |
997 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 998 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 999 goto LABEL_88; |
1000 v85 = v101; | |
1001 } | |
1002 else | |
1003 { | |
1004 v85 = v100; | |
1005 } | |
1006 *(int *)v81 = LODWORD(v85); | |
1007 LABEL_88: | |
1008 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1009 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1010 { |
1011 v88 = v102; | |
1012 LABEL_92: | |
1013 *((int *)v81 + 1) = LODWORD(v88); | |
1014 goto LABEL_93; | |
1015 } | |
1016 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1017 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1018 { |
1019 v88 = v104; | |
1020 goto LABEL_92; | |
1021 } | |
1022 LABEL_93: | |
1023 v81 += 48; | |
1024 --v82; | |
1025 } | |
1026 while ( v82 ); | |
1027 } | |
1028 v91 = __OFSUB__(v116, 3); | |
1029 v90 = v116 - 3 < 0; | |
1030 if ( v116 > 3 ) | |
1031 { | |
1032 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1033 if ( v116 > 0 ) | |
1034 { | |
1035 v105 = 1; | |
1036 do | |
1037 { | |
1038 v92 = v105; | |
1039 v93 = v105 - 1; | |
1040 v94 = v105 + 1; | |
1041 v95 = v105 + 1; | |
1042 if ( v105 - 1 >= v80 ) | |
1043 v93 -= v80; | |
1044 if ( v105 >= v80 ) | |
1045 v92 = v105 - v80; | |
1046 if ( v94 >= v80 ) | |
1047 v95 = v94 - v80; | |
1048 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1049 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1050 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1051 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1052 { | |
1053 ++v105; | |
1054 } | |
1055 else | |
1056 { | |
1057 v96 = v105; | |
1058 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1059 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1060 --v80; | |
1061 } | |
1062 } | |
1063 while ( v105 - 1 < v80 ); | |
1064 } | |
1065 v91 = __OFSUB__(v80, 3); | |
1066 v90 = v80 - 3 < 0; | |
1067 } | |
1068 if ( v90 ^ v91 ) | |
1069 LABEL_112: | |
1070 result = 0; | |
1071 else | |
1072 result = v80; | |
1073 return result; | |
1074 } | |
1075 | |
1076 //----- (0042620A) -------------------------------------------------------- | |
1077 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1078 { | |
1079 __int16 v1; // fps@1 | |
1080 unsigned __int8 v2; // c0@2 | |
1081 char v3; // c2@2 | |
1082 unsigned __int8 v4; // c3@2 | |
1083 bool result; // eax@2 | |
1084 unsigned __int8 v6; // c0@4 | |
1085 char v7; // c2@4 | |
1086 unsigned __int8 v8; // c3@4 | |
1087 unsigned __int8 v9; // c0@6 | |
1088 char v10; // c2@6 | |
1089 unsigned __int8 v11; // c3@6 | |
1090 double v12; // st6@7 | |
1091 float v13; // ST04_4@7 | |
1092 float v14; // ST00_4@7 | |
1093 double v15; // st7@7 | |
1094 double v16; // st6@8 | |
1095 float v17; // ST04_4@8 | |
1096 float v18; // ST00_4@8 | |
1097 double v19; // st7@8 | |
1098 | |
1099 //UNDEF(v1); | |
1100 if ( p->vWorldViewPosition.x < 300.0 | |
1101 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1102 v3 = 0, | |
1103 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1104 //BYTE1(result) = HIBYTE(v1), |
0 | 1105 !(v2 | v4)) ) |
1106 { | |
1107 if ( p->vWorldViewPosition.x < 300.0 ) | |
1108 { | |
1109 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1110 v7 = 0; | |
1111 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1112 //BYTE1(result) = HIBYTE(v1); |
0 | 1113 if ( !(v6 | v8) ) |
1114 { | |
921 | 1115 //LOBYTE(result) = 0; |
1116 return false; | |
0 | 1117 } |
1118 } | |
1119 v9 = 300.0 < p->vWorldViewPosition.x; | |
1120 v10 = 0; | |
1121 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1122 //BYTE1(result) = HIBYTE(v1); |
0 | 1123 if ( v9 | v11 ) |
1124 { | |
1125 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1126 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1127 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1128 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1129 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1130 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1131 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1132 } | |
1133 else | |
1134 { | |
1135 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1136 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1137 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1138 v15 = 300.0 - p->vWorldViewPosition.x; | |
1139 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1140 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1141 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1142 } | |
1143 } | |
921 | 1144 //LOBYTE(result) = 1; |
1145 return true; | |
0 | 1146 } |
1147 | |
1148 //----- (004268E3) -------------------------------------------------------- | |
1149 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1150 { | |
1151 unsigned int v1; // eax@1 | |
1152 unsigned int v2; // edx@1 | |
1153 int v3; // eax@1 | |
1154 int v4; // edx@1 | |
1155 unsigned int v5; // ecx@1 | |
1156 | |
1157 v1 = uColor >> 9; | |
1158 v2 = uColor >> 6; | |
1159 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1160 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1161 v3 = v2 | v1; | |
1162 v4 = (unsigned __int8)uColor >> 3; | |
1163 v5 = uColor >> 16; | |
1164 LOWORD(v5) = v5 & 0x8000; | |
1165 return v5 | v4 | v3; | |
1166 } | |
1167 | |
1168 //----- (0042690D) -------------------------------------------------------- | |
1169 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1170 { | |
1171 unsigned int v1; // eax@1 | |
1172 unsigned int v2; // edx@1 | |
1173 | |
1174 v1 = a1 >> 8; | |
1175 v2 = a1 >> 5; | |
1176 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1177 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1178 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1179 } | |
1180 //----- (00426947) -------------------------------------------------------- | |
1181 void __cdecl sub_426947() | |
1182 { | |
893 | 1183 stru_50C198.field_0 = 0; |
0 | 1184 dword_50C994 = 0; |
1185 dword_50C998_turnbased_icon_1A = 0; | |
1186 } | |
1187 // 50C968: using guessed type int dword_50C968; | |
1188 // 50C994: using guessed type int dword_50C994; | |
1189 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1190 | |
1191 //----- (004269A2) -------------------------------------------------------- | |
958 | 1192 void __fastcall GivePartyExp(unsigned int pEXPNum) |
0 | 1193 { |
958 | 1194 signed int pActivePlayerCount; // ecx@1 |
1195 int pLearningPercent; // eax@13 | |
1196 | |
1197 pActivePlayerCount = 0; | |
1198 for ( uint i = 0; i < 4; ++i ) | |
1199 { | |
1200 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) | |
1201 pActivePlayerCount ++; | |
1202 } | |
1203 if ( pActivePlayerCount ) | |
0 | 1204 { |
958 | 1205 pEXPNum = pEXPNum / pActivePlayerCount; |
1206 for ( uint i = 0; i < 4; ++i ) | |
0 | 1207 { |
958 | 1208 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) |
0 | 1209 { |
958 | 1210 if ( pEXPNum ) |
0 | 1211 { |
958 | 1212 pLearningPercent = pParty->pPlayers[i].GetLearningPercent(); |
1213 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100; | |
1214 pParty->pPlayers[i].uExperience += pEXPNum; | |
1215 if ( pParty->pPlayers[i].uExperience > 4000000000i64 ) | |
0 | 1216 { |
958 | 1217 pParty->pPlayers[i].uExperience = 0; |
0 | 1218 } |
1219 } | |
1220 } | |
1221 } | |
1222 } | |
1223 } | |
1224 | |
1225 //----- (00426A5A) -------------------------------------------------------- | |
1226 void stru319::LootActor(Actor *pActor) | |
1227 { | |
1228 signed int v2; // edi@1 | |
1229 char v3; // zf@1 | |
1230 unsigned int v4; // eax@13 | |
1231 unsigned int v5; // esi@13 | |
1232 int v6; // eax@14 | |
1233 unsigned __int8 v7; // al@30 | |
1234 Party *v8; // esi@34 | |
1235 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1236 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1237 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1238 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1239 int v13; // [sp+30h] [bp-8h]@1 | |
1240 int v14; // [sp+34h] [bp-4h]@1 | |
1241 | |
1242 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1243 Dst.Reset(); | |
1244 v2 = 0; | |
1245 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1246 v13 = 0; | |
1247 v14 = 0; | |
1248 if ( v3 ) | |
1249 { | |
1250 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1251 goto LABEL_9; | |
1252 do | |
1253 { | |
1254 ++v2; | |
1255 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1256 } | |
1257 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1258 } | |
1259 else | |
1260 { | |
1261 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1262 goto LABEL_9; | |
377 | 1263 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1264 pActor->array_000234[3].Reset(); |
1265 } | |
1266 if ( v14 ) | |
1267 { | |
1268 party_finds_gold(v14, 0); | |
1269 viewparams->bRedrawGameUI = 1; | |
1270 } | |
1271 LABEL_9: | |
1272 if ( pActor->uCarriedItemID ) | |
1273 { | |
1274 Dst.Reset(); | |
1275 Dst.uItemID = pActor->uCarriedItemID; | |
1276 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1277 if ( v14 ) | |
721 | 1278 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1279 else |
721 | 1280 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1281 ShowStatusBarString(pTmpBuf2, 2u); |
1282 v4 = Dst.uItemID; | |
1283 v5 = Dst.uItemID; | |
1284 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1285 { | |
1286 v5 = Dst.uItemID; | |
1287 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1288 Dst.uNumCharges = v6; | |
1289 Dst.uMaxCharges = v6; | |
1290 v4 = Dst.uItemID; | |
1291 } | |
1292 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1293 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1294 pItemsTable->SetSpecialBonus(&Dst); |
1295 if ( !pParty->AddItem(&Dst) ) | |
1296 pParty->SetHoldingItem(&Dst); | |
1297 pActor->uCarriedItemID = 0; | |
1298 if ( pActor->array_000234[0].uItemID ) | |
1299 { | |
1300 if ( !pParty->AddItem(pActor->array_000234) ) | |
1301 { | |
1302 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1303 pParty->SetHoldingItem(pActor->array_000234); | |
1304 } | |
1305 pActor->array_000234[0].Reset(); | |
1306 } | |
1307 if ( pActor->array_000234[1].uItemID ) | |
1308 { | |
1309 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1310 { | |
1311 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1312 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1313 } | |
1314 pActor->array_000234[1].Reset(); | |
1315 } | |
1316 LABEL_55: | |
1317 pActor->Remove(); | |
1318 return; | |
1319 } | |
1320 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1321 { | |
1322 if ( pActor->array_000234[3].uItemID ) | |
1323 { | |
1324 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1325 pActor->array_000234[3].Reset(); | |
1326 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1327 if ( v14 ) | |
721 | 1328 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1329 else |
721 | 1330 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1331 ShowStatusBarString(pTmpBuf2, 2u); |
1332 if ( !pParty->AddItem(&Dst) ) | |
1333 pParty->SetHoldingItem(&Dst); | |
1334 v13 = 1; | |
1335 } | |
1336 goto LABEL_44; | |
1337 } | |
1338 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1339 { | |
1340 LABEL_44: | |
1341 v8 = pParty; | |
1342 goto LABEL_45; | |
1343 } | |
1344 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1345 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1346 if ( v14 ) | |
721 | 1347 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1348 else |
721 | 1349 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1350 ShowStatusBarString(pTmpBuf2, 2u); |
1351 v8 = pParty; | |
1352 if ( !pParty->AddItem(&Dst) ) | |
1353 pParty->SetHoldingItem(&Dst); | |
1354 v13 = 1; | |
1355 LABEL_45: | |
1356 if ( pActor->array_000234[0].uItemID ) | |
1357 { | |
1358 if ( !v8->AddItem(pActor->array_000234) ) | |
1359 { | |
1360 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1361 v8->SetHoldingItem(pActor->array_000234); | |
1362 v13 = 1; | |
1363 } | |
1364 pActor->array_000234[0].Reset(); | |
1365 } | |
1366 if ( pActor->array_000234[1].uItemID ) | |
1367 { | |
1368 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1369 { | |
1370 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1371 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1372 v13 = 1; | |
1373 } | |
1374 pActor->array_000234[1].Reset(); | |
1375 } | |
1376 if ( !v13 || rand() % 100 < 90 ) | |
1377 goto LABEL_55; | |
1378 } | |
1379 | |
1380 //----- (00426E10) -------------------------------------------------------- | |
1381 int stru319::which_player_would_attack(Actor *pActor) | |
1382 { | |
1383 signed int v2; // ebx@1 | |
1384 int v3; // ecx@2 | |
1385 signed int v4; // edx@3 | |
1386 char v5; // zf@3 | |
1387 unsigned int v6; // eax@3 | |
1388 int v7; // eax@6 | |
1389 int v8; // eax@7 | |
1390 int v9; // eax@8 | |
1391 int v10; // eax@9 | |
1392 int v11; // eax@10 | |
1393 int v12; // eax@11 | |
1394 int v13; // esi@35 | |
1395 signed int v14; // edi@37 | |
1396 enum CHARACTER_RACE v15; // eax@44 | |
1397 Player *v16; // ecx@47 | |
1398 unsigned __int8 v17; // sf@50 | |
1399 unsigned __int8 v18; // of@50 | |
1400 int v19; // esi@52 | |
1401 Player *v20; // ecx@53 | |
1402 int result; // eax@57 | |
1403 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1404 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1405 int v24; // [sp+138h] [bp-10h]@2 | |
1406 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1407 int v26; // [sp+140h] [bp-8h]@1 | |
1408 int v27; // [sp+144h] [bp-4h]@1 | |
1409 | |
1410 v27 = -1; | |
1411 v26 = -1; | |
1412 v25 = -1; | |
1413 v2 = 0; | |
1414 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1415 { | |
1416 v3 = 0; | |
1417 v24 = 0; | |
1418 do | |
1419 { | |
1420 v4 = 1; | |
1421 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1422 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1423 v22[v3] = v6; | |
1424 if ( !v5 ) | |
1425 { | |
1426 if ( (signed int)v6 > 128 ) | |
1427 { | |
1428 switch ( v6 ) | |
1429 { | |
1430 case 0x100u: | |
1431 v27 = 8; | |
1432 break; | |
1433 case 0x200u: | |
1434 v25 = 0; | |
1435 break; | |
1436 case 0x400u: | |
1437 v25 = 1; | |
1438 break; | |
1439 case 0x800u: | |
1440 v26 = 0; | |
1441 break; | |
1442 case 0x1000u: | |
1443 v26 = 1; | |
1444 break; | |
1445 case 0x2000u: | |
1446 v26 = 3; | |
1447 break; | |
1448 case 0x4000u: | |
1449 v26 = 2; | |
1450 break; | |
1451 } | |
1452 } | |
1453 else | |
1454 { | |
1455 if ( v6 == 128 ) | |
1456 { | |
1457 v27 = 4; | |
1458 } | |
1459 else | |
1460 { | |
1461 v7 = v6 - 1; | |
1462 if ( v7 ) | |
1463 { | |
1464 v8 = v7 - 1; | |
1465 if ( v8 ) | |
1466 { | |
1467 v9 = v8 - 2; | |
1468 if ( v9 ) | |
1469 { | |
1470 v10 = v9 - 4; | |
1471 if ( v10 ) | |
1472 { | |
1473 v11 = v10 - 8; | |
1474 if ( v11 ) | |
1475 { | |
1476 v12 = v11 - 16; | |
1477 if ( v12 ) | |
1478 { | |
1479 if ( v12 == 32 ) | |
1480 v27 = 20; | |
1481 } | |
1482 else | |
1483 { | |
1484 v27 = 32; | |
1485 } | |
1486 } | |
1487 else | |
1488 { | |
1489 v27 = 24; | |
1490 } | |
1491 } | |
1492 else | |
1493 { | |
1494 v27 = 28; | |
1495 } | |
1496 } | |
1497 else | |
1498 { | |
1499 v27 = 16; | |
1500 } | |
1501 } | |
1502 else | |
1503 { | |
1504 v27 = 12; | |
1505 } | |
1506 } | |
1507 else | |
1508 { | |
1509 v27 = 0; | |
1510 } | |
1511 } | |
1512 } | |
1513 v2 = 0; | |
1514 v13 = 0; | |
1515 while ( 1 ) | |
1516 { | |
1517 v14 = 0; | |
135 | 1518 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1519 v14 = v4; |
1520 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1521 v14 = v4; | |
1522 if ( v26 != -1 ) | |
1523 { | |
1524 v15 = pPlayers[v13 + 1]->GetRace(); | |
1525 if ( v26 == v15 ) | |
1526 v14 = 1; | |
1527 } | |
1528 if ( v14 == 1 ) | |
1529 { | |
1530 v16 = pPlayers[v13 + 1]; | |
1531 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1532 v23[v2++] = v13; | |
1533 } | |
1534 ++v13; | |
1535 if ( v13 >= 4 ) | |
1536 break; | |
1537 v4 = 1; | |
1538 } | |
1539 } | |
1540 v3 = v24 + 1; | |
1541 v18 = __OFSUB__(v24 + 1, 15); | |
1542 v17 = v24++ - 14 < 0; | |
1543 } | |
1544 while ( v17 ^ v18 ); | |
1545 if ( v2 ) | |
1546 goto LABEL_61; | |
1547 } | |
1548 v19 = 0; | |
1549 do | |
1550 { | |
1551 v20 = pPlayers[v19 + 1]; | |
1552 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1553 v23[v2++] = v19; | |
1554 ++v19; | |
1555 } | |
1556 while ( v19 < 4 ); | |
1557 if ( v2 ) | |
1558 LABEL_61: | |
1559 result = v23[rand() % v2]; | |
1560 else | |
1561 result = 0; | |
1562 return result; | |
1563 } | |
1564 | |
1565 //----- (0042704B) -------------------------------------------------------- | |
1566 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1567 { | |
1568 stru319 *v3; // edi@1 | |
1569 signed int v4; // ebx@5 | |
1570 signed int v5; // edi@5 | |
1571 | |
1572 v3 = this; | |
1573 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1574 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1575 && rand() % 100 < 5 ) | |
1576 pActor->_44FD29(a2); | |
1577 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1578 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1579 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1580 return 2; | |
1581 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1582 return 3; | |
1583 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1584 } | |
1585 | |
1586 //----- (00427102) -------------------------------------------------------- | |
1587 int stru319::_427102(Actor *pActor, signed int a2) | |
1588 { | |
1589 unsigned __int8 v3; // cf@11 | |
1590 unsigned __int8 v4; // zf@11 | |
1591 SpellBuff *v6; // ecx@46 | |
89 | 1592 Player *v7; // esi@49 |
0 | 1593 signed int v8; // edx@50 |
89 | 1594 SpellBuff *v9; // ecx@50 |
0 | 1595 |
597 | 1596 switch(a2) |
0 | 1597 { |
597 | 1598 case 77: |
1599 { | |
1600 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1601 return 0; | |
1602 return 1; | |
1603 } | |
1604 case 80: | |
1605 { | |
1606 v6 = pParty->pPartyBuffs; | |
1607 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1608 { | |
1609 ++v6; | |
1610 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1611 { | |
1612 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1613 v8 = 0; | |
1614 v9 = v7->pPlayerBuffs; | |
1615 while ( v9->uExpireTime <= 0i64 ) | |
1616 { | |
1617 ++v8; | |
1618 ++v9; | |
1619 if ( v8 >= 24 ) | |
1620 { | |
1621 ++v7; | |
1622 if ( v7 <= &pParty->pPlayers[3] ) | |
1623 { | |
1624 v8 = 0; | |
1625 v9 = v7->pPlayerBuffs; | |
1626 } | |
1627 else | |
1628 return 0; | |
1629 } | |
1630 } | |
1631 return 1; | |
1632 } | |
1633 } | |
1634 return 1; | |
1635 } | |
1636 case 85: | |
1637 { | |
1638 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1639 return 1; | |
1640 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1641 return 0; | |
1642 v3 = 0; | |
1643 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1644 break; | |
1645 } | |
1646 case 86: | |
1647 { | |
0 | 1648 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1649 return 1; |
0 | 1650 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1651 return 0; |
0 | 1652 v3 = 0; |
1653 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1654 break; |
1655 } | |
1656 case 95: | |
1657 { | |
1658 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1659 return 1; | |
0 | 1660 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1661 return 0; |
0 | 1662 v3 = 0; |
1663 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1664 break; |
1665 } | |
1666 case 73: | |
1667 { | |
1668 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1669 return 1; | |
1670 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1671 return 0; | |
1672 v3 = 0; | |
1673 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1674 break; | |
1675 } | |
1676 case 5: | |
1677 { | |
1678 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1679 return 1; | |
1680 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1681 return 0; | |
1682 v3 = 0; | |
1683 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1684 break; | |
1685 } | |
1686 case 17: | |
1687 { | |
1688 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1689 return 1; | |
1690 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1691 return 0; | |
1692 v3 = 0; | |
1693 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1694 break; | |
1695 } | |
1696 case 38: | |
89 | 1697 { |
597 | 1698 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1699 return 1; | |
1700 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1701 return 0; | |
1702 v3 = 0; | |
1703 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1704 } | |
1705 case 46: | |
1706 { | |
1707 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1708 return 1; |
597 | 1709 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1710 return 0; | |
1711 v3 = 0; | |
1712 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1713 break; | |
1714 } | |
1715 case 47: | |
1716 { | |
1717 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1718 return 1; | |
1719 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1720 return 0; | |
1721 v3 = 0; | |
1722 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1723 break; | |
1724 } | |
1725 case 51: | |
1726 { | |
1727 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1728 return 1; | |
1729 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1730 { | |
89 | 1731 v3 = 0; |
1732 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1733 } | |
1734 else | |
597 | 1735 return 0; |
1736 break; | |
1737 } | |
1738 default: | |
89 | 1739 { |
597 | 1740 return 1; |
89 | 1741 } |
0 | 1742 } |
1743 if ( !(v3 | v4) ) | |
1744 return 0; | |
1745 return 1; | |
1746 } | |
1747 | |
1748 //----- (004272F5) -------------------------------------------------------- | |
1749 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1750 { | |
1751 signed int v5; // esi@1 | |
1752 signed int v6; // edi@1 | |
1753 int v7; // esi@8 | |
1754 int v8; // eax@9 | |
1755 int v9; // edx@11 | |
1756 int v10; // edx@13 | |
1757 int v11; // esi@13 | |
1758 unsigned __int8 v12; // sf@13 | |
1759 unsigned __int8 v13; // of@13 | |
1760 int v14; // edx@14 | |
1761 int v15; // eax@14 | |
1762 signed int result; // eax@17 | |
1763 | |
1764 v5 = pActor->pMonsterInfo.uAC; | |
1765 v6 = 0; | |
1766 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1767 v5 /= 2; | |
1768 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1769 v6 = pActor->pActorBuffs[15].uPower; | |
1770 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1771 v6 = pActor->pActorBuffs[16].uPower; | |
1772 v7 = v6 + v5; | |
1773 if ( a3 ) | |
1774 v8 = pPlayer->GetRangedAttack(); | |
1775 else | |
1776 v8 = pPlayer->GetActualAttack(0); | |
1777 v9 = rand() % (v7 + 2 * v8 + 30); | |
1778 if ( a3 == 2 ) | |
1779 { | |
1780 v14 = a4 + v9; | |
1781 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1782 } | |
1783 else | |
1784 { | |
1785 if ( a3 != 3 ) | |
1786 { | |
1787 v10 = a4 + v9; | |
1788 v11 = v7 + 15; | |
1789 v13 = __OFSUB__(v10, v11); | |
1790 v12 = v10 - v11 < 0; | |
1791 goto LABEL_16; | |
1792 } | |
1793 v14 = a4 + v9; | |
1794 v15 = 2 * v7 + 30; | |
1795 } | |
1796 v13 = __OFSUB__(v14, v15); | |
1797 v12 = v14 - v15 < 0; | |
1798 LABEL_16: | |
1799 if ( v12 ^ v13 ) | |
1800 result = 0; | |
1801 else | |
1802 result = 1; | |
1803 return result; | |
1804 } | |
1805 | |
1806 //----- (004273BB) -------------------------------------------------------- | |
1807 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1808 { | |
1809 Actor *v5; // ecx@1 | |
1810 signed int v6; // ebx@1 | |
1811 signed int v7; // esi@1 | |
1812 unsigned __int8 v8; // zf@1 | |
1813 unsigned __int8 v9; // sf@1 | |
1814 int v10; // ebx@10 | |
1815 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1816 | |
1817 v5 = a2; | |
1818 v6 = a2->pMonsterInfo.uAC; | |
1819 v7 = 0; | |
1820 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1821 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1822 a2a = 0; | |
1823 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1824 v6 /= 2; | |
1825 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1826 v7 = v5->pActorBuffs[14].uPower; | |
1827 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1828 v7 = v5->pActorBuffs[16].uPower; | |
1829 v10 = v7 + v6; | |
1830 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1831 a2a = pActor->pActorBuffs[14].uPower; | |
1832 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1833 a2a = pActor->pActorBuffs[17].uPower; | |
1834 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1835 { | |
1836 a2a += pActor->pActorBuffs[11].uPower; | |
1837 pActor->pActorBuffs[11].Reset(); | |
1838 } | |
1839 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1840 } | |
1841 | |
1842 //----- (004274AD) -------------------------------------------------------- | |
1843 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1844 { | |
1845 signed int v3; // edi@1 | |
1846 signed int v4; // esi@8 | |
1847 int v5; // esi@8 | |
1848 | |
1849 v3 = 0; | |
1850 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1851 v3 = pActor->pActorBuffs[14].uPower; | |
1852 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1853 v3 = pActor->pActorBuffs[17].uPower; | |
1854 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1855 { | |
1856 v3 += pActor->pActorBuffs[11].uPower; | |
1857 pActor->pActorBuffs[11].Reset(); | |
1858 } | |
1859 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1860 v5 = rand() % v4 + 1; | |
1861 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1862 } | |
1863 | |
1864 //----- (00427546) -------------------------------------------------------- | |
1865 int stru319::_427546(int a2) | |
1866 { | |
1867 int result; // eax@2 | |
1868 | |
1869 if ( a2 >= 0 ) | |
1870 { | |
1871 if ( a2 >= 1 ) | |
1872 result = (a2 >= 2) + 2; | |
1873 else | |
1874 result = 1; | |
1875 } | |
1876 else | |
1877 { | |
1878 result = 0; | |
1879 } | |
1880 return result; | |
1881 } | |
1882 | |
1883 //----- (0042756B) -------------------------------------------------------- | |
1884 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1885 { | |
1886 int v4; // edx@1 | |
1887 int v5; // ecx@1 | |
1888 signed int v6; // eax@4 | |
1889 signed int result; // eax@17 | |
1890 signed int v8; // esi@18 | |
1891 | |
1892 v4 = 0; | |
1893 v5 = 0; | |
1894 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1895 v5 = pActor->pActorBuffs[14].uPower; | |
1896 switch ( a2 ) | |
1897 { | |
1898 case 4: | |
1899 v6 = pActor->pMonsterInfo.uResPhysical; | |
1900 break; | |
1901 case 0: | |
1902 v6 = pActor->pMonsterInfo.uResFire; | |
1903 goto LABEL_12; | |
1904 case 1: | |
1905 v6 = pActor->pMonsterInfo.uResAir; | |
1906 goto LABEL_12; | |
1907 case 2: | |
1908 v6 = pActor->pMonsterInfo.uResWater; | |
1909 goto LABEL_12; | |
1910 case 3: | |
1911 v6 = pActor->pMonsterInfo.uResEarth; | |
1912 goto LABEL_12; | |
1913 case 6: | |
1914 v6 = pActor->pMonsterInfo.uResSpirit; | |
1915 break; | |
1916 case 7: | |
1917 v6 = pActor->pMonsterInfo.uResMind; | |
1918 goto LABEL_12; | |
1919 case 8: | |
1920 v6 = pActor->pMonsterInfo.uResBody; | |
1921 LABEL_12: | |
1922 v4 = v5; | |
1923 break; | |
1924 case 9: | |
1925 v6 = pActor->pMonsterInfo.uResLight; | |
1926 break; | |
1927 case 10: | |
1928 v6 = pActor->pMonsterInfo.uResDark; | |
1929 break; | |
1930 default: | |
1931 v6 = 0; | |
1932 break; | |
1933 } | |
1934 if ( v6 < 200 ) | |
1935 { | |
1936 v8 = v4 + v6 + 30; | |
1937 if ( rand() % v8 >= 30 ) | |
1938 { | |
1939 a3 >>= 1; | |
1940 if ( rand() % v8 >= 30 ) | |
1941 { | |
1942 a3 >>= 1; | |
1943 if ( rand() % v8 >= 30 ) | |
1944 { | |
1945 a3 >>= 1; | |
1946 if ( rand() % v8 >= 30 ) | |
1947 a3 >>= 1; | |
1948 } | |
1949 } | |
1950 } | |
1951 result = a3; | |
1952 } | |
1953 else | |
1954 { | |
1955 result = 0; | |
1956 } | |
1957 return result; | |
1958 } | |
1959 | |
1960 //----- (00427662) -------------------------------------------------------- | |
1961 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
1962 { | |
1963 Actor *v3; // edi@2 | |
1964 signed int v4; // esi@2 | |
1965 bool result; // eax@13 | |
1966 | |
1967 switch ( uType ) | |
1968 { | |
1969 case 0u: | |
1970 v3 = pActor; | |
1971 v4 = pActor->pMonsterInfo.uResFire; | |
1972 goto LABEL_12; | |
1973 case 1u: | |
1974 v3 = pActor; | |
1975 v4 = pActor->pMonsterInfo.uResAir; | |
1976 goto LABEL_12; | |
1977 case 2u: | |
1978 v3 = pActor; | |
1979 v4 = pActor->pMonsterInfo.uResWater; | |
1980 goto LABEL_12; | |
1981 case 3u: | |
1982 v3 = pActor; | |
1983 v4 = pActor->pMonsterInfo.uResEarth; | |
1984 goto LABEL_12; | |
1985 case 7u: | |
1986 v3 = pActor; | |
1987 v4 = pActor->pMonsterInfo.uResMind; | |
1988 goto LABEL_12; | |
1989 case 6u: | |
1990 v3 = pActor; | |
1991 v4 = pActor->pMonsterInfo.uResSpirit; | |
1992 goto LABEL_12; | |
1993 case 8u: | |
1994 v3 = pActor; | |
1995 v4 = pActor->pMonsterInfo.uResBody; | |
1996 goto LABEL_12; | |
1997 case 9u: | |
1998 v3 = pActor; | |
1999 v4 = pActor->pMonsterInfo.uResLight; | |
2000 goto LABEL_12; | |
2001 case 0xAu: | |
2002 v3 = pActor; | |
2003 v4 = pActor->pMonsterInfo.uResDark; | |
2004 goto LABEL_12; | |
2005 case 4u: | |
2006 v3 = pActor; | |
2007 v4 = pActor->pMonsterInfo.uResPhysical; | |
2008 LABEL_12: | |
2009 if ( v4 < 200 ) | |
2010 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2011 else | |
2012 result = 0; | |
2013 break; | |
2014 default: | |
2015 result = 1; | |
2016 break; | |
2017 } | |
2018 return result; | |
2019 } | |
2020 | |
2021 //----- (00427769) -------------------------------------------------------- | |
2022 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2023 { | |
2024 bool result; // eax@2 | |
2025 | |
710 | 2026 __debugbreak(); // refactor |
0 | 2027 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2028 result = 1; | |
2029 else | |
2030 result = 0; | |
2031 return result; | |
2032 } | |
2033 | |
2034 //----- (0042777D) -------------------------------------------------------- | |
319 | 2035 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2036 { |
370 | 2037 //bool result; // eax@2 |
486 | 2038 //__int16 v6; // bx@4 |
437 | 2039 //Player *v7; // eax@4 |
486 | 2040 //char v8; // zf@12 |
0 | 2041 unsigned __int16 v9; // cx@16 |
2042 unsigned int v10; // eax@18 | |
2043 unsigned __int8 v11; // sf@18 | |
2044 unsigned __int8 v12; // of@18 | |
2045 unsigned __int16 v13; // cx@21 | |
2046 unsigned int v14; // eax@23 | |
486 | 2047 //stru277 *v15; // esi@27 |
2048 //stru277 *v16; // eax@28 | |
832 | 2049 //GUIWindow *v17; // eax@43 |
2050 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2051 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2052 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2053 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2054 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2055 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2056 //int v24; // [sp-18h] [bp-30h]@44 | |
2057 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2058 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2059 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2060 //char *v28; // [sp-8h] [bp-20h]@43 | |
2061 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2062 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2063 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2064 | |
2065 //a3a = uPlayerID; | |
2066 //a2a = a1; | |
370 | 2067 |
2068 //if ( pParty->bTurnBasedModeOn != 1 | |
2069 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2070 if (pParty->bTurnBasedModeOn) | |
0 | 2071 { |
370 | 2072 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2073 return; | |
2074 } | |
2075 | |
2076 | |
486 | 2077 //v6 = a5; |
437 | 2078 //v7 = &pParty->pPlayers[uPlayerID]; |
2079 assert(uPlayerID < 4); | |
2080 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2081 if ( !(a5 & 0x10) ) |
2082 { | |
2083 switch ( a1 ) | |
2084 { | |
486 | 2085 case SPELL_SPIRIT_FATE: |
2086 case SPELL_BODY_FIRST_AID: | |
2087 case SPELL_DARK_REANIMATE: | |
2088 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2089 a5 |= 0x0100; | |
0 | 2090 break; |
486 | 2091 |
2092 case SPELL_FIRE_FIRE_AURA: | |
2093 case SPELL_WATER_RECHARGE_ITEM: | |
2094 case SPELL_WATER_ENCHANT_ITEM: | |
2095 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2096 //LOBYTE(v6) = a5 | 0x80; | |
2097 a5 |= 0x0080; | |
0 | 2098 break; |
486 | 2099 |
2100 case SPELL_FIRE_FIRE_BOLT: | |
2101 case SPELL_FIRE_FIREBALL: | |
2102 case SPELL_FIRE_INCINERATE: | |
2103 case SPELL_AIR_LIGHNING_BOLT: | |
2104 case SPELL_AIR_IMPLOSION: | |
2105 case SPELL_WATER_POISON_SPRAY: | |
2106 case SPELL_WATER_ICE_BOLT: | |
2107 case SPELL_WATER_ACID_BURST: | |
2108 case SPELL_WATER_ICE_BLAST: | |
2109 case SPELL_EARTH_STUN: | |
2110 case SPELL_EARTH_SLOW: | |
2111 case SPELL_EARTH_DEADLY_SWARM: | |
2112 case SPELL_EARTH_BLADES: | |
2113 case SPELL_EARTH_MASS_DISTORTION: | |
2114 case SPELL_SPIRIT_SPIRIT_LASH: | |
2115 case SPELL_MIND_MIND_BLAST: | |
2116 case SPELL_MIND_CHARM: | |
2117 case SPELL_MIND_PSYCHIC_SHOCK: | |
2118 case SPELL_BODY_HARM: | |
2119 case SPELL_BODY_FLYING_FIST: | |
2120 case SPELL_LIGHT_LIGHT_BOLT: | |
2121 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2122 case SPELL_LIGHT_SUNRAY: | |
2123 case SPELL_DARK_TOXIC_CLOUD: | |
2124 case SPELL_DARK_SHRINKING_RAY: | |
2125 case SPELL_DARK_SHARPMETAL: | |
2126 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2127 if ( !a6 ) |
486 | 2128 a5 |= 0x0008; |
0 | 2129 break; |
486 | 2130 case SPELL_MIND_TELEPATHY: |
2131 case SPELL_MIND_BERSERK: | |
2132 case SPELL_MIND_ENSLAVE: | |
2133 case SPELL_LIGHT_PARALYZE: | |
2134 case SPELL_DARK_CONTROL_UNDEAD: | |
2135 //LABEL_9: | |
2136 //v6 = a5 | 8; | |
2137 a5 |= 0x0008; | |
0 | 2138 break; |
486 | 2139 |
2140 case SPELL_EARTH_TELEKINESIS: | |
2141 a5 |= 0x0040; | |
2142 break; | |
2143 | |
2144 case SPELL_SPIRIT_BLESS: | |
2145 if (a4 && ~a4 & 0x01C0) | |
961 | 2146 //goto LABEL_25; |
2147 { | |
2148 a5 |= 0x0002; | |
2149 break; | |
2150 } | |
486 | 2151 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); |
961 | 2152 //goto LABEL_25; |
2153 { | |
2154 a5 |= 0x0002; | |
2155 break; | |
2156 } | |
0 | 2157 break; |
486 | 2158 |
2159 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2160 v9 = a4; |
2161 if ( !a4 ) | |
437 | 2162 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
961 | 2163 //goto LABEL_18; |
2164 v10 = SkillToMastery(v9); | |
2165 v12 = __OFSUB__(v10, 3); | |
2166 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2167 //goto LABEL_24; | |
2168 if ( v11 ^ v12 ) | |
2169 { | |
2170 a5 |= 0x0002; | |
2171 break; | |
2172 } | |
2173 break; | |
486 | 2174 |
2175 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2176 v9 = a4; |
2177 if ( !a4 ) | |
437 | 2178 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
961 | 2179 //LABEL_18: |
0 | 2180 v10 = SkillToMastery(v9); |
2181 v12 = __OFSUB__(v10, 3); | |
2182 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
961 | 2183 //goto LABEL_24; |
2184 if ( v11 ^ v12 ) | |
2185 { | |
2186 a5 |= 0x0002; | |
2187 break; | |
2188 } | |
2189 break; | |
486 | 2190 |
2191 case SPELL_BODY_HAMMERHANDS: | |
0 | 2192 v13 = a4; |
2193 if ( !a4 ) | |
437 | 2194 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2195 v14 = SkillToMastery(v13); |
2196 v12 = __OFSUB__(v14, 4); | |
2197 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
961 | 2198 //LABEL_24: |
0 | 2199 if ( v11 ^ v12 ) |
961 | 2200 //goto LABEL_25; |
2201 { | |
2202 a5 |= 0x0002; | |
2203 break; | |
2204 } | |
0 | 2205 break; |
486 | 2206 |
2207 case SPELL_EARTH_STONE_TO_FLESH: | |
2208 case SPELL_SPIRIT_REMOVE_CURSE: | |
2209 case SPELL_SPIRIT_RAISE_DEAD: | |
2210 case SPELL_SPIRIT_RESSURECTION: | |
2211 case SPELL_MIND_REMOVE_FEAR: | |
2212 case SPELL_MIND_CURE_PARALYSIS: | |
2213 case SPELL_MIND_CURE_INSANITY: | |
2214 case SPELL_BODY_CURE_WEAKNESS: | |
2215 case SPELL_BODY_REGENERATION: | |
2216 case SPELL_BODY_CURE_POISON: | |
2217 case SPELL_BODY_CURE_DISEASE: | |
961 | 2218 //LABEL_25: |
486 | 2219 //v6 = a5 | 2; |
2220 a5 |= 0x0002; | |
0 | 2221 break; |
486 | 2222 |
2223 case SPELL_DARK_SACRIFICE: | |
2224 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2225 a5 |= 0x0200; | |
0 | 2226 break; |
2227 default: | |
2228 break; | |
2229 } | |
2230 } | |
370 | 2231 |
486 | 2232 |
2233 if (a5 & 0x3CA) | |
0 | 2234 { |
924 | 2235 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2236 for (uint i = 0; i < 10; ++i) |
924 | 2237 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2238 { |
924 | 2239 pCastSpellInfo[i].spellnum = 0; |
486 | 2240 break; |
2241 } | |
0 | 2242 } |
486 | 2243 |
924 | 2244 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2245 for (uint i = 0; i < 10; ++i) |
0 | 2246 { |
924 | 2247 auto spell = pCastSpellInfo + i; |
486 | 2248 if (!spell->spellnum) |
2249 continue; | |
2250 | |
2251 spell->spellnum = 0; | |
2252 if (spell->field_8 & 0x3CA) | |
0 | 2253 { |
486 | 2254 pGUIWindow_Settings->Release(); |
2255 pGUIWindow_Settings = nullptr; | |
2256 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2257 GameUI_Footer_TimeLeft = 0; |
486 | 2258 unk_50C9A0 = 0; |
2259 back_to_game(); | |
0 | 2260 } |
2261 } | |
486 | 2262 |
924 | 2263 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2264 if ( result != -1 ) |
2265 { | |
486 | 2266 if ( a5 & 2 ) |
0 | 2267 { |
2268 if ( pGUIWindow_Settings ) | |
319 | 2269 return; |
961 | 2270 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2271 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0); |
2272 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0); | |
2273 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0); | |
2274 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0); | |
319 | 2275 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2276 return; | |
0 | 2277 } |
486 | 2278 if ( a5 & 8 ) |
0 | 2279 { |
2280 if ( pGUIWindow_Settings ) | |
319 | 2281 return; |
832 | 2282 |
961 | 2283 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2284 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0); |
319 | 2285 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2286 return; | |
0 | 2287 } |
486 | 2288 if ( a5 & 0x40 ) |
0 | 2289 { |
2290 if ( pGUIWindow_Settings ) | |
319 | 2291 return; |
832 | 2292 |
961 | 2293 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
2294 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_BE, 0, 0, "", 0); | |
832 | 2295 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2296 return; | |
0 | 2297 } |
486 | 2298 if ( (char)a5 < 0 ) |
0 | 2299 { |
2300 if ( pGUIWindow_Settings ) | |
319 | 2301 return; |
0 | 2302 ++pIcons_LOD->uTexturePacksCount; |
2303 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2304 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2305 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2306 unk_50C9A0 = 1; |
2307 some_active_character = uActiveCharacter; | |
319 | 2308 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2309 return; | |
0 | 2310 } |
486 | 2311 if ( HIBYTE(a5) & 1 ) |
0 | 2312 { |
2313 if ( pGUIWindow_Settings ) | |
319 | 2314 return; |
961 | 2315 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2316 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0); |
2317 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0); | |
2318 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0); | |
2319 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0); | |
2320 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL); | |
961 | 2321 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2322 } |
486 | 2323 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2324 { |
961 | 2325 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
832 | 2326 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2327 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2328 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
960 | 2329 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", |
832 | 2330 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2331 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2332 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2333 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
960 | 2334 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", |
832 | 2335 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
998 | 2336 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0); |
2337 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0); | |
0 | 2338 } |
2339 } | |
2340 } | |
2341 | |
2342 //----- (00427D48) -------------------------------------------------------- | |
924 | 2343 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2344 { |
924 | 2345 CastSpellInfo *v2; // esi@1 |
0 | 2346 signed int v3; // ebx@1 |
2347 | |
2348 v2 = this; | |
2349 v3 = 10; | |
2350 do | |
2351 { | |
2352 if ( v2->spellnum ) | |
2353 { | |
2354 if ( v2->field_8 & 0x3CA ) | |
2355 { | |
2356 v2->spellnum = 0; | |
2357 pGUIWindow_Settings->Release(); | |
2358 pGUIWindow_Settings = 0; | |
2359 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2360 GameUI_Footer_TimeLeft = 0; |
0 | 2361 unk_50C9A0 = 0; |
2362 back_to_game(); | |
2363 } | |
2364 } | |
2365 ++v2; | |
2366 --v3; | |
2367 } | |
2368 while ( v3 ); | |
2369 } | |
2370 | |
2371 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2372 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2373 { |
2374 unsigned int result; // eax@1 | |
924 | 2375 CastSpellInfo *v7; // edx@1 |
2376 CastSpellInfo *v8; // ecx@5 | |
0 | 2377 |
2378 result = 0; | |
2379 v7 = this; | |
2380 while ( v7->spellnum ) | |
2381 { | |
2382 ++result; | |
2383 ++v7; | |
2384 if ( (signed int)result >= 10 ) | |
2385 goto LABEL_8; | |
2386 } | |
2387 v8 = &this[result]; | |
2388 v8->spellnum = a2; | |
2389 v8->uPlayerID = uPlayerID; | |
2390 if ( a5 & 0x10 ) | |
2391 v8->uPlayerID_2 = uPlayerID; | |
2392 v8->field_6 = 0; | |
488 | 2393 v8->spell_target_pid = 0; |
0 | 2394 v8->field_8 = a5; |
488 | 2395 v8->forced_spell_skill_level = skill_level; |
823 | 2396 v8->sound_id = spell_sound_id; |
0 | 2397 LABEL_8: |
2398 if ( result == 10 ) | |
2399 result = -1; | |
2400 return result; | |
2401 } | |
2402 | |
2403 //----- (00427E01) -------------------------------------------------------- | |
924 | 2404 void CastSpellInfo::_427E01_cast_spell() |
0 | 2405 { |
486 | 2406 //int v1; // esi@1 |
0 | 2407 int v2; // edi@1 |
924 | 2408 CastSpellInfo *pCastSpell; // ebx@2 |
488 | 2409 //signed int v4; // eax@8 |
2410 //__int16 v5; // ax@9 | |
0 | 2411 signed int v6; // eax@14 |
488 | 2412 //__int16 v7; // ax@23 |
2413 //__int16 v8; // ax@24 | |
2414 //char v9; // al@44 | |
2415 //int v10; // eax@45 | |
0 | 2416 unsigned __int16 v11; // cx@45 |
822 | 2417 //signed int v12; // ecx@48 |
490 | 2418 //int v13; // eax@53 |
0 | 2419 unsigned __int8 v14; // zf@53 |
488 | 2420 //unsigned int v15; // edx@53 |
2421 //signed int v16; // eax@53 | |
998 | 2422 //Player *v17; // esi@70 |
822 | 2423 //int v18; // eax@72 |
823 | 2424 //int v19; // eax@74 |
888 | 2425 Player *v20; // eax@74 |
0 | 2426 signed int i; // esi@76 |
823 | 2427 //int v22; // eax@88 |
0 | 2428 __int16 v23; // ax@88 |
488 | 2429 //int v24; // ecx@93 |
2430 //int v25; // ecx@94 | |
2431 //signed __int64 v26; // qax@100 | |
2432 //char *v27; // ecx@100 | |
2433 //unsigned __int64 v28; // qax@102 | |
0 | 2434 int v29; // ecx@105 |
2435 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2436 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2437 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2438 //char *v33; // edx@113 |
823 | 2439 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2440 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2441 //int v36; // edx@125 |
823 | 2442 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2443 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2444 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2445 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2446 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2447 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2448 //int *v43; // ecx@129 |
823 | 2449 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2450 //int v45; // ecx@132 |
0 | 2451 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2452 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2453 //int v48; // eax@137 |
823 | 2454 //int v49; // eax@137 |
822 | 2455 //int v50; // eax@141 |
0 | 2456 int v51; // eax@146 |
2457 __int16 v52; // ax@153 | |
823 | 2458 //int v53; // eax@153 |
0 | 2459 signed __int64 v54; // qax@164 |
2460 int v55; // edi@164 | |
488 | 2461 //stru6 *v56; // eax@165 |
0 | 2462 int v57; // eax@169 |
2463 signed __int64 v58; // qax@177 | |
2464 int v59; // edi@177 | |
2465 unsigned __int16 v60; // ax@184 | |
2466 int v61; // ecx@184 | |
823 | 2467 //int v62; // eax@186 |
0 | 2468 int v63; // ecx@187 |
2469 int v64; // ecx@188 | |
2470 int v65; // ecx@189 | |
710 | 2471 //const char *v66; // ecx@200 |
2472 //unsigned int v67; // edx@201 | |
0 | 2473 char v68; // al@207 |
89 | 2474 ItemGen *v69; // esi@211 |
0 | 2475 int v70; // ecx@214 |
2476 int v71; // ecx@215 | |
2477 int v72; // ecx@216 | |
488 | 2478 //__int16 v73; // ST1C_2@222 |
2479 //__int16 v74; // ST18_2@222 | |
2480 //stru6 *v75; // eax@222 | |
993 | 2481 //int v76; // ecx@223 |
2482 //int v77; // ecx@224 | |
2483 //int v78; // ecx@225 | |
2484 //int v79; // eax@227 | |
488 | 2485 //int v80; // eax@232 |
2486 //__int16 v81; // ST18_2@245 | |
2487 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2488 //signed int v83; // edi@245 |
488 | 2489 //__int16 v84; // ST18_2@245 |
2490 //stru6 *v85; // eax@245 | |
2491 //__int16 v86; // ST18_2@245 | |
2492 //stru6 *v87; // eax@245 | |
2493 //__int16 v88; // ST18_2@245 | |
2494 //stru6 *v89; // eax@245 | |
0 | 2495 double v90; // st7@245 |
993 | 2496 //int v91; // eax@250 |
89 | 2497 Player *v92; // eax@255 |
488 | 2498 //__int16 v93; // ST18_2@260 |
2499 //stru6 *v94; // eax@260 | |
2500 //__int16 v95; // ST18_2@260 | |
2501 //stru6 *v96; // eax@260 | |
2502 //__int16 v97; // ST18_2@260 | |
2503 //stru6 *v98; // eax@260 | |
2504 //__int16 v99; // ST18_2@260 | |
2505 //stru6 *v100; // eax@260 | |
993 | 2506 //int v101; // ecx@261 |
2507 //int v102; // ecx@262 | |
2508 //int v103; // ecx@263 | |
2509 //int v104; // eax@265 | |
0 | 2510 int v105; // edi@271 |
488 | 2511 //__int16 v106; // ST18_2@272 |
2512 //stru6 *v107; // eax@272 | |
0 | 2513 __int16 v108; // ST1C_2@274 |
2514 __int16 v109; // ST18_2@274 | |
2515 stru6 *v110; // eax@274 | |
2516 int v111; // eax@274 | |
2517 Actor *v112; // esi@278 | |
2518 int v113; // eax@278 | |
2519 int v114; // ebx@278 | |
2520 unsigned int v115; // ecx@278 | |
2521 int v116; // edx@279 | |
2522 int v117; // edx@281 | |
2523 int v118; // edx@283 | |
2524 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2525 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2526 //int v121; // eax@286 |
0 | 2527 signed int v122; // eax@286 |
993 | 2528 //int v123; // ecx@288 |
2529 //int v124; // ecx@289 | |
2530 //int v125; // ecx@290 | |
2531 //int v126; // eax@292 | |
0 | 2532 int v127; // eax@296 |
488 | 2533 //__int16 v128; // ST18_2@303 |
2534 //stru6 *v129; // eax@303 | |
2535 //__int16 v130; // ST18_2@303 | |
2536 //stru6 *v131; // eax@303 | |
2537 //__int16 v132; // ST18_2@303 | |
2538 //stru6 *v133; // eax@303 | |
2539 //__int16 v134; // ST18_2@303 | |
2540 //stru6 *v135; // eax@303 | |
2541 //unsigned __int64 v136; // qax@304 | |
2542 //char *v137; // ecx@304 | |
993 | 2543 //int v138; // ecx@305 |
0 | 2544 int v139; // ecx@306 |
993 | 2545 //int v140; // eax@308 |
488 | 2546 //__int16 v141; // ST18_2@311 |
2547 //stru6 *v142; // eax@311 | |
2548 //__int16 v143; // ST18_2@311 | |
2549 //stru6 *v144; // eax@311 | |
2550 //__int16 v145; // ST18_2@311 | |
2551 //stru6 *v146; // eax@311 | |
2552 //__int16 v147; // ST18_2@311 | |
2553 //stru6 *v148; // eax@311 | |
0 | 2554 int v149; // ecx@312 |
2555 int v150; // ecx@313 | |
2556 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2557 //signed int v152; // eax@322 |
0 | 2558 int v153; // ecx@322 |
2559 int v154; // eax@322 | |
2560 int v155; // eax@323 | |
2561 int v156; // eax@323 | |
993 | 2562 //int v157; // eax@326 |
0 | 2563 double v158; // st7@326 |
2564 double v159; // st6@326 | |
993 | 2565 //signed __int64 v160; // qtt@334 |
823 | 2566 //int v161; // eax@339 |
0 | 2567 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2568 //int v163; // eax@340 |
0 | 2569 signed int v164; // eax@340 |
2570 signed int v165; // edi@340 | |
488 | 2571 //stru6 *v166; // eax@340 |
2572 //stru6 *v167; // eax@340 | |
0 | 2573 signed int v168; // edi@343 |
2574 int v169; // eax@344 | |
993 | 2575 //int v170; // ecx@346 |
2576 //int v171; // ecx@347 | |
2577 //int v172; // ecx@348 | |
2578 //int v173; // edi@350 | |
0 | 2579 signed int v174; // edi@355 |
488 | 2580 //__int16 v175; // ST18_2@357 |
2581 //stru6 *v176; // eax@357 | |
2582 //__int16 v177; // ST18_2@357 | |
2583 //stru6 *v178; // eax@357 | |
2584 //__int16 v179; // ST18_2@357 | |
2585 //stru6 *v180; // eax@357 | |
2586 //__int16 v181; // ST18_2@357 | |
2587 //stru6 *v182; // eax@357 | |
2588 //signed __int64 v183; // qax@357 | |
0 | 2589 int v184; // ecx@358 |
2590 int v185; // ecx@359 | |
2591 int v186; // ecx@360 | |
823 | 2592 //int v187; // eax@367 |
0 | 2593 int v188; // esi@369 |
2594 int v189; // edi@369 | |
710 | 2595 //const char *v190; // ecx@377 |
0 | 2596 signed int v191; // edi@379 |
2597 int v192; // ecx@382 | |
993 | 2598 //int v193; // ecx@383 |
2599 //int v194; // ecx@384 | |
0 | 2600 int v195; // eax@386 |
2601 int v196; // eax@387 | |
488 | 2602 //__int16 v197; // ST18_2@395 |
2603 //stru6 *v198; // eax@395 | |
2604 //__int16 v199; // ST18_2@395 | |
2605 //stru6 *v200; // eax@395 | |
2606 //__int16 v201; // ST18_2@395 | |
2607 //stru6 *v202; // eax@395 | |
2608 //__int16 v203; // ST18_2@395 | |
2609 //stru6 *v204; // eax@395 | |
0 | 2610 signed int v205; // edi@405 |
2611 int v206; // eax@407 | |
2612 __int16 v207; // cx@407 | |
2613 int v208; // eax@411 | |
2614 signed int v209; // ecx@412 | |
2615 int v210; // edx@412 | |
2616 signed int v211; // ecx@412 | |
2617 int v212; // eax@413 | |
2618 int v213; // eax@413 | |
2619 int v214; // eax@413 | |
2620 int v215; // eax@415 | |
2621 double v216; // st7@415 | |
2622 double v217; // st6@415 | |
2623 signed __int64 v218; // qtt@423 | |
993 | 2624 //int v219; // ecx@425 |
2625 //int v220; // ecx@426 | |
2626 //int v221; // edi@428 | |
890 | 2627 Player *v222; // edi@434 |
0 | 2628 char v223; // al@438 |
993 | 2629 //int v224; // ecx@442 |
2630 //int v225; // ecx@443 | |
823 | 2631 //int v226; // eax@451 |
0 | 2632 int v227; // esi@453 |
2633 unsigned int v228; // edi@454 | |
2634 int v229; // edi@466 | |
488 | 2635 //__int16 v230; // ST18_2@469 |
2636 //stru6 *v231; // eax@469 | |
2637 //signed int v232; // esi@469 | |
2638 //__int16 v233; // ST18_2@469 | |
2639 //stru6 *v234; // eax@469 | |
2640 //__int16 v235; // ST18_2@469 | |
2641 //stru6 *v236; // eax@469 | |
2642 //__int16 v237; // ST18_2@469 | |
2643 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2644 //__int16 v239; // ST1C_2@469 |
0 | 2645 char *v240; // ecx@472 |
2646 double v241; // st7@478 | |
2647 signed __int64 v242; // qax@484 | |
2648 char *v243; // ecx@484 | |
2649 char *v244; // eax@488 | |
2650 int v245; // edi@492 | |
2651 int v246; // eax@492 | |
2652 char *v247; // eax@497 | |
2653 char v248; // al@497 | |
2654 char v249; // cf@500 | |
2655 float v250; // esi@507 | |
2656 char v251; // al@507 | |
2657 int v252; // edx@510 | |
2658 int m; // esi@510 | |
2659 int v254; // eax@513 | |
2660 int v255; // esi@513 | |
2661 int v256; // ecx@513 | |
2662 int v257; // edx@514 | |
2663 int v258; // ecx@514 | |
2664 char v259; // al@516 | |
2665 int v260; // eax@518 | |
2666 int v261; // esi@519 | |
2667 int v262; // edx@521 | |
2668 int v263; // ecx@521 | |
2669 int v264; // esi@521 | |
2670 int v265; // edx@521 | |
2671 int *ii; // eax@522 | |
2672 int v267; // eax@524 | |
2673 int v268; // eax@524 | |
2674 int v269; // eax@526 | |
2675 char *v270; // eax@531 | |
2676 char v271; // al@531 | |
2677 char v272; // cf@534 | |
993 | 2678 //float v273; // esi@541 |
0 | 2679 char v274; // al@541 |
2680 int v275; // edx@544 | |
2681 int k; // esi@544 | |
2682 int v277; // edx@548 | |
2683 int v278; // ecx@548 | |
2684 char v279; // al@550 | |
2685 int v280; // eax@552 | |
2686 int v281; // esi@553 | |
2687 int v282; // edx@555 | |
2688 int v283; // ecx@555 | |
2689 int v284; // esi@555 | |
2690 int v285; // edx@555 | |
2691 int *l; // eax@556 | |
2692 int v287; // eax@558 | |
2693 int v288; // eax@558 | |
2694 ItemGen *v289; // eax@560 | |
2695 signed int v290; // eax@560 | |
2696 unsigned __int8 v291; // al@564 | |
2697 char v292; // al@573 | |
2698 int v293; // eax@575 | |
2699 ItemGen *v294; // esi@575 | |
2700 int v295; // edx@575 | |
2701 int kk; // edi@575 | |
2702 int v297; // edx@579 | |
2703 int v298; // ecx@579 | |
2704 char v299; // al@581 | |
2705 int v300; // eax@583 | |
2706 int v301; // edi@584 | |
2707 int v302; // edx@586 | |
2708 int v303; // ecx@586 | |
2709 int v304; // edi@586 | |
2710 int v305; // edx@586 | |
2711 int *jj; // eax@587 | |
2712 int v307; // eax@589 | |
2713 int v308; // eax@589 | |
2714 char *v309; // ecx@593 | |
2715 char v310; // sf@593 | |
2716 unsigned __int8 v311; // of@593 | |
2717 char v312; // cl@597 | |
488 | 2718 char v313; // al@606pGame->GetStru6() |
0 | 2719 int v314; // edx@607 |
2720 int j; // esi@607 | |
2721 unsigned int v316; // eax@613 | |
2722 const char *v317; // ecx@617 | |
2723 Player *v318; // ecx@619 | |
2724 unsigned int v319; // edi@627 | |
993 | 2725 //int v320; // ecx@629 |
2726 //int v321; // ecx@630 | |
2727 //int v322; // edi@632 | |
0 | 2728 int v323; // edi@635 |
2729 char *v324; // eax@635 | |
2730 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2731 //int v326; // eax@643 |
823 | 2732 //int v327; // eax@648 |
0 | 2733 int v328; // ecx@651 |
2734 int v329; // ecx@652 | |
2735 int v330; // edi@654 | |
488 | 2736 //__int16 v331; // ST18_2@658 |
2737 //stru6 *v332; // eax@658 | |
2738 //__int16 v333; // ST18_2@658 | |
2739 //stru6 *v334; // eax@658 | |
2740 //__int16 v335; // ST18_2@658 | |
2741 //stru6 *v336; // eax@658 | |
2742 //__int16 v337; // ST18_2@658 | |
2743 //stru6 *v338; // eax@658 | |
993 | 2744 //int v339; // ecx@659 |
2745 //int v340; // ecx@660 | |
2746 //int v341; // eax@663 | |
0 | 2747 signed int v342; // edi@668 |
2748 signed int v343; // edi@670 | |
2749 unsigned __int64 v344; // ST08_8@670 | |
488 | 2750 //__int16 v345; // ST1C_2@671 |
2751 //__int16 v346; // ST18_2@671 | |
2752 //stru6 *v347; // eax@671 | |
993 | 2753 //int v348; // ecx@672 |
2754 //int v349; // ecx@673 | |
2755 //int v350; // edi@676 | |
0 | 2756 Player *v351; // edi@680 |
488 | 2757 //__int16 v352; // ST18_2@685 |
2758 //stru6 *v353; // eax@685 | |
0 | 2759 int v354; // ecx@686 |
2760 int v355; // ecx@687 | |
2761 int v356; // eax@689 | |
112 | 2762 Player *v357; // edi@694 |
488 | 2763 //unsigned __int16 v358; // ST1C_2@695 |
2764 //__int16 v359; // ST18_2@695 | |
2765 //stru6 *v360; // eax@695 | |
2766 //__int16 v361; // ST1C_2@697 | |
2767 //__int16 v362; // ST18_2@697 | |
2768 //stru6 *v363; // eax@697 | |
0 | 2769 int v364; // ecx@698 |
2770 int v365; // ecx@699 | |
2771 int v366; // eax@701 | |
488 | 2772 //stru6 *v367; // eax@704 |
823 | 2773 //int v368; // eax@704 |
0 | 2774 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2775 //int v370; // eax@706 |
0 | 2776 int v371; // ecx@709 |
2777 int v372; // ecx@710 | |
2778 int v373; // eax@715 | |
2779 int v374; // eax@717 | |
993 | 2780 //Player *v375; // edi@717 |
0 | 2781 int v376; // eax@717 |
2782 Player *v377; // ecx@719 | |
2783 int v378; // ecx@721 | |
2784 int v379; // ecx@722 | |
2785 int v380; // eax@724 | |
2786 int v381; // edi@727 | |
2787 int v382; // ecx@727 | |
2788 Player *v383; // eax@728 | |
2789 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2790 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2791 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2792 //Player *v387; // edi@738 |
0 | 2793 int v388; // edi@740 |
488 | 2794 //unsigned __int16 v389; // ST1C_2@740 |
2795 //__int16 v390; // ST18_2@740 | |
2796 //stru6 *v391; // eax@740 | |
0 | 2797 int v392; // ecx@742 |
993 | 2798 //int v393; // ecx@743 |
2799 //int v394; // ecx@744 | |
2800 //int v395; // edi@747 | |
0 | 2801 int v396; // eax@752 |
2802 int v397; // eax@757 | |
2803 int v398; // eax@757 | |
2804 int v399; // eax@757 | |
993 | 2805 //char *v400; // esi@757 |
488 | 2806 //Game *v401; // ecx@759 |
2807 //__int16 v402; // ST1C_2@759 | |
2808 //__int16 v403; // ST18_2@759 | |
2809 //stru6 *v404; // eax@759 | |
993 | 2810 //int v405; // ecx@761 |
2811 //int v406; // ecx@762 | |
2812 //int v407; // edi@765 | |
488 | 2813 //__int16 v408; // ST1C_2@769 |
2814 //__int16 v409; // ST18_2@769 | |
2815 //stru6 *v410; // eax@769 | |
993 | 2816 //int v411; // ecx@772 |
2817 //int v412; // ecx@773 | |
2818 //int v413; // edi@775 | |
488 | 2819 //__int16 v414; // ST1C_2@781 |
2820 //__int16 v415; // ST18_2@781 | |
2821 //stru6 *v416; // eax@781 | |
0 | 2822 int v417; // eax@787 |
2823 int v418; // ecx@789 | |
2824 __int16 v419; // ax@791 | |
2825 signed int v420; // eax@793 | |
2826 int v421; // edx@793 | |
2827 const char *v422; // eax@801 | |
2828 int v423; // ecx@808 | |
2829 int v424; // ecx@809 | |
2830 int v425; // eax@811 | |
2831 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2832 //signed int v427; // eax@820 |
0 | 2833 int v428; // ecx@825 |
2834 int v429; // ecx@826 | |
2835 int v430; // eax@828 | |
488 | 2836 //stru6 *v431; // eax@831 |
823 | 2837 //int v432; // eax@831 |
0 | 2838 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2839 //int v434; // eax@833 |
0 | 2840 int v435; // ecx@837 |
2841 int v436; // ecx@838 | |
488 | 2842 //__int16 v437; // ST1C_2@843 |
2843 //__int16 v438; // ST18_2@843 | |
2844 //stru6 *v439; // eax@843 | |
0 | 2845 int v440; // eax@843 |
2846 int v441; // eax@847 | |
993 | 2847 //int v442; // ecx@850 |
2848 //int v443; // ecx@851 | |
2849 //int v444; // eax@853 | |
0 | 2850 signed int v445; // edi@857 |
2851 int v446; // ecx@862 | |
2852 LevelDecoration *v447; // edi@864 | |
2853 __int16 v448; // ax@864 | |
2854 char *v449; // esi@870 | |
2855 int v450; // eax@870 | |
993 | 2856 //int v451; // ecx@875 |
2857 //int v452; // ecx@876 | |
2858 //int v453; // edi@878 | |
488 | 2859 //__int16 v454; // ST1C_2@884 |
2860 //__int16 v455; // ST18_2@884 | |
2861 //stru6 *v456; // eax@884 | |
0 | 2862 int v457; // ecx@887 |
2863 int v458; // ecx@888 | |
2864 int v459; // eax@890 | |
2865 signed int v460; // eax@895 | |
2866 Actor *v461; // eax@897 | |
2867 unsigned __int16 v462; // cx@897 | |
2868 signed int v463; // edx@897 | |
993 | 2869 //int v464; // ecx@905 |
2870 //int v465; // ecx@906 | |
2871 //int v466; // edi@909 | |
488 | 2872 //__int16 v467; // ST1C_2@913 |
2873 //__int16 v468; // ST18_2@913 | |
2874 //stru6 *v469; // eax@913 | |
0 | 2875 int v470; // edi@913 |
2876 int v471; // eax@917 | |
2877 int v472; // eax@917 | |
993 | 2878 //char *v473; // esi@918 |
488 | 2879 //__int16 v474; // ST18_2@920 |
2880 //stru6 *v475; // eax@920 | |
2881 //__int16 v476; // ST18_2@920 | |
2882 //stru6 *v477; // eax@920 | |
2883 //__int16 v478; // ST18_2@920 | |
2884 //stru6 *v479; // eax@920 | |
2885 //__int16 v480; // ST18_2@920 | |
2886 //stru6 *v481; // eax@920 | |
2887 //__int16 v482; // ST18_2@923 | |
2888 //stru6 *v483; // eax@923 | |
2889 //__int16 v484; // ST18_2@923 | |
2890 //stru6 *v485; // eax@923 | |
2891 //__int16 v486; // ST18_2@923 | |
2892 //stru6 *v487; // eax@923 | |
2893 //__int16 v488; // ST18_2@923 | |
2894 //stru6 *v489; // eax@923 | |
2895 //__int16 v490; // ST1C_2@924 | |
2896 //__int16 v491; // ST18_2@924 | |
2897 //stru6 *v492; // eax@924 | |
0 | 2898 int v493; // ecx@925 |
2899 int v494; // ecx@926 | |
488 | 2900 //__int16 v495; // ST1C_2@931 |
2901 //__int16 v496; // ST18_2@931 | |
2902 //stru6 *v497; // eax@931 | |
0 | 2903 int v498; // edi@931 |
2904 int v499; // eax@935 | |
2905 int v500; // eax@935 | |
2906 Player *v501; // edi@939 | |
488 | 2907 //__int16 v502; // ST18_2@940 |
2908 //stru6 *v503; // eax@940 | |
2909 //stru6 *v504; // eax@943 | |
0 | 2910 int v505; // eax@943 |
823 | 2911 //int v506; // eax@943 |
0 | 2912 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2913 //int v508; // eax@944 |
0 | 2914 signed int v509; // eax@944 |
2915 signed int v510; // edi@944 | |
2916 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2917 //int v512; // eax@946 |
0 | 2918 SpellBuff *v513; // edi@946 |
2919 int v514; // ecx@950 | |
993 | 2920 //int v515; // ecx@951 |
0 | 2921 int v516; // eax@953 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2922 //int v517; // eax@956 |
90 | 2923 Actor *v518; // edx@957 |
0 | 2924 __int16 v519; // cx@958 |
993 | 2925 //int v520; // ecx@968 |
2926 //int v521; // ecx@969 | |
2927 //int v522; // eax@971 | |
488 | 2928 //__int16 v523; // ST18_2@975 |
2929 //stru6 *v524; // eax@975 | |
2930 //__int16 v525; // ST18_2@975 | |
2931 //stru6 *v526; // eax@975 | |
2932 //__int16 v527; // ST18_2@975 | |
2933 //stru6 *v528; // eax@975 | |
2934 //__int16 v529; // ST18_2@975 | |
2935 //stru6 *v530; // eax@975 | |
0 | 2936 int v531; // eax@982 |
823 | 2937 //int v532; // eax@982 |
0 | 2938 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2939 //int v534; // eax@983 |
0 | 2940 signed int v535; // eax@983 |
2941 signed int v536; // edi@983 | |
2942 stru6 *v537; // eax@984 | |
2943 int v538; // ecx@985 | |
2944 int v539; // ecx@986 | |
2945 int v540; // eax@988 | |
488 | 2946 //__int16 v541; // ST18_2@991 |
2947 //stru6 *v542; // eax@991 | |
2948 //__int16 v543; // ST18_2@991 | |
2949 //stru6 *v544; // eax@991 | |
2950 //__int16 v545; // ST18_2@991 | |
2951 //stru6 *v546; // eax@991 | |
2952 //__int16 v547; // ST18_2@991 | |
993 | 2953 //stru6 *v548; // eax@991 |
0 | 2954 double v549; // st7@991 |
2955 unsigned __int16 v550; // di@991 | |
2956 int v551; // ecx@993 | |
993 | 2957 //int v552; // ecx@994 |
89 | 2958 Player *v553; // edi@1001 |
488 | 2959 //__int16 v554; // ST18_2@1002 |
2960 //stru6 *v555; // eax@1002 | |
2961 //__int16 v556; // ST18_2@1002 | |
2962 //stru6 *v557; // eax@1002 | |
2963 //__int16 v558; // ST18_2@1002 | |
2964 //stru6 *v559; // eax@1002 | |
2965 //__int16 v560; // ST18_2@1002 | |
2966 //stru6 *v561; // eax@1002 | |
0 | 2967 unsigned __int16 v562; // di@1005 |
2968 signed int v563; // eax@1010 | |
2969 unsigned int v564; // ecx@1011 | |
2970 signed int v565; // eax@1012 | |
2971 Player **v566; // ecx@1012 | |
2972 int v567; // eax@1012 | |
488 | 2973 //unsigned __int16 v568; // ST1C_2@1012 |
2974 //__int16 v569; // ST18_2@1012 | |
2975 //stru6 *v570; // eax@1012 | |
0 | 2976 Player *v571; // eax@1013 |
2977 char *v572; // ecx@1013 | |
2978 int v573; // ecx@1017 | |
2979 int v574; // ecx@1018 | |
2980 int v575; // eax@1020 | |
2981 signed int v576; // eax@1025 | |
2982 Player *v577; // eax@1026 | |
2983 int v578; // eax@1028 | |
2984 __int16 v579; // ax@1029 | |
823 | 2985 //int v580; // eax@1031 |
0 | 2986 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2987 //int v582; // eax@1031 |
488 | 2988 //__int16 v583; // ST1C_2@1034 |
2989 //__int16 v584; // ST18_2@1034 | |
0 | 2990 char *v585; // esi@1034 |
488 | 2991 //stru6 *v586; // eax@1034 |
0 | 2992 signed int v587; // eax@1035 |
2993 int v588; // ecx@1036 | |
2994 int v589; // ecx@1037 | |
2995 int v590; // ecx@1038 | |
2996 char v591; // al@1048 | |
2997 int v592; // esi@1052 | |
2998 int v593; // ecx@1057 | |
993 | 2999 //int v594; // ecx@1058 |
823 | 3000 //int v595; // eax@1064 |
0 | 3001 int v596; // esi@1066 |
3002 unsigned int v597; // edi@1067 | |
3003 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3004 //signed int v599; // eax@1082 |
0 | 3005 int v600; // edi@1086 |
3006 int v601; // edx@1086 | |
3007 int v602; // eax@1086 | |
3008 int v603; // ecx@1086 | |
823 | 3009 //int v604; // eax@1087 |
0 | 3010 char *v605; // eax@1089 |
3011 int v606; // edx@1091 | |
3012 int v607; // ecx@1100 | |
3013 __int16 v608; // ax@1102 | |
3014 signed int v609; // eax@1104 | |
3015 int v610; // edi@1106 | |
3016 unsigned int v611; // eax@1106 | |
89 | 3017 Player *v612; // edi@1106 |
3018 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3019 int v614; // eax@1116 |
3020 int v615; // edi@1119 | |
488 | 3021 //__int16 v616; // ST1C_2@1122 |
3022 //__int16 v617; // ST18_2@1122 | |
3023 //stru6 *v618; // eax@1122 | |
112 | 3024 Player *v619; // edi@1123 |
488 | 3025 //unsigned __int16 v620; // ST1C_2@1124 |
3026 //__int16 v621; // ST18_2@1124 | |
3027 //stru6 *v622; // eax@1124 | |
0 | 3028 signed __int64 v623; // qax@1127 |
823 | 3029 //int v624; // eax@1127 |
0 | 3030 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3031 //int v626; // eax@1129 |
0 | 3032 signed int v627; // eax@1129 |
3033 signed int v628; // edi@1129 | |
3034 int v629; // ecx@1130 | |
3035 Player *v630; // eax@1131 | |
3036 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3037 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3038 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3039 //signed int v634; // eax@1140 |
0 | 3040 int v635; // edi@1142 |
488 | 3041 //unsigned __int16 v636; // ST1C_2@1142 |
3042 //__int16 v637; // ST18_2@1142 | |
3043 //stru6 *v638; // eax@1142 | |
3044 //stru6 *v639; // eax@1143 | |
0 | 3045 int v640; // ecx@1146 |
3046 int v641; // ecx@1147 | |
3047 int v642; // edi@1156 | |
3048 int v643; // eax@1156 | |
3049 int v644; // eax@1156 | |
3050 signed int v645; // eax@1158 | |
488 | 3051 //Player *v646; // ebx@1169 |
3052 //int v647; // edi@1169 | |
3053 //signed int v648; // ST1C_4@1170 | |
3054 //Player *v649; // ecx@1170 | |
3055 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3056 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3057 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3058 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3059 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3060 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3061 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3062 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3063 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3064 int v659; // [sp+0h] [bp-E84h]@123 |
3065 int v660; // [sp+0h] [bp-E84h]@146 | |
3066 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3067 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3068 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3069 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3070 int v665; // [sp+0h] [bp-E84h]@807 | |
3071 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3072 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3073 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3074 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3075 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3076 int v671; // [sp+4h] [bp-E80h]@146 |
3077 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3078 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3079 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3080 const char *v675; // [sp+4h] [bp-E80h]@800 |
3081 int v676; // [sp+4h] [bp-E80h]@807 | |
3082 int v677; // [sp+4h] [bp-E80h]@861 | |
993 | 3083 //int v678; // [sp+4h] [bp-E80h]@997 |
0 | 3084 int v679; // [sp+14h] [bp-E70h]@515 |
3085 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3086 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3087 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3088 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3089 int v684; // [sp+D04h] [bp-180h]@416 | |
3090 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3091 int x; // [sp+D20h] [bp-164h]@327 | |
3092 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3093 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3094 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3095 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3096 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3097 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3098 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3099 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3100 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3101 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3102 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3103 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3104 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3105 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3106 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3107 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3108 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3109 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3110 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3111 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3112 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3113 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3114 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3115 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
924 | 3116 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
0 | 3117 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3118 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3119 int n; // [sp+DA0h] [bp-E4h]@1 | |
3120 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3121 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3122 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3123 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3124 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3125 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3126 int v721; // [sp+DD8h] [bp-ACh]@163 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3127 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3128 int v723; // [sp+E4Ch] [bp-38h]@1 |
3129 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3130 float v725; // [sp+E54h] [bp-30h]@23 | |
3131 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3132 //int v726b; |
0 | 3133 float v727; // [sp+E5Ch] [bp-28h]@1 |
3134 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3135 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3136 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3137 Player *v730b; |
3138 ItemGen *v730c; | |
0 | 3139 int v731; // [sp+E6Ch] [bp-18h]@48 |
3140 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3141 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3142 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3143 int amount; // [sp+E80h] [bp-4h]@1 | |
3144 | |
924 | 3145 //auto ecx0 = this; |
3146 | |
3147 //v711 = ecx0; | |
3148 | |
3149 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3150 //SpriteObject::SpriteObject(&a1); |
0 | 3151 |
486 | 3152 //v1 = 0; |
0 | 3153 v2 = 0; |
3154 amount = 0; | |
3155 LODWORD(v733) = 0; | |
3156 v723 = 0; | |
3157 v727 = 0.0; | |
889 | 3158 for(n = 0; n < 10; ++n) |
0 | 3159 { |
924 | 3160 pCastSpell = &this[n]; |
3161 HIDWORD(v733) = (int)pCastSpell; | |
3162 if ( pCastSpell->spellnum == 0 ) | |
889 | 3163 continue; |
486 | 3164 |
3165 if (pParty->Invisible()) | |
3166 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3167 | |
924 | 3168 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 3169 { |
924 | 3170 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3171 this->_427D48(1); | |
889 | 3172 continue; |
0 | 3173 } |
924 | 3174 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3175 | |
3176 a2 = pCastSpell->spell_target_pid; | |
3177 if (!pCastSpell->spell_target_pid) | |
0 | 3178 { |
924 | 3179 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3180 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3181 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 3182 v666 = 1; |
3183 else | |
3184 v666 = 0; | |
3185 | |
3186 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3187 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3188 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3189 a2 = pMouse->uPointingObjectID; |
0 | 3190 } |
488 | 3191 |
3192 | |
924 | 3193 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3194 if (pSpellSprite.uType) | |
0 | 3195 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3196 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3197 { |
924 | 3198 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3199 v2 = v723; |
3200 } | |
3201 else | |
3202 { | |
3203 v715.uYawAngle = pParty->sRotationY; | |
3204 v715.uPitchAngle = pParty->sRotationX; | |
3205 } | |
3206 } | |
488 | 3207 |
486 | 3208 LODWORD(v725) = 0; |
3209 _this = 0; | |
924 | 3210 if (pCastSpell->forced_spell_skill_level) |
488 | 3211 { |
924 | 3212 v11 = pCastSpell->forced_spell_skill_level; |
993 | 3213 v723 = v11 & 0x3F; // 6 bytes |
488 | 3214 v2 = v723; |
3215 } | |
3216 else | |
0 | 3217 { |
488 | 3218 //v667 = PLAYER_SKILL_STAFF; |
924 | 3219 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 3220 v667 = PLAYER_SKILL_FIRE; |
924 | 3221 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 3222 v667 = PLAYER_SKILL_AIR; |
924 | 3223 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 3224 v667 = PLAYER_SKILL_WATER; |
924 | 3225 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 3226 v667 = PLAYER_SKILL_EARTH; |
924 | 3227 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 3228 v667 = PLAYER_SKILL_SPIRIT; |
924 | 3229 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 3230 v667 = PLAYER_SKILL_MIND; |
924 | 3231 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 3232 v667 = PLAYER_SKILL_BODY; |
924 | 3233 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 3234 v667 = PLAYER_SKILL_LIGHT; |
924 | 3235 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 3236 v667 = PLAYER_SKILL_DARK; |
924 | 3237 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 3238 v667 = PLAYER_SKILL_BOW; |
3239 else assert(false && "Unknown spell"); | |
3240 | |
0 | 3241 LODWORD(v725) = v667; |
488 | 3242 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3243 v2 = v723; | |
3244 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3245 } |
488 | 3246 |
993 | 3247 v731 = SkillToMastery(v11); |
488 | 3248 |
924 | 3249 if (pCastSpell->forced_spell_skill_level) |
486 | 3250 uRequiredMana = 0; |
488 | 3251 else |
924 | 3252 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3253 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3254 |
3255 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3256 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3257 uRequiredMana = 0; |
488 | 3258 |
924 | 3259 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3260 { | |
3261 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
3262 pCastSpell->spellnum = 0; | |
3263 continue; | |
3264 } | |
3265 v730 = pCastSpell->spellnum; | |
3266 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
3267 { | |
3268 if (!pParty->bTurnBasedModeOn) | |
3269 { | |
3270 //v646 = pPlayer; | |
3271 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3272 //v647 = n; | |
3273 } | |
3274 else | |
3275 { | |
3276 //v647 = n; | |
3277 //v646 = pPlayer; | |
3278 //v648 = sRecoveryTime; | |
3279 //v649 = pPlayer; | |
3280 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
3281 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3282 pTurnEngine->_40471C(); | |
3283 } | |
3284 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3285 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3286 this[n].spellnum = 0; | |
3287 pPlayer->sMana -= uRequiredMana; | |
3288 return; | |
3289 } | |
3290 | |
3291 switch ( pCastSpell->spellnum ) | |
3292 { | |
3293 case SPELL_101: | |
3294 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3295 case SPELL_BOW_ARROW: | |
3296 { | |
998 | 3297 //v17 = pPlayer; |
924 | 3298 _this = (ItemGen *)1; |
3299 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3300 _this = (ItemGen *)2; | |
998 | 3301 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); |
924 | 3302 pSpellSprite.stru_24.Reset(); |
3303 pSpellSprite.spell_level = v2; | |
3304 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3305 pSpellSprite.spell_skill = v731; | |
3306 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
998 | 3307 if ( pPlayer->WearsItem(510, 2) ) |
924 | 3308 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); |
3309 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3310 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3311 pSpellSprite.uAttributes = 0; | |
3312 pSpellSprite.uSpriteFrameID = 0; | |
3313 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3314 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3315 pSpellSprite.spell_target_pid = a2; | |
3316 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3317 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3318 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3319 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
3320 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
3321 pSpellSprite.uAttributes = 256; | |
3322 if ( pParty->bTurnBasedModeOn == 1 ) | |
3323 pSpellSprite.uAttributes = 260; | |
3324 for ( i = 0; i < (signed int)_this; ++i ) | |
3325 { | |
3326 if ( i ) | |
3327 pSpellSprite.vPosition.z += 32; | |
3328 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3329 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3330 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3331 ++pTurnEngine->field_1C; | |
3332 } | |
3333 break; | |
3334 } | |
3335 case SPELL_LASER_PROJECTILE: | |
3336 { | |
3337 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3338 pSpellSprite.stru_24.Reset(); | |
3339 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3340 pSpellSprite.spell_level = v723; | |
3341 pSpellSprite.spell_skill = v731; | |
3342 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3343 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3344 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3345 pSpellSprite.uAttributes = 0; | |
3346 pSpellSprite.uSpriteFrameID = 0; | |
3347 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3348 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3349 pSpellSprite.spell_target_pid = a2; | |
3350 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3351 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3352 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3353 memcpy(&pSpellSprite.stru_24, | |
3354 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3355 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3356 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3357 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3358 pSpellSprite.uSectorID = v23; | |
889 | 3359 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3360 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3361 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3362 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3363 ++pTurnEngine->field_1C; |
924 | 3364 break; |
3365 } | |
3366 case SPELL_FIRE_TORCH_LIGHT: | |
3367 { | |
889 | 3368 LODWORD(v733) = 3600 * v2; |
3369 | |
3370 switch (v731) | |
3371 { | |
890 | 3372 case 1: amount = 2; break; |
3373 case 2: amount = 3; break; | |
3374 case 3: | |
3375 case 4: amount = 4; break; | |
3376 default: | |
889 | 3377 assert(false); |
3378 } | |
3379 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3380 break; |
889 | 3381 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3382 LODWORD(v727) = 1; | |
890 | 3383 break; |
924 | 3384 } |
3385 case SPELL_FIRE_FIRE_SPIKE: | |
3386 { | |
890 | 3387 v29 = v731 - 2; |
3388 if ( v29 ) | |
3389 { | |
3390 v30 = v29 - 1; | |
3391 if ( v30 ) | |
3392 { | |
3393 if ( v30 == 1 ) | |
3394 amount = 9; | |
3395 else | |
3396 amount = 3; | |
889 | 3397 } |
3398 else | |
3399 { | |
890 | 3400 amount = 7; |
3401 } | |
3402 } | |
3403 else | |
3404 { | |
3405 amount = 5; | |
3406 } | |
3407 //v31 = v3->uPlayerID; | |
3408 //v32 = 8 * v31; | |
3409 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3410 | |
3411 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3412 int _v733 = 0; | |
3413 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3414 { | |
3415 auto object = pSpriteObjects + i; | |
924 | 3416 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
890 | 3417 ++_v733; |
3418 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3419 v730 = uNumSpriteObjects; | |
3420 do | |
3421 { | |
3422 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3423 ++HIDWORD(v733); | |
3424 v33 += 112; | |
3425 --v730; | |
3426 } | |
3427 while ( v730 );*/ | |
3428 } | |
3429 if (_v733 > amount) | |
3430 { | |
3431 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3432 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3433 pCastSpell->spellnum = 0; |
890 | 3434 continue; |
3435 } | |
3436 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3437 break; | |
924 | 3438 pSpellSprite.stru_24.Reset(); |
3439 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3440 pSpellSprite.spell_level = v2; | |
3441 pSpellSprite.spell_skill = v731; | |
3442 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3443 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3444 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3445 pSpellSprite.uAttributes = 0; | |
3446 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3447 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3448 pSpellSprite.uSpriteFrameID = 0; | |
3449 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3450 pSpellSprite.spell_target_pid = a2; | |
3451 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3452 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3453 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 3454 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3455 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3456 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3457 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 3458 ++pTurnEngine->field_1C; |
3459 LODWORD(v727) = 1; | |
3460 break; | |
924 | 3461 } |
3462 case SPELL_AIR_IMPLOSION: | |
3463 { | |
890 | 3464 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3465 break; | |
3466 if (!a2) | |
3467 { | |
3468 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3469 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3470 pCastSpell->spellnum = 0; |
890 | 3471 continue; |
3472 } | |
3473 if (PID_TYPE(a2) != OBJECT_Actor) | |
3474 { | |
889 | 3475 LODWORD(v727) = 1; |
890 | 3476 break; |
3477 } | |
3478 v697.x = 0; | |
3479 v697.y = 0; | |
3480 v697.z = 0; | |
924 | 3481 pSpellSprite.stru_24.Reset(); |
3482 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3483 pSpellSprite.spell_level = v2; | |
3484 pSpellSprite.spell_skill = v731; | |
3485 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3486 pSpellSprite.uAttributes = 0; | |
3487 pSpellSprite.uSectorID = 0; | |
3488 pSpellSprite.uSpriteFrameID = 0; | |
3489 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3490 pSpellSprite.uFacing = 0; | |
3491 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3492 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3493 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3494 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3495 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3496 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3497 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3498 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3499 LODWORD(v727) = 1; | |
3500 break; | |
924 | 3501 } |
3502 case SPELL_EARTH_MASS_DISTORTION: | |
3503 { | |
890 | 3504 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3505 break; | |
3506 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3507 { | |
3508 LODWORD(v727) = 1; | |
3509 break; | |
3510 } | |
3511 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3512 v704.x = 0; | |
3513 v704.y = 0; | |
3514 v704.z = 0; | |
924 | 3515 pSpellSprite.stru_24.Reset(); |
3516 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3517 pSpellSprite.spell_level = v2; | |
3518 pSpellSprite.spell_skill = v731; | |
3519 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3520 pSpellSprite.uAttributes = 0; | |
3521 pSpellSprite.uSectorID = 0; | |
3522 pSpellSprite.uSpriteFrameID = 0; | |
3523 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3524 pSpellSprite.uFacing = 0; | |
3525 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3526 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3527 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3528 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3529 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3530 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3531 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3532 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3533 LODWORD(v727) = 1; | |
3534 break; | |
924 | 3535 } |
3536 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3537 { | |
890 | 3538 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3539 break; | |
3540 //v730 = a2 >> 3; | |
3541 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3542 v691.x = 0; | |
3543 v691.y = 0; | |
3544 v691.z = 0; | |
924 | 3545 pSpellSprite.stru_24.Reset(); |
3546 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3547 pSpellSprite.spell_level = v2; | |
3548 pSpellSprite.spell_skill = v731; | |
3549 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3550 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3551 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3552 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3553 pSpellSprite.uAttributes = 0; | |
3554 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3555 pSpellSprite.uSpriteFrameID = 0; | |
3556 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3557 pSpellSprite.spell_target_pid = a2; | |
3558 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3559 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3560 pSpellSprite.uAttributes |= 0x80u; | |
3561 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3562 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3563 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3564 { | |
3565 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3566 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3567 pCastSpell->spellnum = 0; |
890 | 3568 continue; |
3569 } | |
3570 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3571 LODWORD(v727) = 1; | |
3572 break; | |
924 | 3573 } |
3574 case SPELL_FIRE_FIRE_BOLT: | |
3575 case SPELL_FIRE_FIREBALL: | |
3576 case SPELL_FIRE_INCINERATE: | |
3577 case SPELL_AIR_LIGHNING_BOLT: | |
3578 case SPELL_WATER_ICE_BOLT: | |
3579 case SPELL_WATER_ICE_BLAST: | |
3580 case SPELL_EARTH_STUN: | |
3581 case SPELL_EARTH_DEADLY_SWARM: | |
3582 case SPELL_MIND_MIND_BLAST: | |
3583 case SPELL_MIND_PSYCHIC_SHOCK: | |
3584 case SPELL_BODY_HARM: | |
3585 case SPELL_LIGHT_LIGHT_BOLT: | |
3586 case SPELL_DARK_DRAGON_BREATH: | |
3587 { | |
889 | 3588 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3589 break; |
924 | 3590 pSpellSprite.stru_24.Reset(); |
3591 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3592 pSpellSprite.spell_level = v2; | |
3593 pSpellSprite.spell_skill = v731; | |
3594 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3595 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3596 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3597 pSpellSprite.uAttributes = 0; | |
3598 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3599 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3600 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3601 else | |
3602 pSpellSprite.uSectorID = 0; | |
3603 pSpellSprite.uSpriteFrameID = 0; | |
3604 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3605 pSpellSprite.spell_target_pid = a2; | |
3606 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3607 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3608 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3609 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3610 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3611 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3612 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3613 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3614 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3615 ++pTurnEngine->field_1C; |
3616 LODWORD(v727) = 1; | |
890 | 3617 break; |
924 | 3618 } |
3619 case SPELL_WATER_ACID_BURST: | |
3620 case SPELL_EARTH_BLADES: | |
3621 case SPELL_BODY_FLYING_FIST: | |
3622 case SPELL_DARK_TOXIC_CLOUD: | |
3623 { | |
889 | 3624 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3625 break; |
924 | 3626 pSpellSprite.stru_24.Reset(); |
3627 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3628 pSpellSprite.spell_level = v2; | |
3629 pSpellSprite.spell_skill = v731; | |
3630 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3631 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3632 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3633 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3634 v660 = pParty->vPosition.y; | |
993 | 3635 pSpellSprite.uAttributes = 0; |
3636 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3637 pSpellSprite.vPosition.z = v51; | |
3638 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3639 pSpellSprite.uSpriteFrameID = 0; | |
3640 pSpellSprite.uSectorID = v52; | |
3641 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3642 pSpellSprite.spell_target_pid = a2; | |
3643 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3644 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3645 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3646 if ( pParty->bTurnBasedModeOn == 1 ) | |
3647 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3648 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3649 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3650 ++pTurnEngine->field_1C; | |
3651 LODWORD(v727) = 1; | |
3652 break; | |
924 | 3653 } |
3654 case SPELL_LIGHT_SUNRAY: | |
3655 { | |
889 | 3656 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
890 | 3657 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3658 { | |
3659 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3660 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3661 pCastSpell->spellnum = 0; |
890 | 3662 continue; |
889 | 3663 } |
3664 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3665 { |
3666 pSpellSprite.stru_24.Reset(); | |
3667 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3668 pSpellSprite.spell_skill = v731; | |
3669 pSpellSprite.spell_level = v2; | |
3670 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3671 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3672 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3673 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3674 v660 = pParty->vPosition.y; | |
993 | 3675 pSpellSprite.uAttributes = 0; |
3676 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3677 pSpellSprite.vPosition.z = v51; | |
3678 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3679 pSpellSprite.uSpriteFrameID = 0; | |
3680 pSpellSprite.uSectorID = v52; | |
3681 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3682 pSpellSprite.spell_target_pid = a2; | |
3683 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3684 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3685 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3686 if ( pParty->bTurnBasedModeOn == 1 ) | |
3687 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3688 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3689 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3690 ++pTurnEngine->field_1C; | |
3691 LODWORD(v727) = 1; | |
924 | 3692 } |
3693 break; | |
3694 } | |
3695 case SPELL_LIGHT_PARALYZE: | |
3696 { | |
890 | 3697 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3698 break; | |
924 | 3699 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3700 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
890 | 3701 { |
3702 LODWORD(v727) = 1; | |
3703 break; | |
3704 } | |
3705 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3706 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3707 v55 = v721; | |
3708 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3709 *(char *)(v55 + 38) |= 8u; | |
3710 *(short *)(v55 + 148) = 0; | |
3711 v672 = 0; | |
3712 *(short *)(v55 + 150) = 0; | |
3713 v661 = (Actor *)v55; | |
993 | 3714 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); |
3715 LODWORD(v727) = 1; | |
3716 break; | |
924 | 3717 } |
3718 case SPELL_EARTH_SLOW: | |
3719 { | |
889 | 3720 if ( v731 == 2 ) |
3721 { | |
890 | 3722 v57 = 300 * v2; |
993 | 3723 amount = 2; |
3724 } | |
3725 else if ( v731 == 3 ) | |
3726 { | |
889 | 3727 amount = 4; |
3728 v57 = 300 * v2; | |
993 | 3729 } |
3730 else if ( v731 == 4 ) | |
3731 { | |
889 | 3732 v57 = 300 * v2; |
3733 amount = 8; | |
993 | 3734 } |
3735 else | |
3736 { | |
890 | 3737 v57 = 180 * v2; |
993 | 3738 amount = 2; |
3739 } | |
3740 // LABEL_174: | |
889 | 3741 LODWORD(v733) = v57; |
3742 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3743 break; |
889 | 3744 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3745 || (v721 = 836 * PID_ID(a2), |
3746 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3747 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3748 { | |
3749 LODWORD(v727) = 1; | |
3750 break; | |
889 | 3751 } |
3752 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3753 v59 = v721; | |
3754 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3755 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
890 | 3756 v731, |
3757 amount, | |
3758 0, | |
3759 0); | |
889 | 3760 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3761 v672 = 0; | |
3762 v661 = (Actor *)LODWORD(v718); | |
993 | 3763 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); |
3764 LODWORD(v727) = 1; | |
3765 break; | |
924 | 3766 } |
3767 case SPELL_MIND_CHARM: | |
3768 { | |
890 | 3769 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3770 break; | |
3771 | |
3772 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3773 { | |
3774 LODWORD(v727) = 1; | |
3775 break; | |
3776 } | |
3777 | |
3778 uint power = 300 * v2; | |
3779 if ( v731 == 2 ) | |
3780 { | |
3781 power = 600 * v2; | |
3782 } | |
3783 else if ( v731 == 3 ) | |
3784 power = 29030400; | |
3785 | |
3786 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3787 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3788 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3789 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3790 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3791 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3792 v731, 0, 0, 0); | |
924 | 3793 pSpellSprite.stru_24.Reset(); |
3794 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3795 pSpellSprite.spell_level = v2; | |
3796 pSpellSprite.spell_skill = v731; | |
3797 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3798 v61 = PID_ID(a2); |
993 | 3799 v600 = pActors[v61].vPosition.y; |
3800 v601 = pActors[v61].vPosition.x; | |
3801 pSpellSprite.uObjectDescID = v60; | |
3802 pSpellSprite.vPosition.x = v601; | |
3803 v602 = pActors[v61].uActorHeight; | |
3804 v603 = pActors[v61].vPosition.z; | |
3805 pSpellSprite.vPosition.y = v600; | |
3806 v676 = v603 + v602; | |
3807 v665 = v600; | |
3808 pSpellSprite.vPosition.z = v603 + v602; | |
3809 v657 = v601; | |
3810 pSpellSprite.uAttributes = 0; | |
3811 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
3812 pSpellSprite.uSpriteFrameID = 0; | |
3813 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3814 pSpellSprite.spell_target_pid = a2; | |
3815 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3816 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3817 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
3818 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3819 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
3820 LODWORD(v727) = 1; | |
3821 break; | |
924 | 3822 } |
3823 case SPELL_DARK_SHRINKING_RAY: | |
3824 { | |
889 | 3825 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3826 break; |
924 | 3827 pSpellSprite.stru_24.Reset(); |
3828 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3829 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3830 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3831 pSpellSprite.uAttributes = 0; | |
3832 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3833 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3834 pParty->vPosition.x, |
3835 pParty->vPosition.y, | |
3836 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3837 pSpellSprite.uSpriteFrameID = 0; |
3838 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3839 pSpellSprite.spell_target_pid = a2; | |
3840 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3841 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3842 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3843 pSpellSprite.spell_skill = v731; | |
3844 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3845 pSpellSprite.spell_level = 300 * v2; | |
890 | 3846 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3847 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3848 | |
3849 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3850 | |
3851 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3852 ++pTurnEngine->field_1C; |
3853 LODWORD(v727) = 1; | |
890 | 3854 break; |
924 | 3855 } |
3856 case SPELL_FIRE_FIRE_AURA: | |
3857 { | |
889 | 3858 v63 = v731 - 1; |
3859 if ( !v63 ) | |
3860 { | |
890 | 3861 amount = 10; |
3862 LODWORD(v733) = 3600 * v2; | |
3863 } | |
3864 else | |
3865 { | |
889 | 3866 v64 = v63 - 1; |
3867 if ( !v64 ) | |
3868 { | |
890 | 3869 amount = 11; |
3870 LODWORD(v733) = 3600 * v2; | |
3871 } | |
3872 else | |
3873 { | |
889 | 3874 v65 = v64 - 1; |
3875 if ( !v65 ) | |
3876 { | |
890 | 3877 amount = 12; |
993 | 3878 // LABEL_195: |
890 | 3879 LODWORD(v733) = 3600 * v2; |
3880 } | |
3881 else if ( v65 == 1 ) | |
3882 { | |
3883 LODWORD(v733) = 0; | |
3884 amount = 12; | |
3885 } | |
3886 } | |
889 | 3887 } |
993 | 3888 // LABEL_196: |
889 | 3889 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3890 break; |
924 | 3891 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3892 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3893 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3894 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3895 && !v730c->Broken() | |
3896 && !v730c->uSpecEnchantmentType | |
3897 && !v730c->uEnchantmentType | |
3898 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3899 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3900 { | |
3901 v69 = v730c; | |
3902 v14 = v731 == 4; | |
3903 v730c->uSpecEnchantmentType = amount; | |
3904 if ( !v14 ) | |
889 | 3905 { |
890 | 3906 v69->uExpireTime = pParty->uTimePlayed |
3907 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3908 * 0.033333335); | |
3909 v69->uAttributes |= 8u; | |
889 | 3910 } |
890 | 3911 v69->uAttributes |= 0x10u; |
984 | 3912 _50C9A8_item_enchantment_timer = 256; |
890 | 3913 LODWORD(v727) = 1; |
3914 break; | |
889 | 3915 } |
3916 | |
3917 dword_50C9D0 = 113; | |
3918 dword_50C9D4 = 0; | |
3919 dword_50C9D8 = 1; | |
3920 | |
3921 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3922 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3923 pCastSpell->spellnum = 0; |
890 | 3924 continue; |
924 | 3925 } |
3926 case SPELL_BODY_REGENERATION: | |
3927 { | |
890 | 3928 v70 = v731 - 1; |
3929 LODWORD(v733) = 3600 * v2; | |
3930 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3931 { | |
3932 v72 = v71 - 1; | |
3933 if ( v72 ) | |
3934 { | |
3935 if ( v72 == 1 ) | |
3936 amount = 10; | |
889 | 3937 } |
3938 else | |
3939 { | |
890 | 3940 amount = 3; |
3941 } | |
3942 } | |
3943 else | |
3944 { | |
3945 amount = 1; | |
3946 } | |
3947 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3948 break; | |
3949 | |
924 | 3950 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3951 | |
3952 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | |
890 | 3953 LODWORD(v727) = 1; |
3954 break; | |
924 | 3955 } |
3956 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3957 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3958 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3959 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3960 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3961 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3962 { | |
3963 LODWORD(v733) = 3600 * v2; | |
993 | 3964 if ( v731 > 0 && v731 <= 4) |
3965 { | |
3966 amount = v731 * v2; | |
3967 } | |
3968 //LABEL_232: | |
924 | 3969 //v80 = v3->spellnum; |
3970 switch (pCastSpell->spellnum) | |
3971 { | |
3972 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3973 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3974 break; | |
3975 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3976 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3977 break; | |
3978 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3979 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3980 break; | |
3981 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3982 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3983 break; | |
3984 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3985 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3986 break; | |
3987 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3988 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3989 break; | |
3990 default: | |
3991 assert(false); | |
3992 continue; | |
3993 } | |
3994 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3995 break; | |
3996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3997 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3998 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3999 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4000 v90 = (double)(signed int)v733 * 4.2666669; | |
4001 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4002 LODWORD(v727) = 1; | |
4003 break; | |
4004 } | |
4005 case SPELL_FIRE_HASTE: | |
4006 { | |
993 | 4007 if ( v731 == 1 || v731 == 2 ) |
4008 { | |
4009 LODWORD(v733) = 60 * (v2 + 60); | |
4010 } | |
4011 else if ( v731 == 3 ) | |
4012 { | |
4013 LODWORD(v733) = 180 * (v2 + 20); | |
4014 } | |
4015 else if ( v731 == 4 ) | |
4016 { | |
4017 LODWORD(v733) = 240 * (v2 + 15); | |
4018 } | |
889 | 4019 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
4020 { | |
890 | 4021 v92 = pParty->pPlayers;//[0].pConditions[1]; |
4022 LODWORD(v727) = 1; | |
4023 do | |
4024 { | |
993 | 4025 if ( v92->pConditions ) |
4026 LODWORD(v727) = 0; | |
4027 ++v92; | |
890 | 4028 } |
4029 while ( v92 <= &pParty->pPlayers[3] ); | |
4030 if (LODWORD(v727)) | |
4031 { | |
993 | 4032 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4033 | |
4034 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4035 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4036 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4037 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4038 } |
4039 } | |
4040 break; | |
924 | 4041 } |
4042 case SPELL_SPIRIT_BLESS: | |
4043 { | |
993 | 4044 if ( v731 == 1 || v731 == 2 ) |
4045 { | |
4046 LODWORD(v733) = 300 * (v2 + 12); | |
4047 } | |
4048 else if ( v731 == 3 ) | |
4049 { | |
4050 LODWORD(v733) = 900 * (v2 + 4); | |
4051 } | |
4052 else if ( v731 == 4 ) | |
4053 { | |
4054 LODWORD(v733) = 3600 * (v2 + 1); | |
4055 } | |
4056 // LABEL_269: | |
889 | 4057 amount = v2 + 5; |
4058 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4059 break; |
889 | 4060 if ( v731 == 1 ) |
4061 { | |
924 | 4062 v108 = pCastSpell->uPlayerID_2; |
4063 v109 = pCastSpell->spellnum; | |
890 | 4064 v110 = pGame->GetStru6(); |
4065 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 4066 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 4067 //v668 = 0; |
4068 v716 = v111; | |
4069 //v658 = v111; | |
4070 //v653 = amount; | |
4071 //v651 = 1; | |
4072 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4073 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
889 | 4074 //LABEL_103: |
4075 //HIDWORD(v650) = HIDWORD(v28); | |
4076 //LABEL_104: | |
4077 //LODWORD(v650) = v28; | |
924 | 4078 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); |
889 | 4079 LODWORD(v727) = 1; |
890 | 4080 break; |
889 | 4081 } |
4082 v105 = 0; | |
4083 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4084 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4085 do | |
4086 { | |
924 | 4087 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 4088 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4089 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4090 ++v730b; | |
4091 ++v105; | |
889 | 4092 } |
4093 while ( v730b <= &pParty->pPlayers[3] ); | |
4094 LODWORD(v727) = 1; | |
890 | 4095 break; |
4096 } | |
4097 case SPELL_SPIRIT_SPIRIT_LASH: | |
4098 { | |
889 | 4099 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4100 { | |
890 | 4101 //v730 = a2 >> 3; |
4102 v112 = &pActors[PID_ID(a2)]; | |
4103 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4104 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4105 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4106 _this = (ItemGen *)v113; | |
4107 v114 = v721; | |
4108 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4109 if ( v113 < v721 ) | |
4110 { | |
889 | 4111 v116 = v113; |
4112 v113 = v721; | |
4113 v114 = v116; | |
890 | 4114 } |
4115 if ( v113 < (signed int)v115 ) | |
4116 { | |
889 | 4117 v117 = v113; |
4118 v113 = (int)v115; | |
4119 v115 = v117; | |
890 | 4120 } |
4121 if ( v114 < (signed int)v115 ) | |
4122 { | |
889 | 4123 v118 = v115; |
4124 v115 = v114; | |
4125 v114 = v118; | |
890 | 4126 } |
4127 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4128 if ( (double)(signed int)this <= 307.2 ) | |
4129 { | |
889 | 4130 v701.x = 0; |
4131 v701.y = 0; | |
4132 v701.z = 0; | |
924 | 4133 pSpellSprite.stru_24.Reset(); |
889 | 4134 v119 = HIDWORD(v733); |
924 | 4135 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4136 pSpellSprite.spell_level = v723; | |
4137 pSpellSprite.spell_skill = v731; | |
4138 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4139 pSpellSprite.uAttributes = 0; | |
4140 pSpellSprite.uSectorID = 0; | |
4141 pSpellSprite.uSpriteFrameID = 0; | |
4142 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4143 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4144 pSpellSprite.uFacing = 0; | |
4145 pSpellSprite.uSoundID = *(short *)(v119 + 16); | |
4146 pSpellSprite.vPosition.x = v112->vPosition.x; | |
4147 pSpellSprite.vPosition.y = v112->vPosition.y; | |
4148 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4149 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
4150 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
889 | 4151 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4152 LODWORD(v727) = 1; | |
890 | 4153 } |
4154 else | |
4155 { | |
889 | 4156 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4157 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4158 *(int *)HIDWORD(v733) = 0; | |
890 | 4159 } |
924 | 4160 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 4161 } |
4162 break; | |
4163 } | |
4164 case SPELL_AIR_SHIELD: | |
4165 case SPELL_EARTH_STONESKIN: | |
4166 case SPELL_SPIRIT_HEROISM: | |
993 | 4167 { |
4168 if( v731 == 1 || v731 == 2 ) | |
4169 { | |
4170 LODWORD(v733) = 300 * (v2 + 12); | |
4171 } | |
4172 else if ( v731 == 3 ) | |
4173 { | |
4174 LODWORD(v733) = 900 * (v2 + 4); | |
4175 } | |
4176 else if ( v731 == 4 ) | |
4177 { | |
4178 LODWORD(v733) = 3600 * (v2 + 1); | |
4179 } | |
4180 | |
4181 // LABEL_296: | |
924 | 4182 v127 = pCastSpell->spellnum; |
889 | 4183 if ( v127 == 17 ) |
4184 { | |
890 | 4185 amount = 0; |
4186 LODWORD(v725) = 14; | |
889 | 4187 } |
4188 else | |
4189 { | |
890 | 4190 if ( v127 == 38 ) |
4191 { | |
889 | 4192 LODWORD(v725) = 15; |
4193 amount = v2 + 5; | |
890 | 4194 } |
4195 else | |
4196 { | |
889 | 4197 if ( v127 != 51 ) |
890 | 4198 continue; |
889 | 4199 LODWORD(v725) = 9; |
4200 amount = v2 + 5; | |
890 | 4201 } |
889 | 4202 } |
4203 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4204 break; |
924 | 4205 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4206 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4207 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4208 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4209 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4210 //LABEL_304: | |
4211 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4212 LODWORD(v727) = 1; | |
890 | 4213 break; |
4214 } | |
4215 case SPELL_FIRE_IMMOLATION: | |
4216 { | |
993 | 4217 if ( v731 == 4 && v139 == 1 ) |
4218 LODWORD(v733) = 600 * v2; | |
889 | 4219 else |
993 | 4220 LODWORD(v733) = 60 * v2; |
889 | 4221 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4222 break; |
889 | 4223 |
924 | 4224 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4225 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4226 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4227 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4228 |
4229 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4230 LODWORD(v727) = 1; | |
890 | 4231 break; |
4232 } | |
4233 case SPELL_FIRE_METEOR_SHOWER: | |
4234 { | |
889 | 4235 v149 = v731 - 1; |
4236 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4237 { | |
890 | 4238 if ( v151 == 1 ) |
889 | 4239 _this = (ItemGen *)20; |
4240 } | |
4241 else | |
4242 { | |
890 | 4243 _this = (ItemGen *)16; |
889 | 4244 } |
4245 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4246 { | |
890 | 4247 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4248 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4249 pCastSpell->spellnum = 0; |
890 | 4250 continue; |
889 | 4251 } |
4252 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4253 break; |
889 | 4254 LODWORD(v725) = PID_TYPE(a2); |
4255 if (PID_TYPE(a2) == OBJECT_Actor) | |
4256 { | |
890 | 4257 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
4258 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4259 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4260 LODWORD(v727) = v153; | |
889 | 4261 } |
4262 else | |
4263 { | |
890 | 4264 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
4265 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4266 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4267 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4268 v154 = pParty->vPosition.z; | |
889 | 4269 } |
4270 HIDWORD(v733) = v154; | |
4271 v713 = v154 + 2500; | |
4272 v721 = 0; | |
4273 LODWORD(v718) = 0; | |
4274 if ( (signed int)_this > 0 ) | |
4275 { | |
890 | 4276 *(float *)&y = (double)SHIDWORD(v733); |
4277 *(float *)&v732 = (double)v713; | |
4278 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4279 auto _this_cpy = (int)_this; | |
4280 do | |
4281 { | |
924 | 4282 //v157 = rand(); |
889 | 4283 v158 = (double)SLODWORD(v718); |
4284 v718 = v158; | |
4285 v159 = (double)v721; | |
4286 *(float *)&v721 = v159; | |
924 | 4287 a2 = rand() % 1000; |
4288 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; | |
993 | 4289 //v725 = v159 * v159; |
889 | 4290 *(float *)&_this = v158 * v158; |
993 | 4291 //if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) |
4292 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 ) | |
889 | 4293 { |
890 | 4294 LODWORD(v687) = 0; |
4295 HIDWORD(v687) = 0; | |
889 | 4296 } |
4297 else | |
4298 { | |
993 | 4299 //x = (signed __int64)sqrt(*(float *)&_this + v725); |
4300 x = (signed __int64)sqrt(*(float *)&_this + v159 * v159); | |
890 | 4301 v687 = __PAIR__( |
4302 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4303 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
889 | 4304 } |
924 | 4305 pSpellSprite.stru_24.Reset(); |
4306 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4307 pSpellSprite.spell_level = v2; | |
4308 pSpellSprite.spell_skill = v731; | |
4309 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4310 pSpellSprite.uAttributes = 0; | |
4311 pSpellSprite.vPosition.x = uRequiredMana; | |
4312 pSpellSprite.vPosition.y = LODWORD(v727); | |
4313 pSpellSprite.uSectorID = 0; | |
4314 pSpellSprite.vPosition.z = a2 + v713; | |
4315 pSpellSprite.uSpriteFrameID = 0; | |
4316 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4317 pSpellSprite.spell_target_pid = v730; | |
4318 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4319 pSpellSprite.uFacing = v687; | |
4320 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 4321 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4322 pSpellSprite.uAttributes = 4; |
4323 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
890 | 4324 && pParty->bTurnBasedModeOn == 1 ) |
4325 ++pTurnEngine->field_1C; | |
889 | 4326 LODWORD(v718) = rand() % 1024 - 512; |
924 | 4327 //v160 = rand(); |
889 | 4328 v14 = _this_cpy-- == 1; |
924 | 4329 v721 = (unsigned __int64)(rand() % 1024) - 512; |
890 | 4330 } |
4331 while ( !v14 ); | |
889 | 4332 } |
4333 LODWORD(v727) = 1; | |
890 | 4334 break; |
4335 } | |
4336 case SPELL_FIRE_INFERNO: | |
4337 { | |
4338 //v67 = 2; | |
4339 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4340 { | |
4341 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4342 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4343 pCastSpell->spellnum = 0; |
890 | 4344 continue; |
4345 } | |
4346 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4347 break; | |
4348 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4349 v700.z = 0; | |
4350 v700.y = 0; | |
4351 v700.x = 0; | |
924 | 4352 pSpellSprite.stru_24.Reset(); |
4353 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4354 pSpellSprite.spell_level = v2; | |
4355 pSpellSprite.spell_skill = v731; | |
4356 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4357 pSpellSprite.uAttributes = 0; | |
4358 pSpellSprite.uSectorID = 0; | |
4359 pSpellSprite.uSpriteFrameID = 0; | |
4360 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4361 pSpellSprite.uFacing = 0; | |
4362 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4363 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4364 a2 = 0; |
4365 if ( (signed int)_v726 > 0 ) | |
4366 { | |
4367 do | |
4368 { | |
4369 v162 = dword_50BF30[a2]; | |
924 | 4370 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4371 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
4372 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4373 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4374 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 4375 v165 = a2; |
4376 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
924 | 4377 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
890 | 4378 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4379 a2 = v165 + 1; | |
4380 } | |
4381 while ( v165 + 1 < (signed int)_v726 ); | |
4382 } | |
4383 LODWORD(v727) = 1; | |
4384 break; | |
4385 } | |
4386 | |
4387 case SPELL_AIR_WIZARD_EYE: | |
4388 { | |
889 | 4389 LODWORD(v733) = 3600 * v2; |
4390 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4391 break; |
889 | 4392 v168 = 0; |
4393 do | |
4394 { | |
890 | 4395 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
4396 v716 = v169; | |
889 | 4397 } |
4398 while ( v168 < 4 ); | |
4399 | |
4400 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4401 LODWORD(v727) = 1; | |
890 | 4402 break; |
4403 } | |
4404 case SPELL_AIR_FEATHER_FALL: | |
4405 { | |
993 | 4406 if ( v731 == 1 ) |
4407 { | |
4408 LODWORD(v733) = 300 * v2; | |
4409 } | |
4410 else if ( v731 == 2 ) | |
4411 { | |
4412 LODWORD(v733) = 600 * v2; | |
4413 } | |
4414 else if ( v731 == 3 || v731 == 4 ) | |
4415 { | |
4416 LODWORD(v733) = 3600 * v2; | |
4417 //LABEL_353: | |
4418 //LODWORD(v733) = v173; | |
889 | 4419 } |
4420 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4421 break; |
889 | 4422 v174 = 0; |
4423 do | |
890 | 4424 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 4425 while ( v174 < 4 ); |
924 | 4426 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4427 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4428 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4429 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4430 |
4431 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4432 LODWORD(v727) = 1; | |
890 | 4433 break; |
4434 } | |
4435 case SPELL_AIR_SPARKS: | |
4436 { | |
4437 v184 = v731 - 1; | |
4438 if ( v184 ) | |
4439 { | |
4440 v185 = v184 - 1; | |
4441 if ( v185 ) | |
4442 { | |
4443 v186 = v185 - 1; | |
4444 if ( v186 ) | |
4445 { | |
4446 if ( v186 == 1 ) | |
4447 amount = 9; | |
4448 } | |
4449 else | |
4450 { | |
4451 amount = 7; | |
4452 } | |
889 | 4453 } |
4454 else | |
4455 { | |
890 | 4456 amount = 5; |
4457 } | |
4458 } | |
4459 else | |
4460 { | |
4461 amount = 3; | |
4462 } | |
4463 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4464 break; | |
4465 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
924 | 4466 pSpellSprite.stru_24.Reset(); |
4467 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4468 pSpellSprite.spell_level = v2; | |
4469 pSpellSprite.spell_skill = v731; | |
4470 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4471 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4472 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4473 pSpellSprite.uAttributes = 0; | |
4474 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4475 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 4476 pParty->vPosition.x, |
4477 pParty->vPosition.y, | |
4478 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 4479 pSpellSprite.uSpriteFrameID = 0; |
4480 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4481 pSpellSprite.spell_target_pid = a2; | |
4482 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4483 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4484 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4485 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4486 v188 = (signed int)_v726 / -2; |
4487 v189 = (signed int)_v726 / 2; | |
4488 while ( v188 <= v189 ) | |
4489 { | |
924 | 4490 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4491 if ( pSpellSprite.Create( | |
890 | 4492 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4493 v715.uPitchAngle, | |
924 | 4494 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4495 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4496 && pParty->bTurnBasedModeOn == 1 ) |
4497 ++pTurnEngine->field_1C; | |
4498 v188 += _v726 / (amount - 1); | |
4499 } | |
4500 LODWORD(v727) = 1; | |
4501 break; | |
4502 } | |
4503 | |
4504 case SPELL_AIR_JUMP: | |
4505 { | |
4506 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4507 { | |
4508 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4509 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4510 break; | |
889 | 4511 } |
4512 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4513 break; |
889 | 4514 v191 = 0; |
4515 do | |
890 | 4516 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 4517 while ( v191 < 4 ); |
4518 BYTE1(pParty->uFlags) |= 1u; | |
4519 pParty->uFallSpeed = 1000; | |
4520 LODWORD(v727) = 1; | |
890 | 4521 break; |
4522 } | |
4523 case SPELL_AIR_INVISIBILITY: | |
4524 { | |
889 | 4525 v192 = v731 - 1; |
993 | 4526 if ( v731 == 1 ) |
889 | 4527 { |
890 | 4528 amount = v2; |
993 | 4529 LODWORD(v733) = 600 * v2; |
4530 } | |
4531 else if ( v731 == 2 ) | |
889 | 4532 { |
890 | 4533 v196 = 2 * v2; |
4534 amount = v196; | |
993 | 4535 LODWORD(v733) = 600 * v2; |
4536 } | |
4537 else if ( v731 == 3 ) | |
889 | 4538 { |
890 | 4539 v196 = 3 * v2; |
924 | 4540 //goto LABEL_389; |
4541 amount = v196; | |
993 | 4542 LODWORD(v733) = 600 * v2; |
4543 } | |
4544 else if ( v731 == 4 ) | |
4545 { | |
889 | 4546 amount = 4 * v2; |
4547 v195 = 3600 * v2; | |
993 | 4548 // LABEL_392: |
889 | 4549 LODWORD(v733) = v195; |
993 | 4550 } |
4551 // LABEL_393: | |
889 | 4552 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
4553 { | |
890 | 4554 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4555 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4556 pCastSpell->spellnum = 0; |
890 | 4557 continue; |
889 | 4558 } |
4559 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4560 { | |
924 | 4561 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4562 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4563 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4564 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4565 |
4566 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4567 LODWORD(v727) = 1; | |
4568 } | |
4569 break; | |
4570 } | |
4571 case SPELL_AIR_FLY: | |
4572 { | |
4573 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4574 { | |
4575 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4576 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4577 break; | |
4578 } | |
924 | 4579 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4580 { |
4581 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4582 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4583 break; | |
4584 } | |
4585 LODWORD(v733) = 3600 * v2; | |
4586 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4587 amount = 1; | |
4588 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4589 break; | |
4590 v205 = 0; | |
4591 do | |
4592 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4593 while ( v205 < 4 ); | |
4594 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
924 | 4595 v207 = pCastSpell->uPlayerID + 1; |
890 | 4596 v716 = v206; |
4597 | |
4598 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4599 LODWORD(v727) = 1; | |
4600 break; | |
4601 } | |
4602 | |
4603 case SPELL_AIR_STARBURST: | |
4604 { | |
4605 //v67 = 2; | |
4606 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4607 { | |
4608 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4609 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4610 pCastSpell->spellnum = 0; |
890 | 4611 continue; |
4612 } | |
4613 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4614 break; | |
4615 v208 = PID_TYPE(a2); | |
4616 LODWORD(v725) = PID_TYPE(a2); | |
4617 if ( v208 == 3 ) | |
4618 { | |
4619 v209 = PID_ID(a2); | |
4620 LODWORD(v718) = pActors[v209].vPosition.x; | |
4621 v210 = pActors[v209].vPosition.y; | |
4622 v211 = pActors[v209].vPosition.z; | |
4623 v713 = v210; | |
4624 } | |
4625 else | |
4626 { | |
4627 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4628 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4629 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4630 v214 = sub_42EBBE(2048, v213); | |
4631 v211 = pParty->vPosition.z; | |
4632 v713 = pParty->vPosition.y + v214; | |
4633 v208 = LODWORD(v725); | |
4634 } | |
4635 HIDWORD(v733) = 0; | |
4636 *(float *)&v732 = (double)v211; | |
4637 LODWORD(v725) = v211 + 2500; | |
4638 v721 = 0; | |
4639 *(float *)&y = (double)(v211 + 2500); | |
4640 v730 = v208 == 3 ? a2 : 0; | |
4641 a2 = 20; | |
4642 do | |
4643 { | |
4644 v215 = rand(); | |
4645 v216 = (double)v721; | |
4646 v217 = (double)SHIDWORD(v733); | |
4647 *(float *)&uRequiredMana = v217; | |
4648 _this = (ItemGen *)(v215 % 1000); | |
4649 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4650 *(float *)&v721 = v217 * v217; | |
4651 //*(float *)&v726 = v216 * v216; | |
4652 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4653 { | |
4654 LODWORD(v685) = 0; | |
4655 HIDWORD(v685) = 0; | |
889 | 4656 } |
4657 else | |
4658 { | |
890 | 4659 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4660 v685 = __PAIR__( | |
4661 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4662 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4663 } | |
924 | 4664 pSpellSprite.stru_24.Reset(); |
4665 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4666 pSpellSprite.spell_level = v2; | |
4667 pSpellSprite.spell_skill = v731; | |
4668 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4669 pSpellSprite.uAttributes = 0; | |
4670 pSpellSprite.vPosition.x = LODWORD(v718); | |
4671 pSpellSprite.vPosition.y = v713; | |
4672 pSpellSprite.uSectorID = 0; | |
4673 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4674 pSpellSprite.uSpriteFrameID = 0; | |
4675 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4676 pSpellSprite.spell_target_pid = v730; | |
921 | 4677 //__debugbreak();//çâåçäîïàä |
924 | 4678 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4679 pSpellSprite.uFacing = v685; | |
4680 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4681 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4682 pSpellSprite.uAttributes = 4; |
4683 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4684 && pParty->bTurnBasedModeOn == 1 ) | |
4685 ++pTurnEngine->field_1C; | |
890 | 4686 v721 = rand() % 1024 - 512; |
4687 v218 = rand(); | |
4688 v14 = a2-- == 1; | |
4689 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4690 } | |
4691 while ( !v14 ); | |
4692 LODWORD(v727) = 1; | |
4693 break; | |
4694 } | |
4695 | |
4696 case SPELL_WATER_AWAKEN: | |
993 | 4697 { |
4698 if ( v731 == 1 ) | |
4699 amount = 180 * v2; | |
4700 else if ( v731 == 2) | |
4701 amount = 3600 * v2; | |
4702 else if ( v731 == 3 ) | |
4703 amount = 86400 * v2; | |
4704 else if ( v731 == 4 ) | |
4705 amount = 0; | |
4706 // LABEL_433: | |
889 | 4707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4708 break; |
4709 v222 = pParty->pPlayers; | |
4710 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4711 while ( 2 ) | |
4712 { | |
4713 if ( v731 == 4 ) | |
4714 { | |
4715 if ( v222->pConditions[2] ) | |
4716 { | |
4717 //*((int *)v222 + 4) = 0; | |
4718 //*((int *)v222 + 5) = 0; | |
4719 v222->pConditions[2] = 0; | |
4720 v222->PlaySound(SPEECH_103, 0); | |
4721 } | |
4722 } | |
4723 else | |
889 | 4724 { |
890 | 4725 v223 = v222->DiscardConditionIfLastsLongerThan( |
4726 2u, | |
4727 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4728 v222 = (Player *)HIDWORD(v733); | |
4729 if ( v223 ) | |
4730 v222->PlaySound(SPEECH_103, 0); | |
4731 } | |
4732 ++v222;// += 6972; | |
4733 HIDWORD(v733) = (int)v222; | |
4734 if ( v222 >= &pParty->pPlayers[3] ) | |
4735 { | |
4736 LODWORD(v727) = 1; | |
4737 break; | |
4738 } | |
4739 } | |
4740 } | |
4741 case SPELL_WATER_POISON_SPRAY: | |
993 | 4742 { |
4743 if ( v731 == 1 ) | |
4744 amount = 1; | |
4745 else if ( v731 == 2 ) | |
4746 amount = 3; | |
4747 else if ( v731 == 3 ) | |
890 | 4748 amount = 5; |
993 | 4749 else if ( v731 == 4 ) |
4750 amount = 7; | |
889 | 4751 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4752 break; |
4753 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4754 if ( amount == 1 ) | |
4755 { | |
924 | 4756 pSpellSprite.stru_24.Reset(); |
4757 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4758 pSpellSprite.spell_skill = v731; | |
4759 pSpellSprite.spell_level = v2; | |
4760 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4761 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4762 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4763 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4764 v660 = pParty->vPosition.y; | |
993 | 4765 // LABEL_153: |
924 | 4766 pSpellSprite.uAttributes = 0; |
4767 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4768 pSpellSprite.vPosition.z = v51; | |
890 | 4769 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4770 pSpellSprite.uSpriteFrameID = 0; |
4771 pSpellSprite.uSectorID = v52; | |
4772 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4773 pSpellSprite.spell_target_pid = a2; | |
4774 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4775 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4776 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4777 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4778 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4779 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4780 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4781 ++pTurnEngine->field_1C; | |
890 | 4782 } |
4783 else | |
4784 { | |
924 | 4785 pSpellSprite.stru_24.Reset(); |
4786 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4787 pSpellSprite.spell_level = v2; | |
4788 pSpellSprite.spell_skill = v731; | |
4789 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4790 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4791 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4792 pSpellSprite.uAttributes = 0; | |
4793 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4794 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4795 pSpellSprite.uSpriteFrameID = 0; | |
4796 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4797 pSpellSprite.spell_target_pid = a2; | |
4798 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4799 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4800 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4801 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4802 v227 = SHIDWORD(v733) / -2; |
4803 y = (char *)(SHIDWORD(v733) / 2); | |
4804 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4805 { | |
4806 v228 = v715.uYawAngle; | |
4807 do | |
4808 { | |
924 | 4809 pSpellSprite.uFacing = v227 + v228; |
4810 if ( pSpellSprite.Create( | |
890 | 4811 v227 + v228, |
4812 v715.uPitchAngle, | |
924 | 4813 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4814 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4815 && pParty->bTurnBasedModeOn == 1 ) |
4816 ++pTurnEngine->field_1C; | |
4817 v227 += SHIDWORD(v733) / (amount - 1); | |
4818 } | |
4819 while ( v227 <= (signed int)y ); | |
4820 } | |
889 | 4821 } |
4822 LODWORD(v727) = 1; | |
890 | 4823 break; |
4824 } | |
4825 case SPELL_WATER_WATER_WALK: | |
4826 { | |
924 | 4827 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4828 { |
4829 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4830 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4831 break; | |
4832 } | |
4833 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4834 v229 = 600 * v2; | |
4835 else | |
4836 v229 = 3600 * v2; | |
4837 LODWORD(v733) = v229; | |
4838 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4839 break; | |
4840 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
924 | 4841 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4842 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4843 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4844 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4845 |
4846 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4847 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4848 v731, | |
4849 amount, | |
4850 v716, | |
924 | 4851 pCastSpell->uPlayerID + 1); |
890 | 4852 if ( v731 == 4 ) |
4853 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4854 LODWORD(v727) = 1; | |
4855 break; | |
4856 } | |
4857 case SPELL_WATER_RECHARGE_ITEM: | |
4858 { | |
4859 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4860 break; | |
924 | 4861 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
890 | 4862 y = v240; |
4863 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4864 { | |
4865 dword_50C9D0 = 113; | |
4866 dword_50C9D4 = 0; | |
4867 dword_50C9D8 = 1; | |
4868 | |
4869 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4870 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4871 pCastSpell->spellnum = 0; |
890 | 4872 continue; |
4873 } | |
4874 if ( v731 == 1 || v731 == 2 ) | |
4875 { | |
4876 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4877 } | |
993 | 4878 else if ( v731 == 3 ) |
4879 { | |
890 | 4880 v241 = (double)v723 * 0.0099999998 + 0.69999999; |
993 | 4881 } |
4882 else if ( v731 == 4 ) | |
4883 { | |
890 | 4884 v241 = (double)v723 * 0.0099999998 + 0.80000001; |
993 | 4885 } |
4886 else | |
4887 { | |
4888 v241 = 0.0; | |
890 | 4889 } |
4890 if ( v241 > 1.0 ) | |
4891 v241 = 1.0; | |
993 | 4892 //LABEL_484: |
890 | 4893 v732 = (unsigned __int8)v240[25]; |
4894 v242 = (signed __int64)((double)v732 * v241); | |
4895 v243 = y; | |
4896 y[25] = v242; | |
4897 *((int *)v243 + 4) = (unsigned __int8)v242; | |
4898 if ( (unsigned __int8)v242 <= 0 ) | |
4899 { | |
4900 *(int *)v243 = 0; | |
4901 dword_50C9D0 = 113; | |
4902 dword_50C9D4 = 0; | |
4903 dword_50C9D8 = 1; | |
4904 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4905 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4906 pCastSpell->spellnum = 0; |
890 | 4907 v2 = v723; |
4908 continue; | |
4909 } | |
4910 *((int *)v243 + 5) |= 0x40u; | |
984 | 4911 _50C9A8_item_enchantment_timer = 256; |
890 | 4912 LODWORD(v727) = 1; |
4913 break; | |
4914 } | |
4915 case SPELL_WATER_ENCHANT_ITEM: | |
4916 { | |
4917 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4918 break; | |
4919 uRequiredMana = 0; | |
4920 HIDWORD(v733) = 10 * v2; | |
4921 v730 = 1; | |
924 | 4922 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 4923 if ( v731 == 1 ) |
4924 { | |
4925 v245 = (int)&v244[36 * a2 + 532]; | |
4926 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
4927 v311 = __OFSUB__(*(int *)v245, 134); | |
4928 v14 = *(int *)v245 == 134; | |
4929 v310 = *(int *)v245 - 134 < 0; | |
4930 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
4931 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
4932 { | |
4933 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
4934 { | |
4935 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
4936 { | |
4937 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
889 | 4938 { |
890 | 4939 v312 = v309[28]; |
4940 if ( v312 ) | |
4941 { | |
4942 if ( v312 != 1 ) | |
4943 { | |
4944 if ( v312 != 2 ) | |
4945 { | |
4946 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
4947 if ( !(v244[36 * a2 + 552] & 2) ) | |
4948 { | |
4949 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
4950 { | |
4951 uRequiredMana = 1; | |
4952 v730 = 0; | |
4953 } | |
4954 if ( rand() % 100 >= SHIDWORD(v733) ) | |
4955 uRequiredMana = 1; | |
4956 if (!uRequiredMana) | |
4957 { | |
4958 v313 = *(char *)(LODWORD(v725) + 28); | |
4959 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
4960 { | |
4961 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
4962 *(int *)(v245 + 4) = 0; | |
4963 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
4964 + 1]; | |
4965 ; | |
4966 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
4967 + 1] ) | |
4968 { | |
4969 ++*(int *)(v245 + 4); | |
4970 if ( j >= v314 ) | |
4971 break; | |
4972 } | |
4973 v254 = rand(); | |
4974 v255 = 10;//pItemsTable->field_116D8[17]; | |
4975 v256 = 10;//pItemsTable->field_116D8[16]; | |
993 | 4976 //LABEL_611: |
890 | 4977 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); |
993 | 4978 //LABEL_612: |
890 | 4979 _this->uItemID |= 0x20u; |
4980 | |
984 | 4981 _50C9A8_item_enchantment_timer = 256; |
890 | 4982 LODWORD(v727) = 1; |
4983 break; | |
4984 } | |
4985 } | |
993 | 4986 else |
4987 { | |
4988 //LABEL_613: | |
890 | 4989 v316 = _this->uItemID; |
4990 if ( !(BYTE1(v316) & 2) ) | |
4991 { | |
4992 LOBYTE(v316) = v316 | 2; | |
4993 _this->uItemID = v316; | |
4994 } | |
993 | 4995 } |
890 | 4996 } |
4997 } | |
4998 } | |
4999 } | |
5000 } | |
889 | 5001 } |
890 | 5002 } |
5003 } | |
993 | 5004 //LABEL_616: |
890 | 5005 if ( LODWORD(v727) == 0 ) |
5006 { | |
993 | 5007 v317 = pGlobalTXT_LocalizationStrings[428]; |
5008 if ( v730 == 0 ) | |
5009 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5010 ShowStatusBarString(v317, 2u); | |
5011 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5012 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5013 pCastSpell->spellnum = 0; | |
5014 v318->PlaySound(SPEECH_43, 0); | |
890 | 5015 } |
5016 break; | |
5017 } | |
5018 if ( v731 != 2 ) | |
5019 { | |
5020 if ( v731 == 3 ) | |
5021 { | |
993 | 5022 v245 = (int)&v244[36 * a2 + 532]; |
5023 v269 = *(int *)v245; | |
5024 if ( *(int *)v245 > 134 | |
5025 || *(int *)(v245 + 12) != 0 | |
5026 || *(int *)(v245 + 4) != 0 | |
5027 || *(int *)(v245 + 8) != 0 | |
5028 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
890 | 5029 { |
993 | 5030 if ( LODWORD(v727) == 0 ) |
5031 { | |
5032 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5033 if ( v730 == 0 ) | |
5034 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5035 ShowStatusBarString(v317, 2u); | |
5036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5037 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5038 pCastSpell->spellnum = 0; | |
5039 v318->PlaySound(SPEECH_43, 0); | |
5040 } | |
5041 break; | |
5042 } | |
5043 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5044 LODWORD(v725) = (int)v270; | |
5045 v271 = v270[28]; | |
5046 if ( v271 && v271 != 1 && v271 != 2 ) | |
5047 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5048 else | |
5049 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5050 if ( v272 ) | |
890 | 5051 { |
993 | 5052 uRequiredMana = 1; |
5053 v730 = 0; | |
5054 } | |
5055 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5056 uRequiredMana = 1; | |
5057 if (uRequiredMana) | |
5058 { | |
5059 v316 = _this->uItemID; | |
5060 if ( !(BYTE1(v316) & 2) ) | |
5061 { | |
5062 LOBYTE(v316) = v316 | 2; | |
5063 _this->uItemID = v316; | |
5064 } | |
5065 if ( LODWORD(v727) == 0 ) | |
5066 { | |
5067 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5068 if ( v730 == 0 ) | |
5069 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5070 ShowStatusBarString(v317, 2u); | |
5071 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5072 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5073 pCastSpell->spellnum = 0; | |
5074 v318->PlaySound(SPEECH_43, 0); | |
5075 } | |
890 | 5076 break; |
5077 } | |
993 | 5078 //v273 = v725; |
5079 v274 = *(char *)(LODWORD(v725) + 28); | |
5080 if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 ) | |
890 | 5081 { |
993 | 5082 if ( rand() % 100 < 80 |
5083 //&& !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5084 && !(*(char *)(LODWORD(v725) + 28) == 0 | *(char *)(LODWORD(v725) + 28) == 1 | *(char *)(LODWORD(v725) + 28) == 2) ) | |
890 | 5085 { |
993 | 5086 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
5087 *(int *)(v245 + 4) = 0; | |
5088 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5089 ; | |
5090 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5091 + 1] ) | |
5092 { | |
5093 ++*(int *)(v245 + 4); | |
5094 if ( k >= v275 ) | |
5095 break; | |
5096 } | |
5097 v254 = rand(); | |
5098 v255 = 10;//pItemsTable->field_116D8[19]; | |
5099 v256 = 10;//pItemsTable->field_116D8[18]; | |
5100 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5101 _this->uItemID |= 0x20u; | |
5102 | |
5103 _50C9A8_item_enchantment_timer = 256; | |
5104 LODWORD(v727) = 1; | |
5105 break; | |
890 | 5106 } |
993 | 5107 v277 = pItemsTable->pSpecialEnchantments_count; |
5108 v278 = 0; | |
5109 v725 = 0.0; | |
5110 HIDWORD(v733) = 0; | |
5111 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5112 { | |
5113 v730 = (int)&v679; | |
5114 do | |
5115 { | |
5116 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5117 if ( !v279 || v279 == 1 ) | |
5118 { | |
5119 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5120 + 4] | |
5121 + v278 * 28); | |
5122 LODWORD(v725) += v280; | |
5123 if ( v280 ) | |
5124 { | |
5125 v281 = v730; | |
5126 v730 += 4; | |
5127 *(int *)v281 = HIDWORD(v733); | |
5128 } | |
5129 } | |
5130 ++HIDWORD(v733); | |
5131 ++v278; | |
5132 } | |
5133 while ( SHIDWORD(v733) < v277 ); | |
5134 } | |
5135 v282 = rand() % SLODWORD(v725); | |
5136 v283 = v679; | |
5137 *(int *)(v245 + 12) = v679; | |
5138 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5139 v285 = v282 + 1; | |
5140 if ( v284 < v285 ) | |
890 | 5141 { |
5142 for ( l = &v679; ; l = (int *)v732 ) | |
5143 { | |
5144 v287 = (int)(l + 1); | |
5145 v732 = v287; | |
5146 v288 = *(int *)v287; | |
5147 *(int *)(v245 + 12) = v288; | |
5148 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5149 + 4]; | |
5150 if ( v284 >= v285 ) | |
5151 break; | |
5152 } | |
5153 } | |
993 | 5154 ++*(int *)(v245 + 12); |
5155 _this->uItemID |= 0x20u; | |
5156 | |
5157 _50C9A8_item_enchantment_timer = 256; | |
5158 LODWORD(v727) = 1; | |
5159 break; | |
5160 } | |
889 | 5161 } |
5162 else | |
5163 { | |
993 | 5164 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5165 if ( v731 != 4 | |
5166 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5167 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5168 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5169 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5170 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
890 | 5171 { |
993 | 5172 if ( LODWORD(v727) == 0 ) |
5173 { | |
5174 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5175 if ( v730 == 0 ) | |
5176 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5177 ShowStatusBarString(v317, 2u); | |
5178 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5179 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5180 pCastSpell->spellnum = 0; | |
5181 v318->PlaySound(SPEECH_43, 0); | |
5182 } | |
5183 break; | |
5184 } | |
5185 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5186 LODWORD(v725) = (int)v247; | |
5187 v248 = v247[28]; | |
5188 if ( v248 && v248 != 1 && v248 != 2 ) | |
5189 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5190 else | |
5191 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5192 if ( v249 ) | |
890 | 5193 { |
993 | 5194 uRequiredMana = 1; |
5195 v730 = 0; | |
5196 } | |
5197 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5198 uRequiredMana = 1; | |
5199 if (uRequiredMana) | |
5200 { | |
5201 v316 = _this->uItemID; | |
5202 if ( !(BYTE1(v316) & 2) ) | |
5203 { | |
5204 LOBYTE(v316) = v316 | 2; | |
5205 _this->uItemID = v316; | |
5206 } | |
5207 if ( LODWORD(v727) == 0 ) | |
5208 { | |
5209 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5210 if ( v730 == 0 ) | |
5211 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5212 ShowStatusBarString(v317, 2u); | |
5213 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5214 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5215 pCastSpell->spellnum = 0; | |
5216 v318->PlaySound(SPEECH_43, 0); | |
5217 } | |
890 | 5218 break; |
5219 } | |
993 | 5220 v250 = v725; |
5221 v251 = *(char *)(LODWORD(v725) + 28); | |
5222 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) | |
890 | 5223 { |
993 | 5224 if ( rand() % 100 < 80 |
5225 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5226 { | |
5227 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5228 *(int *)(v245 + 4) = 0; | |
5229 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5230 ; | |
5231 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5232 + 1] ) | |
890 | 5233 { |
993 | 5234 ++*(int *)(v245 + 4); |
5235 if ( m >= v252 ) | |
5236 break; | |
5237 } | |
5238 v254 = rand(); | |
5239 v255 = 10;// pItemsTable->field_116D8[21]; | |
5240 v256 = 10;//pItemsTable->field_116D8[20]; | |
5241 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5242 _this->uItemID |= 0x20u; | |
5243 | |
5244 _50C9A8_item_enchantment_timer = 256; | |
5245 LODWORD(v727) = 1; | |
5246 break; | |
5247 } | |
5248 v257 = pItemsTable->pSpecialEnchantments_count; | |
5249 v258 = 0; | |
5250 v725 = 0.0; | |
5251 HIDWORD(v733) = 0; | |
5252 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
890 | 5253 { |
993 | 5254 v730 = (int)&v679; |
5255 do | |
5256 { | |
5257 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5258 if ( !v259 || v259 == 1 ) | |
5259 { | |
5260 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5261 + 4] | |
5262 + v258 * 28); | |
5263 LODWORD(v725) += v260; | |
5264 if ( v260 ) | |
5265 { | |
5266 v261 = v730; | |
5267 v730 += 4; | |
5268 *(int *)v261 = HIDWORD(v733); | |
5269 } | |
5270 } | |
5271 ++HIDWORD(v733); | |
5272 ++v258; | |
5273 } | |
5274 while ( SHIDWORD(v733) < v257 ); | |
890 | 5275 } |
993 | 5276 v262 = rand() % SLODWORD(v725); |
5277 v263 = v679; | |
5278 *(int *)(v245 + 12) = v679; | |
5279 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5280 v265 = v262 + 1; | |
5281 if ( v264 < v265 ) | |
5282 { | |
5283 for ( ii = &v679; ; ii = (int *)v732 ) | |
5284 { | |
5285 v267 = (int)(ii + 1); | |
5286 v732 = v267; | |
5287 v268 = *(int *)v267; | |
5288 *(int *)(v245 + 12) = v268; | |
5289 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5290 + 4]; | |
5291 if ( v264 >= v265 ) | |
5292 break; | |
5293 } | |
5294 } | |
5295 ++*(int *)(v245 + 12); | |
5296 _this->uItemID |= 0x20u; | |
5297 | |
5298 _50C9A8_item_enchantment_timer = 256; | |
5299 LODWORD(v727) = 1; | |
890 | 5300 break; |
5301 } | |
5302 } | |
5303 //v1 = 0; | |
993 | 5304 if ( LODWORD(v727) == 0 ) |
5305 { | |
5306 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5307 if ( v730 == 0 ) | |
5308 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5309 ShowStatusBarString(v317, 2u); | |
5310 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5311 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5312 pCastSpell->spellnum = 0; | |
5313 v318->PlaySound(SPEECH_43, 0); | |
5314 } | |
5315 break; | |
890 | 5316 } |
5317 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5318 _this = v289; | |
5319 v290 = v289->uItemID; | |
5320 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5321 if ( v290 > 134 | |
5322 || _this->uSpecEnchantmentType != 0 | |
5323 || _this->uEnchantmentType != 0 | |
5324 || _this->_bonus_strength != 0 | |
5325 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5326 || v291 == 1 | |
5327 || v291 == 2 | |
5328 || _this->Broken()) | |
993 | 5329 { |
5330 if ( LODWORD(v727) == 0 ) | |
5331 { | |
5332 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5333 if ( v730 == 0 ) | |
5334 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5335 ShowStatusBarString(v317, 2u); | |
5336 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5337 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5338 pCastSpell->spellnum = 0; | |
5339 v318->PlaySound(SPEECH_43, 0); | |
5340 } | |
5341 break; | |
5342 } | |
890 | 5343 if ( _this->GetValue() < 0x1C2 ) |
5344 uRequiredMana = 1; | |
5345 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5346 uRequiredMana = 1; | |
5347 if ( uRequiredMana != 0 ) | |
5348 { | |
5349 dword_50C9D0 = 113; | |
5350 dword_50C9D4 = 0; | |
5351 dword_50C9D8 = 1; | |
5352 | |
5353 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5354 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5355 pCastSpell->spellnum = 0; |
890 | 5356 continue; |
5357 } | |
5358 v292 = *(char *)(LODWORD(v725) + 28); | |
5359 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5360 { | |
889 | 5361 v2 = v723; |
5362 //v1 = 0; | |
890 | 5363 |
5364 dword_50C9D0 = 113; | |
5365 dword_50C9D4 = 0; | |
5366 dword_50C9D8 = 1; | |
5367 | |
5368 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5369 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5370 pCastSpell->spellnum = 0; |
890 | 5371 continue; |
5372 } | |
5373 if ( rand() % 100 >= 80 ) | |
5374 { | |
5375 v297 = pItemsTable->pSpecialEnchantments_count; | |
5376 v294 = _this; | |
5377 v298 = 0; | |
5378 v725 = 0.0; | |
5379 HIDWORD(v733) = 0; | |
5380 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5381 { | |
5382 v730 = (int)&v679; | |
5383 do | |
5384 { | |
5385 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5386 if ( !v299 || v299 == 1 ) | |
5387 { | |
5388 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5389 + v298 * 28); | |
5390 LODWORD(v725) += v300; | |
5391 if ( v300 ) | |
5392 { | |
5393 v301 = v730; | |
5394 v730 += 4; | |
5395 *(int *)v301 = HIDWORD(v733); | |
5396 } | |
5397 } | |
5398 ++HIDWORD(v733); | |
5399 ++v298; | |
5400 } | |
5401 while ( SHIDWORD(v733) < v297 ); | |
5402 } | |
5403 v302 = rand() % SLODWORD(v725); | |
5404 v303 = v679; | |
5405 v294->uSpecEnchantmentType = v679; | |
5406 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5407 v305 = v302 + 1; | |
5408 if ( v304 < v305 ) | |
5409 { | |
5410 for ( jj = &v679; ; jj = (int *)v732 ) | |
5411 { | |
5412 v307 = (int)(jj + 1); | |
5413 v732 = v307; | |
5414 v308 = *(int *)v307; | |
5415 v294->uSpecEnchantmentType = v308; | |
5416 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5417 if ( v304 >= v305 ) | |
5418 break; | |
5419 } | |
5420 } | |
5421 ++v294->uSpecEnchantmentType; | |
5422 } | |
5423 else | |
5424 { | |
5425 v293 = rand(); | |
5426 v294 = _this; | |
5427 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5428 _this->uEnchantmentType = 0; | |
5429 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5430 ; | |
5431 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5432 + 1] ) | |
5433 { | |
5434 ++v294->uEnchantmentType; | |
5435 if ( kk >= v295 ) | |
5436 break; | |
5437 } | |
5438 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5439 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5440 } | |
5441 v294->uAttributes |= 0x20u; | |
984 | 5442 _50C9A8_item_enchantment_timer = 256; |
890 | 5443 LODWORD(v727) = 1; |
5444 break; | |
5445 } | |
5446 case SPELL_WATER_TOWN_PORTAL: | |
5447 { | |
5448 amount = 10 * v2; | |
5449 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5450 break; | |
5451 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5452 { | |
5453 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5454 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5455 pCastSpell->spellnum = 0; |
890 | 5456 continue; |
5457 } | |
924 | 5458 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
890 | 5459 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5460 LODWORD(v727) = 1; | |
5461 break; | |
5462 } | |
5463 case SPELL_WATER_LLOYDS_BEACON: | |
5464 { | |
5465 LODWORD(v733) = 604800 * v2; | |
5466 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5467 { | |
5468 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5469 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5470 pCastSpell->spellnum = 0; |
890 | 5471 continue; |
5472 } | |
5473 v319 = uRequiredMana; | |
5474 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5475 { | |
5476 pEventTimer->Pause(); | |
961 | 5477 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); |
890 | 5478 qword_506350 = (signed int)v733; |
924 | 5479 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
890 | 5480 ::uRequiredMana = v319; |
5481 ::sRecoveryTime = sRecoveryTime; | |
924 | 5482 dword_50633C = pCastSpell->sound_id; |
5483 dword_506338 = pCastSpell->spellnum; | |
5484 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
890 | 5485 } |
5486 break; | |
5487 } | |
5488 case SPELL_EARTH_STONE_TO_FLESH: | |
5489 { | |
993 | 5490 __debugbreak(); // missing GM ? |
5491 if ( v731 == 1 || v731 == 2) | |
5492 amount = 3600 * v2; | |
5493 if ( v731 == 3 ) | |
5494 amount = 86400 * v2; | |
5495 //LABEL_634: | |
890 | 5496 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5497 break; | |
924 | 5498 v323 = pCastSpell->uPlayerID_2; |
890 | 5499 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5500 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5501 { | |
5502 LODWORD(v727) = 1; | |
5503 break; | |
5504 } | |
5505 if ( v731 == 4 ) | |
5506 { | |
5507 *(int *)v324 = 0; | |
5508 *((int *)v324 + 1) = 0; | |
5509 LODWORD(v727) = 1; | |
5510 break; | |
5511 } | |
5512 v732 = amount << 7; | |
5513 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5514 v656 = 15; | |
924 | 5515 v325 = &pParty->pPlayers[v323]; |
993 | 5516 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
5517 LODWORD(v727) = 1; | |
5518 break; | |
890 | 5519 } |
5520 case SPELL_EARTH_ROCK_BLAST: | |
5521 { | |
5522 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5523 break; | |
924 | 5524 pSpellSprite.stru_24.Reset(); |
5525 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5526 pSpellSprite.spell_level = v2; | |
5527 pSpellSprite.spell_skill = v731; | |
5528 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5529 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5530 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5531 pSpellSprite.uAttributes = 0; | |
5532 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5533 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 5534 pParty->vPosition.x, |
5535 pParty->vPosition.y, | |
5536 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 5537 pSpellSprite.uSpriteFrameID = 0; |
5538 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5539 pSpellSprite.spell_target_pid = a2; | |
5540 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5541 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5542 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5543 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5544 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5545 | |
5546 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5547 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5548 ++pTurnEngine->field_1C; |
5549 LODWORD(v727) = 1; | |
5550 break; | |
5551 } | |
5552 case SPELL_EARTH_DEATH_BLOSSOM: | |
5553 { | |
5554 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5555 { | |
5556 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5557 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5558 pCastSpell->spellnum = 0; |
890 | 5559 continue; |
5560 } | |
5561 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5562 break; | |
924 | 5563 pSpellSprite.uType = 4090; |
5564 pSpellSprite.stru_24.Reset(); | |
5565 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5566 pSpellSprite.spell_level = v2; | |
5567 pSpellSprite.spell_skill = v731; | |
5568 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5569 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5570 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5571 pSpellSprite.uAttributes = 0; | |
5572 pSpellSprite.uSectorID = 0; | |
5573 pSpellSprite.uSpriteFrameID = 0; | |
5574 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5575 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5576 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5577 pSpellSprite.spell_target_pid = a2; | |
5578 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5579 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5580 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5581 pSpellSprite.uAttributes = 4; |
5582 | |
5583 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5584 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5585 ++pTurnEngine->field_1C; |
5586 LODWORD(v727) = 1; | |
5587 break; | |
5588 } | |
5589 case SPELL_SPIRIT_DETECT_LIFE: | |
5590 { | |
5591 v328 = v731 - 2; | |
5592 if ( v328 ) | |
5593 { | |
5594 v329 = v328 - 1; | |
5595 if ( v329 && v329 != 1 ) | |
5596 v330 = 600 * v2; | |
5597 else | |
5598 v330 = 3600 * v2; | |
5599 } | |
5600 else | |
5601 { | |
5602 v330 = 1800 * v2; | |
5603 } | |
5604 LODWORD(v733) = v330; | |
5605 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5606 break; | |
924 | 5607 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5608 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5609 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5610 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 5611 |
5612 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
5613 LODWORD(v727) = 1; | |
5614 break; | |
5615 } | |
5616 case SPELL_SPIRIT_FATE: | |
5617 { | |
5618 LODWORD(v733) = 300; | |
993 | 5619 if ( v731 == 1 ) |
5620 amount = v2; | |
5621 else if( v731 == 2 ) | |
5622 amount = 2 * v2; | |
5623 else if( v731 == 3 ) | |
5624 amount = 4 * v2; | |
5625 else if( v731 == 4) | |
5626 amount = 6 * v2; | |
5627 //LABEL_667: | |
890 | 5628 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5629 break; | |
924 | 5630 v342 = pCastSpell->spell_target_pid; |
890 | 5631 if ( v342 == 0 ) |
5632 { | |
924 | 5633 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5634 | |
5635 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
890 | 5636 LODWORD(v727) = 1; |
5637 break; | |
5638 } | |
5639 if (PID_TYPE(v342) == OBJECT_Actor) | |
5640 { | |
5641 v343 = PID_ID(v342); | |
5642 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5643 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5644 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5645 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5646 v672 = 0; | |
5647 v661 = &pActors[v343]; | |
993 | 5648 //LABEL_165: |
890 | 5649 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); |
5650 } | |
5651 LODWORD(v727) = 1; | |
5652 break; | |
5653 } | |
5654 case SPELL_SPIRIT_REMOVE_CURSE: | |
5655 { | |
993 | 5656 if ( v731 == 1 || v731 == 2 ) |
5657 amount = 3600 * v2; | |
5658 else if( v731 == 3) | |
5659 amount = 86400 * v2; | |
5660 else if ( v731 == 4 ) | |
890 | 5661 amount = 0; |
993 | 5662 //LABEL_679: |
890 | 5663 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5664 break; | |
924 | 5665 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5666 if ( !v351->pConditions[0] ) |
5667 { | |
5668 LODWORD(v727) = 1; | |
5669 break; | |
5670 } | |
5671 if ( v731 == 4 ) | |
5672 { | |
5673 LODWORD(v351->pConditions[0]) = 0; | |
5674 HIDWORD(v351->pConditions[0]) = 0; | |
5675 } | |
5676 else | |
5677 { | |
5678 v732 = amount << 7; | |
5679 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
924 | 5680 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
890 | 5681 { |
5682 LODWORD(v727) = 1; | |
5683 break; | |
5684 } | |
5685 } | |
924 | 5686 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 5687 LODWORD(v727) = 1; |
5688 break; | |
5689 } | |
5690 case SPELL_SPIRIT_PRESERVATION: | |
5691 { | |
5692 v354 = v731 - 2; | |
5693 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5694 v356 = 900 * (v2 + 4); | |
5695 else | |
5696 v356 = 300 * (v2 + 12); | |
5697 LODWORD(v733) = v356; | |
5698 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5699 break; | |
5700 if ( v731 == 1 || v731 == 2 ) | |
5701 { | |
924 | 5702 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5703 | |
5704 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
890 | 5705 LODWORD(v727) = 1; |
5706 break; | |
5707 } | |
5708 a2 = 0; | |
5709 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5710 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5711 do | |
5712 { | |
924 | 5713 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 5714 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5715 ++a2; | |
5716 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5717 } | |
5718 while ( v357 <= &pParty->pPlayers[3] ); | |
5719 LODWORD(v727) = 1; | |
5720 break; | |
5721 } | |
5722 case SPELL_SPIRIT_TURN_UNDEAD: | |
5723 { | |
5724 v364 = v731 - 2; | |
5725 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5726 v366 = 60 * (v2 + 3); | |
5727 else | |
5728 v366 = 300 * v2 + 180; | |
5729 LODWORD(v733) = v366; | |
5730 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5731 break; | |
5732 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5733 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
924 | 5734 ++pSpellSprite.uType; |
5735 pSpellSprite.stru_24.Reset(); | |
5736 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5737 pSpellSprite.spell_level = v2; | |
5738 pSpellSprite.spell_skill = v731; | |
5739 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5740 pSpellSprite.uAttributes = 0; | |
5741 pSpellSprite.uSectorID = 0; | |
5742 pSpellSprite.uSpriteFrameID = 0; | |
5743 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5744 pSpellSprite.uFacing = 0; | |
5745 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5746 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5747 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5748 { | |
5749 v369 = &pActors[dword_50BF30[a2]]; | |
5750 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5751 { | |
924 | 5752 pSpellSprite.vPosition.x = v369->vPosition.x; |
5753 pSpellSprite.vPosition.y = v369->vPosition.y; | |
5754 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5755 | |
5756 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5757 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 5758 v369->pActorBuffs[4].Apply( |
5759 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
889 | 5760 v731, 0, 0, 0); |
5761 } | |
890 | 5762 } |
5763 LODWORD(v727) = 1; | |
5764 } | |
5765 break; | |
5766 | |
5767 case SPELL_SPIRIT_RAISE_DEAD: | |
5768 { | |
5769 v371 = v731 - 2; | |
5770 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5771 amount = 0; | |
5772 else | |
5773 amount = 86400 * v2; | |
5774 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5775 break; | |
924 | 5776 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5777 v373 = pCastSpell->uPlayerID_2; | |
890 | 5778 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5779 { | |
5780 LODWORD(v727) = 1; | |
5781 break; | |
5782 } | |
5783 v14 = v731 == 4; | |
5784 pParty->pPlayers[v373].sHealth = 1; | |
5785 if ( v14 ) | |
5786 { | |
924 | 5787 v374 = pCastSpell->uPlayerID_2; |
890 | 5788 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5789 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
924 | 5790 v376 = pCastSpell->uPlayerID_2; |
890 | 5791 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5792 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5793 } | |
5794 else | |
5795 { | |
5796 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5797 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5798 0xEu, |
5799 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 5800 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5801 0xDu, |
5802 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5803 } | |
924 | 5804 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
993 | 5805 v377->SetCondition(1, 0); |
5806 LODWORD(v727) = 1; | |
5807 break; | |
890 | 5808 } |
5809 case SPELL_SPIRIT_SHARED_LIFE: | |
5810 { | |
5811 v378 = v731 - 2; | |
5812 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5813 v380 = 4 * v2; | |
5814 else | |
5815 v380 = 3 * v2; | |
5816 amount = v380; | |
5817 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5818 break; | |
5819 v381 = 0; | |
5820 HIDWORD(v733) = amount; | |
5821 v730 = 0; | |
5822 v382 = 1; | |
5823 do | |
5824 { | |
5825 v383 = pPlayers[v382]; | |
5826 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5827 v682[v381++] = v382; | |
5828 ++v382; | |
5829 } | |
5830 while ( v382 <= 4 ); | |
5831 v384 = 0; | |
5832 v730 = v381; | |
5833 if ( v381 > 0 ) | |
5834 { | |
5835 do | |
5836 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5837 while ( v384 < v381 ); | |
5838 } | |
5839 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5840 HIDWORD(v733) = 0; | |
5841 if ( v381 > 0 ) | |
5842 { | |
5843 do | |
5844 { | |
5845 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5846 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5847 v726->sHealth = v732; | |
5848 //v386 = v726->GetMaxHealth(); | |
5849 if ( v726->sHealth > v726->GetMaxHealth()) | |
5850 v726->sHealth = v726->GetMaxHealth(); | |
5851 if ( v726->sHealth > 0 ) | |
5852 { | |
5853 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5854 } | |
5855 v388 = HIDWORD(v733); | |
5856 | |
924 | 5857 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
890 | 5858 HIDWORD(v733) = v388 + 1; |
5859 } | |
5860 while ( v388 + 1 < v730 ); | |
5861 } | |
5862 LODWORD(v727) = 1; | |
5863 break; | |
5864 } | |
5865 case SPELL_SPIRIT_RESSURECTION: | |
5866 { | |
5867 v392 = v731 - 1; | |
993 | 5868 if ( v731 == 1 ) |
5869 amount = 180 * v2; | |
5870 else if ( v731 == 2 ) | |
5871 amount = 10800 * v2; | |
5872 else if ( v731 == 3 ) | |
5873 amount = 259200 * v2; | |
5874 else if ( v731 == 4 ) | |
890 | 5875 amount = 0; |
993 | 5876 //LABEL_751: |
890 | 5877 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5878 break; | |
924 | 5879 v396 = pCastSpell->uPlayerID_2; |
890 | 5880 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5881 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5882 { | |
5883 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5884 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5885 if ( v731 == 4 ) | |
5886 { | |
924 | 5887 v397 = pCastSpell->uPlayerID_2; |
890 | 5888 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5889 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
924 | 5890 v398 = pCastSpell->uPlayerID_2; |
890 | 5891 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5892 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
924 | 5893 v399 = pCastSpell->uPlayerID_2; |
890 | 5894 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5895 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5896 } | |
889 | 5897 else |
890 | 5898 { |
5899 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5900 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
890 | 5901 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5902 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
890 | 5903 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5904 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
890 | 5905 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5906 } | |
924 | 5907 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5908 | |
5909 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
5910 | |
5911 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 5912 } |
5913 LODWORD(v727) = 1; | |
5914 break; | |
5915 } | |
5916 case SPELL_MIND_CURE_PARALYSIS: | |
5917 { | |
993 | 5918 if ( v731 == 1 || v731 == 2 ) |
5919 amount = 3600 * v2; | |
5920 else if ( v731 == 4 ) | |
890 | 5921 amount = 0; |
993 | 5922 else if( v731 == 3 ) |
5923 amount = 86400 * v2; | |
5924 //LABEL_768: | |
890 | 5925 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5926 break; | |
5927 | |
924 | 5928 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5929 v323 = pCastSpell->uPlayerID_2; | |
890 | 5930 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5931 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5932 { | |
5933 LODWORD(v727) = 1; | |
5934 break; | |
5935 } | |
5936 if ( v731 == 4 ) | |
5937 { | |
5938 *(int *)v324 = 0; | |
5939 *((int *)v324 + 1) = 0; | |
889 | 5940 LODWORD(v727) = 1; |
890 | 5941 break; |
5942 } | |
5943 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5944 v656 = 12; | |
924 | 5945 v325 = &pParty->pPlayers[v323]; |
993 | 5946 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
5947 LODWORD(v727) = 1; | |
5948 break; | |
890 | 5949 } |
5950 case SPELL_MIND_REMOVE_FEAR: | |
993 | 5951 { |
5952 if( v731 == 1) | |
5953 amount = 180 * v2; | |
5954 else if( v731 == 2 ) | |
5955 amount = 3600 * v2; | |
5956 else if( v731 == 3) | |
5957 amount = 86400 * v2; | |
5958 else if( v731 == 4 ) | |
890 | 5959 amount = 0; |
993 | 5960 //LABEL_780: |
890 | 5961 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5962 break; | |
5963 | |
924 | 5964 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5965 v323 = pCastSpell->uPlayerID_2; | |
890 | 5966 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
5967 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
5968 { | |
5969 LODWORD(v727) = 1; | |
5970 break; | |
5971 } | |
5972 if ( v731 == 4 ) | |
5973 { | |
5974 *(int *)v324 = 0; | |
5975 *((int *)v324 + 1) = 0; | |
5976 LODWORD(v727) = 1; | |
5977 break; | |
5978 } | |
5979 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5980 v656 = 3; | |
924 | 5981 v325 = &pParty->pPlayers[v323]; |
993 | 5982 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
5983 LODWORD(v727) = 1; | |
5984 break; | |
5985 } | |
890 | 5986 case SPELL_MIND_TELEPATHY: |
993 | 5987 { |
5988 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5989 break; | |
5990 if (PID_TYPE(a2) != OBJECT_Actor) | |
5991 { | |
5992 LODWORD(v727) = 1; | |
5993 break; | |
5994 } | |
5995 v417 = (int)&pActors[PID_ID(a2)]; | |
5996 v730 = v417; | |
5997 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
5998 { | |
5999 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6000 v417 = v730; | |
6001 } | |
6002 v418 = *(int *)(v417 + 672); | |
6003 HIDWORD(v733) = 0; | |
6004 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6005 HIDWORD(v733) = *(int *)(v417 + 684); | |
6006 | |
6007 //ItemGen::ItemGen(&v683); | |
6008 v683.Reset(); | |
6009 | |
6010 v419 = *(short *)(v730 + 180); | |
6011 if (v419) | |
6012 { | |
6013 v683.uItemID = v419; | |
6014 //goto LABEL_799; | |
6015 } | |
6016 else | |
6017 { | |
6018 v420 = 0; | |
6019 v421 = v730 + 564; | |
6020 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6021 { | |
6022 ++v420; | |
6023 v421 += 36; | |
6024 if ( v420 >= 4 ) | |
6025 break; | |
6026 } | |
6027 if ( v420 < 4 ) | |
6028 { | |
6029 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6030 v2 = v723; | |
6031 //v1 = 0; | |
6032 } | |
6033 } | |
6034 // LABEL_799: | |
6035 if ( HIDWORD(v733) != 0 ) | |
6036 { | |
6037 v675 = (const char *)HIDWORD(v733); | |
6038 if (v683.uItemID) | |
6039 { | |
6040 v422 = v683.GetDisplayName(); | |
6041 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
6042 ShowStatusBarString(pTmpBuf2, 2u); | |
6043 pSpellSprite.stru_24.Reset(); | |
6044 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6045 pSpellSprite.spell_level = v2; | |
6046 pSpellSprite.spell_skill = v731; | |
6047 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6048 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6049 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6050 v676 = *(short *)(v730 + 138); | |
6051 v665 = pSpellSprite.vPosition.y; | |
6052 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6053 v657 = pSpellSprite.vPosition.x; | |
6054 } | |
6055 else | |
6056 { | |
6057 v664 = "%d gold"; | |
6058 sprintf(pTmpBuf2, v664, v675); | |
6059 ShowStatusBarString(pTmpBuf2, 2u); | |
6060 pSpellSprite.stru_24.Reset(); | |
6061 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6062 pSpellSprite.spell_level = v2; | |
6063 pSpellSprite.spell_skill = v731; | |
6064 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6065 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6066 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6067 v676 = *(short *)(v730 + 138); | |
6068 v665 = pSpellSprite.vPosition.y; | |
6069 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6070 v657 = pSpellSprite.vPosition.x; | |
6071 } | |
6072 } | |
6073 else | |
6074 { | |
6075 if (v683.uItemID) | |
6076 { | |
6077 v675 = v683.GetDisplayName(); | |
6078 v664 = "(%s)"; | |
6079 sprintf(pTmpBuf2, v664, v675); | |
6080 ShowStatusBarString(pTmpBuf2, 2u); | |
6081 pSpellSprite.stru_24.Reset(); | |
6082 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6083 pSpellSprite.spell_level = v2; | |
6084 pSpellSprite.spell_skill = v731; | |
6085 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6086 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6087 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6088 v676 = *(short *)(v730 + 138); | |
6089 v665 = pSpellSprite.vPosition.y; | |
6090 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6091 v657 = pSpellSprite.vPosition.x; | |
6092 } | |
6093 else | |
6094 { | |
6095 strcpy(pTmpBuf2, "nothing"); | |
6096 ShowStatusBarString(pTmpBuf2, 2u); | |
6097 pSpellSprite.stru_24.Reset(); | |
6098 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6099 pSpellSprite.spell_level = v2; | |
6100 pSpellSprite.spell_skill = v731; | |
6101 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6102 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6103 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6104 v676 = *(short *)(v730 + 138); | |
6105 v665 = pSpellSprite.vPosition.y; | |
6106 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6107 v657 = pSpellSprite.vPosition.x; | |
6108 } | |
6109 } | |
6110 pSpellSprite.uAttributes = 0; | |
6111 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6112 pSpellSprite.uSpriteFrameID = 0; | |
6113 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6114 pSpellSprite.spell_target_pid = a2; | |
6115 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6116 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6117 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6118 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6119 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
889 | 6120 LODWORD(v727) = 1; |
890 | 6121 break; |
6122 } | |
993 | 6123 case SPELL_MIND_BERSERK: |
6124 { | |
6125 v423 = v731 - 2; | |
6126 if ( !v423 ) | |
6127 v425 = 300 * v2; | |
6128 else | |
6129 { | |
6130 v424 = v423 - 1; | |
6131 if ( v424 ) | |
6132 { | |
6133 if ( v424 == 1 ) | |
6134 v425 = 3600 * v2; | |
6135 else | |
6136 //LABEL_813: | |
6137 v425 = 300 * v2; | |
6138 } | |
6139 else | |
6140 { | |
6141 v425 = 600 * v2; | |
6142 } | |
6143 } | |
6144 amount = v425; | |
6145 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6146 break; | |
6147 v426 = PID_ID(a2); | |
6148 if (PID_TYPE(a2) != OBJECT_Actor) | |
6149 { | |
6150 LODWORD(v727) = 1; | |
6151 break; | |
6152 } | |
6153 v730 = 836 * v426; | |
6154 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6155 { | |
6156 pActors[v426].pActorBuffs[1].Reset(); | |
6157 pActors[v426].pActorBuffs[12].Reset(); | |
6158 pActors[v426].pActorBuffs[9].Apply( | |
6159 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6160 v731, 0, 0, 0); | |
6161 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6162 } | |
924 | 6163 pSpellSprite.stru_24.Reset(); |
6164 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6165 pSpellSprite.spell_level = v2; | |
6166 pSpellSprite.spell_skill = v731; | |
993 | 6167 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6168 v61 = v426; | |
6169 v600 = pActors[v61].vPosition.y; | |
6170 v601 = pActors[v61].vPosition.x; | |
6171 pSpellSprite.uObjectDescID = v60; | |
6172 pSpellSprite.vPosition.x = v601; | |
6173 v602 = pActors[v61].uActorHeight; | |
6174 v603 = pActors[v61].vPosition.z; | |
6175 pSpellSprite.vPosition.y = v600; | |
6176 v676 = v603 + v602; | |
6177 v665 = v600; | |
6178 pSpellSprite.vPosition.z = v603 + v602; | |
6179 v657 = v601; | |
6180 pSpellSprite.uAttributes = 0; | |
6181 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6182 pSpellSprite.uSpriteFrameID = 0; | |
6183 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6184 pSpellSprite.spell_target_pid = a2; | |
6185 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6186 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6187 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6188 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6189 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6190 LODWORD(v727) = 1; |
6191 break; | |
6192 } | |
6193 case SPELL_MIND_ENSLAVE: | |
993 | 6194 { |
6195 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6196 break; | |
6197 amount = 600 * v2; | |
6198 if (PID_TYPE(a2) != OBJECT_Actor) | |
6199 { | |
6200 LODWORD(v727) = 1; | |
6201 break; | |
6202 } | |
6203 v730 = 836 * PID_ID(a2); | |
6204 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6205 break; | |
6206 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6207 { | |
6208 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6209 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6210 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6211 v731, 0, 0, 0); | |
6212 } | |
6213 pSpellSprite.stru_24.Reset(); | |
6214 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6215 pSpellSprite.spell_level = v2; | |
6216 pSpellSprite.spell_skill = v731; | |
6217 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6218 v61 = PID_ID(a2); | |
6219 v600 = pActors[v61].vPosition.y; | |
6220 v601 = pActors[v61].vPosition.x; | |
6221 pSpellSprite.uObjectDescID = v60; | |
6222 pSpellSprite.vPosition.x = v601; | |
6223 v602 = pActors[v61].uActorHeight; | |
6224 v603 = pActors[v61].vPosition.z; | |
6225 pSpellSprite.vPosition.y = v600; | |
6226 v676 = v603 + v602; | |
6227 v665 = v600; | |
6228 pSpellSprite.vPosition.z = v603 + v602; | |
6229 v657 = v601; | |
6230 pSpellSprite.uAttributes = 0; | |
6231 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6232 pSpellSprite.uSpriteFrameID = 0; | |
6233 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6234 pSpellSprite.spell_target_pid = a2; | |
6235 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6236 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6237 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6238 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6239 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6240 LODWORD(v727) = 1; |
6241 break; | |
6242 } | |
6243 case SPELL_MIND_MASS_FEAR: | |
6244 { | |
6245 v428 = v731 - 2; | |
6246 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6247 v430 = 300 * v2; | |
6248 else | |
6249 v430 = 180 * v2; | |
6250 amount = v430; | |
6251 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6252 break; | |
6253 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6254 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
924 | 6255 ++pSpellSprite.uType; |
6256 pSpellSprite.stru_24.Reset(); | |
6257 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6258 pSpellSprite.spell_level = v2; | |
6259 pSpellSprite.spell_skill = v731; | |
6260 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6261 pSpellSprite.uAttributes = 0; | |
6262 pSpellSprite.uSectorID = 0; | |
6263 pSpellSprite.uSpriteFrameID = 0; | |
6264 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6265 pSpellSprite.uFacing = 0; | |
6266 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6267 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6268 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6269 { | |
6270 v433 = &pActors[dword_50BF30[a2]]; | |
6271 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6272 break; | |
924 | 6273 pSpellSprite.vPosition.x = v433->vPosition.x; |
6274 pSpellSprite.vPosition.y = v433->vPosition.y; | |
6275 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6276 | |
6277 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6278 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6279 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6280 { | |
6281 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6282 v731, 0, 0, 0); | |
6283 } | |
6284 } | |
6285 LODWORD(v727) = 1; | |
6286 break; | |
6287 } | |
6288 | |
6289 case SPELL_MIND_CURE_INSANITY: | |
6290 { | |
6291 v435 = v731 - 2; | |
6292 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6293 amount = 0; | |
6294 else | |
6295 amount = 86400 * v2; | |
6296 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6297 break; | |
6298 | |
924 | 6299 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6300 v440 = pCastSpell->uPlayerID_2; | |
890 | 6301 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6302 { | |
6303 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6304 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6305 if ( v731 == 4 ) | |
6306 { | |
924 | 6307 v441 = pCastSpell->uPlayerID_2; |
890 | 6308 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6309 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
889 | 6310 } |
6311 else | |
6312 { | |
924 | 6313 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
890 | 6314 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6315 } | |
924 | 6316 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
993 | 6317 //LABEL_720: |
890 | 6318 v377->SetCondition(1, 0); |
6319 } | |
6320 LODWORD(v727) = 1; | |
6321 break; | |
6322 } | |
6323 case SPELL_EARTH_TELEKINESIS: | |
6324 { | |
993 | 6325 if ( v731 == 1 || v731 == 2 ) |
6326 amount = 2 * v2; | |
6327 else if( v731 == 3 ) | |
6328 amount = 3 * v2; | |
6329 else if ( v731 == 4 ) | |
6330 amount = 4 * v2; | |
890 | 6331 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6332 break; | |
6333 v445 = PID_ID(a2); | |
6334 if (PID_TYPE(a2) == OBJECT_Item) | |
6335 { | |
6336 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6337 v450 = *(int *)v449; | |
6338 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6339 { | |
6340 party_finds_gold(*((int *)v449 + 3), 0); | |
6341 viewparams->bRedrawGameUI = 1; | |
889 | 6342 } |
6343 else | |
6344 { | |
890 | 6345 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
6346 ShowStatusBarString(pTmpBuf2, 2u); | |
6347 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6348 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6349 } | |
6350 SpriteObject::OnInteraction(v445); | |
6351 } | |
6352 else | |
6353 { | |
6354 if (PID_TYPE(a2) == OBJECT_Actor) | |
6355 { | |
6356 stru_50C198.LootActor(&pActors[v445]); | |
6357 } | |
6358 else | |
6359 { | |
6360 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6361 { | |
6362 if (PID_TYPE(a2) != OBJECT_BModel) | |
6363 { | |
6364 LODWORD(v727) = 1; | |
6365 break; | |
6366 } | |
6367 dword_507CD8 = 1; | |
6368 v677 = 1; | |
6369 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6370 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6371 else | |
6372 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6373 | |
6374 EventProcessor(v446, a2, v677); | |
6375 LODWORD(v727) = 1; | |
6376 break; | |
6377 } | |
6378 v447 = &pLevelDecorations[v445]; | |
6379 dword_507CD8 = 1; | |
6380 v448 = v447->field_16_event_id; | |
6381 if (v448) | |
6382 { | |
6383 v677 = 1; | |
6384 v446 = v448; | |
6385 EventProcessor(v446, a2, v677); | |
6386 LODWORD(v727) = 1; | |
6387 break; | |
6388 } | |
6389 if ( v447->IsInteractive() ) | |
6390 { | |
6391 activeLevelDecoration = v447; | |
6392 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6393 activeLevelDecoration = NULL; | |
6394 } | |
6395 } | |
6396 } | |
6397 LODWORD(v727) = 1; | |
6398 break; | |
6399 } | |
6400 case SPELL_BODY_CURE_WEAKNESS: | |
6401 { | |
993 | 6402 if ( v731 == 1 ) |
6403 amount = 180 * v2; | |
6404 else if( v731 == 2 ) | |
6405 amount = 3600 * v2; | |
6406 else if( v731 == 3 ) | |
6407 amount = 86400 * v2; | |
6408 else if ( v731 == 4 ) | |
6409 amount = 0; | |
6410 //LABEL_883: | |
890 | 6411 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6412 break; | |
6413 | |
924 | 6414 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6415 v323 = pCastSpell->uPlayerID_2; | |
890 | 6416 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6417 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6418 { | |
889 | 6419 LODWORD(v727) = 1; |
890 | 6420 break; |
6421 } | |
6422 if ( v731 == 4 ) | |
6423 { | |
6424 *(int *)v324 = 0; | |
6425 *((int *)v324 + 1) = 0; | |
6426 LODWORD(v727) = 1; | |
6427 break; | |
6428 } | |
6429 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6430 v656 = 1; | |
6431 v325 = &pParty->pPlayers[v323]; | |
993 | 6432 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
6433 LODWORD(v727) = 1; | |
6434 break; | |
6435 } | |
890 | 6436 case SPELL_BODY_FIRST_AID: |
6437 { | |
6438 v457 = v731 - 2; | |
6439 if ( v457 ) | |
6440 { | |
6441 v458 = v457 - 1; | |
6442 if ( v458 ) | |
6443 { | |
6444 if ( v458 == 1 ) | |
6445 v459 = 5 * v2 + 5; | |
6446 else | |
6447 v459 = 2 * v2 + 5; | |
889 | 6448 } |
6449 else | |
6450 { | |
890 | 6451 v459 = 4 * v2 + 5; |
6452 } | |
6453 } | |
6454 else | |
6455 { | |
6456 v459 = 3 * v2 + 5; | |
6457 } | |
6458 amount = v459; | |
6459 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6460 break; | |
924 | 6461 v460 = pCastSpell->spell_target_pid; |
890 | 6462 if (!v460) |
6463 { | |
924 | 6464 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6465 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 6466 } |
6467 else | |
6468 { | |
6469 if (PID_TYPE(v460) == OBJECT_Actor) | |
6470 { | |
6471 v461 = &pActors[PID_ID(v460)]; | |
6472 v462 = v461->uAIState; | |
6473 v463 = v461->pMonsterInfo.uHP; | |
6474 if ( v462 != 5 ) | |
6475 { | |
6476 if ( v462 != 4 ) | |
6477 { | |
6478 if ( v462 != 19 ) | |
6479 { | |
6480 if ( v462 != 11 ) | |
6481 { | |
6482 v461->sCurrentHP += amount; | |
6483 if ( v461->sCurrentHP > v463 ) | |
6484 v461->sCurrentHP = v463; | |
6485 } | |
6486 } | |
6487 } | |
6488 } | |
6489 } | |
6490 } | |
6491 LODWORD(v727) = 1; | |
6492 break; | |
6493 } | |
6494 case SPELL_BODY_CURE_POISON: | |
6495 { | |
993 | 6496 if ( v731 == 1 || v731 == 2 ) |
6497 amount = 3600 * v2; | |
6498 else if( v731 == 3) | |
6499 amount = 86400 * v2; | |
6500 else if ( v731 == 4 ) | |
890 | 6501 amount = 0; |
993 | 6502 //LABEL_912: |
890 | 6503 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6504 break; | |
6505 | |
924 | 6506 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6507 v470 = pCastSpell->uPlayerID_2; | |
890 | 6508 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6509 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6510 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6511 { | |
6512 LODWORD(v727) = 1; | |
6513 break; | |
6514 } | |
6515 if ( v731 == 4 ) | |
6516 { | |
6517 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6518 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
924 | 6519 v471 = pCastSpell->uPlayerID_2; |
890 | 6520 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6521 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
924 | 6522 v472 = pCastSpell->uPlayerID_2; |
890 | 6523 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6524 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6525 LODWORD(v727) = 1; | |
6526 break; | |
6527 } | |
6528 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6529 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6530 6u, | |
6531 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6532 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6533 8u, |
6534 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6535 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6536 v656 = 10; | |
993 | 6537 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
6538 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6539 LODWORD(v727) = 1; | |
6540 break; | |
6541 } | |
890 | 6542 case SPELL_BODY_PROTECTION_FROM_MAGIC: |
6543 { | |
6544 amount = v2; | |
6545 LODWORD(v733) = 3600 * v2; | |
6546 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6547 break; | |
6548 | |
924 | 6549 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6550 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6551 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6552 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6553 |
6554 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6555 LODWORD(v727) = 1; | |
6556 break; | |
6557 } | |
6558 case SPELL_BODY_HAMMERHANDS: | |
6559 { | |
6560 LODWORD(v733) = 3600 * v2; | |
6561 amount = v2; | |
6562 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6563 break; | |
6564 if ( v731 == 4 ) | |
6565 { | |
924 | 6566 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6567 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6568 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6569 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6570 v732 = (int)v733 << 7; |
6571 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6572 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6573 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6574 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6575 | |
6576 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6577 LODWORD(v727) = 1; | |
6578 break; | |
6579 } | |
924 | 6580 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6581 | |
6582 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); | |
890 | 6583 LODWORD(v727) = 1; |
6584 break; | |
6585 } | |
6586 case SPELL_BODY_CURE_DISEASE: | |
6587 { | |
6588 v493 = v731 - 2; | |
6589 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6590 amount = 0; | |
6591 else | |
6592 amount = 86400 * v2; | |
6593 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6594 break; | |
6595 | |
924 | 6596 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6597 v498 = pCastSpell->uPlayerID_2; | |
890 | 6598 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6599 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6600 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6601 { | |
6602 LODWORD(v727) = 1; | |
6603 break; | |
6604 } | |
6605 if ( v731 == 4 ) | |
6606 { | |
6607 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6608 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
924 | 6609 v499 = pCastSpell->uPlayerID_2; |
890 | 6610 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6611 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
924 | 6612 v500 = pCastSpell->uPlayerID_2; |
890 | 6613 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6614 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6615 } | |
6616 else | |
6617 { | |
6618 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6619 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6620 7u, | |
6621 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6622 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6623 9u, |
6624 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6625 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6626 v656 = 11; | |
993 | 6627 //LABEL_937: |
924 | 6628 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
993 | 6629 //LABEL_641: |
890 | 6630 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
6631 } | |
6632 LODWORD(v727) = 1; | |
6633 break; | |
6634 } | |
6635 case SPELL_BODY_POWER_CURE: | |
6636 { | |
6637 amount = 5 * v2 + 10; | |
6638 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6639 break; | |
6640 v501 = pParty->pPlayers; | |
6641 int v1 = 0; | |
6642 do | |
6643 { | |
924 | 6644 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
890 | 6645 v501->Heal(amount); |
6646 ++v501; | |
6647 ++v1; | |
6648 } | |
6649 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6650 LODWORD(v727) = 1; | |
6651 break; | |
6652 } | |
6653 case SPELL_LIGHT_DISPEL_MAGIC: | |
6654 { | |
6655 sRecoveryTime -= v2; | |
6656 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6657 break; | |
6658 | |
6659 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6660 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6661 ++pSpellSprite.uType; |
890 | 6662 HIDWORD(v733) = v505; |
6663 v688.x = 0; | |
6664 v688.y = 0; | |
6665 v688.z = 0; | |
924 | 6666 pSpellSprite.stru_24.Reset(); |
6667 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6668 pSpellSprite.spell_level = v2; | |
6669 pSpellSprite.spell_skill = v731; | |
6670 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6671 pSpellSprite.uAttributes = 0; | |
6672 pSpellSprite.uSectorID = 0; | |
6673 pSpellSprite.uSpriteFrameID = 0; | |
6674 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6675 pSpellSprite.uFacing = 0; | |
6676 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6677 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6678 a2 = 0; |
6679 if ( SHIDWORD(v733) > 0 ) | |
6680 { | |
6681 do | |
6682 { | |
6683 v507 = dword_50BF30[a2]; | |
924 | 6684 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6685 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
6686 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6687 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6688 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6689 v510 = a2; |
6690 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6691 a2 = v510 + 1; | |
6692 } | |
6693 while ( v510 + 1 < SHIDWORD(v733) ); | |
6694 } | |
6695 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6696 { | |
6697 v511 = &pActors[dword_50BF30[a2]]; | |
924 | 6698 pSpellSprite.vPosition.x = v511->vPosition.x; |
6699 pSpellSprite.vPosition.y = v511->vPosition.y; | |
6700 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6701 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6702 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6703 v513 = v511->pActorBuffs; |
6704 for (int _v726 = 22; _v726 != 0; --_v726) | |
6705 { | |
6706 v513->Reset(); | |
6707 ++v513; | |
6708 } | |
6709 } | |
6710 LODWORD(v727) = 1; | |
6711 break; | |
6712 } | |
6713 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
6714 { | |
6715 v514 = v731 - 2; | |
993 | 6716 if ( v731 == 1 || v731 == 2 ) |
6717 { | |
6718 v516 = 300 * v2; | |
6719 amount = 1; | |
6720 } | |
6721 else if( v731 == 3 ) | |
6722 { | |
6723 v516 = 900 * v2; | |
6724 amount = 3; | |
6725 } | |
6726 else if ( v731 == 4 ) | |
890 | 6727 { |
6728 v516 = 900 * v2; | |
6729 amount = 5; | |
889 | 6730 } |
890 | 6731 v733 = __PAIR__(0, v516); |
6732 | |
6733 if ( (signed int)uNumActors > 0 ) | |
6734 { | |
6735 v518 = pActors;//[0].uAIState; | |
6736 auto _v726 = uNumActors; | |
889 | 6737 do |
6738 { | |
890 | 6739 v519 = v518->uAIState; |
924 | 6740 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
890 | 6741 ++HIDWORD(v733); |
6742 ++v518; | |
6743 --_v726; | |
6744 } | |
6745 while ( _v726 != 0 ); | |
6746 } | |
6747 if ( SHIDWORD(v733) >= amount ) | |
6748 { | |
6749 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6750 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6751 pCastSpell->spellnum = 0; |
890 | 6752 continue; |
6753 } | |
6754 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6755 break; | |
924 | 6756 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
890 | 6757 LODWORD(v727) = 1; |
6758 break; | |
6759 } | |
6760 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
6761 { | |
993 | 6762 if ( v731 == 1 || v731 == 2 ) |
6763 { | |
890 | 6764 LODWORD(v733) = 10800 * v2; |
993 | 6765 amount = 3 * v2 + 10; |
6766 } | |
6767 else if( v731 == 3 ) | |
890 | 6768 { |
6769 LODWORD(v733) = 14400 * v2; | |
993 | 6770 amount = 4 * v2 + 10; |
6771 } | |
6772 else if ( v731 == 4 ) | |
6773 { | |
6774 LODWORD(v733) = 18000 * v2; | |
6775 amount = 5 * v2 + 10; | |
6776 } | |
890 | 6777 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6778 break; | |
6779 | |
924 | 6780 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6781 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6782 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6783 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6784 |
6785 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6786 LODWORD(v727) = 1; | |
6787 break; | |
6788 } | |
6789 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
6790 { | |
6791 //v67 = 2; | |
6792 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6793 { | |
6794 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6795 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6796 pCastSpell->spellnum = 0; |
890 | 6797 continue; |
6798 } | |
6799 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6800 break; | |
6801 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6802 ++pSpellSprite.uType; |
890 | 6803 v694.x = 0; |
6804 v694.y = 0; | |
6805 v694.z = 0; | |
924 | 6806 pSpellSprite.stru_24.Reset(); |
6807 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6808 pSpellSprite.spell_level = v2; | |
6809 pSpellSprite.spell_skill = v731; | |
6810 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6811 pSpellSprite.uAttributes = 0; | |
6812 pSpellSprite.uSectorID = 0; | |
6813 pSpellSprite.uSpriteFrameID = 0; | |
6814 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6815 pSpellSprite.uFacing = 0; | |
6816 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6817 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6818 a2 = 0; |
6819 if ( (signed int)v531 > 0 ) | |
6820 { | |
6821 do | |
6822 { | |
6823 v533 = dword_50BF30[a2]; | |
924 | 6824 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6825 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
6826 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6827 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6828 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6829 v536 = a2; |
6830 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6831 a2 = v536 + 1; | |
6832 } | |
6833 while ( v536 + 1 < (signed int)v531 ); | |
6834 } | |
6835 v537 = pGame->GetStru6(); | |
6836 pGame->GetStru6()->_4A8BFC(); | |
889 | 6837 LODWORD(v727) = 1; |
890 | 6838 break; |
6839 } | |
6840 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6841 { | |
6842 v538 = v731 - 2; | |
6843 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6844 { | |
6845 amount = 5 * v2; | |
6846 v540 = 18000 * v2; | |
6847 } | |
6848 else | |
6849 { | |
6850 amount = 4 * v2; | |
6851 v540 = 14400 * v2; | |
6852 } | |
6853 v730 = v540; | |
6854 LODWORD(v733) = v540; | |
6855 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6856 break; | |
6857 | |
924 | 6858 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6859 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6860 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6861 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6862 |
6863 v732 = v730 << 7; | |
6864 v549 = (double)(v730 << 7) * 0.033333335; | |
6865 *((float *)&v733 + 1) = v549; | |
6866 v712 = (signed __int64)v549; | |
6867 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6868 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6869 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6870 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6871 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6872 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6873 v550 = v2 + 5; | |
6874 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6875 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6876 v731, | |
6877 v550, 0, 0); | |
6878 | |
6879 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6880 LODWORD(v727) = 1; | |
6881 break; | |
6882 } | |
6883 | |
6884 case SPELL_LIGHT_HOUR_OF_POWER: | |
6885 { | |
6886 v551 = v731 - 2; | |
993 | 6887 if ( v731 == 1 || v731 == 2 ) |
6888 { | |
6889 HIDWORD(v733) = 4; | |
6890 amount = 4; | |
6891 } | |
6892 else if( v731 == 3 ) | |
6893 { | |
6894 HIDWORD(v733) = 12; | |
6895 amount = 12; | |
6896 } | |
6897 else if( v731 == 4 ) | |
6898 { | |
890 | 6899 amount = 15; |
6900 HIDWORD(v733) = 20; | |
993 | 6901 } |
6902 //LABEL_1000: | |
890 | 6903 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6904 break; | |
6905 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6906 v732 = (300 * amount * v2 + 60) << 7; | |
6907 v730 = v2 + 5; | |
6908 int _v726 = 0; | |
6909 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6910 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6911 do | |
6912 { | |
924 | 6913 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6915 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6916 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 6917 |
890 | 6918 //((SpellBuff *)(v553 + 6056))->Apply( |
6919 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6920 if ( *(_QWORD *)v553 ) | |
6921 _v726 = 1; | |
6922 ++v553; | |
6923 } | |
6924 while ( v553 <= &pParty->pPlayers[3] ); | |
6925 v562 = v731; | |
6926 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6927 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6928 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6929 if (!_v726) | |
6930 { | |
6931 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0); | |
6932 } | |
6933 LODWORD(v727) = 1; | |
6934 break; | |
6935 } | |
6936 | |
6937 | |
6938 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
6939 { | |
6940 amount = 3; | |
6941 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6942 { | |
6943 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6944 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6945 pCastSpell->spellnum = 0; |
890 | 6946 continue; |
6947 } | |
6948 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6949 break; | |
6950 a2 = 0; | |
6951 _this = (ItemGen *)&pPlayers[1]; | |
6952 do | |
6953 { | |
6954 v563 = 0; | |
889 | 6955 do |
6956 { | |
890 | 6957 v564 = _this->uItemID; |
6958 *(int *)(v563 + _this->uItemID) = 0; | |
6959 v563 += 8; | |
6960 *(int *)(v563 + v564 - 4) = 0; | |
6961 } | |
6962 while ( v563 <= 128 ); | |
6963 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6964 v566 = (Player **)_this; | |
6965 *(int *)(_this->uItemID + 6460) = v565; | |
6966 v567 = (*v566)->GetMaxMana(); | |
6967 *(int *)(_this->uItemID + 6464) = v567; | |
924 | 6968 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 6969 ++a2; |
6970 _this = (ItemGen *)((char *)_this + 4); | |
6971 } | |
6972 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6973 v571 = pPlayer; | |
6974 v572 = (char *)&pPlayer->sAgeModifier; | |
6975 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
6976 *(short *)v572 = 120; | |
6977 else | |
6978 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
6979 sRecoveryTime += -5 * v2; | |
6980 ++v571->uNumDivineInterventionCastsThisDay; | |
6981 LODWORD(v727) = 1; | |
6982 break; | |
6983 } | |
6984 case SPELL_DARK_REANIMATE: | |
6985 { | |
6986 v573 = v731 - 2; | |
6987 if ( v573 ) | |
6988 { | |
6989 v574 = v573 - 1; | |
6990 if ( v574 ) | |
6991 { | |
6992 if ( v574 == 1 ) | |
6993 v575 = 5 * v2; | |
889 | 6994 else |
890 | 6995 v575 = 2 * v2; |
889 | 6996 } |
6997 else | |
6998 { | |
890 | 6999 v575 = 4 * v2; |
7000 } | |
7001 } | |
7002 else | |
7003 { | |
7004 v575 = 3 * v2; | |
7005 } | |
7006 amount = v575; | |
7007 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7008 break; | |
924 | 7009 v576 = pCastSpell->spell_target_pid; |
890 | 7010 if (!v576) |
7011 { | |
924 | 7012 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7013 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 7014 if ( *((_QWORD *)v585 + 14) ) |
7015 { | |
7016 ((Player *)v585)->SetCondition(0x11u, 1); | |
7017 v587 = ((Player *)v585)->GetSexByVoice(); | |
924 | 7018 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
890 | 7019 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7020 } | |
7021 break; | |
7022 } | |
7023 v577 = (Player *)(PID_ID(v576)); | |
7024 //v726 = v577; | |
7025 if ( v577 == (Player *)-1 ) | |
7026 { | |
7027 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7028 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7029 pCastSpell->spellnum = 0; |
890 | 7030 continue; |
7031 } | |
7032 v578 = (int)&pActors[(int)v577]; | |
7033 v721 = v578; | |
7034 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7035 { | |
7036 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7037 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7038 pCastSpell->spellnum = 0; |
890 | 7039 continue; |
7040 } | |
924 | 7041 ++pSpellSprite.uType; |
7042 pSpellSprite.stru_24.Reset(); | |
7043 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7044 pSpellSprite.spell_level = v2; | |
7045 pSpellSprite.spell_skill = v731; | |
7046 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7047 pSpellSprite.uAttributes = 0; | |
7048 pSpellSprite.uSectorID = 0; | |
7049 pSpellSprite.uSpriteFrameID = 0; | |
7050 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
890 | 7051 v581 = v721; |
924 | 7052 pSpellSprite.uFacing = 0; |
7053 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7054 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7055 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
7056 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
890 | 7057 v732 = *(short *)(v721 + 138); |
924 | 7058 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7059 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7060 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7061 if ( *(char *)(v581 + 52) > amount ) |
7062 break; | |
7063 Actor::Resurrect((unsigned int)v577); | |
7064 *(char *)(v581 + 61) = 0; | |
7065 *(char *)(v581 + 53) = 0; | |
7066 *(char *)(v581 + 54) = 0; | |
7067 *(char *)(v581 + 55) = 0; | |
7068 *(char *)(v581 + 56) = 0; | |
7069 *(char *)(v581 + 57) = 0; | |
7070 *(int *)(v581 + 712) = 9999; | |
7071 *(char *)(v581 + 38) &= 0xF7u; | |
7072 *(int *)(v581 + 708) = 0; | |
7073 ((SpellBuff *)(v581 + 356))->Reset(); | |
7074 ((SpellBuff *)(v581 + 228))->Reset(); | |
7075 ((SpellBuff *)(v581 + 404))->Reset(); | |
7076 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7077 *(short *)(v581 + 40) = 10 * amount; | |
889 | 7078 LODWORD(v727) = 1; |
890 | 7079 break; |
7080 } | |
7081 case SPELL_DARK_VAMPIRIC_WEAPON: | |
7082 { | |
7083 v588 = v731 - 1; | |
7084 amount = 16; | |
7085 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7086 { | |
7087 if ( v590 == 1 ) | |
7088 LODWORD(v733) = 0; | |
7089 } | |
7090 else | |
7091 { | |
7092 LODWORD(v733) = 3600 * v2; | |
7093 } | |
7094 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7095 break; | |
7096 __debugbreak(); | |
924 | 7097 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
890 | 7098 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7099 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7100 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7101 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7102 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7103 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7104 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7105 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7106 { | |
7107 dword_50C9D0 = 113; | |
7108 dword_50C9D4 = 0; | |
7109 dword_50C9D8 = 1; | |
7110 | |
7111 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7112 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7113 pCastSpell->spellnum = 0; |
890 | 7114 continue; |
7115 } | |
7116 v592 = HIDWORD(v733); | |
7117 v14 = v731 == 4; | |
7118 *(int *)(HIDWORD(v733) + 12) = 16; | |
7119 if ( !v14 ) | |
7120 { | |
7121 v732 = (int)v733 << 7; | |
7122 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7123 *(int *)(v592 + 20) |= 8u; | |
7124 } | |
7125 *(char *)(v592 + 20) |= 0x80u; | |
984 | 7126 _50C9A8_item_enchantment_timer = 256; |
890 | 7127 LODWORD(v727) = 1; |
7128 break; | |
7129 } | |
7130 case SPELL_DARK_SHARPMETAL: | |
7131 { | |
7132 v593 = v731 - 2; | |
993 | 7133 if( v731 == 1 || v731 == 2 ) |
7134 amount = 5; | |
7135 else if( v731 == 3 ) | |
7136 amount = 7; | |
7137 else if( v731 == 4 ) | |
890 | 7138 amount = 9; |
7139 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7140 break; | |
7141 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
924 | 7142 pSpellSprite.stru_24.Reset(); |
7143 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7144 pSpellSprite.spell_level = v2; | |
7145 pSpellSprite.spell_skill = v731; | |
7146 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7147 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
7148 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
7149 pSpellSprite.uAttributes = 0; | |
7150 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7151 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 7152 pParty->vPosition.x, |
7153 pParty->vPosition.y, | |
7154 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
924 | 7155 pSpellSprite.uSpriteFrameID = 0; |
7156 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7157 pSpellSprite.spell_target_pid = a2; | |
7158 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7159 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7160 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 7161 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 7162 v596 = (signed int)_v726 / -2; |
7163 y = (char *)((signed int)_v726 / 2); | |
7164 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7165 { | |
7166 v597 = v715.uYawAngle; | |
889 | 7167 do |
7168 { | |
924 | 7169 pSpellSprite.uFacing = v596 + v597; |
7170 if ( pSpellSprite.Create( | |
890 | 7171 v596 + v597, |
7172 v715.uPitchAngle, | |
924 | 7173 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7174 pCastSpell->uPlayerID + 1) != -1 | |
890 | 7175 && pParty->bTurnBasedModeOn == 1 ) |
7176 ++pTurnEngine->field_1C; | |
7177 v596 += _v726 / (amount - 1); | |
7178 } | |
7179 while ( v596 <= (signed int)y ); | |
7180 } | |
7181 LODWORD(v727) = 1; | |
7182 break; | |
7183 } | |
7184 | |
7185 case SPELL_DARK_CONTROL_UNDEAD: | |
993 | 7186 { |
7187 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7188 break; | |
7189 if ( v731 == 1 || v731 == 2 ) | |
7190 { | |
7191 v598 = 180 * v2; | |
7192 LODWORD(v733) = v598; | |
7193 } | |
7194 else if ( v731 == 3 ) | |
7195 { | |
7196 v598 = 300 * v2; | |
7197 LODWORD(v733) = v598; | |
7198 } | |
7199 else if ( v731 == 4 ) | |
7200 LODWORD(v733) = 29030400; | |
7201 // LABEL_1082: | |
7202 if (PID_TYPE(a2) != OBJECT_Actor) | |
7203 { | |
7204 LODWORD(v727) = 1; | |
7205 break; | |
7206 } | |
7207 v730 = 836 * PID_ID(a2); | |
7208 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7209 break; | |
7210 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7211 { | |
7212 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7213 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7214 pCastSpell->spellnum = 0; | |
7215 continue; | |
7216 } | |
7217 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7218 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7219 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7220 v731, 0, 0, 0); | |
7221 pSpellSprite.stru_24.Reset(); | |
7222 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7223 pSpellSprite.spell_level = v2; | |
7224 pSpellSprite.spell_skill = v731; | |
7225 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7226 v61 = PID_ID(a2); | |
7227 // LABEL_1086: | |
7228 v600 = pActors[v61].vPosition.y; | |
7229 v601 = pActors[v61].vPosition.x; | |
7230 pSpellSprite.uObjectDescID = v60; | |
7231 pSpellSprite.vPosition.x = v601; | |
7232 v602 = pActors[v61].uActorHeight; | |
7233 v603 = pActors[v61].vPosition.z; | |
7234 pSpellSprite.vPosition.y = v600; | |
7235 v676 = v603 + v602; | |
7236 v665 = v600; | |
7237 pSpellSprite.vPosition.z = v603 + v602; | |
7238 v657 = v601; | |
7239 // LABEL_1087: | |
7240 pSpellSprite.uAttributes = 0; | |
7241 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7242 pSpellSprite.uSpriteFrameID = 0; | |
7243 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7244 pSpellSprite.spell_target_pid = a2; | |
7245 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7246 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
7247 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
7248 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7249 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 7250 LODWORD(v727) = 1; |
7251 break; | |
7252 } | |
7253 case SPELL_DARK_SACRIFICE: | |
993 | 7254 { |
7255 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7256 break; | |
7257 HIDWORD(v733) = 0; | |
7258 memset(&achieved_awards, 0, 4000); | |
7259 _this = 0; | |
7260 v605 = (char *)pParty->pHirelings; | |
889 | 7261 do |
7262 { | |
993 | 7263 if ( *(int *)v605) |
7264 { | |
7265 v606 = HIDWORD(v733)++; | |
7266 achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); | |
7267 } | |
7268 _this = (ItemGen *)((char *)_this + 1); | |
7269 v605 += 76; | |
7270 } | |
7271 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7272 _this = 0; | |
7273 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7274 { | |
7275 v730 = (int)pNPCStats->pNewNPCData; | |
7276 __debugbreak(); // data offset | |
7277 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
7278 do | |
7279 { | |
7280 if ( *(char *)(v730 + 8) & 0x80 | |
7281 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7282 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7283 { | |
7284 v607 = HIDWORD(v733); | |
7285 HIDWORD(v733) += 4; | |
7286 *(int *)v607 = (int)_this + 3; | |
7287 } | |
7288 _this = (ItemGen *)((char *)_this + 1); | |
7289 v730 += 76; | |
7290 } | |
7291 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7292 } | |
7293 v608 = pCastSpell->uPlayerID_2; | |
7294 if ( v608 != 4 && v608 != 5 | |
7295 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7296 || v609 >= 3 ) | |
7297 { | |
7298 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7299 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7300 pCastSpell->spellnum = 0; | |
7301 continue; | |
7302 } | |
7303 v610 = 76 * v609; | |
7304 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7305 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7306 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7307 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7308 v612 = pParty->pPlayers; | |
7309 do | |
7310 { | |
7311 v612->sHealth = v612->GetMaxHealth(); | |
7312 v612->sMana = v612->GetMaxMana(); | |
7313 ++v612; | |
7314 } | |
7315 while ( v612 <= &pParty->pPlayers[3] ); | |
7316 v613 = &pOutdoor->ddm; | |
7317 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7318 v613 = &pIndoor->dlv; | |
7319 v613->uReputation += 15; | |
7320 if ( v613->uReputation > 10000 ) | |
7321 v613->uReputation = 10000; | |
890 | 7322 LODWORD(v727) = 1; |
7323 break; | |
7324 } | |
993 | 7325 case SPELL_DARK_PAIN_REFLECTION: |
7326 { | |
7327 if ( v731 > 0 && v731 <= 4 ) | |
7328 { | |
7329 if ( v731 <= 3 ) | |
7330 { | |
7331 v614 = 300 * (v2 + 12); | |
7332 } | |
7333 if ( v731 == 4 ) | |
7334 { | |
7335 v614 = 900 * (v2 + 4); | |
7336 } | |
7337 LODWORD(v733) = v614; | |
7338 } | |
7339 v615 = v2 + 5; | |
7340 amount = v615; | |
7341 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7342 break; | |
7343 if ( v731 != 3 && v731 != 4 ) | |
7344 { | |
7345 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
7346 | |
7347 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); | |
7348 LODWORD(v727) = 1; | |
7349 break; | |
7350 } | |
7351 a2 = 0; | |
7352 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7353 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
889 | 7354 do |
7355 { | |
993 | 7356 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
7357 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
7358 ++a2; | |
7359 ++v619; | |
7360 } | |
7361 while ( v619 <= &pParty->pPlayers[3] ); | |
7362 LODWORD(v727) = 1; | |
7363 break; | |
7364 } | |
7365 case SPELL_DARK_SOULDRINKER: | |
7366 { | |
7367 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7368 break; | |
7369 pGame->GetIndoorCamera(); | |
7370 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7371 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7372 v707.x = 0; | |
7373 v707.y = 0; | |
7374 v707.z = 0; | |
7375 pSpellSprite.stru_24.Reset(); | |
7376 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7377 pSpellSprite.spell_level = v2; | |
7378 pSpellSprite.spell_skill = v731; | |
7379 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7380 pSpellSprite.uAttributes = 0; | |
7381 pSpellSprite.uSectorID = 0; | |
7382 pSpellSprite.uSpriteFrameID = 0; | |
7383 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
7384 pSpellSprite.uFacing = 0; | |
7385 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7386 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7387 a2 = 0; | |
7388 int _v726 = 0; | |
7389 if ( SHIDWORD(v733) > 0 ) | |
7390 { | |
7391 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
7392 do | |
7393 { | |
7394 v625 = dword_50BF30[a2]; | |
7395 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; | |
7396 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
7397 //v732 = pActors[v625].uActorHeight; | |
7398 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
7399 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7400 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
7401 v628 = a2; | |
7402 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7403 a2 = v628 + 1; | |
7404 } | |
7405 while ( v628 + 1 < SHIDWORD(v733) ); | |
7406 } | |
7407 v730 = 0; | |
7408 v629 = 1; | |
890 | 7409 do |
7410 { | |
993 | 7411 v630 = pPlayers[v629]; |
7412 if ( !v630->pConditions[2] | |
7413 && !v630->pConditions[12] | |
7414 && !v630->pConditions[13] | |
7415 && !v630->pConditions[14] | |
7416 && !v630->pConditions[15] | |
7417 && !v630->pConditions[16] ) | |
7418 { | |
7419 v631 = v730++; | |
7420 v681[v631] = v629; | |
7421 } | |
7422 ++v629; | |
7423 } | |
7424 while ( v629 <= 4 ); | |
7425 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7426 HIDWORD(v733) = 0; | |
7427 if ( v730 > 0 ) | |
7428 { | |
7429 do | |
7430 { | |
7431 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7432 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7433 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7434 v726->sHealth += v732; | |
7435 //v726 = *(Player **)v632; | |
7436 //v634 = v726->GetMaxHealth(); | |
7437 if ( v726->sHealth > v726->GetMaxHealth()) | |
7438 v726->sHealth = v726->GetMaxHealth(); | |
7439 v635 = HIDWORD(v733); | |
7440 | |
7441 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); | |
7442 HIDWORD(v733) = v635 + 1; | |
7443 } | |
7444 while ( v635 + 1 < v730 ); | |
7445 } | |
7446 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
890 | 7447 LODWORD(v727) = 1; |
7448 break; | |
7449 } | |
7450 | |
7451 case SPELL_DARK_ARMAGEDDON: | |
7452 { | |
993 | 7453 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
7454 { | |
7455 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7456 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7457 pCastSpell->spellnum = 0; | |
7458 continue; | |
7459 } | |
7460 v640 = v731 - 2; | |
7461 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7462 amount = 3; | |
7463 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7464 { | |
7465 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7466 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7467 pCastSpell->spellnum = 0; | |
7468 continue; | |
7469 } | |
7470 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7471 break; | |
7472 pParty->armageddon_timer = 256; | |
7473 pParty->field_16140 = v2; | |
7474 ++pPlayer->uNumArmageddonCasts; | |
7475 if ( pParty->bTurnBasedModeOn == 1 ) | |
7476 ++pTurnEngine->field_1C; | |
7477 auto _v726 = 50; | |
7478 do | |
7479 { | |
7480 v642 = rand() % 4096 - 2048; | |
7481 v643 = rand(); | |
7482 v721 = v642 + pParty->vPosition.x; | |
7483 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7484 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7485 v644 = rand(); | |
7486 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7487 --_v726; | |
7488 } | |
7489 while ( _v726 != 0 ); | |
890 | 7490 LODWORD(v727) = 1; |
7491 break; | |
7492 } | |
7493 | |
7494 default: | |
993 | 7495 break; |
890 | 7496 } |
924 | 7497 if ( pCastSpell->field_8 & 0x20 ) |
890 | 7498 { |
7499 if ( v727 != 0.0 ) | |
924 | 7500 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 7501 } |
7502 else | |
7503 { | |
7504 if ( sRecoveryTime < 0 ) | |
7505 sRecoveryTime = 0; | |
7506 if ( pParty->bTurnBasedModeOn ) | |
7507 { | |
7508 v645 = sRecoveryTime; | |
924 | 7509 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 7510 pPlayer->SetRecoveryTime(v645); |
7511 if ( !some_active_character ) | |
7512 pTurnEngine->_40471C(); | |
7513 } | |
7514 else | |
7515 { | |
7516 pPlayer->SetRecoveryTime( | |
7517 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
7518 } | |
7519 if ( v727 != 0.0 ) | |
7520 { | |
7521 pPlayer->PlaySound(SPEECH_49, 0); | |
7522 if ( v727 != 0.0 ) | |
924 | 7523 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
889 | 7524 } |
7525 } | |
924 | 7526 pCastSpell->spellnum = 0; |
890 | 7527 v2 = v723; |
7528 continue; | |
0 | 7529 } |
488 | 7530 |
0 | 7531 } |
7532 //----- (0042EB42) -------------------------------------------------------- | |
7533 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7534 { | |
7535 unsigned int v2; // edx@1 | |
7536 signed int v3; // eax@1 | |
7537 char *v4; // ecx@2 | |
7538 | |
7539 v2 = this->uNumObjects; | |
7540 v3 = 0; | |
7541 if ( (signed int)this->uNumObjects <= 0 ) | |
7542 { | |
7543 LABEL_5: | |
7544 LOWORD(v3) = 0; | |
7545 } | |
7546 else | |
7547 { | |
7548 v4 = (char *)&this->pObjects->uObjectID; | |
7549 while ( uItemID != *(short *)v4 ) | |
7550 { | |
7551 ++v3; | |
7552 v4 += 56; | |
7553 if ( v3 >= (signed int)v2 ) | |
7554 goto LABEL_5; | |
7555 } | |
7556 } | |
7557 return v3; | |
7558 } | |
7559 | |
7560 //----- (0042EB78) -------------------------------------------------------- | |
7561 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7562 { | |
7563 return 8 * this->pIcons[uIconID].uAnimLength; | |
7564 } | |
7565 | |
437 | 7566 const wchar_t *UIMessage2String(UIMessageType msg) |
7567 { | |
7568 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7569 static wchar_t b[256]; // bad for threads | |
7570 switch (msg) | |
7571 { | |
7572 CASE(UIMSG_SelectSpell) | |
7573 CASE(UIMSG_ChangeGameState) | |
7574 CASE(UIMSG_Attack) | |
7575 CASE(UIMSG_PlayArcomage) | |
7576 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7577 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7578 CASE(UIMSG_ShowCredits) | |
7579 CASE(UIMSG_ExitToWindows) | |
7580 CASE(UIMSG_PlayerCreationChangeName) | |
7581 CASE(UIMSG_PlayerCreationClickPlus) | |
7582 CASE(UIMSG_PlayerCreationClickMinus) | |
7583 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7584 CASE(UIMSG_PlayerCreationSelectClass) | |
7585 CASE(UIMSG_PlayerCreationClickOK) | |
7586 CASE(UIMSG_PlayerCreationClickReset) | |
996 | 7587 CASE(UIMSG_ClickBooksBtn) |
437 | 7588 CASE(UIMSG_PlayerCreationRemoveUpSkill) |
7589 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7590 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7591 CASE(UIMSG_LoadGame) | |
7592 CASE(UIMSG_SaveGame) | |
7593 CASE(UIMSG_ShowStatus_DateTime) | |
7594 CASE(UIMSG_ShowStatus_ManaHP) | |
7595 CASE(UIMSG_ShowStatus_Player) | |
7596 CASE(UIMSG_Wait5Minutes) | |
7597 CASE(UIMSG_Wait1Hour) | |
7598 CASE(UIMSG_ShowStatus_Food) | |
7599 CASE(UIMSG_ShowStatus_Funds) | |
7600 CASE(UIMSG_QuickReference) | |
7601 CASE(UIMSG_GameMenuButton) | |
7602 CASE(UIMSG_AlreadyResting) | |
7603 CASE(UIMSG_SelectCharacter) | |
7604 CASE(UIMSG_ChangeSoundVolume) | |
7605 CASE(UIMSG_ChangeMusicVolume) | |
7606 CASE(UIMSG_Escape) | |
7607 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7608 CASE(UIMSG_InventoryLeftClick) | |
7609 CASE(UIMSG_SkillUp) | |
7610 CASE(UIMSG_GameMenu_ReturnToGame) | |
7611 CASE(UIMSG_StartNewGame) | |
7612 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7613 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7614 CASE(UIMSG_Game_OpenOptionsDialog) | |
7615 CASE(UIMSG_SetGraphicsMode) | |
7616 CASE(UIMSG_Quit) | |
7617 CASE(UIMSG_StartHireling1Dialogue) | |
7618 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7619 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7620 CASE(UIMSG_CastSpellFromBook) |
7621 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7622 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7623 CASE(UIMSG_StartNPCDialogue) | |
7624 CASE(UIMSG_ArrowUp) | |
7625 CASE(UIMSG_DownArrow) | |
961 | 7626 CASE(UIMSG_SaveLoadBtn) |
437 | 7627 CASE(UIMSG_SelectLoadSlot) |
7628 CASE(UIMSG_Cancel) | |
7629 CASE(UIMSG_ExitRest) | |
7630 CASE(UIMSG_PlayerCreation_FacePrev) | |
7631 CASE(UIMSG_PlayerCreation_FaceNext) | |
7632 CASE(UIMSG_CycleCharacters) | |
7633 CASE(UIMSG_SetTurnSpeed) | |
7634 CASE(UIMSG_ToggleWalkSound) | |
7635 CASE(UIMSG_ChangeVoiceVolume) | |
7636 CASE(UIMSG_ToggleShowDamage) | |
7637 CASE(UIMSG_ScrollNPCPanel) | |
7638 CASE(UIMSG_ShowFinalWindow) | |
7639 CASE(UIMSG_OpenQuestBook) | |
7640 CASE(UIMSG_OpenAutonotes) | |
7641 CASE(UIMSG_OpenMapBook) | |
7642 CASE(UIMSG_OpenCalendar) | |
7643 CASE(UIMSG_OpenHistoryBook) | |
7644 CASE(UIMSG_ToggleAlwaysRun) | |
7645 CASE(UIMSG_ToggleFlipOnExit) | |
7646 CASE(UIMSG_Game_Action) | |
907 | 7647 CASE(UIMSG_RentRoom) |
437 | 7648 CASE(UIMSG_TransitionUI_Confirm) |
7649 CASE(UIMSG_OpenKeyMappingOptions) | |
7650 CASE(UIMSG_SelectKeyPage1) | |
7651 CASE(UIMSG_SelectKeyPage2) | |
7652 CASE(UIMSG_ResetKeyMapping) | |
7653 CASE(UIMSG_ChangeKeyButton) | |
7654 CASE(UIMSG_OpenVideoOptions) | |
7655 CASE(UIMSG_ToggleBloodsplats) | |
7656 CASE(UIMSG_ToggleColoredLights) | |
7657 CASE(UIMSG_ToggleTint) | |
7658 default: | |
7659 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7660 }; | |
7661 #undef CASE | |
7662 } | |
7663 | |
0 | 7664 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7665 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7666 { |
482 | 7667 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7668 if (uNumMessages < 40) |
7669 { | |
437 | 7670 files[uNumMessages] = file; |
7671 lines[uNumMessages] = line; | |
7672 | |
0 | 7673 pMessages[uNumMessages].eType = msg; |
7674 pMessages[uNumMessages].param = param; | |
7675 pMessages[uNumMessages++].field_8 = a4; | |
7676 } | |
7677 } | |
7678 | |
7679 //----- (0042EBBE) -------------------------------------------------------- | |
7680 int __fastcall sub_42EBBE(int a1, int a2) | |
7681 { | |
7682 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7683 } | |
7684 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7685 | |
7686 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7687 int stru193_math::Sin(int angle) |
0 | 7688 { |
323 | 7689 return Cos(angle - this->uIntegerHalfPi); |
0 | 7690 } |
7691 | |
7692 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7693 void _42ECB5_PlayerAttacksActor() |
0 | 7694 { |
271 | 7695 //unsigned int v0; // ebx@1 |
7696 //Player *v1; // esi@1 | |
7697 //bool result; // eax@1 | |
295 | 7698 //int v3; // edi@2 |
271 | 7699 //unsigned int v4; // eax@7 |
0 | 7700 char *v5; // eax@8 |
271 | 7701 //int v6; // ecx@9 |
7702 //signed int v7; // eax@16 | |
295 | 7703 //Actor *v8; // edi@20 |
0 | 7704 unsigned int v9; // ecx@21 |
295 | 7705 //char *v10; // eax@26 |
0 | 7706 char *v11; // eax@26 |
7707 unsigned int v12; // eax@47 | |
295 | 7708 //char *v13; // eax@47 |
7709 //char *v14; // eax@47 | |
7710 //unsigned int v15; // ebx@54 | |
7711 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7712 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7713 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7714 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7715 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7716 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7717 //int v22; // [sp-4h] [bp-40h]@24 | |
7718 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7719 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7720 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7721 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7722 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7723 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7724 //unsigned int *v28b; |
295 | 7725 //int v29; // [sp+24h] [bp-18h]@16 |
7726 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7727 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7728 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7729 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7730 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7731 |
271 | 7732 //v0 = uActiveCharacter; |
7733 //v27 = 6972 * uActiveCharacter; | |
7734 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7735 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7736 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7737 if (!player->CanAct()) | |
7738 return; | |
7739 | |
924 | 7740 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 7741 //v3 = 0; |
271 | 7742 if (pParty->Invisible()) |
7743 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7744 | |
7745 //v31 = player->pEquipment.uBow; | |
7746 int bow_idx = player->pEquipment.uBow; | |
7747 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7748 bow_idx = 0; | |
7749 | |
295 | 7750 //v32 = 0; |
7751 int wand_item_id = 0; | |
271 | 7752 //v33 = 0; |
7753 //v4 = v1->pEquipment.uMainHand; | |
7754 int laser_weapon_item_id = 0; | |
7755 | |
7756 int main_hand_idx = player->pEquipment.uMainHand; | |
7757 if (main_hand_idx) | |
0 | 7758 { |
271 | 7759 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7760 //v5 = (char *)v1 + 36 * v4; |
271 | 7761 if (!item->Broken()) |
7762 { | |
7763 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7764 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7765 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7766 { |
295 | 7767 if (item->uNumCharges <= 0) |
7768 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7769 else |
295 | 7770 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7771 } |
271 | 7772 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7773 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7774 } |
271 | 7775 } |
7776 | |
295 | 7777 //v30 = 0; |
7778 //v29 = 0; | |
7779 //v28 = 0; | |
271 | 7780 //v7 = pMouse->uPointingObjectID; |
7781 | |
7782 int target_pid = pMouse->uPointingObjectID; | |
848 | 7783 int target_type = PID_TYPE(target_pid), |
7784 target_id = PID_ID(target_pid); | |
271 | 7785 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7786 { | |
7787 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7788 target_type = PID_TYPE(target_pid); |
7789 target_id = PID_ID(target_pid); | |
271 | 7790 } |
295 | 7791 |
7792 auto actor = &pActors[target_id]; | |
7793 int actor_distance = 0; | |
271 | 7794 if (target_type == OBJECT_Actor) |
7795 { | |
295 | 7796 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7797 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7798 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7799 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7800 if (actor_distance < 0) | |
7801 actor_distance = 0; | |
7802 } | |
7803 | |
7804 bool shooting_bow = false, | |
7805 shotting_laser = false, | |
816 | 7806 shooting_wand = false, |
7807 melee_attack = false; | |
295 | 7808 if (laser_weapon_item_id) |
7809 { | |
7810 shotting_laser = true; | |
490 | 7811 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7812 } |
7813 else if (wand_item_id) | |
7814 { | |
7815 shooting_wand = true; | |
7816 | |
7817 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7818 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7819 |
7820 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7821 player->pEquipment.uMainHand = 0; | |
7822 } | |
303 | 7823 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7824 { |
816 | 7825 melee_attack = true; |
7826 | |
303 | 7827 Vec3_int_ a3; |
7828 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7829 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7830 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7831 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7832 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7833 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7834 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7835 _42FA66_do_explosive_impact( |
7836 actor->vPosition.x, | |
7837 actor->vPosition.y, | |
7838 actor->vPosition.z + actor->uActorHeight / 2, | |
7839 0, 512, uActiveCharacter); | |
303 | 7840 } |
7841 else if (bow_idx) | |
7842 { | |
7843 shooting_bow = true; | |
490 | 7844 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7845 } |
7846 else | |
7847 { | |
816 | 7848 melee_attack = true; |
303 | 7849 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7850 } | |
7851 | |
816 | 7852 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7853 { |
816 | 7854 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7855 if (recovery < 30 ) |
7856 recovery = 30; | |
816 | 7857 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7858 } |
7859 | |
7860 | |
7861 int v34 = 0; | |
7862 if (shooting_wand) | |
7863 return; | |
7864 else if (shooting_bow) | |
7865 { | |
7866 v34 = 5; | |
7867 player->PlaySound(SPEECH_50, 0); | |
7868 } | |
7869 if (shotting_laser) | |
7870 v34 = 7; | |
7871 else | |
7872 { | |
7873 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7874 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7875 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7876 pTurnEngine->_40471C(); | |
7877 } | |
7878 | |
7879 switch (v34) | |
7880 { | |
7881 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7882 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7883 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7884 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7885 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7886 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7887 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7888 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7889 } | |
0 | 7890 } |
7891 | |
7892 //----- (0042F184) -------------------------------------------------------- | |
295 | 7893 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7894 { |
7895 int v4; // edi@1 | |
7896 stru319 *v5; // esi@1 | |
7897 int v6; // eax@2 | |
7898 int v7; // eax@4 | |
7899 int result; // eax@5 | |
7900 int *v9; // edx@8 | |
7901 signed int v10; // ebx@10 | |
7902 int v11; // edi@11 | |
7903 Actor *v12; // esi@12 | |
7904 unsigned __int16 v13; // ax@12 | |
7905 int v14; // eax@22 | |
7906 char v15; // zf@30 | |
7907 int v16; // esi@32 | |
7908 int v17; // ecx@34 | |
7909 stru319 *v18; // eax@39 | |
7910 int v19; // edx@39 | |
7911 int v20; // ecx@41 | |
7912 unsigned __int16 v21; // ax@42 | |
7913 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7914 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7915 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7916 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7917 int *v26; // [sp+18h] [bp-14h]@8 | |
7918 int v27; // [sp+1Ch] [bp-10h]@10 | |
7919 int *v28; // [sp+20h] [bp-Ch]@10 | |
7920 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7921 int v30; // [sp+28h] [bp-4h]@6 | |
7922 int i; // [sp+38h] [bp+Ch]@33 | |
7923 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7924 | |
7925 v4 = 0; | |
7926 v5 = this; | |
7927 v24 = this; | |
7928 if ( pRenderer->pRenderD3D ) | |
7929 { | |
7930 v6 = a3 != 0; | |
7931 if ( a4 ) | |
7932 LOBYTE(v6) = v6 | 8; | |
295 | 7933 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7934 if ( v7 != -1 ) |
7935 return (unsigned __int16)v7; | |
295 | 7936 else return 0; |
0 | 7937 } |
7938 else | |
7939 { | |
7940 v30 = 0; | |
7941 if ( pRenderer->pActiveZBuffer ) | |
7942 { | |
692 | 7943 v29 = viewparams->uScreen_topL_X; |
7944 v23 = viewparams->uScreen_BttmR_X; | |
7945 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7946 { |
692 | 7947 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7948 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7949 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7950 do |
7951 { | |
7952 if ( (signed int)v29 < (signed int)v23 ) | |
7953 { | |
7954 v28 = v9; | |
7955 v10 = v4; | |
7956 v27 = v23 - v29; | |
7957 do | |
7958 { | |
7959 v22 = *v28; | |
7960 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7961 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 7962 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7963 v12 = &pActors[PID_ID(v11)]; |
0 | 7964 v13 = v12->uAIState; |
7965 if ( v13 != 5 ) | |
7966 { | |
7967 if ( v13 != 4 | |
7968 && v13 != 11 | |
7969 && v13 != 19 | |
7970 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7971 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 7972 { |
7973 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 7974 && v22 <= pick_depth << 16 ) |
0 | 7975 { |
7976 v14 = 0; | |
7977 if ( v10 > 0 ) | |
7978 { | |
7979 do | |
7980 { | |
7981 if ( dword_50BDA0[v14] == v11 ) | |
7982 break; | |
7983 ++v14; | |
7984 } | |
7985 while ( v14 < v30 ); | |
7986 } | |
7987 if ( v14 == v30 && v10 < 100 ) | |
7988 { | |
7989 ++v30; | |
7990 dword_50BC10[v10] = v22; | |
7991 dword_50BDA0[v10] = v11; | |
7992 ++v10; | |
7993 } | |
7994 } | |
7995 } | |
7996 } | |
7997 } | |
7998 ++v28; | |
7999 --v27; | |
8000 } | |
8001 while ( v27 ); | |
8002 v4 = v30; | |
8003 v5 = v24; | |
8004 } | |
8005 v9 = v26 + 640; | |
8006 v15 = v25-- == 1; | |
8007 v26 += 640; | |
8008 } | |
8009 while ( !v15 ); | |
8010 } | |
8011 if ( v4 > 0 ) | |
8012 { | |
8013 v32 = 1; | |
8014 v16 = (int)dword_50BC10; | |
8015 do | |
8016 { | |
8017 for ( i = v32; i < v4; ++i ) | |
8018 { | |
8019 v17 = dword_50BC10[i]; | |
8020 if ( v17 < *(int *)v16 ) | |
8021 { | |
8022 dword_50BC10[i] = *(int *)v16; | |
8023 *(int *)v16 = v17; | |
8024 } | |
8025 } | |
8026 ++v32; | |
8027 v16 += 4; | |
8028 } | |
8029 while ( v32 - 1 < v4 ); | |
8030 v5 = v24; | |
8031 if ( v4 > 0 ) | |
8032 { | |
8033 v18 = v24; | |
8034 v19 = v4; | |
8035 do | |
8036 { | |
8037 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8038 v18 += 4; | |
8039 --v19; | |
8040 } | |
8041 while ( v19 ); | |
8042 } | |
8043 } | |
8044 v20 = 0; | |
8045 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8046 { | |
8047 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8048 if ( v21 != 4 && v21 != 5 ) | |
8049 break; | |
8050 } | |
8051 if ( v20 != v4 ) | |
8052 { | |
8053 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8054 LOBYTE(result) = result | 3; | |
8055 return result; | |
8056 } | |
8057 } | |
8058 } | |
8059 return 0; | |
8060 } | |
8061 | |
8062 //----- (0042F3D6) -------------------------------------------------------- | |
8063 void InitializeTurnBasedAnimations(void *_this) | |
8064 { | |
8065 unsigned int *v1; // edi@1 | |
8066 | |
8067 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8068 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8069 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8070 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8071 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8072 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8073 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8074 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8075 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8076 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8077 v1 = pIconIDs_Turn; | |
8078 do | |
8079 { | |
8080 pIconsFrameTable->InitializeAnimation(*v1); | |
8081 ++v1; | |
8082 } | |
8083 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8084 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8085 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8086 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8087 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8088 } | |
8089 | |
8090 //----- (0042F4DA) -------------------------------------------------------- | |
8091 signed int __cdecl sub_42F4DA() | |
8092 { | |
8093 signed int v0; // edi@1 | |
82 | 8094 Actor *v1; // esi@4 |
0 | 8095 int v2; // ebx@5 |
8096 int v3; // eax@5 | |
8097 int v4; // ebx@5 | |
8098 unsigned int v5; // ecx@5 | |
8099 int v6; // edx@6 | |
8100 unsigned int v7; // edx@8 | |
8101 unsigned int v8; // edx@10 | |
8102 __int16 v9; // ax@12 | |
8103 signed int result; // eax@20 | |
8104 int v11; // [sp+Ch] [bp-10h]@5 | |
8105 int v12; // [sp+10h] [bp-Ch]@5 | |
8106 signed int v13; // [sp+14h] [bp-8h]@3 | |
8107 | |
8108 v0 = 5120; | |
8109 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8110 v0 = 2560; | |
8111 v13 = 0; | |
8112 if ( (signed int)uNumActors <= 0 ) | |
8113 { | |
8114 LABEL_20: | |
8115 result = 0; | |
8116 } | |
8117 else | |
8118 { | |
82 | 8119 v1 = pActors; |
0 | 8120 while ( 1 ) |
8121 { | |
82 | 8122 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8123 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8124 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8125 v3 = v2; |
8126 v4 = v11; | |
8127 v5 = v12; | |
8128 if ( v3 < v11 ) | |
8129 { | |
8130 v6 = v3; | |
8131 v3 = v11; | |
8132 v4 = v6; | |
8133 } | |
8134 if ( v3 < v12 ) | |
8135 { | |
8136 v7 = v3; | |
8137 v3 = v12; | |
8138 v5 = v7; | |
8139 } | |
8140 if ( v4 < (signed int)v5 ) | |
8141 { | |
8142 v8 = v5; | |
8143 v5 = v4; | |
8144 v4 = v8; | |
8145 } | |
8146 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8147 { | |
82 | 8148 v9 = v1->uAIState; |
8149 if ( v1->uAIState != 5 ) | |
0 | 8150 { |
8151 if ( v9 != 4 | |
8152 && v9 != 11 | |
8153 && v9 != 19 | |
8154 && v9 != 17 | |
82 | 8155 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8156 break; |
8157 } | |
8158 } | |
8159 ++v13; | |
82 | 8160 ++v1; |
0 | 8161 if ( v13 >= (signed int)uNumActors ) |
8162 goto LABEL_20; | |
8163 } | |
8164 result = 1; | |
8165 } | |
8166 return result; | |
8167 } | |
8168 | |
8169 //----- (0042F7EB) -------------------------------------------------------- | |
8170 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) | |
8171 { | |
8172 unsigned int v9; // edi@1 | |
8173 signed int v10; // edx@3 | |
8174 char *v11; // ecx@4 | |
8175 unsigned __int16 v12; // ax@7 | |
8176 unsigned int v13; // edx@9 | |
8177 char *v14; // ecx@10 | |
8178 int v15; // esi@17 | |
8179 int v16; // eax@18 | |
8180 int v17; // edi@20 | |
8181 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8182 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8183 int v21; // [sp+7Ch] [bp-8h]@1 |
8184 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8185 | |
8186 v9 = uSpriteID; | |
8187 v21 = x; | |
8188 v22 = uSpriteID; | |
8189 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8190 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
|
8191 //SpriteObject::SpriteObject(&a1a); |
0 | 8192 a1a.stru_24.Reset(); |
8193 | |
8194 if ( a9 ) | |
8195 { | |
8196 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8197 v9 = v22; | |
8198 } | |
8199 v10 = 0; | |
822 | 8200 a1a.spell_skill = 0; |
8201 a1a.spell_level = 0; | |
8202 a1a.spell_id = 0; | |
0 | 8203 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8204 a1a.uType = v9; |
0 | 8205 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8206 { | |
8207 LABEL_7: | |
8208 v12 = 0; | |
8209 } | |
8210 else | |
8211 { | |
8212 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8213 while ( (short)v9 != *(short *)v11 ) | |
8214 { | |
8215 ++v10; | |
8216 v11 += 56; | |
8217 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8218 goto LABEL_7; | |
8219 } | |
8220 v12 = v10; | |
8221 } | |
8222 a1a.uObjectDescID = v12; | |
8223 a1a.vPosition.z = z; | |
8224 a1a.vPosition.x = v21; | |
8225 a1a.vPosition.y = y; | |
8226 a1a.uSoundID = 0; | |
8227 a1a.uAttributes = attributes; | |
8228 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8229 a1a.uSpriteFrameID = 0; | |
822 | 8230 a1a.spell_caster_pid = 0; |
823 | 8231 a1a.spell_target_pid = 0; |
0 | 8232 if ( !(a1a.uAttributes & 0x10) ) |
8233 { | |
8234 v13 = 0; | |
222 | 8235 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8236 { |
8237 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8238 while ( *(short *)v14 != v9 ) | |
8239 { | |
8240 ++v13; | |
8241 v14 += 48; | |
222 | 8242 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8243 goto LABEL_16; |
8244 } | |
8245 a1a.stru_24.uItemID = v13; | |
8246 } | |
8247 } | |
8248 LABEL_16: | |
8249 if ( a7 ) | |
8250 { | |
8251 v15 = count; | |
8252 if ( count > 0 ) | |
8253 { | |
8254 do | |
8255 { | |
8256 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8257 v16 = rand(); | |
8258 a1a.Create( | |
8259 (signed __int16)a1a.uFacing, | |
8260 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8261 a4, | |
8262 0); | |
8263 --v15; | |
8264 } | |
8265 while ( v15 ); | |
8266 } | |
8267 } | |
8268 else | |
8269 { | |
8270 v17 = count; | |
8271 v18 = stru_5C6E00->uIntegerHalfPi; | |
8272 a1a.uFacing = 0; | |
8273 if ( count > 0 ) | |
8274 { | |
8275 do | |
8276 { | |
8277 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8278 --v17; | |
8279 } | |
8280 while ( v17 ); | |
8281 } | |
8282 } | |
8283 return 1; | |
8284 } | |
8285 | |
8286 //----- (0042F960) -------------------------------------------------------- | |
8287 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8288 { | |
8289 int v3; // ebx@1 | |
8290 int v4; // edi@1 | |
8291 signed int v5; // edx@1 | |
8292 char *v6; // ecx@2 | |
8293 unsigned __int16 v7; // ax@5 | |
8294 signed int v8; // eax@6 | |
8295 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8296 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8297 |
8298 v3 = x; | |
8299 v4 = y; | |
8300 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8301 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
|
8302 //SpriteObject::SpriteObject(&a1); |
0 | 8303 a1.stru_24.Reset(); |
8304 | |
8305 v5 = 0; | |
822 | 8306 a1.spell_skill = 0; |
8307 a1.spell_level = 0; | |
8308 a1.spell_id = 0; | |
0 | 8309 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8310 a1.uType = 800; |
0 | 8311 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8312 { | |
8313 LABEL_5: | |
8314 v7 = 0; | |
8315 } | |
8316 else | |
8317 { | |
8318 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8319 while ( *(short *)v6 != 800 ) | |
8320 { | |
8321 ++v5; | |
8322 v6 += 56; | |
8323 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8324 goto LABEL_5; | |
8325 } | |
8326 v7 = v5; | |
8327 } | |
8328 a1.uObjectDescID = v7; | |
8329 a1.vPosition.x = v3; | |
8330 a1.vPosition.y = v4; | |
8331 a1.vPosition.z = z; | |
8332 a1.uSoundID = 0; | |
8333 a1.uAttributes = 0; | |
8334 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8335 a1.uSpriteFrameID = 0; | |
822 | 8336 a1.spell_caster_pid = 0; |
823 | 8337 a1.spell_target_pid = 0; |
0 | 8338 v8 = a1.Create(0, 0, 0, 0); |
8339 if ( v8 != -1 ) | |
8340 { | |
8341 v9 = 8 * v8; | |
8342 LOBYTE(v9) = v9 | 2; | |
8343 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8344 } | |
8345 } | |
8346 | |
810 | 8347 |
0 | 8348 |
8349 //----- (0042FA66) -------------------------------------------------------- | |
8350 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8351 { | |
8352 int v6; // edi@1 | |
8353 int v7; // esi@1 | |
8354 char *v8; // ecx@2 | |
8355 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8356 //int v10; // eax@10 |
0 | 8357 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8358 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8359 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8360 int v14; // [sp+7Ch] [bp-4h]@1 |
8361 | |
8362 v6 = a1; | |
8363 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8364 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
|
8365 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8366 a1a.uType = 600; |
0 | 8367 a1a.stru_24.Reset(); |
8368 | |
822 | 8369 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8370 a1a.spell_level = 8; | |
8371 a1a.spell_skill = 3; | |
0 | 8372 v14 = 0; |
8373 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8374 { | |
8375 LABEL_5: | |
8376 v9 = 0; | |
8377 } | |
8378 else | |
8379 { | |
8380 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8381 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8382 { |
8383 ++v14; | |
8384 v8 += 56; | |
8385 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8386 goto LABEL_5; | |
8387 } | |
8388 v9 = v14; | |
8389 } | |
8390 a1a.uObjectDescID = v9; | |
8391 a1a.vPosition.x = v6; | |
8392 a1a.vPosition.y = v7; | |
8393 a1a.vPosition.z = a3; | |
8394 a1a.uAttributes = 0; | |
8395 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8396 a1a.uSpriteFrameID = 0; | |
823 | 8397 a1a.spell_target_pid = 0; |
0 | 8398 a1a.field_60_distance_related_prolly_lod = 0; |
8399 a1a.uFacing = 0; | |
8400 a1a.uSoundID = 0; | |
8401 if ( a6 >= 1 || a6 <= 4 ) | |
8402 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8403 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8404 } |
8405 else | |
8406 { | |
822 | 8407 a1a.spell_caster_pid = 0; |
0 | 8408 } |
8409 result = a1a.Create(0, 0, 0, 0); | |
8410 if ( result != -1 ) | |
8411 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8412 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8413 a5, |
8414 SLOWORD(a1a.vPosition.x), | |
8415 SLOWORD(a1a.vPosition.y), | |
8416 SLOWORD(a1a.vPosition.z), | |
8417 0, | |
8418 0); | |
8419 } | |
8420 return result; | |
8421 } | |
8422 | |
8423 //----- (0042FB5C) -------------------------------------------------------- | |
8424 bool __fastcall sub_42FB5C(signed int a1) | |
8425 { | |
8426 int v1; // ecx@3 | |
8427 int v2; // ecx@4 | |
8428 int v3; // ecx@5 | |
8429 int v4; // ecx@6 | |
8430 int v5; // ecx@7 | |
8431 int v6; // ecx@8 | |
8432 char v7; // zf@9 | |
8433 | |
8434 if ( a1 > 39 ) | |
8435 { | |
8436 if ( a1 > 77 ) | |
8437 { | |
8438 if ( a1 == 80 ) | |
8439 return 0; | |
8440 if ( a1 > 84 ) | |
8441 { | |
8442 if ( a1 <= 86 ) | |
8443 return 0; | |
8444 v7 = a1 == 95; | |
8445 goto LABEL_20; | |
8446 } | |
8447 } | |
8448 else | |
8449 { | |
8450 if ( a1 == 77 ) | |
8451 return 0; | |
8452 if ( a1 >= 46 ) | |
8453 { | |
8454 if ( a1 <= 47 || a1 == 51 ) | |
8455 return 0; | |
8456 v7 = a1 == 73; | |
8457 goto LABEL_20; | |
8458 } | |
8459 } | |
8460 return 1; | |
8461 } | |
8462 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8463 return 1; | |
8464 v2 = v1 - 3; | |
8465 if ( !v2 ) | |
8466 return 0; | |
8467 v3 = v2 - 1; | |
8468 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8469 return 1; | |
8470 v5 = v4 - 8; | |
8471 if ( !v5 ) | |
8472 return 0; | |
8473 v6 = v5 - 1; | |
8474 if ( !v6 ) | |
8475 return 1; | |
8476 v7 = v6 == 20; | |
8477 LABEL_20: | |
8478 if ( !v7 ) | |
8479 return 1; | |
8480 return 0; | |
8481 } | |
8482 | |
8483 //----- (0042FBDD) -------------------------------------------------------- | |
8484 void __cdecl sub_42FBDD() | |
8485 { | |
388 | 8486 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8487 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8488 pRenderer->Present(); | |
8489 } | |
8490 | |
8491 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8492 void __cdecl CloseWindowBackground() |
0 | 8493 { |
388 | 8494 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8495 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8496 pRenderer->Present(); | |
8497 } | |
8498 | |
8499 //----- (0042FC4E) -------------------------------------------------------- | |
8500 void __cdecl ProcessInputActions() | |
8501 { | |
8502 char v4; // al@9 | |
8503 char v8; // bl@100 | |
8504 unsigned __int16 v9; // ax@102 | |
8505 int v10; // eax@103 | |
8506 char v14; // al@159 | |
8507 unsigned int v15; // eax@168 | |
8508 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8509 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8510 int v24; // [sp+4h] [bp-4h]@87 | |
8511 | |
8512 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8513 auto pKeyboard = pGame->pKeyboardInstance; | |
8514 if (!bAlwaysRun) | |
8515 { | |
8516 if (pKeyboard->IsShiftHeld()) | |
8517 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8518 else | |
8519 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8520 } | |
8521 else | |
8522 { | |
8523 if (pKeyboard->IsShiftHeld()) | |
8524 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8525 else | |
8526 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8527 } | |
8528 | |
140 | 8529 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
998 | 8530 for ( uint i = 0; i < 30; ++i ) |
8531 { | |
8532 if ( pKeyActionMap->pToggleTypes[i] ) | |
8533 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
8534 else | |
8535 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
8536 if ( v14 && i == 9 ) | |
8537 { | |
8538 if ( !pCurrentScreen ) | |
8539 { | |
8540 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
8541 continue; | |
8542 } | |
8543 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
8544 { | |
8545 v15 = pMessageQueue_50CBD0->uNumMessages; | |
8546 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8547 { | |
8548 v15 = 0; | |
8549 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
8550 { | |
8551 v15 = 1; | |
8552 pMessageQueue_50CBD0->uNumMessages = 0; | |
8553 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
8554 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8555 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8556 ++pMessageQueue_50CBD0->uNumMessages; | |
8557 continue; | |
8558 } | |
8559 pMessageQueue_50CBD0->uNumMessages = 0; | |
8560 } | |
8561 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
8562 } | |
8563 } | |
8564 } | |
0 | 8565 if ( !pEventTimer->bPaused ) |
8566 { | |
998 | 8567 for ( uint i = 0; i < 30; ++i ) |
0 | 8568 { |
998 | 8569 inputAction = (InputAction)i; |
8570 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
8571 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 8572 else |
998 | 8573 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 8574 if ( v4 ) |
8575 { | |
8576 switch ( inputAction ) | |
8577 { | |
8578 case INPUT_MoveForward: | |
271 | 8579 if (pCurrentScreen != SCREEN_GAME) |
0 | 8580 break; |
8581 if (!pParty->bTurnBasedModeOn) | |
8582 { | |
140 | 8583 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8584 partyAction = PARTY_RunForward; |
8585 else | |
8586 partyAction = PARTY_WalkForward; | |
998 | 8587 pPartyActionQueue->Add(partyAction); |
163 | 8588 break; |
8589 } | |
8590 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8591 { | |
8592 pTurnEngine->uActionPointsLeft -= 26; | |
8593 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8594 partyAction = PARTY_RunForward; | |
8595 else | |
8596 partyAction = PARTY_WalkForward; | |
998 | 8597 pPartyActionQueue->Add(partyAction); |
163 | 8598 break; |
0 | 8599 } |
8600 break; | |
8601 case INPUT_MoveBackwards: | |
271 | 8602 if (pCurrentScreen != SCREEN_GAME) |
0 | 8603 break; |
8604 if (!pParty->bTurnBasedModeOn) | |
17 | 8605 { |
8606 if ( pParty->uFlags2 & 2 ) | |
8607 partyAction = PARTY_RunBackward; | |
8608 else | |
8609 partyAction = PARTY_WalkBackward; | |
998 | 8610 pPartyActionQueue->Add(partyAction); |
163 | 8611 break; |
17 | 8612 } |
0 | 8613 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8614 { | |
8615 pTurnEngine->uActionPointsLeft -= 26; | |
8616 if ( pParty->uFlags2 & 2 ) | |
8617 partyAction = PARTY_RunBackward; | |
8618 else | |
8619 partyAction = PARTY_WalkBackward; | |
998 | 8620 pPartyActionQueue->Add(partyAction); |
163 | 8621 break; |
0 | 8622 } |
8623 break; | |
8624 case INPUT_StrafeLeft: | |
271 | 8625 if (pCurrentScreen != SCREEN_GAME) |
0 | 8626 break; |
8627 if (!pParty->bTurnBasedModeOn) | |
17 | 8628 { |
8629 partyAction = PARTY_StrafeLeft; | |
998 | 8630 pPartyActionQueue->Add(partyAction); |
163 | 8631 break; |
17 | 8632 } |
0 | 8633 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8634 break; | |
8635 pTurnEngine->uActionPointsLeft -= 26; | |
8636 partyAction = PARTY_StrafeLeft; | |
998 | 8637 pPartyActionQueue->Add(partyAction); |
8638 break; | |
0 | 8639 case INPUT_StrafeRight: |
271 | 8640 if (pCurrentScreen != SCREEN_GAME) |
0 | 8641 break; |
8642 if (!pParty->bTurnBasedModeOn) | |
17 | 8643 { |
8644 partyAction = PARTY_StrafeRight; | |
998 | 8645 pPartyActionQueue->Add(partyAction); |
163 | 8646 break; |
17 | 8647 } |
0 | 8648 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8649 break; | |
8650 pTurnEngine->uActionPointsLeft -= 26; | |
8651 partyAction = PARTY_StrafeRight; | |
998 | 8652 pPartyActionQueue->Add(partyAction); |
163 | 8653 break; |
0 | 8654 case INPUT_TurnLeft: |
271 | 8655 if (pCurrentScreen != SCREEN_GAME) |
0 | 8656 break; |
8657 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8658 { | |
8659 if (pParty->bTurnBasedModeOn) | |
8660 { | |
8661 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8662 break; | |
8663 pTurnEngine->uActionPointsLeft -= 26; | |
8664 } | |
998 | 8665 partyAction = PARTY_StrafeLeft; |
0 | 8666 } |
8667 else | |
8668 { | |
8669 if ( pParty->uFlags2 & 2 ) | |
998 | 8670 partyAction = PARTY_FastTurnLeft; |
0 | 8671 else |
998 | 8672 partyAction = PARTY_TurnLeft; |
0 | 8673 } |
998 | 8674 pPartyActionQueue->Add(partyAction); |
0 | 8675 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
8676 { | |
271 | 8677 pWeather->OnPlayerTurn(10); |
0 | 8678 } |
8679 break; | |
8680 case INPUT_TurnRight: | |
271 | 8681 if (pCurrentScreen != SCREEN_GAME) |
0 | 8682 break; |
8683 if ( GetAsyncKeyState(17) ) // strafing | |
8684 { | |
8685 if (pParty->bTurnBasedModeOn) | |
8686 { | |
8687 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8688 break; | |
8689 pTurnEngine->uActionPointsLeft -= 26; | |
8690 } | |
998 | 8691 partyAction = PARTY_StrafeRight; |
0 | 8692 } |
8693 else | |
8694 { | |
8695 if ( pParty->uFlags2 & 2 ) | |
998 | 8696 partyAction = PARTY_FastTurnRight; |
0 | 8697 else |
998 | 8698 partyAction = PARTY_TurnRight; |
0 | 8699 } |
998 | 8700 pPartyActionQueue->Add(partyAction); |
0 | 8701 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
8702 { | |
271 | 8703 pWeather->OnPlayerTurn(-10); |
0 | 8704 } |
8705 break; | |
8706 case INPUT_Jump: | |
271 | 8707 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8708 break; |
8709 partyAction = (PartyAction)12; | |
998 | 8710 pPartyActionQueue->Add(partyAction); |
163 | 8711 break; |
0 | 8712 case INPUT_Yell: |
187 | 8713 if (!pCurrentScreen && uActiveCharacter) |
0 | 8714 { |
8715 pParty->Yell(); | |
187 | 8716 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8717 } |
187 | 8718 break; |
0 | 8719 case INPUT_Pass: |
8720 if ( pCurrentScreen ) | |
8721 break; | |
8722 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8723 { |
8724 pTurnEngine->field_18 |= 8u; | |
8725 break; | |
8726 } | |
0 | 8727 if ( uActiveCharacter ) |
8728 { | |
998 | 8729 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 8730 { |
998 | 8731 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 8732 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8733 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 8734 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 8735 pTurnEngine->_40471C(); |
8736 } | |
8737 } | |
8738 break; | |
998 | 8739 case INPUT_Combat://if press ENTER |
271 | 8740 if (pCurrentScreen == SCREEN_GAME) |
0 | 8741 { |
8742 if (pParty->bTurnBasedModeOn) | |
8743 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8744 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8745 { |
8746 pParty->bTurnBasedModeOn = 0; | |
8747 pTurnEngine->End(true); | |
8748 } | |
8749 } | |
8750 else | |
8751 { | |
8752 pTurnEngine->Start(); | |
8753 pParty->bTurnBasedModeOn = true; | |
8754 } | |
8755 } | |
8756 break; | |
8757 case INPUT_CastReady: | |
271 | 8758 if (pCurrentScreen != SCREEN_GAME) |
0 | 8759 break; |
8760 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8761 { |
8762 pTurnEngine->field_18 |= 8u; | |
8763 break; | |
8764 } | |
0 | 8765 if ( !uActiveCharacter ) |
8766 break; | |
998 | 8767 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 8768 if ( !v8 |
8769 || bUnderwater | |
998 | 8770 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
8771 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
8772 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
8773 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
8774 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
8775 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 8776 { |
998 | 8777 pPartyActionQueue = pPartyActionQueue; |
437 | 8778 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8779 break; | |
0 | 8780 } |
8781 else | |
8782 { | |
1003 | 8783 if ( dword_50C9E8 < 40 ) |
0 | 8784 { |
8785 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8786 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8787 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8788 ++dword_50C9E8; |
1003 | 8789 } |
0 | 8790 } |
8791 break; | |
8792 case INPUT_Attack: | |
271 | 8793 if (pCurrentScreen != SCREEN_GAME) |
0 | 8794 break; |
998 | 8795 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3) |
8796 { | |
8797 pTurnEngine->field_18 |= 8u; | |
8798 break; | |
8799 } | |
8800 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 8801 break; |
8802 case INPUT_EventTrigger: | |
271 | 8803 if (pCurrentScreen == SCREEN_GAME) |
0 | 8804 { |
437 | 8805 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 8806 break; |
0 | 8807 } |
151 | 8808 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8809 { |
8810 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8811 { | |
437 | 8812 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 8813 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8814 { | |
8815 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 8816 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 8817 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8818 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8819 ++pMessageQueue_50CBD0->uNumMessages; | |
8820 break; | |
8821 } | |
437 | 8822 break; |
0 | 8823 } |
437 | 8824 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 8825 } |
8826 break; | |
8827 case INPUT_CharCycle: | |
1003 | 8828 if ( pCurrentScreen == SCREEN_SPELL_BOOK || dword_50C9E8 >= 40 ) |
0 | 8829 break; |
1003 | 8830 dword_50C9EC[3 * dword_50C9E8] = 176; |
437 | 8831 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8832 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1003 | 8833 ++dword_50C9E8; |
163 | 8834 break; |
0 | 8835 case INPUT_LookUp: |
8836 if ( pEventTimer->bPaused ) | |
8837 break; | |
8838 partyAction = (PartyAction)7; | |
998 | 8839 pPartyActionQueue->Add(partyAction); |
163 | 8840 break; |
0 | 8841 case INPUT_CenterView: |
8842 if ( pEventTimer->bPaused ) | |
8843 break; | |
8844 partyAction = (PartyAction)9; | |
998 | 8845 pPartyActionQueue->Add(partyAction); |
163 | 8846 break; |
0 | 8847 case INPUT_LookDown: |
8848 if ( pEventTimer->bPaused ) | |
8849 break; | |
8850 partyAction = (PartyAction)8; | |
998 | 8851 pPartyActionQueue->Add(partyAction); |
163 | 8852 break; |
0 | 8853 case INPUT_FlyUp: |
998 | 8854 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 8855 break; |
8856 partyAction = (PartyAction)13; | |
998 | 8857 pPartyActionQueue->Add(partyAction); |
163 | 8858 break; |
0 | 8859 case INPUT_Land: |
998 | 8860 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 8861 break; |
8862 partyAction = (PartyAction)15; | |
998 | 8863 pPartyActionQueue->Add(partyAction); |
163 | 8864 break; |
0 | 8865 case INPUT_FlyDown: |
8866 if ( !pCurrentScreen | |
8867 && !pEventTimer->bPaused ) | |
8868 { | |
8869 partyAction = (PartyAction)14; | |
998 | 8870 pPartyActionQueue->Add(partyAction); |
0 | 8871 } |
8872 break; | |
8873 case INPUT_ZoomIn: | |
1003 | 8874 if ( dword_50C9E8 >= 40 ) |
0 | 8875 break; |
8876 dword_50C9EC[3 * dword_50C9E8] = 367; | |
437 | 8877 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8878 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1003 | 8879 ++dword_50C9E8; |
163 | 8880 break; |
0 | 8881 case INPUT_ZoomOut: |
1003 | 8882 if ( dword_50C9E8 < 40 ) |
0 | 8883 { |
8884 dword_50C9EC[3 * dword_50C9E8] = 368; | |
437 | 8885 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8886 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8887 ++dword_50C9E8; |
1003 | 8888 } |
0 | 8889 break; |
8890 case INPUT_AlwaysRun: | |
8891 bAlwaysRun = bAlwaysRun == 0; | |
8892 break; | |
17 | 8893 default: |
8894 break; | |
0 | 8895 } |
8896 } | |
8897 } | |
8898 } | |
8899 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
8900 { | |
8901 AsyncKeyboard::LeaveCriticalSection(); | |
998 | 8902 //v16 = pAsyncKeyboard; |
0 | 8903 AsyncKeyboard::EnterCriticalSection(); |
998 | 8904 memset((char *)pAsyncKeyboard + 521, 0, 0x100u); |
0 | 8905 AsyncKeyboard::LeaveCriticalSection(); |
8906 } | |
8907 } |