Mercurial > mm7
annotate mm7_6.cpp @ 958:9c2d08e42ed3
GivePartyExp
author | Ritor1 |
---|---|
date | Thu, 02 May 2013 17:58:32 +0600 |
parents | 840b78f6c2d3 |
children | 9a5db2cf999a |
rev | line source |
---|---|
0 | 1 #include "MM7.h" |
2 | |
3 #include "MapInfo.h" | |
4 #include "Game.h" | |
5 #include "GUIWindow.h" | |
6 #include "GUIFont.h" | |
7 #include "GUIProgressBar.h" | |
8 #include "Party.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Outdoor.h" | |
11 #include "IndoorCamera.h" | |
12 #include "Overlays.h" | |
13 #include "Monsters.h" | |
14 #include "Arcomage.h" | |
15 #include "LOD.h" | |
16 #include "Actor.h" | |
17 #include "Allocator.h" | |
18 #include "Events.h" | |
19 #include "Viewport.h" | |
20 #include "FrameTableInc.h" | |
21 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
22 #include "SpriteObject.h" |
0 | 23 #include "ObjectList.h" |
24 #include "Chest.h" | |
25 #include "PaletteManager.h" | |
26 #include "DecorationList.h" | |
27 #include "SaveLoad.h" | |
28 #include "stru123.h" | |
29 #include "Time.h" | |
30 #include "IconFrameTable.h" | |
31 #include "Awards.h" | |
32 #include "Autonotes.h" | |
33 #include "stru160.h" | |
34 #include "TurnEngine.h" | |
924 | 35 #include "CastSpellInfo.h" |
0 | 36 #include "Weather.h" |
37 #include "stru298.h" | |
189 | 38 #include "texts.h" |
0 | 39 #include "StorylineTextTable.h" |
40 #include "Events2D.h" | |
370 | 41 #include "Log.h" |
0 | 42 |
43 #include "mm7_data.h" | |
44 | |
45 | |
46 | |
47 //----- (00424EE0) -------------------------------------------------------- | |
48 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
49 { | |
50 unsigned int v1; // edx@1 | |
51 double v2; // st7@1 | |
52 signed int v3; // edi@1 | |
53 char *v4; // esi@4 | |
54 char *v5; // ecx@4 | |
55 unsigned int v6; // eax@4 | |
56 char *v7; // edx@4 | |
57 double v8; // st6@10 | |
58 double v9; // st5@10 | |
59 double v10; // st6@11 | |
60 unsigned __int8 v11; // c2@15 | |
61 unsigned __int8 v12; // c3@15 | |
62 void *v13; // edi@22 | |
63 char *v14; // eax@22 | |
64 double v15; // st6@22 | |
65 char *v16; // ecx@22 | |
66 signed int result; // eax@24 | |
67 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
68 bool v19; // [sp+Ch] [bp-28h]@6 | |
69 char *v20; // [sp+10h] [bp-24h]@4 | |
70 char *v21; // [sp+14h] [bp-20h]@4 | |
71 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
72 char *v23; // [sp+1Ch] [bp-18h]@4 | |
73 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
74 char *v25; // [sp+24h] [bp-10h]@4 | |
75 char *v26; // [sp+28h] [bp-Ch]@4 | |
76 char *v27; // [sp+2Ch] [bp-8h]@4 | |
77 char *v28; // [sp+30h] [bp-4h]@4 | |
78 | |
79 v1 = uVertexID; | |
80 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
81 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
82 v3 = 0; | |
83 v22 = 0; | |
84 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
85 v3 = 1; | |
86 if ( (signed int)(uVertexID + 1) <= 1 ) | |
87 return 0; | |
88 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
89 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
90 v6 = v1; | |
91 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 92 v26 = (char *)&array_507D30[0]._rhw; |
0 | 93 v24 = array_507D30; |
94 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
95 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
96 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
97 v27 = (char *)&array_507D30[0].v; | |
98 v28 = (char *)&array_507D30[0].u; | |
99 v7 = (char *)&array_50AC10[0].v; | |
100 v18 = v6; | |
101 do | |
102 { | |
103 v19 = v2 >= *((float *)v7 + 5); | |
104 if ( v3 != v19 ) | |
105 { | |
106 if ( v19 ) | |
107 { | |
108 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
109 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
110 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
111 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
112 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
113 } | |
114 else | |
115 { | |
116 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
117 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
118 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
119 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
120 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
121 } | |
122 *(float *)v27 = v9; | |
123 *(float *)v25 = v2; | |
124 *(float *)v26 = 1.0 / v2; | |
125 if ( v3 ) | |
126 { | |
127 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
128 { | |
129 v11 = 0; | |
130 v12 = *(float *)v4 == *((float *)v7 - 5); | |
131 goto LABEL_19; | |
132 } | |
133 } | |
134 else | |
135 { | |
136 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
137 { | |
138 v11 = 0; | |
139 v12 = *(float *)v4 == *((float *)v7 + 7); | |
140 LABEL_19: | |
141 if ( v12 | v11 ) | |
142 goto LABEL_21; | |
143 goto LABEL_20; | |
144 } | |
145 } | |
146 LABEL_20: | |
147 v26 += 48; | |
148 ++v24; | |
149 v25 += 48; | |
150 v27 += 48; | |
151 v28 += 48; | |
152 v5 += 48; | |
153 v4 += 48; | |
154 ++v22; | |
155 v23 += 48; | |
156 v21 = v5; | |
157 v20 = v4; | |
158 } | |
159 LABEL_21: | |
160 if ( v19 ) | |
161 { | |
162 v13 = v24; | |
163 v14 = v26; | |
164 v21 += 48; | |
165 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
166 v20 += 48; | |
167 ++v22; | |
168 v28 += 48; | |
169 v27 += 48; | |
170 v25 += 48; | |
171 ++v24; | |
172 v26 += 48; | |
173 memcpy(v13, v7 + 8, 0x30u); | |
174 v16 = v23; | |
175 v23 += 48; | |
176 v4 = v20; | |
177 *(float *)v14 = v15; | |
178 *(int *)v16 = *((int *)v7 + 13); | |
179 v5 = v21; | |
180 } | |
181 v3 = v19; | |
182 v7 += 48; | |
183 --v18; | |
184 } | |
185 while ( v18 ); | |
186 result = v22; | |
187 if ( v22 < 3 ) | |
188 return 0; | |
189 return result; | |
190 } | |
191 | |
192 //----- (004250FE) -------------------------------------------------------- | |
193 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
194 { | |
195 unsigned int v1; // edx@1 | |
196 char *v2; // edi@5 | |
197 char *v3; // esi@5 | |
198 char *v4; // ecx@5 | |
199 int v5; // ebx@6 | |
200 double v6; // st6@11 | |
201 double v7; // st5@11 | |
202 double v8; // st6@12 | |
203 unsigned __int8 v9; // c2@16 | |
204 unsigned __int8 v10; // c3@16 | |
205 void *v11; // edi@23 | |
206 double v12; // st6@23 | |
207 char *v13; // ecx@23 | |
208 char v14; // zf@24 | |
209 signed int result; // eax@25 | |
210 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
211 bool v17; // [sp+Ch] [bp-24h]@2 | |
212 bool v18; // [sp+10h] [bp-20h]@7 | |
213 char *v19; // [sp+14h] [bp-1Ch]@5 | |
214 char *v20; // [sp+18h] [bp-18h]@5 | |
215 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
216 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
217 char *v23; // [sp+24h] [bp-Ch]@5 | |
218 char *v24; // [sp+28h] [bp-8h]@5 | |
219 char *v25; // [sp+2Ch] [bp-4h]@5 | |
220 | |
221 v1 = uVertexID; | |
222 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
223 v21 = 0; | |
224 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
225 if ( (signed int)(uVertexID + 1) <= 1 ) | |
226 return 0; | |
227 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
228 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 229 v24 = (char *)&array_507D30[0]._rhw; |
0 | 230 v22 = array_507D30; |
231 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
232 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
233 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
234 v25 = (char *)&array_507D30[0].flt_2C; | |
235 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
236 v16 = v1; | |
237 do | |
238 { | |
239 v5 = (int)(v4 + 48); | |
240 v18 = *((float *)v4 + 12) >= 8.0; | |
241 if ( v17 != v18 ) | |
242 { | |
243 if ( v18 ) | |
244 { | |
245 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
246 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
247 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
248 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
249 } | |
250 else | |
251 { | |
252 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
253 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
254 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
255 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
256 } | |
257 *(float *)v25 = v7; | |
258 *(float *)v23 = 8.0; | |
259 *(int *)v24 = 0x3E000000u; | |
260 if ( v17 ) | |
261 { | |
262 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
263 { | |
264 v9 = 0; | |
265 v10 = *(float *)v2 == *((float *)v4 + 2); | |
266 goto LABEL_20; | |
267 } | |
268 } | |
269 else | |
270 { | |
271 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
272 { | |
273 v9 = 0; | |
274 v10 = *(float *)v2 == *((float *)v4 + 14); | |
275 LABEL_20: | |
276 if ( v10 | v9 ) | |
277 goto LABEL_22; | |
278 goto LABEL_21; | |
279 } | |
280 } | |
281 LABEL_21: | |
282 ++v22; | |
283 v23 += 48; | |
284 v25 += 48; | |
285 v3 += 48; | |
286 v2 += 48; | |
287 ++v21; | |
288 v24 += 48; | |
289 v20 = v3; | |
290 v19 = v2; | |
291 } | |
292 LABEL_22: | |
293 if ( v18 ) | |
294 { | |
295 v11 = v22; | |
296 v20 += 48; | |
297 v19 += 48; | |
298 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
299 ++v21; | |
300 v25 += 48; | |
301 v23 += 48; | |
302 ++v22; | |
303 memcpy(v11, v4 + 36, 0x30u); | |
304 v13 = v24; | |
305 v24 += 48; | |
306 v3 = v20; | |
307 v2 = v19; | |
308 *(float *)v13 = v12; | |
309 } | |
310 v14 = v16-- == 1; | |
311 v17 = v18; | |
312 v4 = (char *)v5; | |
313 } | |
314 while ( !v14 ); | |
315 result = v21; | |
316 if ( v21 < 3 ) | |
317 return 0; | |
318 return result; | |
319 } | |
320 | |
321 //----- (004252E8) -------------------------------------------------------- | |
322 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
323 { | |
324 unsigned int v1; // edx@1 | |
325 double v2; // st7@1 | |
326 char *v3; // edi@5 | |
327 char *v4; // esi@5 | |
328 char *v5; // ecx@5 | |
329 int v6; // ebx@6 | |
330 double v7; // st6@11 | |
331 double v8; // st5@11 | |
332 double v9; // st6@12 | |
333 unsigned __int8 v10; // c2@16 | |
334 unsigned __int8 v11; // c3@16 | |
335 void *v12; // edi@23 | |
336 double v13; // st6@23 | |
337 char *v14; // ecx@23 | |
338 char v15; // zf@24 | |
339 signed int result; // eax@25 | |
340 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
341 bool v18; // [sp+Ch] [bp-24h]@2 | |
342 bool v19; // [sp+10h] [bp-20h]@7 | |
343 char *v20; // [sp+14h] [bp-1Ch]@5 | |
344 char *v21; // [sp+18h] [bp-18h]@5 | |
345 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
346 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
347 char *v24; // [sp+24h] [bp-Ch]@5 | |
348 char *v25; // [sp+28h] [bp-8h]@5 | |
349 char *v26; // [sp+2Ch] [bp-4h]@5 | |
350 | |
351 v1 = uVertexID; | |
352 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
353 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
354 v22 = 0; | |
355 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
356 if ( (signed int)(uVertexID + 1) <= 1 ) | |
357 return 0; | |
358 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
359 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 360 v25 = (char *)&array_507D30[0]._rhw; |
0 | 361 v23 = array_507D30; |
362 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
363 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
364 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
365 v26 = (char *)&array_507D30[0].flt_2C; | |
366 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
367 v17 = v1; | |
368 do | |
369 { | |
370 v6 = (int)(v5 + 48); | |
371 v19 = v2 >= *((float *)v5 + 12); | |
372 if ( v18 != v19 ) | |
373 { | |
374 if ( v19 ) | |
375 { | |
376 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
377 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
378 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
379 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
380 } | |
381 else | |
382 { | |
383 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
384 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
385 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
386 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
387 } | |
388 *(float *)v26 = v8; | |
389 *(float *)v24 = v2; | |
390 *(float *)v25 = 1.0 / v2; | |
391 if ( v18 ) | |
392 { | |
393 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
394 { | |
395 v10 = 0; | |
396 v11 = *(float *)v3 == *((float *)v5 + 2); | |
397 goto LABEL_20; | |
398 } | |
399 } | |
400 else | |
401 { | |
402 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
403 { | |
404 v10 = 0; | |
405 v11 = *(float *)v3 == *((float *)v5 + 14); | |
406 LABEL_20: | |
407 if ( v11 | v10 ) | |
408 goto LABEL_22; | |
409 goto LABEL_21; | |
410 } | |
411 } | |
412 LABEL_21: | |
413 ++v23; | |
414 v24 += 48; | |
415 v26 += 48; | |
416 v4 += 48; | |
417 v3 += 48; | |
418 ++v22; | |
419 v25 += 48; | |
420 v21 = v4; | |
421 v20 = v3; | |
422 } | |
423 LABEL_22: | |
424 if ( v19 ) | |
425 { | |
426 v12 = v23; | |
427 v21 += 48; | |
428 v20 += 48; | |
429 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
430 ++v22; | |
431 v26 += 48; | |
432 v24 += 48; | |
433 ++v23; | |
434 memcpy(v12, v5 + 36, 0x30u); | |
435 v14 = v25; | |
436 v25 += 48; | |
437 v4 = v21; | |
438 v3 = v20; | |
439 *(float *)v14 = v13; | |
440 } | |
441 v15 = v17-- == 1; | |
442 v18 = v19; | |
443 v5 = (char *)v6; | |
444 } | |
445 while ( !v15 ); | |
446 result = v22; | |
447 if ( v22 < 3 ) | |
448 return 0; | |
449 return result; | |
450 } | |
451 | |
452 //----- (004254D2) -------------------------------------------------------- | |
453 int __fastcall sr_4254D2(signed int a1) | |
454 { | |
455 signed int v1; // ebx@2 | |
456 int v2; // ecx@2 | |
457 int result; // eax@11 | |
458 double v4; // ST74_8@12 | |
459 bool v5; // edi@12 | |
460 char *v6; // esi@13 | |
461 char *v7; // ebx@13 | |
462 double v8; // st7@15 | |
463 double v9; // st7@16 | |
464 double v10; // st6@16 | |
465 double v11; // st7@17 | |
466 float v12; // eax@18 | |
467 double v13; // ST4C_8@19 | |
468 double v14; // ST10_8@19 | |
469 double v15; // ST28_8@20 | |
470 double v16; // ST34_8@20 | |
471 char v17; // zf@20 | |
472 double v18; // ST18_8@21 | |
473 double v19; // ST3C_8@21 | |
474 double v20; // ST44_8@22 | |
475 double v21; // ST54_8@22 | |
476 void *v22; // edi@26 | |
477 double v23; // ST54_8@29 | |
478 bool v24; // esi@29 | |
479 char *v25; // edi@30 | |
480 char *v26; // ebx@30 | |
481 bool v27; // ecx@32 | |
482 double v28; // st7@33 | |
483 double v29; // st7@34 | |
484 double v30; // st6@34 | |
485 double v31; // st7@35 | |
486 double v32; // ST44_8@37 | |
487 double v33; // ST3C_8@37 | |
488 double v34; // ST18_8@38 | |
489 double v35; // ST34_8@38 | |
490 char v36; // zf@38 | |
491 double v37; // ST28_8@39 | |
492 double v38; // ST10_8@39 | |
493 double v39; // ST20_8@40 | |
494 double v40; // ST5C_8@40 | |
495 void *v41; // edi@44 | |
496 double v42; // ST5C_8@47 | |
497 bool v43; // edi@47 | |
498 char *v44; // esi@48 | |
499 char *v45; // ebx@48 | |
500 bool v46; // ecx@49 | |
501 double v47; // st6@50 | |
502 double v48; // st6@51 | |
503 double v49; // st5@51 | |
504 double v50; // st6@52 | |
505 double v51; // ST20_8@54 | |
506 double v52; // ST54_8@54 | |
507 double v53; // ST44_8@55 | |
508 double v54; // ST3C_8@55 | |
509 char v55; // zf@55 | |
510 double v56; // ST18_8@56 | |
511 double v57; // ST34_8@56 | |
512 double v58; // ST28_8@57 | |
513 double v59; // ST10_8@57 | |
514 void *v60; // edi@61 | |
515 double v61; // ST5C_8@64 | |
516 bool v62; // edi@64 | |
517 char *v63; // esi@65 | |
518 char *v64; // ebx@65 | |
519 bool v65; // ecx@66 | |
520 double v66; // st6@67 | |
521 double v67; // st6@68 | |
522 double v68; // st5@68 | |
523 double v69; // st6@69 | |
524 double v70; // ST20_8@71 | |
525 double v71; // ST54_8@71 | |
526 double v72; // ST44_8@72 | |
527 double v73; // ST3C_8@72 | |
528 char v74; // zf@72 | |
529 double v75; // ST18_8@73 | |
530 double v76; // ST34_8@73 | |
531 double v77; // ST28_8@74 | |
532 double v78; // ST10_8@74 | |
533 void *v79; // edi@78 | |
534 int v80; // ebx@81 | |
535 char *v81; // ecx@82 | |
536 signed int v82; // esi@82 | |
537 float v83; // ST78_4@83 | |
538 double v84; // ST5C_8@83 | |
539 float v85; // eax@84 | |
540 double v86; // ST20_8@85 | |
541 double v87; // ST54_8@88 | |
542 float v88; // eax@89 | |
543 double v89; // ST44_8@90 | |
544 unsigned __int8 v90; // sf@94 | |
545 unsigned __int8 v91; // of@94 | |
546 int v92; // edx@97 | |
547 int v93; // esi@97 | |
548 int v94; // edi@97 | |
549 int v95; // eax@97 | |
550 int v96; // eax@104 | |
551 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
552 double v98; // [sp+54h] [bp-84h]@49 | |
553 double v99; // [sp+54h] [bp-84h]@66 | |
554 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
555 float v101; // [sp+60h] [bp-78h]@1 | |
556 float v102; // [sp+64h] [bp-74h]@1 | |
557 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
558 float v104; // [sp+A8h] [bp-30h]@1 | |
559 signed int v105; // [sp+A8h] [bp-30h]@96 | |
560 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
561 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
562 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
563 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
564 signed int v110; // [sp+B0h] [bp-28h]@12 | |
565 char *v111; // [sp+B8h] [bp-20h]@30 | |
566 signed int v112; // [sp+B8h] [bp-20h]@48 | |
567 signed int v113; // [sp+B8h] [bp-20h]@65 | |
568 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
569 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
570 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
571 signed int v117; // [sp+C0h] [bp-18h]@1 | |
572 char *v118; // [sp+C0h] [bp-18h]@30 | |
573 char *v119; // [sp+C0h] [bp-18h]@48 | |
574 char *v120; // [sp+C0h] [bp-18h]@65 | |
575 char *v121; // [sp+C4h] [bp-14h]@13 | |
576 char *v122; // [sp+C4h] [bp-14h]@30 | |
577 signed int v123; // [sp+C4h] [bp-14h]@47 | |
578 char *v124; // [sp+C8h] [bp-10h]@30 | |
579 char *v125; // [sp+C8h] [bp-10h]@48 | |
580 char *v126; // [sp+C8h] [bp-10h]@65 | |
581 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
582 char *v128; // [sp+CCh] [bp-Ch]@13 | |
583 char *v129; // [sp+CCh] [bp-Ch]@30 | |
584 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
585 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
586 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
587 char *v133; // [sp+D0h] [bp-8h]@30 | |
588 char *v134; // [sp+D0h] [bp-8h]@48 | |
589 char *v135; // [sp+D0h] [bp-8h]@65 | |
590 signed int v136; // [sp+D4h] [bp-4h]@1 | |
591 char *v137; // [sp+D4h] [bp-4h]@13 | |
592 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
593 char *v139; // [sp+D4h] [bp-4h]@48 | |
594 char *v140; // [sp+D4h] [bp-4h]@65 | |
595 | |
693 | 596 v101 = (double)(signed int)pViewport->uViewportTL_X; |
597 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 598 v117 = a1; |
599 v136 = 1; | |
693 | 600 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
601 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 602 if ( a1 <= 0 ) |
603 return v117; | |
604 v127 = a1; | |
605 v1 = a1; | |
606 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
607 v2 = 0; | |
608 do | |
609 { | |
610 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
611 v136 = 0; | |
612 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
613 v136 = 0; | |
614 ++v2; | |
615 --v127; | |
616 } | |
617 while ( v127 ); | |
618 if ( v136 ) | |
619 return v117; | |
620 v110 = 0; | |
621 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
622 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 623 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 624 if ( v117 < 1 ) |
625 goto LABEL_112; | |
626 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
627 v132 = array_50A2B0; | |
628 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
629 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
630 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 631 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 632 v7 = (char *)&array_50AC10[0].flt_2C; |
633 do | |
634 { | |
635 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 636 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 637 if ( !(v5 ^ v106) ) |
638 goto LABEL_25; | |
639 v8 = v101; | |
693 | 640 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 641 { |
642 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
643 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
644 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
645 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
646 } | |
647 else | |
648 { | |
649 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
650 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
651 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
652 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
653 } | |
654 *(float *)v121 = v10; | |
655 *(int *)v137 = LODWORD(v101); | |
656 LODWORD(v12) = *(int *)v6; | |
657 if ( v5 ) | |
658 { | |
659 v13 = v12 + 6.7553994e15; | |
660 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
661 if ( LODWORD(v13) == LODWORD(v14) ) | |
662 { | |
663 v15 = *(float *)v137 + 6.7553994e15; | |
664 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
665 v17 = LODWORD(v15) == LODWORD(v16); | |
666 goto LABEL_23; | |
667 } | |
668 } | |
669 else | |
670 { | |
671 v18 = v12 + 6.7553994e15; | |
672 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
673 if ( LODWORD(v18) == LODWORD(v19) ) | |
674 { | |
675 v20 = *(float *)v137 + 6.7553994e15; | |
676 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
677 v17 = LODWORD(v20) == LODWORD(v21); | |
678 LABEL_23: | |
679 if ( v17 ) | |
680 goto LABEL_25; | |
681 goto LABEL_24; | |
682 } | |
683 } | |
684 LABEL_24: | |
685 v121 += 48; | |
686 v114 += 48; | |
687 v6 += 48; | |
688 ++v110; | |
689 ++v132; | |
690 v128 = v6; | |
691 v137 += 48; | |
692 LABEL_25: | |
693 if ( v106 ) | |
694 { | |
695 v22 = v132; | |
696 v128 += 48; | |
697 ++v110; | |
698 v114 += 48; | |
699 v121 += 48; | |
700 v137 += 48; | |
701 ++v132; | |
702 memcpy(v22, v7 + 4, 0x30u); | |
703 v6 = v128; | |
704 } | |
705 v5 = v106; | |
706 v7 += 48; | |
707 --v117; | |
708 } | |
709 while ( v117 ); | |
710 if ( v110 < 3 | |
711 || (v115 = 0, | |
712 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
713 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 714 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 715 v110 < 1) ) |
716 goto LABEL_112; | |
168 | 717 v25 = (char *)&array_509950[0]._rhw; |
0 | 718 v138 = array_509950; |
719 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
720 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
721 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
722 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
723 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 724 v111 = (char *)&array_509950[0]._rhw; |
0 | 725 v26 = (char *)&array_50A2B0[0].flt_2C; |
726 while ( 2 ) | |
727 { | |
728 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 729 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
730 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 731 if ( v24 != v27 ) |
732 { | |
733 v28 = v100; | |
693 | 734 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 735 { |
736 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
737 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
738 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
739 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
740 } | |
741 else | |
742 { | |
743 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
744 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
745 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
746 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
747 } | |
748 *(float *)v124 = v30; | |
749 *(int *)v133 = LODWORD(v100); | |
750 if ( v24 ) | |
751 { | |
752 v32 = *(float *)v122 + 6.7553994e15; | |
753 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
754 if ( LODWORD(v32) == LODWORD(v33) ) | |
755 { | |
756 v34 = *(float *)v133 + 6.7553994e15; | |
757 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
758 v36 = LODWORD(v34) == LODWORD(v35); | |
759 goto LABEL_41; | |
760 } | |
761 goto LABEL_42; | |
762 } | |
763 v37 = *(float *)v118 + 6.7553994e15; | |
764 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
765 if ( LODWORD(v37) != LODWORD(v38) ) | |
766 goto LABEL_42; | |
767 v39 = *(float *)v129 + 6.7553994e15; | |
768 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
769 v36 = LODWORD(v39) == LODWORD(v40); | |
770 LABEL_41: | |
771 if ( !v36 ) | |
772 { | |
773 LABEL_42: | |
774 v129 += 48; | |
775 v118 += 48; | |
776 v133 += 48; | |
777 v122 += 48; | |
778 v124 += 48; | |
779 v111 += 48; | |
780 ++v115; | |
781 ++v138; | |
782 } | |
783 } | |
784 if ( v27 ) | |
785 { | |
786 v41 = v138; | |
787 ++v115; | |
788 v111 += 48; | |
789 v124 += 48; | |
790 v122 += 48; | |
791 v133 += 48; | |
792 v118 += 48; | |
793 v129 += 48; | |
794 ++v138; | |
795 memcpy(v41, v26 + 4, 0x30u); | |
796 } | |
797 v24 = v107; | |
798 v26 += 48; | |
799 --v110; | |
800 if ( v110 ) | |
801 { | |
802 v25 = v111; | |
803 continue; | |
804 } | |
805 break; | |
806 } | |
807 if ( v115 < 3 | |
808 || (v123 = 0, | |
809 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
810 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 811 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 812 v115 < 1) ) |
813 goto LABEL_112; | |
814 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
815 v130 = array_508FF0; | |
816 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
817 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
818 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 819 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 820 v45 = (char *)&array_509950[0].flt_2C; |
821 v112 = v115; | |
822 while ( 2 ) | |
823 { | |
824 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 825 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
826 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 827 if ( v43 != v46 ) |
828 { | |
829 v47 = v104; | |
693 | 830 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 831 { |
832 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
833 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
834 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
835 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
836 } | |
837 else | |
838 { | |
839 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
840 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
841 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
842 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
843 } | |
844 *(float *)v125 = v49; | |
845 *(float *)v139 = v104; | |
846 if ( v43 ) | |
847 { | |
848 v51 = v104 + 6.7553994e15; | |
849 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
850 if ( LODWORD(v51) == LODWORD(v52) ) | |
851 { | |
852 v53 = *(float *)v44 + 6.7553994e15; | |
853 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
854 v55 = LODWORD(v53) == LODWORD(v54); | |
855 goto LABEL_58; | |
856 } | |
857 goto LABEL_59; | |
858 } | |
859 v56 = v104 + 6.7553994e15; | |
860 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
861 if ( LODWORD(v56) != LODWORD(v57) ) | |
862 goto LABEL_59; | |
863 v58 = *(float *)v44 + 6.7553994e15; | |
864 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
865 v55 = LODWORD(v58) == LODWORD(v59); | |
866 LABEL_58: | |
867 if ( !v55 ) | |
868 { | |
869 LABEL_59: | |
870 v139 += 48; | |
871 v125 += 48; | |
872 v134 += 48; | |
873 v44 += 48; | |
874 ++v123; | |
875 ++v130; | |
876 v119 = v44; | |
877 } | |
878 } | |
879 if ( v46 ) | |
880 { | |
881 v60 = v130; | |
882 v119 += 48; | |
883 ++v123; | |
884 v134 += 48; | |
885 v125 += 48; | |
886 v139 += 48; | |
887 ++v130; | |
888 memcpy(v60, v45 + 4, 0x30u); | |
889 v44 = v119; | |
890 } | |
891 v43 = v108; | |
892 v45 += 48; | |
893 --v112; | |
894 if ( v112 ) | |
895 continue; | |
896 break; | |
897 } | |
898 if ( v123 < 3 | |
899 || (v116 = 0, | |
900 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
901 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 902 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 903 v123 < 1) ) |
904 goto LABEL_112; | |
905 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
906 v131 = array_508690; | |
907 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
908 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
909 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 910 v135 = (char *)&array_508690[0]._rhw; |
0 | 911 v64 = (char *)&array_508FF0[0].flt_2C; |
912 v113 = v123; | |
913 while ( 2 ) | |
914 { | |
915 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 916 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
917 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 918 if ( v62 != v65 ) |
919 { | |
920 v66 = v102; | |
693 | 921 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 922 { |
923 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
924 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
925 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
926 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
927 } | |
928 else | |
929 { | |
930 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
931 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
932 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
933 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
934 } | |
935 *(float *)v126 = v68; | |
936 *(float *)v140 = v102; | |
937 if ( v62 ) | |
938 { | |
939 v70 = v102 + 6.7553994e15; | |
940 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
941 if ( LODWORD(v70) == LODWORD(v71) ) | |
942 { | |
943 v72 = *(float *)v63 + 6.7553994e15; | |
944 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
945 v74 = LODWORD(v72) == LODWORD(v73); | |
946 goto LABEL_75; | |
947 } | |
948 goto LABEL_76; | |
949 } | |
950 v75 = v102 + 6.7553994e15; | |
951 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
952 if ( LODWORD(v75) != LODWORD(v76) ) | |
953 goto LABEL_76; | |
954 v77 = *(float *)v63 + 6.7553994e15; | |
955 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
956 v74 = LODWORD(v77) == LODWORD(v78); | |
957 LABEL_75: | |
958 if ( !v74 ) | |
959 { | |
960 LABEL_76: | |
961 v140 += 48; | |
962 v126 += 48; | |
963 v135 += 48; | |
964 v63 += 48; | |
965 ++v116; | |
966 ++v131; | |
967 v120 = v63; | |
968 } | |
969 } | |
970 if ( v65 ) | |
971 { | |
972 v79 = v131; | |
973 v120 += 48; | |
974 ++v116; | |
975 v135 += 48; | |
976 v126 += 48; | |
977 v140 += 48; | |
978 ++v131; | |
979 memcpy(v79, v64 + 4, 0x30u); | |
980 v63 = v120; | |
981 } | |
982 v62 = v109; | |
983 v64 += 48; | |
984 --v113; | |
985 if ( v113 ) | |
986 continue; | |
987 break; | |
988 } | |
989 if ( v116 < 3 ) | |
990 goto LABEL_112; | |
991 v80 = v116; | |
992 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
993 if ( v116 > 0 ) | |
994 { | |
995 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
996 v82 = v116; | |
997 do | |
998 { | |
999 LODWORD(v83) = *(int *)v81; | |
1000 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1001 v84 = v83 + 6.7553994e15; | |
693 | 1002 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1003 { |
1004 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1005 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1006 goto LABEL_88; |
1007 v85 = v101; | |
1008 } | |
1009 else | |
1010 { | |
1011 v85 = v100; | |
1012 } | |
1013 *(int *)v81 = LODWORD(v85); | |
1014 LABEL_88: | |
1015 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1016 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1017 { |
1018 v88 = v102; | |
1019 LABEL_92: | |
1020 *((int *)v81 + 1) = LODWORD(v88); | |
1021 goto LABEL_93; | |
1022 } | |
1023 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1024 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1025 { |
1026 v88 = v104; | |
1027 goto LABEL_92; | |
1028 } | |
1029 LABEL_93: | |
1030 v81 += 48; | |
1031 --v82; | |
1032 } | |
1033 while ( v82 ); | |
1034 } | |
1035 v91 = __OFSUB__(v116, 3); | |
1036 v90 = v116 - 3 < 0; | |
1037 if ( v116 > 3 ) | |
1038 { | |
1039 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1040 if ( v116 > 0 ) | |
1041 { | |
1042 v105 = 1; | |
1043 do | |
1044 { | |
1045 v92 = v105; | |
1046 v93 = v105 - 1; | |
1047 v94 = v105 + 1; | |
1048 v95 = v105 + 1; | |
1049 if ( v105 - 1 >= v80 ) | |
1050 v93 -= v80; | |
1051 if ( v105 >= v80 ) | |
1052 v92 = v105 - v80; | |
1053 if ( v94 >= v80 ) | |
1054 v95 = v94 - v80; | |
1055 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1056 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1057 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1058 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1059 { | |
1060 ++v105; | |
1061 } | |
1062 else | |
1063 { | |
1064 v96 = v105; | |
1065 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1066 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1067 --v80; | |
1068 } | |
1069 } | |
1070 while ( v105 - 1 < v80 ); | |
1071 } | |
1072 v91 = __OFSUB__(v80, 3); | |
1073 v90 = v80 - 3 < 0; | |
1074 } | |
1075 if ( v90 ^ v91 ) | |
1076 LABEL_112: | |
1077 result = 0; | |
1078 else | |
1079 result = v80; | |
1080 return result; | |
1081 } | |
1082 | |
1083 //----- (0042620A) -------------------------------------------------------- | |
1084 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1085 { | |
1086 __int16 v1; // fps@1 | |
1087 unsigned __int8 v2; // c0@2 | |
1088 char v3; // c2@2 | |
1089 unsigned __int8 v4; // c3@2 | |
1090 bool result; // eax@2 | |
1091 unsigned __int8 v6; // c0@4 | |
1092 char v7; // c2@4 | |
1093 unsigned __int8 v8; // c3@4 | |
1094 unsigned __int8 v9; // c0@6 | |
1095 char v10; // c2@6 | |
1096 unsigned __int8 v11; // c3@6 | |
1097 double v12; // st6@7 | |
1098 float v13; // ST04_4@7 | |
1099 float v14; // ST00_4@7 | |
1100 double v15; // st7@7 | |
1101 double v16; // st6@8 | |
1102 float v17; // ST04_4@8 | |
1103 float v18; // ST00_4@8 | |
1104 double v19; // st7@8 | |
1105 | |
1106 //UNDEF(v1); | |
1107 if ( p->vWorldViewPosition.x < 300.0 | |
1108 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1109 v3 = 0, | |
1110 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1111 //BYTE1(result) = HIBYTE(v1), |
0 | 1112 !(v2 | v4)) ) |
1113 { | |
1114 if ( p->vWorldViewPosition.x < 300.0 ) | |
1115 { | |
1116 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1117 v7 = 0; | |
1118 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1119 //BYTE1(result) = HIBYTE(v1); |
0 | 1120 if ( !(v6 | v8) ) |
1121 { | |
921 | 1122 //LOBYTE(result) = 0; |
1123 return false; | |
0 | 1124 } |
1125 } | |
1126 v9 = 300.0 < p->vWorldViewPosition.x; | |
1127 v10 = 0; | |
1128 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1129 //BYTE1(result) = HIBYTE(v1); |
0 | 1130 if ( v9 | v11 ) |
1131 { | |
1132 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1133 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1134 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1135 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1136 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1137 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1138 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1139 } | |
1140 else | |
1141 { | |
1142 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1143 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1144 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1145 v15 = 300.0 - p->vWorldViewPosition.x; | |
1146 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1147 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1148 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1149 } | |
1150 } | |
921 | 1151 //LOBYTE(result) = 1; |
1152 return true; | |
0 | 1153 } |
1154 | |
1155 //----- (004268E3) -------------------------------------------------------- | |
1156 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1157 { | |
1158 unsigned int v1; // eax@1 | |
1159 unsigned int v2; // edx@1 | |
1160 int v3; // eax@1 | |
1161 int v4; // edx@1 | |
1162 unsigned int v5; // ecx@1 | |
1163 | |
1164 v1 = uColor >> 9; | |
1165 v2 = uColor >> 6; | |
1166 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1167 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1168 v3 = v2 | v1; | |
1169 v4 = (unsigned __int8)uColor >> 3; | |
1170 v5 = uColor >> 16; | |
1171 LOWORD(v5) = v5 & 0x8000; | |
1172 return v5 | v4 | v3; | |
1173 } | |
1174 | |
1175 //----- (0042690D) -------------------------------------------------------- | |
1176 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1177 { | |
1178 unsigned int v1; // eax@1 | |
1179 unsigned int v2; // edx@1 | |
1180 | |
1181 v1 = a1 >> 8; | |
1182 v2 = a1 >> 5; | |
1183 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1184 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1185 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1186 } | |
1187 //----- (00426947) -------------------------------------------------------- | |
1188 void __cdecl sub_426947() | |
1189 { | |
893 | 1190 stru_50C198.field_0 = 0; |
0 | 1191 dword_50C994 = 0; |
1192 dword_50C998_turnbased_icon_1A = 0; | |
1193 } | |
1194 // 50C968: using guessed type int dword_50C968; | |
1195 // 50C994: using guessed type int dword_50C994; | |
1196 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1197 | |
1198 //----- (004269A2) -------------------------------------------------------- | |
958 | 1199 void __fastcall GivePartyExp(unsigned int pEXPNum) |
0 | 1200 { |
958 | 1201 signed int pActivePlayerCount; // ecx@1 |
1202 int pLearningPercent; // eax@13 | |
1203 | |
1204 pActivePlayerCount = 0; | |
1205 for ( uint i = 0; i < 4; ++i ) | |
1206 { | |
1207 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) | |
1208 pActivePlayerCount ++; | |
1209 } | |
1210 if ( pActivePlayerCount ) | |
0 | 1211 { |
958 | 1212 pEXPNum = pEXPNum / pActivePlayerCount; |
1213 for ( uint i = 0; i < 4; ++i ) | |
0 | 1214 { |
958 | 1215 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) |
0 | 1216 { |
958 | 1217 if ( pEXPNum ) |
0 | 1218 { |
958 | 1219 pLearningPercent = pParty->pPlayers[i].GetLearningPercent(); |
1220 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100; | |
1221 pParty->pPlayers[i].uExperience += pEXPNum; | |
1222 if ( pParty->pPlayers[i].uExperience > 4000000000i64 ) | |
0 | 1223 { |
958 | 1224 pParty->pPlayers[i].uExperience = 0; |
0 | 1225 } |
1226 } | |
1227 } | |
1228 } | |
1229 } | |
1230 } | |
1231 | |
1232 //----- (00426A5A) -------------------------------------------------------- | |
1233 void stru319::LootActor(Actor *pActor) | |
1234 { | |
1235 signed int v2; // edi@1 | |
1236 char v3; // zf@1 | |
1237 unsigned int v4; // eax@13 | |
1238 unsigned int v5; // esi@13 | |
1239 int v6; // eax@14 | |
1240 unsigned __int8 v7; // al@30 | |
1241 Party *v8; // esi@34 | |
1242 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1243 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1244 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1245 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1246 int v13; // [sp+30h] [bp-8h]@1 | |
1247 int v14; // [sp+34h] [bp-4h]@1 | |
1248 | |
1249 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1250 Dst.Reset(); | |
1251 v2 = 0; | |
1252 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1253 v13 = 0; | |
1254 v14 = 0; | |
1255 if ( v3 ) | |
1256 { | |
1257 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1258 goto LABEL_9; | |
1259 do | |
1260 { | |
1261 ++v2; | |
1262 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1263 } | |
1264 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1265 } | |
1266 else | |
1267 { | |
1268 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1269 goto LABEL_9; | |
377 | 1270 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1271 pActor->array_000234[3].Reset(); |
1272 } | |
1273 if ( v14 ) | |
1274 { | |
1275 party_finds_gold(v14, 0); | |
1276 viewparams->bRedrawGameUI = 1; | |
1277 } | |
1278 LABEL_9: | |
1279 if ( pActor->uCarriedItemID ) | |
1280 { | |
1281 Dst.Reset(); | |
1282 Dst.uItemID = pActor->uCarriedItemID; | |
1283 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1284 if ( v14 ) | |
721 | 1285 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1286 else |
721 | 1287 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1288 ShowStatusBarString(pTmpBuf2, 2u); |
1289 v4 = Dst.uItemID; | |
1290 v5 = Dst.uItemID; | |
1291 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1292 { | |
1293 v5 = Dst.uItemID; | |
1294 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1295 Dst.uNumCharges = v6; | |
1296 Dst.uMaxCharges = v6; | |
1297 v4 = Dst.uItemID; | |
1298 } | |
1299 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1300 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1301 pItemsTable->SetSpecialBonus(&Dst); |
1302 if ( !pParty->AddItem(&Dst) ) | |
1303 pParty->SetHoldingItem(&Dst); | |
1304 pActor->uCarriedItemID = 0; | |
1305 if ( pActor->array_000234[0].uItemID ) | |
1306 { | |
1307 if ( !pParty->AddItem(pActor->array_000234) ) | |
1308 { | |
1309 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1310 pParty->SetHoldingItem(pActor->array_000234); | |
1311 } | |
1312 pActor->array_000234[0].Reset(); | |
1313 } | |
1314 if ( pActor->array_000234[1].uItemID ) | |
1315 { | |
1316 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1317 { | |
1318 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1319 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1320 } | |
1321 pActor->array_000234[1].Reset(); | |
1322 } | |
1323 LABEL_55: | |
1324 pActor->Remove(); | |
1325 return; | |
1326 } | |
1327 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1328 { | |
1329 if ( pActor->array_000234[3].uItemID ) | |
1330 { | |
1331 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1332 pActor->array_000234[3].Reset(); | |
1333 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1334 if ( v14 ) | |
721 | 1335 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1336 else |
721 | 1337 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1338 ShowStatusBarString(pTmpBuf2, 2u); |
1339 if ( !pParty->AddItem(&Dst) ) | |
1340 pParty->SetHoldingItem(&Dst); | |
1341 v13 = 1; | |
1342 } | |
1343 goto LABEL_44; | |
1344 } | |
1345 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1346 { | |
1347 LABEL_44: | |
1348 v8 = pParty; | |
1349 goto LABEL_45; | |
1350 } | |
1351 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1352 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1353 if ( v14 ) | |
721 | 1354 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1355 else |
721 | 1356 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1357 ShowStatusBarString(pTmpBuf2, 2u); |
1358 v8 = pParty; | |
1359 if ( !pParty->AddItem(&Dst) ) | |
1360 pParty->SetHoldingItem(&Dst); | |
1361 v13 = 1; | |
1362 LABEL_45: | |
1363 if ( pActor->array_000234[0].uItemID ) | |
1364 { | |
1365 if ( !v8->AddItem(pActor->array_000234) ) | |
1366 { | |
1367 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1368 v8->SetHoldingItem(pActor->array_000234); | |
1369 v13 = 1; | |
1370 } | |
1371 pActor->array_000234[0].Reset(); | |
1372 } | |
1373 if ( pActor->array_000234[1].uItemID ) | |
1374 { | |
1375 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1376 { | |
1377 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1378 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1379 v13 = 1; | |
1380 } | |
1381 pActor->array_000234[1].Reset(); | |
1382 } | |
1383 if ( !v13 || rand() % 100 < 90 ) | |
1384 goto LABEL_55; | |
1385 } | |
1386 | |
1387 //----- (00426E10) -------------------------------------------------------- | |
1388 int stru319::which_player_would_attack(Actor *pActor) | |
1389 { | |
1390 signed int v2; // ebx@1 | |
1391 int v3; // ecx@2 | |
1392 signed int v4; // edx@3 | |
1393 char v5; // zf@3 | |
1394 unsigned int v6; // eax@3 | |
1395 int v7; // eax@6 | |
1396 int v8; // eax@7 | |
1397 int v9; // eax@8 | |
1398 int v10; // eax@9 | |
1399 int v11; // eax@10 | |
1400 int v12; // eax@11 | |
1401 int v13; // esi@35 | |
1402 signed int v14; // edi@37 | |
1403 enum CHARACTER_RACE v15; // eax@44 | |
1404 Player *v16; // ecx@47 | |
1405 unsigned __int8 v17; // sf@50 | |
1406 unsigned __int8 v18; // of@50 | |
1407 int v19; // esi@52 | |
1408 Player *v20; // ecx@53 | |
1409 int result; // eax@57 | |
1410 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1411 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1412 int v24; // [sp+138h] [bp-10h]@2 | |
1413 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1414 int v26; // [sp+140h] [bp-8h]@1 | |
1415 int v27; // [sp+144h] [bp-4h]@1 | |
1416 | |
1417 v27 = -1; | |
1418 v26 = -1; | |
1419 v25 = -1; | |
1420 v2 = 0; | |
1421 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1422 { | |
1423 v3 = 0; | |
1424 v24 = 0; | |
1425 do | |
1426 { | |
1427 v4 = 1; | |
1428 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1429 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1430 v22[v3] = v6; | |
1431 if ( !v5 ) | |
1432 { | |
1433 if ( (signed int)v6 > 128 ) | |
1434 { | |
1435 switch ( v6 ) | |
1436 { | |
1437 case 0x100u: | |
1438 v27 = 8; | |
1439 break; | |
1440 case 0x200u: | |
1441 v25 = 0; | |
1442 break; | |
1443 case 0x400u: | |
1444 v25 = 1; | |
1445 break; | |
1446 case 0x800u: | |
1447 v26 = 0; | |
1448 break; | |
1449 case 0x1000u: | |
1450 v26 = 1; | |
1451 break; | |
1452 case 0x2000u: | |
1453 v26 = 3; | |
1454 break; | |
1455 case 0x4000u: | |
1456 v26 = 2; | |
1457 break; | |
1458 } | |
1459 } | |
1460 else | |
1461 { | |
1462 if ( v6 == 128 ) | |
1463 { | |
1464 v27 = 4; | |
1465 } | |
1466 else | |
1467 { | |
1468 v7 = v6 - 1; | |
1469 if ( v7 ) | |
1470 { | |
1471 v8 = v7 - 1; | |
1472 if ( v8 ) | |
1473 { | |
1474 v9 = v8 - 2; | |
1475 if ( v9 ) | |
1476 { | |
1477 v10 = v9 - 4; | |
1478 if ( v10 ) | |
1479 { | |
1480 v11 = v10 - 8; | |
1481 if ( v11 ) | |
1482 { | |
1483 v12 = v11 - 16; | |
1484 if ( v12 ) | |
1485 { | |
1486 if ( v12 == 32 ) | |
1487 v27 = 20; | |
1488 } | |
1489 else | |
1490 { | |
1491 v27 = 32; | |
1492 } | |
1493 } | |
1494 else | |
1495 { | |
1496 v27 = 24; | |
1497 } | |
1498 } | |
1499 else | |
1500 { | |
1501 v27 = 28; | |
1502 } | |
1503 } | |
1504 else | |
1505 { | |
1506 v27 = 16; | |
1507 } | |
1508 } | |
1509 else | |
1510 { | |
1511 v27 = 12; | |
1512 } | |
1513 } | |
1514 else | |
1515 { | |
1516 v27 = 0; | |
1517 } | |
1518 } | |
1519 } | |
1520 v2 = 0; | |
1521 v13 = 0; | |
1522 while ( 1 ) | |
1523 { | |
1524 v14 = 0; | |
135 | 1525 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1526 v14 = v4; |
1527 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1528 v14 = v4; | |
1529 if ( v26 != -1 ) | |
1530 { | |
1531 v15 = pPlayers[v13 + 1]->GetRace(); | |
1532 if ( v26 == v15 ) | |
1533 v14 = 1; | |
1534 } | |
1535 if ( v14 == 1 ) | |
1536 { | |
1537 v16 = pPlayers[v13 + 1]; | |
1538 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1539 v23[v2++] = v13; | |
1540 } | |
1541 ++v13; | |
1542 if ( v13 >= 4 ) | |
1543 break; | |
1544 v4 = 1; | |
1545 } | |
1546 } | |
1547 v3 = v24 + 1; | |
1548 v18 = __OFSUB__(v24 + 1, 15); | |
1549 v17 = v24++ - 14 < 0; | |
1550 } | |
1551 while ( v17 ^ v18 ); | |
1552 if ( v2 ) | |
1553 goto LABEL_61; | |
1554 } | |
1555 v19 = 0; | |
1556 do | |
1557 { | |
1558 v20 = pPlayers[v19 + 1]; | |
1559 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1560 v23[v2++] = v19; | |
1561 ++v19; | |
1562 } | |
1563 while ( v19 < 4 ); | |
1564 if ( v2 ) | |
1565 LABEL_61: | |
1566 result = v23[rand() % v2]; | |
1567 else | |
1568 result = 0; | |
1569 return result; | |
1570 } | |
1571 | |
1572 //----- (0042704B) -------------------------------------------------------- | |
1573 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1574 { | |
1575 stru319 *v3; // edi@1 | |
1576 signed int v4; // ebx@5 | |
1577 signed int v5; // edi@5 | |
1578 | |
1579 v3 = this; | |
1580 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1581 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1582 && rand() % 100 < 5 ) | |
1583 pActor->_44FD29(a2); | |
1584 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1585 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1586 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1587 return 2; | |
1588 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1589 return 3; | |
1590 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1591 } | |
1592 | |
1593 //----- (00427102) -------------------------------------------------------- | |
1594 int stru319::_427102(Actor *pActor, signed int a2) | |
1595 { | |
1596 unsigned __int8 v3; // cf@11 | |
1597 unsigned __int8 v4; // zf@11 | |
1598 SpellBuff *v6; // ecx@46 | |
89 | 1599 Player *v7; // esi@49 |
0 | 1600 signed int v8; // edx@50 |
89 | 1601 SpellBuff *v9; // ecx@50 |
0 | 1602 |
597 | 1603 switch(a2) |
0 | 1604 { |
597 | 1605 case 77: |
1606 { | |
1607 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1608 return 0; | |
1609 return 1; | |
1610 } | |
1611 case 80: | |
1612 { | |
1613 v6 = pParty->pPartyBuffs; | |
1614 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1615 { | |
1616 ++v6; | |
1617 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1618 { | |
1619 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1620 v8 = 0; | |
1621 v9 = v7->pPlayerBuffs; | |
1622 while ( v9->uExpireTime <= 0i64 ) | |
1623 { | |
1624 ++v8; | |
1625 ++v9; | |
1626 if ( v8 >= 24 ) | |
1627 { | |
1628 ++v7; | |
1629 if ( v7 <= &pParty->pPlayers[3] ) | |
1630 { | |
1631 v8 = 0; | |
1632 v9 = v7->pPlayerBuffs; | |
1633 } | |
1634 else | |
1635 return 0; | |
1636 } | |
1637 } | |
1638 return 1; | |
1639 } | |
1640 } | |
1641 return 1; | |
1642 } | |
1643 case 85: | |
1644 { | |
1645 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1646 return 1; | |
1647 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1648 return 0; | |
1649 v3 = 0; | |
1650 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1651 break; | |
1652 } | |
1653 case 86: | |
1654 { | |
0 | 1655 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1656 return 1; |
0 | 1657 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1658 return 0; |
0 | 1659 v3 = 0; |
1660 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1661 break; |
1662 } | |
1663 case 95: | |
1664 { | |
1665 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1666 return 1; | |
0 | 1667 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1668 return 0; |
0 | 1669 v3 = 0; |
1670 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1671 break; |
1672 } | |
1673 case 73: | |
1674 { | |
1675 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1676 return 1; | |
1677 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1678 return 0; | |
1679 v3 = 0; | |
1680 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1681 break; | |
1682 } | |
1683 case 5: | |
1684 { | |
1685 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1686 return 1; | |
1687 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1688 return 0; | |
1689 v3 = 0; | |
1690 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1691 break; | |
1692 } | |
1693 case 17: | |
1694 { | |
1695 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1696 return 1; | |
1697 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1698 return 0; | |
1699 v3 = 0; | |
1700 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1701 break; | |
1702 } | |
1703 case 38: | |
89 | 1704 { |
597 | 1705 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1706 return 1; | |
1707 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1708 return 0; | |
1709 v3 = 0; | |
1710 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1711 } | |
1712 case 46: | |
1713 { | |
1714 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1715 return 1; |
597 | 1716 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1717 return 0; | |
1718 v3 = 0; | |
1719 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1720 break; | |
1721 } | |
1722 case 47: | |
1723 { | |
1724 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1725 return 1; | |
1726 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1727 return 0; | |
1728 v3 = 0; | |
1729 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1730 break; | |
1731 } | |
1732 case 51: | |
1733 { | |
1734 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1735 return 1; | |
1736 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1737 { | |
89 | 1738 v3 = 0; |
1739 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1740 } | |
1741 else | |
597 | 1742 return 0; |
1743 break; | |
1744 } | |
1745 default: | |
89 | 1746 { |
597 | 1747 return 1; |
89 | 1748 } |
0 | 1749 } |
1750 if ( !(v3 | v4) ) | |
1751 return 0; | |
1752 return 1; | |
1753 } | |
1754 | |
1755 //----- (004272F5) -------------------------------------------------------- | |
1756 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1757 { | |
1758 signed int v5; // esi@1 | |
1759 signed int v6; // edi@1 | |
1760 int v7; // esi@8 | |
1761 int v8; // eax@9 | |
1762 int v9; // edx@11 | |
1763 int v10; // edx@13 | |
1764 int v11; // esi@13 | |
1765 unsigned __int8 v12; // sf@13 | |
1766 unsigned __int8 v13; // of@13 | |
1767 int v14; // edx@14 | |
1768 int v15; // eax@14 | |
1769 signed int result; // eax@17 | |
1770 | |
1771 v5 = pActor->pMonsterInfo.uAC; | |
1772 v6 = 0; | |
1773 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1774 v5 /= 2; | |
1775 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1776 v6 = pActor->pActorBuffs[15].uPower; | |
1777 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1778 v6 = pActor->pActorBuffs[16].uPower; | |
1779 v7 = v6 + v5; | |
1780 if ( a3 ) | |
1781 v8 = pPlayer->GetRangedAttack(); | |
1782 else | |
1783 v8 = pPlayer->GetActualAttack(0); | |
1784 v9 = rand() % (v7 + 2 * v8 + 30); | |
1785 if ( a3 == 2 ) | |
1786 { | |
1787 v14 = a4 + v9; | |
1788 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1789 } | |
1790 else | |
1791 { | |
1792 if ( a3 != 3 ) | |
1793 { | |
1794 v10 = a4 + v9; | |
1795 v11 = v7 + 15; | |
1796 v13 = __OFSUB__(v10, v11); | |
1797 v12 = v10 - v11 < 0; | |
1798 goto LABEL_16; | |
1799 } | |
1800 v14 = a4 + v9; | |
1801 v15 = 2 * v7 + 30; | |
1802 } | |
1803 v13 = __OFSUB__(v14, v15); | |
1804 v12 = v14 - v15 < 0; | |
1805 LABEL_16: | |
1806 if ( v12 ^ v13 ) | |
1807 result = 0; | |
1808 else | |
1809 result = 1; | |
1810 return result; | |
1811 } | |
1812 | |
1813 //----- (004273BB) -------------------------------------------------------- | |
1814 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1815 { | |
1816 Actor *v5; // ecx@1 | |
1817 signed int v6; // ebx@1 | |
1818 signed int v7; // esi@1 | |
1819 unsigned __int8 v8; // zf@1 | |
1820 unsigned __int8 v9; // sf@1 | |
1821 int v10; // ebx@10 | |
1822 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1823 | |
1824 v5 = a2; | |
1825 v6 = a2->pMonsterInfo.uAC; | |
1826 v7 = 0; | |
1827 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1828 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1829 a2a = 0; | |
1830 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1831 v6 /= 2; | |
1832 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1833 v7 = v5->pActorBuffs[14].uPower; | |
1834 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1835 v7 = v5->pActorBuffs[16].uPower; | |
1836 v10 = v7 + v6; | |
1837 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1838 a2a = pActor->pActorBuffs[14].uPower; | |
1839 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1840 a2a = pActor->pActorBuffs[17].uPower; | |
1841 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1842 { | |
1843 a2a += pActor->pActorBuffs[11].uPower; | |
1844 pActor->pActorBuffs[11].Reset(); | |
1845 } | |
1846 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1847 } | |
1848 | |
1849 //----- (004274AD) -------------------------------------------------------- | |
1850 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1851 { | |
1852 signed int v3; // edi@1 | |
1853 signed int v4; // esi@8 | |
1854 int v5; // esi@8 | |
1855 | |
1856 v3 = 0; | |
1857 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1858 v3 = pActor->pActorBuffs[14].uPower; | |
1859 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1860 v3 = pActor->pActorBuffs[17].uPower; | |
1861 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1862 { | |
1863 v3 += pActor->pActorBuffs[11].uPower; | |
1864 pActor->pActorBuffs[11].Reset(); | |
1865 } | |
1866 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1867 v5 = rand() % v4 + 1; | |
1868 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1869 } | |
1870 | |
1871 //----- (00427546) -------------------------------------------------------- | |
1872 int stru319::_427546(int a2) | |
1873 { | |
1874 int result; // eax@2 | |
1875 | |
1876 if ( a2 >= 0 ) | |
1877 { | |
1878 if ( a2 >= 1 ) | |
1879 result = (a2 >= 2) + 2; | |
1880 else | |
1881 result = 1; | |
1882 } | |
1883 else | |
1884 { | |
1885 result = 0; | |
1886 } | |
1887 return result; | |
1888 } | |
1889 | |
1890 //----- (0042756B) -------------------------------------------------------- | |
1891 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1892 { | |
1893 int v4; // edx@1 | |
1894 int v5; // ecx@1 | |
1895 signed int v6; // eax@4 | |
1896 signed int result; // eax@17 | |
1897 signed int v8; // esi@18 | |
1898 | |
1899 v4 = 0; | |
1900 v5 = 0; | |
1901 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1902 v5 = pActor->pActorBuffs[14].uPower; | |
1903 switch ( a2 ) | |
1904 { | |
1905 case 4: | |
1906 v6 = pActor->pMonsterInfo.uResPhysical; | |
1907 break; | |
1908 case 0: | |
1909 v6 = pActor->pMonsterInfo.uResFire; | |
1910 goto LABEL_12; | |
1911 case 1: | |
1912 v6 = pActor->pMonsterInfo.uResAir; | |
1913 goto LABEL_12; | |
1914 case 2: | |
1915 v6 = pActor->pMonsterInfo.uResWater; | |
1916 goto LABEL_12; | |
1917 case 3: | |
1918 v6 = pActor->pMonsterInfo.uResEarth; | |
1919 goto LABEL_12; | |
1920 case 6: | |
1921 v6 = pActor->pMonsterInfo.uResSpirit; | |
1922 break; | |
1923 case 7: | |
1924 v6 = pActor->pMonsterInfo.uResMind; | |
1925 goto LABEL_12; | |
1926 case 8: | |
1927 v6 = pActor->pMonsterInfo.uResBody; | |
1928 LABEL_12: | |
1929 v4 = v5; | |
1930 break; | |
1931 case 9: | |
1932 v6 = pActor->pMonsterInfo.uResLight; | |
1933 break; | |
1934 case 10: | |
1935 v6 = pActor->pMonsterInfo.uResDark; | |
1936 break; | |
1937 default: | |
1938 v6 = 0; | |
1939 break; | |
1940 } | |
1941 if ( v6 < 200 ) | |
1942 { | |
1943 v8 = v4 + v6 + 30; | |
1944 if ( rand() % v8 >= 30 ) | |
1945 { | |
1946 a3 >>= 1; | |
1947 if ( rand() % v8 >= 30 ) | |
1948 { | |
1949 a3 >>= 1; | |
1950 if ( rand() % v8 >= 30 ) | |
1951 { | |
1952 a3 >>= 1; | |
1953 if ( rand() % v8 >= 30 ) | |
1954 a3 >>= 1; | |
1955 } | |
1956 } | |
1957 } | |
1958 result = a3; | |
1959 } | |
1960 else | |
1961 { | |
1962 result = 0; | |
1963 } | |
1964 return result; | |
1965 } | |
1966 | |
1967 //----- (00427662) -------------------------------------------------------- | |
1968 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
1969 { | |
1970 Actor *v3; // edi@2 | |
1971 signed int v4; // esi@2 | |
1972 bool result; // eax@13 | |
1973 | |
1974 switch ( uType ) | |
1975 { | |
1976 case 0u: | |
1977 v3 = pActor; | |
1978 v4 = pActor->pMonsterInfo.uResFire; | |
1979 goto LABEL_12; | |
1980 case 1u: | |
1981 v3 = pActor; | |
1982 v4 = pActor->pMonsterInfo.uResAir; | |
1983 goto LABEL_12; | |
1984 case 2u: | |
1985 v3 = pActor; | |
1986 v4 = pActor->pMonsterInfo.uResWater; | |
1987 goto LABEL_12; | |
1988 case 3u: | |
1989 v3 = pActor; | |
1990 v4 = pActor->pMonsterInfo.uResEarth; | |
1991 goto LABEL_12; | |
1992 case 7u: | |
1993 v3 = pActor; | |
1994 v4 = pActor->pMonsterInfo.uResMind; | |
1995 goto LABEL_12; | |
1996 case 6u: | |
1997 v3 = pActor; | |
1998 v4 = pActor->pMonsterInfo.uResSpirit; | |
1999 goto LABEL_12; | |
2000 case 8u: | |
2001 v3 = pActor; | |
2002 v4 = pActor->pMonsterInfo.uResBody; | |
2003 goto LABEL_12; | |
2004 case 9u: | |
2005 v3 = pActor; | |
2006 v4 = pActor->pMonsterInfo.uResLight; | |
2007 goto LABEL_12; | |
2008 case 0xAu: | |
2009 v3 = pActor; | |
2010 v4 = pActor->pMonsterInfo.uResDark; | |
2011 goto LABEL_12; | |
2012 case 4u: | |
2013 v3 = pActor; | |
2014 v4 = pActor->pMonsterInfo.uResPhysical; | |
2015 LABEL_12: | |
2016 if ( v4 < 200 ) | |
2017 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2018 else | |
2019 result = 0; | |
2020 break; | |
2021 default: | |
2022 result = 1; | |
2023 break; | |
2024 } | |
2025 return result; | |
2026 } | |
2027 | |
2028 //----- (00427769) -------------------------------------------------------- | |
2029 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2030 { | |
2031 bool result; // eax@2 | |
2032 | |
710 | 2033 __debugbreak(); // refactor |
0 | 2034 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2035 result = 1; | |
2036 else | |
2037 result = 0; | |
2038 return result; | |
2039 } | |
2040 | |
2041 //----- (0042777D) -------------------------------------------------------- | |
319 | 2042 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2043 { |
370 | 2044 //bool result; // eax@2 |
486 | 2045 //__int16 v6; // bx@4 |
437 | 2046 //Player *v7; // eax@4 |
486 | 2047 //char v8; // zf@12 |
0 | 2048 unsigned __int16 v9; // cx@16 |
2049 unsigned int v10; // eax@18 | |
2050 unsigned __int8 v11; // sf@18 | |
2051 unsigned __int8 v12; // of@18 | |
2052 unsigned __int16 v13; // cx@21 | |
2053 unsigned int v14; // eax@23 | |
486 | 2054 //stru277 *v15; // esi@27 |
2055 //stru277 *v16; // eax@28 | |
832 | 2056 //GUIWindow *v17; // eax@43 |
2057 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2058 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2059 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2060 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2061 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2062 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2063 //int v24; // [sp-18h] [bp-30h]@44 | |
2064 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2065 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2066 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2067 //char *v28; // [sp-8h] [bp-20h]@43 | |
2068 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2069 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2070 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2071 | |
2072 //a3a = uPlayerID; | |
2073 //a2a = a1; | |
370 | 2074 |
2075 //if ( pParty->bTurnBasedModeOn != 1 | |
2076 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2077 if (pParty->bTurnBasedModeOn) | |
0 | 2078 { |
370 | 2079 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2080 return; | |
2081 } | |
2082 | |
2083 | |
486 | 2084 //v6 = a5; |
437 | 2085 //v7 = &pParty->pPlayers[uPlayerID]; |
2086 assert(uPlayerID < 4); | |
2087 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2088 if ( !(a5 & 0x10) ) |
2089 { | |
2090 switch ( a1 ) | |
2091 { | |
486 | 2092 case SPELL_SPIRIT_FATE: |
2093 case SPELL_BODY_FIRST_AID: | |
2094 case SPELL_DARK_REANIMATE: | |
2095 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2096 a5 |= 0x0100; | |
0 | 2097 break; |
486 | 2098 |
2099 case SPELL_FIRE_FIRE_AURA: | |
2100 case SPELL_WATER_RECHARGE_ITEM: | |
2101 case SPELL_WATER_ENCHANT_ITEM: | |
2102 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2103 //LOBYTE(v6) = a5 | 0x80; | |
2104 a5 |= 0x0080; | |
0 | 2105 break; |
486 | 2106 |
2107 case SPELL_FIRE_FIRE_BOLT: | |
2108 case SPELL_FIRE_FIREBALL: | |
2109 case SPELL_FIRE_INCINERATE: | |
2110 case SPELL_AIR_LIGHNING_BOLT: | |
2111 case SPELL_AIR_IMPLOSION: | |
2112 case SPELL_WATER_POISON_SPRAY: | |
2113 case SPELL_WATER_ICE_BOLT: | |
2114 case SPELL_WATER_ACID_BURST: | |
2115 case SPELL_WATER_ICE_BLAST: | |
2116 case SPELL_EARTH_STUN: | |
2117 case SPELL_EARTH_SLOW: | |
2118 case SPELL_EARTH_DEADLY_SWARM: | |
2119 case SPELL_EARTH_BLADES: | |
2120 case SPELL_EARTH_MASS_DISTORTION: | |
2121 case SPELL_SPIRIT_SPIRIT_LASH: | |
2122 case SPELL_MIND_MIND_BLAST: | |
2123 case SPELL_MIND_CHARM: | |
2124 case SPELL_MIND_PSYCHIC_SHOCK: | |
2125 case SPELL_BODY_HARM: | |
2126 case SPELL_BODY_FLYING_FIST: | |
2127 case SPELL_LIGHT_LIGHT_BOLT: | |
2128 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2129 case SPELL_LIGHT_SUNRAY: | |
2130 case SPELL_DARK_TOXIC_CLOUD: | |
2131 case SPELL_DARK_SHRINKING_RAY: | |
2132 case SPELL_DARK_SHARPMETAL: | |
2133 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2134 if ( !a6 ) |
486 | 2135 a5 |= 0x0008; |
0 | 2136 break; |
486 | 2137 case SPELL_MIND_TELEPATHY: |
2138 case SPELL_MIND_BERSERK: | |
2139 case SPELL_MIND_ENSLAVE: | |
2140 case SPELL_LIGHT_PARALYZE: | |
2141 case SPELL_DARK_CONTROL_UNDEAD: | |
2142 //LABEL_9: | |
2143 //v6 = a5 | 8; | |
2144 a5 |= 0x0008; | |
0 | 2145 break; |
486 | 2146 |
2147 case SPELL_EARTH_TELEKINESIS: | |
2148 a5 |= 0x0040; | |
2149 break; | |
2150 | |
2151 case SPELL_SPIRIT_BLESS: | |
2152 if (a4 && ~a4 & 0x01C0) | |
2153 goto LABEL_25; | |
2154 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); | |
0 | 2155 goto LABEL_25; |
2156 break; | |
486 | 2157 |
2158 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2159 v9 = a4; |
2160 if ( !a4 ) | |
437 | 2161 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
0 | 2162 goto LABEL_18; |
486 | 2163 |
2164 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2165 v9 = a4; |
2166 if ( !a4 ) | |
437 | 2167 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
0 | 2168 LABEL_18: |
2169 v10 = SkillToMastery(v9); | |
2170 v12 = __OFSUB__(v10, 3); | |
2171 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2172 goto LABEL_24; | |
486 | 2173 |
2174 case SPELL_BODY_HAMMERHANDS: | |
0 | 2175 v13 = a4; |
2176 if ( !a4 ) | |
437 | 2177 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2178 v14 = SkillToMastery(v13); |
2179 v12 = __OFSUB__(v14, 4); | |
2180 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
2181 LABEL_24: | |
2182 if ( v11 ^ v12 ) | |
2183 goto LABEL_25; | |
2184 break; | |
486 | 2185 |
2186 case SPELL_EARTH_STONE_TO_FLESH: | |
2187 case SPELL_SPIRIT_REMOVE_CURSE: | |
2188 case SPELL_SPIRIT_RAISE_DEAD: | |
2189 case SPELL_SPIRIT_RESSURECTION: | |
2190 case SPELL_MIND_REMOVE_FEAR: | |
2191 case SPELL_MIND_CURE_PARALYSIS: | |
2192 case SPELL_MIND_CURE_INSANITY: | |
2193 case SPELL_BODY_CURE_WEAKNESS: | |
2194 case SPELL_BODY_REGENERATION: | |
2195 case SPELL_BODY_CURE_POISON: | |
2196 case SPELL_BODY_CURE_DISEASE: | |
0 | 2197 LABEL_25: |
486 | 2198 //v6 = a5 | 2; |
2199 a5 |= 0x0002; | |
0 | 2200 break; |
486 | 2201 |
2202 case SPELL_DARK_SACRIFICE: | |
2203 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2204 a5 |= 0x0200; | |
0 | 2205 break; |
2206 default: | |
2207 break; | |
2208 } | |
2209 } | |
370 | 2210 |
486 | 2211 |
2212 if (a5 & 0x3CA) | |
0 | 2213 { |
924 | 2214 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2215 for (uint i = 0; i < 10; ++i) |
924 | 2216 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2217 { |
924 | 2218 pCastSpellInfo[i].spellnum = 0; |
486 | 2219 break; |
2220 } | |
0 | 2221 } |
486 | 2222 |
924 | 2223 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2224 for (uint i = 0; i < 10; ++i) |
0 | 2225 { |
924 | 2226 auto spell = pCastSpellInfo + i; |
486 | 2227 if (!spell->spellnum) |
2228 continue; | |
2229 | |
2230 spell->spellnum = 0; | |
2231 if (spell->field_8 & 0x3CA) | |
0 | 2232 { |
486 | 2233 pGUIWindow_Settings->Release(); |
2234 pGUIWindow_Settings = nullptr; | |
2235 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2236 GameUI_Footer_TimeLeft = 0; |
486 | 2237 unk_50C9A0 = 0; |
2238 back_to_game(); | |
0 | 2239 } |
2240 } | |
486 | 2241 |
924 | 2242 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2243 if ( result != -1 ) |
2244 { | |
486 | 2245 if ( a5 & 2 ) |
0 | 2246 { |
2247 if ( pGUIWindow_Settings ) | |
319 | 2248 return; |
924 | 2249 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2250 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); |
2251 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); | |
2252 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); | |
2253 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); | |
319 | 2254 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2255 return; | |
0 | 2256 } |
486 | 2257 if ( a5 & 8 ) |
0 | 2258 { |
2259 if ( pGUIWindow_Settings ) | |
319 | 2260 return; |
832 | 2261 |
924 | 2262 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2263 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); |
319 | 2264 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2265 return; | |
0 | 2266 } |
486 | 2267 if ( a5 & 0x40 ) |
0 | 2268 { |
2269 if ( pGUIWindow_Settings ) | |
319 | 2270 return; |
832 | 2271 |
924 | 2272 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2273 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); |
2274 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2275 return; | |
0 | 2276 } |
486 | 2277 if ( (char)a5 < 0 ) |
0 | 2278 { |
2279 if ( pGUIWindow_Settings ) | |
319 | 2280 return; |
0 | 2281 ++pIcons_LOD->uTexturePacksCount; |
2282 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2283 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2284 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2285 unk_50C9A0 = 1; |
2286 some_active_character = uActiveCharacter; | |
319 | 2287 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2288 return; | |
0 | 2289 } |
486 | 2290 if ( HIBYTE(a5) & 1 ) |
0 | 2291 { |
2292 if ( pGUIWindow_Settings ) | |
319 | 2293 return; |
924 | 2294 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2295 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); |
2296 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); | |
2297 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); | |
2298 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); | |
2299 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); | |
423 | 2300 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2301 } |
486 | 2302 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2303 { |
924 | 2304 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2305 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2306 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2307 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
0 | 2308 1, |
2309 0, | |
832 | 2310 UIMSG_ScrollNPCPanel, 0, |
0 | 2311 0, |
2312 "", | |
832 | 2313 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2314 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2315 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2316 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
0 | 2317 1, |
2318 0, | |
832 | 2319 UIMSG_ScrollNPCPanel, 1, |
0 | 2320 0, |
2321 "", | |
832 | 2322 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
2323 pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0); | |
2324 pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0); | |
0 | 2325 } |
2326 } | |
2327 } | |
2328 | |
2329 //----- (00427D48) -------------------------------------------------------- | |
924 | 2330 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2331 { |
924 | 2332 CastSpellInfo *v2; // esi@1 |
0 | 2333 signed int v3; // ebx@1 |
2334 | |
2335 v2 = this; | |
2336 v3 = 10; | |
2337 do | |
2338 { | |
2339 if ( v2->spellnum ) | |
2340 { | |
2341 if ( v2->field_8 & 0x3CA ) | |
2342 { | |
2343 v2->spellnum = 0; | |
2344 pGUIWindow_Settings->Release(); | |
2345 pGUIWindow_Settings = 0; | |
2346 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2347 GameUI_Footer_TimeLeft = 0; |
0 | 2348 unk_50C9A0 = 0; |
2349 back_to_game(); | |
2350 } | |
2351 } | |
2352 ++v2; | |
2353 --v3; | |
2354 } | |
2355 while ( v3 ); | |
2356 } | |
2357 | |
2358 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2359 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2360 { |
2361 unsigned int result; // eax@1 | |
924 | 2362 CastSpellInfo *v7; // edx@1 |
2363 CastSpellInfo *v8; // ecx@5 | |
0 | 2364 |
2365 result = 0; | |
2366 v7 = this; | |
2367 while ( v7->spellnum ) | |
2368 { | |
2369 ++result; | |
2370 ++v7; | |
2371 if ( (signed int)result >= 10 ) | |
2372 goto LABEL_8; | |
2373 } | |
2374 v8 = &this[result]; | |
2375 v8->spellnum = a2; | |
2376 v8->uPlayerID = uPlayerID; | |
2377 if ( a5 & 0x10 ) | |
2378 v8->uPlayerID_2 = uPlayerID; | |
2379 v8->field_6 = 0; | |
488 | 2380 v8->spell_target_pid = 0; |
0 | 2381 v8->field_8 = a5; |
488 | 2382 v8->forced_spell_skill_level = skill_level; |
823 | 2383 v8->sound_id = spell_sound_id; |
0 | 2384 LABEL_8: |
2385 if ( result == 10 ) | |
2386 result = -1; | |
2387 return result; | |
2388 } | |
2389 | |
2390 //----- (00427E01) -------------------------------------------------------- | |
924 | 2391 void CastSpellInfo::_427E01_cast_spell() |
0 | 2392 { |
486 | 2393 //int v1; // esi@1 |
0 | 2394 int v2; // edi@1 |
924 | 2395 CastSpellInfo *pCastSpell; // ebx@2 |
488 | 2396 //signed int v4; // eax@8 |
2397 //__int16 v5; // ax@9 | |
0 | 2398 signed int v6; // eax@14 |
488 | 2399 //__int16 v7; // ax@23 |
2400 //__int16 v8; // ax@24 | |
2401 //char v9; // al@44 | |
2402 //int v10; // eax@45 | |
0 | 2403 unsigned __int16 v11; // cx@45 |
822 | 2404 //signed int v12; // ecx@48 |
490 | 2405 //int v13; // eax@53 |
0 | 2406 unsigned __int8 v14; // zf@53 |
488 | 2407 //unsigned int v15; // edx@53 |
2408 //signed int v16; // eax@53 | |
0 | 2409 Player *v17; // esi@70 |
822 | 2410 //int v18; // eax@72 |
823 | 2411 //int v19; // eax@74 |
888 | 2412 Player *v20; // eax@74 |
0 | 2413 signed int i; // esi@76 |
823 | 2414 //int v22; // eax@88 |
0 | 2415 __int16 v23; // ax@88 |
488 | 2416 //int v24; // ecx@93 |
2417 //int v25; // ecx@94 | |
2418 //signed __int64 v26; // qax@100 | |
2419 //char *v27; // ecx@100 | |
2420 //unsigned __int64 v28; // qax@102 | |
0 | 2421 int v29; // ecx@105 |
2422 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2423 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2424 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2425 //char *v33; // edx@113 |
823 | 2426 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2427 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2428 //int v36; // edx@125 |
823 | 2429 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2430 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2431 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2432 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2433 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2434 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2435 //int *v43; // ecx@129 |
823 | 2436 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2437 //int v45; // ecx@132 |
0 | 2438 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2439 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2440 //int v48; // eax@137 |
823 | 2441 //int v49; // eax@137 |
822 | 2442 //int v50; // eax@141 |
0 | 2443 int v51; // eax@146 |
2444 __int16 v52; // ax@153 | |
823 | 2445 //int v53; // eax@153 |
0 | 2446 signed __int64 v54; // qax@164 |
2447 int v55; // edi@164 | |
488 | 2448 //stru6 *v56; // eax@165 |
0 | 2449 int v57; // eax@169 |
2450 signed __int64 v58; // qax@177 | |
2451 int v59; // edi@177 | |
2452 unsigned __int16 v60; // ax@184 | |
2453 int v61; // ecx@184 | |
823 | 2454 //int v62; // eax@186 |
0 | 2455 int v63; // ecx@187 |
2456 int v64; // ecx@188 | |
2457 int v65; // ecx@189 | |
710 | 2458 //const char *v66; // ecx@200 |
2459 //unsigned int v67; // edx@201 | |
0 | 2460 char v68; // al@207 |
89 | 2461 ItemGen *v69; // esi@211 |
0 | 2462 int v70; // ecx@214 |
2463 int v71; // ecx@215 | |
2464 int v72; // ecx@216 | |
488 | 2465 //__int16 v73; // ST1C_2@222 |
2466 //__int16 v74; // ST18_2@222 | |
2467 //stru6 *v75; // eax@222 | |
0 | 2468 int v76; // ecx@223 |
2469 int v77; // ecx@224 | |
2470 int v78; // ecx@225 | |
2471 int v79; // eax@227 | |
488 | 2472 //int v80; // eax@232 |
2473 //__int16 v81; // ST18_2@245 | |
2474 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2475 //signed int v83; // edi@245 |
488 | 2476 //__int16 v84; // ST18_2@245 |
2477 //stru6 *v85; // eax@245 | |
2478 //__int16 v86; // ST18_2@245 | |
2479 //stru6 *v87; // eax@245 | |
2480 //__int16 v88; // ST18_2@245 | |
2481 //stru6 *v89; // eax@245 | |
0 | 2482 double v90; // st7@245 |
2483 int v91; // eax@250 | |
89 | 2484 Player *v92; // eax@255 |
488 | 2485 //__int16 v93; // ST18_2@260 |
2486 //stru6 *v94; // eax@260 | |
2487 //__int16 v95; // ST18_2@260 | |
2488 //stru6 *v96; // eax@260 | |
2489 //__int16 v97; // ST18_2@260 | |
2490 //stru6 *v98; // eax@260 | |
2491 //__int16 v99; // ST18_2@260 | |
2492 //stru6 *v100; // eax@260 | |
0 | 2493 int v101; // ecx@261 |
2494 int v102; // ecx@262 | |
2495 int v103; // ecx@263 | |
2496 int v104; // eax@265 | |
2497 int v105; // edi@271 | |
488 | 2498 //__int16 v106; // ST18_2@272 |
2499 //stru6 *v107; // eax@272 | |
0 | 2500 __int16 v108; // ST1C_2@274 |
2501 __int16 v109; // ST18_2@274 | |
2502 stru6 *v110; // eax@274 | |
2503 int v111; // eax@274 | |
2504 Actor *v112; // esi@278 | |
2505 int v113; // eax@278 | |
2506 int v114; // ebx@278 | |
2507 unsigned int v115; // ecx@278 | |
2508 int v116; // edx@279 | |
2509 int v117; // edx@281 | |
2510 int v118; // edx@283 | |
2511 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2512 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2513 //int v121; // eax@286 |
0 | 2514 signed int v122; // eax@286 |
2515 int v123; // ecx@288 | |
2516 int v124; // ecx@289 | |
2517 int v125; // ecx@290 | |
2518 int v126; // eax@292 | |
2519 int v127; // eax@296 | |
488 | 2520 //__int16 v128; // ST18_2@303 |
2521 //stru6 *v129; // eax@303 | |
2522 //__int16 v130; // ST18_2@303 | |
2523 //stru6 *v131; // eax@303 | |
2524 //__int16 v132; // ST18_2@303 | |
2525 //stru6 *v133; // eax@303 | |
2526 //__int16 v134; // ST18_2@303 | |
2527 //stru6 *v135; // eax@303 | |
2528 //unsigned __int64 v136; // qax@304 | |
2529 //char *v137; // ecx@304 | |
0 | 2530 int v138; // ecx@305 |
2531 int v139; // ecx@306 | |
2532 int v140; // eax@308 | |
488 | 2533 //__int16 v141; // ST18_2@311 |
2534 //stru6 *v142; // eax@311 | |
2535 //__int16 v143; // ST18_2@311 | |
2536 //stru6 *v144; // eax@311 | |
2537 //__int16 v145; // ST18_2@311 | |
2538 //stru6 *v146; // eax@311 | |
2539 //__int16 v147; // ST18_2@311 | |
2540 //stru6 *v148; // eax@311 | |
0 | 2541 int v149; // ecx@312 |
2542 int v150; // ecx@313 | |
2543 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2544 //signed int v152; // eax@322 |
0 | 2545 int v153; // ecx@322 |
2546 int v154; // eax@322 | |
2547 int v155; // eax@323 | |
2548 int v156; // eax@323 | |
2549 int v157; // eax@326 | |
2550 double v158; // st7@326 | |
2551 double v159; // st6@326 | |
2552 signed __int64 v160; // qtt@334 | |
823 | 2553 //int v161; // eax@339 |
0 | 2554 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2555 //int v163; // eax@340 |
0 | 2556 signed int v164; // eax@340 |
2557 signed int v165; // edi@340 | |
488 | 2558 //stru6 *v166; // eax@340 |
2559 //stru6 *v167; // eax@340 | |
0 | 2560 signed int v168; // edi@343 |
2561 int v169; // eax@344 | |
2562 int v170; // ecx@346 | |
2563 int v171; // ecx@347 | |
2564 int v172; // ecx@348 | |
2565 int v173; // edi@350 | |
2566 signed int v174; // edi@355 | |
488 | 2567 //__int16 v175; // ST18_2@357 |
2568 //stru6 *v176; // eax@357 | |
2569 //__int16 v177; // ST18_2@357 | |
2570 //stru6 *v178; // eax@357 | |
2571 //__int16 v179; // ST18_2@357 | |
2572 //stru6 *v180; // eax@357 | |
2573 //__int16 v181; // ST18_2@357 | |
2574 //stru6 *v182; // eax@357 | |
2575 //signed __int64 v183; // qax@357 | |
0 | 2576 int v184; // ecx@358 |
2577 int v185; // ecx@359 | |
2578 int v186; // ecx@360 | |
823 | 2579 //int v187; // eax@367 |
0 | 2580 int v188; // esi@369 |
2581 int v189; // edi@369 | |
710 | 2582 //const char *v190; // ecx@377 |
0 | 2583 signed int v191; // edi@379 |
2584 int v192; // ecx@382 | |
2585 int v193; // ecx@383 | |
2586 int v194; // ecx@384 | |
2587 int v195; // eax@386 | |
2588 int v196; // eax@387 | |
488 | 2589 //__int16 v197; // ST18_2@395 |
2590 //stru6 *v198; // eax@395 | |
2591 //__int16 v199; // ST18_2@395 | |
2592 //stru6 *v200; // eax@395 | |
2593 //__int16 v201; // ST18_2@395 | |
2594 //stru6 *v202; // eax@395 | |
2595 //__int16 v203; // ST18_2@395 | |
2596 //stru6 *v204; // eax@395 | |
0 | 2597 signed int v205; // edi@405 |
2598 int v206; // eax@407 | |
2599 __int16 v207; // cx@407 | |
2600 int v208; // eax@411 | |
2601 signed int v209; // ecx@412 | |
2602 int v210; // edx@412 | |
2603 signed int v211; // ecx@412 | |
2604 int v212; // eax@413 | |
2605 int v213; // eax@413 | |
2606 int v214; // eax@413 | |
2607 int v215; // eax@415 | |
2608 double v216; // st7@415 | |
2609 double v217; // st6@415 | |
2610 signed __int64 v218; // qtt@423 | |
2611 int v219; // ecx@425 | |
2612 int v220; // ecx@426 | |
2613 int v221; // edi@428 | |
890 | 2614 Player *v222; // edi@434 |
0 | 2615 char v223; // al@438 |
2616 int v224; // ecx@442 | |
2617 int v225; // ecx@443 | |
823 | 2618 //int v226; // eax@451 |
0 | 2619 int v227; // esi@453 |
2620 unsigned int v228; // edi@454 | |
2621 int v229; // edi@466 | |
488 | 2622 //__int16 v230; // ST18_2@469 |
2623 //stru6 *v231; // eax@469 | |
2624 //signed int v232; // esi@469 | |
2625 //__int16 v233; // ST18_2@469 | |
2626 //stru6 *v234; // eax@469 | |
2627 //__int16 v235; // ST18_2@469 | |
2628 //stru6 *v236; // eax@469 | |
2629 //__int16 v237; // ST18_2@469 | |
2630 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2631 //__int16 v239; // ST1C_2@469 |
0 | 2632 char *v240; // ecx@472 |
2633 double v241; // st7@478 | |
2634 signed __int64 v242; // qax@484 | |
2635 char *v243; // ecx@484 | |
2636 char *v244; // eax@488 | |
2637 int v245; // edi@492 | |
2638 int v246; // eax@492 | |
2639 char *v247; // eax@497 | |
2640 char v248; // al@497 | |
2641 char v249; // cf@500 | |
2642 float v250; // esi@507 | |
2643 char v251; // al@507 | |
2644 int v252; // edx@510 | |
2645 int m; // esi@510 | |
2646 int v254; // eax@513 | |
2647 int v255; // esi@513 | |
2648 int v256; // ecx@513 | |
2649 int v257; // edx@514 | |
2650 int v258; // ecx@514 | |
2651 char v259; // al@516 | |
2652 int v260; // eax@518 | |
2653 int v261; // esi@519 | |
2654 int v262; // edx@521 | |
2655 int v263; // ecx@521 | |
2656 int v264; // esi@521 | |
2657 int v265; // edx@521 | |
2658 int *ii; // eax@522 | |
2659 int v267; // eax@524 | |
2660 int v268; // eax@524 | |
2661 int v269; // eax@526 | |
2662 char *v270; // eax@531 | |
2663 char v271; // al@531 | |
2664 char v272; // cf@534 | |
2665 float v273; // esi@541 | |
2666 char v274; // al@541 | |
2667 int v275; // edx@544 | |
2668 int k; // esi@544 | |
2669 int v277; // edx@548 | |
2670 int v278; // ecx@548 | |
2671 char v279; // al@550 | |
2672 int v280; // eax@552 | |
2673 int v281; // esi@553 | |
2674 int v282; // edx@555 | |
2675 int v283; // ecx@555 | |
2676 int v284; // esi@555 | |
2677 int v285; // edx@555 | |
2678 int *l; // eax@556 | |
2679 int v287; // eax@558 | |
2680 int v288; // eax@558 | |
2681 ItemGen *v289; // eax@560 | |
2682 signed int v290; // eax@560 | |
2683 unsigned __int8 v291; // al@564 | |
2684 char v292; // al@573 | |
2685 int v293; // eax@575 | |
2686 ItemGen *v294; // esi@575 | |
2687 int v295; // edx@575 | |
2688 int kk; // edi@575 | |
2689 int v297; // edx@579 | |
2690 int v298; // ecx@579 | |
2691 char v299; // al@581 | |
2692 int v300; // eax@583 | |
2693 int v301; // edi@584 | |
2694 int v302; // edx@586 | |
2695 int v303; // ecx@586 | |
2696 int v304; // edi@586 | |
2697 int v305; // edx@586 | |
2698 int *jj; // eax@587 | |
2699 int v307; // eax@589 | |
2700 int v308; // eax@589 | |
2701 char *v309; // ecx@593 | |
2702 char v310; // sf@593 | |
2703 unsigned __int8 v311; // of@593 | |
2704 char v312; // cl@597 | |
488 | 2705 char v313; // al@606pGame->GetStru6() |
0 | 2706 int v314; // edx@607 |
2707 int j; // esi@607 | |
2708 unsigned int v316; // eax@613 | |
2709 const char *v317; // ecx@617 | |
2710 Player *v318; // ecx@619 | |
2711 unsigned int v319; // edi@627 | |
2712 int v320; // ecx@629 | |
2713 int v321; // ecx@630 | |
2714 int v322; // edi@632 | |
2715 int v323; // edi@635 | |
2716 char *v324; // eax@635 | |
2717 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2718 //int v326; // eax@643 |
823 | 2719 //int v327; // eax@648 |
0 | 2720 int v328; // ecx@651 |
2721 int v329; // ecx@652 | |
2722 int v330; // edi@654 | |
488 | 2723 //__int16 v331; // ST18_2@658 |
2724 //stru6 *v332; // eax@658 | |
2725 //__int16 v333; // ST18_2@658 | |
2726 //stru6 *v334; // eax@658 | |
2727 //__int16 v335; // ST18_2@658 | |
2728 //stru6 *v336; // eax@658 | |
2729 //__int16 v337; // ST18_2@658 | |
2730 //stru6 *v338; // eax@658 | |
0 | 2731 int v339; // ecx@659 |
2732 int v340; // ecx@660 | |
2733 int v341; // eax@663 | |
2734 signed int v342; // edi@668 | |
2735 signed int v343; // edi@670 | |
2736 unsigned __int64 v344; // ST08_8@670 | |
488 | 2737 //__int16 v345; // ST1C_2@671 |
2738 //__int16 v346; // ST18_2@671 | |
2739 //stru6 *v347; // eax@671 | |
0 | 2740 int v348; // ecx@672 |
2741 int v349; // ecx@673 | |
2742 int v350; // edi@676 | |
2743 Player *v351; // edi@680 | |
488 | 2744 //__int16 v352; // ST18_2@685 |
2745 //stru6 *v353; // eax@685 | |
0 | 2746 int v354; // ecx@686 |
2747 int v355; // ecx@687 | |
2748 int v356; // eax@689 | |
112 | 2749 Player *v357; // edi@694 |
488 | 2750 //unsigned __int16 v358; // ST1C_2@695 |
2751 //__int16 v359; // ST18_2@695 | |
2752 //stru6 *v360; // eax@695 | |
2753 //__int16 v361; // ST1C_2@697 | |
2754 //__int16 v362; // ST18_2@697 | |
2755 //stru6 *v363; // eax@697 | |
0 | 2756 int v364; // ecx@698 |
2757 int v365; // ecx@699 | |
2758 int v366; // eax@701 | |
488 | 2759 //stru6 *v367; // eax@704 |
823 | 2760 //int v368; // eax@704 |
0 | 2761 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2762 //int v370; // eax@706 |
0 | 2763 int v371; // ecx@709 |
2764 int v372; // ecx@710 | |
2765 int v373; // eax@715 | |
2766 int v374; // eax@717 | |
112 | 2767 Player *v375; // edi@717 |
0 | 2768 int v376; // eax@717 |
2769 Player *v377; // ecx@719 | |
2770 int v378; // ecx@721 | |
2771 int v379; // ecx@722 | |
2772 int v380; // eax@724 | |
2773 int v381; // edi@727 | |
2774 int v382; // ecx@727 | |
2775 Player *v383; // eax@728 | |
2776 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2777 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2778 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2779 //Player *v387; // edi@738 |
0 | 2780 int v388; // edi@740 |
488 | 2781 //unsigned __int16 v389; // ST1C_2@740 |
2782 //__int16 v390; // ST18_2@740 | |
2783 //stru6 *v391; // eax@740 | |
0 | 2784 int v392; // ecx@742 |
2785 int v393; // ecx@743 | |
2786 int v394; // ecx@744 | |
2787 int v395; // edi@747 | |
2788 int v396; // eax@752 | |
2789 int v397; // eax@757 | |
2790 int v398; // eax@757 | |
2791 int v399; // eax@757 | |
2792 char *v400; // esi@757 | |
488 | 2793 //Game *v401; // ecx@759 |
2794 //__int16 v402; // ST1C_2@759 | |
2795 //__int16 v403; // ST18_2@759 | |
2796 //stru6 *v404; // eax@759 | |
0 | 2797 int v405; // ecx@761 |
2798 int v406; // ecx@762 | |
2799 int v407; // edi@765 | |
488 | 2800 //__int16 v408; // ST1C_2@769 |
2801 //__int16 v409; // ST18_2@769 | |
2802 //stru6 *v410; // eax@769 | |
0 | 2803 int v411; // ecx@772 |
2804 int v412; // ecx@773 | |
2805 int v413; // edi@775 | |
488 | 2806 //__int16 v414; // ST1C_2@781 |
2807 //__int16 v415; // ST18_2@781 | |
2808 //stru6 *v416; // eax@781 | |
0 | 2809 int v417; // eax@787 |
2810 int v418; // ecx@789 | |
2811 __int16 v419; // ax@791 | |
2812 signed int v420; // eax@793 | |
2813 int v421; // edx@793 | |
2814 const char *v422; // eax@801 | |
2815 int v423; // ecx@808 | |
2816 int v424; // ecx@809 | |
2817 int v425; // eax@811 | |
2818 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2819 //signed int v427; // eax@820 |
0 | 2820 int v428; // ecx@825 |
2821 int v429; // ecx@826 | |
2822 int v430; // eax@828 | |
488 | 2823 //stru6 *v431; // eax@831 |
823 | 2824 //int v432; // eax@831 |
0 | 2825 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2826 //int v434; // eax@833 |
0 | 2827 int v435; // ecx@837 |
2828 int v436; // ecx@838 | |
488 | 2829 //__int16 v437; // ST1C_2@843 |
2830 //__int16 v438; // ST18_2@843 | |
2831 //stru6 *v439; // eax@843 | |
0 | 2832 int v440; // eax@843 |
2833 int v441; // eax@847 | |
2834 int v442; // ecx@850 | |
2835 int v443; // ecx@851 | |
2836 int v444; // eax@853 | |
2837 signed int v445; // edi@857 | |
2838 int v446; // ecx@862 | |
2839 LevelDecoration *v447; // edi@864 | |
2840 __int16 v448; // ax@864 | |
2841 char *v449; // esi@870 | |
2842 int v450; // eax@870 | |
2843 int v451; // ecx@875 | |
2844 int v452; // ecx@876 | |
2845 int v453; // edi@878 | |
488 | 2846 //__int16 v454; // ST1C_2@884 |
2847 //__int16 v455; // ST18_2@884 | |
2848 //stru6 *v456; // eax@884 | |
0 | 2849 int v457; // ecx@887 |
2850 int v458; // ecx@888 | |
2851 int v459; // eax@890 | |
2852 signed int v460; // eax@895 | |
2853 Actor *v461; // eax@897 | |
2854 unsigned __int16 v462; // cx@897 | |
2855 signed int v463; // edx@897 | |
2856 int v464; // ecx@905 | |
2857 int v465; // ecx@906 | |
2858 int v466; // edi@909 | |
488 | 2859 //__int16 v467; // ST1C_2@913 |
2860 //__int16 v468; // ST18_2@913 | |
2861 //stru6 *v469; // eax@913 | |
0 | 2862 int v470; // edi@913 |
2863 int v471; // eax@917 | |
2864 int v472; // eax@917 | |
2865 char *v473; // esi@918 | |
488 | 2866 //__int16 v474; // ST18_2@920 |
2867 //stru6 *v475; // eax@920 | |
2868 //__int16 v476; // ST18_2@920 | |
2869 //stru6 *v477; // eax@920 | |
2870 //__int16 v478; // ST18_2@920 | |
2871 //stru6 *v479; // eax@920 | |
2872 //__int16 v480; // ST18_2@920 | |
2873 //stru6 *v481; // eax@920 | |
2874 //__int16 v482; // ST18_2@923 | |
2875 //stru6 *v483; // eax@923 | |
2876 //__int16 v484; // ST18_2@923 | |
2877 //stru6 *v485; // eax@923 | |
2878 //__int16 v486; // ST18_2@923 | |
2879 //stru6 *v487; // eax@923 | |
2880 //__int16 v488; // ST18_2@923 | |
2881 //stru6 *v489; // eax@923 | |
2882 //__int16 v490; // ST1C_2@924 | |
2883 //__int16 v491; // ST18_2@924 | |
2884 //stru6 *v492; // eax@924 | |
0 | 2885 int v493; // ecx@925 |
2886 int v494; // ecx@926 | |
488 | 2887 //__int16 v495; // ST1C_2@931 |
2888 //__int16 v496; // ST18_2@931 | |
2889 //stru6 *v497; // eax@931 | |
0 | 2890 int v498; // edi@931 |
2891 int v499; // eax@935 | |
2892 int v500; // eax@935 | |
2893 Player *v501; // edi@939 | |
488 | 2894 //__int16 v502; // ST18_2@940 |
2895 //stru6 *v503; // eax@940 | |
2896 //stru6 *v504; // eax@943 | |
0 | 2897 int v505; // eax@943 |
823 | 2898 //int v506; // eax@943 |
0 | 2899 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2900 //int v508; // eax@944 |
0 | 2901 signed int v509; // eax@944 |
2902 signed int v510; // edi@944 | |
2903 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2904 //int v512; // eax@946 |
0 | 2905 SpellBuff *v513; // edi@946 |
2906 int v514; // ecx@950 | |
2907 int v515; // ecx@951 | |
2908 int v516; // eax@953 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2909 //int v517; // eax@956 |
90 | 2910 Actor *v518; // edx@957 |
0 | 2911 __int16 v519; // cx@958 |
2912 int v520; // ecx@968 | |
2913 int v521; // ecx@969 | |
2914 int v522; // eax@971 | |
488 | 2915 //__int16 v523; // ST18_2@975 |
2916 //stru6 *v524; // eax@975 | |
2917 //__int16 v525; // ST18_2@975 | |
2918 //stru6 *v526; // eax@975 | |
2919 //__int16 v527; // ST18_2@975 | |
2920 //stru6 *v528; // eax@975 | |
2921 //__int16 v529; // ST18_2@975 | |
2922 //stru6 *v530; // eax@975 | |
0 | 2923 int v531; // eax@982 |
823 | 2924 //int v532; // eax@982 |
0 | 2925 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2926 //int v534; // eax@983 |
0 | 2927 signed int v535; // eax@983 |
2928 signed int v536; // edi@983 | |
2929 stru6 *v537; // eax@984 | |
2930 int v538; // ecx@985 | |
2931 int v539; // ecx@986 | |
2932 int v540; // eax@988 | |
488 | 2933 //__int16 v541; // ST18_2@991 |
2934 //stru6 *v542; // eax@991 | |
2935 //__int16 v543; // ST18_2@991 | |
2936 //stru6 *v544; // eax@991 | |
2937 //__int16 v545; // ST18_2@991 | |
2938 //stru6 *v546; // eax@991 | |
2939 //__int16 v547; // ST18_2@991 | |
0 | 2940 stru6 *v548; // eax@991 |
2941 double v549; // st7@991 | |
2942 unsigned __int16 v550; // di@991 | |
2943 int v551; // ecx@993 | |
2944 int v552; // ecx@994 | |
89 | 2945 Player *v553; // edi@1001 |
488 | 2946 //__int16 v554; // ST18_2@1002 |
2947 //stru6 *v555; // eax@1002 | |
2948 //__int16 v556; // ST18_2@1002 | |
2949 //stru6 *v557; // eax@1002 | |
2950 //__int16 v558; // ST18_2@1002 | |
2951 //stru6 *v559; // eax@1002 | |
2952 //__int16 v560; // ST18_2@1002 | |
2953 //stru6 *v561; // eax@1002 | |
0 | 2954 unsigned __int16 v562; // di@1005 |
2955 signed int v563; // eax@1010 | |
2956 unsigned int v564; // ecx@1011 | |
2957 signed int v565; // eax@1012 | |
2958 Player **v566; // ecx@1012 | |
2959 int v567; // eax@1012 | |
488 | 2960 //unsigned __int16 v568; // ST1C_2@1012 |
2961 //__int16 v569; // ST18_2@1012 | |
2962 //stru6 *v570; // eax@1012 | |
0 | 2963 Player *v571; // eax@1013 |
2964 char *v572; // ecx@1013 | |
2965 int v573; // ecx@1017 | |
2966 int v574; // ecx@1018 | |
2967 int v575; // eax@1020 | |
2968 signed int v576; // eax@1025 | |
2969 Player *v577; // eax@1026 | |
2970 int v578; // eax@1028 | |
2971 __int16 v579; // ax@1029 | |
823 | 2972 //int v580; // eax@1031 |
0 | 2973 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2974 //int v582; // eax@1031 |
488 | 2975 //__int16 v583; // ST1C_2@1034 |
2976 //__int16 v584; // ST18_2@1034 | |
0 | 2977 char *v585; // esi@1034 |
488 | 2978 //stru6 *v586; // eax@1034 |
0 | 2979 signed int v587; // eax@1035 |
2980 int v588; // ecx@1036 | |
2981 int v589; // ecx@1037 | |
2982 int v590; // ecx@1038 | |
2983 char v591; // al@1048 | |
2984 int v592; // esi@1052 | |
2985 int v593; // ecx@1057 | |
2986 int v594; // ecx@1058 | |
823 | 2987 //int v595; // eax@1064 |
0 | 2988 int v596; // esi@1066 |
2989 unsigned int v597; // edi@1067 | |
2990 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2991 //signed int v599; // eax@1082 |
0 | 2992 int v600; // edi@1086 |
2993 int v601; // edx@1086 | |
2994 int v602; // eax@1086 | |
2995 int v603; // ecx@1086 | |
823 | 2996 //int v604; // eax@1087 |
0 | 2997 char *v605; // eax@1089 |
2998 int v606; // edx@1091 | |
2999 int v607; // ecx@1100 | |
3000 __int16 v608; // ax@1102 | |
3001 signed int v609; // eax@1104 | |
3002 int v610; // edi@1106 | |
3003 unsigned int v611; // eax@1106 | |
89 | 3004 Player *v612; // edi@1106 |
3005 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3006 int v614; // eax@1116 |
3007 int v615; // edi@1119 | |
488 | 3008 //__int16 v616; // ST1C_2@1122 |
3009 //__int16 v617; // ST18_2@1122 | |
3010 //stru6 *v618; // eax@1122 | |
112 | 3011 Player *v619; // edi@1123 |
488 | 3012 //unsigned __int16 v620; // ST1C_2@1124 |
3013 //__int16 v621; // ST18_2@1124 | |
3014 //stru6 *v622; // eax@1124 | |
0 | 3015 signed __int64 v623; // qax@1127 |
823 | 3016 //int v624; // eax@1127 |
0 | 3017 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3018 //int v626; // eax@1129 |
0 | 3019 signed int v627; // eax@1129 |
3020 signed int v628; // edi@1129 | |
3021 int v629; // ecx@1130 | |
3022 Player *v630; // eax@1131 | |
3023 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3024 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3025 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3026 //signed int v634; // eax@1140 |
0 | 3027 int v635; // edi@1142 |
488 | 3028 //unsigned __int16 v636; // ST1C_2@1142 |
3029 //__int16 v637; // ST18_2@1142 | |
3030 //stru6 *v638; // eax@1142 | |
3031 //stru6 *v639; // eax@1143 | |
0 | 3032 int v640; // ecx@1146 |
3033 int v641; // ecx@1147 | |
3034 int v642; // edi@1156 | |
3035 int v643; // eax@1156 | |
3036 int v644; // eax@1156 | |
3037 signed int v645; // eax@1158 | |
488 | 3038 //Player *v646; // ebx@1169 |
3039 //int v647; // edi@1169 | |
3040 //signed int v648; // ST1C_4@1170 | |
3041 //Player *v649; // ecx@1170 | |
3042 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3043 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3044 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3045 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3046 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3047 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3048 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3049 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3050 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3051 int v659; // [sp+0h] [bp-E84h]@123 |
3052 int v660; // [sp+0h] [bp-E84h]@146 | |
3053 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3054 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3055 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3056 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3057 int v665; // [sp+0h] [bp-E84h]@807 | |
3058 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3059 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3060 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3061 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3062 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3063 int v671; // [sp+4h] [bp-E80h]@146 |
3064 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3065 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3066 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3067 const char *v675; // [sp+4h] [bp-E80h]@800 |
3068 int v676; // [sp+4h] [bp-E80h]@807 | |
3069 int v677; // [sp+4h] [bp-E80h]@861 | |
3070 int v678; // [sp+4h] [bp-E80h]@997 | |
3071 int v679; // [sp+14h] [bp-E70h]@515 | |
3072 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3073 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3074 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3075 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3076 int v684; // [sp+D04h] [bp-180h]@416 | |
3077 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3078 int x; // [sp+D20h] [bp-164h]@327 | |
3079 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3080 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3081 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3082 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3083 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3084 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3085 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3086 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3087 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3088 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3089 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3090 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3091 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3092 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3093 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3094 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3095 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3096 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3097 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3098 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3099 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3100 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3101 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3102 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
924 | 3103 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
0 | 3104 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3105 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3106 int n; // [sp+DA0h] [bp-E4h]@1 | |
3107 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3108 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3109 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3110 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3111 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3112 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3113 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
|
3114 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3115 int v723; // [sp+E4Ch] [bp-38h]@1 |
3116 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3117 float v725; // [sp+E54h] [bp-30h]@23 | |
3118 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3119 //int v726b; |
0 | 3120 float v727; // [sp+E5Ch] [bp-28h]@1 |
3121 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3122 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3123 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3124 Player *v730b; |
3125 ItemGen *v730c; | |
0 | 3126 int v731; // [sp+E6Ch] [bp-18h]@48 |
3127 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3128 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3129 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3130 int amount; // [sp+E80h] [bp-4h]@1 | |
3131 | |
924 | 3132 //auto ecx0 = this; |
3133 | |
3134 //v711 = ecx0; | |
3135 | |
3136 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
|
3137 //SpriteObject::SpriteObject(&a1); |
0 | 3138 |
486 | 3139 //v1 = 0; |
0 | 3140 v2 = 0; |
3141 amount = 0; | |
3142 LODWORD(v733) = 0; | |
3143 v723 = 0; | |
3144 v727 = 0.0; | |
889 | 3145 //n = 0; |
3146 //while ( 1 ) | |
3147 for(n = 0; n < 10; ++n) | |
0 | 3148 { |
924 | 3149 pCastSpell = &this[n]; |
3150 HIDWORD(v733) = (int)pCastSpell; | |
3151 if ( pCastSpell->spellnum == 0 ) | |
889 | 3152 continue; |
486 | 3153 |
3154 if (pParty->Invisible()) | |
3155 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3156 | |
924 | 3157 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 3158 { |
924 | 3159 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3160 this->_427D48(1); | |
889 | 3161 continue; |
0 | 3162 } |
924 | 3163 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3164 | |
3165 a2 = pCastSpell->spell_target_pid; | |
3166 if (!pCastSpell->spell_target_pid) | |
0 | 3167 { |
924 | 3168 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3169 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3170 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 3171 v666 = 1; |
3172 else | |
3173 v666 = 0; | |
3174 | |
3175 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3176 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3177 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3178 a2 = pMouse->uPointingObjectID; |
0 | 3179 } |
488 | 3180 |
3181 | |
924 | 3182 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3183 if (pSpellSprite.uType) | |
0 | 3184 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3185 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3186 { |
924 | 3187 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3188 v2 = v723; |
3189 } | |
3190 else | |
3191 { | |
3192 v715.uYawAngle = pParty->sRotationY; | |
3193 v715.uPitchAngle = pParty->sRotationX; | |
3194 } | |
3195 } | |
488 | 3196 |
486 | 3197 LODWORD(v725) = 0; |
3198 _this = 0; | |
924 | 3199 if (pCastSpell->forced_spell_skill_level) |
488 | 3200 { |
924 | 3201 v11 = pCastSpell->forced_spell_skill_level; |
488 | 3202 v723 = v11 & 0x3F; |
3203 v2 = v723; | |
3204 } | |
3205 else | |
0 | 3206 { |
488 | 3207 //v667 = PLAYER_SKILL_STAFF; |
924 | 3208 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 3209 v667 = PLAYER_SKILL_FIRE; |
924 | 3210 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 3211 v667 = PLAYER_SKILL_AIR; |
924 | 3212 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 3213 v667 = PLAYER_SKILL_WATER; |
924 | 3214 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 3215 v667 = PLAYER_SKILL_EARTH; |
924 | 3216 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 3217 v667 = PLAYER_SKILL_SPIRIT; |
924 | 3218 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 3219 v667 = PLAYER_SKILL_MIND; |
924 | 3220 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 3221 v667 = PLAYER_SKILL_BODY; |
924 | 3222 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 3223 v667 = PLAYER_SKILL_LIGHT; |
924 | 3224 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 3225 v667 = PLAYER_SKILL_DARK; |
924 | 3226 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 3227 v667 = PLAYER_SKILL_BOW; |
3228 else assert(false && "Unknown spell"); | |
3229 | |
0 | 3230 LODWORD(v725) = v667; |
488 | 3231 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3232 v2 = v723; | |
3233 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3234 } |
488 | 3235 |
0 | 3236 if ( HIBYTE(v11) & 1 ) |
3237 { | |
3238 v731 = 4; | |
3239 } | |
3240 else | |
3241 { | |
3242 if ( (v11 & 0x80u) == 0 ) | |
3243 { | |
3244 v731 = ((v11 & 0x40) != 0) + 1; | |
3245 } | |
3246 else | |
3247 { | |
3248 v731 = 3; | |
3249 } | |
3250 } | |
488 | 3251 |
924 | 3252 if (pCastSpell->forced_spell_skill_level) |
486 | 3253 uRequiredMana = 0; |
488 | 3254 else |
924 | 3255 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3256 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3257 |
3258 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3259 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3260 uRequiredMana = 0; |
488 | 3261 |
924 | 3262 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3263 { | |
3264 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
3265 pCastSpell->spellnum = 0; | |
3266 continue; | |
3267 } | |
3268 v730 = pCastSpell->spellnum; | |
3269 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
3270 { | |
3271 if (!pParty->bTurnBasedModeOn) | |
3272 { | |
3273 //v646 = pPlayer; | |
3274 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3275 //v647 = n; | |
3276 } | |
3277 else | |
3278 { | |
3279 //v647 = n; | |
3280 //v646 = pPlayer; | |
3281 //v648 = sRecoveryTime; | |
3282 //v649 = pPlayer; | |
3283 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
3284 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3285 pTurnEngine->_40471C(); | |
3286 } | |
3287 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3288 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3289 this[n].spellnum = 0; | |
3290 pPlayer->sMana -= uRequiredMana; | |
3291 return; | |
3292 } | |
3293 | |
3294 switch ( pCastSpell->spellnum ) | |
3295 { | |
3296 case SPELL_101: | |
3297 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3298 case SPELL_BOW_ARROW: | |
3299 { | |
3300 v17 = pPlayer; | |
3301 _this = (ItemGen *)1; | |
3302 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3303 _this = (ItemGen *)2; | |
3304 sRecoveryTime = v17->GetAttackRecoveryTime(true); | |
3305 pSpellSprite.stru_24.Reset(); | |
3306 pSpellSprite.spell_level = v2; | |
3307 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3308 pSpellSprite.spell_skill = v731; | |
3309 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3310 if ( v17->WearsItem(510, 2) ) | |
3311 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3312 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3313 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3314 pSpellSprite.uAttributes = 0; | |
3315 pSpellSprite.uSpriteFrameID = 0; | |
3316 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3317 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3318 pSpellSprite.spell_target_pid = a2; | |
3319 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3320 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3321 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3322 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
3323 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
3324 pSpellSprite.uAttributes = 256; | |
3325 if ( pParty->bTurnBasedModeOn == 1 ) | |
3326 pSpellSprite.uAttributes = 260; | |
3327 for ( i = 0; i < (signed int)_this; ++i ) | |
3328 { | |
3329 if ( i ) | |
3330 pSpellSprite.vPosition.z += 32; | |
3331 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3332 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3333 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3334 ++pTurnEngine->field_1C; | |
3335 } | |
3336 break; | |
3337 } | |
3338 case SPELL_LASER_PROJECTILE: | |
3339 { | |
3340 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3341 pSpellSprite.stru_24.Reset(); | |
3342 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3343 pSpellSprite.spell_level = v723; | |
3344 pSpellSprite.spell_skill = v731; | |
3345 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3346 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3347 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3348 pSpellSprite.uAttributes = 0; | |
3349 pSpellSprite.uSpriteFrameID = 0; | |
3350 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3351 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3352 pSpellSprite.spell_target_pid = a2; | |
3353 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3354 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3355 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3356 memcpy(&pSpellSprite.stru_24, | |
3357 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3358 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3359 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3360 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3361 pSpellSprite.uSectorID = v23; | |
889 | 3362 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3363 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3364 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3365 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3366 ++pTurnEngine->field_1C; |
924 | 3367 break; |
3368 } | |
3369 case SPELL_FIRE_TORCH_LIGHT: | |
3370 { | |
889 | 3371 LODWORD(v733) = 3600 * v2; |
3372 | |
3373 switch (v731) | |
3374 { | |
890 | 3375 case 1: amount = 2; break; |
3376 case 2: amount = 3; break; | |
3377 case 3: | |
3378 case 4: amount = 4; break; | |
3379 default: | |
889 | 3380 assert(false); |
3381 } | |
3382 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3383 break; |
889 | 3384 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3385 LODWORD(v727) = 1; | |
890 | 3386 break; |
924 | 3387 } |
3388 case SPELL_FIRE_FIRE_SPIKE: | |
3389 { | |
890 | 3390 v29 = v731 - 2; |
3391 if ( v29 ) | |
3392 { | |
3393 v30 = v29 - 1; | |
3394 if ( v30 ) | |
3395 { | |
3396 if ( v30 == 1 ) | |
3397 amount = 9; | |
3398 else | |
3399 amount = 3; | |
889 | 3400 } |
3401 else | |
3402 { | |
890 | 3403 amount = 7; |
3404 } | |
3405 } | |
3406 else | |
3407 { | |
3408 amount = 5; | |
3409 } | |
3410 //v31 = v3->uPlayerID; | |
3411 //v32 = 8 * v31; | |
3412 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3413 | |
3414 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3415 int _v733 = 0; | |
3416 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3417 { | |
3418 auto object = pSpriteObjects + i; | |
924 | 3419 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
890 | 3420 ++_v733; |
3421 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3422 v730 = uNumSpriteObjects; | |
3423 do | |
3424 { | |
3425 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3426 ++HIDWORD(v733); | |
3427 v33 += 112; | |
3428 --v730; | |
3429 } | |
3430 while ( v730 );*/ | |
3431 } | |
3432 if (_v733 > amount) | |
3433 { | |
3434 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3435 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3436 pCastSpell->spellnum = 0; |
890 | 3437 continue; |
3438 } | |
3439 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3440 break; | |
924 | 3441 pSpellSprite.stru_24.Reset(); |
3442 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3443 pSpellSprite.spell_level = v2; | |
3444 pSpellSprite.spell_skill = v731; | |
3445 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3446 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3447 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3448 pSpellSprite.uAttributes = 0; | |
3449 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3450 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3451 pSpellSprite.uSpriteFrameID = 0; | |
3452 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3453 pSpellSprite.spell_target_pid = a2; | |
3454 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3455 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3456 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 3457 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3458 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3459 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3460 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 3461 ++pTurnEngine->field_1C; |
3462 LODWORD(v727) = 1; | |
3463 break; | |
924 | 3464 } |
3465 case SPELL_AIR_IMPLOSION: | |
3466 { | |
890 | 3467 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3468 break; | |
3469 if (!a2) | |
3470 { | |
3471 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3472 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3473 pCastSpell->spellnum = 0; |
890 | 3474 continue; |
3475 } | |
3476 if (PID_TYPE(a2) != OBJECT_Actor) | |
3477 { | |
889 | 3478 LODWORD(v727) = 1; |
890 | 3479 break; |
3480 } | |
3481 v697.x = 0; | |
3482 v697.y = 0; | |
3483 v697.z = 0; | |
924 | 3484 pSpellSprite.stru_24.Reset(); |
3485 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3486 pSpellSprite.spell_level = v2; | |
3487 pSpellSprite.spell_skill = v731; | |
3488 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3489 pSpellSprite.uAttributes = 0; | |
3490 pSpellSprite.uSectorID = 0; | |
3491 pSpellSprite.uSpriteFrameID = 0; | |
3492 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3493 pSpellSprite.uFacing = 0; | |
3494 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3495 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3496 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3497 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3498 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3499 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3500 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3501 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3502 LODWORD(v727) = 1; | |
3503 break; | |
924 | 3504 } |
3505 case SPELL_EARTH_MASS_DISTORTION: | |
3506 { | |
890 | 3507 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3508 break; | |
3509 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3510 { | |
3511 LODWORD(v727) = 1; | |
3512 break; | |
3513 } | |
3514 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3515 v704.x = 0; | |
3516 v704.y = 0; | |
3517 v704.z = 0; | |
924 | 3518 pSpellSprite.stru_24.Reset(); |
3519 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3520 pSpellSprite.spell_level = v2; | |
3521 pSpellSprite.spell_skill = v731; | |
3522 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3523 pSpellSprite.uAttributes = 0; | |
3524 pSpellSprite.uSectorID = 0; | |
3525 pSpellSprite.uSpriteFrameID = 0; | |
3526 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3527 pSpellSprite.uFacing = 0; | |
3528 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3529 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3530 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3531 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3532 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3533 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3534 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3535 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3536 LODWORD(v727) = 1; | |
3537 break; | |
924 | 3538 } |
3539 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3540 { | |
890 | 3541 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3542 break; | |
3543 //v730 = a2 >> 3; | |
3544 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3545 v691.x = 0; | |
3546 v691.y = 0; | |
3547 v691.z = 0; | |
924 | 3548 pSpellSprite.stru_24.Reset(); |
3549 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3550 pSpellSprite.spell_level = v2; | |
3551 pSpellSprite.spell_skill = v731; | |
3552 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3553 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3554 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3555 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3556 pSpellSprite.uAttributes = 0; | |
3557 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3558 pSpellSprite.uSpriteFrameID = 0; | |
3559 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3560 pSpellSprite.spell_target_pid = a2; | |
3561 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3562 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3563 pSpellSprite.uAttributes |= 0x80u; | |
3564 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3565 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3566 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3567 { | |
3568 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3569 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3570 pCastSpell->spellnum = 0; |
890 | 3571 continue; |
3572 } | |
3573 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3574 LODWORD(v727) = 1; | |
3575 break; | |
924 | 3576 } |
3577 case SPELL_FIRE_FIRE_BOLT: | |
3578 case SPELL_FIRE_FIREBALL: | |
3579 case SPELL_FIRE_INCINERATE: | |
3580 case SPELL_AIR_LIGHNING_BOLT: | |
3581 case SPELL_WATER_ICE_BOLT: | |
3582 case SPELL_WATER_ICE_BLAST: | |
3583 case SPELL_EARTH_STUN: | |
3584 case SPELL_EARTH_DEADLY_SWARM: | |
3585 case SPELL_MIND_MIND_BLAST: | |
3586 case SPELL_MIND_PSYCHIC_SHOCK: | |
3587 case SPELL_BODY_HARM: | |
3588 case SPELL_LIGHT_LIGHT_BOLT: | |
3589 case SPELL_DARK_DRAGON_BREATH: | |
3590 { | |
889 | 3591 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3592 break; |
924 | 3593 pSpellSprite.stru_24.Reset(); |
3594 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3595 pSpellSprite.spell_level = v2; | |
3596 pSpellSprite.spell_skill = v731; | |
3597 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3598 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3599 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3600 pSpellSprite.uAttributes = 0; | |
3601 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3602 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3603 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3604 else | |
3605 pSpellSprite.uSectorID = 0; | |
3606 pSpellSprite.uSpriteFrameID = 0; | |
3607 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3608 pSpellSprite.spell_target_pid = a2; | |
3609 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3610 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3611 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3612 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3613 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3614 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3615 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3616 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3617 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3618 ++pTurnEngine->field_1C; |
3619 LODWORD(v727) = 1; | |
890 | 3620 break; |
924 | 3621 } |
3622 case SPELL_WATER_ACID_BURST: | |
3623 case SPELL_EARTH_BLADES: | |
3624 case SPELL_BODY_FLYING_FIST: | |
3625 case SPELL_DARK_TOXIC_CLOUD: | |
3626 { | |
889 | 3627 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3628 break; |
924 | 3629 pSpellSprite.stru_24.Reset(); |
3630 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3631 pSpellSprite.spell_level = v2; | |
3632 pSpellSprite.spell_skill = v731; | |
3633 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3634 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3635 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3636 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3637 v660 = pParty->vPosition.y; | |
3638 goto LABEL_153; | |
924 | 3639 } |
3640 case SPELL_LIGHT_SUNRAY: | |
3641 { | |
889 | 3642 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
890 | 3643 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3644 { | |
3645 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3646 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3647 pCastSpell->spellnum = 0; |
890 | 3648 continue; |
889 | 3649 } |
3650 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3651 { |
3652 pSpellSprite.stru_24.Reset(); | |
3653 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3654 pSpellSprite.spell_skill = v731; | |
3655 pSpellSprite.spell_level = v2; | |
3656 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3657 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3658 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3659 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3660 v660 = pParty->vPosition.y; | |
3661 goto LABEL_153; | |
3662 } | |
3663 break; | |
3664 } | |
3665 case SPELL_LIGHT_PARALYZE: | |
3666 { | |
890 | 3667 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3668 break; | |
924 | 3669 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3670 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
890 | 3671 { |
3672 LODWORD(v727) = 1; | |
3673 break; | |
3674 } | |
3675 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3676 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3677 v55 = v721; | |
3678 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3679 *(char *)(v55 + 38) |= 8u; | |
3680 *(short *)(v55 + 148) = 0; | |
3681 v672 = 0; | |
3682 *(short *)(v55 + 150) = 0; | |
3683 v661 = (Actor *)v55; | |
3684 goto LABEL_165; | |
924 | 3685 } |
3686 case SPELL_EARTH_SLOW: | |
3687 { | |
889 | 3688 if ( v731 == 2 ) |
3689 { | |
890 | 3690 v57 = 300 * v2; |
889 | 3691 } |
3692 else | |
3693 { | |
890 | 3694 if ( v731 == 3 ) |
3695 { | |
889 | 3696 amount = 4; |
3697 v57 = 300 * v2; | |
3698 goto LABEL_174; | |
890 | 3699 } |
3700 if ( v731 == 4 ) | |
3701 { | |
889 | 3702 v57 = 300 * v2; |
3703 amount = 8; | |
3704 goto LABEL_174; | |
890 | 3705 } |
3706 v57 = 180 * v2; | |
889 | 3707 } |
3708 amount = 2; | |
3709 LABEL_174: | |
3710 LODWORD(v733) = v57; | |
3711 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3712 break; |
889 | 3713 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3714 || (v721 = 836 * PID_ID(a2), |
3715 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3716 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3717 { | |
3718 LODWORD(v727) = 1; | |
3719 break; | |
889 | 3720 } |
3721 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3722 v59 = v721; | |
3723 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3724 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
890 | 3725 v731, |
3726 amount, | |
3727 0, | |
3728 0); | |
889 | 3729 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3730 v672 = 0; | |
3731 v661 = (Actor *)LODWORD(v718); | |
3732 goto LABEL_165; | |
924 | 3733 } |
3734 case SPELL_MIND_CHARM: | |
3735 { | |
890 | 3736 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3737 break; | |
3738 | |
3739 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3740 { | |
3741 LODWORD(v727) = 1; | |
3742 break; | |
3743 } | |
3744 | |
3745 uint power = 300 * v2; | |
3746 if ( v731 == 2 ) | |
3747 { | |
3748 power = 600 * v2; | |
3749 } | |
3750 else if ( v731 == 3 ) | |
3751 power = 29030400; | |
3752 | |
3753 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3754 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3755 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3756 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3757 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3758 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3759 v731, 0, 0, 0); | |
924 | 3760 pSpellSprite.stru_24.Reset(); |
3761 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3762 pSpellSprite.spell_level = v2; | |
3763 pSpellSprite.spell_skill = v731; | |
3764 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3765 v61 = PID_ID(a2); |
3766 goto LABEL_1086; | |
924 | 3767 } |
3768 case SPELL_DARK_SHRINKING_RAY: | |
3769 { | |
889 | 3770 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3771 break; |
924 | 3772 pSpellSprite.stru_24.Reset(); |
3773 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3774 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3775 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3776 pSpellSprite.uAttributes = 0; | |
3777 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3778 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3779 pParty->vPosition.x, |
3780 pParty->vPosition.y, | |
3781 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3782 pSpellSprite.uSpriteFrameID = 0; |
3783 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3784 pSpellSprite.spell_target_pid = a2; | |
3785 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3786 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3787 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3788 pSpellSprite.spell_skill = v731; | |
3789 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3790 pSpellSprite.spell_level = 300 * v2; | |
890 | 3791 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3792 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3793 | |
3794 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3795 | |
3796 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3797 ++pTurnEngine->field_1C; |
3798 LODWORD(v727) = 1; | |
890 | 3799 break; |
924 | 3800 } |
3801 case SPELL_FIRE_FIRE_AURA: | |
3802 { | |
889 | 3803 v63 = v731 - 1; |
3804 if ( !v63 ) | |
3805 { | |
890 | 3806 amount = 10; |
3807 LODWORD(v733) = 3600 * v2; | |
3808 } | |
3809 else | |
3810 { | |
889 | 3811 v64 = v63 - 1; |
3812 if ( !v64 ) | |
3813 { | |
890 | 3814 amount = 11; |
3815 LODWORD(v733) = 3600 * v2; | |
3816 } | |
3817 else | |
3818 { | |
889 | 3819 v65 = v64 - 1; |
3820 if ( !v65 ) | |
3821 { | |
890 | 3822 amount = 12; |
889 | 3823 LABEL_195: |
890 | 3824 LODWORD(v733) = 3600 * v2; |
3825 } | |
3826 else if ( v65 == 1 ) | |
3827 { | |
3828 LODWORD(v733) = 0; | |
3829 amount = 12; | |
3830 } | |
3831 } | |
889 | 3832 } |
3833 LABEL_196: | |
3834 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3835 break; |
924 | 3836 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3837 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3838 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3839 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3840 && !v730c->Broken() | |
3841 && !v730c->uSpecEnchantmentType | |
3842 && !v730c->uEnchantmentType | |
3843 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3844 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3845 { | |
3846 v69 = v730c; | |
3847 v14 = v731 == 4; | |
3848 v730c->uSpecEnchantmentType = amount; | |
3849 if ( !v14 ) | |
889 | 3850 { |
890 | 3851 v69->uExpireTime = pParty->uTimePlayed |
3852 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3853 * 0.033333335); | |
3854 v69->uAttributes |= 8u; | |
889 | 3855 } |
890 | 3856 v69->uAttributes |= 0x10u; |
3857 dword_50C9A8 = 256; | |
3858 LODWORD(v727) = 1; | |
3859 break; | |
889 | 3860 } |
3861 | |
3862 dword_50C9D0 = 113; | |
3863 dword_50C9D4 = 0; | |
3864 dword_50C9D8 = 1; | |
3865 | |
3866 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3867 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3868 pCastSpell->spellnum = 0; |
890 | 3869 continue; |
924 | 3870 } |
3871 case SPELL_BODY_REGENERATION: | |
3872 { | |
890 | 3873 v70 = v731 - 1; |
3874 LODWORD(v733) = 3600 * v2; | |
3875 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3876 { | |
3877 v72 = v71 - 1; | |
3878 if ( v72 ) | |
3879 { | |
3880 if ( v72 == 1 ) | |
3881 amount = 10; | |
889 | 3882 } |
3883 else | |
3884 { | |
890 | 3885 amount = 3; |
3886 } | |
3887 } | |
3888 else | |
3889 { | |
3890 amount = 1; | |
3891 } | |
3892 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3893 break; | |
3894 | |
924 | 3895 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3896 | |
3897 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 | 3898 LODWORD(v727) = 1; |
3899 break; | |
924 | 3900 } |
3901 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3902 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3903 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3904 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3905 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3906 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3907 { | |
3908 v76 = v731 - 1; | |
3909 LODWORD(v733) = 3600 * v2; | |
3910 if ( v76 ) | |
3911 { | |
3912 v77 = v76 - 1; | |
3913 if ( v77 ) | |
3914 { | |
3915 v78 = v77 - 1; | |
3916 if ( v78 ) | |
3917 { | |
3918 if ( v78 != 1 ) | |
3919 goto LABEL_232; | |
3920 v79 = 4 * v2; | |
3921 } | |
3922 else | |
3923 { | |
3924 v79 = 3 * v2; | |
3925 } | |
3926 } | |
3927 else | |
3928 { | |
3929 v79 = 2 * v2; | |
3930 } | |
3931 amount = v79; | |
3932 } | |
3933 else | |
3934 { | |
3935 amount = v2; | |
3936 } | |
3937 LABEL_232: | |
3938 //v80 = v3->spellnum; | |
3939 switch (pCastSpell->spellnum) | |
3940 { | |
3941 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3942 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3943 break; | |
3944 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3945 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3946 break; | |
3947 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3948 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3949 break; | |
3950 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3951 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3952 break; | |
3953 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3954 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3955 break; | |
3956 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3957 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3958 break; | |
3959 default: | |
3960 assert(false); | |
3961 continue; | |
3962 } | |
3963 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3964 break; | |
3965 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3966 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3967 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3968 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
3969 v90 = (double)(signed int)v733 * 4.2666669; | |
3970 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3971 LODWORD(v727) = 1; | |
3972 break; | |
3973 } | |
3974 case SPELL_FIRE_HASTE: | |
3975 { | |
889 | 3976 if ( v731 <= 0 ) |
890 | 3977 goto LABEL_254; |
889 | 3978 if ( v731 <= 2 ) |
3979 { | |
890 | 3980 v91 = 60 * (v2 + 60); |
889 | 3981 } |
3982 else | |
3983 { | |
890 | 3984 if ( v731 == 3 ) |
3985 { | |
889 | 3986 v91 = 180 * (v2 + 20); |
890 | 3987 } |
3988 else | |
3989 { | |
889 | 3990 if ( v731 != 4 ) |
890 | 3991 goto LABEL_254; |
889 | 3992 v91 = 240 * (v2 + 15); |
890 | 3993 } |
889 | 3994 } |
3995 LODWORD(v733) = v91; | |
3996 LABEL_254: | |
3997 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
3998 { | |
890 | 3999 v92 = pParty->pPlayers;//[0].pConditions[1]; |
4000 LODWORD(v727) = 1; | |
4001 do | |
4002 { | |
889 | 4003 if ( v92->pConditions ) |
890 | 4004 LODWORD(v727) = 0; |
889 | 4005 ++v92; |
890 | 4006 } |
4007 while ( v92 <= &pParty->pPlayers[3] ); | |
4008 if (LODWORD(v727)) | |
4009 { | |
889 | 4010 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4011 | |
924 | 4012 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4013 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4014 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4015 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4016 } |
4017 } | |
4018 break; | |
924 | 4019 } |
4020 case SPELL_SPIRIT_BLESS: | |
4021 { | |
889 | 4022 v101 = v731 - 1; |
4023 if ( v101 && (v102 = v101 - 1) != 0 ) | |
4024 { | |
890 | 4025 v103 = v102 - 1; |
4026 if ( v103 ) | |
4027 { | |
889 | 4028 if ( v103 != 1 ) |
890 | 4029 goto LABEL_269; |
889 | 4030 v104 = 3600 * (v2 + 1); |
890 | 4031 } |
4032 else | |
4033 { | |
889 | 4034 v104 = 900 * (v2 + 4); |
890 | 4035 } |
889 | 4036 } |
4037 else | |
4038 { | |
890 | 4039 v104 = 300 * (v2 + 12); |
889 | 4040 } |
4041 LODWORD(v733) = v104; | |
4042 LABEL_269: | |
4043 amount = v2 + 5; | |
4044 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4045 break; |
889 | 4046 if ( v731 == 1 ) |
4047 { | |
924 | 4048 v108 = pCastSpell->uPlayerID_2; |
4049 v109 = pCastSpell->spellnum; | |
890 | 4050 v110 = pGame->GetStru6(); |
4051 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 4052 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 4053 //v668 = 0; |
4054 v716 = v111; | |
4055 //v658 = v111; | |
4056 //v653 = amount; | |
4057 //v651 = 1; | |
4058 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4059 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
889 | 4060 //LABEL_103: |
4061 //HIDWORD(v650) = HIDWORD(v28); | |
4062 //LABEL_104: | |
4063 //LODWORD(v650) = v28; | |
924 | 4064 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 | 4065 LODWORD(v727) = 1; |
890 | 4066 break; |
889 | 4067 } |
4068 v105 = 0; | |
4069 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4070 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4071 do | |
4072 { | |
924 | 4073 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 4074 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4075 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4076 ++v730b; | |
4077 ++v105; | |
889 | 4078 } |
4079 while ( v730b <= &pParty->pPlayers[3] ); | |
4080 LODWORD(v727) = 1; | |
890 | 4081 break; |
4082 } | |
4083 case SPELL_SPIRIT_SPIRIT_LASH: | |
4084 { | |
889 | 4085 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4086 { | |
890 | 4087 //v730 = a2 >> 3; |
4088 v112 = &pActors[PID_ID(a2)]; | |
4089 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4090 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4091 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4092 _this = (ItemGen *)v113; | |
4093 v114 = v721; | |
4094 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4095 if ( v113 < v721 ) | |
4096 { | |
889 | 4097 v116 = v113; |
4098 v113 = v721; | |
4099 v114 = v116; | |
890 | 4100 } |
4101 if ( v113 < (signed int)v115 ) | |
4102 { | |
889 | 4103 v117 = v113; |
4104 v113 = (int)v115; | |
4105 v115 = v117; | |
890 | 4106 } |
4107 if ( v114 < (signed int)v115 ) | |
4108 { | |
889 | 4109 v118 = v115; |
4110 v115 = v114; | |
4111 v114 = v118; | |
890 | 4112 } |
4113 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4114 if ( (double)(signed int)this <= 307.2 ) | |
4115 { | |
889 | 4116 v701.x = 0; |
4117 v701.y = 0; | |
4118 v701.z = 0; | |
924 | 4119 pSpellSprite.stru_24.Reset(); |
889 | 4120 v119 = HIDWORD(v733); |
924 | 4121 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4122 pSpellSprite.spell_level = v723; | |
4123 pSpellSprite.spell_skill = v731; | |
4124 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4125 pSpellSprite.uAttributes = 0; | |
4126 pSpellSprite.uSectorID = 0; | |
4127 pSpellSprite.uSpriteFrameID = 0; | |
4128 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4129 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4130 pSpellSprite.uFacing = 0; | |
4131 pSpellSprite.uSoundID = *(short *)(v119 + 16); | |
4132 pSpellSprite.vPosition.x = v112->vPosition.x; | |
4133 pSpellSprite.vPosition.y = v112->vPosition.y; | |
4134 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4135 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
4136 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
889 | 4137 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4138 LODWORD(v727) = 1; | |
890 | 4139 } |
4140 else | |
4141 { | |
889 | 4142 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4143 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4144 *(int *)HIDWORD(v733) = 0; | |
890 | 4145 } |
924 | 4146 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 4147 } |
4148 break; | |
4149 } | |
4150 case SPELL_AIR_SHIELD: | |
4151 case SPELL_EARTH_STONESKIN: | |
4152 case SPELL_SPIRIT_HEROISM: | |
4153 { | |
889 | 4154 v123 = v731 - 1; |
4155 if ( v123 && (v124 = v123 - 1) != 0 ) | |
4156 { | |
890 | 4157 v125 = v124 - 1; |
4158 if ( v125 ) | |
4159 { | |
889 | 4160 if ( v125 != 1 ) |
890 | 4161 goto LABEL_296; |
889 | 4162 v126 = 3600 * (v2 + 1); |
890 | 4163 } |
4164 else | |
4165 { | |
889 | 4166 v126 = 900 * (v2 + 4); |
890 | 4167 } |
889 | 4168 } |
4169 else | |
4170 { | |
890 | 4171 v126 = 300 * (v2 + 12); |
889 | 4172 } |
4173 LODWORD(v733) = v126; | |
4174 LABEL_296: | |
924 | 4175 v127 = pCastSpell->spellnum; |
889 | 4176 if ( v127 == 17 ) |
4177 { | |
890 | 4178 amount = 0; |
4179 LODWORD(v725) = 14; | |
889 | 4180 } |
4181 else | |
4182 { | |
890 | 4183 if ( v127 == 38 ) |
4184 { | |
889 | 4185 LODWORD(v725) = 15; |
4186 amount = v2 + 5; | |
890 | 4187 } |
4188 else | |
4189 { | |
889 | 4190 if ( v127 != 51 ) |
890 | 4191 continue; |
889 | 4192 LODWORD(v725) = 9; |
4193 amount = v2 + 5; | |
890 | 4194 } |
889 | 4195 } |
4196 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4197 break; |
924 | 4198 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4199 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4200 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4201 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4202 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4203 //LABEL_304: | |
4204 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4205 LODWORD(v727) = 1; | |
890 | 4206 break; |
4207 } | |
4208 case SPELL_FIRE_IMMOLATION: | |
4209 { | |
889 | 4210 v138 = v731 - 2; |
4211 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) | |
890 | 4212 v140 = 600 * v2; |
889 | 4213 else |
890 | 4214 v140 = 60 * v2; |
889 | 4215 LODWORD(v733) = v140; |
4216 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4217 break; |
889 | 4218 |
924 | 4219 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4220 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4221 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4222 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4223 |
4224 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4225 LODWORD(v727) = 1; | |
890 | 4226 break; |
4227 } | |
4228 case SPELL_FIRE_METEOR_SHOWER: | |
4229 { | |
889 | 4230 v149 = v731 - 1; |
4231 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4232 { | |
890 | 4233 if ( v151 == 1 ) |
889 | 4234 _this = (ItemGen *)20; |
4235 } | |
4236 else | |
4237 { | |
890 | 4238 _this = (ItemGen *)16; |
889 | 4239 } |
4240 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4241 { | |
890 | 4242 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4243 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4244 pCastSpell->spellnum = 0; |
890 | 4245 continue; |
889 | 4246 } |
4247 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4248 break; |
889 | 4249 LODWORD(v725) = PID_TYPE(a2); |
4250 if (PID_TYPE(a2) == OBJECT_Actor) | |
4251 { | |
890 | 4252 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
4253 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4254 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4255 LODWORD(v727) = v153; | |
889 | 4256 } |
4257 else | |
4258 { | |
890 | 4259 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
4260 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4261 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4262 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4263 v154 = pParty->vPosition.z; | |
889 | 4264 } |
4265 HIDWORD(v733) = v154; | |
4266 v713 = v154 + 2500; | |
4267 v721 = 0; | |
4268 LODWORD(v718) = 0; | |
4269 if ( (signed int)_this > 0 ) | |
4270 { | |
890 | 4271 *(float *)&y = (double)SHIDWORD(v733); |
4272 *(float *)&v732 = (double)v713; | |
4273 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4274 auto _this_cpy = (int)_this; | |
4275 do | |
4276 { | |
924 | 4277 //v157 = rand(); |
889 | 4278 v158 = (double)SLODWORD(v718); |
4279 v718 = v158; | |
4280 v159 = (double)v721; | |
4281 *(float *)&v721 = v159; | |
924 | 4282 a2 = rand() % 1000; |
4283 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; | |
889 | 4284 v725 = v159 * v159; |
4285 *(float *)&_this = v158 * v158; | |
4286 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4287 { | |
890 | 4288 LODWORD(v687) = 0; |
4289 HIDWORD(v687) = 0; | |
889 | 4290 } |
4291 else | |
4292 { | |
890 | 4293 x = (signed __int64)sqrt(*(float *)&_this + v725); |
4294 v687 = __PAIR__( | |
4295 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4296 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
889 | 4297 } |
924 | 4298 pSpellSprite.stru_24.Reset(); |
4299 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4300 pSpellSprite.spell_level = v2; | |
4301 pSpellSprite.spell_skill = v731; | |
4302 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4303 pSpellSprite.uAttributes = 0; | |
4304 pSpellSprite.vPosition.x = uRequiredMana; | |
4305 pSpellSprite.vPosition.y = LODWORD(v727); | |
4306 pSpellSprite.uSectorID = 0; | |
4307 pSpellSprite.vPosition.z = a2 + v713; | |
4308 pSpellSprite.uSpriteFrameID = 0; | |
4309 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4310 pSpellSprite.spell_target_pid = v730; | |
4311 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4312 pSpellSprite.uFacing = v687; | |
4313 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 4314 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4315 pSpellSprite.uAttributes = 4; |
4316 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
890 | 4317 && pParty->bTurnBasedModeOn == 1 ) |
4318 ++pTurnEngine->field_1C; | |
889 | 4319 LODWORD(v718) = rand() % 1024 - 512; |
924 | 4320 //v160 = rand(); |
889 | 4321 v14 = _this_cpy-- == 1; |
924 | 4322 v721 = (unsigned __int64)(rand() % 1024) - 512; |
890 | 4323 } |
4324 while ( !v14 ); | |
889 | 4325 } |
4326 LODWORD(v727) = 1; | |
890 | 4327 break; |
4328 } | |
4329 case SPELL_FIRE_INFERNO: | |
4330 { | |
4331 //v67 = 2; | |
4332 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4333 { | |
4334 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4335 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4336 pCastSpell->spellnum = 0; |
890 | 4337 continue; |
4338 } | |
4339 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4340 break; | |
4341 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4342 v700.z = 0; | |
4343 v700.y = 0; | |
4344 v700.x = 0; | |
924 | 4345 pSpellSprite.stru_24.Reset(); |
4346 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4347 pSpellSprite.spell_level = v2; | |
4348 pSpellSprite.spell_skill = v731; | |
4349 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4350 pSpellSprite.uAttributes = 0; | |
4351 pSpellSprite.uSectorID = 0; | |
4352 pSpellSprite.uSpriteFrameID = 0; | |
4353 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4354 pSpellSprite.uFacing = 0; | |
4355 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4356 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4357 a2 = 0; |
4358 if ( (signed int)_v726 > 0 ) | |
4359 { | |
4360 do | |
4361 { | |
4362 v162 = dword_50BF30[a2]; | |
924 | 4363 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4364 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
4365 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4366 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4367 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 4368 v165 = a2; |
4369 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
924 | 4370 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
890 | 4371 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4372 a2 = v165 + 1; | |
4373 } | |
4374 while ( v165 + 1 < (signed int)_v726 ); | |
4375 } | |
4376 LODWORD(v727) = 1; | |
4377 break; | |
4378 } | |
4379 | |
4380 case SPELL_AIR_WIZARD_EYE: | |
4381 { | |
889 | 4382 LODWORD(v733) = 3600 * v2; |
4383 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4384 break; |
889 | 4385 v168 = 0; |
4386 do | |
4387 { | |
890 | 4388 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
4389 v716 = v169; | |
889 | 4390 } |
4391 while ( v168 < 4 ); | |
4392 | |
4393 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4394 LODWORD(v727) = 1; | |
890 | 4395 break; |
4396 } | |
4397 case SPELL_AIR_FEATHER_FALL: | |
4398 { | |
889 | 4399 v170 = v731 - 1; |
4400 if ( !v170 ) | |
4401 { | |
890 | 4402 v173 = 300 * v2; |
4403 goto LABEL_353; | |
889 | 4404 } |
4405 v171 = v170 - 1; | |
4406 if ( !v171 ) | |
4407 { | |
890 | 4408 v173 = 600 * v2; |
4409 goto LABEL_353; | |
889 | 4410 } |
4411 v172 = v171 - 1; | |
4412 if ( !v172 || v172 == 1 ) | |
4413 { | |
890 | 4414 v173 = 3600 * v2; |
889 | 4415 LABEL_353: |
890 | 4416 LODWORD(v733) = v173; |
889 | 4417 } |
4418 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4419 break; |
889 | 4420 v174 = 0; |
4421 do | |
890 | 4422 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 4423 while ( v174 < 4 ); |
924 | 4424 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4425 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4426 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4427 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4428 |
4429 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); | |
4430 LODWORD(v727) = 1; | |
890 | 4431 break; |
4432 } | |
4433 case SPELL_AIR_SPARKS: | |
4434 { | |
4435 v184 = v731 - 1; | |
4436 if ( v184 ) | |
4437 { | |
4438 v185 = v184 - 1; | |
4439 if ( v185 ) | |
4440 { | |
4441 v186 = v185 - 1; | |
4442 if ( v186 ) | |
4443 { | |
4444 if ( v186 == 1 ) | |
4445 amount = 9; | |
4446 } | |
4447 else | |
4448 { | |
4449 amount = 7; | |
4450 } | |
889 | 4451 } |
4452 else | |
4453 { | |
890 | 4454 amount = 5; |
4455 } | |
4456 } | |
4457 else | |
4458 { | |
4459 amount = 3; | |
4460 } | |
4461 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4462 break; | |
4463 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
924 | 4464 pSpellSprite.stru_24.Reset(); |
4465 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4466 pSpellSprite.spell_level = v2; | |
4467 pSpellSprite.spell_skill = v731; | |
4468 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4469 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4470 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4471 pSpellSprite.uAttributes = 0; | |
4472 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4473 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 4474 pParty->vPosition.x, |
4475 pParty->vPosition.y, | |
4476 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 4477 pSpellSprite.uSpriteFrameID = 0; |
4478 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4479 pSpellSprite.spell_target_pid = a2; | |
4480 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4481 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4482 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4483 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4484 v188 = (signed int)_v726 / -2; |
4485 v189 = (signed int)_v726 / 2; | |
4486 while ( v188 <= v189 ) | |
4487 { | |
924 | 4488 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4489 if ( pSpellSprite.Create( | |
890 | 4490 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4491 v715.uPitchAngle, | |
924 | 4492 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4493 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4494 && pParty->bTurnBasedModeOn == 1 ) |
4495 ++pTurnEngine->field_1C; | |
4496 v188 += _v726 / (amount - 1); | |
4497 } | |
4498 LODWORD(v727) = 1; | |
4499 break; | |
4500 } | |
4501 | |
4502 case SPELL_AIR_JUMP: | |
4503 { | |
4504 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4505 { | |
4506 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4507 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4508 break; | |
889 | 4509 } |
4510 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4511 break; |
889 | 4512 v191 = 0; |
4513 do | |
890 | 4514 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 4515 while ( v191 < 4 ); |
4516 BYTE1(pParty->uFlags) |= 1u; | |
4517 pParty->uFallSpeed = 1000; | |
4518 LODWORD(v727) = 1; | |
890 | 4519 break; |
4520 } | |
4521 case SPELL_AIR_INVISIBILITY: | |
4522 { | |
889 | 4523 v192 = v731 - 1; |
4524 if ( !v192 ) | |
4525 { | |
890 | 4526 amount = v2; |
924 | 4527 //goto LABEL_391; |
4528 v195 = 600 * v2; | |
4529 goto LABEL_392; | |
889 | 4530 } |
4531 v193 = v192 - 1; | |
4532 if ( !v193 ) | |
4533 { | |
890 | 4534 v196 = 2 * v2; |
924 | 4535 //LABEL_389: |
890 | 4536 amount = v196; |
924 | 4537 //LABEL_391: |
890 | 4538 v195 = 600 * v2; |
4539 goto LABEL_392; | |
889 | 4540 } |
4541 v194 = v193 - 1; | |
4542 if ( !v194 ) | |
4543 { | |
890 | 4544 v196 = 3 * v2; |
924 | 4545 //goto LABEL_389; |
4546 amount = v196; | |
4547 v195 = 600 * v2; | |
4548 goto LABEL_392; | |
889 | 4549 } |
4550 if ( v194 != 1 ) | |
890 | 4551 goto LABEL_393; |
889 | 4552 amount = 4 * v2; |
4553 v195 = 3600 * v2; | |
4554 LABEL_392: | |
4555 LODWORD(v733) = v195; | |
4556 LABEL_393: | |
4557 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
4558 { | |
890 | 4559 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4560 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4561 pCastSpell->spellnum = 0; |
890 | 4562 continue; |
889 | 4563 } |
4564 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4565 { | |
924 | 4566 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4567 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4568 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4569 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4570 |
4571 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4572 LODWORD(v727) = 1; | |
4573 } | |
4574 break; | |
4575 } | |
4576 case SPELL_AIR_FLY: | |
4577 { | |
4578 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4579 { | |
4580 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4581 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4582 break; | |
4583 } | |
924 | 4584 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4585 { |
4586 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4587 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4588 break; | |
4589 } | |
4590 LODWORD(v733) = 3600 * v2; | |
4591 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4592 amount = 1; | |
4593 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4594 break; | |
4595 v205 = 0; | |
4596 do | |
4597 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4598 while ( v205 < 4 ); | |
4599 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
924 | 4600 v207 = pCastSpell->uPlayerID + 1; |
890 | 4601 v716 = v206; |
4602 | |
4603 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4604 LODWORD(v727) = 1; | |
4605 break; | |
4606 } | |
4607 | |
4608 case SPELL_AIR_STARBURST: | |
4609 { | |
4610 //v67 = 2; | |
4611 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4612 { | |
4613 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4614 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4615 pCastSpell->spellnum = 0; |
890 | 4616 continue; |
4617 } | |
4618 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4619 break; | |
4620 v208 = PID_TYPE(a2); | |
4621 LODWORD(v725) = PID_TYPE(a2); | |
4622 if ( v208 == 3 ) | |
4623 { | |
4624 v209 = PID_ID(a2); | |
4625 LODWORD(v718) = pActors[v209].vPosition.x; | |
4626 v210 = pActors[v209].vPosition.y; | |
4627 v211 = pActors[v209].vPosition.z; | |
4628 v713 = v210; | |
4629 } | |
4630 else | |
4631 { | |
4632 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4633 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4634 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4635 v214 = sub_42EBBE(2048, v213); | |
4636 v211 = pParty->vPosition.z; | |
4637 v713 = pParty->vPosition.y + v214; | |
4638 v208 = LODWORD(v725); | |
4639 } | |
4640 HIDWORD(v733) = 0; | |
4641 *(float *)&v732 = (double)v211; | |
4642 LODWORD(v725) = v211 + 2500; | |
4643 v721 = 0; | |
4644 *(float *)&y = (double)(v211 + 2500); | |
4645 v730 = v208 == 3 ? a2 : 0; | |
4646 a2 = 20; | |
4647 do | |
4648 { | |
4649 v215 = rand(); | |
4650 v216 = (double)v721; | |
4651 v217 = (double)SHIDWORD(v733); | |
4652 *(float *)&uRequiredMana = v217; | |
4653 _this = (ItemGen *)(v215 % 1000); | |
4654 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4655 *(float *)&v721 = v217 * v217; | |
4656 //*(float *)&v726 = v216 * v216; | |
4657 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4658 { | |
4659 LODWORD(v685) = 0; | |
4660 HIDWORD(v685) = 0; | |
889 | 4661 } |
4662 else | |
4663 { | |
890 | 4664 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4665 v685 = __PAIR__( | |
4666 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4667 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4668 } | |
924 | 4669 pSpellSprite.stru_24.Reset(); |
4670 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4671 pSpellSprite.spell_level = v2; | |
4672 pSpellSprite.spell_skill = v731; | |
4673 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4674 pSpellSprite.uAttributes = 0; | |
4675 pSpellSprite.vPosition.x = LODWORD(v718); | |
4676 pSpellSprite.vPosition.y = v713; | |
4677 pSpellSprite.uSectorID = 0; | |
4678 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4679 pSpellSprite.uSpriteFrameID = 0; | |
4680 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4681 pSpellSprite.spell_target_pid = v730; | |
921 | 4682 //__debugbreak();//çâåçäîïàä |
924 | 4683 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4684 pSpellSprite.uFacing = v685; | |
4685 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4686 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4687 pSpellSprite.uAttributes = 4; |
4688 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4689 && pParty->bTurnBasedModeOn == 1 ) | |
4690 ++pTurnEngine->field_1C; | |
890 | 4691 v721 = rand() % 1024 - 512; |
4692 v218 = rand(); | |
4693 v14 = a2-- == 1; | |
4694 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4695 } | |
4696 while ( !v14 ); | |
4697 LODWORD(v727) = 1; | |
4698 break; | |
4699 } | |
4700 | |
4701 case SPELL_WATER_AWAKEN: | |
4702 { | |
4703 v219 = v731 - 2; | |
4704 if ( v219 ) | |
4705 { | |
4706 v220 = v219 - 1; | |
4707 if ( v220 ) | |
4708 { | |
4709 if ( v220 == 1 ) | |
4710 { | |
4711 amount = 0; | |
4712 goto LABEL_433; | |
4713 } | |
4714 v221 = 180 * v2; | |
4715 } | |
4716 else | |
4717 { | |
4718 v221 = 86400 * v2; | |
4719 } | |
889 | 4720 } |
4721 else | |
4722 { | |
890 | 4723 v221 = 3600 * v2; |
4724 } | |
4725 amount = v221; | |
4726 LABEL_433: | |
889 | 4727 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4728 break; |
4729 v222 = pParty->pPlayers; | |
4730 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4731 while ( 2 ) | |
4732 { | |
4733 if ( v731 == 4 ) | |
4734 { | |
4735 if ( v222->pConditions[2] ) | |
4736 { | |
4737 //*((int *)v222 + 4) = 0; | |
4738 //*((int *)v222 + 5) = 0; | |
4739 v222->pConditions[2] = 0; | |
4740 v222->PlaySound(SPEECH_103, 0); | |
4741 } | |
4742 } | |
4743 else | |
889 | 4744 { |
890 | 4745 v223 = v222->DiscardConditionIfLastsLongerThan( |
4746 2u, | |
4747 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4748 v222 = (Player *)HIDWORD(v733); | |
4749 if ( v223 ) | |
4750 v222->PlaySound(SPEECH_103, 0); | |
4751 } | |
4752 ++v222;// += 6972; | |
4753 HIDWORD(v733) = (int)v222; | |
4754 if ( v222 >= &pParty->pPlayers[3] ) | |
4755 { | |
4756 LODWORD(v727) = 1; | |
4757 break; | |
4758 } | |
4759 } | |
4760 } | |
4761 case SPELL_WATER_POISON_SPRAY: | |
4762 { | |
4763 v224 = v731 - 2; | |
4764 if ( v224 ) | |
4765 { | |
4766 v225 = v224 - 1; | |
4767 if ( v225 ) | |
4768 { | |
4769 if ( v225 == 1 ) | |
4770 amount = 7; | |
4771 else | |
4772 amount = 1; | |
4773 } | |
4774 else | |
4775 { | |
4776 amount = 5; | |
889 | 4777 } |
890 | 4778 } |
4779 else | |
4780 { | |
4781 amount = 3; | |
4782 } | |
889 | 4783 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4784 break; |
4785 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4786 if ( amount == 1 ) | |
4787 { | |
924 | 4788 pSpellSprite.stru_24.Reset(); |
4789 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4790 pSpellSprite.spell_skill = v731; | |
4791 pSpellSprite.spell_level = v2; | |
4792 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4793 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4794 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4795 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4796 v660 = pParty->vPosition.y; | |
4797 LABEL_153: | |
924 | 4798 pSpellSprite.uAttributes = 0; |
4799 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4800 pSpellSprite.vPosition.z = v51; | |
890 | 4801 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4802 pSpellSprite.uSpriteFrameID = 0; |
4803 pSpellSprite.uSectorID = v52; | |
4804 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4805 pSpellSprite.spell_target_pid = a2; | |
4806 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4807 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4808 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4809 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4810 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4811 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4812 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4813 ++pTurnEngine->field_1C; | |
890 | 4814 } |
4815 else | |
4816 { | |
924 | 4817 pSpellSprite.stru_24.Reset(); |
4818 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4819 pSpellSprite.spell_level = v2; | |
4820 pSpellSprite.spell_skill = v731; | |
4821 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4822 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4823 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4824 pSpellSprite.uAttributes = 0; | |
4825 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4826 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4827 pSpellSprite.uSpriteFrameID = 0; | |
4828 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4829 pSpellSprite.spell_target_pid = a2; | |
4830 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4831 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4832 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4833 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4834 v227 = SHIDWORD(v733) / -2; |
4835 y = (char *)(SHIDWORD(v733) / 2); | |
4836 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4837 { | |
4838 v228 = v715.uYawAngle; | |
4839 do | |
4840 { | |
924 | 4841 pSpellSprite.uFacing = v227 + v228; |
4842 if ( pSpellSprite.Create( | |
890 | 4843 v227 + v228, |
4844 v715.uPitchAngle, | |
924 | 4845 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4846 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4847 && pParty->bTurnBasedModeOn == 1 ) |
4848 ++pTurnEngine->field_1C; | |
4849 v227 += SHIDWORD(v733) / (amount - 1); | |
4850 } | |
4851 while ( v227 <= (signed int)y ); | |
4852 } | |
889 | 4853 } |
4854 LODWORD(v727) = 1; | |
890 | 4855 break; |
4856 } | |
4857 case SPELL_WATER_WATER_WALK: | |
4858 { | |
924 | 4859 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4860 { |
4861 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4862 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4863 break; | |
4864 } | |
4865 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4866 v229 = 600 * v2; | |
4867 else | |
4868 v229 = 3600 * v2; | |
4869 LODWORD(v733) = v229; | |
4870 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4871 break; | |
4872 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
924 | 4873 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4874 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4875 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4876 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4877 |
4878 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4879 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4880 v731, | |
4881 amount, | |
4882 v716, | |
924 | 4883 pCastSpell->uPlayerID + 1); |
890 | 4884 if ( v731 == 4 ) |
4885 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4886 LODWORD(v727) = 1; | |
4887 break; | |
4888 } | |
4889 case SPELL_WATER_RECHARGE_ITEM: | |
4890 { | |
4891 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4892 break; | |
924 | 4893 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
890 | 4894 y = v240; |
4895 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4896 { | |
4897 dword_50C9D0 = 113; | |
4898 dword_50C9D4 = 0; | |
4899 dword_50C9D8 = 1; | |
4900 | |
4901 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4902 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4903 pCastSpell->spellnum = 0; |
890 | 4904 continue; |
4905 } | |
4906 if ( v731 == 1 || v731 == 2 ) | |
4907 { | |
4908 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4909 } | |
4910 else | |
4911 { | |
4912 if ( v731 == 3 ) | |
4913 { | |
4914 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
889 | 4915 } |
4916 else | |
4917 { | |
890 | 4918 if ( v731 != 4 ) |
4919 { | |
4920 v241 = 0.0; | |
4921 goto LABEL_484; | |
4922 } | |
4923 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4924 } | |
4925 } | |
4926 if ( v241 > 1.0 ) | |
4927 v241 = 1.0; | |
4928 LABEL_484: | |
4929 v732 = (unsigned __int8)v240[25]; | |
4930 v242 = (signed __int64)((double)v732 * v241); | |
4931 v243 = y; | |
4932 y[25] = v242; | |
4933 *((int *)v243 + 4) = (unsigned __int8)v242; | |
4934 if ( (unsigned __int8)v242 <= 0 ) | |
4935 { | |
4936 *(int *)v243 = 0; | |
4937 dword_50C9D0 = 113; | |
4938 dword_50C9D4 = 0; | |
4939 dword_50C9D8 = 1; | |
4940 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4941 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4942 pCastSpell->spellnum = 0; |
890 | 4943 v2 = v723; |
4944 continue; | |
4945 } | |
4946 *((int *)v243 + 5) |= 0x40u; | |
4947 dword_50C9A8 = 256; | |
4948 LODWORD(v727) = 1; | |
4949 break; | |
4950 } | |
4951 case SPELL_WATER_ENCHANT_ITEM: | |
4952 { | |
4953 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4954 break; | |
4955 uRequiredMana = 0; | |
4956 HIDWORD(v733) = 10 * v2; | |
4957 v730 = 1; | |
924 | 4958 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 4959 if ( v731 == 1 ) |
4960 { | |
4961 v245 = (int)&v244[36 * a2 + 532]; | |
4962 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
4963 v311 = __OFSUB__(*(int *)v245, 134); | |
4964 v14 = *(int *)v245 == 134; | |
4965 v310 = *(int *)v245 - 134 < 0; | |
4966 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
4967 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
4968 { | |
4969 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
4970 { | |
4971 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
4972 { | |
4973 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
889 | 4974 { |
890 | 4975 v312 = v309[28]; |
4976 if ( v312 ) | |
4977 { | |
4978 if ( v312 != 1 ) | |
4979 { | |
4980 if ( v312 != 2 ) | |
4981 { | |
4982 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
4983 if ( !(v244[36 * a2 + 552] & 2) ) | |
4984 { | |
4985 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
4986 { | |
4987 uRequiredMana = 1; | |
4988 v730 = 0; | |
4989 } | |
4990 if ( rand() % 100 >= SHIDWORD(v733) ) | |
4991 uRequiredMana = 1; | |
4992 if (!uRequiredMana) | |
4993 { | |
4994 v313 = *(char *)(LODWORD(v725) + 28); | |
4995 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
4996 { | |
4997 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
4998 *(int *)(v245 + 4) = 0; | |
4999 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5000 + 1]; | |
5001 ; | |
5002 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5003 + 1] ) | |
5004 { | |
5005 ++*(int *)(v245 + 4); | |
5006 if ( j >= v314 ) | |
5007 break; | |
5008 } | |
5009 v254 = rand(); | |
5010 v255 = 10;//pItemsTable->field_116D8[17]; | |
5011 v256 = 10;//pItemsTable->field_116D8[16]; | |
5012 LABEL_611: | |
5013 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5014 LABEL_612: | |
5015 _this->uItemID |= 0x20u; | |
5016 | |
5017 dword_50C9A8 = 256; | |
5018 LODWORD(v727) = 1; | |
5019 break; | |
5020 } | |
924 | 5021 goto LABEL_616; |
890 | 5022 } |
5023 LABEL_613: | |
5024 v316 = _this->uItemID; | |
5025 if ( !(BYTE1(v316) & 2) ) | |
5026 { | |
5027 LOBYTE(v316) = v316 | 2; | |
5028 _this->uItemID = v316; | |
5029 } | |
5030 } | |
5031 } | |
5032 } | |
5033 } | |
5034 } | |
889 | 5035 } |
890 | 5036 } |
5037 } | |
5038 LABEL_616: | |
5039 if ( LODWORD(v727) == 0 ) | |
5040 { | |
5041 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5042 if ( v730 == 0 ) | |
5043 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5044 ShowStatusBarString(v317, 2u); | |
5045 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5046 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5047 pCastSpell->spellnum = 0; | |
890 | 5048 v318->PlaySound(SPEECH_43, 0); |
5049 } | |
5050 break; | |
5051 } | |
5052 if ( v731 != 2 ) | |
5053 { | |
5054 if ( v731 == 3 ) | |
5055 { | |
5056 v245 = (int)&v244[36 * a2 + 532]; | |
5057 v269 = *(int *)v245; | |
5058 if ( *(int *)v245 > 134 | |
5059 || *(int *)(v245 + 12) != 0 | |
5060 || *(int *)(v245 + 4) != 0 | |
5061 || *(int *)(v245 + 8) != 0 | |
5062 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
5063 goto LABEL_616; | |
5064 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5065 LODWORD(v725) = (int)v270; | |
5066 v271 = v270[28]; | |
5067 if ( v271 && v271 != 1 && v271 != 2 ) | |
5068 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5069 else | |
5070 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5071 if ( v272 ) | |
5072 { | |
5073 uRequiredMana = 1; | |
5074 v730 = 0; | |
5075 } | |
5076 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5077 uRequiredMana = 1; | |
5078 if (uRequiredMana) | |
5079 goto LABEL_613; | |
5080 v273 = v725; | |
5081 v274 = *(char *)(LODWORD(v725) + 28); | |
5082 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 ) | |
5083 { | |
5084 if ( rand() % 100 < 80 | |
5085 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5086 { | |
5087 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5088 *(int *)(v245 + 4) = 0; | |
5089 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5090 ; | |
5091 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5092 + 1] ) | |
5093 { | |
5094 ++*(int *)(v245 + 4); | |
5095 if ( k >= v275 ) | |
5096 break; | |
5097 } | |
5098 v254 = rand(); | |
5099 v255 = 10;//pItemsTable->field_116D8[19]; | |
5100 v256 = 10;//pItemsTable->field_116D8[18]; | |
5101 goto LABEL_611; | |
5102 } | |
5103 v277 = pItemsTable->pSpecialEnchantments_count; | |
5104 v278 = 0; | |
5105 v725 = 0.0; | |
5106 HIDWORD(v733) = 0; | |
5107 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5108 { | |
5109 v730 = (int)&v679; | |
5110 do | |
5111 { | |
5112 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5113 if ( !v279 || v279 == 1 ) | |
5114 { | |
5115 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5116 + 4] | |
5117 + v278 * 28); | |
5118 LODWORD(v725) += v280; | |
5119 if ( v280 ) | |
5120 { | |
5121 v281 = v730; | |
5122 v730 += 4; | |
5123 *(int *)v281 = HIDWORD(v733); | |
5124 } | |
5125 } | |
5126 ++HIDWORD(v733); | |
5127 ++v278; | |
5128 } | |
5129 while ( SHIDWORD(v733) < v277 ); | |
5130 } | |
5131 v282 = rand() % SLODWORD(v725); | |
5132 v283 = v679; | |
5133 *(int *)(v245 + 12) = v679; | |
5134 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5135 v285 = v282 + 1; | |
5136 if ( v284 < v285 ) | |
5137 { | |
5138 for ( l = &v679; ; l = (int *)v732 ) | |
5139 { | |
5140 v287 = (int)(l + 1); | |
5141 v732 = v287; | |
5142 v288 = *(int *)v287; | |
5143 *(int *)(v245 + 12) = v288; | |
5144 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5145 + 4]; | |
5146 if ( v284 >= v285 ) | |
5147 break; | |
5148 } | |
5149 } | |
924 | 5150 ++*(int *)(v245 + 12); |
5151 goto LABEL_612; | |
890 | 5152 } |
889 | 5153 } |
5154 else | |
5155 { | |
890 | 5156 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5157 if ( v731 != 4 | |
5158 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5159 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5160 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5161 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5162 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
5163 goto LABEL_616; | |
5164 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5165 LODWORD(v725) = (int)v247; | |
5166 v248 = v247[28]; | |
5167 if ( v248 && v248 != 1 && v248 != 2 ) | |
5168 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5169 else | |
5170 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5171 if ( v249 ) | |
5172 { | |
5173 uRequiredMana = 1; | |
5174 v730 = 0; | |
5175 } | |
5176 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5177 uRequiredMana = 1; | |
5178 if (uRequiredMana) | |
5179 goto LABEL_613; | |
5180 v250 = v725; | |
5181 v251 = *(char *)(LODWORD(v725) + 28); | |
5182 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 ) | |
5183 { | |
5184 if ( rand() % 100 < 80 | |
5185 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5186 { | |
5187 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5188 *(int *)(v245 + 4) = 0; | |
5189 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5190 ; | |
5191 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5192 + 1] ) | |
5193 { | |
5194 ++*(int *)(v245 + 4); | |
5195 if ( m >= v252 ) | |
5196 break; | |
5197 } | |
5198 v254 = rand(); | |
5199 v255 = 10;// pItemsTable->field_116D8[21]; | |
5200 v256 = 10;//pItemsTable->field_116D8[20]; | |
5201 goto LABEL_611; | |
5202 } | |
5203 v257 = pItemsTable->pSpecialEnchantments_count; | |
5204 v258 = 0; | |
5205 v725 = 0.0; | |
5206 HIDWORD(v733) = 0; | |
5207 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5208 { | |
5209 v730 = (int)&v679; | |
5210 do | |
5211 { | |
5212 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5213 if ( !v259 || v259 == 1 ) | |
5214 { | |
5215 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5216 + 4] | |
5217 + v258 * 28); | |
5218 LODWORD(v725) += v260; | |
5219 if ( v260 ) | |
5220 { | |
5221 v261 = v730; | |
5222 v730 += 4; | |
5223 *(int *)v261 = HIDWORD(v733); | |
5224 } | |
5225 } | |
5226 ++HIDWORD(v733); | |
5227 ++v258; | |
5228 } | |
5229 while ( SHIDWORD(v733) < v257 ); | |
5230 } | |
5231 v262 = rand() % SLODWORD(v725); | |
5232 v263 = v679; | |
5233 *(int *)(v245 + 12) = v679; | |
5234 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5235 v265 = v262 + 1; | |
5236 if ( v264 < v265 ) | |
5237 { | |
5238 for ( ii = &v679; ; ii = (int *)v732 ) | |
5239 { | |
5240 v267 = (int)(ii + 1); | |
5241 v732 = v267; | |
5242 v268 = *(int *)v267; | |
5243 *(int *)(v245 + 12) = v268; | |
5244 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5245 + 4]; | |
5246 if ( v264 >= v265 ) | |
5247 break; | |
5248 } | |
5249 } | |
5250 ++*(int *)(v245 + 12); | |
5251 goto LABEL_612; | |
5252 } | |
5253 } | |
5254 //v1 = 0; | |
5255 goto LABEL_616; | |
5256 } | |
5257 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5258 _this = v289; | |
5259 v290 = v289->uItemID; | |
5260 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5261 if ( v290 > 134 | |
5262 || _this->uSpecEnchantmentType != 0 | |
5263 || _this->uEnchantmentType != 0 | |
5264 || _this->_bonus_strength != 0 | |
5265 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5266 || v291 == 1 | |
5267 || v291 == 2 | |
5268 || _this->Broken()) | |
5269 goto LABEL_616; | |
5270 if ( _this->GetValue() < 0x1C2 ) | |
5271 uRequiredMana = 1; | |
5272 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5273 uRequiredMana = 1; | |
5274 if ( uRequiredMana != 0 ) | |
5275 { | |
5276 dword_50C9D0 = 113; | |
5277 dword_50C9D4 = 0; | |
5278 dword_50C9D8 = 1; | |
5279 | |
5280 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5281 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5282 pCastSpell->spellnum = 0; |
890 | 5283 continue; |
5284 } | |
5285 v292 = *(char *)(LODWORD(v725) + 28); | |
5286 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5287 { | |
889 | 5288 v2 = v723; |
5289 //v1 = 0; | |
890 | 5290 |
5291 dword_50C9D0 = 113; | |
5292 dword_50C9D4 = 0; | |
5293 dword_50C9D8 = 1; | |
5294 | |
5295 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5296 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5297 pCastSpell->spellnum = 0; |
890 | 5298 continue; |
5299 } | |
5300 if ( rand() % 100 >= 80 ) | |
5301 { | |
5302 v297 = pItemsTable->pSpecialEnchantments_count; | |
5303 v294 = _this; | |
5304 v298 = 0; | |
5305 v725 = 0.0; | |
5306 HIDWORD(v733) = 0; | |
5307 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5308 { | |
5309 v730 = (int)&v679; | |
5310 do | |
5311 { | |
5312 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5313 if ( !v299 || v299 == 1 ) | |
5314 { | |
5315 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5316 + v298 * 28); | |
5317 LODWORD(v725) += v300; | |
5318 if ( v300 ) | |
5319 { | |
5320 v301 = v730; | |
5321 v730 += 4; | |
5322 *(int *)v301 = HIDWORD(v733); | |
5323 } | |
5324 } | |
5325 ++HIDWORD(v733); | |
5326 ++v298; | |
5327 } | |
5328 while ( SHIDWORD(v733) < v297 ); | |
5329 } | |
5330 v302 = rand() % SLODWORD(v725); | |
5331 v303 = v679; | |
5332 v294->uSpecEnchantmentType = v679; | |
5333 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5334 v305 = v302 + 1; | |
5335 if ( v304 < v305 ) | |
5336 { | |
5337 for ( jj = &v679; ; jj = (int *)v732 ) | |
5338 { | |
5339 v307 = (int)(jj + 1); | |
5340 v732 = v307; | |
5341 v308 = *(int *)v307; | |
5342 v294->uSpecEnchantmentType = v308; | |
5343 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5344 if ( v304 >= v305 ) | |
5345 break; | |
5346 } | |
5347 } | |
5348 ++v294->uSpecEnchantmentType; | |
5349 } | |
5350 else | |
5351 { | |
5352 v293 = rand(); | |
5353 v294 = _this; | |
5354 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5355 _this->uEnchantmentType = 0; | |
5356 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5357 ; | |
5358 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5359 + 1] ) | |
5360 { | |
5361 ++v294->uEnchantmentType; | |
5362 if ( kk >= v295 ) | |
5363 break; | |
5364 } | |
5365 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5366 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5367 } | |
5368 v294->uAttributes |= 0x20u; | |
5369 dword_50C9A8 = 256; | |
5370 LODWORD(v727) = 1; | |
5371 break; | |
5372 } | |
5373 case SPELL_WATER_TOWN_PORTAL: | |
5374 { | |
5375 amount = 10 * v2; | |
5376 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5377 break; | |
5378 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5379 { | |
5380 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5381 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5382 pCastSpell->spellnum = 0; |
890 | 5383 continue; |
5384 } | |
924 | 5385 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
890 | 5386 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5387 LODWORD(v727) = 1; | |
5388 break; | |
5389 } | |
5390 case SPELL_WATER_LLOYDS_BEACON: | |
5391 { | |
5392 LODWORD(v733) = 604800 * v2; | |
5393 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5394 { | |
5395 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5396 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5397 pCastSpell->spellnum = 0; |
890 | 5398 continue; |
5399 } | |
5400 v319 = uRequiredMana; | |
5401 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5402 { | |
5403 pEventTimer->Pause(); | |
5404 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | |
5405 qword_506350 = (signed int)v733; | |
924 | 5406 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
890 | 5407 ::uRequiredMana = v319; |
5408 ::sRecoveryTime = sRecoveryTime; | |
924 | 5409 dword_50633C = pCastSpell->sound_id; |
5410 dword_506338 = pCastSpell->spellnum; | |
5411 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
890 | 5412 } |
5413 break; | |
5414 } | |
5415 case SPELL_EARTH_STONE_TO_FLESH: | |
5416 { | |
5417 v320 = v731 - 2; | |
5418 if ( !v320 ) | |
5419 goto LABEL_632; | |
5420 v321 = v320 - 1; | |
5421 if ( v321 ) | |
5422 { | |
5423 if ( v321 == 1 ) | |
5424 goto LABEL_634; | |
5425 LABEL_632: | |
5426 v322 = 3600 * v2; | |
5427 } | |
5428 else | |
5429 { | |
5430 v322 = 86400 * v2; | |
5431 } | |
5432 amount = v322; | |
5433 LABEL_634: | |
5434 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5435 break; | |
924 | 5436 v323 = pCastSpell->uPlayerID_2; |
890 | 5437 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5438 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5439 { | |
5440 LODWORD(v727) = 1; | |
5441 break; | |
5442 } | |
5443 if ( v731 == 4 ) | |
5444 { | |
5445 *(int *)v324 = 0; | |
5446 *((int *)v324 + 1) = 0; | |
5447 LODWORD(v727) = 1; | |
5448 break; | |
5449 } | |
5450 v732 = amount << 7; | |
5451 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5452 v656 = 15; | |
924 | 5453 v325 = &pParty->pPlayers[v323]; |
5454 goto LABEL_641; | |
890 | 5455 } |
5456 case SPELL_EARTH_ROCK_BLAST: | |
5457 { | |
5458 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5459 break; | |
924 | 5460 pSpellSprite.stru_24.Reset(); |
5461 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5462 pSpellSprite.spell_level = v2; | |
5463 pSpellSprite.spell_skill = v731; | |
5464 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5465 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5466 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5467 pSpellSprite.uAttributes = 0; | |
5468 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5469 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 5470 pParty->vPosition.x, |
5471 pParty->vPosition.y, | |
5472 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 5473 pSpellSprite.uSpriteFrameID = 0; |
5474 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5475 pSpellSprite.spell_target_pid = a2; | |
5476 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5477 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5478 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5479 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5480 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5481 | |
5482 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5483 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5484 ++pTurnEngine->field_1C; |
5485 LODWORD(v727) = 1; | |
5486 break; | |
5487 } | |
5488 case SPELL_EARTH_DEATH_BLOSSOM: | |
5489 { | |
5490 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5491 { | |
5492 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5493 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5494 pCastSpell->spellnum = 0; |
890 | 5495 continue; |
5496 } | |
5497 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5498 break; | |
924 | 5499 pSpellSprite.uType = 4090; |
5500 pSpellSprite.stru_24.Reset(); | |
5501 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5502 pSpellSprite.spell_level = v2; | |
5503 pSpellSprite.spell_skill = v731; | |
5504 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5505 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5506 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5507 pSpellSprite.uAttributes = 0; | |
5508 pSpellSprite.uSectorID = 0; | |
5509 pSpellSprite.uSpriteFrameID = 0; | |
5510 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5511 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5512 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5513 pSpellSprite.spell_target_pid = a2; | |
5514 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5515 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5516 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5517 pSpellSprite.uAttributes = 4; |
5518 | |
5519 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5520 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5521 ++pTurnEngine->field_1C; |
5522 LODWORD(v727) = 1; | |
5523 break; | |
5524 } | |
5525 case SPELL_SPIRIT_DETECT_LIFE: | |
5526 { | |
5527 v328 = v731 - 2; | |
5528 if ( v328 ) | |
5529 { | |
5530 v329 = v328 - 1; | |
5531 if ( v329 && v329 != 1 ) | |
5532 v330 = 600 * v2; | |
5533 else | |
5534 v330 = 3600 * v2; | |
5535 } | |
5536 else | |
5537 { | |
5538 v330 = 1800 * v2; | |
5539 } | |
5540 LODWORD(v733) = v330; | |
5541 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5542 break; | |
924 | 5543 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5544 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5545 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5546 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 5547 |
5548 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); | |
5549 LODWORD(v727) = 1; | |
5550 break; | |
5551 } | |
5552 case SPELL_SPIRIT_FATE: | |
5553 { | |
5554 LODWORD(v733) = 300; | |
5555 v339 = v731 - 2; | |
5556 if ( v339 ) | |
5557 { | |
5558 v340 = v339 - 1; | |
5559 if ( v340 ) | |
5560 { | |
5561 if ( v340 != 1 ) | |
5562 { | |
5563 amount = v2; | |
5564 goto LABEL_667; | |
5565 } | |
5566 v341 = 6 * v2; | |
889 | 5567 } |
5568 else | |
5569 { | |
890 | 5570 v341 = 4 * v2; |
5571 } | |
5572 } | |
5573 else | |
5574 { | |
5575 v341 = 2 * v2; | |
5576 } | |
5577 amount = v341; | |
5578 LABEL_667: | |
5579 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5580 break; | |
924 | 5581 v342 = pCastSpell->spell_target_pid; |
890 | 5582 if ( v342 == 0 ) |
5583 { | |
924 | 5584 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5585 | |
5586 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
890 | 5587 LODWORD(v727) = 1; |
5588 break; | |
5589 } | |
5590 if (PID_TYPE(v342) == OBJECT_Actor) | |
5591 { | |
5592 v343 = PID_ID(v342); | |
5593 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5594 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5595 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5596 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5597 v672 = 0; | |
5598 v661 = &pActors[v343]; | |
5599 LABEL_165: | |
5600 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5601 } | |
5602 LODWORD(v727) = 1; | |
5603 break; | |
5604 } | |
5605 case SPELL_SPIRIT_REMOVE_CURSE: | |
5606 { | |
5607 v348 = v731 - 2; | |
5608 if ( !v348 ) | |
5609 goto LABEL_677; | |
5610 v349 = v348 - 1; | |
5611 if ( v349 ) | |
5612 { | |
5613 if ( v349 == 1 ) | |
5614 { | |
5615 amount = 0; | |
5616 goto LABEL_679; | |
5617 } | |
5618 LABEL_677: | |
5619 v350 = 3600 * v2; | |
5620 } | |
5621 else | |
5622 { | |
5623 v350 = 86400 * v2; | |
5624 } | |
5625 amount = v350; | |
5626 LABEL_679: | |
5627 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5628 break; | |
924 | 5629 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5630 if ( !v351->pConditions[0] ) |
5631 { | |
5632 LODWORD(v727) = 1; | |
5633 break; | |
5634 } | |
5635 if ( v731 == 4 ) | |
5636 { | |
5637 LODWORD(v351->pConditions[0]) = 0; | |
5638 HIDWORD(v351->pConditions[0]) = 0; | |
5639 } | |
5640 else | |
5641 { | |
5642 v732 = amount << 7; | |
5643 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
924 | 5644 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
890 | 5645 { |
5646 LODWORD(v727) = 1; | |
5647 break; | |
5648 } | |
5649 } | |
924 | 5650 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 5651 LODWORD(v727) = 1; |
5652 break; | |
5653 } | |
5654 case SPELL_SPIRIT_PRESERVATION: | |
5655 { | |
5656 v354 = v731 - 2; | |
5657 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5658 v356 = 900 * (v2 + 4); | |
5659 else | |
5660 v356 = 300 * (v2 + 12); | |
5661 LODWORD(v733) = v356; | |
5662 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5663 break; | |
5664 if ( v731 == 1 || v731 == 2 ) | |
5665 { | |
924 | 5666 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5667 | |
5668 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 | 5669 LODWORD(v727) = 1; |
5670 break; | |
5671 } | |
5672 a2 = 0; | |
5673 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5674 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5675 do | |
5676 { | |
924 | 5677 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 5678 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5679 ++a2; | |
5680 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5681 } | |
5682 while ( v357 <= &pParty->pPlayers[3] ); | |
5683 LODWORD(v727) = 1; | |
5684 break; | |
5685 } | |
5686 case SPELL_SPIRIT_TURN_UNDEAD: | |
5687 { | |
5688 v364 = v731 - 2; | |
5689 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5690 v366 = 60 * (v2 + 3); | |
5691 else | |
5692 v366 = 300 * v2 + 180; | |
5693 LODWORD(v733) = v366; | |
5694 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5695 break; | |
5696 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5697 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
924 | 5698 ++pSpellSprite.uType; |
5699 pSpellSprite.stru_24.Reset(); | |
5700 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5701 pSpellSprite.spell_level = v2; | |
5702 pSpellSprite.spell_skill = v731; | |
5703 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5704 pSpellSprite.uAttributes = 0; | |
5705 pSpellSprite.uSectorID = 0; | |
5706 pSpellSprite.uSpriteFrameID = 0; | |
5707 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5708 pSpellSprite.uFacing = 0; | |
5709 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5710 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5711 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5712 { | |
5713 v369 = &pActors[dword_50BF30[a2]]; | |
5714 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5715 { | |
924 | 5716 pSpellSprite.vPosition.x = v369->vPosition.x; |
5717 pSpellSprite.vPosition.y = v369->vPosition.y; | |
5718 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5719 | |
5720 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5721 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 5722 v369->pActorBuffs[4].Apply( |
5723 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
889 | 5724 v731, 0, 0, 0); |
5725 } | |
890 | 5726 } |
5727 LODWORD(v727) = 1; | |
5728 } | |
5729 break; | |
5730 | |
5731 case SPELL_SPIRIT_RAISE_DEAD: | |
5732 { | |
5733 v371 = v731 - 2; | |
5734 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5735 amount = 0; | |
5736 else | |
5737 amount = 86400 * v2; | |
5738 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5739 break; | |
924 | 5740 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5741 v373 = pCastSpell->uPlayerID_2; | |
890 | 5742 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5743 { | |
5744 LODWORD(v727) = 1; | |
5745 break; | |
5746 } | |
5747 v14 = v731 == 4; | |
5748 pParty->pPlayers[v373].sHealth = 1; | |
5749 if ( v14 ) | |
5750 { | |
924 | 5751 v374 = pCastSpell->uPlayerID_2; |
890 | 5752 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5753 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
924 | 5754 v376 = pCastSpell->uPlayerID_2; |
890 | 5755 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5756 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5757 } | |
5758 else | |
5759 { | |
5760 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5761 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5762 0xEu, |
5763 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 5764 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5765 0xDu, |
5766 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5767 } | |
924 | 5768 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5769 goto LABEL_720; |
5770 } | |
5771 case SPELL_SPIRIT_SHARED_LIFE: | |
5772 { | |
5773 v378 = v731 - 2; | |
5774 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5775 v380 = 4 * v2; | |
5776 else | |
5777 v380 = 3 * v2; | |
5778 amount = v380; | |
5779 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5780 break; | |
5781 v381 = 0; | |
5782 HIDWORD(v733) = amount; | |
5783 v730 = 0; | |
5784 v382 = 1; | |
5785 do | |
5786 { | |
5787 v383 = pPlayers[v382]; | |
5788 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5789 v682[v381++] = v382; | |
5790 ++v382; | |
5791 } | |
5792 while ( v382 <= 4 ); | |
5793 v384 = 0; | |
5794 v730 = v381; | |
5795 if ( v381 > 0 ) | |
5796 { | |
5797 do | |
5798 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5799 while ( v384 < v381 ); | |
5800 } | |
5801 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5802 HIDWORD(v733) = 0; | |
5803 if ( v381 > 0 ) | |
5804 { | |
5805 do | |
5806 { | |
5807 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5808 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5809 v726->sHealth = v732; | |
5810 //v386 = v726->GetMaxHealth(); | |
5811 if ( v726->sHealth > v726->GetMaxHealth()) | |
5812 v726->sHealth = v726->GetMaxHealth(); | |
5813 if ( v726->sHealth > 0 ) | |
5814 { | |
5815 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5816 } | |
5817 v388 = HIDWORD(v733); | |
5818 | |
924 | 5819 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
890 | 5820 HIDWORD(v733) = v388 + 1; |
5821 } | |
5822 while ( v388 + 1 < v730 ); | |
5823 } | |
5824 LODWORD(v727) = 1; | |
5825 break; | |
5826 } | |
5827 case SPELL_SPIRIT_RESSURECTION: | |
5828 { | |
5829 v392 = v731 - 1; | |
5830 if ( !v392 ) | |
5831 { | |
5832 v395 = 180 * v2; | |
924 | 5833 amount = v395; |
5834 goto LABEL_751; | |
890 | 5835 } |
5836 v393 = v392 - 1; | |
5837 if ( !v393 ) | |
5838 { | |
5839 v395 = 10800 * v2; | |
924 | 5840 amount = v395; |
5841 goto LABEL_751; | |
890 | 5842 } |
5843 v394 = v393 - 1; | |
5844 if ( !v394 ) | |
5845 { | |
5846 v395 = 259200 * v2; | |
5847 amount = v395; | |
5848 goto LABEL_751; | |
5849 } | |
5850 if ( v394 == 1 ) | |
5851 amount = 0; | |
5852 LABEL_751: | |
5853 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5854 break; | |
924 | 5855 v396 = pCastSpell->uPlayerID_2; |
890 | 5856 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5857 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5858 { | |
5859 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5860 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5861 if ( v731 == 4 ) | |
5862 { | |
924 | 5863 v397 = pCastSpell->uPlayerID_2; |
890 | 5864 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5865 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
924 | 5866 v398 = pCastSpell->uPlayerID_2; |
890 | 5867 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5868 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
924 | 5869 v399 = pCastSpell->uPlayerID_2; |
890 | 5870 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5871 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5872 } | |
889 | 5873 else |
890 | 5874 { |
5875 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5876 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
890 | 5877 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5878 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
890 | 5879 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5880 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
890 | 5881 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5882 } | |
924 | 5883 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5884 | |
5885 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
5886 | |
5887 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 5888 } |
5889 LODWORD(v727) = 1; | |
5890 break; | |
5891 } | |
5892 case SPELL_MIND_CURE_PARALYSIS: | |
5893 { | |
5894 v405 = v731 - 2; | |
5895 if ( !v405 ) | |
5896 goto LABEL_766; | |
5897 v406 = v405 - 1; | |
5898 if ( v406 ) | |
5899 { | |
5900 if ( v406 == 1 ) | |
5901 { | |
5902 amount = 0; | |
5903 goto LABEL_768; | |
5904 } | |
5905 LABEL_766: | |
5906 v407 = 3600 * v2; | |
5907 } | |
5908 else | |
5909 { | |
5910 v407 = 86400 * v2; | |
5911 } | |
5912 amount = v407; | |
5913 LABEL_768: | |
5914 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5915 break; | |
5916 | |
924 | 5917 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5918 v323 = pCastSpell->uPlayerID_2; | |
890 | 5919 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5920 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5921 { | |
5922 LODWORD(v727) = 1; | |
5923 break; | |
5924 } | |
5925 if ( v731 == 4 ) | |
5926 { | |
5927 *(int *)v324 = 0; | |
5928 *((int *)v324 + 1) = 0; | |
889 | 5929 LODWORD(v727) = 1; |
890 | 5930 break; |
5931 } | |
5932 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5933 v656 = 12; | |
924 | 5934 v325 = &pParty->pPlayers[v323]; |
5935 goto LABEL_641; | |
890 | 5936 |
5937 } | |
5938 case SPELL_MIND_REMOVE_FEAR: | |
5939 { | |
5940 v411 = v731 - 2; | |
5941 if ( v411 ) | |
5942 { | |
5943 v412 = v411 - 1; | |
5944 if ( v412 ) | |
5945 { | |
5946 if ( v412 == 1 ) | |
5947 { | |
5948 amount = 0; | |
5949 goto LABEL_780; | |
5950 } | |
5951 v413 = 180 * v2; | |
889 | 5952 } |
5953 else | |
5954 { | |
890 | 5955 v413 = 86400 * v2; |
5956 } | |
5957 } | |
5958 else | |
5959 { | |
5960 v413 = 3600 * v2; | |
5961 } | |
5962 amount = v413; | |
5963 LABEL_780: | |
5964 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5965 break; | |
5966 | |
924 | 5967 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5968 v323 = pCastSpell->uPlayerID_2; | |
890 | 5969 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
5970 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
5971 { | |
5972 LODWORD(v727) = 1; | |
5973 break; | |
5974 } | |
5975 if ( v731 == 4 ) | |
5976 { | |
5977 *(int *)v324 = 0; | |
5978 *((int *)v324 + 1) = 0; | |
5979 LODWORD(v727) = 1; | |
5980 break; | |
5981 } | |
5982 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5983 v656 = 3; | |
924 | 5984 v325 = &pParty->pPlayers[v323]; |
5985 goto LABEL_641; | |
890 | 5986 } |
5987 case SPELL_MIND_TELEPATHY: | |
5988 { | |
5989 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5990 break; | |
5991 if (PID_TYPE(a2) != OBJECT_Actor) | |
5992 { | |
889 | 5993 LODWORD(v727) = 1; |
890 | 5994 break; |
5995 } | |
5996 v417 = (int)&pActors[PID_ID(a2)]; | |
5997 v730 = v417; | |
5998 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
5999 { | |
6000 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6001 v417 = v730; | |
6002 } | |
6003 v418 = *(int *)(v417 + 672); | |
6004 HIDWORD(v733) = 0; | |
6005 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6006 HIDWORD(v733) = *(int *)(v417 + 684); | |
6007 | |
6008 //ItemGen::ItemGen(&v683); | |
6009 v683.Reset(); | |
6010 | |
6011 v419 = *(short *)(v730 + 180); | |
6012 if (v419) | |
6013 { | |
6014 v683.uItemID = v419; | |
6015 goto LABEL_799; | |
6016 } | |
6017 v420 = 0; | |
6018 v421 = v730 + 564; | |
6019 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6020 { | |
6021 ++v420; | |
6022 v421 += 36; | |
6023 if ( v420 >= 4 ) | |
6024 goto LABEL_799; | |
6025 } | |
6026 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6027 v2 = v723; | |
6028 //v1 = 0; | |
6029 LABEL_799: | |
6030 if ( HIDWORD(v733) != 0 ) | |
6031 { | |
6032 v675 = (const char *)HIDWORD(v733); | |
6033 if (v683.uItemID) | |
6034 { | |
6035 v422 = v683.GetDisplayName(); | |
6036 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
924 | 6037 ShowStatusBarString(pTmpBuf2, 2u); |
6038 pSpellSprite.stru_24.Reset(); | |
6039 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6040 pSpellSprite.spell_level = v2; | |
6041 pSpellSprite.spell_skill = v731; | |
6042 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6043 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6044 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6045 v676 = *(short *)(v730 + 138); | |
6046 v665 = pSpellSprite.vPosition.y; | |
6047 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6048 v657 = pSpellSprite.vPosition.x; | |
6049 goto LABEL_1087; | |
890 | 6050 } |
6051 v664 = "%d gold"; | |
924 | 6052 sprintf(pTmpBuf2, v664, v675); |
6053 ShowStatusBarString(pTmpBuf2, 2u); | |
6054 pSpellSprite.stru_24.Reset(); | |
6055 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6056 pSpellSprite.spell_level = v2; | |
6057 pSpellSprite.spell_skill = v731; | |
6058 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6059 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6060 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6061 v676 = *(short *)(v730 + 138); | |
6062 v665 = pSpellSprite.vPosition.y; | |
6063 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6064 v657 = pSpellSprite.vPosition.x; | |
6065 goto LABEL_1087; | |
890 | 6066 } |
6067 if (v683.uItemID) | |
6068 { | |
6069 v675 = v683.GetDisplayName(); | |
6070 v664 = "(%s)"; | |
6071 sprintf(pTmpBuf2, v664, v675); | |
924 | 6072 ShowStatusBarString(pTmpBuf2, 2u); |
6073 pSpellSprite.stru_24.Reset(); | |
6074 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6075 pSpellSprite.spell_level = v2; | |
6076 pSpellSprite.spell_skill = v731; | |
6077 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6078 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6079 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6080 v676 = *(short *)(v730 + 138); | |
6081 v665 = pSpellSprite.vPosition.y; | |
6082 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6083 v657 = pSpellSprite.vPosition.x; | |
6084 goto LABEL_1087; | |
890 | 6085 } |
6086 strcpy(pTmpBuf2, "nothing"); | |
6087 ShowStatusBarString(pTmpBuf2, 2u); | |
924 | 6088 pSpellSprite.stru_24.Reset(); |
6089 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6090 pSpellSprite.spell_level = v2; | |
6091 pSpellSprite.spell_skill = v731; | |
6092 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6093 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6094 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
890 | 6095 v676 = *(short *)(v730 + 138); |
924 | 6096 v665 = pSpellSprite.vPosition.y; |
6097 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6098 v657 = pSpellSprite.vPosition.x; | |
890 | 6099 goto LABEL_1087; |
6100 } | |
6101 case SPELL_MIND_BERSERK: | |
6102 { | |
6103 v423 = v731 - 2; | |
6104 if ( !v423 ) | |
6105 goto LABEL_813; | |
6106 v424 = v423 - 1; | |
6107 if ( v424 ) | |
6108 { | |
6109 if ( v424 == 1 ) | |
6110 v425 = 3600 * v2; | |
6111 else | |
6112 LABEL_813: | |
6113 v425 = 300 * v2; | |
6114 } | |
6115 else | |
6116 { | |
6117 v425 = 600 * v2; | |
6118 } | |
6119 amount = v425; | |
6120 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6121 break; | |
6122 v426 = PID_ID(a2); | |
6123 if (PID_TYPE(a2) != OBJECT_Actor) | |
6124 { | |
6125 LODWORD(v727) = 1; | |
6126 break; | |
6127 } | |
6128 v730 = 836 * v426; | |
6129 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6130 { | |
6131 pActors[v426].pActorBuffs[1].Reset(); | |
6132 pActors[v426].pActorBuffs[12].Reset(); | |
6133 pActors[v426].pActorBuffs[9].Apply( | |
6134 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6135 v731, 0, 0, 0); | |
6136 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6137 } | |
924 | 6138 pSpellSprite.stru_24.Reset(); |
6139 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6140 pSpellSprite.spell_level = v2; | |
6141 pSpellSprite.spell_skill = v731; | |
6142 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6143 v61 = v426; |
6144 goto LABEL_1086; | |
6145 | |
6146 } | |
6147 case SPELL_MIND_ENSLAVE: | |
6148 { | |
6149 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6150 break; | |
6151 amount = 600 * v2; | |
6152 if (PID_TYPE(a2) != OBJECT_Actor) | |
6153 { | |
6154 LODWORD(v727) = 1; | |
6155 break; | |
6156 } | |
6157 v730 = 836 * PID_ID(a2); | |
6158 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6159 break; | |
6160 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6161 { | |
6162 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6163 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6164 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6165 v731, 0, 0, 0); | |
6166 } | |
924 | 6167 pSpellSprite.stru_24.Reset(); |
6168 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6169 pSpellSprite.spell_level = v2; | |
6170 pSpellSprite.spell_skill = v731; | |
6171 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6172 v61 = PID_ID(a2); |
6173 goto LABEL_1086; | |
6174 } | |
6175 case SPELL_MIND_MASS_FEAR: | |
6176 { | |
6177 v428 = v731 - 2; | |
6178 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6179 v430 = 300 * v2; | |
6180 else | |
6181 v430 = 180 * v2; | |
6182 amount = v430; | |
6183 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6184 break; | |
6185 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6186 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
924 | 6187 ++pSpellSprite.uType; |
6188 pSpellSprite.stru_24.Reset(); | |
6189 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6190 pSpellSprite.spell_level = v2; | |
6191 pSpellSprite.spell_skill = v731; | |
6192 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6193 pSpellSprite.uAttributes = 0; | |
6194 pSpellSprite.uSectorID = 0; | |
6195 pSpellSprite.uSpriteFrameID = 0; | |
6196 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6197 pSpellSprite.uFacing = 0; | |
6198 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6199 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6200 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6201 { | |
6202 v433 = &pActors[dword_50BF30[a2]]; | |
6203 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6204 break; | |
924 | 6205 pSpellSprite.vPosition.x = v433->vPosition.x; |
6206 pSpellSprite.vPosition.y = v433->vPosition.y; | |
6207 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6208 | |
6209 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6210 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6211 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6212 { | |
6213 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6214 v731, 0, 0, 0); | |
6215 } | |
6216 } | |
6217 LODWORD(v727) = 1; | |
6218 break; | |
6219 } | |
6220 | |
6221 case SPELL_MIND_CURE_INSANITY: | |
6222 { | |
6223 v435 = v731 - 2; | |
6224 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6225 amount = 0; | |
6226 else | |
6227 amount = 86400 * v2; | |
6228 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6229 break; | |
6230 | |
924 | 6231 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6232 v440 = pCastSpell->uPlayerID_2; | |
890 | 6233 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6234 { | |
6235 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6236 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6237 if ( v731 == 4 ) | |
6238 { | |
924 | 6239 v441 = pCastSpell->uPlayerID_2; |
890 | 6240 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6241 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
889 | 6242 } |
6243 else | |
6244 { | |
924 | 6245 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
890 | 6246 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6247 } | |
924 | 6248 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6249 LABEL_720: |
6250 v377->SetCondition(1, 0); | |
6251 } | |
6252 LODWORD(v727) = 1; | |
6253 break; | |
6254 } | |
6255 case SPELL_EARTH_TELEKINESIS: | |
6256 { | |
6257 v442 = v731 - 2; | |
6258 if ( !v442 ) | |
6259 goto LABEL_855; | |
6260 v443 = v442 - 1; | |
6261 if ( v443 ) | |
6262 { | |
6263 if ( v443 == 1 ) | |
6264 v444 = 4 * v2; | |
6265 else | |
6266 LABEL_855: | |
6267 v444 = 2 * v2; | |
6268 } | |
6269 else | |
6270 { | |
6271 v444 = 3 * v2; | |
6272 } | |
6273 amount = v444; | |
6274 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6275 break; | |
6276 v445 = PID_ID(a2); | |
6277 if (PID_TYPE(a2) == OBJECT_Item) | |
6278 { | |
6279 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6280 v450 = *(int *)v449; | |
6281 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6282 { | |
6283 party_finds_gold(*((int *)v449 + 3), 0); | |
6284 viewparams->bRedrawGameUI = 1; | |
889 | 6285 } |
6286 else | |
6287 { | |
890 | 6288 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
6289 ShowStatusBarString(pTmpBuf2, 2u); | |
6290 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6291 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6292 } | |
6293 SpriteObject::OnInteraction(v445); | |
6294 } | |
6295 else | |
6296 { | |
6297 if (PID_TYPE(a2) == OBJECT_Actor) | |
6298 { | |
6299 stru_50C198.LootActor(&pActors[v445]); | |
6300 } | |
6301 else | |
6302 { | |
6303 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6304 { | |
6305 if (PID_TYPE(a2) != OBJECT_BModel) | |
6306 { | |
6307 LODWORD(v727) = 1; | |
6308 break; | |
6309 } | |
6310 dword_507CD8 = 1; | |
6311 v677 = 1; | |
6312 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6313 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6314 else | |
6315 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6316 | |
6317 EventProcessor(v446, a2, v677); | |
6318 LODWORD(v727) = 1; | |
6319 break; | |
6320 } | |
6321 v447 = &pLevelDecorations[v445]; | |
6322 dword_507CD8 = 1; | |
6323 v448 = v447->field_16_event_id; | |
6324 if (v448) | |
6325 { | |
6326 v677 = 1; | |
6327 v446 = v448; | |
6328 EventProcessor(v446, a2, v677); | |
6329 LODWORD(v727) = 1; | |
6330 break; | |
6331 } | |
6332 if ( v447->IsInteractive() ) | |
6333 { | |
6334 activeLevelDecoration = v447; | |
6335 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6336 activeLevelDecoration = NULL; | |
6337 } | |
6338 } | |
6339 } | |
6340 LODWORD(v727) = 1; | |
6341 break; | |
6342 } | |
6343 case SPELL_BODY_CURE_WEAKNESS: | |
6344 { | |
6345 v451 = v731 - 2; | |
6346 if ( v451 ) | |
6347 { | |
6348 v452 = v451 - 1; | |
6349 if ( v452 ) | |
6350 { | |
6351 if ( v452 == 1 ) | |
6352 { | |
6353 amount = 0; | |
6354 goto LABEL_883; | |
6355 } | |
6356 v453 = 180 * v2; | |
889 | 6357 } |
6358 else | |
6359 { | |
890 | 6360 v453 = 86400 * v2; |
6361 } | |
6362 } | |
6363 else | |
6364 { | |
6365 v453 = 3600 * v2; | |
6366 } | |
6367 amount = v453; | |
6368 LABEL_883: | |
6369 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6370 break; | |
6371 | |
924 | 6372 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6373 v323 = pCastSpell->uPlayerID_2; | |
890 | 6374 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6375 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6376 { | |
889 | 6377 LODWORD(v727) = 1; |
890 | 6378 break; |
6379 } | |
6380 if ( v731 == 4 ) | |
6381 { | |
6382 *(int *)v324 = 0; | |
6383 *((int *)v324 + 1) = 0; | |
6384 LODWORD(v727) = 1; | |
6385 break; | |
6386 } | |
6387 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6388 v656 = 1; | |
6389 v325 = &pParty->pPlayers[v323]; | |
6390 goto LABEL_641; | |
6391 } | |
6392 case SPELL_BODY_FIRST_AID: | |
6393 { | |
6394 v457 = v731 - 2; | |
6395 if ( v457 ) | |
6396 { | |
6397 v458 = v457 - 1; | |
6398 if ( v458 ) | |
6399 { | |
6400 if ( v458 == 1 ) | |
6401 v459 = 5 * v2 + 5; | |
6402 else | |
6403 v459 = 2 * v2 + 5; | |
889 | 6404 } |
6405 else | |
6406 { | |
890 | 6407 v459 = 4 * v2 + 5; |
6408 } | |
6409 } | |
6410 else | |
6411 { | |
6412 v459 = 3 * v2 + 5; | |
6413 } | |
6414 amount = v459; | |
6415 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6416 break; | |
924 | 6417 v460 = pCastSpell->spell_target_pid; |
890 | 6418 if (!v460) |
6419 { | |
924 | 6420 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6421 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 6422 } |
6423 else | |
6424 { | |
6425 if (PID_TYPE(v460) == OBJECT_Actor) | |
6426 { | |
6427 v461 = &pActors[PID_ID(v460)]; | |
6428 v462 = v461->uAIState; | |
6429 v463 = v461->pMonsterInfo.uHP; | |
6430 if ( v462 != 5 ) | |
6431 { | |
6432 if ( v462 != 4 ) | |
6433 { | |
6434 if ( v462 != 19 ) | |
6435 { | |
6436 if ( v462 != 11 ) | |
6437 { | |
6438 v461->sCurrentHP += amount; | |
6439 if ( v461->sCurrentHP > v463 ) | |
6440 v461->sCurrentHP = v463; | |
6441 } | |
6442 } | |
6443 } | |
6444 } | |
6445 } | |
6446 } | |
6447 LODWORD(v727) = 1; | |
6448 break; | |
6449 } | |
6450 case SPELL_BODY_CURE_POISON: | |
6451 { | |
6452 v464 = v731 - 2; | |
6453 if ( !v464 ) | |
6454 goto LABEL_910; | |
6455 v465 = v464 - 1; | |
6456 if ( v465 ) | |
6457 { | |
6458 if ( v465 == 1 ) | |
6459 { | |
6460 amount = 0; | |
6461 goto LABEL_912; | |
6462 } | |
6463 LABEL_910: | |
6464 v466 = 3600 * v2; | |
6465 } | |
6466 else | |
6467 { | |
6468 v466 = 86400 * v2; | |
6469 } | |
6470 amount = v466; | |
6471 LABEL_912: | |
6472 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6473 break; | |
6474 | |
924 | 6475 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6476 v470 = pCastSpell->uPlayerID_2; | |
890 | 6477 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6478 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6479 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6480 { | |
6481 LODWORD(v727) = 1; | |
6482 break; | |
6483 } | |
6484 if ( v731 == 4 ) | |
6485 { | |
6486 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6487 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
924 | 6488 v471 = pCastSpell->uPlayerID_2; |
890 | 6489 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6490 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
924 | 6491 v472 = pCastSpell->uPlayerID_2; |
890 | 6492 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6493 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6494 LODWORD(v727) = 1; | |
6495 break; | |
6496 } | |
6497 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6498 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6499 6u, | |
6500 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6501 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6502 8u, |
6503 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6504 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6505 v656 = 10; | |
6506 goto LABEL_937; | |
6507 | |
6508 } | |
6509 case SPELL_BODY_PROTECTION_FROM_MAGIC: | |
6510 { | |
6511 amount = v2; | |
6512 LODWORD(v733) = 3600 * v2; | |
6513 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6514 break; | |
6515 | |
924 | 6516 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6517 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6518 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6519 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6520 |
6521 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6522 LODWORD(v727) = 1; | |
6523 break; | |
6524 } | |
6525 case SPELL_BODY_HAMMERHANDS: | |
6526 { | |
6527 LODWORD(v733) = 3600 * v2; | |
6528 amount = v2; | |
6529 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6530 break; | |
6531 if ( v731 == 4 ) | |
6532 { | |
924 | 6533 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6534 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6535 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6536 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6537 v732 = (int)v733 << 7; |
6538 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6539 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6540 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6541 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6542 | |
6543 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6544 LODWORD(v727) = 1; | |
6545 break; | |
6546 } | |
924 | 6547 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6548 | |
6549 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 | 6550 LODWORD(v727) = 1; |
6551 break; | |
6552 } | |
6553 case SPELL_BODY_CURE_DISEASE: | |
6554 { | |
6555 v493 = v731 - 2; | |
6556 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6557 amount = 0; | |
6558 else | |
6559 amount = 86400 * v2; | |
6560 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6561 break; | |
6562 | |
924 | 6563 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6564 v498 = pCastSpell->uPlayerID_2; | |
890 | 6565 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6566 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6567 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6568 { | |
6569 LODWORD(v727) = 1; | |
6570 break; | |
6571 } | |
6572 if ( v731 == 4 ) | |
6573 { | |
6574 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6575 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
924 | 6576 v499 = pCastSpell->uPlayerID_2; |
890 | 6577 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6578 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
924 | 6579 v500 = pCastSpell->uPlayerID_2; |
890 | 6580 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6581 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6582 } | |
6583 else | |
6584 { | |
6585 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6586 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6587 7u, | |
6588 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6589 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6590 9u, |
6591 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6592 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6593 v656 = 11; | |
6594 LABEL_937: | |
924 | 6595 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6596 LABEL_641: |
6597 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6598 } | |
6599 LODWORD(v727) = 1; | |
6600 break; | |
6601 } | |
6602 case SPELL_BODY_POWER_CURE: | |
6603 { | |
6604 amount = 5 * v2 + 10; | |
6605 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6606 break; | |
6607 v501 = pParty->pPlayers; | |
6608 int v1 = 0; | |
6609 do | |
6610 { | |
924 | 6611 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
890 | 6612 v501->Heal(amount); |
6613 ++v501; | |
6614 ++v1; | |
6615 } | |
6616 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6617 LODWORD(v727) = 1; | |
6618 break; | |
6619 } | |
6620 case SPELL_LIGHT_DISPEL_MAGIC: | |
6621 { | |
6622 sRecoveryTime -= v2; | |
6623 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6624 break; | |
6625 | |
6626 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6627 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6628 ++pSpellSprite.uType; |
890 | 6629 HIDWORD(v733) = v505; |
6630 v688.x = 0; | |
6631 v688.y = 0; | |
6632 v688.z = 0; | |
924 | 6633 pSpellSprite.stru_24.Reset(); |
6634 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6635 pSpellSprite.spell_level = v2; | |
6636 pSpellSprite.spell_skill = v731; | |
6637 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6638 pSpellSprite.uAttributes = 0; | |
6639 pSpellSprite.uSectorID = 0; | |
6640 pSpellSprite.uSpriteFrameID = 0; | |
6641 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6642 pSpellSprite.uFacing = 0; | |
6643 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6644 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6645 a2 = 0; |
6646 if ( SHIDWORD(v733) > 0 ) | |
6647 { | |
6648 do | |
6649 { | |
6650 v507 = dword_50BF30[a2]; | |
924 | 6651 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6652 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
6653 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6654 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6655 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6656 v510 = a2; |
6657 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6658 a2 = v510 + 1; | |
6659 } | |
6660 while ( v510 + 1 < SHIDWORD(v733) ); | |
6661 } | |
6662 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6663 { | |
6664 v511 = &pActors[dword_50BF30[a2]]; | |
924 | 6665 pSpellSprite.vPosition.x = v511->vPosition.x; |
6666 pSpellSprite.vPosition.y = v511->vPosition.y; | |
6667 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6668 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6669 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6670 v513 = v511->pActorBuffs; |
6671 for (int _v726 = 22; _v726 != 0; --_v726) | |
6672 { | |
6673 v513->Reset(); | |
6674 ++v513; | |
6675 } | |
6676 } | |
6677 LODWORD(v727) = 1; | |
6678 break; | |
6679 } | |
6680 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
6681 { | |
6682 v514 = v731 - 2; | |
6683 if ( !v514 ) | |
6684 goto LABEL_955; | |
6685 v515 = v514 - 1; | |
6686 if ( v515 ) | |
6687 { | |
6688 if ( v515 == 1 ) | |
6689 { | |
6690 v516 = 900 * v2; | |
6691 amount = 5; | |
889 | 6692 } |
6693 else | |
6694 { | |
890 | 6695 LABEL_955: |
6696 v516 = 300 * v2; | |
6697 amount = 1; | |
6698 } | |
6699 } | |
6700 else | |
6701 { | |
6702 v516 = 900 * v2; | |
6703 amount = 3; | |
6704 } | |
6705 v733 = __PAIR__(0, v516); | |
6706 | |
6707 if ( (signed int)uNumActors > 0 ) | |
6708 { | |
6709 v518 = pActors;//[0].uAIState; | |
6710 auto _v726 = uNumActors; | |
889 | 6711 do |
6712 { | |
890 | 6713 v519 = v518->uAIState; |
924 | 6714 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
890 | 6715 ++HIDWORD(v733); |
6716 ++v518; | |
6717 --_v726; | |
6718 } | |
6719 while ( _v726 != 0 ); | |
6720 } | |
6721 if ( SHIDWORD(v733) >= amount ) | |
6722 { | |
6723 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6724 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6725 pCastSpell->spellnum = 0; |
890 | 6726 continue; |
6727 } | |
6728 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6729 break; | |
924 | 6730 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
890 | 6731 LODWORD(v727) = 1; |
6732 break; | |
6733 } | |
6734 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
6735 { | |
6736 v520 = v731 - 2; | |
6737 if ( !v520 ) | |
6738 goto LABEL_973; | |
6739 v521 = v520 - 1; | |
6740 if ( v521 ) | |
6741 { | |
6742 if ( v521 == 1 ) | |
6743 { | |
6744 LODWORD(v733) = 18000 * v2; | |
6745 v522 = 5 * v2 + 10; | |
889 | 6746 } |
6747 else | |
6748 { | |
890 | 6749 LABEL_973: |
6750 LODWORD(v733) = 10800 * v2; | |
6751 v522 = 3 * v2 + 10; | |
6752 } | |
6753 } | |
6754 else | |
6755 { | |
6756 LODWORD(v733) = 14400 * v2; | |
6757 v522 = 4 * v2 + 10; | |
6758 } | |
6759 amount = v522; | |
6760 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6761 break; | |
6762 | |
924 | 6763 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6764 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6765 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6766 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6767 |
6768 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6769 LODWORD(v727) = 1; | |
6770 break; | |
6771 } | |
6772 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
6773 { | |
6774 //v67 = 2; | |
6775 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6776 { | |
6777 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6778 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6779 pCastSpell->spellnum = 0; |
890 | 6780 continue; |
6781 } | |
6782 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6783 break; | |
6784 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6785 ++pSpellSprite.uType; |
890 | 6786 v694.x = 0; |
6787 v694.y = 0; | |
6788 v694.z = 0; | |
924 | 6789 pSpellSprite.stru_24.Reset(); |
6790 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6791 pSpellSprite.spell_level = v2; | |
6792 pSpellSprite.spell_skill = v731; | |
6793 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6794 pSpellSprite.uAttributes = 0; | |
6795 pSpellSprite.uSectorID = 0; | |
6796 pSpellSprite.uSpriteFrameID = 0; | |
6797 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6798 pSpellSprite.uFacing = 0; | |
6799 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6800 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6801 a2 = 0; |
6802 if ( (signed int)v531 > 0 ) | |
6803 { | |
6804 do | |
6805 { | |
6806 v533 = dword_50BF30[a2]; | |
924 | 6807 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6808 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
6809 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6810 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6811 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6812 v536 = a2; |
6813 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6814 a2 = v536 + 1; | |
6815 } | |
6816 while ( v536 + 1 < (signed int)v531 ); | |
6817 } | |
6818 v537 = pGame->GetStru6(); | |
6819 pGame->GetStru6()->_4A8BFC(); | |
889 | 6820 LODWORD(v727) = 1; |
890 | 6821 break; |
6822 } | |
6823 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6824 { | |
6825 v538 = v731 - 2; | |
6826 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6827 { | |
6828 amount = 5 * v2; | |
6829 v540 = 18000 * v2; | |
6830 } | |
6831 else | |
6832 { | |
6833 amount = 4 * v2; | |
6834 v540 = 14400 * v2; | |
6835 } | |
6836 v730 = v540; | |
6837 LODWORD(v733) = v540; | |
6838 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6839 break; | |
6840 | |
924 | 6841 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6842 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6843 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6844 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6845 |
6846 v732 = v730 << 7; | |
6847 v549 = (double)(v730 << 7) * 0.033333335; | |
6848 *((float *)&v733 + 1) = v549; | |
6849 v712 = (signed __int64)v549; | |
6850 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6851 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6852 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6853 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6854 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6855 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6856 v550 = v2 + 5; | |
6857 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6858 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6859 v731, | |
6860 v550, 0, 0); | |
6861 | |
6862 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6863 LODWORD(v727) = 1; | |
6864 break; | |
6865 } | |
6866 | |
6867 case SPELL_LIGHT_HOUR_OF_POWER: | |
6868 { | |
6869 v551 = v731 - 2; | |
6870 if ( !v551 ) | |
6871 goto LABEL_998; | |
6872 v552 = v551 - 1; | |
6873 if ( v552 ) | |
6874 { | |
6875 if ( v552 == 1 ) | |
6876 { | |
6877 amount = 15; | |
6878 HIDWORD(v733) = 20; | |
6879 goto LABEL_1000; | |
6880 } | |
6881 LABEL_998: | |
6882 v678 = 4; | |
6883 } | |
6884 else | |
6885 { | |
6886 v678 = 12; | |
6887 } | |
6888 amount = v678; | |
6889 HIDWORD(v733) = v678; | |
6890 LABEL_1000: | |
6891 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6892 break; | |
6893 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6894 v732 = (300 * amount * v2 + 60) << 7; | |
6895 v730 = v2 + 5; | |
6896 int _v726 = 0; | |
6897 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6898 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6899 do | |
6900 { | |
924 | 6901 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6902 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6903 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6904 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 6905 |
890 | 6906 //((SpellBuff *)(v553 + 6056))->Apply( |
6907 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6908 if ( *(_QWORD *)v553 ) | |
6909 _v726 = 1; | |
6910 ++v553; | |
6911 } | |
6912 while ( v553 <= &pParty->pPlayers[3] ); | |
6913 v562 = v731; | |
6914 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6915 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6916 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6917 if (!_v726) | |
6918 { | |
6919 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); | |
6920 } | |
6921 LODWORD(v727) = 1; | |
6922 break; | |
6923 } | |
6924 | |
6925 | |
6926 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
6927 { | |
6928 amount = 3; | |
6929 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6930 { | |
6931 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6932 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6933 pCastSpell->spellnum = 0; |
890 | 6934 continue; |
6935 } | |
6936 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6937 break; | |
6938 a2 = 0; | |
6939 _this = (ItemGen *)&pPlayers[1]; | |
6940 do | |
6941 { | |
6942 v563 = 0; | |
889 | 6943 do |
6944 { | |
890 | 6945 v564 = _this->uItemID; |
6946 *(int *)(v563 + _this->uItemID) = 0; | |
6947 v563 += 8; | |
6948 *(int *)(v563 + v564 - 4) = 0; | |
6949 } | |
6950 while ( v563 <= 128 ); | |
6951 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6952 v566 = (Player **)_this; | |
6953 *(int *)(_this->uItemID + 6460) = v565; | |
6954 v567 = (*v566)->GetMaxMana(); | |
6955 *(int *)(_this->uItemID + 6464) = v567; | |
924 | 6956 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 6957 ++a2; |
6958 _this = (ItemGen *)((char *)_this + 4); | |
6959 } | |
6960 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6961 v571 = pPlayer; | |
6962 v572 = (char *)&pPlayer->sAgeModifier; | |
6963 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
6964 *(short *)v572 = 120; | |
6965 else | |
6966 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
6967 sRecoveryTime += -5 * v2; | |
6968 ++v571->uNumDivineInterventionCastsThisDay; | |
6969 LODWORD(v727) = 1; | |
6970 break; | |
6971 } | |
6972 case SPELL_DARK_REANIMATE: | |
6973 { | |
6974 v573 = v731 - 2; | |
6975 if ( v573 ) | |
6976 { | |
6977 v574 = v573 - 1; | |
6978 if ( v574 ) | |
6979 { | |
6980 if ( v574 == 1 ) | |
6981 v575 = 5 * v2; | |
889 | 6982 else |
890 | 6983 v575 = 2 * v2; |
889 | 6984 } |
6985 else | |
6986 { | |
890 | 6987 v575 = 4 * v2; |
6988 } | |
6989 } | |
6990 else | |
6991 { | |
6992 v575 = 3 * v2; | |
6993 } | |
6994 amount = v575; | |
6995 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6996 break; | |
924 | 6997 v576 = pCastSpell->spell_target_pid; |
890 | 6998 if (!v576) |
6999 { | |
924 | 7000 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7001 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 7002 if ( *((_QWORD *)v585 + 14) ) |
7003 { | |
7004 ((Player *)v585)->SetCondition(0x11u, 1); | |
7005 v587 = ((Player *)v585)->GetSexByVoice(); | |
924 | 7006 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
890 | 7007 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7008 } | |
7009 break; | |
7010 } | |
7011 v577 = (Player *)(PID_ID(v576)); | |
7012 //v726 = v577; | |
7013 if ( v577 == (Player *)-1 ) | |
7014 { | |
7015 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7016 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7017 pCastSpell->spellnum = 0; |
890 | 7018 continue; |
7019 } | |
7020 v578 = (int)&pActors[(int)v577]; | |
7021 v721 = v578; | |
7022 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7023 { | |
7024 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7025 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7026 pCastSpell->spellnum = 0; |
890 | 7027 continue; |
7028 } | |
924 | 7029 ++pSpellSprite.uType; |
7030 pSpellSprite.stru_24.Reset(); | |
7031 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7032 pSpellSprite.spell_level = v2; | |
7033 pSpellSprite.spell_skill = v731; | |
7034 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7035 pSpellSprite.uAttributes = 0; | |
7036 pSpellSprite.uSectorID = 0; | |
7037 pSpellSprite.uSpriteFrameID = 0; | |
7038 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
890 | 7039 v581 = v721; |
924 | 7040 pSpellSprite.uFacing = 0; |
7041 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7042 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7043 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
7044 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
890 | 7045 v732 = *(short *)(v721 + 138); |
924 | 7046 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7047 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7048 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7049 if ( *(char *)(v581 + 52) > amount ) |
7050 break; | |
7051 Actor::Resurrect((unsigned int)v577); | |
7052 *(char *)(v581 + 61) = 0; | |
7053 *(char *)(v581 + 53) = 0; | |
7054 *(char *)(v581 + 54) = 0; | |
7055 *(char *)(v581 + 55) = 0; | |
7056 *(char *)(v581 + 56) = 0; | |
7057 *(char *)(v581 + 57) = 0; | |
7058 *(int *)(v581 + 712) = 9999; | |
7059 *(char *)(v581 + 38) &= 0xF7u; | |
7060 *(int *)(v581 + 708) = 0; | |
7061 ((SpellBuff *)(v581 + 356))->Reset(); | |
7062 ((SpellBuff *)(v581 + 228))->Reset(); | |
7063 ((SpellBuff *)(v581 + 404))->Reset(); | |
7064 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7065 *(short *)(v581 + 40) = 10 * amount; | |
889 | 7066 LODWORD(v727) = 1; |
890 | 7067 break; |
7068 } | |
7069 case SPELL_DARK_VAMPIRIC_WEAPON: | |
7070 { | |
7071 v588 = v731 - 1; | |
7072 amount = 16; | |
7073 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7074 { | |
7075 if ( v590 == 1 ) | |
7076 LODWORD(v733) = 0; | |
7077 } | |
7078 else | |
7079 { | |
7080 LODWORD(v733) = 3600 * v2; | |
7081 } | |
7082 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7083 break; | |
7084 __debugbreak(); | |
924 | 7085 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
890 | 7086 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7087 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7088 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7089 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7090 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7091 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7092 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7093 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7094 { | |
7095 dword_50C9D0 = 113; | |
7096 dword_50C9D4 = 0; | |
7097 dword_50C9D8 = 1; | |
7098 | |
7099 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7100 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7101 pCastSpell->spellnum = 0; |
890 | 7102 continue; |
7103 } | |
7104 v592 = HIDWORD(v733); | |
7105 v14 = v731 == 4; | |
7106 *(int *)(HIDWORD(v733) + 12) = 16; | |
7107 if ( !v14 ) | |
7108 { | |
7109 v732 = (int)v733 << 7; | |
7110 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7111 *(int *)(v592 + 20) |= 8u; | |
7112 } | |
7113 *(char *)(v592 + 20) |= 0x80u; | |
7114 dword_50C9A8 = 256; | |
7115 LODWORD(v727) = 1; | |
7116 break; | |
7117 } | |
7118 case SPELL_DARK_SHARPMETAL: | |
7119 { | |
7120 v593 = v731 - 2; | |
7121 if ( !v593 ) | |
7122 goto LABEL_1062; | |
7123 v594 = v593 - 1; | |
7124 if ( v594 ) | |
7125 { | |
7126 if ( v594 == 1 ) | |
7127 amount = 9; | |
889 | 7128 else |
890 | 7129 LABEL_1062: |
7130 amount = 5; | |
7131 } | |
7132 else | |
7133 { | |
7134 amount = 7; | |
7135 } | |
7136 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7137 break; | |
7138 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
924 | 7139 pSpellSprite.stru_24.Reset(); |
7140 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7141 pSpellSprite.spell_level = v2; | |
7142 pSpellSprite.spell_skill = v731; | |
7143 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7144 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
7145 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
7146 pSpellSprite.uAttributes = 0; | |
7147 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7148 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 7149 pParty->vPosition.x, |
7150 pParty->vPosition.y, | |
7151 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
924 | 7152 pSpellSprite.uSpriteFrameID = 0; |
7153 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7154 pSpellSprite.spell_target_pid = a2; | |
7155 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7156 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7157 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 7158 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 7159 v596 = (signed int)_v726 / -2; |
7160 y = (char *)((signed int)_v726 / 2); | |
7161 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7162 { | |
7163 v597 = v715.uYawAngle; | |
889 | 7164 do |
7165 { | |
924 | 7166 pSpellSprite.uFacing = v596 + v597; |
7167 if ( pSpellSprite.Create( | |
890 | 7168 v596 + v597, |
7169 v715.uPitchAngle, | |
924 | 7170 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7171 pCastSpell->uPlayerID + 1) != -1 | |
890 | 7172 && pParty->bTurnBasedModeOn == 1 ) |
7173 ++pTurnEngine->field_1C; | |
7174 v596 += _v726 / (amount - 1); | |
7175 } | |
7176 while ( v596 <= (signed int)y ); | |
7177 } | |
7178 LODWORD(v727) = 1; | |
7179 break; | |
7180 } | |
7181 | |
7182 case SPELL_DARK_CONTROL_UNDEAD: | |
7183 { | |
7184 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7185 break; | |
7186 if ( v731 == 1 || v731 == 2 ) | |
7187 { | |
7188 v598 = 180 * v2; | |
924 | 7189 LODWORD(v733) = v598; |
7190 goto LABEL_1082; | |
890 | 7191 } |
7192 if ( v731 == 3 ) | |
7193 { | |
7194 v598 = 300 * v2; | |
7195 LODWORD(v733) = v598; | |
7196 goto LABEL_1082; | |
7197 } | |
7198 if ( v731 == 4 ) | |
7199 LODWORD(v733) = 29030400; | |
7200 LABEL_1082: | |
7201 if (PID_TYPE(a2) != OBJECT_Actor) | |
7202 { | |
7203 LODWORD(v727) = 1; | |
7204 break; | |
7205 } | |
7206 v730 = 836 * PID_ID(a2); | |
7207 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7208 break; | |
7209 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7210 { | |
7211 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7212 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7213 pCastSpell->spellnum = 0; |
890 | 7214 continue; |
7215 } | |
7216 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7217 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7218 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7219 v731, 0, 0, 0); | |
924 | 7220 pSpellSprite.stru_24.Reset(); |
7221 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7222 pSpellSprite.spell_level = v2; | |
7223 pSpellSprite.spell_skill = v731; | |
7224 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 7225 v61 = PID_ID(a2); |
7226 LABEL_1086: | |
7227 v600 = pActors[v61].vPosition.y; | |
7228 v601 = pActors[v61].vPosition.x; | |
924 | 7229 pSpellSprite.uObjectDescID = v60; |
7230 pSpellSprite.vPosition.x = v601; | |
890 | 7231 v602 = pActors[v61].uActorHeight; |
7232 v603 = pActors[v61].vPosition.z; | |
924 | 7233 pSpellSprite.vPosition.y = v600; |
890 | 7234 v676 = v603 + v602; |
7235 v665 = v600; | |
924 | 7236 pSpellSprite.vPosition.z = v603 + v602; |
890 | 7237 v657 = v601; |
7238 LABEL_1087: | |
924 | 7239 pSpellSprite.uAttributes = 0; |
7240 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7241 pSpellSprite.uSpriteFrameID = 0; | |
7242 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7243 pSpellSprite.spell_target_pid = a2; | |
7244 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7245 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
7246 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
7247 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7248 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
7249 LODWORD(v727) = 1; | |
7250 break; | |
7251 } | |
890 | 7252 case SPELL_DARK_SACRIFICE: |
7253 { | |
7254 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7255 break; | |
7256 HIDWORD(v733) = 0; | |
949 | 7257 memset(&achieved_awards, 0, 4000); |
890 | 7258 _this = 0; |
7259 v605 = (char *)pParty->pHirelings; | |
7260 do | |
7261 { | |
7262 if ( *(int *)v605) | |
7263 { | |
7264 v606 = HIDWORD(v733)++; | |
949 | 7265 achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); |
890 | 7266 } |
7267 _this = (ItemGen *)((char *)_this + 1); | |
7268 v605 += 76; | |
7269 } | |
7270 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7271 _this = 0; | |
7272 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7273 { | |
7274 v730 = (int)pNPCStats->pNewNPCData; | |
949 | 7275 __debugbreak(); // data offset |
890 | 7276 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; |
889 | 7277 do |
7278 { | |
890 | 7279 if ( *(char *)(v730 + 8) & 0x80 |
7280 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7281 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7282 { | |
7283 v607 = HIDWORD(v733); | |
7284 HIDWORD(v733) += 4; | |
7285 *(int *)v607 = (int)_this + 3; | |
7286 } | |
7287 _this = (ItemGen *)((char *)_this + 1); | |
7288 v730 += 76; | |
7289 } | |
7290 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7291 } | |
924 | 7292 v608 = pCastSpell->uPlayerID_2; |
890 | 7293 if ( v608 != 4 && v608 != 5 |
7294 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7295 || v609 >= 3 ) | |
7296 { | |
7297 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7298 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7299 pCastSpell->spellnum = 0; |
890 | 7300 continue; |
7301 } | |
7302 v610 = 76 * v609; | |
7303 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7304 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7305 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7306 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7307 v612 = pParty->pPlayers; | |
7308 do | |
7309 { | |
7310 v612->sHealth = v612->GetMaxHealth(); | |
7311 v612->sMana = v612->GetMaxMana(); | |
7312 ++v612; | |
7313 } | |
7314 while ( v612 <= &pParty->pPlayers[3] ); | |
7315 v613 = &pOutdoor->ddm; | |
7316 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7317 v613 = &pIndoor->dlv; | |
7318 v613->uReputation += 15; | |
7319 if ( v613->uReputation > 10000 ) | |
7320 v613->uReputation = 10000; | |
7321 LODWORD(v727) = 1; | |
7322 break; | |
7323 } | |
7324 case SPELL_DARK_PAIN_REFLECTION: | |
7325 { | |
7326 if ( v731 <= 0 ) | |
7327 goto LABEL_1119; | |
7328 if ( v731 <= 3 ) | |
7329 { | |
7330 v614 = 300 * (v2 + 12); | |
7331 } | |
7332 else | |
7333 { | |
7334 if ( v731 != 4 ) | |
7335 goto LABEL_1119; | |
7336 v614 = 900 * (v2 + 4); | |
7337 } | |
7338 LODWORD(v733) = v614; | |
7339 LABEL_1119: | |
7340 v615 = v2 + 5; | |
7341 amount = v615; | |
7342 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7343 break; | |
7344 if ( v731 != 3 && v731 != 4 ) | |
7345 { | |
924 | 7346 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
7347 | |
7348 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); | |
890 | 7349 LODWORD(v727) = 1; |
7350 break; | |
7351 } | |
7352 a2 = 0; | |
7353 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7354 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
7355 do | |
7356 { | |
924 | 7357 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 7358 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); |
7359 ++a2; | |
7360 ++v619; | |
7361 } | |
7362 while ( v619 <= &pParty->pPlayers[3] ); | |
7363 LODWORD(v727) = 1; | |
7364 break; | |
7365 } | |
7366 case SPELL_DARK_SOULDRINKER: | |
7367 { | |
7368 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7369 break; | |
7370 pGame->GetIndoorCamera(); | |
7371 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7372 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7373 v707.x = 0; | |
7374 v707.y = 0; | |
7375 v707.z = 0; | |
924 | 7376 pSpellSprite.stru_24.Reset(); |
7377 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7378 pSpellSprite.spell_level = v2; | |
7379 pSpellSprite.spell_skill = v731; | |
7380 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7381 pSpellSprite.uAttributes = 0; | |
7382 pSpellSprite.uSectorID = 0; | |
7383 pSpellSprite.uSpriteFrameID = 0; | |
7384 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
7385 pSpellSprite.uFacing = 0; | |
7386 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7387 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7388 a2 = 0; |
7389 int _v726 = 0; | |
7390 if ( SHIDWORD(v733) > 0 ) | |
7391 { | |
7392 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
889 | 7393 do |
7394 { | |
890 | 7395 v625 = dword_50BF30[a2]; |
924 | 7396 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; |
7397 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
890 | 7398 //v732 = pActors[v625].uActorHeight; |
924 | 7399 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); |
7400 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7401 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7402 v628 = a2; |
7403 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7404 a2 = v628 + 1; | |
7405 } | |
7406 while ( v628 + 1 < SHIDWORD(v733) ); | |
7407 } | |
7408 v730 = 0; | |
7409 v629 = 1; | |
7410 do | |
7411 { | |
7412 v630 = pPlayers[v629]; | |
7413 if ( !v630->pConditions[2] | |
7414 && !v630->pConditions[12] | |
7415 && !v630->pConditions[13] | |
7416 && !v630->pConditions[14] | |
7417 && !v630->pConditions[15] | |
7418 && !v630->pConditions[16] ) | |
7419 { | |
7420 v631 = v730++; | |
7421 v681[v631] = v629; | |
7422 } | |
7423 ++v629; | |
7424 } | |
7425 while ( v629 <= 4 ); | |
7426 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7427 HIDWORD(v733) = 0; | |
7428 if ( v730 > 0 ) | |
7429 { | |
7430 do | |
7431 { | |
7432 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7433 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7434 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7435 v726->sHealth += v732; | |
7436 //v726 = *(Player **)v632; | |
7437 //v634 = v726->GetMaxHealth(); | |
7438 if ( v726->sHealth > v726->GetMaxHealth()) | |
7439 v726->sHealth = v726->GetMaxHealth(); | |
7440 v635 = HIDWORD(v733); | |
7441 | |
924 | 7442 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); |
890 | 7443 HIDWORD(v733) = v635 + 1; |
7444 } | |
7445 while ( v635 + 1 < v730 ); | |
7446 } | |
7447 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
7448 LODWORD(v727) = 1; | |
7449 break; | |
7450 } | |
7451 | |
7452 case SPELL_DARK_ARMAGEDDON: | |
7453 { | |
7454 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7455 { | |
7456 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7457 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7458 pCastSpell->spellnum = 0; |
890 | 7459 continue; |
7460 } | |
7461 v640 = v731 - 2; | |
7462 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7463 amount = 3; | |
7464 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7465 { | |
7466 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7467 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7468 pCastSpell->spellnum = 0; |
890 | 7469 continue; |
7470 } | |
7471 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7472 break; | |
7473 pParty->armageddon_timer = 256; | |
7474 pParty->field_16140 = v2; | |
7475 ++pPlayer->uNumArmageddonCasts; | |
7476 if ( pParty->bTurnBasedModeOn == 1 ) | |
7477 ++pTurnEngine->field_1C; | |
7478 auto _v726 = 50; | |
7479 do | |
7480 { | |
7481 v642 = rand() % 4096 - 2048; | |
7482 v643 = rand(); | |
7483 v721 = v642 + pParty->vPosition.x; | |
7484 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7485 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7486 v644 = rand(); | |
7487 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7488 --_v726; | |
7489 } | |
7490 while ( _v726 != 0 ); | |
7491 LODWORD(v727) = 1; | |
7492 break; | |
7493 } | |
7494 | |
7495 default: | |
7496 break; | |
7497 } | |
924 | 7498 if ( pCastSpell->field_8 & 0x20 ) |
890 | 7499 { |
7500 if ( v727 != 0.0 ) | |
924 | 7501 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 7502 } |
7503 else | |
7504 { | |
7505 if ( sRecoveryTime < 0 ) | |
7506 sRecoveryTime = 0; | |
7507 if ( pParty->bTurnBasedModeOn ) | |
7508 { | |
7509 v645 = sRecoveryTime; | |
924 | 7510 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 7511 pPlayer->SetRecoveryTime(v645); |
7512 if ( !some_active_character ) | |
7513 pTurnEngine->_40471C(); | |
7514 } | |
7515 else | |
7516 { | |
7517 pPlayer->SetRecoveryTime( | |
7518 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
7519 } | |
7520 if ( v727 != 0.0 ) | |
7521 { | |
7522 pPlayer->PlaySound(SPEECH_49, 0); | |
7523 if ( v727 != 0.0 ) | |
924 | 7524 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
7525 pCastSpell->spellnum = 0; | |
890 | 7526 v2 = v723; |
7527 continue; | |
889 | 7528 } |
7529 } | |
924 | 7530 pCastSpell->spellnum = 0; |
890 | 7531 v2 = v723; |
7532 continue; | |
7533 | |
889 | 7534 //LABEL_1166: |
7535 // ++n; | |
7536 // if ( n >= 10 ) | |
7537 // return; | |
0 | 7538 } |
488 | 7539 |
889 | 7540 |
0 | 7541 } |
7542 //----- (0042EB42) -------------------------------------------------------- | |
7543 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7544 { | |
7545 unsigned int v2; // edx@1 | |
7546 signed int v3; // eax@1 | |
7547 char *v4; // ecx@2 | |
7548 | |
7549 v2 = this->uNumObjects; | |
7550 v3 = 0; | |
7551 if ( (signed int)this->uNumObjects <= 0 ) | |
7552 { | |
7553 LABEL_5: | |
7554 LOWORD(v3) = 0; | |
7555 } | |
7556 else | |
7557 { | |
7558 v4 = (char *)&this->pObjects->uObjectID; | |
7559 while ( uItemID != *(short *)v4 ) | |
7560 { | |
7561 ++v3; | |
7562 v4 += 56; | |
7563 if ( v3 >= (signed int)v2 ) | |
7564 goto LABEL_5; | |
7565 } | |
7566 } | |
7567 return v3; | |
7568 } | |
7569 | |
7570 //----- (0042EB78) -------------------------------------------------------- | |
7571 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7572 { | |
7573 return 8 * this->pIcons[uIconID].uAnimLength; | |
7574 } | |
7575 | |
437 | 7576 const wchar_t *UIMessage2String(UIMessageType msg) |
7577 { | |
7578 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7579 static wchar_t b[256]; // bad for threads | |
7580 switch (msg) | |
7581 { | |
7582 CASE(UIMSG_SelectSpell) | |
7583 CASE(UIMSG_ChangeGameState) | |
7584 CASE(UIMSG_Attack) | |
7585 CASE(UIMSG_PlayArcomage) | |
7586 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7587 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7588 CASE(UIMSG_ShowCredits) | |
7589 CASE(UIMSG_ExitToWindows) | |
7590 CASE(UIMSG_PlayerCreationChangeName) | |
7591 CASE(UIMSG_PlayerCreationClickPlus) | |
7592 CASE(UIMSG_PlayerCreationClickMinus) | |
7593 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7594 CASE(UIMSG_PlayerCreationSelectClass) | |
7595 CASE(UIMSG_PlayerCreationClickOK) | |
7596 CASE(UIMSG_PlayerCreationClickReset) | |
7597 CASE(UIMSG_AutonotesBook) | |
7598 CASE(UIMSG_PlayerCreationRemoveUpSkill) | |
7599 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7600 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7601 CASE(UIMSG_LoadGame) | |
7602 CASE(UIMSG_SaveGame) | |
7603 CASE(UIMSG_ShowStatus_DateTime) | |
7604 CASE(UIMSG_ShowStatus_ManaHP) | |
7605 CASE(UIMSG_ShowStatus_Player) | |
7606 CASE(UIMSG_Wait5Minutes) | |
7607 CASE(UIMSG_Wait1Hour) | |
7608 CASE(UIMSG_ShowStatus_Food) | |
7609 CASE(UIMSG_ShowStatus_Funds) | |
7610 CASE(UIMSG_QuickReference) | |
7611 CASE(UIMSG_GameMenuButton) | |
7612 CASE(UIMSG_AlreadyResting) | |
7613 CASE(UIMSG_SelectCharacter) | |
7614 CASE(UIMSG_ChangeSoundVolume) | |
7615 CASE(UIMSG_ChangeMusicVolume) | |
7616 CASE(UIMSG_Escape) | |
7617 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7618 CASE(UIMSG_InventoryLeftClick) | |
7619 CASE(UIMSG_SkillUp) | |
7620 CASE(UIMSG_GameMenu_ReturnToGame) | |
7621 CASE(UIMSG_StartNewGame) | |
7622 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7623 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7624 CASE(UIMSG_Game_OpenOptionsDialog) | |
7625 CASE(UIMSG_SetGraphicsMode) | |
7626 CASE(UIMSG_Quit) | |
7627 CASE(UIMSG_StartHireling1Dialogue) | |
7628 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7629 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7630 CASE(UIMSG_CastSpellFromBook) |
7631 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7632 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7633 CASE(UIMSG_StartNPCDialogue) | |
7634 CASE(UIMSG_ArrowUp) | |
7635 CASE(UIMSG_DownArrow) | |
7636 CASE(UIMSG_LoadSlot) | |
7637 CASE(UIMSG_SelectLoadSlot) | |
7638 CASE(UIMSG_Cancel) | |
7639 CASE(UIMSG_ExitRest) | |
7640 CASE(UIMSG_PlayerCreation_FacePrev) | |
7641 CASE(UIMSG_PlayerCreation_FaceNext) | |
7642 CASE(UIMSG_CycleCharacters) | |
7643 CASE(UIMSG_SetTurnSpeed) | |
7644 CASE(UIMSG_ToggleWalkSound) | |
7645 CASE(UIMSG_ChangeVoiceVolume) | |
7646 CASE(UIMSG_ToggleShowDamage) | |
7647 CASE(UIMSG_ScrollNPCPanel) | |
7648 CASE(UIMSG_ShowFinalWindow) | |
7649 CASE(UIMSG_OpenQuestBook) | |
7650 CASE(UIMSG_OpenAutonotes) | |
7651 CASE(UIMSG_OpenMapBook) | |
7652 CASE(UIMSG_OpenCalendar) | |
7653 CASE(UIMSG_OpenHistoryBook) | |
7654 CASE(UIMSG_ToggleAlwaysRun) | |
7655 CASE(UIMSG_ToggleFlipOnExit) | |
7656 CASE(UIMSG_Game_Action) | |
907 | 7657 CASE(UIMSG_RentRoom) |
437 | 7658 CASE(UIMSG_TransitionUI_Confirm) |
7659 CASE(UIMSG_OpenKeyMappingOptions) | |
7660 CASE(UIMSG_SelectKeyPage1) | |
7661 CASE(UIMSG_SelectKeyPage2) | |
7662 CASE(UIMSG_ResetKeyMapping) | |
7663 CASE(UIMSG_ChangeKeyButton) | |
7664 CASE(UIMSG_OpenVideoOptions) | |
7665 CASE(UIMSG_ToggleBloodsplats) | |
7666 CASE(UIMSG_ToggleColoredLights) | |
7667 CASE(UIMSG_ToggleTint) | |
7668 default: | |
7669 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7670 }; | |
7671 #undef CASE | |
7672 } | |
7673 | |
0 | 7674 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7675 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7676 { |
482 | 7677 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7678 if (uNumMessages < 40) |
7679 { | |
437 | 7680 files[uNumMessages] = file; |
7681 lines[uNumMessages] = line; | |
7682 | |
0 | 7683 pMessages[uNumMessages].eType = msg; |
7684 pMessages[uNumMessages].param = param; | |
7685 pMessages[uNumMessages++].field_8 = a4; | |
7686 } | |
7687 } | |
7688 | |
7689 //----- (0042EBBE) -------------------------------------------------------- | |
7690 int __fastcall sub_42EBBE(int a1, int a2) | |
7691 { | |
7692 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7693 } | |
7694 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7695 | |
7696 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7697 int stru193_math::Sin(int angle) |
0 | 7698 { |
323 | 7699 return Cos(angle - this->uIntegerHalfPi); |
0 | 7700 } |
7701 | |
7702 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7703 void _42ECB5_PlayerAttacksActor() |
0 | 7704 { |
271 | 7705 //unsigned int v0; // ebx@1 |
7706 //Player *v1; // esi@1 | |
7707 //bool result; // eax@1 | |
295 | 7708 //int v3; // edi@2 |
271 | 7709 //unsigned int v4; // eax@7 |
0 | 7710 char *v5; // eax@8 |
271 | 7711 //int v6; // ecx@9 |
7712 //signed int v7; // eax@16 | |
295 | 7713 //Actor *v8; // edi@20 |
0 | 7714 unsigned int v9; // ecx@21 |
295 | 7715 //char *v10; // eax@26 |
0 | 7716 char *v11; // eax@26 |
7717 unsigned int v12; // eax@47 | |
295 | 7718 //char *v13; // eax@47 |
7719 //char *v14; // eax@47 | |
7720 //unsigned int v15; // ebx@54 | |
7721 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7722 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7723 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7724 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7725 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7726 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7727 //int v22; // [sp-4h] [bp-40h]@24 | |
7728 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7729 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7730 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7731 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7732 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7733 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7734 //unsigned int *v28b; |
295 | 7735 //int v29; // [sp+24h] [bp-18h]@16 |
7736 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7737 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7738 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7739 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7740 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7741 |
271 | 7742 //v0 = uActiveCharacter; |
7743 //v27 = 6972 * uActiveCharacter; | |
7744 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7745 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7746 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7747 if (!player->CanAct()) | |
7748 return; | |
7749 | |
924 | 7750 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 7751 //v3 = 0; |
271 | 7752 if (pParty->Invisible()) |
7753 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7754 | |
7755 //v31 = player->pEquipment.uBow; | |
7756 int bow_idx = player->pEquipment.uBow; | |
7757 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7758 bow_idx = 0; | |
7759 | |
295 | 7760 //v32 = 0; |
7761 int wand_item_id = 0; | |
271 | 7762 //v33 = 0; |
7763 //v4 = v1->pEquipment.uMainHand; | |
7764 int laser_weapon_item_id = 0; | |
7765 | |
7766 int main_hand_idx = player->pEquipment.uMainHand; | |
7767 if (main_hand_idx) | |
0 | 7768 { |
271 | 7769 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7770 //v5 = (char *)v1 + 36 * v4; |
271 | 7771 if (!item->Broken()) |
7772 { | |
7773 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7774 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7775 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7776 { |
295 | 7777 if (item->uNumCharges <= 0) |
7778 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7779 else |
295 | 7780 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7781 } |
271 | 7782 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7783 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7784 } |
271 | 7785 } |
7786 | |
295 | 7787 //v30 = 0; |
7788 //v29 = 0; | |
7789 //v28 = 0; | |
271 | 7790 //v7 = pMouse->uPointingObjectID; |
7791 | |
7792 int target_pid = pMouse->uPointingObjectID; | |
848 | 7793 int target_type = PID_TYPE(target_pid), |
7794 target_id = PID_ID(target_pid); | |
271 | 7795 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7796 { | |
7797 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7798 target_type = PID_TYPE(target_pid); |
7799 target_id = PID_ID(target_pid); | |
271 | 7800 } |
295 | 7801 |
7802 auto actor = &pActors[target_id]; | |
7803 int actor_distance = 0; | |
271 | 7804 if (target_type == OBJECT_Actor) |
7805 { | |
295 | 7806 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7807 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7808 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7809 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7810 if (actor_distance < 0) | |
7811 actor_distance = 0; | |
7812 } | |
7813 | |
7814 bool shooting_bow = false, | |
7815 shotting_laser = false, | |
816 | 7816 shooting_wand = false, |
7817 melee_attack = false; | |
295 | 7818 if (laser_weapon_item_id) |
7819 { | |
7820 shotting_laser = true; | |
490 | 7821 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7822 } |
7823 else if (wand_item_id) | |
7824 { | |
7825 shooting_wand = true; | |
7826 | |
7827 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7828 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7829 |
7830 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7831 player->pEquipment.uMainHand = 0; | |
7832 } | |
303 | 7833 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7834 { |
816 | 7835 melee_attack = true; |
7836 | |
303 | 7837 Vec3_int_ a3; |
7838 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7839 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7840 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7841 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7842 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7843 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7844 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7845 _42FA66_do_explosive_impact( |
7846 actor->vPosition.x, | |
7847 actor->vPosition.y, | |
7848 actor->vPosition.z + actor->uActorHeight / 2, | |
7849 0, 512, uActiveCharacter); | |
303 | 7850 } |
7851 else if (bow_idx) | |
7852 { | |
7853 shooting_bow = true; | |
490 | 7854 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7855 } |
7856 else | |
7857 { | |
816 | 7858 melee_attack = true; |
303 | 7859 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7860 } | |
7861 | |
816 | 7862 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7863 { |
816 | 7864 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7865 if (recovery < 30 ) |
7866 recovery = 30; | |
816 | 7867 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7868 } |
7869 | |
7870 | |
7871 int v34 = 0; | |
7872 if (shooting_wand) | |
7873 return; | |
7874 else if (shooting_bow) | |
7875 { | |
7876 v34 = 5; | |
7877 player->PlaySound(SPEECH_50, 0); | |
7878 } | |
7879 if (shotting_laser) | |
7880 v34 = 7; | |
7881 else | |
7882 { | |
7883 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7884 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7885 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7886 pTurnEngine->_40471C(); | |
7887 } | |
7888 | |
7889 switch (v34) | |
7890 { | |
7891 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7892 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7893 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7894 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7895 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7896 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7897 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7898 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7899 } | |
0 | 7900 } |
7901 | |
7902 //----- (0042F184) -------------------------------------------------------- | |
295 | 7903 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7904 { |
7905 int v4; // edi@1 | |
7906 stru319 *v5; // esi@1 | |
7907 int v6; // eax@2 | |
7908 int v7; // eax@4 | |
7909 int result; // eax@5 | |
7910 int *v9; // edx@8 | |
7911 signed int v10; // ebx@10 | |
7912 int v11; // edi@11 | |
7913 Actor *v12; // esi@12 | |
7914 unsigned __int16 v13; // ax@12 | |
7915 int v14; // eax@22 | |
7916 char v15; // zf@30 | |
7917 int v16; // esi@32 | |
7918 int v17; // ecx@34 | |
7919 stru319 *v18; // eax@39 | |
7920 int v19; // edx@39 | |
7921 int v20; // ecx@41 | |
7922 unsigned __int16 v21; // ax@42 | |
7923 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7924 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7925 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7926 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7927 int *v26; // [sp+18h] [bp-14h]@8 | |
7928 int v27; // [sp+1Ch] [bp-10h]@10 | |
7929 int *v28; // [sp+20h] [bp-Ch]@10 | |
7930 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7931 int v30; // [sp+28h] [bp-4h]@6 | |
7932 int i; // [sp+38h] [bp+Ch]@33 | |
7933 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7934 | |
7935 v4 = 0; | |
7936 v5 = this; | |
7937 v24 = this; | |
7938 if ( pRenderer->pRenderD3D ) | |
7939 { | |
7940 v6 = a3 != 0; | |
7941 if ( a4 ) | |
7942 LOBYTE(v6) = v6 | 8; | |
295 | 7943 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7944 if ( v7 != -1 ) |
7945 return (unsigned __int16)v7; | |
295 | 7946 else return 0; |
0 | 7947 } |
7948 else | |
7949 { | |
7950 v30 = 0; | |
7951 if ( pRenderer->pActiveZBuffer ) | |
7952 { | |
692 | 7953 v29 = viewparams->uScreen_topL_X; |
7954 v23 = viewparams->uScreen_BttmR_X; | |
7955 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7956 { |
692 | 7957 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7958 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7959 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7960 do |
7961 { | |
7962 if ( (signed int)v29 < (signed int)v23 ) | |
7963 { | |
7964 v28 = v9; | |
7965 v10 = v4; | |
7966 v27 = v23 - v29; | |
7967 do | |
7968 { | |
7969 v22 = *v28; | |
7970 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7971 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 7972 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7973 v12 = &pActors[PID_ID(v11)]; |
0 | 7974 v13 = v12->uAIState; |
7975 if ( v13 != 5 ) | |
7976 { | |
7977 if ( v13 != 4 | |
7978 && v13 != 11 | |
7979 && v13 != 19 | |
7980 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7981 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 7982 { |
7983 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 7984 && v22 <= pick_depth << 16 ) |
0 | 7985 { |
7986 v14 = 0; | |
7987 if ( v10 > 0 ) | |
7988 { | |
7989 do | |
7990 { | |
7991 if ( dword_50BDA0[v14] == v11 ) | |
7992 break; | |
7993 ++v14; | |
7994 } | |
7995 while ( v14 < v30 ); | |
7996 } | |
7997 if ( v14 == v30 && v10 < 100 ) | |
7998 { | |
7999 ++v30; | |
8000 dword_50BC10[v10] = v22; | |
8001 dword_50BDA0[v10] = v11; | |
8002 ++v10; | |
8003 } | |
8004 } | |
8005 } | |
8006 } | |
8007 } | |
8008 ++v28; | |
8009 --v27; | |
8010 } | |
8011 while ( v27 ); | |
8012 v4 = v30; | |
8013 v5 = v24; | |
8014 } | |
8015 v9 = v26 + 640; | |
8016 v15 = v25-- == 1; | |
8017 v26 += 640; | |
8018 } | |
8019 while ( !v15 ); | |
8020 } | |
8021 if ( v4 > 0 ) | |
8022 { | |
8023 v32 = 1; | |
8024 v16 = (int)dword_50BC10; | |
8025 do | |
8026 { | |
8027 for ( i = v32; i < v4; ++i ) | |
8028 { | |
8029 v17 = dword_50BC10[i]; | |
8030 if ( v17 < *(int *)v16 ) | |
8031 { | |
8032 dword_50BC10[i] = *(int *)v16; | |
8033 *(int *)v16 = v17; | |
8034 } | |
8035 } | |
8036 ++v32; | |
8037 v16 += 4; | |
8038 } | |
8039 while ( v32 - 1 < v4 ); | |
8040 v5 = v24; | |
8041 if ( v4 > 0 ) | |
8042 { | |
8043 v18 = v24; | |
8044 v19 = v4; | |
8045 do | |
8046 { | |
8047 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8048 v18 += 4; | |
8049 --v19; | |
8050 } | |
8051 while ( v19 ); | |
8052 } | |
8053 } | |
8054 v20 = 0; | |
8055 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8056 { | |
8057 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8058 if ( v21 != 4 && v21 != 5 ) | |
8059 break; | |
8060 } | |
8061 if ( v20 != v4 ) | |
8062 { | |
8063 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8064 LOBYTE(result) = result | 3; | |
8065 return result; | |
8066 } | |
8067 } | |
8068 } | |
8069 return 0; | |
8070 } | |
8071 | |
8072 //----- (0042F3D6) -------------------------------------------------------- | |
8073 void InitializeTurnBasedAnimations(void *_this) | |
8074 { | |
8075 unsigned int *v1; // edi@1 | |
8076 | |
8077 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8078 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8079 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8080 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8081 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8082 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8083 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8084 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8085 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8086 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8087 v1 = pIconIDs_Turn; | |
8088 do | |
8089 { | |
8090 pIconsFrameTable->InitializeAnimation(*v1); | |
8091 ++v1; | |
8092 } | |
8093 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8094 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8095 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8096 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8097 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8098 } | |
8099 | |
8100 //----- (0042F4DA) -------------------------------------------------------- | |
8101 signed int __cdecl sub_42F4DA() | |
8102 { | |
8103 signed int v0; // edi@1 | |
82 | 8104 Actor *v1; // esi@4 |
0 | 8105 int v2; // ebx@5 |
8106 int v3; // eax@5 | |
8107 int v4; // ebx@5 | |
8108 unsigned int v5; // ecx@5 | |
8109 int v6; // edx@6 | |
8110 unsigned int v7; // edx@8 | |
8111 unsigned int v8; // edx@10 | |
8112 __int16 v9; // ax@12 | |
8113 signed int result; // eax@20 | |
8114 int v11; // [sp+Ch] [bp-10h]@5 | |
8115 int v12; // [sp+10h] [bp-Ch]@5 | |
8116 signed int v13; // [sp+14h] [bp-8h]@3 | |
8117 | |
8118 v0 = 5120; | |
8119 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8120 v0 = 2560; | |
8121 v13 = 0; | |
8122 if ( (signed int)uNumActors <= 0 ) | |
8123 { | |
8124 LABEL_20: | |
8125 result = 0; | |
8126 } | |
8127 else | |
8128 { | |
82 | 8129 v1 = pActors; |
0 | 8130 while ( 1 ) |
8131 { | |
82 | 8132 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8133 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8134 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8135 v3 = v2; |
8136 v4 = v11; | |
8137 v5 = v12; | |
8138 if ( v3 < v11 ) | |
8139 { | |
8140 v6 = v3; | |
8141 v3 = v11; | |
8142 v4 = v6; | |
8143 } | |
8144 if ( v3 < v12 ) | |
8145 { | |
8146 v7 = v3; | |
8147 v3 = v12; | |
8148 v5 = v7; | |
8149 } | |
8150 if ( v4 < (signed int)v5 ) | |
8151 { | |
8152 v8 = v5; | |
8153 v5 = v4; | |
8154 v4 = v8; | |
8155 } | |
8156 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8157 { | |
82 | 8158 v9 = v1->uAIState; |
8159 if ( v1->uAIState != 5 ) | |
0 | 8160 { |
8161 if ( v9 != 4 | |
8162 && v9 != 11 | |
8163 && v9 != 19 | |
8164 && v9 != 17 | |
82 | 8165 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8166 break; |
8167 } | |
8168 } | |
8169 ++v13; | |
82 | 8170 ++v1; |
0 | 8171 if ( v13 >= (signed int)uNumActors ) |
8172 goto LABEL_20; | |
8173 } | |
8174 result = 1; | |
8175 } | |
8176 return result; | |
8177 } | |
8178 | |
8179 //----- (0042F7EB) -------------------------------------------------------- | |
8180 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) | |
8181 { | |
8182 unsigned int v9; // edi@1 | |
8183 signed int v10; // edx@3 | |
8184 char *v11; // ecx@4 | |
8185 unsigned __int16 v12; // ax@7 | |
8186 unsigned int v13; // edx@9 | |
8187 char *v14; // ecx@10 | |
8188 int v15; // esi@17 | |
8189 int v16; // eax@18 | |
8190 int v17; // edi@20 | |
8191 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8192 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8193 int v21; // [sp+7Ch] [bp-8h]@1 |
8194 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8195 | |
8196 v9 = uSpriteID; | |
8197 v21 = x; | |
8198 v22 = uSpriteID; | |
8199 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8200 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
|
8201 //SpriteObject::SpriteObject(&a1a); |
0 | 8202 a1a.stru_24.Reset(); |
8203 | |
8204 if ( a9 ) | |
8205 { | |
8206 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8207 v9 = v22; | |
8208 } | |
8209 v10 = 0; | |
822 | 8210 a1a.spell_skill = 0; |
8211 a1a.spell_level = 0; | |
8212 a1a.spell_id = 0; | |
0 | 8213 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8214 a1a.uType = v9; |
0 | 8215 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8216 { | |
8217 LABEL_7: | |
8218 v12 = 0; | |
8219 } | |
8220 else | |
8221 { | |
8222 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8223 while ( (short)v9 != *(short *)v11 ) | |
8224 { | |
8225 ++v10; | |
8226 v11 += 56; | |
8227 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8228 goto LABEL_7; | |
8229 } | |
8230 v12 = v10; | |
8231 } | |
8232 a1a.uObjectDescID = v12; | |
8233 a1a.vPosition.z = z; | |
8234 a1a.vPosition.x = v21; | |
8235 a1a.vPosition.y = y; | |
8236 a1a.uSoundID = 0; | |
8237 a1a.uAttributes = attributes; | |
8238 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8239 a1a.uSpriteFrameID = 0; | |
822 | 8240 a1a.spell_caster_pid = 0; |
823 | 8241 a1a.spell_target_pid = 0; |
0 | 8242 if ( !(a1a.uAttributes & 0x10) ) |
8243 { | |
8244 v13 = 0; | |
222 | 8245 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8246 { |
8247 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8248 while ( *(short *)v14 != v9 ) | |
8249 { | |
8250 ++v13; | |
8251 v14 += 48; | |
222 | 8252 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8253 goto LABEL_16; |
8254 } | |
8255 a1a.stru_24.uItemID = v13; | |
8256 } | |
8257 } | |
8258 LABEL_16: | |
8259 if ( a7 ) | |
8260 { | |
8261 v15 = count; | |
8262 if ( count > 0 ) | |
8263 { | |
8264 do | |
8265 { | |
8266 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8267 v16 = rand(); | |
8268 a1a.Create( | |
8269 (signed __int16)a1a.uFacing, | |
8270 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8271 a4, | |
8272 0); | |
8273 --v15; | |
8274 } | |
8275 while ( v15 ); | |
8276 } | |
8277 } | |
8278 else | |
8279 { | |
8280 v17 = count; | |
8281 v18 = stru_5C6E00->uIntegerHalfPi; | |
8282 a1a.uFacing = 0; | |
8283 if ( count > 0 ) | |
8284 { | |
8285 do | |
8286 { | |
8287 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8288 --v17; | |
8289 } | |
8290 while ( v17 ); | |
8291 } | |
8292 } | |
8293 return 1; | |
8294 } | |
8295 | |
8296 //----- (0042F960) -------------------------------------------------------- | |
8297 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8298 { | |
8299 int v3; // ebx@1 | |
8300 int v4; // edi@1 | |
8301 signed int v5; // edx@1 | |
8302 char *v6; // ecx@2 | |
8303 unsigned __int16 v7; // ax@5 | |
8304 signed int v8; // eax@6 | |
8305 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8306 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8307 |
8308 v3 = x; | |
8309 v4 = y; | |
8310 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8311 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
|
8312 //SpriteObject::SpriteObject(&a1); |
0 | 8313 a1.stru_24.Reset(); |
8314 | |
8315 v5 = 0; | |
822 | 8316 a1.spell_skill = 0; |
8317 a1.spell_level = 0; | |
8318 a1.spell_id = 0; | |
0 | 8319 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8320 a1.uType = 800; |
0 | 8321 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8322 { | |
8323 LABEL_5: | |
8324 v7 = 0; | |
8325 } | |
8326 else | |
8327 { | |
8328 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8329 while ( *(short *)v6 != 800 ) | |
8330 { | |
8331 ++v5; | |
8332 v6 += 56; | |
8333 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8334 goto LABEL_5; | |
8335 } | |
8336 v7 = v5; | |
8337 } | |
8338 a1.uObjectDescID = v7; | |
8339 a1.vPosition.x = v3; | |
8340 a1.vPosition.y = v4; | |
8341 a1.vPosition.z = z; | |
8342 a1.uSoundID = 0; | |
8343 a1.uAttributes = 0; | |
8344 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8345 a1.uSpriteFrameID = 0; | |
822 | 8346 a1.spell_caster_pid = 0; |
823 | 8347 a1.spell_target_pid = 0; |
0 | 8348 v8 = a1.Create(0, 0, 0, 0); |
8349 if ( v8 != -1 ) | |
8350 { | |
8351 v9 = 8 * v8; | |
8352 LOBYTE(v9) = v9 | 2; | |
8353 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8354 } | |
8355 } | |
8356 | |
810 | 8357 |
0 | 8358 |
8359 //----- (0042FA66) -------------------------------------------------------- | |
8360 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8361 { | |
8362 int v6; // edi@1 | |
8363 int v7; // esi@1 | |
8364 char *v8; // ecx@2 | |
8365 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8366 //int v10; // eax@10 |
0 | 8367 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8368 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8369 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8370 int v14; // [sp+7Ch] [bp-4h]@1 |
8371 | |
8372 v6 = a1; | |
8373 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8374 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
|
8375 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8376 a1a.uType = 600; |
0 | 8377 a1a.stru_24.Reset(); |
8378 | |
822 | 8379 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8380 a1a.spell_level = 8; | |
8381 a1a.spell_skill = 3; | |
0 | 8382 v14 = 0; |
8383 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8384 { | |
8385 LABEL_5: | |
8386 v9 = 0; | |
8387 } | |
8388 else | |
8389 { | |
8390 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8391 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8392 { |
8393 ++v14; | |
8394 v8 += 56; | |
8395 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8396 goto LABEL_5; | |
8397 } | |
8398 v9 = v14; | |
8399 } | |
8400 a1a.uObjectDescID = v9; | |
8401 a1a.vPosition.x = v6; | |
8402 a1a.vPosition.y = v7; | |
8403 a1a.vPosition.z = a3; | |
8404 a1a.uAttributes = 0; | |
8405 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8406 a1a.uSpriteFrameID = 0; | |
823 | 8407 a1a.spell_target_pid = 0; |
0 | 8408 a1a.field_60_distance_related_prolly_lod = 0; |
8409 a1a.uFacing = 0; | |
8410 a1a.uSoundID = 0; | |
8411 if ( a6 >= 1 || a6 <= 4 ) | |
8412 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8413 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8414 } |
8415 else | |
8416 { | |
822 | 8417 a1a.spell_caster_pid = 0; |
0 | 8418 } |
8419 result = a1a.Create(0, 0, 0, 0); | |
8420 if ( result != -1 ) | |
8421 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8422 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8423 a5, |
8424 SLOWORD(a1a.vPosition.x), | |
8425 SLOWORD(a1a.vPosition.y), | |
8426 SLOWORD(a1a.vPosition.z), | |
8427 0, | |
8428 0); | |
8429 } | |
8430 return result; | |
8431 } | |
8432 | |
8433 //----- (0042FB5C) -------------------------------------------------------- | |
8434 bool __fastcall sub_42FB5C(signed int a1) | |
8435 { | |
8436 int v1; // ecx@3 | |
8437 int v2; // ecx@4 | |
8438 int v3; // ecx@5 | |
8439 int v4; // ecx@6 | |
8440 int v5; // ecx@7 | |
8441 int v6; // ecx@8 | |
8442 char v7; // zf@9 | |
8443 | |
8444 if ( a1 > 39 ) | |
8445 { | |
8446 if ( a1 > 77 ) | |
8447 { | |
8448 if ( a1 == 80 ) | |
8449 return 0; | |
8450 if ( a1 > 84 ) | |
8451 { | |
8452 if ( a1 <= 86 ) | |
8453 return 0; | |
8454 v7 = a1 == 95; | |
8455 goto LABEL_20; | |
8456 } | |
8457 } | |
8458 else | |
8459 { | |
8460 if ( a1 == 77 ) | |
8461 return 0; | |
8462 if ( a1 >= 46 ) | |
8463 { | |
8464 if ( a1 <= 47 || a1 == 51 ) | |
8465 return 0; | |
8466 v7 = a1 == 73; | |
8467 goto LABEL_20; | |
8468 } | |
8469 } | |
8470 return 1; | |
8471 } | |
8472 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8473 return 1; | |
8474 v2 = v1 - 3; | |
8475 if ( !v2 ) | |
8476 return 0; | |
8477 v3 = v2 - 1; | |
8478 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8479 return 1; | |
8480 v5 = v4 - 8; | |
8481 if ( !v5 ) | |
8482 return 0; | |
8483 v6 = v5 - 1; | |
8484 if ( !v6 ) | |
8485 return 1; | |
8486 v7 = v6 == 20; | |
8487 LABEL_20: | |
8488 if ( !v7 ) | |
8489 return 1; | |
8490 return 0; | |
8491 } | |
8492 | |
8493 //----- (0042FBDD) -------------------------------------------------------- | |
8494 void __cdecl sub_42FBDD() | |
8495 { | |
388 | 8496 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8497 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8498 pRenderer->Present(); | |
8499 } | |
8500 | |
8501 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8502 void __cdecl CloseWindowBackground() |
0 | 8503 { |
388 | 8504 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8505 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8506 pRenderer->Present(); | |
8507 } | |
8508 | |
8509 //----- (0042FC4E) -------------------------------------------------------- | |
8510 void __cdecl ProcessInputActions() | |
8511 { | |
8512 ActionQueue *pActionQueue; // esi@7 | |
832 | 8513 //Keyboard *v3; // ecx@8 |
0 | 8514 char v4; // al@9 |
8515 ActionQueue *v5; // ecx@19 | |
8516 Player *v6; // ecx@86 | |
8517 Player *v7; // esi@100 | |
8518 char v8; // bl@100 | |
8519 unsigned __int16 v9; // ax@102 | |
8520 int v10; // eax@103 | |
8521 unsigned int v11; // eax@127 | |
8522 signed int v12; // esi@157 | |
8523 Keyboard *v13; // ecx@158 | |
8524 char v14; // al@159 | |
8525 unsigned int v15; // eax@168 | |
8526 void *v16; // esi@177 | |
8527 int v17; // [sp-14h] [bp-1Ch]@8 | |
8528 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8529 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 | |
271 | 8530 //__int16 v20; // [sp-14h] [bp-1Ch]@60 |
0 | 8531 int v21; // [sp-14h] [bp-1Ch]@68 |
8532 int v22; // [sp-Ch] [bp-14h]@158 | |
8533 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8534 int v24; // [sp+4h] [bp-4h]@87 | |
8535 | |
8536 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8537 auto pKeyboard = pGame->pKeyboardInstance; | |
8538 if (!bAlwaysRun) | |
8539 { | |
8540 if (pKeyboard->IsShiftHeld()) | |
8541 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8542 else | |
8543 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8544 } | |
8545 else | |
8546 { | |
8547 if (pKeyboard->IsShiftHeld()) | |
8548 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8549 else | |
8550 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8551 } | |
8552 | |
140 | 8553 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
486 | 8554 //LABEL_6: |
0 | 8555 if ( !pEventTimer->bPaused ) |
8556 { | |
8557 inputAction = (InputAction)0; | |
8558 pActionQueue = pPartyActionQueue; | |
8559 while ( 1 ) | |
8560 { | |
8561 v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; | |
8562 if ( pKeyActionMap->pToggleTypes[inputAction] ) | |
832 | 8563 v4 = pKeyboard->WasKeyPressed(v17); |
0 | 8564 else |
832 | 8565 v4 = pKeyboard->IsKeyBeingHeld(v17); |
0 | 8566 if ( v4 ) |
8567 { | |
8568 switch ( inputAction ) | |
8569 { | |
8570 case INPUT_MoveForward: | |
271 | 8571 if (pCurrentScreen != SCREEN_GAME) |
0 | 8572 break; |
8573 if (!pParty->bTurnBasedModeOn) | |
163 | 8574 //goto _do_move_forward; |
0 | 8575 { |
8576 v5 = pActionQueue; | |
140 | 8577 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8578 partyAction = PARTY_RunForward; |
8579 else | |
8580 partyAction = PARTY_WalkForward; | |
163 | 8581 //goto _add_action_and_continue; |
8582 v5->Add(partyAction); | |
8583 break; | |
8584 } | |
8585 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8586 { | |
8587 pTurnEngine->uActionPointsLeft -= 26; | |
8588 //_do_move_forward: | |
8589 v5 = pActionQueue; | |
8590 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8591 partyAction = PARTY_RunForward; | |
8592 else | |
8593 partyAction = PARTY_WalkForward; | |
8594 //goto _add_action_and_continue; | |
8595 v5->Add(partyAction); | |
8596 break; | |
0 | 8597 } |
8598 break; | |
8599 case INPUT_MoveBackwards: | |
17 | 8600 //__debugbreak(); |
271 | 8601 if (pCurrentScreen != SCREEN_GAME) |
0 | 8602 break; |
8603 if (!pParty->bTurnBasedModeOn) | |
17 | 8604 //goto _do_move_backwards; |
8605 { | |
8606 v5 = pActionQueue; | |
8607 if ( pParty->uFlags2 & 2 ) | |
8608 partyAction = PARTY_RunBackward; | |
8609 else | |
8610 partyAction = PARTY_WalkBackward; | |
163 | 8611 //goto _add_action_and_continue; |
8612 v5->Add(partyAction); | |
8613 break; | |
17 | 8614 } |
0 | 8615 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8616 { | |
8617 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8618 //_do_move_backwards: |
0 | 8619 v5 = pActionQueue; |
8620 if ( pParty->uFlags2 & 2 ) | |
8621 partyAction = PARTY_RunBackward; | |
8622 else | |
8623 partyAction = PARTY_WalkBackward; | |
163 | 8624 //goto _add_action_and_continue; |
8625 v5->Add(partyAction); | |
8626 break; | |
0 | 8627 } |
8628 break; | |
8629 case INPUT_StrafeLeft: | |
17 | 8630 //__debugbreak(); |
271 | 8631 if (pCurrentScreen != SCREEN_GAME) |
0 | 8632 break; |
8633 if (!pParty->bTurnBasedModeOn) | |
17 | 8634 //goto _do_strafe_left; |
8635 { | |
8636 partyAction = PARTY_StrafeLeft; | |
163 | 8637 //goto _add_action_and_continue_; |
8638 v5 = pActionQueue; | |
8639 v5->Add(partyAction); | |
8640 break; | |
17 | 8641 } |
0 | 8642 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8643 break; | |
8644 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8645 //_do_strafe_left: |
0 | 8646 partyAction = PARTY_StrafeLeft; |
163 | 8647 //goto _add_action_and_continue_; |
8648 v5 = pActionQueue; | |
8649 v5->Add(partyAction); | |
8650 break; | |
0 | 8651 case INPUT_StrafeRight: |
17 | 8652 //__debugbreak(); |
271 | 8653 if (pCurrentScreen != SCREEN_GAME) |
0 | 8654 break; |
8655 if (!pParty->bTurnBasedModeOn) | |
17 | 8656 //goto _do_strafe_right; |
8657 { | |
8658 partyAction = PARTY_StrafeRight; | |
163 | 8659 //goto _add_action_and_continue_; |
8660 v5 = pActionQueue; | |
8661 v5->Add(partyAction); | |
8662 break; | |
17 | 8663 } |
0 | 8664 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8665 break; | |
8666 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8667 //_do_strafe_right: |
0 | 8668 partyAction = PARTY_StrafeRight; |
163 | 8669 //goto _add_action_and_continue_; |
8670 v5 = pActionQueue; | |
8671 v5->Add(partyAction); | |
8672 break; | |
0 | 8673 case INPUT_TurnLeft: |
271 | 8674 if (pCurrentScreen != SCREEN_GAME) |
0 | 8675 break; |
8676 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8677 { | |
8678 if (pParty->bTurnBasedModeOn) | |
8679 { | |
8680 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8681 break; | |
8682 pTurnEngine->uActionPointsLeft -= 26; | |
8683 } | |
8684 partyAction_ = PARTY_StrafeLeft; | |
8685 } | |
8686 else | |
8687 { | |
8688 if ( pParty->uFlags2 & 2 ) | |
8689 partyAction_ = PARTY_FastTurnLeft; | |
8690 else | |
8691 partyAction_ = PARTY_TurnLeft; | |
8692 } | |
8693 pActionQueue->Add(partyAction_); | |
8694 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8695 { | |
271 | 8696 pWeather->OnPlayerTurn(10); |
0 | 8697 } |
8698 break; | |
8699 case INPUT_TurnRight: | |
271 | 8700 if (pCurrentScreen != SCREEN_GAME) |
0 | 8701 break; |
8702 if ( GetAsyncKeyState(17) ) // strafing | |
8703 { | |
8704 if (pParty->bTurnBasedModeOn) | |
8705 { | |
8706 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8707 break; | |
8708 pTurnEngine->uActionPointsLeft -= 26; | |
8709 } | |
271 | 8710 v21 = PARTY_StrafeRight; |
0 | 8711 } |
8712 else | |
8713 { | |
8714 if ( pParty->uFlags2 & 2 ) | |
271 | 8715 v21 = PARTY_FastTurnRight; |
0 | 8716 else |
271 | 8717 v21 = PARTY_TurnRight; |
0 | 8718 } |
8719 pActionQueue->Add((PartyAction)v21); | |
8720 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8721 { | |
271 | 8722 pWeather->OnPlayerTurn(-10); |
0 | 8723 } |
8724 break; | |
8725 case INPUT_Jump: | |
17 | 8726 //__debugbreak(); |
271 | 8727 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8728 break; |
8729 partyAction = (PartyAction)12; | |
163 | 8730 //goto _add_action_and_continue_; |
8731 v5 = pActionQueue; | |
8732 v5->Add(partyAction); | |
8733 break; | |
0 | 8734 case INPUT_Yell: |
187 | 8735 if (!pCurrentScreen && uActiveCharacter) |
0 | 8736 { |
8737 pParty->Yell(); | |
187 | 8738 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8739 } |
187 | 8740 break; |
0 | 8741 case INPUT_Pass: |
17 | 8742 //__debugbreak(); |
0 | 8743 if ( pCurrentScreen ) |
8744 break; | |
8745 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8746 //goto LABEL_118; |
8747 { | |
8748 pTurnEngine->field_18 |= 8u; | |
8749 break; | |
8750 } | |
0 | 8751 if ( uActiveCharacter ) |
8752 { | |
8753 v6 = pPlayers[uActiveCharacter]; | |
8754 if ( !v6->uTimeToRecovery ) | |
8755 { | |
816 | 8756 v24 = v6->GetAttackRecoveryTime(false); |
0 | 8757 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8758 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 8759 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 8760 pTurnEngine->_40471C(); |
8761 } | |
8762 } | |
8763 break; | |
8764 case INPUT_Combat: | |
17 | 8765 //__debugbreak(); |
271 | 8766 if (pCurrentScreen == SCREEN_GAME) |
0 | 8767 { |
8768 if (pParty->bTurnBasedModeOn) | |
8769 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8770 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8771 { |
8772 pParty->bTurnBasedModeOn = 0; | |
8773 pTurnEngine->End(true); | |
8774 } | |
8775 } | |
8776 else | |
8777 { | |
8778 pTurnEngine->Start(); | |
8779 pParty->bTurnBasedModeOn = true; | |
8780 } | |
8781 } | |
8782 break; | |
8783 case INPUT_CastReady: | |
17 | 8784 //__debugbreak(); |
271 | 8785 if (pCurrentScreen != SCREEN_GAME) |
0 | 8786 break; |
8787 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8788 //goto LABEL_118; |
8789 { | |
8790 pTurnEngine->field_18 |= 8u; | |
8791 break; | |
8792 } | |
0 | 8793 if ( !uActiveCharacter ) |
8794 break; | |
8795 v7 = pPlayers[uActiveCharacter]; | |
8796 v8 = v7->uQuickSpell; | |
8797 if ( !v8 | |
8798 || bUnderwater | |
8799 || ((v9 = v7->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
8800 v10 > v7->sMana) ) | |
8801 { | |
8802 pActionQueue = pPartyActionQueue; | |
8803 LABEL_120: | |
437 | 8804 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8805 break; | |
8806 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8807 { |
271 | 8808 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; |
163 | 8809 //goto _send_message; |
8810 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8811 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8812 ++pMessageQueue_50CBD0->uNumMessages; | |
8813 break; | |
437 | 8814 }*/ |
0 | 8815 } |
8816 else | |
8817 { | |
8818 pActionQueue = pPartyActionQueue; | |
8819 if ( dword_50C9E8 < 40 ) | |
8820 { | |
8821 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8822 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8823 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8824 ++dword_50C9E8; |
8825 } | |
8826 } | |
8827 break; | |
8828 case INPUT_Attack: | |
17 | 8829 //__debugbreak(); |
271 | 8830 if (pCurrentScreen != SCREEN_GAME) |
0 | 8831 break; |
8832 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) | |
8833 goto LABEL_120; | |
17 | 8834 //LABEL_118: |
0 | 8835 pTurnEngine->field_18 |= 8u; |
8836 break; | |
8837 case INPUT_EventTrigger: | |
271 | 8838 if (pCurrentScreen == SCREEN_GAME) |
0 | 8839 { |
437 | 8840 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8841 break; |
271 | 8842 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; |
163 | 8843 //goto _send_message; |
8844 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8845 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8846 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8847 break;*/ |
8848 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
163 | 8849 break; |
0 | 8850 } |
151 | 8851 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8852 { |
8853 v11 = pMessageQueue_50CBD0->uNumMessages; | |
8854 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8855 { | |
437 | 8856 v11 = 0; |
8857 pMessageQueue_50CBD0->uNumMessages = 0; | |
0 | 8858 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8859 { | |
8860 v11 = 1; | |
8861 pMessageQueue_50CBD0->uNumMessages = 1; | |
163 | 8862 //LABEL_132: |
271 | 8863 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8864 //_send_message: |
0 | 8865 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8866 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8867 ++pMessageQueue_50CBD0->uNumMessages; | |
8868 break; | |
8869 } | |
437 | 8870 break; |
0 | 8871 } |
437 | 8872 /*if ( (signed int)v11 < 40 ) |
163 | 8873 //goto LABEL_132; |
8874 { | |
271 | 8875 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8876 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8877 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8878 ++pMessageQueue_50CBD0->uNumMessages; | |
8879 break; | |
437 | 8880 }*/ |
8881 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 8882 } |
8883 break; | |
8884 case INPUT_CharCycle: | |
17 | 8885 //__debugbreak(); |
151 | 8886 if ( pCurrentScreen == SCREEN_SPELL_BOOK |
0 | 8887 || dword_50C9E8 >= 40 ) |
8888 break; | |
8889 dword_50C9EC[3 * dword_50C9E8] = 176; | |
163 | 8890 //goto LABEL_155; |
437 | 8891 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8892 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8893 ++dword_50C9E8; |
8894 break; | |
0 | 8895 case INPUT_LookUp: |
17 | 8896 //__debugbreak(); |
0 | 8897 if ( pEventTimer->bPaused ) |
8898 break; | |
8899 partyAction = (PartyAction)7; | |
163 | 8900 //goto _add_action_and_continue_; |
8901 v5 = pActionQueue; | |
8902 v5->Add(partyAction); | |
8903 break; | |
0 | 8904 case INPUT_CenterView: |
17 | 8905 //__debugbreak(); |
0 | 8906 if ( pEventTimer->bPaused ) |
8907 break; | |
8908 partyAction = (PartyAction)9; | |
163 | 8909 //goto _add_action_and_continue_; |
8910 v5 = pActionQueue; | |
8911 v5->Add(partyAction); | |
8912 break; | |
0 | 8913 case INPUT_LookDown: |
17 | 8914 //__debugbreak(); |
0 | 8915 if ( pEventTimer->bPaused ) |
8916 break; | |
8917 partyAction = (PartyAction)8; | |
163 | 8918 //goto _add_action_and_continue_; |
8919 v5 = pActionQueue; | |
8920 v5->Add(partyAction); | |
8921 break; | |
0 | 8922 case INPUT_FlyUp: |
17 | 8923 //__debugbreak(); |
0 | 8924 if ( pCurrentScreen |
8925 || pEventTimer->bPaused ) | |
8926 break; | |
8927 partyAction = (PartyAction)13; | |
163 | 8928 //goto _add_action_and_continue_; |
8929 v5 = pActionQueue; | |
8930 v5->Add(partyAction); | |
8931 break; | |
0 | 8932 case INPUT_Land: |
17 | 8933 //__debugbreak(); |
0 | 8934 if ( pCurrentScreen |
8935 || pEventTimer->bPaused ) | |
8936 break; | |
8937 partyAction = (PartyAction)15; | |
163 | 8938 //goto _add_action_and_continue_; |
8939 v5 = pActionQueue; | |
8940 v5->Add(partyAction); | |
8941 break; | |
0 | 8942 case INPUT_FlyDown: |
17 | 8943 //__debugbreak(); |
0 | 8944 if ( !pCurrentScreen |
8945 && !pEventTimer->bPaused ) | |
8946 { | |
8947 partyAction = (PartyAction)14; | |
163 | 8948 //_add_action_and_continue_: |
0 | 8949 v5 = pActionQueue; |
163 | 8950 //_add_action_and_continue: |
0 | 8951 v5->Add(partyAction); |
8952 } | |
8953 break; | |
8954 case INPUT_ZoomIn: | |
17 | 8955 //__debugbreak(); |
0 | 8956 if ( dword_50C9E8 >= 40 ) |
8957 break; | |
8958 dword_50C9EC[3 * dword_50C9E8] = 367; | |
163 | 8959 //goto LABEL_155; |
437 | 8960 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8961 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8962 ++dword_50C9E8; |
8963 break; | |
0 | 8964 case INPUT_ZoomOut: |
17 | 8965 //__debugbreak(); |
0 | 8966 if ( dword_50C9E8 < 40 ) |
8967 { | |
8968 dword_50C9EC[3 * dword_50C9E8] = 368; | |
163 | 8969 //LABEL_155: |
437 | 8970 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8971 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8972 ++dword_50C9E8; |
8973 } | |
8974 break; | |
8975 case INPUT_AlwaysRun: | |
8976 bAlwaysRun = bAlwaysRun == 0; | |
8977 break; | |
17 | 8978 default: |
8979 //__debugbreak(); | |
8980 break; | |
0 | 8981 } |
8982 } | |
8983 inputAction = (InputAction)((int)inputAction + 1); | |
8984 if ( (signed int)inputAction >= 30 ) | |
8985 goto LABEL_176; | |
8986 } | |
8987 } | |
8988 v12 = 0; | |
8989 do | |
8990 { | |
8991 v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; | |
8992 v13 = pGame->pKeyboardInstance; | |
8993 if ( pKeyActionMap->pToggleTypes[v12] ) | |
8994 v14 = v13->WasKeyPressed(v22); | |
8995 else | |
8996 v14 = v13->IsKeyBeingHeld(v22); | |
8997 if ( v14 && v12 == 9 ) | |
8998 { | |
8999 if ( !pCurrentScreen ) | |
9000 { | |
437 | 9001 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9002 goto LABEL_175; |
9003 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; | |
17 | 9004 //goto LABEL_174; |
9005 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9006 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9007 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9008 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
17 | 9009 goto LABEL_175; |
0 | 9010 } |
151 | 9011 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE |
9012 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
0 | 9013 { |
9014 v15 = pMessageQueue_50CBD0->uNumMessages; | |
9015 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9016 { | |
9017 v15 = 0; | |
9018 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
9019 { | |
9020 v15 = 1; | |
437 | 9021 pMessageQueue_50CBD0->uNumMessages = 0; |
17 | 9022 //goto LABEL_173; |
437 | 9023 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; |
17 | 9024 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9025 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9026 ++pMessageQueue_50CBD0->uNumMessages; | |
9027 goto LABEL_175; | |
0 | 9028 } |
9029 pMessageQueue_50CBD0->uNumMessages = 0; | |
9030 } | |
437 | 9031 /*if ( (signed int)v15 >= 40 ) |
0 | 9032 goto LABEL_175; |
17 | 9033 //LABEL_173: |
0 | 9034 pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; |
17 | 9035 //LABEL_174: |
0 | 9036 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9037 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9038 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9039 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 9040 goto LABEL_175; |
9041 } | |
9042 } | |
9043 LABEL_175: | |
9044 ++v12; | |
9045 } | |
9046 while ( v12 < 30 ); | |
9047 LABEL_176: | |
9048 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
9049 { | |
9050 AsyncKeyboard::LeaveCriticalSection(); | |
9051 v16 = pAsyncKeyboard; | |
9052 AsyncKeyboard::EnterCriticalSection(); | |
9053 memset((char *)v16 + 521, 0, 0x100u); | |
9054 AsyncKeyboard::LeaveCriticalSection(); | |
9055 } | |
9056 } |