Mercurial > mm7
annotate mm7_6.cpp @ 1023:54f74d2c894f
m
author | Ritor1 |
---|---|
date | Wed, 15 May 2013 09:32:33 +0600 |
parents | e4383e6dfbef |
children | 9318dd3f3711 |
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) | |
961 | 2153 //goto LABEL_25; |
2154 { | |
2155 a5 |= 0x0002; | |
2156 break; | |
2157 } | |
486 | 2158 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); |
961 | 2159 //goto LABEL_25; |
2160 { | |
2161 a5 |= 0x0002; | |
2162 break; | |
2163 } | |
0 | 2164 break; |
486 | 2165 |
2166 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2167 v9 = a4; |
2168 if ( !a4 ) | |
437 | 2169 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
961 | 2170 //goto LABEL_18; |
2171 v10 = SkillToMastery(v9); | |
2172 v12 = __OFSUB__(v10, 3); | |
2173 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2174 //goto LABEL_24; | |
2175 if ( v11 ^ v12 ) | |
2176 { | |
2177 a5 |= 0x0002; | |
2178 break; | |
2179 } | |
2180 break; | |
486 | 2181 |
2182 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2183 v9 = a4; |
2184 if ( !a4 ) | |
437 | 2185 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
961 | 2186 //LABEL_18: |
0 | 2187 v10 = SkillToMastery(v9); |
2188 v12 = __OFSUB__(v10, 3); | |
2189 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
961 | 2190 //goto LABEL_24; |
2191 if ( v11 ^ v12 ) | |
2192 { | |
2193 a5 |= 0x0002; | |
2194 break; | |
2195 } | |
2196 break; | |
486 | 2197 |
2198 case SPELL_BODY_HAMMERHANDS: | |
0 | 2199 v13 = a4; |
2200 if ( !a4 ) | |
437 | 2201 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2202 v14 = SkillToMastery(v13); |
2203 v12 = __OFSUB__(v14, 4); | |
2204 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
961 | 2205 //LABEL_24: |
0 | 2206 if ( v11 ^ v12 ) |
961 | 2207 //goto LABEL_25; |
2208 { | |
2209 a5 |= 0x0002; | |
2210 break; | |
2211 } | |
0 | 2212 break; |
486 | 2213 |
2214 case SPELL_EARTH_STONE_TO_FLESH: | |
2215 case SPELL_SPIRIT_REMOVE_CURSE: | |
2216 case SPELL_SPIRIT_RAISE_DEAD: | |
2217 case SPELL_SPIRIT_RESSURECTION: | |
2218 case SPELL_MIND_REMOVE_FEAR: | |
2219 case SPELL_MIND_CURE_PARALYSIS: | |
2220 case SPELL_MIND_CURE_INSANITY: | |
2221 case SPELL_BODY_CURE_WEAKNESS: | |
2222 case SPELL_BODY_REGENERATION: | |
2223 case SPELL_BODY_CURE_POISON: | |
2224 case SPELL_BODY_CURE_DISEASE: | |
961 | 2225 //LABEL_25: |
486 | 2226 //v6 = a5 | 2; |
2227 a5 |= 0x0002; | |
0 | 2228 break; |
486 | 2229 |
2230 case SPELL_DARK_SACRIFICE: | |
2231 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2232 a5 |= 0x0200; | |
0 | 2233 break; |
2234 default: | |
2235 break; | |
2236 } | |
2237 } | |
370 | 2238 |
486 | 2239 |
2240 if (a5 & 0x3CA) | |
0 | 2241 { |
924 | 2242 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2243 for (uint i = 0; i < 10; ++i) |
924 | 2244 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2245 { |
924 | 2246 pCastSpellInfo[i].spellnum = 0; |
486 | 2247 break; |
2248 } | |
0 | 2249 } |
486 | 2250 |
924 | 2251 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2252 for (uint i = 0; i < 10; ++i) |
0 | 2253 { |
924 | 2254 auto spell = pCastSpellInfo + i; |
486 | 2255 if (!spell->spellnum) |
2256 continue; | |
2257 | |
2258 spell->spellnum = 0; | |
2259 if (spell->field_8 & 0x3CA) | |
0 | 2260 { |
486 | 2261 pGUIWindow_Settings->Release(); |
2262 pGUIWindow_Settings = nullptr; | |
2263 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2264 GameUI_Footer_TimeLeft = 0; |
486 | 2265 unk_50C9A0 = 0; |
2266 back_to_game(); | |
0 | 2267 } |
2268 } | |
486 | 2269 |
924 | 2270 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2271 if ( result != -1 ) |
2272 { | |
486 | 2273 if ( a5 & 2 ) |
0 | 2274 { |
2275 if ( pGUIWindow_Settings ) | |
319 | 2276 return; |
961 | 2277 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2278 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0); |
2279 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0); | |
2280 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0); | |
2281 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0); | |
319 | 2282 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2283 return; | |
0 | 2284 } |
486 | 2285 if ( a5 & 8 ) |
0 | 2286 { |
2287 if ( pGUIWindow_Settings ) | |
319 | 2288 return; |
832 | 2289 |
961 | 2290 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2291 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0); |
319 | 2292 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2293 return; | |
0 | 2294 } |
486 | 2295 if ( a5 & 0x40 ) |
0 | 2296 { |
2297 if ( pGUIWindow_Settings ) | |
319 | 2298 return; |
832 | 2299 |
961 | 2300 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
2301 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_BE, 0, 0, "", 0); | |
832 | 2302 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2303 return; | |
0 | 2304 } |
486 | 2305 if ( (char)a5 < 0 ) |
0 | 2306 { |
2307 if ( pGUIWindow_Settings ) | |
319 | 2308 return; |
0 | 2309 ++pIcons_LOD->uTexturePacksCount; |
2310 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2311 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2312 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2313 unk_50C9A0 = 1; |
2314 some_active_character = uActiveCharacter; | |
319 | 2315 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2316 return; | |
0 | 2317 } |
486 | 2318 if ( HIBYTE(a5) & 1 ) |
0 | 2319 { |
2320 if ( pGUIWindow_Settings ) | |
319 | 2321 return; |
961 | 2322 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2323 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0); |
2324 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0); | |
2325 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0); | |
2326 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0); | |
2327 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL); | |
961 | 2328 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2329 } |
486 | 2330 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2331 { |
961 | 2332 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
832 | 2333 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2334 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2335 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
960 | 2336 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", |
832 | 2337 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2338 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2339 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2340 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
960 | 2341 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", |
832 | 2342 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
998 | 2343 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0); |
2344 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0); | |
0 | 2345 } |
2346 } | |
2347 } | |
2348 | |
2349 //----- (00427D48) -------------------------------------------------------- | |
924 | 2350 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2351 { |
924 | 2352 CastSpellInfo *v2; // esi@1 |
0 | 2353 signed int v3; // ebx@1 |
2354 | |
2355 v2 = this; | |
2356 v3 = 10; | |
2357 do | |
2358 { | |
2359 if ( v2->spellnum ) | |
2360 { | |
2361 if ( v2->field_8 & 0x3CA ) | |
2362 { | |
2363 v2->spellnum = 0; | |
2364 pGUIWindow_Settings->Release(); | |
2365 pGUIWindow_Settings = 0; | |
2366 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2367 GameUI_Footer_TimeLeft = 0; |
0 | 2368 unk_50C9A0 = 0; |
2369 back_to_game(); | |
2370 } | |
2371 } | |
2372 ++v2; | |
2373 --v3; | |
2374 } | |
2375 while ( v3 ); | |
2376 } | |
2377 | |
2378 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2379 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2380 { |
2381 unsigned int result; // eax@1 | |
924 | 2382 CastSpellInfo *v7; // edx@1 |
2383 CastSpellInfo *v8; // ecx@5 | |
0 | 2384 |
2385 result = 0; | |
2386 v7 = this; | |
2387 while ( v7->spellnum ) | |
2388 { | |
2389 ++result; | |
2390 ++v7; | |
2391 if ( (signed int)result >= 10 ) | |
2392 goto LABEL_8; | |
2393 } | |
2394 v8 = &this[result]; | |
2395 v8->spellnum = a2; | |
2396 v8->uPlayerID = uPlayerID; | |
2397 if ( a5 & 0x10 ) | |
2398 v8->uPlayerID_2 = uPlayerID; | |
2399 v8->field_6 = 0; | |
488 | 2400 v8->spell_target_pid = 0; |
0 | 2401 v8->field_8 = a5; |
488 | 2402 v8->forced_spell_skill_level = skill_level; |
823 | 2403 v8->sound_id = spell_sound_id; |
0 | 2404 LABEL_8: |
2405 if ( result == 10 ) | |
2406 result = -1; | |
2407 return result; | |
2408 } | |
2409 | |
2410 //----- (00427E01) -------------------------------------------------------- | |
924 | 2411 void CastSpellInfo::_427E01_cast_spell() |
0 | 2412 { |
486 | 2413 //int v1; // esi@1 |
0 | 2414 int v2; // edi@1 |
924 | 2415 CastSpellInfo *pCastSpell; // ebx@2 |
488 | 2416 //signed int v4; // eax@8 |
2417 //__int16 v5; // ax@9 | |
0 | 2418 signed int v6; // eax@14 |
488 | 2419 //__int16 v7; // ax@23 |
2420 //__int16 v8; // ax@24 | |
2421 //char v9; // al@44 | |
2422 //int v10; // eax@45 | |
0 | 2423 unsigned __int16 v11; // cx@45 |
822 | 2424 //signed int v12; // ecx@48 |
490 | 2425 //int v13; // eax@53 |
0 | 2426 unsigned __int8 v14; // zf@53 |
488 | 2427 //unsigned int v15; // edx@53 |
2428 //signed int v16; // eax@53 | |
998 | 2429 //Player *v17; // esi@70 |
822 | 2430 //int v18; // eax@72 |
823 | 2431 //int v19; // eax@74 |
888 | 2432 Player *v20; // eax@74 |
0 | 2433 signed int i; // esi@76 |
823 | 2434 //int v22; // eax@88 |
0 | 2435 __int16 v23; // ax@88 |
488 | 2436 //int v24; // ecx@93 |
2437 //int v25; // ecx@94 | |
2438 //signed __int64 v26; // qax@100 | |
2439 //char *v27; // ecx@100 | |
2440 //unsigned __int64 v28; // qax@102 | |
0 | 2441 int v29; // ecx@105 |
2442 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2443 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2444 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2445 //char *v33; // edx@113 |
823 | 2446 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2447 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2448 //int v36; // edx@125 |
823 | 2449 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2450 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2451 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2452 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2453 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2454 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2455 //int *v43; // ecx@129 |
823 | 2456 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2457 //int v45; // ecx@132 |
0 | 2458 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2459 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2460 //int v48; // eax@137 |
823 | 2461 //int v49; // eax@137 |
822 | 2462 //int v50; // eax@141 |
0 | 2463 int v51; // eax@146 |
2464 __int16 v52; // ax@153 | |
823 | 2465 //int v53; // eax@153 |
0 | 2466 signed __int64 v54; // qax@164 |
2467 int v55; // edi@164 | |
488 | 2468 //stru6 *v56; // eax@165 |
0 | 2469 int v57; // eax@169 |
2470 signed __int64 v58; // qax@177 | |
2471 int v59; // edi@177 | |
2472 unsigned __int16 v60; // ax@184 | |
2473 int v61; // ecx@184 | |
823 | 2474 //int v62; // eax@186 |
0 | 2475 int v63; // ecx@187 |
2476 int v64; // ecx@188 | |
2477 int v65; // ecx@189 | |
710 | 2478 //const char *v66; // ecx@200 |
2479 //unsigned int v67; // edx@201 | |
0 | 2480 char v68; // al@207 |
89 | 2481 ItemGen *v69; // esi@211 |
0 | 2482 int v70; // ecx@214 |
2483 int v71; // ecx@215 | |
2484 int v72; // ecx@216 | |
488 | 2485 //__int16 v73; // ST1C_2@222 |
2486 //__int16 v74; // ST18_2@222 | |
2487 //stru6 *v75; // eax@222 | |
993 | 2488 //int v76; // ecx@223 |
2489 //int v77; // ecx@224 | |
2490 //int v78; // ecx@225 | |
2491 //int v79; // eax@227 | |
488 | 2492 //int v80; // eax@232 |
2493 //__int16 v81; // ST18_2@245 | |
2494 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2495 //signed int v83; // edi@245 |
488 | 2496 //__int16 v84; // ST18_2@245 |
2497 //stru6 *v85; // eax@245 | |
2498 //__int16 v86; // ST18_2@245 | |
2499 //stru6 *v87; // eax@245 | |
2500 //__int16 v88; // ST18_2@245 | |
2501 //stru6 *v89; // eax@245 | |
0 | 2502 double v90; // st7@245 |
993 | 2503 //int v91; // eax@250 |
89 | 2504 Player *v92; // eax@255 |
488 | 2505 //__int16 v93; // ST18_2@260 |
2506 //stru6 *v94; // eax@260 | |
2507 //__int16 v95; // ST18_2@260 | |
2508 //stru6 *v96; // eax@260 | |
2509 //__int16 v97; // ST18_2@260 | |
2510 //stru6 *v98; // eax@260 | |
2511 //__int16 v99; // ST18_2@260 | |
2512 //stru6 *v100; // eax@260 | |
993 | 2513 //int v101; // ecx@261 |
2514 //int v102; // ecx@262 | |
2515 //int v103; // ecx@263 | |
2516 //int v104; // eax@265 | |
0 | 2517 int v105; // edi@271 |
488 | 2518 //__int16 v106; // ST18_2@272 |
2519 //stru6 *v107; // eax@272 | |
0 | 2520 __int16 v108; // ST1C_2@274 |
2521 __int16 v109; // ST18_2@274 | |
2522 stru6 *v110; // eax@274 | |
2523 int v111; // eax@274 | |
2524 Actor *v112; // esi@278 | |
2525 int v113; // eax@278 | |
2526 int v114; // ebx@278 | |
2527 unsigned int v115; // ecx@278 | |
2528 int v116; // edx@279 | |
2529 int v117; // edx@281 | |
2530 int v118; // edx@283 | |
2531 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2532 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2533 //int v121; // eax@286 |
0 | 2534 signed int v122; // eax@286 |
993 | 2535 //int v123; // ecx@288 |
2536 //int v124; // ecx@289 | |
2537 //int v125; // ecx@290 | |
2538 //int v126; // eax@292 | |
0 | 2539 int v127; // eax@296 |
488 | 2540 //__int16 v128; // ST18_2@303 |
2541 //stru6 *v129; // eax@303 | |
2542 //__int16 v130; // ST18_2@303 | |
2543 //stru6 *v131; // eax@303 | |
2544 //__int16 v132; // ST18_2@303 | |
2545 //stru6 *v133; // eax@303 | |
2546 //__int16 v134; // ST18_2@303 | |
2547 //stru6 *v135; // eax@303 | |
2548 //unsigned __int64 v136; // qax@304 | |
2549 //char *v137; // ecx@304 | |
993 | 2550 //int v138; // ecx@305 |
0 | 2551 int v139; // ecx@306 |
993 | 2552 //int v140; // eax@308 |
488 | 2553 //__int16 v141; // ST18_2@311 |
2554 //stru6 *v142; // eax@311 | |
2555 //__int16 v143; // ST18_2@311 | |
2556 //stru6 *v144; // eax@311 | |
2557 //__int16 v145; // ST18_2@311 | |
2558 //stru6 *v146; // eax@311 | |
2559 //__int16 v147; // ST18_2@311 | |
2560 //stru6 *v148; // eax@311 | |
0 | 2561 int v149; // ecx@312 |
2562 int v150; // ecx@313 | |
2563 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2564 //signed int v152; // eax@322 |
0 | 2565 int v153; // ecx@322 |
2566 int v154; // eax@322 | |
2567 int v155; // eax@323 | |
2568 int v156; // eax@323 | |
993 | 2569 //int v157; // eax@326 |
0 | 2570 double v158; // st7@326 |
2571 double v159; // st6@326 | |
993 | 2572 //signed __int64 v160; // qtt@334 |
823 | 2573 //int v161; // eax@339 |
0 | 2574 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2575 //int v163; // eax@340 |
0 | 2576 signed int v164; // eax@340 |
2577 signed int v165; // edi@340 | |
488 | 2578 //stru6 *v166; // eax@340 |
2579 //stru6 *v167; // eax@340 | |
0 | 2580 signed int v168; // edi@343 |
2581 int v169; // eax@344 | |
993 | 2582 //int v170; // ecx@346 |
2583 //int v171; // ecx@347 | |
2584 //int v172; // ecx@348 | |
2585 //int v173; // edi@350 | |
0 | 2586 signed int v174; // edi@355 |
488 | 2587 //__int16 v175; // ST18_2@357 |
2588 //stru6 *v176; // eax@357 | |
2589 //__int16 v177; // ST18_2@357 | |
2590 //stru6 *v178; // eax@357 | |
2591 //__int16 v179; // ST18_2@357 | |
2592 //stru6 *v180; // eax@357 | |
2593 //__int16 v181; // ST18_2@357 | |
2594 //stru6 *v182; // eax@357 | |
2595 //signed __int64 v183; // qax@357 | |
0 | 2596 int v184; // ecx@358 |
2597 int v185; // ecx@359 | |
2598 int v186; // ecx@360 | |
823 | 2599 //int v187; // eax@367 |
0 | 2600 int v188; // esi@369 |
2601 int v189; // edi@369 | |
710 | 2602 //const char *v190; // ecx@377 |
0 | 2603 signed int v191; // edi@379 |
2604 int v192; // ecx@382 | |
993 | 2605 //int v193; // ecx@383 |
2606 //int v194; // ecx@384 | |
0 | 2607 int v195; // eax@386 |
2608 int v196; // eax@387 | |
488 | 2609 //__int16 v197; // ST18_2@395 |
2610 //stru6 *v198; // eax@395 | |
2611 //__int16 v199; // ST18_2@395 | |
2612 //stru6 *v200; // eax@395 | |
2613 //__int16 v201; // ST18_2@395 | |
2614 //stru6 *v202; // eax@395 | |
2615 //__int16 v203; // ST18_2@395 | |
2616 //stru6 *v204; // eax@395 | |
0 | 2617 signed int v205; // edi@405 |
2618 int v206; // eax@407 | |
2619 __int16 v207; // cx@407 | |
2620 int v208; // eax@411 | |
2621 signed int v209; // ecx@412 | |
2622 int v210; // edx@412 | |
2623 signed int v211; // ecx@412 | |
2624 int v212; // eax@413 | |
2625 int v213; // eax@413 | |
2626 int v214; // eax@413 | |
2627 int v215; // eax@415 | |
2628 double v216; // st7@415 | |
2629 double v217; // st6@415 | |
2630 signed __int64 v218; // qtt@423 | |
993 | 2631 //int v219; // ecx@425 |
2632 //int v220; // ecx@426 | |
2633 //int v221; // edi@428 | |
890 | 2634 Player *v222; // edi@434 |
0 | 2635 char v223; // al@438 |
993 | 2636 //int v224; // ecx@442 |
2637 //int v225; // ecx@443 | |
823 | 2638 //int v226; // eax@451 |
0 | 2639 int v227; // esi@453 |
2640 unsigned int v228; // edi@454 | |
2641 int v229; // edi@466 | |
488 | 2642 //__int16 v230; // ST18_2@469 |
2643 //stru6 *v231; // eax@469 | |
2644 //signed int v232; // esi@469 | |
2645 //__int16 v233; // ST18_2@469 | |
2646 //stru6 *v234; // eax@469 | |
2647 //__int16 v235; // ST18_2@469 | |
2648 //stru6 *v236; // eax@469 | |
2649 //__int16 v237; // ST18_2@469 | |
2650 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2651 //__int16 v239; // ST1C_2@469 |
0 | 2652 char *v240; // ecx@472 |
2653 double v241; // st7@478 | |
2654 signed __int64 v242; // qax@484 | |
2655 char *v243; // ecx@484 | |
2656 char *v244; // eax@488 | |
2657 int v245; // edi@492 | |
2658 int v246; // eax@492 | |
2659 char *v247; // eax@497 | |
2660 char v248; // al@497 | |
2661 char v249; // cf@500 | |
2662 float v250; // esi@507 | |
2663 char v251; // al@507 | |
2664 int v252; // edx@510 | |
2665 int m; // esi@510 | |
2666 int v254; // eax@513 | |
2667 int v255; // esi@513 | |
2668 int v256; // ecx@513 | |
2669 int v257; // edx@514 | |
2670 int v258; // ecx@514 | |
2671 char v259; // al@516 | |
2672 int v260; // eax@518 | |
2673 int v261; // esi@519 | |
2674 int v262; // edx@521 | |
2675 int v263; // ecx@521 | |
2676 int v264; // esi@521 | |
2677 int v265; // edx@521 | |
2678 int *ii; // eax@522 | |
2679 int v267; // eax@524 | |
2680 int v268; // eax@524 | |
2681 int v269; // eax@526 | |
2682 char *v270; // eax@531 | |
2683 char v271; // al@531 | |
2684 char v272; // cf@534 | |
993 | 2685 //float v273; // esi@541 |
0 | 2686 char v274; // al@541 |
2687 int v275; // edx@544 | |
2688 int k; // esi@544 | |
2689 int v277; // edx@548 | |
2690 int v278; // ecx@548 | |
2691 char v279; // al@550 | |
2692 int v280; // eax@552 | |
2693 int v281; // esi@553 | |
2694 int v282; // edx@555 | |
2695 int v283; // ecx@555 | |
2696 int v284; // esi@555 | |
2697 int v285; // edx@555 | |
2698 int *l; // eax@556 | |
2699 int v287; // eax@558 | |
2700 int v288; // eax@558 | |
2701 ItemGen *v289; // eax@560 | |
2702 signed int v290; // eax@560 | |
2703 unsigned __int8 v291; // al@564 | |
2704 char v292; // al@573 | |
2705 int v293; // eax@575 | |
2706 ItemGen *v294; // esi@575 | |
2707 int v295; // edx@575 | |
2708 int kk; // edi@575 | |
2709 int v297; // edx@579 | |
2710 int v298; // ecx@579 | |
2711 char v299; // al@581 | |
2712 int v300; // eax@583 | |
2713 int v301; // edi@584 | |
2714 int v302; // edx@586 | |
2715 int v303; // ecx@586 | |
2716 int v304; // edi@586 | |
2717 int v305; // edx@586 | |
2718 int *jj; // eax@587 | |
2719 int v307; // eax@589 | |
2720 int v308; // eax@589 | |
2721 char *v309; // ecx@593 | |
2722 char v310; // sf@593 | |
2723 unsigned __int8 v311; // of@593 | |
2724 char v312; // cl@597 | |
488 | 2725 char v313; // al@606pGame->GetStru6() |
0 | 2726 int v314; // edx@607 |
2727 int j; // esi@607 | |
2728 unsigned int v316; // eax@613 | |
2729 const char *v317; // ecx@617 | |
2730 Player *v318; // ecx@619 | |
2731 unsigned int v319; // edi@627 | |
993 | 2732 //int v320; // ecx@629 |
2733 //int v321; // ecx@630 | |
2734 //int v322; // edi@632 | |
0 | 2735 int v323; // edi@635 |
2736 char *v324; // eax@635 | |
2737 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2738 //int v326; // eax@643 |
823 | 2739 //int v327; // eax@648 |
0 | 2740 int v328; // ecx@651 |
2741 int v329; // ecx@652 | |
2742 int v330; // edi@654 | |
488 | 2743 //__int16 v331; // ST18_2@658 |
2744 //stru6 *v332; // eax@658 | |
2745 //__int16 v333; // ST18_2@658 | |
2746 //stru6 *v334; // eax@658 | |
2747 //__int16 v335; // ST18_2@658 | |
2748 //stru6 *v336; // eax@658 | |
2749 //__int16 v337; // ST18_2@658 | |
2750 //stru6 *v338; // eax@658 | |
993 | 2751 //int v339; // ecx@659 |
2752 //int v340; // ecx@660 | |
2753 //int v341; // eax@663 | |
0 | 2754 signed int v342; // edi@668 |
2755 signed int v343; // edi@670 | |
2756 unsigned __int64 v344; // ST08_8@670 | |
488 | 2757 //__int16 v345; // ST1C_2@671 |
2758 //__int16 v346; // ST18_2@671 | |
2759 //stru6 *v347; // eax@671 | |
993 | 2760 //int v348; // ecx@672 |
2761 //int v349; // ecx@673 | |
2762 //int v350; // edi@676 | |
0 | 2763 Player *v351; // edi@680 |
488 | 2764 //__int16 v352; // ST18_2@685 |
2765 //stru6 *v353; // eax@685 | |
0 | 2766 int v354; // ecx@686 |
2767 int v355; // ecx@687 | |
2768 int v356; // eax@689 | |
112 | 2769 Player *v357; // edi@694 |
488 | 2770 //unsigned __int16 v358; // ST1C_2@695 |
2771 //__int16 v359; // ST18_2@695 | |
2772 //stru6 *v360; // eax@695 | |
2773 //__int16 v361; // ST1C_2@697 | |
2774 //__int16 v362; // ST18_2@697 | |
2775 //stru6 *v363; // eax@697 | |
0 | 2776 int v364; // ecx@698 |
2777 int v365; // ecx@699 | |
2778 int v366; // eax@701 | |
488 | 2779 //stru6 *v367; // eax@704 |
823 | 2780 //int v368; // eax@704 |
0 | 2781 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2782 //int v370; // eax@706 |
0 | 2783 int v371; // ecx@709 |
2784 int v372; // ecx@710 | |
2785 int v373; // eax@715 | |
2786 int v374; // eax@717 | |
993 | 2787 //Player *v375; // edi@717 |
0 | 2788 int v376; // eax@717 |
2789 Player *v377; // ecx@719 | |
2790 int v378; // ecx@721 | |
2791 int v379; // ecx@722 | |
2792 int v380; // eax@724 | |
2793 int v381; // edi@727 | |
2794 int v382; // ecx@727 | |
2795 Player *v383; // eax@728 | |
2796 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2797 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2798 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2799 //Player *v387; // edi@738 |
0 | 2800 int v388; // edi@740 |
488 | 2801 //unsigned __int16 v389; // ST1C_2@740 |
2802 //__int16 v390; // ST18_2@740 | |
2803 //stru6 *v391; // eax@740 | |
0 | 2804 int v392; // ecx@742 |
993 | 2805 //int v393; // ecx@743 |
2806 //int v394; // ecx@744 | |
2807 //int v395; // edi@747 | |
0 | 2808 int v396; // eax@752 |
2809 int v397; // eax@757 | |
2810 int v398; // eax@757 | |
2811 int v399; // eax@757 | |
993 | 2812 //char *v400; // esi@757 |
488 | 2813 //Game *v401; // ecx@759 |
2814 //__int16 v402; // ST1C_2@759 | |
2815 //__int16 v403; // ST18_2@759 | |
2816 //stru6 *v404; // eax@759 | |
993 | 2817 //int v405; // ecx@761 |
2818 //int v406; // ecx@762 | |
2819 //int v407; // edi@765 | |
488 | 2820 //__int16 v408; // ST1C_2@769 |
2821 //__int16 v409; // ST18_2@769 | |
2822 //stru6 *v410; // eax@769 | |
993 | 2823 //int v411; // ecx@772 |
2824 //int v412; // ecx@773 | |
2825 //int v413; // edi@775 | |
488 | 2826 //__int16 v414; // ST1C_2@781 |
2827 //__int16 v415; // ST18_2@781 | |
2828 //stru6 *v416; // eax@781 | |
0 | 2829 int v417; // eax@787 |
2830 int v418; // ecx@789 | |
2831 __int16 v419; // ax@791 | |
2832 signed int v420; // eax@793 | |
2833 int v421; // edx@793 | |
2834 const char *v422; // eax@801 | |
2835 int v423; // ecx@808 | |
2836 int v424; // ecx@809 | |
2837 int v425; // eax@811 | |
2838 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2839 //signed int v427; // eax@820 |
0 | 2840 int v428; // ecx@825 |
2841 int v429; // ecx@826 | |
2842 int v430; // eax@828 | |
488 | 2843 //stru6 *v431; // eax@831 |
823 | 2844 //int v432; // eax@831 |
0 | 2845 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2846 //int v434; // eax@833 |
0 | 2847 int v435; // ecx@837 |
2848 int v436; // ecx@838 | |
488 | 2849 //__int16 v437; // ST1C_2@843 |
2850 //__int16 v438; // ST18_2@843 | |
2851 //stru6 *v439; // eax@843 | |
0 | 2852 int v440; // eax@843 |
2853 int v441; // eax@847 | |
993 | 2854 //int v442; // ecx@850 |
2855 //int v443; // ecx@851 | |
2856 //int v444; // eax@853 | |
0 | 2857 signed int v445; // edi@857 |
2858 int v446; // ecx@862 | |
2859 LevelDecoration *v447; // edi@864 | |
2860 __int16 v448; // ax@864 | |
2861 char *v449; // esi@870 | |
2862 int v450; // eax@870 | |
993 | 2863 //int v451; // ecx@875 |
2864 //int v452; // ecx@876 | |
2865 //int v453; // edi@878 | |
488 | 2866 //__int16 v454; // ST1C_2@884 |
2867 //__int16 v455; // ST18_2@884 | |
2868 //stru6 *v456; // eax@884 | |
0 | 2869 int v457; // ecx@887 |
2870 int v458; // ecx@888 | |
2871 int v459; // eax@890 | |
2872 signed int v460; // eax@895 | |
2873 Actor *v461; // eax@897 | |
2874 unsigned __int16 v462; // cx@897 | |
2875 signed int v463; // edx@897 | |
993 | 2876 //int v464; // ecx@905 |
2877 //int v465; // ecx@906 | |
2878 //int v466; // edi@909 | |
488 | 2879 //__int16 v467; // ST1C_2@913 |
2880 //__int16 v468; // ST18_2@913 | |
2881 //stru6 *v469; // eax@913 | |
0 | 2882 int v470; // edi@913 |
2883 int v471; // eax@917 | |
2884 int v472; // eax@917 | |
993 | 2885 //char *v473; // esi@918 |
488 | 2886 //__int16 v474; // ST18_2@920 |
2887 //stru6 *v475; // eax@920 | |
2888 //__int16 v476; // ST18_2@920 | |
2889 //stru6 *v477; // eax@920 | |
2890 //__int16 v478; // ST18_2@920 | |
2891 //stru6 *v479; // eax@920 | |
2892 //__int16 v480; // ST18_2@920 | |
2893 //stru6 *v481; // eax@920 | |
2894 //__int16 v482; // ST18_2@923 | |
2895 //stru6 *v483; // eax@923 | |
2896 //__int16 v484; // ST18_2@923 | |
2897 //stru6 *v485; // eax@923 | |
2898 //__int16 v486; // ST18_2@923 | |
2899 //stru6 *v487; // eax@923 | |
2900 //__int16 v488; // ST18_2@923 | |
2901 //stru6 *v489; // eax@923 | |
2902 //__int16 v490; // ST1C_2@924 | |
2903 //__int16 v491; // ST18_2@924 | |
2904 //stru6 *v492; // eax@924 | |
0 | 2905 int v493; // ecx@925 |
2906 int v494; // ecx@926 | |
488 | 2907 //__int16 v495; // ST1C_2@931 |
2908 //__int16 v496; // ST18_2@931 | |
2909 //stru6 *v497; // eax@931 | |
0 | 2910 int v498; // edi@931 |
2911 int v499; // eax@935 | |
2912 int v500; // eax@935 | |
2913 Player *v501; // edi@939 | |
488 | 2914 //__int16 v502; // ST18_2@940 |
2915 //stru6 *v503; // eax@940 | |
2916 //stru6 *v504; // eax@943 | |
0 | 2917 int v505; // eax@943 |
823 | 2918 //int v506; // eax@943 |
0 | 2919 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2920 //int v508; // eax@944 |
0 | 2921 signed int v509; // eax@944 |
2922 signed int v510; // edi@944 | |
2923 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2924 //int v512; // eax@946 |
0 | 2925 SpellBuff *v513; // edi@946 |
2926 int v514; // ecx@950 | |
993 | 2927 //int v515; // ecx@951 |
0 | 2928 int v516; // eax@953 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2929 //int v517; // eax@956 |
90 | 2930 Actor *v518; // edx@957 |
0 | 2931 __int16 v519; // cx@958 |
993 | 2932 //int v520; // ecx@968 |
2933 //int v521; // ecx@969 | |
2934 //int v522; // eax@971 | |
488 | 2935 //__int16 v523; // ST18_2@975 |
2936 //stru6 *v524; // eax@975 | |
2937 //__int16 v525; // ST18_2@975 | |
2938 //stru6 *v526; // eax@975 | |
2939 //__int16 v527; // ST18_2@975 | |
2940 //stru6 *v528; // eax@975 | |
2941 //__int16 v529; // ST18_2@975 | |
2942 //stru6 *v530; // eax@975 | |
0 | 2943 int v531; // eax@982 |
823 | 2944 //int v532; // eax@982 |
0 | 2945 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2946 //int v534; // eax@983 |
0 | 2947 signed int v535; // eax@983 |
2948 signed int v536; // edi@983 | |
2949 stru6 *v537; // eax@984 | |
2950 int v538; // ecx@985 | |
2951 int v539; // ecx@986 | |
2952 int v540; // eax@988 | |
488 | 2953 //__int16 v541; // ST18_2@991 |
2954 //stru6 *v542; // eax@991 | |
2955 //__int16 v543; // ST18_2@991 | |
2956 //stru6 *v544; // eax@991 | |
2957 //__int16 v545; // ST18_2@991 | |
2958 //stru6 *v546; // eax@991 | |
2959 //__int16 v547; // ST18_2@991 | |
993 | 2960 //stru6 *v548; // eax@991 |
0 | 2961 double v549; // st7@991 |
2962 unsigned __int16 v550; // di@991 | |
2963 int v551; // ecx@993 | |
993 | 2964 //int v552; // ecx@994 |
89 | 2965 Player *v553; // edi@1001 |
488 | 2966 //__int16 v554; // ST18_2@1002 |
2967 //stru6 *v555; // eax@1002 | |
2968 //__int16 v556; // ST18_2@1002 | |
2969 //stru6 *v557; // eax@1002 | |
2970 //__int16 v558; // ST18_2@1002 | |
2971 //stru6 *v559; // eax@1002 | |
2972 //__int16 v560; // ST18_2@1002 | |
2973 //stru6 *v561; // eax@1002 | |
0 | 2974 unsigned __int16 v562; // di@1005 |
2975 signed int v563; // eax@1010 | |
2976 unsigned int v564; // ecx@1011 | |
2977 signed int v565; // eax@1012 | |
2978 Player **v566; // ecx@1012 | |
2979 int v567; // eax@1012 | |
488 | 2980 //unsigned __int16 v568; // ST1C_2@1012 |
2981 //__int16 v569; // ST18_2@1012 | |
2982 //stru6 *v570; // eax@1012 | |
0 | 2983 Player *v571; // eax@1013 |
2984 char *v572; // ecx@1013 | |
2985 int v573; // ecx@1017 | |
2986 int v574; // ecx@1018 | |
2987 int v575; // eax@1020 | |
2988 signed int v576; // eax@1025 | |
2989 Player *v577; // eax@1026 | |
2990 int v578; // eax@1028 | |
2991 __int16 v579; // ax@1029 | |
823 | 2992 //int v580; // eax@1031 |
0 | 2993 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2994 //int v582; // eax@1031 |
488 | 2995 //__int16 v583; // ST1C_2@1034 |
2996 //__int16 v584; // ST18_2@1034 | |
0 | 2997 char *v585; // esi@1034 |
488 | 2998 //stru6 *v586; // eax@1034 |
0 | 2999 signed int v587; // eax@1035 |
3000 int v588; // ecx@1036 | |
3001 int v589; // ecx@1037 | |
3002 int v590; // ecx@1038 | |
3003 char v591; // al@1048 | |
3004 int v592; // esi@1052 | |
3005 int v593; // ecx@1057 | |
993 | 3006 //int v594; // ecx@1058 |
823 | 3007 //int v595; // eax@1064 |
0 | 3008 int v596; // esi@1066 |
3009 unsigned int v597; // edi@1067 | |
3010 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3011 //signed int v599; // eax@1082 |
0 | 3012 int v600; // edi@1086 |
3013 int v601; // edx@1086 | |
3014 int v602; // eax@1086 | |
3015 int v603; // ecx@1086 | |
823 | 3016 //int v604; // eax@1087 |
0 | 3017 char *v605; // eax@1089 |
3018 int v606; // edx@1091 | |
3019 int v607; // ecx@1100 | |
3020 __int16 v608; // ax@1102 | |
3021 signed int v609; // eax@1104 | |
3022 int v610; // edi@1106 | |
3023 unsigned int v611; // eax@1106 | |
89 | 3024 Player *v612; // edi@1106 |
3025 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3026 int v614; // eax@1116 |
3027 int v615; // edi@1119 | |
488 | 3028 //__int16 v616; // ST1C_2@1122 |
3029 //__int16 v617; // ST18_2@1122 | |
3030 //stru6 *v618; // eax@1122 | |
112 | 3031 Player *v619; // edi@1123 |
488 | 3032 //unsigned __int16 v620; // ST1C_2@1124 |
3033 //__int16 v621; // ST18_2@1124 | |
3034 //stru6 *v622; // eax@1124 | |
0 | 3035 signed __int64 v623; // qax@1127 |
823 | 3036 //int v624; // eax@1127 |
0 | 3037 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3038 //int v626; // eax@1129 |
0 | 3039 signed int v627; // eax@1129 |
3040 signed int v628; // edi@1129 | |
3041 int v629; // ecx@1130 | |
3042 Player *v630; // eax@1131 | |
3043 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3044 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3045 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3046 //signed int v634; // eax@1140 |
0 | 3047 int v635; // edi@1142 |
488 | 3048 //unsigned __int16 v636; // ST1C_2@1142 |
3049 //__int16 v637; // ST18_2@1142 | |
3050 //stru6 *v638; // eax@1142 | |
3051 //stru6 *v639; // eax@1143 | |
0 | 3052 int v640; // ecx@1146 |
3053 int v641; // ecx@1147 | |
3054 int v642; // edi@1156 | |
3055 int v643; // eax@1156 | |
3056 int v644; // eax@1156 | |
3057 signed int v645; // eax@1158 | |
488 | 3058 //Player *v646; // ebx@1169 |
3059 //int v647; // edi@1169 | |
3060 //signed int v648; // ST1C_4@1170 | |
3061 //Player *v649; // ecx@1170 | |
3062 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3063 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3064 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3065 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3066 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3067 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3068 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3069 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3070 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3071 int v659; // [sp+0h] [bp-E84h]@123 |
3072 int v660; // [sp+0h] [bp-E84h]@146 | |
3073 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3074 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3075 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3076 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3077 int v665; // [sp+0h] [bp-E84h]@807 | |
3078 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3079 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3080 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3081 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3082 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3083 int v671; // [sp+4h] [bp-E80h]@146 |
3084 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3085 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3086 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3087 const char *v675; // [sp+4h] [bp-E80h]@800 |
3088 int v676; // [sp+4h] [bp-E80h]@807 | |
3089 int v677; // [sp+4h] [bp-E80h]@861 | |
993 | 3090 //int v678; // [sp+4h] [bp-E80h]@997 |
0 | 3091 int v679; // [sp+14h] [bp-E70h]@515 |
3092 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3093 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3094 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3095 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3096 int v684; // [sp+D04h] [bp-180h]@416 | |
3097 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3098 int x; // [sp+D20h] [bp-164h]@327 | |
3099 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3100 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3101 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3102 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3103 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3104 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3105 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3106 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3107 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3108 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3109 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3110 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3111 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3112 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3113 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3114 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3115 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3116 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3117 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3118 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3119 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3120 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3121 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3122 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
924 | 3123 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
0 | 3124 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3125 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3126 int n; // [sp+DA0h] [bp-E4h]@1 | |
3127 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3128 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3129 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3130 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3131 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3132 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3133 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
|
3134 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3135 int v723; // [sp+E4Ch] [bp-38h]@1 |
3136 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3137 float v725; // [sp+E54h] [bp-30h]@23 | |
3138 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3139 //int v726b; |
0 | 3140 float v727; // [sp+E5Ch] [bp-28h]@1 |
3141 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3142 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3143 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3144 Player *v730b; |
3145 ItemGen *v730c; | |
0 | 3146 int v731; // [sp+E6Ch] [bp-18h]@48 |
3147 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3148 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3149 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3150 int amount; // [sp+E80h] [bp-4h]@1 | |
3151 | |
924 | 3152 //auto ecx0 = this; |
3153 | |
3154 //v711 = ecx0; | |
3155 | |
3156 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
|
3157 //SpriteObject::SpriteObject(&a1); |
0 | 3158 |
486 | 3159 //v1 = 0; |
0 | 3160 v2 = 0; |
3161 amount = 0; | |
3162 LODWORD(v733) = 0; | |
3163 v723 = 0; | |
3164 v727 = 0.0; | |
889 | 3165 for(n = 0; n < 10; ++n) |
0 | 3166 { |
924 | 3167 pCastSpell = &this[n]; |
3168 HIDWORD(v733) = (int)pCastSpell; | |
3169 if ( pCastSpell->spellnum == 0 ) | |
889 | 3170 continue; |
486 | 3171 |
3172 if (pParty->Invisible()) | |
3173 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3174 | |
924 | 3175 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 3176 { |
924 | 3177 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3178 this->_427D48(1); | |
889 | 3179 continue; |
0 | 3180 } |
924 | 3181 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3182 | |
3183 a2 = pCastSpell->spell_target_pid; | |
3184 if (!pCastSpell->spell_target_pid) | |
0 | 3185 { |
924 | 3186 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3187 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3188 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 3189 v666 = 1; |
3190 else | |
3191 v666 = 0; | |
3192 | |
3193 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3194 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3195 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3196 a2 = pMouse->uPointingObjectID; |
0 | 3197 } |
488 | 3198 |
3199 | |
924 | 3200 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3201 if (pSpellSprite.uType) | |
0 | 3202 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3203 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3204 { |
924 | 3205 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3206 v2 = v723; |
3207 } | |
3208 else | |
3209 { | |
3210 v715.uYawAngle = pParty->sRotationY; | |
3211 v715.uPitchAngle = pParty->sRotationX; | |
3212 } | |
3213 } | |
488 | 3214 |
486 | 3215 LODWORD(v725) = 0; |
3216 _this = 0; | |
924 | 3217 if (pCastSpell->forced_spell_skill_level) |
488 | 3218 { |
924 | 3219 v11 = pCastSpell->forced_spell_skill_level; |
993 | 3220 v723 = v11 & 0x3F; // 6 bytes |
488 | 3221 v2 = v723; |
3222 } | |
3223 else | |
0 | 3224 { |
488 | 3225 //v667 = PLAYER_SKILL_STAFF; |
924 | 3226 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 3227 v667 = PLAYER_SKILL_FIRE; |
924 | 3228 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 3229 v667 = PLAYER_SKILL_AIR; |
924 | 3230 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 3231 v667 = PLAYER_SKILL_WATER; |
924 | 3232 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 3233 v667 = PLAYER_SKILL_EARTH; |
924 | 3234 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 3235 v667 = PLAYER_SKILL_SPIRIT; |
924 | 3236 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 3237 v667 = PLAYER_SKILL_MIND; |
924 | 3238 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 3239 v667 = PLAYER_SKILL_BODY; |
924 | 3240 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 3241 v667 = PLAYER_SKILL_LIGHT; |
924 | 3242 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 3243 v667 = PLAYER_SKILL_DARK; |
924 | 3244 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 3245 v667 = PLAYER_SKILL_BOW; |
3246 else assert(false && "Unknown spell"); | |
3247 | |
0 | 3248 LODWORD(v725) = v667; |
488 | 3249 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3250 v2 = v723; | |
3251 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3252 } |
488 | 3253 |
993 | 3254 v731 = SkillToMastery(v11); |
488 | 3255 |
924 | 3256 if (pCastSpell->forced_spell_skill_level) |
486 | 3257 uRequiredMana = 0; |
488 | 3258 else |
924 | 3259 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3260 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3261 |
3262 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3263 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3264 uRequiredMana = 0; |
488 | 3265 |
924 | 3266 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3267 { | |
3268 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
3269 pCastSpell->spellnum = 0; | |
3270 continue; | |
3271 } | |
3272 v730 = pCastSpell->spellnum; | |
3273 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
3274 { | |
3275 if (!pParty->bTurnBasedModeOn) | |
3276 { | |
3277 //v646 = pPlayer; | |
3278 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3279 //v647 = n; | |
3280 } | |
3281 else | |
3282 { | |
3283 //v647 = n; | |
3284 //v646 = pPlayer; | |
3285 //v648 = sRecoveryTime; | |
3286 //v649 = pPlayer; | |
3287 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
3288 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3289 pTurnEngine->_40471C(); | |
3290 } | |
3291 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3292 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3293 this[n].spellnum = 0; | |
3294 pPlayer->sMana -= uRequiredMana; | |
3295 return; | |
3296 } | |
3297 | |
3298 switch ( pCastSpell->spellnum ) | |
3299 { | |
3300 case SPELL_101: | |
3301 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3302 case SPELL_BOW_ARROW: | |
3303 { | |
998 | 3304 //v17 = pPlayer; |
924 | 3305 _this = (ItemGen *)1; |
3306 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3307 _this = (ItemGen *)2; | |
998 | 3308 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); |
924 | 3309 pSpellSprite.stru_24.Reset(); |
3310 pSpellSprite.spell_level = v2; | |
3311 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3312 pSpellSprite.spell_skill = v731; | |
3313 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
998 | 3314 if ( pPlayer->WearsItem(510, 2) ) |
924 | 3315 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); |
3316 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3317 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3318 pSpellSprite.uAttributes = 0; | |
3319 pSpellSprite.uSpriteFrameID = 0; | |
3320 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3321 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3322 pSpellSprite.spell_target_pid = a2; | |
3323 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3324 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3325 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3326 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
3327 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
3328 pSpellSprite.uAttributes = 256; | |
3329 if ( pParty->bTurnBasedModeOn == 1 ) | |
3330 pSpellSprite.uAttributes = 260; | |
3331 for ( i = 0; i < (signed int)_this; ++i ) | |
3332 { | |
3333 if ( i ) | |
3334 pSpellSprite.vPosition.z += 32; | |
3335 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3336 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3337 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3338 ++pTurnEngine->field_1C; | |
3339 } | |
3340 break; | |
3341 } | |
3342 case SPELL_LASER_PROJECTILE: | |
3343 { | |
3344 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3345 pSpellSprite.stru_24.Reset(); | |
3346 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3347 pSpellSprite.spell_level = v723; | |
3348 pSpellSprite.spell_skill = v731; | |
3349 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3350 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3351 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3352 pSpellSprite.uAttributes = 0; | |
3353 pSpellSprite.uSpriteFrameID = 0; | |
3354 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3355 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3356 pSpellSprite.spell_target_pid = a2; | |
3357 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3358 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3359 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3360 memcpy(&pSpellSprite.stru_24, | |
3361 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3362 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3363 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3364 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3365 pSpellSprite.uSectorID = v23; | |
889 | 3366 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3367 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3368 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3369 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3370 ++pTurnEngine->field_1C; |
924 | 3371 break; |
3372 } | |
3373 case SPELL_FIRE_TORCH_LIGHT: | |
3374 { | |
889 | 3375 LODWORD(v733) = 3600 * v2; |
3376 | |
3377 switch (v731) | |
3378 { | |
890 | 3379 case 1: amount = 2; break; |
3380 case 2: amount = 3; break; | |
3381 case 3: | |
3382 case 4: amount = 4; break; | |
3383 default: | |
889 | 3384 assert(false); |
3385 } | |
3386 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3387 break; |
889 | 3388 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3389 LODWORD(v727) = 1; | |
890 | 3390 break; |
924 | 3391 } |
3392 case SPELL_FIRE_FIRE_SPIKE: | |
3393 { | |
890 | 3394 v29 = v731 - 2; |
3395 if ( v29 ) | |
3396 { | |
3397 v30 = v29 - 1; | |
3398 if ( v30 ) | |
3399 { | |
3400 if ( v30 == 1 ) | |
3401 amount = 9; | |
3402 else | |
3403 amount = 3; | |
889 | 3404 } |
3405 else | |
3406 { | |
890 | 3407 amount = 7; |
3408 } | |
3409 } | |
3410 else | |
3411 { | |
3412 amount = 5; | |
3413 } | |
3414 //v31 = v3->uPlayerID; | |
3415 //v32 = 8 * v31; | |
3416 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3417 | |
3418 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3419 int _v733 = 0; | |
3420 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3421 { | |
3422 auto object = pSpriteObjects + i; | |
924 | 3423 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
890 | 3424 ++_v733; |
3425 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3426 v730 = uNumSpriteObjects; | |
3427 do | |
3428 { | |
3429 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3430 ++HIDWORD(v733); | |
3431 v33 += 112; | |
3432 --v730; | |
3433 } | |
3434 while ( v730 );*/ | |
3435 } | |
3436 if (_v733 > amount) | |
3437 { | |
3438 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3439 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3440 pCastSpell->spellnum = 0; |
890 | 3441 continue; |
3442 } | |
3443 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3444 break; | |
924 | 3445 pSpellSprite.stru_24.Reset(); |
3446 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3447 pSpellSprite.spell_level = v2; | |
3448 pSpellSprite.spell_skill = v731; | |
3449 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3450 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3451 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3452 pSpellSprite.uAttributes = 0; | |
3453 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3454 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3455 pSpellSprite.uSpriteFrameID = 0; | |
3456 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3457 pSpellSprite.spell_target_pid = a2; | |
3458 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3459 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3460 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 3461 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3462 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3463 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3464 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 3465 ++pTurnEngine->field_1C; |
3466 LODWORD(v727) = 1; | |
3467 break; | |
924 | 3468 } |
3469 case SPELL_AIR_IMPLOSION: | |
3470 { | |
890 | 3471 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3472 break; | |
3473 if (!a2) | |
3474 { | |
3475 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3476 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3477 pCastSpell->spellnum = 0; |
890 | 3478 continue; |
3479 } | |
3480 if (PID_TYPE(a2) != OBJECT_Actor) | |
3481 { | |
889 | 3482 LODWORD(v727) = 1; |
890 | 3483 break; |
3484 } | |
3485 v697.x = 0; | |
3486 v697.y = 0; | |
3487 v697.z = 0; | |
924 | 3488 pSpellSprite.stru_24.Reset(); |
3489 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3490 pSpellSprite.spell_level = v2; | |
3491 pSpellSprite.spell_skill = v731; | |
3492 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3493 pSpellSprite.uAttributes = 0; | |
3494 pSpellSprite.uSectorID = 0; | |
3495 pSpellSprite.uSpriteFrameID = 0; | |
3496 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3497 pSpellSprite.uFacing = 0; | |
3498 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3499 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3500 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3501 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3502 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3503 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3504 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3505 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3506 LODWORD(v727) = 1; | |
3507 break; | |
924 | 3508 } |
3509 case SPELL_EARTH_MASS_DISTORTION: | |
3510 { | |
890 | 3511 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3512 break; | |
3513 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3514 { | |
3515 LODWORD(v727) = 1; | |
3516 break; | |
3517 } | |
3518 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3519 v704.x = 0; | |
3520 v704.y = 0; | |
3521 v704.z = 0; | |
924 | 3522 pSpellSprite.stru_24.Reset(); |
3523 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3524 pSpellSprite.spell_level = v2; | |
3525 pSpellSprite.spell_skill = v731; | |
3526 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3527 pSpellSprite.uAttributes = 0; | |
3528 pSpellSprite.uSectorID = 0; | |
3529 pSpellSprite.uSpriteFrameID = 0; | |
3530 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3531 pSpellSprite.uFacing = 0; | |
3532 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3533 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3534 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3535 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3536 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3537 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3538 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3539 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3540 LODWORD(v727) = 1; | |
3541 break; | |
924 | 3542 } |
3543 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3544 { | |
890 | 3545 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3546 break; | |
3547 //v730 = a2 >> 3; | |
3548 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3549 v691.x = 0; | |
3550 v691.y = 0; | |
3551 v691.z = 0; | |
924 | 3552 pSpellSprite.stru_24.Reset(); |
3553 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3554 pSpellSprite.spell_level = v2; | |
3555 pSpellSprite.spell_skill = v731; | |
3556 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3557 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3558 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3559 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3560 pSpellSprite.uAttributes = 0; | |
3561 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3562 pSpellSprite.uSpriteFrameID = 0; | |
3563 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3564 pSpellSprite.spell_target_pid = a2; | |
3565 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3566 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3567 pSpellSprite.uAttributes |= 0x80u; | |
3568 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3569 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3570 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3571 { | |
3572 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3573 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3574 pCastSpell->spellnum = 0; |
890 | 3575 continue; |
3576 } | |
3577 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3578 LODWORD(v727) = 1; | |
3579 break; | |
924 | 3580 } |
3581 case SPELL_FIRE_FIRE_BOLT: | |
3582 case SPELL_FIRE_FIREBALL: | |
3583 case SPELL_FIRE_INCINERATE: | |
3584 case SPELL_AIR_LIGHNING_BOLT: | |
3585 case SPELL_WATER_ICE_BOLT: | |
3586 case SPELL_WATER_ICE_BLAST: | |
3587 case SPELL_EARTH_STUN: | |
3588 case SPELL_EARTH_DEADLY_SWARM: | |
3589 case SPELL_MIND_MIND_BLAST: | |
3590 case SPELL_MIND_PSYCHIC_SHOCK: | |
3591 case SPELL_BODY_HARM: | |
3592 case SPELL_LIGHT_LIGHT_BOLT: | |
3593 case SPELL_DARK_DRAGON_BREATH: | |
3594 { | |
889 | 3595 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3596 break; |
924 | 3597 pSpellSprite.stru_24.Reset(); |
3598 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3599 pSpellSprite.spell_level = v2; | |
3600 pSpellSprite.spell_skill = v731; | |
3601 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3602 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3603 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3604 pSpellSprite.uAttributes = 0; | |
3605 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3606 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3607 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3608 else | |
3609 pSpellSprite.uSectorID = 0; | |
3610 pSpellSprite.uSpriteFrameID = 0; | |
3611 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3612 pSpellSprite.spell_target_pid = a2; | |
3613 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3614 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3615 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3616 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3617 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3618 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3619 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3620 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3621 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3622 ++pTurnEngine->field_1C; |
3623 LODWORD(v727) = 1; | |
890 | 3624 break; |
924 | 3625 } |
3626 case SPELL_WATER_ACID_BURST: | |
3627 case SPELL_EARTH_BLADES: | |
3628 case SPELL_BODY_FLYING_FIST: | |
3629 case SPELL_DARK_TOXIC_CLOUD: | |
3630 { | |
889 | 3631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3632 break; |
924 | 3633 pSpellSprite.stru_24.Reset(); |
3634 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3635 pSpellSprite.spell_level = v2; | |
3636 pSpellSprite.spell_skill = v731; | |
3637 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3638 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3639 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3640 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3641 v660 = pParty->vPosition.y; | |
993 | 3642 pSpellSprite.uAttributes = 0; |
3643 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3644 pSpellSprite.vPosition.z = v51; | |
3645 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3646 pSpellSprite.uSpriteFrameID = 0; | |
3647 pSpellSprite.uSectorID = v52; | |
3648 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3649 pSpellSprite.spell_target_pid = a2; | |
3650 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3651 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3652 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3653 if ( pParty->bTurnBasedModeOn == 1 ) | |
3654 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3655 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3656 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3657 ++pTurnEngine->field_1C; | |
3658 LODWORD(v727) = 1; | |
3659 break; | |
924 | 3660 } |
3661 case SPELL_LIGHT_SUNRAY: | |
3662 { | |
889 | 3663 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
890 | 3664 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3665 { | |
3666 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3667 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3668 pCastSpell->spellnum = 0; |
890 | 3669 continue; |
889 | 3670 } |
3671 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3672 { |
3673 pSpellSprite.stru_24.Reset(); | |
3674 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3675 pSpellSprite.spell_skill = v731; | |
3676 pSpellSprite.spell_level = v2; | |
3677 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3678 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3679 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3680 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3681 v660 = pParty->vPosition.y; | |
993 | 3682 pSpellSprite.uAttributes = 0; |
3683 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3684 pSpellSprite.vPosition.z = v51; | |
3685 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3686 pSpellSprite.uSpriteFrameID = 0; | |
3687 pSpellSprite.uSectorID = v52; | |
3688 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3689 pSpellSprite.spell_target_pid = a2; | |
3690 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3691 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3692 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3693 if ( pParty->bTurnBasedModeOn == 1 ) | |
3694 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3695 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3696 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3697 ++pTurnEngine->field_1C; | |
3698 LODWORD(v727) = 1; | |
924 | 3699 } |
3700 break; | |
3701 } | |
3702 case SPELL_LIGHT_PARALYZE: | |
3703 { | |
890 | 3704 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3705 break; | |
924 | 3706 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3707 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
890 | 3708 { |
3709 LODWORD(v727) = 1; | |
3710 break; | |
3711 } | |
3712 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3713 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3714 v55 = v721; | |
3715 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3716 *(char *)(v55 + 38) |= 8u; | |
3717 *(short *)(v55 + 148) = 0; | |
3718 v672 = 0; | |
3719 *(short *)(v55 + 150) = 0; | |
3720 v661 = (Actor *)v55; | |
993 | 3721 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); |
3722 LODWORD(v727) = 1; | |
3723 break; | |
924 | 3724 } |
3725 case SPELL_EARTH_SLOW: | |
3726 { | |
889 | 3727 if ( v731 == 2 ) |
3728 { | |
890 | 3729 v57 = 300 * v2; |
993 | 3730 amount = 2; |
3731 } | |
3732 else if ( v731 == 3 ) | |
3733 { | |
889 | 3734 amount = 4; |
3735 v57 = 300 * v2; | |
993 | 3736 } |
3737 else if ( v731 == 4 ) | |
3738 { | |
889 | 3739 v57 = 300 * v2; |
3740 amount = 8; | |
993 | 3741 } |
3742 else | |
3743 { | |
890 | 3744 v57 = 180 * v2; |
993 | 3745 amount = 2; |
3746 } | |
3747 // LABEL_174: | |
889 | 3748 LODWORD(v733) = v57; |
3749 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3750 break; |
889 | 3751 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3752 || (v721 = 836 * PID_ID(a2), |
3753 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3754 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3755 { | |
3756 LODWORD(v727) = 1; | |
3757 break; | |
889 | 3758 } |
3759 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3760 v59 = v721; | |
3761 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3762 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
890 | 3763 v731, |
3764 amount, | |
3765 0, | |
3766 0); | |
889 | 3767 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3768 v672 = 0; | |
3769 v661 = (Actor *)LODWORD(v718); | |
993 | 3770 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); |
3771 LODWORD(v727) = 1; | |
3772 break; | |
924 | 3773 } |
3774 case SPELL_MIND_CHARM: | |
3775 { | |
890 | 3776 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3777 break; | |
3778 | |
3779 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3780 { | |
3781 LODWORD(v727) = 1; | |
3782 break; | |
3783 } | |
3784 | |
3785 uint power = 300 * v2; | |
3786 if ( v731 == 2 ) | |
3787 { | |
3788 power = 600 * v2; | |
3789 } | |
3790 else if ( v731 == 3 ) | |
3791 power = 29030400; | |
3792 | |
3793 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3794 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3795 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3796 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3797 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3798 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3799 v731, 0, 0, 0); | |
924 | 3800 pSpellSprite.stru_24.Reset(); |
3801 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3802 pSpellSprite.spell_level = v2; | |
3803 pSpellSprite.spell_skill = v731; | |
3804 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3805 v61 = PID_ID(a2); |
993 | 3806 v600 = pActors[v61].vPosition.y; |
3807 v601 = pActors[v61].vPosition.x; | |
3808 pSpellSprite.uObjectDescID = v60; | |
3809 pSpellSprite.vPosition.x = v601; | |
3810 v602 = pActors[v61].uActorHeight; | |
3811 v603 = pActors[v61].vPosition.z; | |
3812 pSpellSprite.vPosition.y = v600; | |
3813 v676 = v603 + v602; | |
3814 v665 = v600; | |
3815 pSpellSprite.vPosition.z = v603 + v602; | |
3816 v657 = v601; | |
3817 pSpellSprite.uAttributes = 0; | |
3818 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
3819 pSpellSprite.uSpriteFrameID = 0; | |
3820 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3821 pSpellSprite.spell_target_pid = a2; | |
3822 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3823 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3824 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
3825 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3826 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
3827 LODWORD(v727) = 1; | |
3828 break; | |
924 | 3829 } |
3830 case SPELL_DARK_SHRINKING_RAY: | |
3831 { | |
889 | 3832 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3833 break; |
924 | 3834 pSpellSprite.stru_24.Reset(); |
3835 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3836 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3837 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3838 pSpellSprite.uAttributes = 0; | |
3839 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3840 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3841 pParty->vPosition.x, |
3842 pParty->vPosition.y, | |
3843 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3844 pSpellSprite.uSpriteFrameID = 0; |
3845 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3846 pSpellSprite.spell_target_pid = a2; | |
3847 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3848 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3849 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3850 pSpellSprite.spell_skill = v731; | |
3851 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3852 pSpellSprite.spell_level = 300 * v2; | |
890 | 3853 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3854 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3855 | |
3856 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3857 | |
3858 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3859 ++pTurnEngine->field_1C; |
3860 LODWORD(v727) = 1; | |
890 | 3861 break; |
924 | 3862 } |
3863 case SPELL_FIRE_FIRE_AURA: | |
3864 { | |
889 | 3865 v63 = v731 - 1; |
3866 if ( !v63 ) | |
3867 { | |
890 | 3868 amount = 10; |
3869 LODWORD(v733) = 3600 * v2; | |
3870 } | |
3871 else | |
3872 { | |
889 | 3873 v64 = v63 - 1; |
3874 if ( !v64 ) | |
3875 { | |
890 | 3876 amount = 11; |
3877 LODWORD(v733) = 3600 * v2; | |
3878 } | |
3879 else | |
3880 { | |
889 | 3881 v65 = v64 - 1; |
3882 if ( !v65 ) | |
3883 { | |
890 | 3884 amount = 12; |
993 | 3885 // LABEL_195: |
890 | 3886 LODWORD(v733) = 3600 * v2; |
3887 } | |
3888 else if ( v65 == 1 ) | |
3889 { | |
3890 LODWORD(v733) = 0; | |
3891 amount = 12; | |
3892 } | |
3893 } | |
889 | 3894 } |
993 | 3895 // LABEL_196: |
889 | 3896 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3897 break; |
924 | 3898 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3899 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3900 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3901 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3902 && !v730c->Broken() | |
3903 && !v730c->uSpecEnchantmentType | |
3904 && !v730c->uEnchantmentType | |
3905 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3906 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3907 { | |
3908 v69 = v730c; | |
3909 v14 = v731 == 4; | |
3910 v730c->uSpecEnchantmentType = amount; | |
3911 if ( !v14 ) | |
889 | 3912 { |
890 | 3913 v69->uExpireTime = pParty->uTimePlayed |
3914 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3915 * 0.033333335); | |
3916 v69->uAttributes |= 8u; | |
889 | 3917 } |
890 | 3918 v69->uAttributes |= 0x10u; |
984 | 3919 _50C9A8_item_enchantment_timer = 256; |
890 | 3920 LODWORD(v727) = 1; |
3921 break; | |
889 | 3922 } |
3923 | |
3924 dword_50C9D0 = 113; | |
3925 dword_50C9D4 = 0; | |
3926 dword_50C9D8 = 1; | |
3927 | |
3928 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3929 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3930 pCastSpell->spellnum = 0; |
890 | 3931 continue; |
924 | 3932 } |
3933 case SPELL_BODY_REGENERATION: | |
3934 { | |
890 | 3935 v70 = v731 - 1; |
3936 LODWORD(v733) = 3600 * v2; | |
3937 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3938 { | |
3939 v72 = v71 - 1; | |
3940 if ( v72 ) | |
3941 { | |
3942 if ( v72 == 1 ) | |
3943 amount = 10; | |
889 | 3944 } |
3945 else | |
3946 { | |
890 | 3947 amount = 3; |
3948 } | |
3949 } | |
3950 else | |
3951 { | |
3952 amount = 1; | |
3953 } | |
3954 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3955 break; | |
3956 | |
924 | 3957 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3958 | |
3959 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 | 3960 LODWORD(v727) = 1; |
3961 break; | |
924 | 3962 } |
3963 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3964 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3965 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3966 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3967 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3968 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3969 { | |
3970 LODWORD(v733) = 3600 * v2; | |
993 | 3971 if ( v731 > 0 && v731 <= 4) |
3972 { | |
3973 amount = v731 * v2; | |
3974 } | |
3975 //LABEL_232: | |
924 | 3976 //v80 = v3->spellnum; |
3977 switch (pCastSpell->spellnum) | |
3978 { | |
3979 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3980 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3981 break; | |
3982 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3983 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3984 break; | |
3985 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3986 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3987 break; | |
3988 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3989 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3990 break; | |
3991 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3992 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3993 break; | |
3994 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3995 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3996 break; | |
3997 default: | |
3998 assert(false); | |
3999 continue; | |
4000 } | |
4001 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4002 break; | |
4003 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4004 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4005 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4007 v90 = (double)(signed int)v733 * 4.2666669; | |
4008 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4009 LODWORD(v727) = 1; | |
4010 break; | |
4011 } | |
4012 case SPELL_FIRE_HASTE: | |
4013 { | |
993 | 4014 if ( v731 == 1 || v731 == 2 ) |
4015 { | |
4016 LODWORD(v733) = 60 * (v2 + 60); | |
4017 } | |
4018 else if ( v731 == 3 ) | |
4019 { | |
4020 LODWORD(v733) = 180 * (v2 + 20); | |
4021 } | |
4022 else if ( v731 == 4 ) | |
4023 { | |
4024 LODWORD(v733) = 240 * (v2 + 15); | |
4025 } | |
889 | 4026 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
4027 { | |
890 | 4028 v92 = pParty->pPlayers;//[0].pConditions[1]; |
4029 LODWORD(v727) = 1; | |
4030 do | |
4031 { | |
993 | 4032 if ( v92->pConditions ) |
4033 LODWORD(v727) = 0; | |
4034 ++v92; | |
890 | 4035 } |
4036 while ( v92 <= &pParty->pPlayers[3] ); | |
4037 if (LODWORD(v727)) | |
4038 { | |
993 | 4039 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4040 | |
4041 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4042 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4043 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4044 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4045 } |
4046 } | |
4047 break; | |
924 | 4048 } |
4049 case SPELL_SPIRIT_BLESS: | |
4050 { | |
993 | 4051 if ( v731 == 1 || v731 == 2 ) |
4052 { | |
4053 LODWORD(v733) = 300 * (v2 + 12); | |
4054 } | |
4055 else if ( v731 == 3 ) | |
4056 { | |
4057 LODWORD(v733) = 900 * (v2 + 4); | |
4058 } | |
4059 else if ( v731 == 4 ) | |
4060 { | |
4061 LODWORD(v733) = 3600 * (v2 + 1); | |
4062 } | |
4063 // LABEL_269: | |
889 | 4064 amount = v2 + 5; |
4065 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4066 break; |
889 | 4067 if ( v731 == 1 ) |
4068 { | |
924 | 4069 v108 = pCastSpell->uPlayerID_2; |
4070 v109 = pCastSpell->spellnum; | |
890 | 4071 v110 = pGame->GetStru6(); |
4072 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 4073 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 4074 //v668 = 0; |
4075 v716 = v111; | |
4076 //v658 = v111; | |
4077 //v653 = amount; | |
4078 //v651 = 1; | |
4079 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4080 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
889 | 4081 //LABEL_103: |
4082 //HIDWORD(v650) = HIDWORD(v28); | |
4083 //LABEL_104: | |
4084 //LODWORD(v650) = v28; | |
924 | 4085 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 | 4086 LODWORD(v727) = 1; |
890 | 4087 break; |
889 | 4088 } |
4089 v105 = 0; | |
4090 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4091 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4092 do | |
4093 { | |
924 | 4094 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 4095 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4096 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4097 ++v730b; | |
4098 ++v105; | |
889 | 4099 } |
4100 while ( v730b <= &pParty->pPlayers[3] ); | |
4101 LODWORD(v727) = 1; | |
890 | 4102 break; |
4103 } | |
4104 case SPELL_SPIRIT_SPIRIT_LASH: | |
4105 { | |
889 | 4106 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4107 { | |
890 | 4108 //v730 = a2 >> 3; |
4109 v112 = &pActors[PID_ID(a2)]; | |
4110 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4111 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4112 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4113 _this = (ItemGen *)v113; | |
4114 v114 = v721; | |
4115 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4116 if ( v113 < v721 ) | |
4117 { | |
889 | 4118 v116 = v113; |
4119 v113 = v721; | |
4120 v114 = v116; | |
890 | 4121 } |
4122 if ( v113 < (signed int)v115 ) | |
4123 { | |
889 | 4124 v117 = v113; |
4125 v113 = (int)v115; | |
4126 v115 = v117; | |
890 | 4127 } |
4128 if ( v114 < (signed int)v115 ) | |
4129 { | |
889 | 4130 v118 = v115; |
4131 v115 = v114; | |
4132 v114 = v118; | |
890 | 4133 } |
4134 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4135 if ( (double)(signed int)this <= 307.2 ) | |
4136 { | |
889 | 4137 v701.x = 0; |
4138 v701.y = 0; | |
4139 v701.z = 0; | |
924 | 4140 pSpellSprite.stru_24.Reset(); |
889 | 4141 v119 = HIDWORD(v733); |
924 | 4142 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4143 pSpellSprite.spell_level = v723; | |
4144 pSpellSprite.spell_skill = v731; | |
4145 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4146 pSpellSprite.uAttributes = 0; | |
4147 pSpellSprite.uSectorID = 0; | |
4148 pSpellSprite.uSpriteFrameID = 0; | |
4149 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4150 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4151 pSpellSprite.uFacing = 0; | |
4152 pSpellSprite.uSoundID = *(short *)(v119 + 16); | |
4153 pSpellSprite.vPosition.x = v112->vPosition.x; | |
4154 pSpellSprite.vPosition.y = v112->vPosition.y; | |
4155 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4156 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
4157 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
889 | 4158 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4159 LODWORD(v727) = 1; | |
890 | 4160 } |
4161 else | |
4162 { | |
889 | 4163 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4164 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4165 *(int *)HIDWORD(v733) = 0; | |
890 | 4166 } |
924 | 4167 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 4168 } |
4169 break; | |
4170 } | |
4171 case SPELL_AIR_SHIELD: | |
4172 case SPELL_EARTH_STONESKIN: | |
4173 case SPELL_SPIRIT_HEROISM: | |
993 | 4174 { |
4175 if( v731 == 1 || v731 == 2 ) | |
4176 { | |
4177 LODWORD(v733) = 300 * (v2 + 12); | |
4178 } | |
4179 else if ( v731 == 3 ) | |
4180 { | |
4181 LODWORD(v733) = 900 * (v2 + 4); | |
4182 } | |
4183 else if ( v731 == 4 ) | |
4184 { | |
4185 LODWORD(v733) = 3600 * (v2 + 1); | |
4186 } | |
4187 | |
4188 // LABEL_296: | |
924 | 4189 v127 = pCastSpell->spellnum; |
889 | 4190 if ( v127 == 17 ) |
4191 { | |
890 | 4192 amount = 0; |
4193 LODWORD(v725) = 14; | |
889 | 4194 } |
4195 else | |
4196 { | |
890 | 4197 if ( v127 == 38 ) |
4198 { | |
889 | 4199 LODWORD(v725) = 15; |
4200 amount = v2 + 5; | |
890 | 4201 } |
4202 else | |
4203 { | |
889 | 4204 if ( v127 != 51 ) |
890 | 4205 continue; |
889 | 4206 LODWORD(v725) = 9; |
4207 amount = v2 + 5; | |
890 | 4208 } |
889 | 4209 } |
4210 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4211 break; |
924 | 4212 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4213 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4214 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4215 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4216 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4217 //LABEL_304: | |
4218 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4219 LODWORD(v727) = 1; | |
890 | 4220 break; |
4221 } | |
4222 case SPELL_FIRE_IMMOLATION: | |
4223 { | |
993 | 4224 if ( v731 == 4 && v139 == 1 ) |
4225 LODWORD(v733) = 600 * v2; | |
889 | 4226 else |
993 | 4227 LODWORD(v733) = 60 * v2; |
889 | 4228 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4229 break; |
889 | 4230 |
924 | 4231 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4232 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4233 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4234 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4235 |
4236 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4237 LODWORD(v727) = 1; | |
890 | 4238 break; |
4239 } | |
4240 case SPELL_FIRE_METEOR_SHOWER: | |
4241 { | |
889 | 4242 v149 = v731 - 1; |
4243 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4244 { | |
890 | 4245 if ( v151 == 1 ) |
889 | 4246 _this = (ItemGen *)20; |
4247 } | |
4248 else | |
4249 { | |
890 | 4250 _this = (ItemGen *)16; |
889 | 4251 } |
4252 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4253 { | |
890 | 4254 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4255 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4256 pCastSpell->spellnum = 0; |
890 | 4257 continue; |
889 | 4258 } |
4259 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4260 break; |
889 | 4261 LODWORD(v725) = PID_TYPE(a2); |
4262 if (PID_TYPE(a2) == OBJECT_Actor) | |
4263 { | |
890 | 4264 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
4265 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4266 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4267 LODWORD(v727) = v153; | |
889 | 4268 } |
4269 else | |
4270 { | |
890 | 4271 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
4272 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4273 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4274 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4275 v154 = pParty->vPosition.z; | |
889 | 4276 } |
4277 HIDWORD(v733) = v154; | |
4278 v713 = v154 + 2500; | |
4279 v721 = 0; | |
4280 LODWORD(v718) = 0; | |
4281 if ( (signed int)_this > 0 ) | |
4282 { | |
890 | 4283 *(float *)&y = (double)SHIDWORD(v733); |
4284 *(float *)&v732 = (double)v713; | |
4285 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4286 auto _this_cpy = (int)_this; | |
4287 do | |
4288 { | |
924 | 4289 //v157 = rand(); |
889 | 4290 v158 = (double)SLODWORD(v718); |
4291 v718 = v158; | |
4292 v159 = (double)v721; | |
4293 *(float *)&v721 = v159; | |
924 | 4294 a2 = rand() % 1000; |
4295 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; | |
993 | 4296 //v725 = v159 * v159; |
889 | 4297 *(float *)&_this = v158 * v158; |
993 | 4298 //if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) |
4299 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 ) | |
889 | 4300 { |
890 | 4301 LODWORD(v687) = 0; |
4302 HIDWORD(v687) = 0; | |
889 | 4303 } |
4304 else | |
4305 { | |
993 | 4306 //x = (signed __int64)sqrt(*(float *)&_this + v725); |
4307 x = (signed __int64)sqrt(*(float *)&_this + v159 * v159); | |
890 | 4308 v687 = __PAIR__( |
4309 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4310 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
889 | 4311 } |
924 | 4312 pSpellSprite.stru_24.Reset(); |
4313 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4314 pSpellSprite.spell_level = v2; | |
4315 pSpellSprite.spell_skill = v731; | |
4316 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4317 pSpellSprite.uAttributes = 0; | |
4318 pSpellSprite.vPosition.x = uRequiredMana; | |
4319 pSpellSprite.vPosition.y = LODWORD(v727); | |
4320 pSpellSprite.uSectorID = 0; | |
4321 pSpellSprite.vPosition.z = a2 + v713; | |
4322 pSpellSprite.uSpriteFrameID = 0; | |
4323 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4324 pSpellSprite.spell_target_pid = v730; | |
4325 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4326 pSpellSprite.uFacing = v687; | |
4327 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 4328 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4329 pSpellSprite.uAttributes = 4; |
4330 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
890 | 4331 && pParty->bTurnBasedModeOn == 1 ) |
4332 ++pTurnEngine->field_1C; | |
889 | 4333 LODWORD(v718) = rand() % 1024 - 512; |
924 | 4334 //v160 = rand(); |
889 | 4335 v14 = _this_cpy-- == 1; |
924 | 4336 v721 = (unsigned __int64)(rand() % 1024) - 512; |
890 | 4337 } |
4338 while ( !v14 ); | |
889 | 4339 } |
4340 LODWORD(v727) = 1; | |
890 | 4341 break; |
4342 } | |
4343 case SPELL_FIRE_INFERNO: | |
4344 { | |
4345 //v67 = 2; | |
4346 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4347 { | |
4348 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4349 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4350 pCastSpell->spellnum = 0; |
890 | 4351 continue; |
4352 } | |
4353 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4354 break; | |
4355 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4356 v700.z = 0; | |
4357 v700.y = 0; | |
4358 v700.x = 0; | |
924 | 4359 pSpellSprite.stru_24.Reset(); |
4360 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4361 pSpellSprite.spell_level = v2; | |
4362 pSpellSprite.spell_skill = v731; | |
4363 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4364 pSpellSprite.uAttributes = 0; | |
4365 pSpellSprite.uSectorID = 0; | |
4366 pSpellSprite.uSpriteFrameID = 0; | |
4367 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4368 pSpellSprite.uFacing = 0; | |
4369 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4370 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4371 a2 = 0; |
4372 if ( (signed int)_v726 > 0 ) | |
4373 { | |
4374 do | |
4375 { | |
4376 v162 = dword_50BF30[a2]; | |
924 | 4377 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4378 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
4379 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4380 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4381 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 4382 v165 = a2; |
4383 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
924 | 4384 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
890 | 4385 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4386 a2 = v165 + 1; | |
4387 } | |
4388 while ( v165 + 1 < (signed int)_v726 ); | |
4389 } | |
4390 LODWORD(v727) = 1; | |
4391 break; | |
4392 } | |
4393 | |
4394 case SPELL_AIR_WIZARD_EYE: | |
4395 { | |
889 | 4396 LODWORD(v733) = 3600 * v2; |
4397 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4398 break; |
889 | 4399 v168 = 0; |
4400 do | |
4401 { | |
890 | 4402 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
4403 v716 = v169; | |
889 | 4404 } |
4405 while ( v168 < 4 ); | |
4406 | |
4407 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4408 LODWORD(v727) = 1; | |
890 | 4409 break; |
4410 } | |
4411 case SPELL_AIR_FEATHER_FALL: | |
4412 { | |
993 | 4413 if ( v731 == 1 ) |
4414 { | |
4415 LODWORD(v733) = 300 * v2; | |
4416 } | |
4417 else if ( v731 == 2 ) | |
4418 { | |
4419 LODWORD(v733) = 600 * v2; | |
4420 } | |
4421 else if ( v731 == 3 || v731 == 4 ) | |
4422 { | |
4423 LODWORD(v733) = 3600 * v2; | |
4424 //LABEL_353: | |
4425 //LODWORD(v733) = v173; | |
889 | 4426 } |
4427 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4428 break; |
889 | 4429 v174 = 0; |
4430 do | |
890 | 4431 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 4432 while ( v174 < 4 ); |
924 | 4433 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4434 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4435 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4436 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4437 |
4438 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); | |
4439 LODWORD(v727) = 1; | |
890 | 4440 break; |
4441 } | |
4442 case SPELL_AIR_SPARKS: | |
4443 { | |
4444 v184 = v731 - 1; | |
4445 if ( v184 ) | |
4446 { | |
4447 v185 = v184 - 1; | |
4448 if ( v185 ) | |
4449 { | |
4450 v186 = v185 - 1; | |
4451 if ( v186 ) | |
4452 { | |
4453 if ( v186 == 1 ) | |
4454 amount = 9; | |
4455 } | |
4456 else | |
4457 { | |
4458 amount = 7; | |
4459 } | |
889 | 4460 } |
4461 else | |
4462 { | |
890 | 4463 amount = 5; |
4464 } | |
4465 } | |
4466 else | |
4467 { | |
4468 amount = 3; | |
4469 } | |
4470 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4471 break; | |
4472 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
924 | 4473 pSpellSprite.stru_24.Reset(); |
4474 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4475 pSpellSprite.spell_level = v2; | |
4476 pSpellSprite.spell_skill = v731; | |
4477 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4478 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4479 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4480 pSpellSprite.uAttributes = 0; | |
4481 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4482 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 4483 pParty->vPosition.x, |
4484 pParty->vPosition.y, | |
4485 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 4486 pSpellSprite.uSpriteFrameID = 0; |
4487 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4488 pSpellSprite.spell_target_pid = a2; | |
4489 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4490 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4491 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4492 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4493 v188 = (signed int)_v726 / -2; |
4494 v189 = (signed int)_v726 / 2; | |
4495 while ( v188 <= v189 ) | |
4496 { | |
924 | 4497 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4498 if ( pSpellSprite.Create( | |
890 | 4499 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4500 v715.uPitchAngle, | |
924 | 4501 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4502 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4503 && pParty->bTurnBasedModeOn == 1 ) |
4504 ++pTurnEngine->field_1C; | |
4505 v188 += _v726 / (amount - 1); | |
4506 } | |
4507 LODWORD(v727) = 1; | |
4508 break; | |
4509 } | |
4510 | |
4511 case SPELL_AIR_JUMP: | |
4512 { | |
4513 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4514 { | |
4515 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4516 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4517 break; | |
889 | 4518 } |
4519 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4520 break; |
889 | 4521 v191 = 0; |
4522 do | |
890 | 4523 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 4524 while ( v191 < 4 ); |
4525 BYTE1(pParty->uFlags) |= 1u; | |
4526 pParty->uFallSpeed = 1000; | |
4527 LODWORD(v727) = 1; | |
890 | 4528 break; |
4529 } | |
4530 case SPELL_AIR_INVISIBILITY: | |
4531 { | |
889 | 4532 v192 = v731 - 1; |
993 | 4533 if ( v731 == 1 ) |
889 | 4534 { |
890 | 4535 amount = v2; |
993 | 4536 LODWORD(v733) = 600 * v2; |
4537 } | |
4538 else if ( v731 == 2 ) | |
889 | 4539 { |
890 | 4540 v196 = 2 * v2; |
4541 amount = v196; | |
993 | 4542 LODWORD(v733) = 600 * v2; |
4543 } | |
4544 else if ( v731 == 3 ) | |
889 | 4545 { |
890 | 4546 v196 = 3 * v2; |
924 | 4547 //goto LABEL_389; |
4548 amount = v196; | |
993 | 4549 LODWORD(v733) = 600 * v2; |
4550 } | |
4551 else if ( v731 == 4 ) | |
4552 { | |
889 | 4553 amount = 4 * v2; |
4554 v195 = 3600 * v2; | |
993 | 4555 // LABEL_392: |
889 | 4556 LODWORD(v733) = v195; |
993 | 4557 } |
4558 // LABEL_393: | |
889 | 4559 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
4560 { | |
890 | 4561 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4562 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4563 pCastSpell->spellnum = 0; |
890 | 4564 continue; |
889 | 4565 } |
4566 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4567 { | |
924 | 4568 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4569 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4570 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4571 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4572 |
4573 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4574 LODWORD(v727) = 1; | |
4575 } | |
4576 break; | |
4577 } | |
4578 case SPELL_AIR_FLY: | |
4579 { | |
4580 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4581 { | |
4582 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4583 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4584 break; | |
4585 } | |
924 | 4586 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4587 { |
4588 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4589 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4590 break; | |
4591 } | |
4592 LODWORD(v733) = 3600 * v2; | |
4593 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4594 amount = 1; | |
4595 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4596 break; | |
4597 v205 = 0; | |
4598 do | |
4599 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4600 while ( v205 < 4 ); | |
4601 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
924 | 4602 v207 = pCastSpell->uPlayerID + 1; |
890 | 4603 v716 = v206; |
4604 | |
4605 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4606 LODWORD(v727) = 1; | |
4607 break; | |
4608 } | |
4609 | |
4610 case SPELL_AIR_STARBURST: | |
4611 { | |
4612 //v67 = 2; | |
4613 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4614 { | |
4615 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4616 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4617 pCastSpell->spellnum = 0; |
890 | 4618 continue; |
4619 } | |
4620 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4621 break; | |
4622 v208 = PID_TYPE(a2); | |
4623 LODWORD(v725) = PID_TYPE(a2); | |
4624 if ( v208 == 3 ) | |
4625 { | |
4626 v209 = PID_ID(a2); | |
4627 LODWORD(v718) = pActors[v209].vPosition.x; | |
4628 v210 = pActors[v209].vPosition.y; | |
4629 v211 = pActors[v209].vPosition.z; | |
4630 v713 = v210; | |
4631 } | |
4632 else | |
4633 { | |
4634 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4635 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4636 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4637 v214 = sub_42EBBE(2048, v213); | |
4638 v211 = pParty->vPosition.z; | |
4639 v713 = pParty->vPosition.y + v214; | |
4640 v208 = LODWORD(v725); | |
4641 } | |
4642 HIDWORD(v733) = 0; | |
4643 *(float *)&v732 = (double)v211; | |
4644 LODWORD(v725) = v211 + 2500; | |
4645 v721 = 0; | |
4646 *(float *)&y = (double)(v211 + 2500); | |
4647 v730 = v208 == 3 ? a2 : 0; | |
4648 a2 = 20; | |
4649 do | |
4650 { | |
4651 v215 = rand(); | |
4652 v216 = (double)v721; | |
4653 v217 = (double)SHIDWORD(v733); | |
4654 *(float *)&uRequiredMana = v217; | |
4655 _this = (ItemGen *)(v215 % 1000); | |
4656 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4657 *(float *)&v721 = v217 * v217; | |
4658 //*(float *)&v726 = v216 * v216; | |
4659 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4660 { | |
4661 LODWORD(v685) = 0; | |
4662 HIDWORD(v685) = 0; | |
889 | 4663 } |
4664 else | |
4665 { | |
890 | 4666 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4667 v685 = __PAIR__( | |
4668 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4669 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4670 } | |
924 | 4671 pSpellSprite.stru_24.Reset(); |
4672 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4673 pSpellSprite.spell_level = v2; | |
4674 pSpellSprite.spell_skill = v731; | |
4675 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4676 pSpellSprite.uAttributes = 0; | |
4677 pSpellSprite.vPosition.x = LODWORD(v718); | |
4678 pSpellSprite.vPosition.y = v713; | |
4679 pSpellSprite.uSectorID = 0; | |
4680 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4681 pSpellSprite.uSpriteFrameID = 0; | |
4682 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4683 pSpellSprite.spell_target_pid = v730; | |
921 | 4684 //__debugbreak();//çâåçäîïàä |
924 | 4685 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4686 pSpellSprite.uFacing = v685; | |
4687 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4688 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4689 pSpellSprite.uAttributes = 4; |
4690 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4691 && pParty->bTurnBasedModeOn == 1 ) | |
4692 ++pTurnEngine->field_1C; | |
890 | 4693 v721 = rand() % 1024 - 512; |
4694 v218 = rand(); | |
4695 v14 = a2-- == 1; | |
4696 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4697 } | |
4698 while ( !v14 ); | |
4699 LODWORD(v727) = 1; | |
4700 break; | |
4701 } | |
4702 | |
4703 case SPELL_WATER_AWAKEN: | |
993 | 4704 { |
4705 if ( v731 == 1 ) | |
4706 amount = 180 * v2; | |
4707 else if ( v731 == 2) | |
4708 amount = 3600 * v2; | |
4709 else if ( v731 == 3 ) | |
4710 amount = 86400 * v2; | |
4711 else if ( v731 == 4 ) | |
4712 amount = 0; | |
4713 // LABEL_433: | |
889 | 4714 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4715 break; |
4716 v222 = pParty->pPlayers; | |
4717 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4718 while ( 2 ) | |
4719 { | |
4720 if ( v731 == 4 ) | |
4721 { | |
4722 if ( v222->pConditions[2] ) | |
4723 { | |
4724 //*((int *)v222 + 4) = 0; | |
4725 //*((int *)v222 + 5) = 0; | |
4726 v222->pConditions[2] = 0; | |
4727 v222->PlaySound(SPEECH_103, 0); | |
4728 } | |
4729 } | |
4730 else | |
889 | 4731 { |
890 | 4732 v223 = v222->DiscardConditionIfLastsLongerThan( |
4733 2u, | |
4734 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4735 v222 = (Player *)HIDWORD(v733); | |
4736 if ( v223 ) | |
4737 v222->PlaySound(SPEECH_103, 0); | |
4738 } | |
4739 ++v222;// += 6972; | |
4740 HIDWORD(v733) = (int)v222; | |
4741 if ( v222 >= &pParty->pPlayers[3] ) | |
4742 { | |
4743 LODWORD(v727) = 1; | |
4744 break; | |
4745 } | |
4746 } | |
4747 } | |
4748 case SPELL_WATER_POISON_SPRAY: | |
993 | 4749 { |
4750 if ( v731 == 1 ) | |
4751 amount = 1; | |
4752 else if ( v731 == 2 ) | |
4753 amount = 3; | |
4754 else if ( v731 == 3 ) | |
890 | 4755 amount = 5; |
993 | 4756 else if ( v731 == 4 ) |
4757 amount = 7; | |
889 | 4758 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4759 break; |
4760 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4761 if ( amount == 1 ) | |
4762 { | |
924 | 4763 pSpellSprite.stru_24.Reset(); |
4764 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4765 pSpellSprite.spell_skill = v731; | |
4766 pSpellSprite.spell_level = v2; | |
4767 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4768 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4769 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4770 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4771 v660 = pParty->vPosition.y; | |
993 | 4772 // LABEL_153: |
924 | 4773 pSpellSprite.uAttributes = 0; |
4774 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4775 pSpellSprite.vPosition.z = v51; | |
890 | 4776 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4777 pSpellSprite.uSpriteFrameID = 0; |
4778 pSpellSprite.uSectorID = v52; | |
4779 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4780 pSpellSprite.spell_target_pid = a2; | |
4781 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4782 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4783 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4784 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4785 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4786 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4787 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4788 ++pTurnEngine->field_1C; | |
890 | 4789 } |
4790 else | |
4791 { | |
924 | 4792 pSpellSprite.stru_24.Reset(); |
4793 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4794 pSpellSprite.spell_level = v2; | |
4795 pSpellSprite.spell_skill = v731; | |
4796 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4797 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4798 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4799 pSpellSprite.uAttributes = 0; | |
4800 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4801 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4802 pSpellSprite.uSpriteFrameID = 0; | |
4803 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4804 pSpellSprite.spell_target_pid = a2; | |
4805 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4806 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4807 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4808 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4809 v227 = SHIDWORD(v733) / -2; |
4810 y = (char *)(SHIDWORD(v733) / 2); | |
4811 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4812 { | |
4813 v228 = v715.uYawAngle; | |
4814 do | |
4815 { | |
924 | 4816 pSpellSprite.uFacing = v227 + v228; |
4817 if ( pSpellSprite.Create( | |
890 | 4818 v227 + v228, |
4819 v715.uPitchAngle, | |
924 | 4820 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4821 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4822 && pParty->bTurnBasedModeOn == 1 ) |
4823 ++pTurnEngine->field_1C; | |
4824 v227 += SHIDWORD(v733) / (amount - 1); | |
4825 } | |
4826 while ( v227 <= (signed int)y ); | |
4827 } | |
889 | 4828 } |
4829 LODWORD(v727) = 1; | |
890 | 4830 break; |
4831 } | |
4832 case SPELL_WATER_WATER_WALK: | |
4833 { | |
924 | 4834 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4835 { |
4836 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4837 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4838 break; | |
4839 } | |
4840 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4841 v229 = 600 * v2; | |
4842 else | |
4843 v229 = 3600 * v2; | |
4844 LODWORD(v733) = v229; | |
4845 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4846 break; | |
4847 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
924 | 4848 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4849 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4850 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4851 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4852 |
4853 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4854 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4855 v731, | |
4856 amount, | |
4857 v716, | |
924 | 4858 pCastSpell->uPlayerID + 1); |
890 | 4859 if ( v731 == 4 ) |
4860 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4861 LODWORD(v727) = 1; | |
4862 break; | |
4863 } | |
4864 case SPELL_WATER_RECHARGE_ITEM: | |
4865 { | |
4866 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4867 break; | |
924 | 4868 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
890 | 4869 y = v240; |
4870 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4871 { | |
4872 dword_50C9D0 = 113; | |
4873 dword_50C9D4 = 0; | |
4874 dword_50C9D8 = 1; | |
4875 | |
4876 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4877 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4878 pCastSpell->spellnum = 0; |
890 | 4879 continue; |
4880 } | |
4881 if ( v731 == 1 || v731 == 2 ) | |
4882 { | |
4883 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4884 } | |
993 | 4885 else if ( v731 == 3 ) |
4886 { | |
890 | 4887 v241 = (double)v723 * 0.0099999998 + 0.69999999; |
993 | 4888 } |
4889 else if ( v731 == 4 ) | |
4890 { | |
890 | 4891 v241 = (double)v723 * 0.0099999998 + 0.80000001; |
993 | 4892 } |
4893 else | |
4894 { | |
4895 v241 = 0.0; | |
890 | 4896 } |
4897 if ( v241 > 1.0 ) | |
4898 v241 = 1.0; | |
993 | 4899 //LABEL_484: |
890 | 4900 v732 = (unsigned __int8)v240[25]; |
4901 v242 = (signed __int64)((double)v732 * v241); | |
4902 v243 = y; | |
4903 y[25] = v242; | |
4904 *((int *)v243 + 4) = (unsigned __int8)v242; | |
4905 if ( (unsigned __int8)v242 <= 0 ) | |
4906 { | |
4907 *(int *)v243 = 0; | |
4908 dword_50C9D0 = 113; | |
4909 dword_50C9D4 = 0; | |
4910 dword_50C9D8 = 1; | |
4911 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4912 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4913 pCastSpell->spellnum = 0; |
890 | 4914 v2 = v723; |
4915 continue; | |
4916 } | |
4917 *((int *)v243 + 5) |= 0x40u; | |
984 | 4918 _50C9A8_item_enchantment_timer = 256; |
890 | 4919 LODWORD(v727) = 1; |
4920 break; | |
4921 } | |
4922 case SPELL_WATER_ENCHANT_ITEM: | |
4923 { | |
4924 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4925 break; | |
4926 uRequiredMana = 0; | |
4927 HIDWORD(v733) = 10 * v2; | |
4928 v730 = 1; | |
924 | 4929 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 4930 if ( v731 == 1 ) |
4931 { | |
4932 v245 = (int)&v244[36 * a2 + 532]; | |
4933 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
4934 v311 = __OFSUB__(*(int *)v245, 134); | |
4935 v14 = *(int *)v245 == 134; | |
4936 v310 = *(int *)v245 - 134 < 0; | |
4937 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
4938 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
4939 { | |
4940 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
4941 { | |
4942 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
4943 { | |
4944 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
889 | 4945 { |
890 | 4946 v312 = v309[28]; |
4947 if ( v312 ) | |
4948 { | |
4949 if ( v312 != 1 ) | |
4950 { | |
4951 if ( v312 != 2 ) | |
4952 { | |
4953 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
4954 if ( !(v244[36 * a2 + 552] & 2) ) | |
4955 { | |
4956 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
4957 { | |
4958 uRequiredMana = 1; | |
4959 v730 = 0; | |
4960 } | |
4961 if ( rand() % 100 >= SHIDWORD(v733) ) | |
4962 uRequiredMana = 1; | |
4963 if (!uRequiredMana) | |
4964 { | |
4965 v313 = *(char *)(LODWORD(v725) + 28); | |
4966 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
4967 { | |
4968 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
4969 *(int *)(v245 + 4) = 0; | |
4970 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
4971 + 1]; | |
4972 ; | |
4973 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
4974 + 1] ) | |
4975 { | |
4976 ++*(int *)(v245 + 4); | |
4977 if ( j >= v314 ) | |
4978 break; | |
4979 } | |
4980 v254 = rand(); | |
4981 v255 = 10;//pItemsTable->field_116D8[17]; | |
4982 v256 = 10;//pItemsTable->field_116D8[16]; | |
993 | 4983 //LABEL_611: |
890 | 4984 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); |
993 | 4985 //LABEL_612: |
890 | 4986 _this->uItemID |= 0x20u; |
4987 | |
984 | 4988 _50C9A8_item_enchantment_timer = 256; |
890 | 4989 LODWORD(v727) = 1; |
4990 break; | |
4991 } | |
4992 } | |
993 | 4993 else |
4994 { | |
4995 //LABEL_613: | |
890 | 4996 v316 = _this->uItemID; |
4997 if ( !(BYTE1(v316) & 2) ) | |
4998 { | |
4999 LOBYTE(v316) = v316 | 2; | |
5000 _this->uItemID = v316; | |
5001 } | |
993 | 5002 } |
890 | 5003 } |
5004 } | |
5005 } | |
5006 } | |
5007 } | |
889 | 5008 } |
890 | 5009 } |
5010 } | |
993 | 5011 //LABEL_616: |
890 | 5012 if ( LODWORD(v727) == 0 ) |
5013 { | |
993 | 5014 v317 = pGlobalTXT_LocalizationStrings[428]; |
5015 if ( v730 == 0 ) | |
5016 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5017 ShowStatusBarString(v317, 2u); | |
5018 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5019 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5020 pCastSpell->spellnum = 0; | |
5021 v318->PlaySound(SPEECH_43, 0); | |
890 | 5022 } |
5023 break; | |
5024 } | |
5025 if ( v731 != 2 ) | |
5026 { | |
5027 if ( v731 == 3 ) | |
5028 { | |
993 | 5029 v245 = (int)&v244[36 * a2 + 532]; |
5030 v269 = *(int *)v245; | |
5031 if ( *(int *)v245 > 134 | |
5032 || *(int *)(v245 + 12) != 0 | |
5033 || *(int *)(v245 + 4) != 0 | |
5034 || *(int *)(v245 + 8) != 0 | |
5035 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
890 | 5036 { |
993 | 5037 if ( LODWORD(v727) == 0 ) |
5038 { | |
5039 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5040 if ( v730 == 0 ) | |
5041 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5042 ShowStatusBarString(v317, 2u); | |
5043 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5044 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5045 pCastSpell->spellnum = 0; | |
5046 v318->PlaySound(SPEECH_43, 0); | |
5047 } | |
5048 break; | |
5049 } | |
5050 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5051 LODWORD(v725) = (int)v270; | |
5052 v271 = v270[28]; | |
5053 if ( v271 && v271 != 1 && v271 != 2 ) | |
5054 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5055 else | |
5056 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5057 if ( v272 ) | |
890 | 5058 { |
993 | 5059 uRequiredMana = 1; |
5060 v730 = 0; | |
5061 } | |
5062 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5063 uRequiredMana = 1; | |
5064 if (uRequiredMana) | |
5065 { | |
5066 v316 = _this->uItemID; | |
5067 if ( !(BYTE1(v316) & 2) ) | |
5068 { | |
5069 LOBYTE(v316) = v316 | 2; | |
5070 _this->uItemID = v316; | |
5071 } | |
5072 if ( LODWORD(v727) == 0 ) | |
5073 { | |
5074 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5075 if ( v730 == 0 ) | |
5076 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5077 ShowStatusBarString(v317, 2u); | |
5078 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5079 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5080 pCastSpell->spellnum = 0; | |
5081 v318->PlaySound(SPEECH_43, 0); | |
5082 } | |
890 | 5083 break; |
5084 } | |
993 | 5085 //v273 = v725; |
5086 v274 = *(char *)(LODWORD(v725) + 28); | |
5087 if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 ) | |
890 | 5088 { |
993 | 5089 if ( rand() % 100 < 80 |
5090 //&& !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5091 && !(*(char *)(LODWORD(v725) + 28) == 0 | *(char *)(LODWORD(v725) + 28) == 1 | *(char *)(LODWORD(v725) + 28) == 2) ) | |
890 | 5092 { |
993 | 5093 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
5094 *(int *)(v245 + 4) = 0; | |
5095 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5096 ; | |
5097 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5098 + 1] ) | |
5099 { | |
5100 ++*(int *)(v245 + 4); | |
5101 if ( k >= v275 ) | |
5102 break; | |
5103 } | |
5104 v254 = rand(); | |
5105 v255 = 10;//pItemsTable->field_116D8[19]; | |
5106 v256 = 10;//pItemsTable->field_116D8[18]; | |
5107 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5108 _this->uItemID |= 0x20u; | |
5109 | |
5110 _50C9A8_item_enchantment_timer = 256; | |
5111 LODWORD(v727) = 1; | |
5112 break; | |
890 | 5113 } |
993 | 5114 v277 = pItemsTable->pSpecialEnchantments_count; |
5115 v278 = 0; | |
5116 v725 = 0.0; | |
5117 HIDWORD(v733) = 0; | |
5118 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5119 { | |
5120 v730 = (int)&v679; | |
5121 do | |
5122 { | |
5123 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5124 if ( !v279 || v279 == 1 ) | |
5125 { | |
5126 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5127 + 4] | |
5128 + v278 * 28); | |
5129 LODWORD(v725) += v280; | |
5130 if ( v280 ) | |
5131 { | |
5132 v281 = v730; | |
5133 v730 += 4; | |
5134 *(int *)v281 = HIDWORD(v733); | |
5135 } | |
5136 } | |
5137 ++HIDWORD(v733); | |
5138 ++v278; | |
5139 } | |
5140 while ( SHIDWORD(v733) < v277 ); | |
5141 } | |
5142 v282 = rand() % SLODWORD(v725); | |
5143 v283 = v679; | |
5144 *(int *)(v245 + 12) = v679; | |
5145 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5146 v285 = v282 + 1; | |
5147 if ( v284 < v285 ) | |
890 | 5148 { |
5149 for ( l = &v679; ; l = (int *)v732 ) | |
5150 { | |
5151 v287 = (int)(l + 1); | |
5152 v732 = v287; | |
5153 v288 = *(int *)v287; | |
5154 *(int *)(v245 + 12) = v288; | |
5155 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5156 + 4]; | |
5157 if ( v284 >= v285 ) | |
5158 break; | |
5159 } | |
5160 } | |
993 | 5161 ++*(int *)(v245 + 12); |
5162 _this->uItemID |= 0x20u; | |
5163 | |
5164 _50C9A8_item_enchantment_timer = 256; | |
5165 LODWORD(v727) = 1; | |
5166 break; | |
5167 } | |
889 | 5168 } |
5169 else | |
5170 { | |
993 | 5171 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5172 if ( v731 != 4 | |
5173 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5174 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5175 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5176 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5177 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
890 | 5178 { |
993 | 5179 if ( LODWORD(v727) == 0 ) |
5180 { | |
5181 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5182 if ( v730 == 0 ) | |
5183 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5184 ShowStatusBarString(v317, 2u); | |
5185 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5186 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5187 pCastSpell->spellnum = 0; | |
5188 v318->PlaySound(SPEECH_43, 0); | |
5189 } | |
5190 break; | |
5191 } | |
5192 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5193 LODWORD(v725) = (int)v247; | |
5194 v248 = v247[28]; | |
5195 if ( v248 && v248 != 1 && v248 != 2 ) | |
5196 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5197 else | |
5198 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5199 if ( v249 ) | |
890 | 5200 { |
993 | 5201 uRequiredMana = 1; |
5202 v730 = 0; | |
5203 } | |
5204 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5205 uRequiredMana = 1; | |
5206 if (uRequiredMana) | |
5207 { | |
5208 v316 = _this->uItemID; | |
5209 if ( !(BYTE1(v316) & 2) ) | |
5210 { | |
5211 LOBYTE(v316) = v316 | 2; | |
5212 _this->uItemID = v316; | |
5213 } | |
5214 if ( LODWORD(v727) == 0 ) | |
5215 { | |
5216 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5217 if ( v730 == 0 ) | |
5218 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5219 ShowStatusBarString(v317, 2u); | |
5220 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5221 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5222 pCastSpell->spellnum = 0; | |
5223 v318->PlaySound(SPEECH_43, 0); | |
5224 } | |
890 | 5225 break; |
5226 } | |
993 | 5227 v250 = v725; |
5228 v251 = *(char *)(LODWORD(v725) + 28); | |
5229 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) | |
890 | 5230 { |
993 | 5231 if ( rand() % 100 < 80 |
5232 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5233 { | |
5234 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5235 *(int *)(v245 + 4) = 0; | |
5236 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5237 ; | |
5238 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5239 + 1] ) | |
890 | 5240 { |
993 | 5241 ++*(int *)(v245 + 4); |
5242 if ( m >= v252 ) | |
5243 break; | |
5244 } | |
5245 v254 = rand(); | |
5246 v255 = 10;// pItemsTable->field_116D8[21]; | |
5247 v256 = 10;//pItemsTable->field_116D8[20]; | |
5248 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5249 _this->uItemID |= 0x20u; | |
5250 | |
5251 _50C9A8_item_enchantment_timer = 256; | |
5252 LODWORD(v727) = 1; | |
5253 break; | |
5254 } | |
5255 v257 = pItemsTable->pSpecialEnchantments_count; | |
5256 v258 = 0; | |
5257 v725 = 0.0; | |
5258 HIDWORD(v733) = 0; | |
5259 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
890 | 5260 { |
993 | 5261 v730 = (int)&v679; |
5262 do | |
5263 { | |
5264 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5265 if ( !v259 || v259 == 1 ) | |
5266 { | |
5267 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5268 + 4] | |
5269 + v258 * 28); | |
5270 LODWORD(v725) += v260; | |
5271 if ( v260 ) | |
5272 { | |
5273 v261 = v730; | |
5274 v730 += 4; | |
5275 *(int *)v261 = HIDWORD(v733); | |
5276 } | |
5277 } | |
5278 ++HIDWORD(v733); | |
5279 ++v258; | |
5280 } | |
5281 while ( SHIDWORD(v733) < v257 ); | |
890 | 5282 } |
993 | 5283 v262 = rand() % SLODWORD(v725); |
5284 v263 = v679; | |
5285 *(int *)(v245 + 12) = v679; | |
5286 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5287 v265 = v262 + 1; | |
5288 if ( v264 < v265 ) | |
5289 { | |
5290 for ( ii = &v679; ; ii = (int *)v732 ) | |
5291 { | |
5292 v267 = (int)(ii + 1); | |
5293 v732 = v267; | |
5294 v268 = *(int *)v267; | |
5295 *(int *)(v245 + 12) = v268; | |
5296 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5297 + 4]; | |
5298 if ( v264 >= v265 ) | |
5299 break; | |
5300 } | |
5301 } | |
5302 ++*(int *)(v245 + 12); | |
5303 _this->uItemID |= 0x20u; | |
5304 | |
5305 _50C9A8_item_enchantment_timer = 256; | |
5306 LODWORD(v727) = 1; | |
890 | 5307 break; |
5308 } | |
5309 } | |
5310 //v1 = 0; | |
993 | 5311 if ( LODWORD(v727) == 0 ) |
5312 { | |
5313 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5314 if ( v730 == 0 ) | |
5315 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5316 ShowStatusBarString(v317, 2u); | |
5317 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5318 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5319 pCastSpell->spellnum = 0; | |
5320 v318->PlaySound(SPEECH_43, 0); | |
5321 } | |
5322 break; | |
890 | 5323 } |
5324 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5325 _this = v289; | |
5326 v290 = v289->uItemID; | |
5327 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5328 if ( v290 > 134 | |
5329 || _this->uSpecEnchantmentType != 0 | |
5330 || _this->uEnchantmentType != 0 | |
5331 || _this->_bonus_strength != 0 | |
5332 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5333 || v291 == 1 | |
5334 || v291 == 2 | |
5335 || _this->Broken()) | |
993 | 5336 { |
5337 if ( LODWORD(v727) == 0 ) | |
5338 { | |
5339 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5340 if ( v730 == 0 ) | |
5341 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5342 ShowStatusBarString(v317, 2u); | |
5343 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5344 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5345 pCastSpell->spellnum = 0; | |
5346 v318->PlaySound(SPEECH_43, 0); | |
5347 } | |
5348 break; | |
5349 } | |
890 | 5350 if ( _this->GetValue() < 0x1C2 ) |
5351 uRequiredMana = 1; | |
5352 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5353 uRequiredMana = 1; | |
5354 if ( uRequiredMana != 0 ) | |
5355 { | |
5356 dword_50C9D0 = 113; | |
5357 dword_50C9D4 = 0; | |
5358 dword_50C9D8 = 1; | |
5359 | |
5360 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5361 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5362 pCastSpell->spellnum = 0; |
890 | 5363 continue; |
5364 } | |
5365 v292 = *(char *)(LODWORD(v725) + 28); | |
5366 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5367 { | |
889 | 5368 v2 = v723; |
5369 //v1 = 0; | |
890 | 5370 |
5371 dword_50C9D0 = 113; | |
5372 dword_50C9D4 = 0; | |
5373 dword_50C9D8 = 1; | |
5374 | |
5375 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5376 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5377 pCastSpell->spellnum = 0; |
890 | 5378 continue; |
5379 } | |
5380 if ( rand() % 100 >= 80 ) | |
5381 { | |
5382 v297 = pItemsTable->pSpecialEnchantments_count; | |
5383 v294 = _this; | |
5384 v298 = 0; | |
5385 v725 = 0.0; | |
5386 HIDWORD(v733) = 0; | |
5387 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5388 { | |
5389 v730 = (int)&v679; | |
5390 do | |
5391 { | |
5392 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5393 if ( !v299 || v299 == 1 ) | |
5394 { | |
5395 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5396 + v298 * 28); | |
5397 LODWORD(v725) += v300; | |
5398 if ( v300 ) | |
5399 { | |
5400 v301 = v730; | |
5401 v730 += 4; | |
5402 *(int *)v301 = HIDWORD(v733); | |
5403 } | |
5404 } | |
5405 ++HIDWORD(v733); | |
5406 ++v298; | |
5407 } | |
5408 while ( SHIDWORD(v733) < v297 ); | |
5409 } | |
5410 v302 = rand() % SLODWORD(v725); | |
5411 v303 = v679; | |
5412 v294->uSpecEnchantmentType = v679; | |
5413 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5414 v305 = v302 + 1; | |
5415 if ( v304 < v305 ) | |
5416 { | |
5417 for ( jj = &v679; ; jj = (int *)v732 ) | |
5418 { | |
5419 v307 = (int)(jj + 1); | |
5420 v732 = v307; | |
5421 v308 = *(int *)v307; | |
5422 v294->uSpecEnchantmentType = v308; | |
5423 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5424 if ( v304 >= v305 ) | |
5425 break; | |
5426 } | |
5427 } | |
5428 ++v294->uSpecEnchantmentType; | |
5429 } | |
5430 else | |
5431 { | |
5432 v293 = rand(); | |
5433 v294 = _this; | |
5434 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5435 _this->uEnchantmentType = 0; | |
5436 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5437 ; | |
5438 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5439 + 1] ) | |
5440 { | |
5441 ++v294->uEnchantmentType; | |
5442 if ( kk >= v295 ) | |
5443 break; | |
5444 } | |
5445 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5446 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5447 } | |
5448 v294->uAttributes |= 0x20u; | |
984 | 5449 _50C9A8_item_enchantment_timer = 256; |
890 | 5450 LODWORD(v727) = 1; |
5451 break; | |
5452 } | |
5453 case SPELL_WATER_TOWN_PORTAL: | |
5454 { | |
5455 amount = 10 * v2; | |
5456 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5457 break; | |
5458 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5459 { | |
5460 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5461 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5462 pCastSpell->spellnum = 0; |
890 | 5463 continue; |
5464 } | |
924 | 5465 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
890 | 5466 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5467 LODWORD(v727) = 1; | |
5468 break; | |
5469 } | |
5470 case SPELL_WATER_LLOYDS_BEACON: | |
5471 { | |
5472 LODWORD(v733) = 604800 * v2; | |
5473 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5474 { | |
5475 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5476 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5477 pCastSpell->spellnum = 0; |
890 | 5478 continue; |
5479 } | |
5480 v319 = uRequiredMana; | |
5481 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5482 { | |
5483 pEventTimer->Pause(); | |
961 | 5484 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); |
890 | 5485 qword_506350 = (signed int)v733; |
924 | 5486 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
890 | 5487 ::uRequiredMana = v319; |
5488 ::sRecoveryTime = sRecoveryTime; | |
924 | 5489 dword_50633C = pCastSpell->sound_id; |
5490 dword_506338 = pCastSpell->spellnum; | |
5491 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
890 | 5492 } |
5493 break; | |
5494 } | |
5495 case SPELL_EARTH_STONE_TO_FLESH: | |
5496 { | |
993 | 5497 __debugbreak(); // missing GM ? |
5498 if ( v731 == 1 || v731 == 2) | |
5499 amount = 3600 * v2; | |
5500 if ( v731 == 3 ) | |
5501 amount = 86400 * v2; | |
5502 //LABEL_634: | |
890 | 5503 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5504 break; | |
924 | 5505 v323 = pCastSpell->uPlayerID_2; |
890 | 5506 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5507 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5508 { | |
5509 LODWORD(v727) = 1; | |
5510 break; | |
5511 } | |
5512 if ( v731 == 4 ) | |
5513 { | |
5514 *(int *)v324 = 0; | |
5515 *((int *)v324 + 1) = 0; | |
5516 LODWORD(v727) = 1; | |
5517 break; | |
5518 } | |
5519 v732 = amount << 7; | |
5520 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5521 v656 = 15; | |
924 | 5522 v325 = &pParty->pPlayers[v323]; |
993 | 5523 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
5524 LODWORD(v727) = 1; | |
5525 break; | |
890 | 5526 } |
5527 case SPELL_EARTH_ROCK_BLAST: | |
5528 { | |
5529 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5530 break; | |
924 | 5531 pSpellSprite.stru_24.Reset(); |
5532 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5533 pSpellSprite.spell_level = v2; | |
5534 pSpellSprite.spell_skill = v731; | |
5535 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5536 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5537 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5538 pSpellSprite.uAttributes = 0; | |
5539 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5540 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 5541 pParty->vPosition.x, |
5542 pParty->vPosition.y, | |
5543 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 5544 pSpellSprite.uSpriteFrameID = 0; |
5545 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5546 pSpellSprite.spell_target_pid = a2; | |
5547 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5548 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5549 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5550 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5551 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5552 | |
5553 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5554 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5555 ++pTurnEngine->field_1C; |
5556 LODWORD(v727) = 1; | |
5557 break; | |
5558 } | |
5559 case SPELL_EARTH_DEATH_BLOSSOM: | |
5560 { | |
5561 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5562 { | |
5563 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5564 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5565 pCastSpell->spellnum = 0; |
890 | 5566 continue; |
5567 } | |
5568 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5569 break; | |
924 | 5570 pSpellSprite.uType = 4090; |
5571 pSpellSprite.stru_24.Reset(); | |
5572 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5573 pSpellSprite.spell_level = v2; | |
5574 pSpellSprite.spell_skill = v731; | |
5575 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5576 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5577 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5578 pSpellSprite.uAttributes = 0; | |
5579 pSpellSprite.uSectorID = 0; | |
5580 pSpellSprite.uSpriteFrameID = 0; | |
5581 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5582 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5583 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5584 pSpellSprite.spell_target_pid = a2; | |
5585 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5586 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5587 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5588 pSpellSprite.uAttributes = 4; |
5589 | |
5590 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5591 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5592 ++pTurnEngine->field_1C; |
5593 LODWORD(v727) = 1; | |
5594 break; | |
5595 } | |
5596 case SPELL_SPIRIT_DETECT_LIFE: | |
5597 { | |
5598 v328 = v731 - 2; | |
5599 if ( v328 ) | |
5600 { | |
5601 v329 = v328 - 1; | |
5602 if ( v329 && v329 != 1 ) | |
5603 v330 = 600 * v2; | |
5604 else | |
5605 v330 = 3600 * v2; | |
5606 } | |
5607 else | |
5608 { | |
5609 v330 = 1800 * v2; | |
5610 } | |
5611 LODWORD(v733) = v330; | |
5612 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5613 break; | |
924 | 5614 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5615 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5616 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5617 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 5618 |
5619 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); | |
5620 LODWORD(v727) = 1; | |
5621 break; | |
5622 } | |
5623 case SPELL_SPIRIT_FATE: | |
5624 { | |
5625 LODWORD(v733) = 300; | |
993 | 5626 if ( v731 == 1 ) |
5627 amount = v2; | |
5628 else if( v731 == 2 ) | |
5629 amount = 2 * v2; | |
5630 else if( v731 == 3 ) | |
5631 amount = 4 * v2; | |
5632 else if( v731 == 4) | |
5633 amount = 6 * v2; | |
5634 //LABEL_667: | |
890 | 5635 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5636 break; | |
924 | 5637 v342 = pCastSpell->spell_target_pid; |
890 | 5638 if ( v342 == 0 ) |
5639 { | |
924 | 5640 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5641 | |
5642 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
890 | 5643 LODWORD(v727) = 1; |
5644 break; | |
5645 } | |
5646 if (PID_TYPE(v342) == OBJECT_Actor) | |
5647 { | |
5648 v343 = PID_ID(v342); | |
5649 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5650 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5651 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5652 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5653 v672 = 0; | |
5654 v661 = &pActors[v343]; | |
993 | 5655 //LABEL_165: |
890 | 5656 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); |
5657 } | |
5658 LODWORD(v727) = 1; | |
5659 break; | |
5660 } | |
5661 case SPELL_SPIRIT_REMOVE_CURSE: | |
5662 { | |
993 | 5663 if ( v731 == 1 || v731 == 2 ) |
5664 amount = 3600 * v2; | |
5665 else if( v731 == 3) | |
5666 amount = 86400 * v2; | |
5667 else if ( v731 == 4 ) | |
890 | 5668 amount = 0; |
993 | 5669 //LABEL_679: |
890 | 5670 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5671 break; | |
924 | 5672 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5673 if ( !v351->pConditions[0] ) |
5674 { | |
5675 LODWORD(v727) = 1; | |
5676 break; | |
5677 } | |
5678 if ( v731 == 4 ) | |
5679 { | |
5680 LODWORD(v351->pConditions[0]) = 0; | |
5681 HIDWORD(v351->pConditions[0]) = 0; | |
5682 } | |
5683 else | |
5684 { | |
5685 v732 = amount << 7; | |
5686 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
924 | 5687 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
890 | 5688 { |
5689 LODWORD(v727) = 1; | |
5690 break; | |
5691 } | |
5692 } | |
924 | 5693 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 5694 LODWORD(v727) = 1; |
5695 break; | |
5696 } | |
5697 case SPELL_SPIRIT_PRESERVATION: | |
5698 { | |
5699 v354 = v731 - 2; | |
5700 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5701 v356 = 900 * (v2 + 4); | |
5702 else | |
5703 v356 = 300 * (v2 + 12); | |
5704 LODWORD(v733) = v356; | |
5705 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5706 break; | |
5707 if ( v731 == 1 || v731 == 2 ) | |
5708 { | |
924 | 5709 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5710 | |
5711 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 | 5712 LODWORD(v727) = 1; |
5713 break; | |
5714 } | |
5715 a2 = 0; | |
5716 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5717 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5718 do | |
5719 { | |
924 | 5720 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 5721 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5722 ++a2; | |
5723 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5724 } | |
5725 while ( v357 <= &pParty->pPlayers[3] ); | |
5726 LODWORD(v727) = 1; | |
5727 break; | |
5728 } | |
5729 case SPELL_SPIRIT_TURN_UNDEAD: | |
5730 { | |
5731 v364 = v731 - 2; | |
5732 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5733 v366 = 60 * (v2 + 3); | |
5734 else | |
5735 v366 = 300 * v2 + 180; | |
5736 LODWORD(v733) = v366; | |
5737 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5738 break; | |
5739 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5740 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
924 | 5741 ++pSpellSprite.uType; |
5742 pSpellSprite.stru_24.Reset(); | |
5743 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5744 pSpellSprite.spell_level = v2; | |
5745 pSpellSprite.spell_skill = v731; | |
5746 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5747 pSpellSprite.uAttributes = 0; | |
5748 pSpellSprite.uSectorID = 0; | |
5749 pSpellSprite.uSpriteFrameID = 0; | |
5750 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5751 pSpellSprite.uFacing = 0; | |
5752 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5753 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5754 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5755 { | |
5756 v369 = &pActors[dword_50BF30[a2]]; | |
5757 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5758 { | |
924 | 5759 pSpellSprite.vPosition.x = v369->vPosition.x; |
5760 pSpellSprite.vPosition.y = v369->vPosition.y; | |
5761 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5762 | |
5763 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5764 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 5765 v369->pActorBuffs[4].Apply( |
5766 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
889 | 5767 v731, 0, 0, 0); |
5768 } | |
890 | 5769 } |
5770 LODWORD(v727) = 1; | |
5771 } | |
5772 break; | |
5773 | |
5774 case SPELL_SPIRIT_RAISE_DEAD: | |
5775 { | |
5776 v371 = v731 - 2; | |
5777 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5778 amount = 0; | |
5779 else | |
5780 amount = 86400 * v2; | |
5781 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5782 break; | |
924 | 5783 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5784 v373 = pCastSpell->uPlayerID_2; | |
890 | 5785 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5786 { | |
5787 LODWORD(v727) = 1; | |
5788 break; | |
5789 } | |
5790 v14 = v731 == 4; | |
5791 pParty->pPlayers[v373].sHealth = 1; | |
5792 if ( v14 ) | |
5793 { | |
924 | 5794 v374 = pCastSpell->uPlayerID_2; |
890 | 5795 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5796 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
924 | 5797 v376 = pCastSpell->uPlayerID_2; |
890 | 5798 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5799 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5800 } | |
5801 else | |
5802 { | |
5803 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5804 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5805 0xEu, |
5806 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 5807 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5808 0xDu, |
5809 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5810 } | |
924 | 5811 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
993 | 5812 v377->SetCondition(1, 0); |
5813 LODWORD(v727) = 1; | |
5814 break; | |
890 | 5815 } |
5816 case SPELL_SPIRIT_SHARED_LIFE: | |
5817 { | |
5818 v378 = v731 - 2; | |
5819 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5820 v380 = 4 * v2; | |
5821 else | |
5822 v380 = 3 * v2; | |
5823 amount = v380; | |
5824 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5825 break; | |
5826 v381 = 0; | |
5827 HIDWORD(v733) = amount; | |
5828 v730 = 0; | |
5829 v382 = 1; | |
5830 do | |
5831 { | |
5832 v383 = pPlayers[v382]; | |
5833 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5834 v682[v381++] = v382; | |
5835 ++v382; | |
5836 } | |
5837 while ( v382 <= 4 ); | |
5838 v384 = 0; | |
5839 v730 = v381; | |
5840 if ( v381 > 0 ) | |
5841 { | |
5842 do | |
5843 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5844 while ( v384 < v381 ); | |
5845 } | |
5846 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5847 HIDWORD(v733) = 0; | |
5848 if ( v381 > 0 ) | |
5849 { | |
5850 do | |
5851 { | |
5852 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5853 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5854 v726->sHealth = v732; | |
5855 //v386 = v726->GetMaxHealth(); | |
5856 if ( v726->sHealth > v726->GetMaxHealth()) | |
5857 v726->sHealth = v726->GetMaxHealth(); | |
5858 if ( v726->sHealth > 0 ) | |
5859 { | |
5860 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5861 } | |
5862 v388 = HIDWORD(v733); | |
5863 | |
924 | 5864 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
890 | 5865 HIDWORD(v733) = v388 + 1; |
5866 } | |
5867 while ( v388 + 1 < v730 ); | |
5868 } | |
5869 LODWORD(v727) = 1; | |
5870 break; | |
5871 } | |
5872 case SPELL_SPIRIT_RESSURECTION: | |
5873 { | |
5874 v392 = v731 - 1; | |
993 | 5875 if ( v731 == 1 ) |
5876 amount = 180 * v2; | |
5877 else if ( v731 == 2 ) | |
5878 amount = 10800 * v2; | |
5879 else if ( v731 == 3 ) | |
5880 amount = 259200 * v2; | |
5881 else if ( v731 == 4 ) | |
890 | 5882 amount = 0; |
993 | 5883 //LABEL_751: |
890 | 5884 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5885 break; | |
924 | 5886 v396 = pCastSpell->uPlayerID_2; |
890 | 5887 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5888 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5889 { | |
5890 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5891 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5892 if ( v731 == 4 ) | |
5893 { | |
924 | 5894 v397 = pCastSpell->uPlayerID_2; |
890 | 5895 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5896 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
924 | 5897 v398 = pCastSpell->uPlayerID_2; |
890 | 5898 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5899 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
924 | 5900 v399 = pCastSpell->uPlayerID_2; |
890 | 5901 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5902 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5903 } | |
889 | 5904 else |
890 | 5905 { |
5906 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5907 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
890 | 5908 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5909 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
890 | 5910 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5911 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
890 | 5912 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5913 } | |
924 | 5914 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5915 | |
5916 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
5917 | |
5918 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 5919 } |
5920 LODWORD(v727) = 1; | |
5921 break; | |
5922 } | |
5923 case SPELL_MIND_CURE_PARALYSIS: | |
5924 { | |
993 | 5925 if ( v731 == 1 || v731 == 2 ) |
5926 amount = 3600 * v2; | |
5927 else if ( v731 == 4 ) | |
890 | 5928 amount = 0; |
993 | 5929 else if( v731 == 3 ) |
5930 amount = 86400 * v2; | |
5931 //LABEL_768: | |
890 | 5932 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5933 break; | |
5934 | |
924 | 5935 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5936 v323 = pCastSpell->uPlayerID_2; | |
890 | 5937 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5938 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5939 { | |
5940 LODWORD(v727) = 1; | |
5941 break; | |
5942 } | |
5943 if ( v731 == 4 ) | |
5944 { | |
5945 *(int *)v324 = 0; | |
5946 *((int *)v324 + 1) = 0; | |
889 | 5947 LODWORD(v727) = 1; |
890 | 5948 break; |
5949 } | |
5950 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5951 v656 = 12; | |
924 | 5952 v325 = &pParty->pPlayers[v323]; |
993 | 5953 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
5954 LODWORD(v727) = 1; | |
5955 break; | |
890 | 5956 } |
5957 case SPELL_MIND_REMOVE_FEAR: | |
993 | 5958 { |
5959 if( v731 == 1) | |
5960 amount = 180 * v2; | |
5961 else if( v731 == 2 ) | |
5962 amount = 3600 * v2; | |
5963 else if( v731 == 3) | |
5964 amount = 86400 * v2; | |
5965 else if( v731 == 4 ) | |
890 | 5966 amount = 0; |
993 | 5967 //LABEL_780: |
890 | 5968 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5969 break; | |
5970 | |
924 | 5971 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5972 v323 = pCastSpell->uPlayerID_2; | |
890 | 5973 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
5974 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
5975 { | |
5976 LODWORD(v727) = 1; | |
5977 break; | |
5978 } | |
5979 if ( v731 == 4 ) | |
5980 { | |
5981 *(int *)v324 = 0; | |
5982 *((int *)v324 + 1) = 0; | |
5983 LODWORD(v727) = 1; | |
5984 break; | |
5985 } | |
5986 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5987 v656 = 3; | |
924 | 5988 v325 = &pParty->pPlayers[v323]; |
993 | 5989 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
5990 LODWORD(v727) = 1; | |
5991 break; | |
5992 } | |
890 | 5993 case SPELL_MIND_TELEPATHY: |
993 | 5994 { |
5995 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5996 break; | |
5997 if (PID_TYPE(a2) != OBJECT_Actor) | |
5998 { | |
5999 LODWORD(v727) = 1; | |
6000 break; | |
6001 } | |
6002 v417 = (int)&pActors[PID_ID(a2)]; | |
6003 v730 = v417; | |
6004 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6005 { | |
6006 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6007 v417 = v730; | |
6008 } | |
6009 v418 = *(int *)(v417 + 672); | |
6010 HIDWORD(v733) = 0; | |
6011 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6012 HIDWORD(v733) = *(int *)(v417 + 684); | |
6013 | |
6014 //ItemGen::ItemGen(&v683); | |
6015 v683.Reset(); | |
6016 | |
6017 v419 = *(short *)(v730 + 180); | |
6018 if (v419) | |
6019 { | |
6020 v683.uItemID = v419; | |
6021 //goto LABEL_799; | |
6022 } | |
6023 else | |
6024 { | |
6025 v420 = 0; | |
6026 v421 = v730 + 564; | |
6027 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6028 { | |
6029 ++v420; | |
6030 v421 += 36; | |
6031 if ( v420 >= 4 ) | |
6032 break; | |
6033 } | |
6034 if ( v420 < 4 ) | |
6035 { | |
6036 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6037 v2 = v723; | |
6038 //v1 = 0; | |
6039 } | |
6040 } | |
6041 // LABEL_799: | |
6042 if ( HIDWORD(v733) != 0 ) | |
6043 { | |
6044 v675 = (const char *)HIDWORD(v733); | |
6045 if (v683.uItemID) | |
6046 { | |
6047 v422 = v683.GetDisplayName(); | |
6048 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
6049 ShowStatusBarString(pTmpBuf2, 2u); | |
6050 pSpellSprite.stru_24.Reset(); | |
6051 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6052 pSpellSprite.spell_level = v2; | |
6053 pSpellSprite.spell_skill = v731; | |
6054 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6055 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6056 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6057 v676 = *(short *)(v730 + 138); | |
6058 v665 = pSpellSprite.vPosition.y; | |
6059 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6060 v657 = pSpellSprite.vPosition.x; | |
6061 } | |
6062 else | |
6063 { | |
6064 v664 = "%d gold"; | |
6065 sprintf(pTmpBuf2, v664, v675); | |
6066 ShowStatusBarString(pTmpBuf2, 2u); | |
6067 pSpellSprite.stru_24.Reset(); | |
6068 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6069 pSpellSprite.spell_level = v2; | |
6070 pSpellSprite.spell_skill = v731; | |
6071 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6072 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6073 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6074 v676 = *(short *)(v730 + 138); | |
6075 v665 = pSpellSprite.vPosition.y; | |
6076 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6077 v657 = pSpellSprite.vPosition.x; | |
6078 } | |
6079 } | |
6080 else | |
6081 { | |
6082 if (v683.uItemID) | |
6083 { | |
6084 v675 = v683.GetDisplayName(); | |
6085 v664 = "(%s)"; | |
6086 sprintf(pTmpBuf2, v664, v675); | |
6087 ShowStatusBarString(pTmpBuf2, 2u); | |
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); | |
6095 v676 = *(short *)(v730 + 138); | |
6096 v665 = pSpellSprite.vPosition.y; | |
6097 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6098 v657 = pSpellSprite.vPosition.x; | |
6099 } | |
6100 else | |
6101 { | |
6102 strcpy(pTmpBuf2, "nothing"); | |
6103 ShowStatusBarString(pTmpBuf2, 2u); | |
6104 pSpellSprite.stru_24.Reset(); | |
6105 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6106 pSpellSprite.spell_level = v2; | |
6107 pSpellSprite.spell_skill = v731; | |
6108 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6109 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6110 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6111 v676 = *(short *)(v730 + 138); | |
6112 v665 = pSpellSprite.vPosition.y; | |
6113 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6114 v657 = pSpellSprite.vPosition.x; | |
6115 } | |
6116 } | |
6117 pSpellSprite.uAttributes = 0; | |
6118 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6119 pSpellSprite.uSpriteFrameID = 0; | |
6120 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6121 pSpellSprite.spell_target_pid = a2; | |
6122 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6123 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6124 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6125 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6126 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
889 | 6127 LODWORD(v727) = 1; |
890 | 6128 break; |
6129 } | |
993 | 6130 case SPELL_MIND_BERSERK: |
6131 { | |
6132 v423 = v731 - 2; | |
6133 if ( !v423 ) | |
6134 v425 = 300 * v2; | |
6135 else | |
6136 { | |
6137 v424 = v423 - 1; | |
6138 if ( v424 ) | |
6139 { | |
6140 if ( v424 == 1 ) | |
6141 v425 = 3600 * v2; | |
6142 else | |
6143 //LABEL_813: | |
6144 v425 = 300 * v2; | |
6145 } | |
6146 else | |
6147 { | |
6148 v425 = 600 * v2; | |
6149 } | |
6150 } | |
6151 amount = v425; | |
6152 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6153 break; | |
6154 v426 = PID_ID(a2); | |
6155 if (PID_TYPE(a2) != OBJECT_Actor) | |
6156 { | |
6157 LODWORD(v727) = 1; | |
6158 break; | |
6159 } | |
6160 v730 = 836 * v426; | |
6161 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6162 { | |
6163 pActors[v426].pActorBuffs[1].Reset(); | |
6164 pActors[v426].pActorBuffs[12].Reset(); | |
6165 pActors[v426].pActorBuffs[9].Apply( | |
6166 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6167 v731, 0, 0, 0); | |
6168 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6169 } | |
924 | 6170 pSpellSprite.stru_24.Reset(); |
6171 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6172 pSpellSprite.spell_level = v2; | |
6173 pSpellSprite.spell_skill = v731; | |
993 | 6174 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6175 v61 = v426; | |
6176 v600 = pActors[v61].vPosition.y; | |
6177 v601 = pActors[v61].vPosition.x; | |
6178 pSpellSprite.uObjectDescID = v60; | |
6179 pSpellSprite.vPosition.x = v601; | |
6180 v602 = pActors[v61].uActorHeight; | |
6181 v603 = pActors[v61].vPosition.z; | |
6182 pSpellSprite.vPosition.y = v600; | |
6183 v676 = v603 + v602; | |
6184 v665 = v600; | |
6185 pSpellSprite.vPosition.z = v603 + v602; | |
6186 v657 = v601; | |
6187 pSpellSprite.uAttributes = 0; | |
6188 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6189 pSpellSprite.uSpriteFrameID = 0; | |
6190 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6191 pSpellSprite.spell_target_pid = a2; | |
6192 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6193 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6194 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6195 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6196 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6197 LODWORD(v727) = 1; |
6198 break; | |
6199 } | |
6200 case SPELL_MIND_ENSLAVE: | |
993 | 6201 { |
6202 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6203 break; | |
6204 amount = 600 * v2; | |
6205 if (PID_TYPE(a2) != OBJECT_Actor) | |
6206 { | |
6207 LODWORD(v727) = 1; | |
6208 break; | |
6209 } | |
6210 v730 = 836 * PID_ID(a2); | |
6211 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6212 break; | |
6213 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6214 { | |
6215 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6216 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6217 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6218 v731, 0, 0, 0); | |
6219 } | |
6220 pSpellSprite.stru_24.Reset(); | |
6221 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6222 pSpellSprite.spell_level = v2; | |
6223 pSpellSprite.spell_skill = v731; | |
6224 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6225 v61 = PID_ID(a2); | |
6226 v600 = pActors[v61].vPosition.y; | |
6227 v601 = pActors[v61].vPosition.x; | |
6228 pSpellSprite.uObjectDescID = v60; | |
6229 pSpellSprite.vPosition.x = v601; | |
6230 v602 = pActors[v61].uActorHeight; | |
6231 v603 = pActors[v61].vPosition.z; | |
6232 pSpellSprite.vPosition.y = v600; | |
6233 v676 = v603 + v602; | |
6234 v665 = v600; | |
6235 pSpellSprite.vPosition.z = v603 + v602; | |
6236 v657 = v601; | |
6237 pSpellSprite.uAttributes = 0; | |
6238 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6239 pSpellSprite.uSpriteFrameID = 0; | |
6240 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6241 pSpellSprite.spell_target_pid = a2; | |
6242 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6243 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6244 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6245 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6246 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6247 LODWORD(v727) = 1; |
6248 break; | |
6249 } | |
6250 case SPELL_MIND_MASS_FEAR: | |
6251 { | |
6252 v428 = v731 - 2; | |
6253 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6254 v430 = 300 * v2; | |
6255 else | |
6256 v430 = 180 * v2; | |
6257 amount = v430; | |
6258 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6259 break; | |
6260 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6261 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
924 | 6262 ++pSpellSprite.uType; |
6263 pSpellSprite.stru_24.Reset(); | |
6264 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6265 pSpellSprite.spell_level = v2; | |
6266 pSpellSprite.spell_skill = v731; | |
6267 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6268 pSpellSprite.uAttributes = 0; | |
6269 pSpellSprite.uSectorID = 0; | |
6270 pSpellSprite.uSpriteFrameID = 0; | |
6271 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6272 pSpellSprite.uFacing = 0; | |
6273 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6274 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6275 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6276 { | |
6277 v433 = &pActors[dword_50BF30[a2]]; | |
6278 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6279 break; | |
924 | 6280 pSpellSprite.vPosition.x = v433->vPosition.x; |
6281 pSpellSprite.vPosition.y = v433->vPosition.y; | |
6282 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6283 | |
6284 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6285 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6286 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6287 { | |
6288 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6289 v731, 0, 0, 0); | |
6290 } | |
6291 } | |
6292 LODWORD(v727) = 1; | |
6293 break; | |
6294 } | |
6295 | |
6296 case SPELL_MIND_CURE_INSANITY: | |
6297 { | |
6298 v435 = v731 - 2; | |
6299 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6300 amount = 0; | |
6301 else | |
6302 amount = 86400 * v2; | |
6303 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6304 break; | |
6305 | |
924 | 6306 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6307 v440 = pCastSpell->uPlayerID_2; | |
890 | 6308 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6309 { | |
6310 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6311 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6312 if ( v731 == 4 ) | |
6313 { | |
924 | 6314 v441 = pCastSpell->uPlayerID_2; |
890 | 6315 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6316 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
889 | 6317 } |
6318 else | |
6319 { | |
924 | 6320 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
890 | 6321 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6322 } | |
924 | 6323 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
993 | 6324 //LABEL_720: |
890 | 6325 v377->SetCondition(1, 0); |
6326 } | |
6327 LODWORD(v727) = 1; | |
6328 break; | |
6329 } | |
6330 case SPELL_EARTH_TELEKINESIS: | |
6331 { | |
993 | 6332 if ( v731 == 1 || v731 == 2 ) |
6333 amount = 2 * v2; | |
6334 else if( v731 == 3 ) | |
6335 amount = 3 * v2; | |
6336 else if ( v731 == 4 ) | |
6337 amount = 4 * v2; | |
890 | 6338 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6339 break; | |
6340 v445 = PID_ID(a2); | |
6341 if (PID_TYPE(a2) == OBJECT_Item) | |
6342 { | |
6343 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6344 v450 = *(int *)v449; | |
6345 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6346 { | |
6347 party_finds_gold(*((int *)v449 + 3), 0); | |
6348 viewparams->bRedrawGameUI = 1; | |
889 | 6349 } |
6350 else | |
6351 { | |
890 | 6352 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
6353 ShowStatusBarString(pTmpBuf2, 2u); | |
6354 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6355 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6356 } | |
6357 SpriteObject::OnInteraction(v445); | |
6358 } | |
6359 else | |
6360 { | |
6361 if (PID_TYPE(a2) == OBJECT_Actor) | |
6362 { | |
6363 stru_50C198.LootActor(&pActors[v445]); | |
6364 } | |
6365 else | |
6366 { | |
6367 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6368 { | |
6369 if (PID_TYPE(a2) != OBJECT_BModel) | |
6370 { | |
6371 LODWORD(v727) = 1; | |
6372 break; | |
6373 } | |
6374 dword_507CD8 = 1; | |
6375 v677 = 1; | |
6376 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6377 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6378 else | |
6379 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6380 | |
6381 EventProcessor(v446, a2, v677); | |
6382 LODWORD(v727) = 1; | |
6383 break; | |
6384 } | |
6385 v447 = &pLevelDecorations[v445]; | |
6386 dword_507CD8 = 1; | |
6387 v448 = v447->field_16_event_id; | |
6388 if (v448) | |
6389 { | |
6390 v677 = 1; | |
6391 v446 = v448; | |
6392 EventProcessor(v446, a2, v677); | |
6393 LODWORD(v727) = 1; | |
6394 break; | |
6395 } | |
6396 if ( v447->IsInteractive() ) | |
6397 { | |
6398 activeLevelDecoration = v447; | |
6399 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6400 activeLevelDecoration = NULL; | |
6401 } | |
6402 } | |
6403 } | |
6404 LODWORD(v727) = 1; | |
6405 break; | |
6406 } | |
6407 case SPELL_BODY_CURE_WEAKNESS: | |
6408 { | |
993 | 6409 if ( v731 == 1 ) |
6410 amount = 180 * v2; | |
6411 else if( v731 == 2 ) | |
6412 amount = 3600 * v2; | |
6413 else if( v731 == 3 ) | |
6414 amount = 86400 * v2; | |
6415 else if ( v731 == 4 ) | |
6416 amount = 0; | |
6417 //LABEL_883: | |
890 | 6418 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6419 break; | |
6420 | |
924 | 6421 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6422 v323 = pCastSpell->uPlayerID_2; | |
890 | 6423 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6424 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6425 { | |
889 | 6426 LODWORD(v727) = 1; |
890 | 6427 break; |
6428 } | |
6429 if ( v731 == 4 ) | |
6430 { | |
6431 *(int *)v324 = 0; | |
6432 *((int *)v324 + 1) = 0; | |
6433 LODWORD(v727) = 1; | |
6434 break; | |
6435 } | |
6436 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6437 v656 = 1; | |
6438 v325 = &pParty->pPlayers[v323]; | |
993 | 6439 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
6440 LODWORD(v727) = 1; | |
6441 break; | |
6442 } | |
890 | 6443 case SPELL_BODY_FIRST_AID: |
6444 { | |
6445 v457 = v731 - 2; | |
6446 if ( v457 ) | |
6447 { | |
6448 v458 = v457 - 1; | |
6449 if ( v458 ) | |
6450 { | |
6451 if ( v458 == 1 ) | |
6452 v459 = 5 * v2 + 5; | |
6453 else | |
6454 v459 = 2 * v2 + 5; | |
889 | 6455 } |
6456 else | |
6457 { | |
890 | 6458 v459 = 4 * v2 + 5; |
6459 } | |
6460 } | |
6461 else | |
6462 { | |
6463 v459 = 3 * v2 + 5; | |
6464 } | |
6465 amount = v459; | |
6466 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6467 break; | |
924 | 6468 v460 = pCastSpell->spell_target_pid; |
890 | 6469 if (!v460) |
6470 { | |
924 | 6471 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6472 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 6473 } |
6474 else | |
6475 { | |
6476 if (PID_TYPE(v460) == OBJECT_Actor) | |
6477 { | |
6478 v461 = &pActors[PID_ID(v460)]; | |
6479 v462 = v461->uAIState; | |
6480 v463 = v461->pMonsterInfo.uHP; | |
6481 if ( v462 != 5 ) | |
6482 { | |
6483 if ( v462 != 4 ) | |
6484 { | |
6485 if ( v462 != 19 ) | |
6486 { | |
6487 if ( v462 != 11 ) | |
6488 { | |
6489 v461->sCurrentHP += amount; | |
6490 if ( v461->sCurrentHP > v463 ) | |
6491 v461->sCurrentHP = v463; | |
6492 } | |
6493 } | |
6494 } | |
6495 } | |
6496 } | |
6497 } | |
6498 LODWORD(v727) = 1; | |
6499 break; | |
6500 } | |
6501 case SPELL_BODY_CURE_POISON: | |
6502 { | |
993 | 6503 if ( v731 == 1 || v731 == 2 ) |
6504 amount = 3600 * v2; | |
6505 else if( v731 == 3) | |
6506 amount = 86400 * v2; | |
6507 else if ( v731 == 4 ) | |
890 | 6508 amount = 0; |
993 | 6509 //LABEL_912: |
890 | 6510 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6511 break; | |
6512 | |
924 | 6513 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6514 v470 = pCastSpell->uPlayerID_2; | |
890 | 6515 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6516 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6517 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6518 { | |
6519 LODWORD(v727) = 1; | |
6520 break; | |
6521 } | |
6522 if ( v731 == 4 ) | |
6523 { | |
6524 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6525 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
924 | 6526 v471 = pCastSpell->uPlayerID_2; |
890 | 6527 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6528 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
924 | 6529 v472 = pCastSpell->uPlayerID_2; |
890 | 6530 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6531 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6532 LODWORD(v727) = 1; | |
6533 break; | |
6534 } | |
6535 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6536 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6537 6u, | |
6538 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6539 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6540 8u, |
6541 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6542 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6543 v656 = 10; | |
993 | 6544 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
6545 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6546 LODWORD(v727) = 1; | |
6547 break; | |
6548 } | |
890 | 6549 case SPELL_BODY_PROTECTION_FROM_MAGIC: |
6550 { | |
6551 amount = v2; | |
6552 LODWORD(v733) = 3600 * v2; | |
6553 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6554 break; | |
6555 | |
924 | 6556 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6557 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6558 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6559 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6560 |
6561 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6562 LODWORD(v727) = 1; | |
6563 break; | |
6564 } | |
6565 case SPELL_BODY_HAMMERHANDS: | |
6566 { | |
6567 LODWORD(v733) = 3600 * v2; | |
6568 amount = v2; | |
6569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6570 break; | |
6571 if ( v731 == 4 ) | |
6572 { | |
924 | 6573 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6574 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6575 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6576 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6577 v732 = (int)v733 << 7; |
6578 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6579 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6580 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6581 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6582 | |
6583 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6584 LODWORD(v727) = 1; | |
6585 break; | |
6586 } | |
924 | 6587 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6588 | |
6589 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 | 6590 LODWORD(v727) = 1; |
6591 break; | |
6592 } | |
6593 case SPELL_BODY_CURE_DISEASE: | |
6594 { | |
6595 v493 = v731 - 2; | |
6596 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6597 amount = 0; | |
6598 else | |
6599 amount = 86400 * v2; | |
6600 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6601 break; | |
6602 | |
924 | 6603 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6604 v498 = pCastSpell->uPlayerID_2; | |
890 | 6605 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6606 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6607 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6608 { | |
6609 LODWORD(v727) = 1; | |
6610 break; | |
6611 } | |
6612 if ( v731 == 4 ) | |
6613 { | |
6614 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6615 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
924 | 6616 v499 = pCastSpell->uPlayerID_2; |
890 | 6617 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6618 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
924 | 6619 v500 = pCastSpell->uPlayerID_2; |
890 | 6620 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6621 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6622 } | |
6623 else | |
6624 { | |
6625 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6626 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6627 7u, | |
6628 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6629 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6630 9u, |
6631 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6632 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6633 v656 = 11; | |
993 | 6634 //LABEL_937: |
924 | 6635 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
993 | 6636 //LABEL_641: |
890 | 6637 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
6638 } | |
6639 LODWORD(v727) = 1; | |
6640 break; | |
6641 } | |
6642 case SPELL_BODY_POWER_CURE: | |
6643 { | |
6644 amount = 5 * v2 + 10; | |
6645 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6646 break; | |
6647 v501 = pParty->pPlayers; | |
6648 int v1 = 0; | |
6649 do | |
6650 { | |
924 | 6651 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
890 | 6652 v501->Heal(amount); |
6653 ++v501; | |
6654 ++v1; | |
6655 } | |
6656 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6657 LODWORD(v727) = 1; | |
6658 break; | |
6659 } | |
6660 case SPELL_LIGHT_DISPEL_MAGIC: | |
6661 { | |
6662 sRecoveryTime -= v2; | |
6663 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6664 break; | |
6665 | |
6666 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6667 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6668 ++pSpellSprite.uType; |
890 | 6669 HIDWORD(v733) = v505; |
6670 v688.x = 0; | |
6671 v688.y = 0; | |
6672 v688.z = 0; | |
924 | 6673 pSpellSprite.stru_24.Reset(); |
6674 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6675 pSpellSprite.spell_level = v2; | |
6676 pSpellSprite.spell_skill = v731; | |
6677 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6678 pSpellSprite.uAttributes = 0; | |
6679 pSpellSprite.uSectorID = 0; | |
6680 pSpellSprite.uSpriteFrameID = 0; | |
6681 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6682 pSpellSprite.uFacing = 0; | |
6683 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6684 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6685 a2 = 0; |
6686 if ( SHIDWORD(v733) > 0 ) | |
6687 { | |
6688 do | |
6689 { | |
6690 v507 = dword_50BF30[a2]; | |
924 | 6691 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6692 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
6693 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6694 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6695 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6696 v510 = a2; |
6697 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6698 a2 = v510 + 1; | |
6699 } | |
6700 while ( v510 + 1 < SHIDWORD(v733) ); | |
6701 } | |
6702 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6703 { | |
6704 v511 = &pActors[dword_50BF30[a2]]; | |
924 | 6705 pSpellSprite.vPosition.x = v511->vPosition.x; |
6706 pSpellSprite.vPosition.y = v511->vPosition.y; | |
6707 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6708 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6709 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6710 v513 = v511->pActorBuffs; |
6711 for (int _v726 = 22; _v726 != 0; --_v726) | |
6712 { | |
6713 v513->Reset(); | |
6714 ++v513; | |
6715 } | |
6716 } | |
6717 LODWORD(v727) = 1; | |
6718 break; | |
6719 } | |
6720 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
6721 { | |
6722 v514 = v731 - 2; | |
993 | 6723 if ( v731 == 1 || v731 == 2 ) |
6724 { | |
6725 v516 = 300 * v2; | |
6726 amount = 1; | |
6727 } | |
6728 else if( v731 == 3 ) | |
6729 { | |
6730 v516 = 900 * v2; | |
6731 amount = 3; | |
6732 } | |
6733 else if ( v731 == 4 ) | |
890 | 6734 { |
6735 v516 = 900 * v2; | |
6736 amount = 5; | |
889 | 6737 } |
890 | 6738 v733 = __PAIR__(0, v516); |
6739 | |
6740 if ( (signed int)uNumActors > 0 ) | |
6741 { | |
6742 v518 = pActors;//[0].uAIState; | |
6743 auto _v726 = uNumActors; | |
889 | 6744 do |
6745 { | |
890 | 6746 v519 = v518->uAIState; |
924 | 6747 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
890 | 6748 ++HIDWORD(v733); |
6749 ++v518; | |
6750 --_v726; | |
6751 } | |
6752 while ( _v726 != 0 ); | |
6753 } | |
6754 if ( SHIDWORD(v733) >= amount ) | |
6755 { | |
6756 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6757 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6758 pCastSpell->spellnum = 0; |
890 | 6759 continue; |
6760 } | |
6761 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6762 break; | |
924 | 6763 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
890 | 6764 LODWORD(v727) = 1; |
6765 break; | |
6766 } | |
6767 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
6768 { | |
993 | 6769 if ( v731 == 1 || v731 == 2 ) |
6770 { | |
890 | 6771 LODWORD(v733) = 10800 * v2; |
993 | 6772 amount = 3 * v2 + 10; |
6773 } | |
6774 else if( v731 == 3 ) | |
890 | 6775 { |
6776 LODWORD(v733) = 14400 * v2; | |
993 | 6777 amount = 4 * v2 + 10; |
6778 } | |
6779 else if ( v731 == 4 ) | |
6780 { | |
6781 LODWORD(v733) = 18000 * v2; | |
6782 amount = 5 * v2 + 10; | |
6783 } | |
890 | 6784 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6785 break; | |
6786 | |
924 | 6787 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6788 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6789 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6790 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6791 |
6792 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6793 LODWORD(v727) = 1; | |
6794 break; | |
6795 } | |
6796 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
6797 { | |
6798 //v67 = 2; | |
6799 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6800 { | |
6801 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6802 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6803 pCastSpell->spellnum = 0; |
890 | 6804 continue; |
6805 } | |
6806 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6807 break; | |
6808 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6809 ++pSpellSprite.uType; |
890 | 6810 v694.x = 0; |
6811 v694.y = 0; | |
6812 v694.z = 0; | |
924 | 6813 pSpellSprite.stru_24.Reset(); |
6814 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6815 pSpellSprite.spell_level = v2; | |
6816 pSpellSprite.spell_skill = v731; | |
6817 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6818 pSpellSprite.uAttributes = 0; | |
6819 pSpellSprite.uSectorID = 0; | |
6820 pSpellSprite.uSpriteFrameID = 0; | |
6821 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6822 pSpellSprite.uFacing = 0; | |
6823 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6824 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6825 a2 = 0; |
6826 if ( (signed int)v531 > 0 ) | |
6827 { | |
6828 do | |
6829 { | |
6830 v533 = dword_50BF30[a2]; | |
924 | 6831 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6832 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
6833 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6834 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6835 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6836 v536 = a2; |
6837 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6838 a2 = v536 + 1; | |
6839 } | |
6840 while ( v536 + 1 < (signed int)v531 ); | |
6841 } | |
6842 v537 = pGame->GetStru6(); | |
6843 pGame->GetStru6()->_4A8BFC(); | |
889 | 6844 LODWORD(v727) = 1; |
890 | 6845 break; |
6846 } | |
6847 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6848 { | |
6849 v538 = v731 - 2; | |
6850 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6851 { | |
6852 amount = 5 * v2; | |
6853 v540 = 18000 * v2; | |
6854 } | |
6855 else | |
6856 { | |
6857 amount = 4 * v2; | |
6858 v540 = 14400 * v2; | |
6859 } | |
6860 v730 = v540; | |
6861 LODWORD(v733) = v540; | |
6862 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6863 break; | |
6864 | |
924 | 6865 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6866 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6867 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6868 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6869 |
6870 v732 = v730 << 7; | |
6871 v549 = (double)(v730 << 7) * 0.033333335; | |
6872 *((float *)&v733 + 1) = v549; | |
6873 v712 = (signed __int64)v549; | |
6874 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6875 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6876 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6877 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6878 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6879 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6880 v550 = v2 + 5; | |
6881 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6882 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6883 v731, | |
6884 v550, 0, 0); | |
6885 | |
6886 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6887 LODWORD(v727) = 1; | |
6888 break; | |
6889 } | |
6890 | |
6891 case SPELL_LIGHT_HOUR_OF_POWER: | |
6892 { | |
6893 v551 = v731 - 2; | |
993 | 6894 if ( v731 == 1 || v731 == 2 ) |
6895 { | |
6896 HIDWORD(v733) = 4; | |
6897 amount = 4; | |
6898 } | |
6899 else if( v731 == 3 ) | |
6900 { | |
6901 HIDWORD(v733) = 12; | |
6902 amount = 12; | |
6903 } | |
6904 else if( v731 == 4 ) | |
6905 { | |
890 | 6906 amount = 15; |
6907 HIDWORD(v733) = 20; | |
993 | 6908 } |
6909 //LABEL_1000: | |
890 | 6910 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6911 break; | |
6912 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6913 v732 = (300 * amount * v2 + 60) << 7; | |
6914 v730 = v2 + 5; | |
6915 int _v726 = 0; | |
6916 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6917 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6918 do | |
6919 { | |
924 | 6920 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6921 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6922 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6923 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 6924 |
890 | 6925 //((SpellBuff *)(v553 + 6056))->Apply( |
6926 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6927 if ( *(_QWORD *)v553 ) | |
6928 _v726 = 1; | |
6929 ++v553; | |
6930 } | |
6931 while ( v553 <= &pParty->pPlayers[3] ); | |
6932 v562 = v731; | |
6933 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6934 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6935 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6936 if (!_v726) | |
6937 { | |
6938 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); | |
6939 } | |
6940 LODWORD(v727) = 1; | |
6941 break; | |
6942 } | |
6943 | |
6944 | |
6945 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
6946 { | |
6947 amount = 3; | |
6948 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6949 { | |
6950 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6951 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6952 pCastSpell->spellnum = 0; |
890 | 6953 continue; |
6954 } | |
6955 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6956 break; | |
6957 a2 = 0; | |
6958 _this = (ItemGen *)&pPlayers[1]; | |
6959 do | |
6960 { | |
6961 v563 = 0; | |
889 | 6962 do |
6963 { | |
890 | 6964 v564 = _this->uItemID; |
6965 *(int *)(v563 + _this->uItemID) = 0; | |
6966 v563 += 8; | |
6967 *(int *)(v563 + v564 - 4) = 0; | |
6968 } | |
6969 while ( v563 <= 128 ); | |
6970 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6971 v566 = (Player **)_this; | |
6972 *(int *)(_this->uItemID + 6460) = v565; | |
6973 v567 = (*v566)->GetMaxMana(); | |
6974 *(int *)(_this->uItemID + 6464) = v567; | |
924 | 6975 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 6976 ++a2; |
6977 _this = (ItemGen *)((char *)_this + 4); | |
6978 } | |
6979 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6980 v571 = pPlayer; | |
6981 v572 = (char *)&pPlayer->sAgeModifier; | |
6982 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
6983 *(short *)v572 = 120; | |
6984 else | |
6985 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
6986 sRecoveryTime += -5 * v2; | |
6987 ++v571->uNumDivineInterventionCastsThisDay; | |
6988 LODWORD(v727) = 1; | |
6989 break; | |
6990 } | |
6991 case SPELL_DARK_REANIMATE: | |
6992 { | |
6993 v573 = v731 - 2; | |
6994 if ( v573 ) | |
6995 { | |
6996 v574 = v573 - 1; | |
6997 if ( v574 ) | |
6998 { | |
6999 if ( v574 == 1 ) | |
7000 v575 = 5 * v2; | |
889 | 7001 else |
890 | 7002 v575 = 2 * v2; |
889 | 7003 } |
7004 else | |
7005 { | |
890 | 7006 v575 = 4 * v2; |
7007 } | |
7008 } | |
7009 else | |
7010 { | |
7011 v575 = 3 * v2; | |
7012 } | |
7013 amount = v575; | |
7014 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7015 break; | |
924 | 7016 v576 = pCastSpell->spell_target_pid; |
890 | 7017 if (!v576) |
7018 { | |
924 | 7019 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7020 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 7021 if ( *((_QWORD *)v585 + 14) ) |
7022 { | |
7023 ((Player *)v585)->SetCondition(0x11u, 1); | |
7024 v587 = ((Player *)v585)->GetSexByVoice(); | |
924 | 7025 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
890 | 7026 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7027 } | |
7028 break; | |
7029 } | |
7030 v577 = (Player *)(PID_ID(v576)); | |
7031 //v726 = v577; | |
7032 if ( v577 == (Player *)-1 ) | |
7033 { | |
7034 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7035 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7036 pCastSpell->spellnum = 0; |
890 | 7037 continue; |
7038 } | |
7039 v578 = (int)&pActors[(int)v577]; | |
7040 v721 = v578; | |
7041 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7042 { | |
7043 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7044 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7045 pCastSpell->spellnum = 0; |
890 | 7046 continue; |
7047 } | |
924 | 7048 ++pSpellSprite.uType; |
7049 pSpellSprite.stru_24.Reset(); | |
7050 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7051 pSpellSprite.spell_level = v2; | |
7052 pSpellSprite.spell_skill = v731; | |
7053 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7054 pSpellSprite.uAttributes = 0; | |
7055 pSpellSprite.uSectorID = 0; | |
7056 pSpellSprite.uSpriteFrameID = 0; | |
7057 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
890 | 7058 v581 = v721; |
924 | 7059 pSpellSprite.uFacing = 0; |
7060 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7061 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7062 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
7063 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
890 | 7064 v732 = *(short *)(v721 + 138); |
924 | 7065 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7066 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7067 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7068 if ( *(char *)(v581 + 52) > amount ) |
7069 break; | |
7070 Actor::Resurrect((unsigned int)v577); | |
7071 *(char *)(v581 + 61) = 0; | |
7072 *(char *)(v581 + 53) = 0; | |
7073 *(char *)(v581 + 54) = 0; | |
7074 *(char *)(v581 + 55) = 0; | |
7075 *(char *)(v581 + 56) = 0; | |
7076 *(char *)(v581 + 57) = 0; | |
7077 *(int *)(v581 + 712) = 9999; | |
7078 *(char *)(v581 + 38) &= 0xF7u; | |
7079 *(int *)(v581 + 708) = 0; | |
7080 ((SpellBuff *)(v581 + 356))->Reset(); | |
7081 ((SpellBuff *)(v581 + 228))->Reset(); | |
7082 ((SpellBuff *)(v581 + 404))->Reset(); | |
7083 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7084 *(short *)(v581 + 40) = 10 * amount; | |
889 | 7085 LODWORD(v727) = 1; |
890 | 7086 break; |
7087 } | |
7088 case SPELL_DARK_VAMPIRIC_WEAPON: | |
7089 { | |
7090 v588 = v731 - 1; | |
7091 amount = 16; | |
7092 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7093 { | |
7094 if ( v590 == 1 ) | |
7095 LODWORD(v733) = 0; | |
7096 } | |
7097 else | |
7098 { | |
7099 LODWORD(v733) = 3600 * v2; | |
7100 } | |
7101 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7102 break; | |
7103 __debugbreak(); | |
924 | 7104 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
890 | 7105 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7106 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7107 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7108 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7109 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7110 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7111 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7112 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7113 { | |
7114 dword_50C9D0 = 113; | |
7115 dword_50C9D4 = 0; | |
7116 dword_50C9D8 = 1; | |
7117 | |
7118 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7119 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7120 pCastSpell->spellnum = 0; |
890 | 7121 continue; |
7122 } | |
7123 v592 = HIDWORD(v733); | |
7124 v14 = v731 == 4; | |
7125 *(int *)(HIDWORD(v733) + 12) = 16; | |
7126 if ( !v14 ) | |
7127 { | |
7128 v732 = (int)v733 << 7; | |
7129 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7130 *(int *)(v592 + 20) |= 8u; | |
7131 } | |
7132 *(char *)(v592 + 20) |= 0x80u; | |
984 | 7133 _50C9A8_item_enchantment_timer = 256; |
890 | 7134 LODWORD(v727) = 1; |
7135 break; | |
7136 } | |
7137 case SPELL_DARK_SHARPMETAL: | |
7138 { | |
7139 v593 = v731 - 2; | |
993 | 7140 if( v731 == 1 || v731 == 2 ) |
7141 amount = 5; | |
7142 else if( v731 == 3 ) | |
7143 amount = 7; | |
7144 else if( v731 == 4 ) | |
890 | 7145 amount = 9; |
7146 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7147 break; | |
7148 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
924 | 7149 pSpellSprite.stru_24.Reset(); |
7150 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7151 pSpellSprite.spell_level = v2; | |
7152 pSpellSprite.spell_skill = v731; | |
7153 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7154 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
7155 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
7156 pSpellSprite.uAttributes = 0; | |
7157 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7158 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 7159 pParty->vPosition.x, |
7160 pParty->vPosition.y, | |
7161 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
924 | 7162 pSpellSprite.uSpriteFrameID = 0; |
7163 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7164 pSpellSprite.spell_target_pid = a2; | |
7165 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7166 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7167 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 7168 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 7169 v596 = (signed int)_v726 / -2; |
7170 y = (char *)((signed int)_v726 / 2); | |
7171 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7172 { | |
7173 v597 = v715.uYawAngle; | |
889 | 7174 do |
7175 { | |
924 | 7176 pSpellSprite.uFacing = v596 + v597; |
7177 if ( pSpellSprite.Create( | |
890 | 7178 v596 + v597, |
7179 v715.uPitchAngle, | |
924 | 7180 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7181 pCastSpell->uPlayerID + 1) != -1 | |
890 | 7182 && pParty->bTurnBasedModeOn == 1 ) |
7183 ++pTurnEngine->field_1C; | |
7184 v596 += _v726 / (amount - 1); | |
7185 } | |
7186 while ( v596 <= (signed int)y ); | |
7187 } | |
7188 LODWORD(v727) = 1; | |
7189 break; | |
7190 } | |
7191 | |
7192 case SPELL_DARK_CONTROL_UNDEAD: | |
993 | 7193 { |
7194 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7195 break; | |
7196 if ( v731 == 1 || v731 == 2 ) | |
7197 { | |
7198 v598 = 180 * v2; | |
7199 LODWORD(v733) = v598; | |
7200 } | |
7201 else if ( v731 == 3 ) | |
7202 { | |
7203 v598 = 300 * v2; | |
7204 LODWORD(v733) = v598; | |
7205 } | |
7206 else if ( v731 == 4 ) | |
7207 LODWORD(v733) = 29030400; | |
7208 // LABEL_1082: | |
7209 if (PID_TYPE(a2) != OBJECT_Actor) | |
7210 { | |
7211 LODWORD(v727) = 1; | |
7212 break; | |
7213 } | |
7214 v730 = 836 * PID_ID(a2); | |
7215 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7216 break; | |
7217 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7218 { | |
7219 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7220 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7221 pCastSpell->spellnum = 0; | |
7222 continue; | |
7223 } | |
7224 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7225 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7226 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7227 v731, 0, 0, 0); | |
7228 pSpellSprite.stru_24.Reset(); | |
7229 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7230 pSpellSprite.spell_level = v2; | |
7231 pSpellSprite.spell_skill = v731; | |
7232 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7233 v61 = PID_ID(a2); | |
7234 // LABEL_1086: | |
7235 v600 = pActors[v61].vPosition.y; | |
7236 v601 = pActors[v61].vPosition.x; | |
7237 pSpellSprite.uObjectDescID = v60; | |
7238 pSpellSprite.vPosition.x = v601; | |
7239 v602 = pActors[v61].uActorHeight; | |
7240 v603 = pActors[v61].vPosition.z; | |
7241 pSpellSprite.vPosition.y = v600; | |
7242 v676 = v603 + v602; | |
7243 v665 = v600; | |
7244 pSpellSprite.vPosition.z = v603 + v602; | |
7245 v657 = v601; | |
7246 // LABEL_1087: | |
7247 pSpellSprite.uAttributes = 0; | |
7248 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7249 pSpellSprite.uSpriteFrameID = 0; | |
7250 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7251 pSpellSprite.spell_target_pid = a2; | |
7252 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7253 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
7254 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
7255 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7256 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 7257 LODWORD(v727) = 1; |
7258 break; | |
7259 } | |
7260 case SPELL_DARK_SACRIFICE: | |
993 | 7261 { |
7262 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7263 break; | |
7264 HIDWORD(v733) = 0; | |
7265 memset(&achieved_awards, 0, 4000); | |
7266 _this = 0; | |
7267 v605 = (char *)pParty->pHirelings; | |
889 | 7268 do |
7269 { | |
993 | 7270 if ( *(int *)v605) |
7271 { | |
7272 v606 = HIDWORD(v733)++; | |
7273 achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); | |
7274 } | |
7275 _this = (ItemGen *)((char *)_this + 1); | |
7276 v605 += 76; | |
7277 } | |
7278 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7279 _this = 0; | |
7280 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7281 { | |
7282 v730 = (int)pNPCStats->pNewNPCData; | |
7283 __debugbreak(); // data offset | |
7284 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
7285 do | |
7286 { | |
7287 if ( *(char *)(v730 + 8) & 0x80 | |
7288 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7289 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7290 { | |
7291 v607 = HIDWORD(v733); | |
7292 HIDWORD(v733) += 4; | |
7293 *(int *)v607 = (int)_this + 3; | |
7294 } | |
7295 _this = (ItemGen *)((char *)_this + 1); | |
7296 v730 += 76; | |
7297 } | |
7298 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7299 } | |
7300 v608 = pCastSpell->uPlayerID_2; | |
7301 if ( v608 != 4 && v608 != 5 | |
7302 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7303 || v609 >= 3 ) | |
7304 { | |
7305 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7306 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7307 pCastSpell->spellnum = 0; | |
7308 continue; | |
7309 } | |
7310 v610 = 76 * v609; | |
7311 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7312 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7313 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7314 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7315 v612 = pParty->pPlayers; | |
7316 do | |
7317 { | |
7318 v612->sHealth = v612->GetMaxHealth(); | |
7319 v612->sMana = v612->GetMaxMana(); | |
7320 ++v612; | |
7321 } | |
7322 while ( v612 <= &pParty->pPlayers[3] ); | |
7323 v613 = &pOutdoor->ddm; | |
7324 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7325 v613 = &pIndoor->dlv; | |
7326 v613->uReputation += 15; | |
7327 if ( v613->uReputation > 10000 ) | |
7328 v613->uReputation = 10000; | |
890 | 7329 LODWORD(v727) = 1; |
7330 break; | |
7331 } | |
993 | 7332 case SPELL_DARK_PAIN_REFLECTION: |
7333 { | |
7334 if ( v731 > 0 && v731 <= 4 ) | |
7335 { | |
7336 if ( v731 <= 3 ) | |
7337 { | |
7338 v614 = 300 * (v2 + 12); | |
7339 } | |
7340 if ( v731 == 4 ) | |
7341 { | |
7342 v614 = 900 * (v2 + 4); | |
7343 } | |
7344 LODWORD(v733) = v614; | |
7345 } | |
7346 v615 = v2 + 5; | |
7347 amount = v615; | |
7348 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7349 break; | |
7350 if ( v731 != 3 && v731 != 4 ) | |
7351 { | |
7352 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
7353 | |
7354 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); | |
7355 LODWORD(v727) = 1; | |
7356 break; | |
7357 } | |
7358 a2 = 0; | |
7359 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7360 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
889 | 7361 do |
7362 { | |
993 | 7363 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
7364 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
7365 ++a2; | |
7366 ++v619; | |
7367 } | |
7368 while ( v619 <= &pParty->pPlayers[3] ); | |
7369 LODWORD(v727) = 1; | |
7370 break; | |
7371 } | |
7372 case SPELL_DARK_SOULDRINKER: | |
7373 { | |
7374 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7375 break; | |
7376 pGame->GetIndoorCamera(); | |
7377 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7378 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7379 v707.x = 0; | |
7380 v707.y = 0; | |
7381 v707.z = 0; | |
7382 pSpellSprite.stru_24.Reset(); | |
7383 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7384 pSpellSprite.spell_level = v2; | |
7385 pSpellSprite.spell_skill = v731; | |
7386 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7387 pSpellSprite.uAttributes = 0; | |
7388 pSpellSprite.uSectorID = 0; | |
7389 pSpellSprite.uSpriteFrameID = 0; | |
7390 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
7391 pSpellSprite.uFacing = 0; | |
7392 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7393 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7394 a2 = 0; | |
7395 int _v726 = 0; | |
7396 if ( SHIDWORD(v733) > 0 ) | |
7397 { | |
7398 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
7399 do | |
7400 { | |
7401 v625 = dword_50BF30[a2]; | |
7402 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; | |
7403 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
7404 //v732 = pActors[v625].uActorHeight; | |
7405 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
7406 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7407 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
7408 v628 = a2; | |
7409 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7410 a2 = v628 + 1; | |
7411 } | |
7412 while ( v628 + 1 < SHIDWORD(v733) ); | |
7413 } | |
7414 v730 = 0; | |
7415 v629 = 1; | |
890 | 7416 do |
7417 { | |
993 | 7418 v630 = pPlayers[v629]; |
7419 if ( !v630->pConditions[2] | |
7420 && !v630->pConditions[12] | |
7421 && !v630->pConditions[13] | |
7422 && !v630->pConditions[14] | |
7423 && !v630->pConditions[15] | |
7424 && !v630->pConditions[16] ) | |
7425 { | |
7426 v631 = v730++; | |
7427 v681[v631] = v629; | |
7428 } | |
7429 ++v629; | |
7430 } | |
7431 while ( v629 <= 4 ); | |
7432 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7433 HIDWORD(v733) = 0; | |
7434 if ( v730 > 0 ) | |
7435 { | |
7436 do | |
7437 { | |
7438 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7439 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7440 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7441 v726->sHealth += v732; | |
7442 //v726 = *(Player **)v632; | |
7443 //v634 = v726->GetMaxHealth(); | |
7444 if ( v726->sHealth > v726->GetMaxHealth()) | |
7445 v726->sHealth = v726->GetMaxHealth(); | |
7446 v635 = HIDWORD(v733); | |
7447 | |
7448 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); | |
7449 HIDWORD(v733) = v635 + 1; | |
7450 } | |
7451 while ( v635 + 1 < v730 ); | |
7452 } | |
7453 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
890 | 7454 LODWORD(v727) = 1; |
7455 break; | |
7456 } | |
7457 | |
7458 case SPELL_DARK_ARMAGEDDON: | |
7459 { | |
993 | 7460 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
7461 { | |
7462 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7463 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7464 pCastSpell->spellnum = 0; | |
7465 continue; | |
7466 } | |
7467 v640 = v731 - 2; | |
7468 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7469 amount = 3; | |
7470 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7471 { | |
7472 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7473 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7474 pCastSpell->spellnum = 0; | |
7475 continue; | |
7476 } | |
7477 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7478 break; | |
7479 pParty->armageddon_timer = 256; | |
7480 pParty->field_16140 = v2; | |
7481 ++pPlayer->uNumArmageddonCasts; | |
7482 if ( pParty->bTurnBasedModeOn == 1 ) | |
7483 ++pTurnEngine->field_1C; | |
7484 auto _v726 = 50; | |
7485 do | |
7486 { | |
7487 v642 = rand() % 4096 - 2048; | |
7488 v643 = rand(); | |
7489 v721 = v642 + pParty->vPosition.x; | |
7490 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7491 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7492 v644 = rand(); | |
7493 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7494 --_v726; | |
7495 } | |
7496 while ( _v726 != 0 ); | |
890 | 7497 LODWORD(v727) = 1; |
7498 break; | |
7499 } | |
7500 | |
7501 default: | |
993 | 7502 break; |
890 | 7503 } |
924 | 7504 if ( pCastSpell->field_8 & 0x20 ) |
890 | 7505 { |
7506 if ( v727 != 0.0 ) | |
924 | 7507 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 7508 } |
7509 else | |
7510 { | |
7511 if ( sRecoveryTime < 0 ) | |
7512 sRecoveryTime = 0; | |
7513 if ( pParty->bTurnBasedModeOn ) | |
7514 { | |
7515 v645 = sRecoveryTime; | |
924 | 7516 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 7517 pPlayer->SetRecoveryTime(v645); |
7518 if ( !some_active_character ) | |
7519 pTurnEngine->_40471C(); | |
7520 } | |
7521 else | |
7522 { | |
7523 pPlayer->SetRecoveryTime( | |
7524 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
7525 } | |
7526 if ( v727 != 0.0 ) | |
7527 { | |
7528 pPlayer->PlaySound(SPEECH_49, 0); | |
7529 if ( v727 != 0.0 ) | |
924 | 7530 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
889 | 7531 } |
7532 } | |
924 | 7533 pCastSpell->spellnum = 0; |
890 | 7534 v2 = v723; |
7535 continue; | |
0 | 7536 } |
488 | 7537 |
0 | 7538 } |
7539 //----- (0042EB42) -------------------------------------------------------- | |
7540 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7541 { | |
7542 unsigned int v2; // edx@1 | |
7543 signed int v3; // eax@1 | |
7544 char *v4; // ecx@2 | |
7545 | |
7546 v2 = this->uNumObjects; | |
7547 v3 = 0; | |
7548 if ( (signed int)this->uNumObjects <= 0 ) | |
7549 { | |
7550 LABEL_5: | |
7551 LOWORD(v3) = 0; | |
7552 } | |
7553 else | |
7554 { | |
7555 v4 = (char *)&this->pObjects->uObjectID; | |
7556 while ( uItemID != *(short *)v4 ) | |
7557 { | |
7558 ++v3; | |
7559 v4 += 56; | |
7560 if ( v3 >= (signed int)v2 ) | |
7561 goto LABEL_5; | |
7562 } | |
7563 } | |
7564 return v3; | |
7565 } | |
7566 | |
7567 //----- (0042EB78) -------------------------------------------------------- | |
7568 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7569 { | |
7570 return 8 * this->pIcons[uIconID].uAnimLength; | |
7571 } | |
7572 | |
437 | 7573 const wchar_t *UIMessage2String(UIMessageType msg) |
7574 { | |
7575 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7576 static wchar_t b[256]; // bad for threads | |
7577 switch (msg) | |
7578 { | |
7579 CASE(UIMSG_SelectSpell) | |
7580 CASE(UIMSG_ChangeGameState) | |
7581 CASE(UIMSG_Attack) | |
7582 CASE(UIMSG_PlayArcomage) | |
7583 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7584 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7585 CASE(UIMSG_ShowCredits) | |
7586 CASE(UIMSG_ExitToWindows) | |
7587 CASE(UIMSG_PlayerCreationChangeName) | |
7588 CASE(UIMSG_PlayerCreationClickPlus) | |
7589 CASE(UIMSG_PlayerCreationClickMinus) | |
7590 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7591 CASE(UIMSG_PlayerCreationSelectClass) | |
7592 CASE(UIMSG_PlayerCreationClickOK) | |
7593 CASE(UIMSG_PlayerCreationClickReset) | |
996 | 7594 CASE(UIMSG_ClickBooksBtn) |
437 | 7595 CASE(UIMSG_PlayerCreationRemoveUpSkill) |
7596 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7597 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7598 CASE(UIMSG_LoadGame) | |
7599 CASE(UIMSG_SaveGame) | |
7600 CASE(UIMSG_ShowStatus_DateTime) | |
7601 CASE(UIMSG_ShowStatus_ManaHP) | |
7602 CASE(UIMSG_ShowStatus_Player) | |
7603 CASE(UIMSG_Wait5Minutes) | |
7604 CASE(UIMSG_Wait1Hour) | |
7605 CASE(UIMSG_ShowStatus_Food) | |
7606 CASE(UIMSG_ShowStatus_Funds) | |
7607 CASE(UIMSG_QuickReference) | |
7608 CASE(UIMSG_GameMenuButton) | |
7609 CASE(UIMSG_AlreadyResting) | |
7610 CASE(UIMSG_SelectCharacter) | |
7611 CASE(UIMSG_ChangeSoundVolume) | |
7612 CASE(UIMSG_ChangeMusicVolume) | |
7613 CASE(UIMSG_Escape) | |
7614 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7615 CASE(UIMSG_InventoryLeftClick) | |
7616 CASE(UIMSG_SkillUp) | |
7617 CASE(UIMSG_GameMenu_ReturnToGame) | |
7618 CASE(UIMSG_StartNewGame) | |
7619 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7620 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7621 CASE(UIMSG_Game_OpenOptionsDialog) | |
7622 CASE(UIMSG_SetGraphicsMode) | |
7623 CASE(UIMSG_Quit) | |
7624 CASE(UIMSG_StartHireling1Dialogue) | |
7625 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7626 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7627 CASE(UIMSG_CastSpellFromBook) |
7628 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7629 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7630 CASE(UIMSG_StartNPCDialogue) | |
7631 CASE(UIMSG_ArrowUp) | |
7632 CASE(UIMSG_DownArrow) | |
961 | 7633 CASE(UIMSG_SaveLoadBtn) |
437 | 7634 CASE(UIMSG_SelectLoadSlot) |
7635 CASE(UIMSG_Cancel) | |
7636 CASE(UIMSG_ExitRest) | |
7637 CASE(UIMSG_PlayerCreation_FacePrev) | |
7638 CASE(UIMSG_PlayerCreation_FaceNext) | |
7639 CASE(UIMSG_CycleCharacters) | |
7640 CASE(UIMSG_SetTurnSpeed) | |
7641 CASE(UIMSG_ToggleWalkSound) | |
7642 CASE(UIMSG_ChangeVoiceVolume) | |
7643 CASE(UIMSG_ToggleShowDamage) | |
7644 CASE(UIMSG_ScrollNPCPanel) | |
7645 CASE(UIMSG_ShowFinalWindow) | |
7646 CASE(UIMSG_OpenQuestBook) | |
7647 CASE(UIMSG_OpenAutonotes) | |
7648 CASE(UIMSG_OpenMapBook) | |
7649 CASE(UIMSG_OpenCalendar) | |
7650 CASE(UIMSG_OpenHistoryBook) | |
7651 CASE(UIMSG_ToggleAlwaysRun) | |
7652 CASE(UIMSG_ToggleFlipOnExit) | |
7653 CASE(UIMSG_Game_Action) | |
907 | 7654 CASE(UIMSG_RentRoom) |
437 | 7655 CASE(UIMSG_TransitionUI_Confirm) |
7656 CASE(UIMSG_OpenKeyMappingOptions) | |
7657 CASE(UIMSG_SelectKeyPage1) | |
7658 CASE(UIMSG_SelectKeyPage2) | |
7659 CASE(UIMSG_ResetKeyMapping) | |
7660 CASE(UIMSG_ChangeKeyButton) | |
7661 CASE(UIMSG_OpenVideoOptions) | |
7662 CASE(UIMSG_ToggleBloodsplats) | |
7663 CASE(UIMSG_ToggleColoredLights) | |
7664 CASE(UIMSG_ToggleTint) | |
7665 default: | |
7666 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7667 }; | |
7668 #undef CASE | |
7669 } | |
7670 | |
0 | 7671 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7672 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7673 { |
482 | 7674 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7675 if (uNumMessages < 40) |
7676 { | |
437 | 7677 files[uNumMessages] = file; |
7678 lines[uNumMessages] = line; | |
7679 | |
0 | 7680 pMessages[uNumMessages].eType = msg; |
7681 pMessages[uNumMessages].param = param; | |
7682 pMessages[uNumMessages++].field_8 = a4; | |
7683 } | |
7684 } | |
7685 | |
7686 //----- (0042EBBE) -------------------------------------------------------- | |
7687 int __fastcall sub_42EBBE(int a1, int a2) | |
7688 { | |
7689 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7690 } | |
7691 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7692 | |
7693 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7694 int stru193_math::Sin(int angle) |
0 | 7695 { |
323 | 7696 return Cos(angle - this->uIntegerHalfPi); |
0 | 7697 } |
7698 | |
7699 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7700 void _42ECB5_PlayerAttacksActor() |
0 | 7701 { |
271 | 7702 //unsigned int v0; // ebx@1 |
7703 //Player *v1; // esi@1 | |
7704 //bool result; // eax@1 | |
295 | 7705 //int v3; // edi@2 |
271 | 7706 //unsigned int v4; // eax@7 |
0 | 7707 char *v5; // eax@8 |
271 | 7708 //int v6; // ecx@9 |
7709 //signed int v7; // eax@16 | |
295 | 7710 //Actor *v8; // edi@20 |
0 | 7711 unsigned int v9; // ecx@21 |
295 | 7712 //char *v10; // eax@26 |
0 | 7713 char *v11; // eax@26 |
7714 unsigned int v12; // eax@47 | |
295 | 7715 //char *v13; // eax@47 |
7716 //char *v14; // eax@47 | |
7717 //unsigned int v15; // ebx@54 | |
7718 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7719 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7720 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7721 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7722 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7723 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7724 //int v22; // [sp-4h] [bp-40h]@24 | |
7725 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7726 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7727 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7728 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7729 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7730 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7731 //unsigned int *v28b; |
295 | 7732 //int v29; // [sp+24h] [bp-18h]@16 |
7733 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7734 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7735 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7736 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7737 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7738 |
271 | 7739 //v0 = uActiveCharacter; |
7740 //v27 = 6972 * uActiveCharacter; | |
7741 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7742 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7743 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7744 if (!player->CanAct()) | |
7745 return; | |
7746 | |
924 | 7747 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 7748 //v3 = 0; |
271 | 7749 if (pParty->Invisible()) |
7750 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7751 | |
7752 //v31 = player->pEquipment.uBow; | |
7753 int bow_idx = player->pEquipment.uBow; | |
7754 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7755 bow_idx = 0; | |
7756 | |
295 | 7757 //v32 = 0; |
7758 int wand_item_id = 0; | |
271 | 7759 //v33 = 0; |
7760 //v4 = v1->pEquipment.uMainHand; | |
7761 int laser_weapon_item_id = 0; | |
7762 | |
7763 int main_hand_idx = player->pEquipment.uMainHand; | |
7764 if (main_hand_idx) | |
0 | 7765 { |
271 | 7766 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7767 //v5 = (char *)v1 + 36 * v4; |
271 | 7768 if (!item->Broken()) |
7769 { | |
7770 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7771 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7772 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7773 { |
295 | 7774 if (item->uNumCharges <= 0) |
7775 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7776 else |
295 | 7777 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7778 } |
271 | 7779 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7780 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7781 } |
271 | 7782 } |
7783 | |
295 | 7784 //v30 = 0; |
7785 //v29 = 0; | |
7786 //v28 = 0; | |
271 | 7787 //v7 = pMouse->uPointingObjectID; |
7788 | |
7789 int target_pid = pMouse->uPointingObjectID; | |
848 | 7790 int target_type = PID_TYPE(target_pid), |
7791 target_id = PID_ID(target_pid); | |
271 | 7792 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7793 { | |
7794 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7795 target_type = PID_TYPE(target_pid); |
7796 target_id = PID_ID(target_pid); | |
271 | 7797 } |
295 | 7798 |
7799 auto actor = &pActors[target_id]; | |
7800 int actor_distance = 0; | |
271 | 7801 if (target_type == OBJECT_Actor) |
7802 { | |
295 | 7803 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7804 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7805 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7806 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7807 if (actor_distance < 0) | |
7808 actor_distance = 0; | |
7809 } | |
7810 | |
7811 bool shooting_bow = false, | |
7812 shotting_laser = false, | |
816 | 7813 shooting_wand = false, |
7814 melee_attack = false; | |
295 | 7815 if (laser_weapon_item_id) |
7816 { | |
7817 shotting_laser = true; | |
490 | 7818 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7819 } |
7820 else if (wand_item_id) | |
7821 { | |
7822 shooting_wand = true; | |
7823 | |
7824 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7825 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7826 |
7827 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7828 player->pEquipment.uMainHand = 0; | |
7829 } | |
303 | 7830 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7831 { |
816 | 7832 melee_attack = true; |
7833 | |
303 | 7834 Vec3_int_ a3; |
7835 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7836 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7837 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7838 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7839 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7840 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7841 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7842 _42FA66_do_explosive_impact( |
7843 actor->vPosition.x, | |
7844 actor->vPosition.y, | |
7845 actor->vPosition.z + actor->uActorHeight / 2, | |
7846 0, 512, uActiveCharacter); | |
303 | 7847 } |
7848 else if (bow_idx) | |
7849 { | |
7850 shooting_bow = true; | |
490 | 7851 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7852 } |
7853 else | |
7854 { | |
816 | 7855 melee_attack = true; |
303 | 7856 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7857 } | |
7858 | |
816 | 7859 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7860 { |
816 | 7861 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7862 if (recovery < 30 ) |
7863 recovery = 30; | |
816 | 7864 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7865 } |
7866 | |
7867 | |
7868 int v34 = 0; | |
7869 if (shooting_wand) | |
7870 return; | |
7871 else if (shooting_bow) | |
7872 { | |
7873 v34 = 5; | |
7874 player->PlaySound(SPEECH_50, 0); | |
7875 } | |
7876 if (shotting_laser) | |
7877 v34 = 7; | |
7878 else | |
7879 { | |
7880 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7881 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7882 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7883 pTurnEngine->_40471C(); | |
7884 } | |
7885 | |
7886 switch (v34) | |
7887 { | |
7888 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7889 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7890 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7891 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7892 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7893 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7894 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7895 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7896 } | |
0 | 7897 } |
7898 | |
7899 //----- (0042F184) -------------------------------------------------------- | |
295 | 7900 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7901 { |
7902 int v4; // edi@1 | |
7903 stru319 *v5; // esi@1 | |
7904 int v6; // eax@2 | |
7905 int v7; // eax@4 | |
7906 int result; // eax@5 | |
7907 int *v9; // edx@8 | |
7908 signed int v10; // ebx@10 | |
7909 int v11; // edi@11 | |
7910 Actor *v12; // esi@12 | |
7911 unsigned __int16 v13; // ax@12 | |
7912 int v14; // eax@22 | |
7913 char v15; // zf@30 | |
7914 int v16; // esi@32 | |
7915 int v17; // ecx@34 | |
7916 stru319 *v18; // eax@39 | |
7917 int v19; // edx@39 | |
7918 int v20; // ecx@41 | |
7919 unsigned __int16 v21; // ax@42 | |
7920 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7921 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7922 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7923 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7924 int *v26; // [sp+18h] [bp-14h]@8 | |
7925 int v27; // [sp+1Ch] [bp-10h]@10 | |
7926 int *v28; // [sp+20h] [bp-Ch]@10 | |
7927 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7928 int v30; // [sp+28h] [bp-4h]@6 | |
7929 int i; // [sp+38h] [bp+Ch]@33 | |
7930 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7931 | |
7932 v4 = 0; | |
7933 v5 = this; | |
7934 v24 = this; | |
7935 if ( pRenderer->pRenderD3D ) | |
7936 { | |
7937 v6 = a3 != 0; | |
7938 if ( a4 ) | |
7939 LOBYTE(v6) = v6 | 8; | |
295 | 7940 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7941 if ( v7 != -1 ) |
7942 return (unsigned __int16)v7; | |
295 | 7943 else return 0; |
0 | 7944 } |
7945 else | |
7946 { | |
7947 v30 = 0; | |
7948 if ( pRenderer->pActiveZBuffer ) | |
7949 { | |
692 | 7950 v29 = viewparams->uScreen_topL_X; |
7951 v23 = viewparams->uScreen_BttmR_X; | |
7952 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7953 { |
692 | 7954 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7955 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7956 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7957 do |
7958 { | |
7959 if ( (signed int)v29 < (signed int)v23 ) | |
7960 { | |
7961 v28 = v9; | |
7962 v10 = v4; | |
7963 v27 = v23 - v29; | |
7964 do | |
7965 { | |
7966 v22 = *v28; | |
7967 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7968 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 7969 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7970 v12 = &pActors[PID_ID(v11)]; |
0 | 7971 v13 = v12->uAIState; |
7972 if ( v13 != 5 ) | |
7973 { | |
7974 if ( v13 != 4 | |
7975 && v13 != 11 | |
7976 && v13 != 19 | |
7977 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7978 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 7979 { |
7980 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 7981 && v22 <= pick_depth << 16 ) |
0 | 7982 { |
7983 v14 = 0; | |
7984 if ( v10 > 0 ) | |
7985 { | |
7986 do | |
7987 { | |
7988 if ( dword_50BDA0[v14] == v11 ) | |
7989 break; | |
7990 ++v14; | |
7991 } | |
7992 while ( v14 < v30 ); | |
7993 } | |
7994 if ( v14 == v30 && v10 < 100 ) | |
7995 { | |
7996 ++v30; | |
7997 dword_50BC10[v10] = v22; | |
7998 dword_50BDA0[v10] = v11; | |
7999 ++v10; | |
8000 } | |
8001 } | |
8002 } | |
8003 } | |
8004 } | |
8005 ++v28; | |
8006 --v27; | |
8007 } | |
8008 while ( v27 ); | |
8009 v4 = v30; | |
8010 v5 = v24; | |
8011 } | |
8012 v9 = v26 + 640; | |
8013 v15 = v25-- == 1; | |
8014 v26 += 640; | |
8015 } | |
8016 while ( !v15 ); | |
8017 } | |
8018 if ( v4 > 0 ) | |
8019 { | |
8020 v32 = 1; | |
8021 v16 = (int)dword_50BC10; | |
8022 do | |
8023 { | |
8024 for ( i = v32; i < v4; ++i ) | |
8025 { | |
8026 v17 = dword_50BC10[i]; | |
8027 if ( v17 < *(int *)v16 ) | |
8028 { | |
8029 dword_50BC10[i] = *(int *)v16; | |
8030 *(int *)v16 = v17; | |
8031 } | |
8032 } | |
8033 ++v32; | |
8034 v16 += 4; | |
8035 } | |
8036 while ( v32 - 1 < v4 ); | |
8037 v5 = v24; | |
8038 if ( v4 > 0 ) | |
8039 { | |
8040 v18 = v24; | |
8041 v19 = v4; | |
8042 do | |
8043 { | |
8044 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8045 v18 += 4; | |
8046 --v19; | |
8047 } | |
8048 while ( v19 ); | |
8049 } | |
8050 } | |
8051 v20 = 0; | |
8052 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8053 { | |
8054 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8055 if ( v21 != 4 && v21 != 5 ) | |
8056 break; | |
8057 } | |
8058 if ( v20 != v4 ) | |
8059 { | |
8060 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8061 LOBYTE(result) = result | 3; | |
8062 return result; | |
8063 } | |
8064 } | |
8065 } | |
8066 return 0; | |
8067 } | |
8068 | |
8069 //----- (0042F3D6) -------------------------------------------------------- | |
8070 void InitializeTurnBasedAnimations(void *_this) | |
8071 { | |
8072 unsigned int *v1; // edi@1 | |
8073 | |
8074 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8075 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8076 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8077 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8078 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8079 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8080 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8081 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8082 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8083 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8084 v1 = pIconIDs_Turn; | |
8085 do | |
8086 { | |
8087 pIconsFrameTable->InitializeAnimation(*v1); | |
8088 ++v1; | |
8089 } | |
8090 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8091 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8092 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8093 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8094 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8095 } | |
8096 | |
8097 //----- (0042F4DA) -------------------------------------------------------- | |
8098 signed int __cdecl sub_42F4DA() | |
8099 { | |
8100 signed int v0; // edi@1 | |
82 | 8101 Actor *v1; // esi@4 |
0 | 8102 int v2; // ebx@5 |
8103 int v3; // eax@5 | |
8104 int v4; // ebx@5 | |
8105 unsigned int v5; // ecx@5 | |
8106 int v6; // edx@6 | |
8107 unsigned int v7; // edx@8 | |
8108 unsigned int v8; // edx@10 | |
8109 __int16 v9; // ax@12 | |
8110 signed int result; // eax@20 | |
8111 int v11; // [sp+Ch] [bp-10h]@5 | |
8112 int v12; // [sp+10h] [bp-Ch]@5 | |
8113 signed int v13; // [sp+14h] [bp-8h]@3 | |
8114 | |
8115 v0 = 5120; | |
8116 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8117 v0 = 2560; | |
8118 v13 = 0; | |
8119 if ( (signed int)uNumActors <= 0 ) | |
8120 { | |
8121 LABEL_20: | |
8122 result = 0; | |
8123 } | |
8124 else | |
8125 { | |
82 | 8126 v1 = pActors; |
0 | 8127 while ( 1 ) |
8128 { | |
82 | 8129 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8130 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8131 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8132 v3 = v2; |
8133 v4 = v11; | |
8134 v5 = v12; | |
8135 if ( v3 < v11 ) | |
8136 { | |
8137 v6 = v3; | |
8138 v3 = v11; | |
8139 v4 = v6; | |
8140 } | |
8141 if ( v3 < v12 ) | |
8142 { | |
8143 v7 = v3; | |
8144 v3 = v12; | |
8145 v5 = v7; | |
8146 } | |
8147 if ( v4 < (signed int)v5 ) | |
8148 { | |
8149 v8 = v5; | |
8150 v5 = v4; | |
8151 v4 = v8; | |
8152 } | |
8153 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8154 { | |
82 | 8155 v9 = v1->uAIState; |
8156 if ( v1->uAIState != 5 ) | |
0 | 8157 { |
8158 if ( v9 != 4 | |
8159 && v9 != 11 | |
8160 && v9 != 19 | |
8161 && v9 != 17 | |
82 | 8162 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8163 break; |
8164 } | |
8165 } | |
8166 ++v13; | |
82 | 8167 ++v1; |
0 | 8168 if ( v13 >= (signed int)uNumActors ) |
8169 goto LABEL_20; | |
8170 } | |
8171 result = 1; | |
8172 } | |
8173 return result; | |
8174 } | |
8175 | |
8176 //----- (0042F7EB) -------------------------------------------------------- | |
8177 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) | |
8178 { | |
8179 unsigned int v9; // edi@1 | |
8180 signed int v10; // edx@3 | |
8181 char *v11; // ecx@4 | |
8182 unsigned __int16 v12; // ax@7 | |
8183 unsigned int v13; // edx@9 | |
8184 char *v14; // ecx@10 | |
8185 int v15; // esi@17 | |
8186 int v16; // eax@18 | |
8187 int v17; // edi@20 | |
8188 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8189 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8190 int v21; // [sp+7Ch] [bp-8h]@1 |
8191 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8192 | |
8193 v9 = uSpriteID; | |
8194 v21 = x; | |
8195 v22 = uSpriteID; | |
8196 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8197 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
|
8198 //SpriteObject::SpriteObject(&a1a); |
0 | 8199 a1a.stru_24.Reset(); |
8200 | |
8201 if ( a9 ) | |
8202 { | |
8203 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8204 v9 = v22; | |
8205 } | |
8206 v10 = 0; | |
822 | 8207 a1a.spell_skill = 0; |
8208 a1a.spell_level = 0; | |
8209 a1a.spell_id = 0; | |
0 | 8210 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8211 a1a.uType = v9; |
0 | 8212 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8213 { | |
8214 LABEL_7: | |
8215 v12 = 0; | |
8216 } | |
8217 else | |
8218 { | |
8219 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8220 while ( (short)v9 != *(short *)v11 ) | |
8221 { | |
8222 ++v10; | |
8223 v11 += 56; | |
8224 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8225 goto LABEL_7; | |
8226 } | |
8227 v12 = v10; | |
8228 } | |
8229 a1a.uObjectDescID = v12; | |
8230 a1a.vPosition.z = z; | |
8231 a1a.vPosition.x = v21; | |
8232 a1a.vPosition.y = y; | |
8233 a1a.uSoundID = 0; | |
8234 a1a.uAttributes = attributes; | |
8235 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8236 a1a.uSpriteFrameID = 0; | |
822 | 8237 a1a.spell_caster_pid = 0; |
823 | 8238 a1a.spell_target_pid = 0; |
0 | 8239 if ( !(a1a.uAttributes & 0x10) ) |
8240 { | |
8241 v13 = 0; | |
222 | 8242 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8243 { |
8244 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8245 while ( *(short *)v14 != v9 ) | |
8246 { | |
8247 ++v13; | |
8248 v14 += 48; | |
222 | 8249 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8250 goto LABEL_16; |
8251 } | |
8252 a1a.stru_24.uItemID = v13; | |
8253 } | |
8254 } | |
8255 LABEL_16: | |
8256 if ( a7 ) | |
8257 { | |
8258 v15 = count; | |
8259 if ( count > 0 ) | |
8260 { | |
8261 do | |
8262 { | |
8263 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8264 v16 = rand(); | |
8265 a1a.Create( | |
8266 (signed __int16)a1a.uFacing, | |
8267 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8268 a4, | |
8269 0); | |
8270 --v15; | |
8271 } | |
8272 while ( v15 ); | |
8273 } | |
8274 } | |
8275 else | |
8276 { | |
8277 v17 = count; | |
8278 v18 = stru_5C6E00->uIntegerHalfPi; | |
8279 a1a.uFacing = 0; | |
8280 if ( count > 0 ) | |
8281 { | |
8282 do | |
8283 { | |
8284 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8285 --v17; | |
8286 } | |
8287 while ( v17 ); | |
8288 } | |
8289 } | |
8290 return 1; | |
8291 } | |
8292 | |
8293 //----- (0042F960) -------------------------------------------------------- | |
8294 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8295 { | |
8296 int v3; // ebx@1 | |
8297 int v4; // edi@1 | |
8298 signed int v5; // edx@1 | |
8299 char *v6; // ecx@2 | |
8300 unsigned __int16 v7; // ax@5 | |
8301 signed int v8; // eax@6 | |
8302 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8303 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8304 |
8305 v3 = x; | |
8306 v4 = y; | |
8307 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8308 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
|
8309 //SpriteObject::SpriteObject(&a1); |
0 | 8310 a1.stru_24.Reset(); |
8311 | |
8312 v5 = 0; | |
822 | 8313 a1.spell_skill = 0; |
8314 a1.spell_level = 0; | |
8315 a1.spell_id = 0; | |
0 | 8316 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8317 a1.uType = 800; |
0 | 8318 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8319 { | |
8320 LABEL_5: | |
8321 v7 = 0; | |
8322 } | |
8323 else | |
8324 { | |
8325 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8326 while ( *(short *)v6 != 800 ) | |
8327 { | |
8328 ++v5; | |
8329 v6 += 56; | |
8330 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8331 goto LABEL_5; | |
8332 } | |
8333 v7 = v5; | |
8334 } | |
8335 a1.uObjectDescID = v7; | |
8336 a1.vPosition.x = v3; | |
8337 a1.vPosition.y = v4; | |
8338 a1.vPosition.z = z; | |
8339 a1.uSoundID = 0; | |
8340 a1.uAttributes = 0; | |
8341 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8342 a1.uSpriteFrameID = 0; | |
822 | 8343 a1.spell_caster_pid = 0; |
823 | 8344 a1.spell_target_pid = 0; |
0 | 8345 v8 = a1.Create(0, 0, 0, 0); |
8346 if ( v8 != -1 ) | |
8347 { | |
8348 v9 = 8 * v8; | |
8349 LOBYTE(v9) = v9 | 2; | |
8350 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8351 } | |
8352 } | |
8353 | |
810 | 8354 |
0 | 8355 |
8356 //----- (0042FA66) -------------------------------------------------------- | |
8357 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8358 { | |
8359 int v6; // edi@1 | |
8360 int v7; // esi@1 | |
8361 char *v8; // ecx@2 | |
8362 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8363 //int v10; // eax@10 |
0 | 8364 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8365 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8366 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8367 int v14; // [sp+7Ch] [bp-4h]@1 |
8368 | |
8369 v6 = a1; | |
8370 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8371 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
|
8372 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8373 a1a.uType = 600; |
0 | 8374 a1a.stru_24.Reset(); |
8375 | |
822 | 8376 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8377 a1a.spell_level = 8; | |
8378 a1a.spell_skill = 3; | |
0 | 8379 v14 = 0; |
8380 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8381 { | |
8382 LABEL_5: | |
8383 v9 = 0; | |
8384 } | |
8385 else | |
8386 { | |
8387 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8388 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8389 { |
8390 ++v14; | |
8391 v8 += 56; | |
8392 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8393 goto LABEL_5; | |
8394 } | |
8395 v9 = v14; | |
8396 } | |
8397 a1a.uObjectDescID = v9; | |
8398 a1a.vPosition.x = v6; | |
8399 a1a.vPosition.y = v7; | |
8400 a1a.vPosition.z = a3; | |
8401 a1a.uAttributes = 0; | |
8402 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8403 a1a.uSpriteFrameID = 0; | |
823 | 8404 a1a.spell_target_pid = 0; |
0 | 8405 a1a.field_60_distance_related_prolly_lod = 0; |
8406 a1a.uFacing = 0; | |
8407 a1a.uSoundID = 0; | |
8408 if ( a6 >= 1 || a6 <= 4 ) | |
8409 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8410 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8411 } |
8412 else | |
8413 { | |
822 | 8414 a1a.spell_caster_pid = 0; |
0 | 8415 } |
8416 result = a1a.Create(0, 0, 0, 0); | |
8417 if ( result != -1 ) | |
8418 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8419 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8420 a5, |
8421 SLOWORD(a1a.vPosition.x), | |
8422 SLOWORD(a1a.vPosition.y), | |
8423 SLOWORD(a1a.vPosition.z), | |
8424 0, | |
8425 0); | |
8426 } | |
8427 return result; | |
8428 } | |
8429 | |
8430 //----- (0042FB5C) -------------------------------------------------------- | |
8431 bool __fastcall sub_42FB5C(signed int a1) | |
8432 { | |
8433 int v1; // ecx@3 | |
8434 int v2; // ecx@4 | |
8435 int v3; // ecx@5 | |
8436 int v4; // ecx@6 | |
8437 int v5; // ecx@7 | |
8438 int v6; // ecx@8 | |
8439 char v7; // zf@9 | |
8440 | |
8441 if ( a1 > 39 ) | |
8442 { | |
8443 if ( a1 > 77 ) | |
8444 { | |
8445 if ( a1 == 80 ) | |
8446 return 0; | |
8447 if ( a1 > 84 ) | |
8448 { | |
8449 if ( a1 <= 86 ) | |
8450 return 0; | |
8451 v7 = a1 == 95; | |
8452 goto LABEL_20; | |
8453 } | |
8454 } | |
8455 else | |
8456 { | |
8457 if ( a1 == 77 ) | |
8458 return 0; | |
8459 if ( a1 >= 46 ) | |
8460 { | |
8461 if ( a1 <= 47 || a1 == 51 ) | |
8462 return 0; | |
8463 v7 = a1 == 73; | |
8464 goto LABEL_20; | |
8465 } | |
8466 } | |
8467 return 1; | |
8468 } | |
8469 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8470 return 1; | |
8471 v2 = v1 - 3; | |
8472 if ( !v2 ) | |
8473 return 0; | |
8474 v3 = v2 - 1; | |
8475 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8476 return 1; | |
8477 v5 = v4 - 8; | |
8478 if ( !v5 ) | |
8479 return 0; | |
8480 v6 = v5 - 1; | |
8481 if ( !v6 ) | |
8482 return 1; | |
8483 v7 = v6 == 20; | |
8484 LABEL_20: | |
8485 if ( !v7 ) | |
8486 return 1; | |
8487 return 0; | |
8488 } | |
8489 | |
8490 //----- (0042FBDD) -------------------------------------------------------- | |
8491 void __cdecl sub_42FBDD() | |
8492 { | |
388 | 8493 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8494 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8495 pRenderer->Present(); | |
8496 } | |
8497 | |
8498 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8499 void __cdecl CloseWindowBackground() |
0 | 8500 { |
388 | 8501 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8502 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8503 pRenderer->Present(); | |
8504 } | |
8505 | |
8506 //----- (0042FC4E) -------------------------------------------------------- | |
8507 void __cdecl ProcessInputActions() | |
8508 { | |
8509 char v4; // al@9 | |
8510 char v8; // bl@100 | |
8511 unsigned __int16 v9; // ax@102 | |
8512 int v10; // eax@103 | |
8513 char v14; // al@159 | |
8514 unsigned int v15; // eax@168 | |
8515 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8516 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8517 int v24; // [sp+4h] [bp-4h]@87 | |
8518 | |
8519 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8520 auto pKeyboard = pGame->pKeyboardInstance; | |
8521 if (!bAlwaysRun) | |
8522 { | |
8523 if (pKeyboard->IsShiftHeld()) | |
8524 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8525 else | |
8526 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8527 } | |
8528 else | |
8529 { | |
8530 if (pKeyboard->IsShiftHeld()) | |
8531 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8532 else | |
8533 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8534 } | |
8535 | |
140 | 8536 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
998 | 8537 for ( uint i = 0; i < 30; ++i ) |
8538 { | |
8539 if ( pKeyActionMap->pToggleTypes[i] ) | |
8540 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
8541 else | |
8542 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
8543 if ( v14 && i == 9 ) | |
8544 { | |
8545 if ( !pCurrentScreen ) | |
8546 { | |
8547 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
8548 continue; | |
8549 } | |
8550 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
8551 { | |
8552 v15 = pMessageQueue_50CBD0->uNumMessages; | |
8553 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8554 { | |
8555 v15 = 0; | |
8556 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
8557 { | |
8558 v15 = 1; | |
8559 pMessageQueue_50CBD0->uNumMessages = 0; | |
8560 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
8561 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8562 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8563 ++pMessageQueue_50CBD0->uNumMessages; | |
8564 continue; | |
8565 } | |
8566 pMessageQueue_50CBD0->uNumMessages = 0; | |
8567 } | |
8568 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
8569 } | |
8570 } | |
8571 } | |
0 | 8572 if ( !pEventTimer->bPaused ) |
8573 { | |
998 | 8574 for ( uint i = 0; i < 30; ++i ) |
0 | 8575 { |
998 | 8576 inputAction = (InputAction)i; |
8577 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
8578 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 8579 else |
998 | 8580 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 8581 if ( v4 ) |
8582 { | |
8583 switch ( inputAction ) | |
8584 { | |
8585 case INPUT_MoveForward: | |
271 | 8586 if (pCurrentScreen != SCREEN_GAME) |
0 | 8587 break; |
8588 if (!pParty->bTurnBasedModeOn) | |
8589 { | |
140 | 8590 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8591 partyAction = PARTY_RunForward; |
8592 else | |
8593 partyAction = PARTY_WalkForward; | |
998 | 8594 pPartyActionQueue->Add(partyAction); |
163 | 8595 break; |
8596 } | |
8597 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8598 { | |
8599 pTurnEngine->uActionPointsLeft -= 26; | |
8600 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8601 partyAction = PARTY_RunForward; | |
8602 else | |
8603 partyAction = PARTY_WalkForward; | |
998 | 8604 pPartyActionQueue->Add(partyAction); |
163 | 8605 break; |
0 | 8606 } |
8607 break; | |
8608 case INPUT_MoveBackwards: | |
271 | 8609 if (pCurrentScreen != SCREEN_GAME) |
0 | 8610 break; |
8611 if (!pParty->bTurnBasedModeOn) | |
17 | 8612 { |
8613 if ( pParty->uFlags2 & 2 ) | |
8614 partyAction = PARTY_RunBackward; | |
8615 else | |
8616 partyAction = PARTY_WalkBackward; | |
998 | 8617 pPartyActionQueue->Add(partyAction); |
163 | 8618 break; |
17 | 8619 } |
0 | 8620 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8621 { | |
8622 pTurnEngine->uActionPointsLeft -= 26; | |
8623 if ( pParty->uFlags2 & 2 ) | |
8624 partyAction = PARTY_RunBackward; | |
8625 else | |
8626 partyAction = PARTY_WalkBackward; | |
998 | 8627 pPartyActionQueue->Add(partyAction); |
163 | 8628 break; |
0 | 8629 } |
8630 break; | |
8631 case INPUT_StrafeLeft: | |
271 | 8632 if (pCurrentScreen != SCREEN_GAME) |
0 | 8633 break; |
8634 if (!pParty->bTurnBasedModeOn) | |
17 | 8635 { |
8636 partyAction = PARTY_StrafeLeft; | |
998 | 8637 pPartyActionQueue->Add(partyAction); |
163 | 8638 break; |
17 | 8639 } |
0 | 8640 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8641 break; | |
8642 pTurnEngine->uActionPointsLeft -= 26; | |
8643 partyAction = PARTY_StrafeLeft; | |
998 | 8644 pPartyActionQueue->Add(partyAction); |
8645 break; | |
0 | 8646 case INPUT_StrafeRight: |
271 | 8647 if (pCurrentScreen != SCREEN_GAME) |
0 | 8648 break; |
8649 if (!pParty->bTurnBasedModeOn) | |
17 | 8650 { |
8651 partyAction = PARTY_StrafeRight; | |
998 | 8652 pPartyActionQueue->Add(partyAction); |
163 | 8653 break; |
17 | 8654 } |
0 | 8655 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8656 break; | |
8657 pTurnEngine->uActionPointsLeft -= 26; | |
8658 partyAction = PARTY_StrafeRight; | |
998 | 8659 pPartyActionQueue->Add(partyAction); |
163 | 8660 break; |
0 | 8661 case INPUT_TurnLeft: |
271 | 8662 if (pCurrentScreen != SCREEN_GAME) |
0 | 8663 break; |
8664 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8665 { | |
8666 if (pParty->bTurnBasedModeOn) | |
8667 { | |
8668 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8669 break; | |
8670 pTurnEngine->uActionPointsLeft -= 26; | |
8671 } | |
998 | 8672 partyAction = PARTY_StrafeLeft; |
0 | 8673 } |
8674 else | |
8675 { | |
8676 if ( pParty->uFlags2 & 2 ) | |
998 | 8677 partyAction = PARTY_FastTurnLeft; |
0 | 8678 else |
998 | 8679 partyAction = PARTY_TurnLeft; |
0 | 8680 } |
998 | 8681 pPartyActionQueue->Add(partyAction); |
0 | 8682 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
8683 { | |
271 | 8684 pWeather->OnPlayerTurn(10); |
0 | 8685 } |
8686 break; | |
8687 case INPUT_TurnRight: | |
271 | 8688 if (pCurrentScreen != SCREEN_GAME) |
0 | 8689 break; |
8690 if ( GetAsyncKeyState(17) ) // strafing | |
8691 { | |
8692 if (pParty->bTurnBasedModeOn) | |
8693 { | |
8694 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8695 break; | |
8696 pTurnEngine->uActionPointsLeft -= 26; | |
8697 } | |
998 | 8698 partyAction = PARTY_StrafeRight; |
0 | 8699 } |
8700 else | |
8701 { | |
8702 if ( pParty->uFlags2 & 2 ) | |
998 | 8703 partyAction = PARTY_FastTurnRight; |
0 | 8704 else |
998 | 8705 partyAction = PARTY_TurnRight; |
0 | 8706 } |
998 | 8707 pPartyActionQueue->Add(partyAction); |
0 | 8708 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
8709 { | |
271 | 8710 pWeather->OnPlayerTurn(-10); |
0 | 8711 } |
8712 break; | |
8713 case INPUT_Jump: | |
271 | 8714 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8715 break; |
8716 partyAction = (PartyAction)12; | |
998 | 8717 pPartyActionQueue->Add(partyAction); |
163 | 8718 break; |
0 | 8719 case INPUT_Yell: |
187 | 8720 if (!pCurrentScreen && uActiveCharacter) |
0 | 8721 { |
8722 pParty->Yell(); | |
187 | 8723 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8724 } |
187 | 8725 break; |
0 | 8726 case INPUT_Pass: |
8727 if ( pCurrentScreen ) | |
8728 break; | |
8729 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8730 { |
8731 pTurnEngine->field_18 |= 8u; | |
8732 break; | |
8733 } | |
0 | 8734 if ( uActiveCharacter ) |
8735 { | |
998 | 8736 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 8737 { |
998 | 8738 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 8739 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8740 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 8741 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 8742 pTurnEngine->_40471C(); |
8743 } | |
8744 } | |
8745 break; | |
998 | 8746 case INPUT_Combat://if press ENTER |
271 | 8747 if (pCurrentScreen == SCREEN_GAME) |
0 | 8748 { |
8749 if (pParty->bTurnBasedModeOn) | |
8750 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8751 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8752 { |
8753 pParty->bTurnBasedModeOn = 0; | |
8754 pTurnEngine->End(true); | |
8755 } | |
8756 } | |
8757 else | |
8758 { | |
8759 pTurnEngine->Start(); | |
8760 pParty->bTurnBasedModeOn = true; | |
8761 } | |
8762 } | |
8763 break; | |
8764 case INPUT_CastReady: | |
271 | 8765 if (pCurrentScreen != SCREEN_GAME) |
0 | 8766 break; |
8767 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8768 { |
8769 pTurnEngine->field_18 |= 8u; | |
8770 break; | |
8771 } | |
0 | 8772 if ( !uActiveCharacter ) |
8773 break; | |
998 | 8774 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 8775 if ( !v8 |
8776 || bUnderwater | |
998 | 8777 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
8778 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
8779 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
8780 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
8781 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
8782 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 8783 { |
998 | 8784 pPartyActionQueue = pPartyActionQueue; |
437 | 8785 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8786 break; | |
0 | 8787 } |
8788 else | |
8789 { | |
998 | 8790 /*if ( dword_50C9E8 < 40 ) |
0 | 8791 { |
8792 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8793 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8794 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8795 ++dword_50C9E8; |
998 | 8796 }*/ |
8797 pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0); | |
0 | 8798 } |
8799 break; | |
8800 case INPUT_Attack: | |
271 | 8801 if (pCurrentScreen != SCREEN_GAME) |
0 | 8802 break; |
998 | 8803 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3) |
8804 { | |
8805 pTurnEngine->field_18 |= 8u; | |
8806 break; | |
8807 } | |
8808 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 8809 break; |
8810 case INPUT_EventTrigger: | |
271 | 8811 if (pCurrentScreen == SCREEN_GAME) |
0 | 8812 { |
437 | 8813 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 8814 break; |
0 | 8815 } |
151 | 8816 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8817 { |
8818 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8819 { | |
437 | 8820 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 8821 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8822 { | |
8823 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 8824 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 8825 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8826 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8827 ++pMessageQueue_50CBD0->uNumMessages; | |
8828 break; | |
8829 } | |
437 | 8830 break; |
0 | 8831 } |
437 | 8832 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 8833 } |
8834 break; | |
8835 case INPUT_CharCycle: | |
998 | 8836 if ( pCurrentScreen == SCREEN_SPELL_BOOK )// || dword_50C9E8 >= 40 ) |
0 | 8837 break; |
998 | 8838 /*dword_50C9EC[3 * dword_50C9E8] = 176; |
437 | 8839 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8840 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
998 | 8841 ++dword_50C9E8;*/ |
8842 pMessageQueue_50CBD0->AddMessage(UIMSG_CycleCharacters, 0, 0); | |
163 | 8843 break; |
0 | 8844 case INPUT_LookUp: |
8845 if ( pEventTimer->bPaused ) | |
8846 break; | |
8847 partyAction = (PartyAction)7; | |
998 | 8848 pPartyActionQueue->Add(partyAction); |
163 | 8849 break; |
0 | 8850 case INPUT_CenterView: |
8851 if ( pEventTimer->bPaused ) | |
8852 break; | |
8853 partyAction = (PartyAction)9; | |
998 | 8854 pPartyActionQueue->Add(partyAction); |
163 | 8855 break; |
0 | 8856 case INPUT_LookDown: |
8857 if ( pEventTimer->bPaused ) | |
8858 break; | |
8859 partyAction = (PartyAction)8; | |
998 | 8860 pPartyActionQueue->Add(partyAction); |
163 | 8861 break; |
0 | 8862 case INPUT_FlyUp: |
998 | 8863 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 8864 break; |
8865 partyAction = (PartyAction)13; | |
998 | 8866 pPartyActionQueue->Add(partyAction); |
163 | 8867 break; |
0 | 8868 case INPUT_Land: |
998 | 8869 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 8870 break; |
8871 partyAction = (PartyAction)15; | |
998 | 8872 pPartyActionQueue->Add(partyAction); |
163 | 8873 break; |
0 | 8874 case INPUT_FlyDown: |
8875 if ( !pCurrentScreen | |
8876 && !pEventTimer->bPaused ) | |
8877 { | |
8878 partyAction = (PartyAction)14; | |
998 | 8879 pPartyActionQueue->Add(partyAction); |
0 | 8880 } |
8881 break; | |
8882 case INPUT_ZoomIn: | |
998 | 8883 /*if ( dword_50C9E8 >= 40 ) |
0 | 8884 break; |
8885 dword_50C9EC[3 * dword_50C9E8] = 367; | |
437 | 8886 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8887 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
998 | 8888 ++dword_50C9E8;*/ |
8889 pMessageQueue_50CBD0->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); | |
163 | 8890 break; |
0 | 8891 case INPUT_ZoomOut: |
998 | 8892 /*if ( dword_50C9E8 < 40 ) |
0 | 8893 { |
8894 dword_50C9EC[3 * dword_50C9E8] = 368; | |
437 | 8895 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8896 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8897 ++dword_50C9E8; |
998 | 8898 }*/ |
8899 pMessageQueue_50CBD0->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); | |
0 | 8900 break; |
8901 case INPUT_AlwaysRun: | |
8902 bAlwaysRun = bAlwaysRun == 0; | |
8903 break; | |
17 | 8904 default: |
8905 break; | |
0 | 8906 } |
8907 } | |
8908 } | |
8909 } | |
8910 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
8911 { | |
8912 AsyncKeyboard::LeaveCriticalSection(); | |
998 | 8913 //v16 = pAsyncKeyboard; |
0 | 8914 AsyncKeyboard::EnterCriticalSection(); |
998 | 8915 memset((char *)pAsyncKeyboard + 521, 0, 0x100u); |
0 | 8916 AsyncKeyboard::LeaveCriticalSection(); |
8917 } | |
8918 } |