Mercurial > mm7
annotate mm7_6.cpp @ 1013:0cef8c6aa893
case SPELL_WATER_ENCHANT_ITEM refactor
author | zipi |
---|---|
date | Sun, 19 May 2013 16:18:09 +0100 |
parents | 9e823ad5eaa6 |
children | 9ac94d00012e |
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 { |
2413 int v2; // edi@1 | |
924 | 2414 CastSpellInfo *pCastSpell; // ebx@2 |
0 | 2415 signed int v6; // eax@14 |
2416 unsigned __int16 v11; // cx@45 | |
2417 unsigned __int8 v14; // zf@53 | |
2418 signed int i; // esi@76 | |
2419 __int16 v23; // ax@88 | |
2420 int v51; // eax@146 | |
2421 __int16 v52; // ax@153 | |
2422 signed __int64 v54; // qax@164 | |
1005 | 2423 Actor *v55; // edi@164 |
0 | 2424 signed __int64 v58; // qax@177 |
1005 | 2425 Actor *pActor; // edi@177 |
0 | 2426 unsigned __int16 v60; // ax@184 |
2427 int v61; // ecx@184 | |
89 | 2428 ItemGen *v69; // esi@211 |
0 | 2429 double v90; // st7@245 |
89 | 2430 Player *v92; // eax@255 |
0 | 2431 int v105; // edi@271 |
2432 __int16 v108; // ST1C_2@274 | |
2433 __int16 v109; // ST18_2@274 | |
2434 stru6 *v110; // eax@274 | |
2435 int v111; // eax@274 | |
2436 Actor *v112; // esi@278 | |
2437 int v113; // eax@278 | |
2438 int v114; // ebx@278 | |
2439 unsigned int v115; // ecx@278 | |
2440 int v116; // edx@279 | |
2441 int v117; // edx@281 | |
2442 int v118; // edx@283 | |
2443 signed int v122; // eax@286 | |
2444 int v127; // eax@296 | |
2445 int v153; // ecx@322 | |
2446 int v154; // eax@322 | |
2447 int v155; // eax@323 | |
2448 int v156; // eax@323 | |
2449 int v162; // edi@340 | |
2450 signed int v164; // eax@340 | |
2451 signed int v165; // edi@340 | |
2452 signed int v168; // edi@343 | |
2453 int v169; // eax@344 | |
2454 signed int v174; // edi@355 | |
2455 int v188; // esi@369 | |
2456 int v189; // edi@369 | |
2457 signed int v191; // edi@379 | |
2458 signed int v205; // edi@405 | |
2459 int v206; // eax@407 | |
2460 __int16 v207; // cx@407 | |
2461 int v208; // eax@411 | |
2462 signed int v209; // ecx@412 | |
2463 int v210; // edx@412 | |
2464 signed int v211; // ecx@412 | |
2465 int v212; // eax@413 | |
2466 int v213; // eax@413 | |
2467 int v214; // eax@413 | |
2468 int v215; // eax@415 | |
2469 double v216; // st7@415 | |
2470 double v217; // st6@415 | |
2471 signed __int64 v218; // qtt@423 | |
2472 char v223; // al@438 | |
1009 | 2473 |
0 | 2474 int v227; // esi@453 |
2475 unsigned int v228; // edi@454 | |
2476 int v229; // edi@466 | |
1009 | 2477 |
1013 | 2478 ItemGen *v240; // ecx@472 |
0 | 2479 double v241; // st7@478 |
1013 | 2480 ItemGen *v245; // edi@492 |
0 | 2481 int v254; // eax@513 |
2482 int v255; // esi@513 | |
2483 int v256; // ecx@513 | |
2484 int v257; // edx@514 | |
2485 int v258; // ecx@514 | |
2486 char v259; // al@516 | |
2487 int v260; // eax@518 | |
2488 int v261; // esi@519 | |
2489 int v262; // edx@521 | |
1013 | 2490 int *v263; // ecx@521 |
0 | 2491 int v264; // esi@521 |
2492 int v265; // edx@521 | |
2493 int *ii; // eax@522 | |
2494 int v267; // eax@524 | |
2495 int v268; // eax@524 | |
2496 char v271; // al@531 | |
2497 int v277; // edx@548 | |
2498 int v278; // ecx@548 | |
2499 char v279; // al@550 | |
2500 int v280; // eax@552 | |
1013 | 2501 int *v281; // esi@553 |
0 | 2502 int v282; // edx@555 |
1013 | 2503 int *v283; // ecx@555 |
0 | 2504 int v284; // esi@555 |
2505 int v285; // edx@555 | |
2506 int *l; // eax@556 | |
2507 ItemGen *v294; // esi@575 | |
2508 int v295; // edx@575 | |
2509 int kk; // edi@575 | |
488 | 2510 char v313; // al@606pGame->GetStru6() |
0 | 2511 const char *v317; // ecx@617 |
2512 Player *v318; // ecx@619 | |
2513 unsigned int v319; // edi@627 | |
2514 int v323; // edi@635 | |
2515 char *v324; // eax@635 | |
2516 Player *v325; // ecx@640 | |
2517 int v328; // ecx@651 | |
2518 int v329; // ecx@652 | |
2519 int v330; // edi@654 | |
2520 signed int v342; // edi@668 | |
2521 signed int v343; // edi@670 | |
2522 unsigned __int64 v344; // ST08_8@670 | |
2523 Player *v351; // edi@680 | |
112 | 2524 Player *v357; // edi@694 |
0 | 2525 Actor *v369; // edi@705 |
2526 int v373; // eax@715 | |
2527 int v374; // eax@717 | |
2528 int v376; // eax@717 | |
2529 Player *v377; // ecx@719 | |
2530 int v381; // edi@727 | |
2531 int v382; // ecx@727 | |
2532 Player *v383; // eax@728 | |
2533 int v384; // eax@733 | |
2534 int v388; // edi@740 | |
2535 int v396; // eax@752 | |
2536 int v397; // eax@757 | |
2537 int v398; // eax@757 | |
2538 int v399; // eax@757 | |
1013 | 2539 Actor *v417; // eax@787 |
0 | 2540 int v418; // ecx@789 |
2541 __int16 v419; // ax@791 | |
2542 signed int v420; // eax@793 | |
1013 | 2543 ItemGen *v421; // edx@793 |
0 | 2544 const char *v422; // eax@801 |
2545 signed int v426; // eax@815 | |
2546 Actor *v433; // edi@832 | |
2547 int v435; // ecx@837 | |
2548 int v440; // eax@843 | |
2549 int v441; // eax@847 | |
2550 signed int v445; // edi@857 | |
2551 int v446; // ecx@862 | |
2552 LevelDecoration *v447; // edi@864 | |
2553 __int16 v448; // ax@864 | |
2554 char *v449; // esi@870 | |
2555 int v450; // eax@870 | |
2556 signed int v460; // eax@895 | |
2557 Actor *v461; // eax@897 | |
2558 unsigned __int16 v462; // cx@897 | |
2559 signed int v463; // edx@897 | |
2560 int v470; // edi@913 | |
2561 int v471; // eax@917 | |
2562 int v472; // eax@917 | |
2563 int v498; // edi@931 | |
2564 int v499; // eax@935 | |
2565 int v500; // eax@935 | |
2566 Player *v501; // edi@939 | |
2567 int v505; // eax@943 | |
2568 int v507; // edi@944 | |
2569 signed int v509; // eax@944 | |
2570 signed int v510; // edi@944 | |
90 | 2571 Actor *v518; // edx@957 |
0 | 2572 __int16 v519; // cx@958 |
2573 int v531; // eax@982 | |
2574 int v533; // edi@983 | |
2575 signed int v535; // eax@983 | |
2576 signed int v536; // edi@983 | |
2577 stru6 *v537; // eax@984 | |
2578 double v549; // st7@991 | |
2579 unsigned __int16 v550; // di@991 | |
89 | 2580 Player *v553; // edi@1001 |
0 | 2581 unsigned __int16 v562; // di@1005 |
2582 signed int v563; // eax@1010 | |
2583 unsigned int v564; // ecx@1011 | |
2584 signed int v565; // eax@1012 | |
2585 Player **v566; // ecx@1012 | |
2586 int v567; // eax@1012 | |
2587 Player *v571; // eax@1013 | |
2588 char *v572; // ecx@1013 | |
2589 signed int v576; // eax@1025 | |
2590 Player *v577; // eax@1026 | |
2591 int v578; // eax@1028 | |
2592 __int16 v579; // ax@1029 | |
2593 int v581; // edi@1031 | |
2594 char *v585; // esi@1034 | |
2595 signed int v587; // eax@1035 | |
2596 char v591; // al@1048 | |
1013 | 2597 ItemGen *v592; // esi@1052 |
0 | 2598 int v596; // esi@1066 |
2599 unsigned int v597; // edi@1067 | |
2600 int v600; // edi@1086 | |
2601 int v601; // edx@1086 | |
2602 int v602; // eax@1086 | |
2603 int v603; // ecx@1086 | |
1009 | 2604 NPCData *pNPCData; // eax@1089 |
0 | 2605 int v606; // edx@1091 |
1013 | 2606 AwardType *v607; // ecx@1100 |
0 | 2607 __int16 v608; // ax@1102 |
2608 signed int v609; // eax@1104 | |
2609 int v610; // edi@1106 | |
2610 unsigned int v611; // eax@1106 | |
89 | 2611 Player *v612; // edi@1106 |
2612 DDM_DLV_Header *v613; // eax@1108 | |
0 | 2613 int v615; // edi@1119 |
112 | 2614 Player *v619; // edi@1123 |
0 | 2615 signed __int64 v623; // qax@1127 |
2616 int v625; // edi@1129 | |
2617 signed int v627; // eax@1129 | |
2618 signed int v628; // edi@1129 | |
2619 int v629; // ecx@1130 | |
2620 Player *v630; // eax@1131 | |
2621 int v631; // eax@1137 | |
2622 int v635; // edi@1142 | |
2623 int v642; // edi@1156 | |
2624 int v643; // eax@1156 | |
2625 int v644; // eax@1156 | |
2626 signed int v645; // eax@1158 | |
2627 unsigned int v656; // [sp-4h] [bp-E88h]@639 | |
2628 int v657; // [sp-4h] [bp-E88h]@807 | |
2629 int v659; // [sp+0h] [bp-E84h]@123 | |
2630 int v660; // [sp+0h] [bp-E84h]@146 | |
2631 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
2632 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 | |
2633 const char *v664; // [sp+0h] [bp-E84h]@802 | |
2634 int v665; // [sp+0h] [bp-E84h]@807 | |
2635 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 2636 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
0 | 2637 int v671; // [sp+4h] [bp-E80h]@146 |
1013 | 2638 int v675; // [sp+4h] [bp-E80h]@800 |
0 | 2639 int v676; // [sp+4h] [bp-E80h]@807 |
2640 int v677; // [sp+4h] [bp-E80h]@861 | |
1013 | 2641 int v679[800]; // [sp+14h] [bp-E70h]@515 |
0 | 2642 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 |
2643 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
2644 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
2645 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
2646 int v684; // [sp+D04h] [bp-180h]@416 | |
2647 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
2648 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2649 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2650 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2651 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2652 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0 | 2653 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2654 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2655 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2656 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0 | 2657 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
2658 __int64 v712; // [sp+D94h] [bp-F0h]@991 | |
2659 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
2660 int n; // [sp+DA0h] [bp-E4h]@1 | |
2661 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
2662 int v716; // [sp+DC0h] [bp-C4h]@272 | |
2663 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
2664 float v718; // [sp+DCCh] [bp-B8h]@176 | |
2665 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
2666 char *y; // [sp+DD4h] [bp-B0h]@325 | |
2667 int v721; // [sp+DD8h] [bp-ACh]@163 | |
2668 int v723; // [sp+E4Ch] [bp-38h]@1 | |
2669 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
2670 float v725; // [sp+E54h] [bp-30h]@23 | |
2671 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
2672 float v727; // [sp+E5Ch] [bp-28h]@1 | |
2673 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
2674 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
2675 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 2676 Player *v730b; |
2677 ItemGen *v730c; | |
0 | 2678 int v731; // [sp+E6Ch] [bp-18h]@48 |
2679 signed int v732; // [sp+E70h] [bp-14h]@325 | |
2680 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
2681 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
2682 int amount; // [sp+E80h] [bp-4h]@1 | |
2683 | |
924 | 2684 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 |
1009 | 2685 |
0 | 2686 v2 = 0; |
2687 amount = 0; | |
2688 LODWORD(v733) = 0; | |
2689 v723 = 0; | |
2690 v727 = 0.0; | |
889 | 2691 for(n = 0; n < 10; ++n) |
0 | 2692 { |
924 | 2693 pCastSpell = &this[n]; |
2694 HIDWORD(v733) = (int)pCastSpell; | |
2695 if ( pCastSpell->spellnum == 0 ) | |
889 | 2696 continue; |
486 | 2697 |
2698 if (pParty->Invisible()) | |
2699 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
2700 | |
924 | 2701 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 2702 { |
924 | 2703 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
2704 this->_427D48(1); | |
889 | 2705 continue; |
0 | 2706 } |
924 | 2707 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
2708 | |
2709 a2 = pCastSpell->spell_target_pid; | |
2710 if (!pCastSpell->spell_target_pid) | |
0 | 2711 { |
924 | 2712 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
2713 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
2714 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 2715 v666 = 1; |
2716 else | |
2717 v666 = 0; | |
2718 | |
2719 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
2720 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2721 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 2722 a2 = pMouse->uPointingObjectID; |
0 | 2723 } |
488 | 2724 |
2725 | |
924 | 2726 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
2727 if (pSpellSprite.uType) | |
0 | 2728 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2729 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 2730 { |
924 | 2731 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 2732 v2 = v723; |
2733 } | |
2734 else | |
2735 { | |
2736 v715.uYawAngle = pParty->sRotationY; | |
2737 v715.uPitchAngle = pParty->sRotationX; | |
2738 } | |
2739 } | |
488 | 2740 |
486 | 2741 LODWORD(v725) = 0; |
2742 _this = 0; | |
924 | 2743 if (pCastSpell->forced_spell_skill_level) |
488 | 2744 { |
924 | 2745 v11 = pCastSpell->forced_spell_skill_level; |
993 | 2746 v723 = v11 & 0x3F; // 6 bytes |
488 | 2747 v2 = v723; |
2748 } | |
2749 else | |
0 | 2750 { |
488 | 2751 //v667 = PLAYER_SKILL_STAFF; |
924 | 2752 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 2753 v667 = PLAYER_SKILL_FIRE; |
924 | 2754 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 2755 v667 = PLAYER_SKILL_AIR; |
924 | 2756 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 2757 v667 = PLAYER_SKILL_WATER; |
924 | 2758 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 2759 v667 = PLAYER_SKILL_EARTH; |
924 | 2760 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 2761 v667 = PLAYER_SKILL_SPIRIT; |
924 | 2762 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 2763 v667 = PLAYER_SKILL_MIND; |
924 | 2764 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 2765 v667 = PLAYER_SKILL_BODY; |
924 | 2766 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 2767 v667 = PLAYER_SKILL_LIGHT; |
924 | 2768 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 2769 v667 = PLAYER_SKILL_DARK; |
924 | 2770 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 2771 v667 = PLAYER_SKILL_BOW; |
2772 else assert(false && "Unknown spell"); | |
2773 | |
0 | 2774 LODWORD(v725) = v667; |
488 | 2775 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
2776 v2 = v723; | |
2777 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 2778 } |
488 | 2779 |
993 | 2780 v731 = SkillToMastery(v11); |
488 | 2781 |
924 | 2782 if (pCastSpell->forced_spell_skill_level) |
486 | 2783 uRequiredMana = 0; |
488 | 2784 else |
924 | 2785 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
2786 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 2787 |
2788 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 2789 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 2790 uRequiredMana = 0; |
488 | 2791 |
924 | 2792 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
2793 { | |
2794 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
2795 pCastSpell->spellnum = 0; | |
2796 continue; | |
2797 } | |
2798 v730 = pCastSpell->spellnum; | |
2799 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
2800 { | |
2801 if (!pParty->bTurnBasedModeOn) | |
2802 { | |
2803 //v646 = pPlayer; | |
2804 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
2805 //v647 = n; | |
2806 } | |
2807 else | |
2808 { | |
2809 //v647 = n; | |
2810 //v646 = pPlayer; | |
2811 //v648 = sRecoveryTime; | |
2812 //v649 = pPlayer; | |
2813 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
2814 pPlayer->SetRecoveryTime(sRecoveryTime); | |
2815 pTurnEngine->_40471C(); | |
2816 } | |
2817 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
2818 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2819 this[n].spellnum = 0; | |
2820 pPlayer->sMana -= uRequiredMana; | |
2821 return; | |
2822 } | |
2823 | |
2824 switch ( pCastSpell->spellnum ) | |
2825 { | |
1005 | 2826 case SPELL_101: |
2827 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
2828 case SPELL_BOW_ARROW: | |
2829 { | |
2830 amount = 1; | |
2831 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
2832 amount = 2; | |
2833 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); | |
2834 pSpellSprite.stru_24.Reset(); | |
2835 pSpellSprite.spell_level = v2; | |
2836 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2837 pSpellSprite.spell_skill = v731; | |
2838 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2839 if ( pPlayer->WearsItem(510, 2) ) | |
2840 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
2841 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2842 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2843 pSpellSprite.uAttributes = 0; | |
2844 pSpellSprite.uSpriteFrameID = 0; | |
2845 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2846 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2847 pSpellSprite.spell_target_pid = a2; | |
2848 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2849 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2850 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2851 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
2852 memcpy(&pSpellSprite.stru_24, &pPlayer[pPlayer->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
2853 pSpellSprite.uAttributes = 256; | |
2854 if ( pParty->bTurnBasedModeOn == 1 ) | |
2855 pSpellSprite.uAttributes = 260; | |
2856 for ( i = 0; i < amount; ++i ) | |
2857 { | |
2858 if ( i ) | |
2859 pSpellSprite.vPosition.z += 32; | |
2860 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
2861 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
2862 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
2863 ++pTurnEngine->field_1C; | |
2864 } | |
2865 break; | |
2866 } | |
2867 case SPELL_LASER_PROJECTILE: | |
2868 { | |
924 | 2869 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); |
2870 pSpellSprite.stru_24.Reset(); | |
2871 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2872 pSpellSprite.spell_level = v723; | |
2873 pSpellSprite.spell_skill = v731; | |
2874 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2875 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2876 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2877 pSpellSprite.uAttributes = 0; | |
2878 pSpellSprite.uSpriteFrameID = 0; | |
2879 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
2880 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2881 pSpellSprite.spell_target_pid = a2; | |
2882 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2883 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2884 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1005 | 2885 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
2886 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); | |
2887 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
2888 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); | |
924 | 2889 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); |
2890 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
2891 pSpellSprite.uSectorID = v23; | |
889 | 2892 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 2893 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
2894 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
2895 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 2896 ++pTurnEngine->field_1C; |
924 | 2897 break; |
1005 | 2898 } |
2899 case SPELL_FIRE_TORCH_LIGHT: | |
2900 { | |
889 | 2901 switch (v731) |
2902 { | |
890 | 2903 case 1: amount = 2; break; |
2904 case 2: amount = 3; break; | |
2905 case 3: | |
2906 case 4: amount = 4; break; | |
2907 default: | |
889 | 2908 assert(false); |
2909 } | |
2910 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 2911 break; |
889 | 2912 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
2913 LODWORD(v727) = 1; | |
890 | 2914 break; |
1005 | 2915 } |
2916 case SPELL_FIRE_FIRE_SPIKE: | |
2917 { | |
2918 switch (v731) | |
2919 { | |
2920 case 1: amount = 3; break; | |
2921 case 2: amount = 5; break; | |
2922 case 3: amount = 7; break; | |
2923 case 4: amount = 9; break; | |
2924 default: | |
2925 assert(false); | |
2926 } | |
2927 | |
2928 //v31 = v3->uPlayerID; | |
2929 //v32 = 8 * v31; | |
2930 //LOBYTE(v32) = v32 | OBJECT_Player; | |
2931 | |
2932 //if ( (signed int)uNumSpriteObjects > 0 ) | |
2933 int _v733 = 0; | |
2934 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
2935 { | |
2936 auto object = pSpriteObjects + i; | |
2937 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) | |
2938 ++_v733; | |
2939 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
2940 v730 = uNumSpriteObjects; | |
2941 do | |
2942 { | |
2943 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
2944 ++HIDWORD(v733); | |
2945 v33 += 112; | |
2946 --v730; | |
2947 } | |
2948 while ( v730 );*/ | |
2949 } | |
2950 if (_v733 > amount) | |
2951 { | |
2952 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2953 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2954 pCastSpell->spellnum = 0; | |
2955 continue; | |
2956 } | |
2957 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2958 break; | |
2959 pSpellSprite.stru_24.Reset(); | |
2960 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2961 pSpellSprite.spell_level = v2; | |
2962 pSpellSprite.spell_skill = v731; | |
2963 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2964 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2965 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2966 pSpellSprite.uAttributes = 0; | |
2967 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2968 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
2969 pSpellSprite.uSpriteFrameID = 0; | |
2970 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2971 pSpellSprite.spell_target_pid = a2; | |
2972 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2973 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2974 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2975 if ( pParty->bTurnBasedModeOn == 1 ) | |
2976 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
2977 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
2978 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
2979 ++pTurnEngine->field_1C; | |
889 | 2980 LODWORD(v727) = 1; |
890 | 2981 break; |
2982 } | |
1005 | 2983 case SPELL_AIR_IMPLOSION: |
2984 { | |
2985 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2986 break; | |
2987 if (!a2) | |
2988 { | |
2989 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2990 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2991 pCastSpell->spellnum = 0; | |
2992 continue; | |
2993 } | |
2994 if (PID_TYPE(a2) != OBJECT_Actor) | |
2995 { | |
2996 LODWORD(v727) = 1; | |
2997 break; | |
2998 } | |
2999 v697.x = 0; | |
3000 v697.y = 0; | |
3001 v697.z = 0; | |
3002 pSpellSprite.stru_24.Reset(); | |
3003 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3004 pSpellSprite.spell_level = v2; | |
3005 pSpellSprite.spell_skill = v731; | |
3006 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3007 pSpellSprite.uAttributes = 0; | |
3008 pSpellSprite.uSectorID = 0; | |
3009 pSpellSprite.uSpriteFrameID = 0; | |
3010 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3011 pSpellSprite.uFacing = 0; | |
3012 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3013 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3014 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3015 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3016 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3017 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3018 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
3019 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | |
890 | 3020 LODWORD(v727) = 1; |
3021 break; | |
3022 } | |
1005 | 3023 case SPELL_EARTH_MASS_DISTORTION: |
3024 { | |
3025 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3026 break; | |
3027 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3028 { | |
3029 LODWORD(v727) = 1; | |
3030 break; | |
3031 } | |
3032 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3033 v704.x = 0; | |
3034 v704.y = 0; | |
3035 v704.z = 0; | |
3036 pSpellSprite.stru_24.Reset(); | |
3037 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3038 pSpellSprite.spell_level = v2; | |
3039 pSpellSprite.spell_skill = v731; | |
3040 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3041 pSpellSprite.uAttributes = 0; | |
3042 pSpellSprite.uSectorID = 0; | |
3043 pSpellSprite.uSpriteFrameID = 0; | |
3044 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3045 pSpellSprite.uFacing = 0; | |
3046 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3047 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3048 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3049 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3050 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3051 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3052 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
3053 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | |
3054 LODWORD(v727) = 1; | |
890 | 3055 break; |
1005 | 3056 } |
3057 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3058 { | |
3059 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | |
3060 break; | |
3061 //v730 = a2 >> 3; | |
3062 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3063 v691.x = 0; | |
3064 v691.y = 0; | |
3065 v691.z = 0; | |
3066 pSpellSprite.stru_24.Reset(); | |
3067 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3068 pSpellSprite.spell_level = v2; | |
3069 pSpellSprite.spell_skill = v731; | |
3070 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3071 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3072 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3073 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3074 pSpellSprite.uAttributes = 0; | |
3075 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3076 pSpellSprite.uSpriteFrameID = 0; | |
3077 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3078 pSpellSprite.spell_target_pid = a2; | |
3079 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3080 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3081 pSpellSprite.uAttributes |= 0x80u; | |
3082 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3083 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
1013 | 3084 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
1005 | 3085 { |
3086 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3087 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3088 pCastSpell->spellnum = 0; | |
3089 continue; | |
3090 } | |
3091 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3092 LODWORD(v727) = 1; | |
3093 break; | |
3094 } | |
3095 case SPELL_FIRE_FIRE_BOLT: | |
3096 case SPELL_FIRE_FIREBALL: | |
3097 case SPELL_FIRE_INCINERATE: | |
3098 case SPELL_AIR_LIGHNING_BOLT: | |
3099 case SPELL_WATER_ICE_BOLT: | |
3100 case SPELL_WATER_ICE_BLAST: | |
3101 case SPELL_EARTH_STUN: | |
3102 case SPELL_EARTH_DEADLY_SWARM: | |
3103 case SPELL_MIND_MIND_BLAST: | |
3104 case SPELL_MIND_PSYCHIC_SHOCK: | |
3105 case SPELL_BODY_HARM: | |
3106 case SPELL_LIGHT_LIGHT_BOLT: | |
3107 case SPELL_DARK_DRAGON_BREATH: | |
3108 { | |
889 | 3109 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3110 break; |
924 | 3111 pSpellSprite.stru_24.Reset(); |
3112 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3113 pSpellSprite.spell_level = v2; | |
3114 pSpellSprite.spell_skill = v731; | |
3115 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3116 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3117 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3118 pSpellSprite.uAttributes = 0; | |
3119 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3120 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3121 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3122 else | |
3123 pSpellSprite.uSectorID = 0; | |
3124 pSpellSprite.uSpriteFrameID = 0; | |
3125 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3126 pSpellSprite.spell_target_pid = a2; | |
3127 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3128 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3129 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3130 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3131 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3132 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3133 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3134 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3135 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3136 ++pTurnEngine->field_1C; |
3137 LODWORD(v727) = 1; | |
890 | 3138 break; |
1005 | 3139 } |
3140 case SPELL_WATER_ACID_BURST: | |
3141 case SPELL_EARTH_BLADES: | |
3142 case SPELL_BODY_FLYING_FIST: | |
3143 case SPELL_DARK_TOXIC_CLOUD: | |
3144 { | |
889 | 3145 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3146 break; |
924 | 3147 pSpellSprite.stru_24.Reset(); |
3148 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3149 pSpellSprite.spell_level = v2; | |
3150 pSpellSprite.spell_skill = v731; | |
3151 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3152 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3153 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3154 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3155 v660 = pParty->vPosition.y; | |
993 | 3156 pSpellSprite.uAttributes = 0; |
3157 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3158 pSpellSprite.vPosition.z = v51; | |
3159 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3160 pSpellSprite.uSpriteFrameID = 0; | |
3161 pSpellSprite.uSectorID = v52; | |
3162 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3163 pSpellSprite.spell_target_pid = a2; | |
3164 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3165 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3166 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3167 if ( pParty->bTurnBasedModeOn == 1 ) | |
3168 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3169 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3170 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3171 ++pTurnEngine->field_1C; | |
3172 LODWORD(v727) = 1; | |
3173 break; | |
1009 | 3174 } |
1005 | 3175 case SPELL_LIGHT_SUNRAY: |
3176 { | |
889 | 3177 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
1009 | 3178 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) ) |
890 | 3179 { |
3180 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3181 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3182 pCastSpell->spellnum = 0; |
890 | 3183 continue; |
889 | 3184 } |
3185 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3186 { |
3187 pSpellSprite.stru_24.Reset(); | |
3188 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3189 pSpellSprite.spell_skill = v731; | |
3190 pSpellSprite.spell_level = v2; | |
3191 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3192 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3193 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3194 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3195 v660 = pParty->vPosition.y; | |
993 | 3196 pSpellSprite.uAttributes = 0; |
3197 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3198 pSpellSprite.vPosition.z = v51; | |
3199 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3200 pSpellSprite.uSpriteFrameID = 0; | |
3201 pSpellSprite.uSectorID = v52; | |
3202 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3203 pSpellSprite.spell_target_pid = a2; | |
3204 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3205 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3206 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3207 if ( pParty->bTurnBasedModeOn == 1 ) | |
3208 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3209 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3210 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3211 ++pTurnEngine->field_1C; | |
3212 LODWORD(v727) = 1; | |
924 | 3213 } |
3214 break; | |
1005 | 3215 } |
3216 case SPELL_LIGHT_PARALYZE: | |
3217 { | |
3218 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3219 break; | |
3220 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], | |
3221 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
3222 { | |
3223 LODWORD(v727) = 1; | |
3224 break; | |
3225 } | |
3226 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3227 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3228 v55 = &pActors[PID_ID(a2)]; | |
3229 v55->pActorBuffs[6].Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3230 BYTE2(v55->uAttributes) |= 8u; | |
3231 v55->vVelocity.x = 0; | |
3232 //v672 = 0; | |
3233 v55->vVelocity.y = 0; | |
3234 v661 = v55; | |
3235 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
3236 LODWORD(v727) = 1; | |
890 | 3237 break; |
1005 | 3238 } |
3239 case SPELL_EARTH_SLOW: | |
3240 { | |
3241 switch (v731) | |
3242 { | |
3243 case 1: LODWORD(v733) = 180 * v2; amount = 2; break; | |
3244 case 2: LODWORD(v733) = 300 * v2; amount = 2; break; | |
3245 case 3: LODWORD(v733) = 300 * v2; amount = 4; break; | |
3246 case 4: LODWORD(v733) = 300 * v2; amount = 8; break; | |
3247 default: | |
3248 assert(false); | |
3249 } | |
889 | 3250 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3251 break; |
889 | 3252 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3253 || (v721 = 836 * PID_ID(a2), |
3254 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3255 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3256 { | |
3257 LODWORD(v727) = 1; | |
3258 break; | |
889 | 3259 } |
3260 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
1005 | 3261 //v59 = v721; |
3262 pActor = &pActors[PID_ID(a2)]; | |
889 | 3263 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( |
1005 | 3264 pActor->pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, v731, amount, 0, 0); |
3265 //*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | |
3266 BYTE2(pActor->uAttributes) |= 8u; | |
3267 //v672 = 0; | |
889 | 3268 v661 = (Actor *)LODWORD(v718); |
1005 | 3269 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); |
993 | 3270 LODWORD(v727) = 1; |
3271 break; | |
924 | 3272 } |
1005 | 3273 case SPELL_MIND_CHARM: |
3274 { | |
890 | 3275 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3276 break; | |
3277 | |
3278 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3279 { | |
3280 LODWORD(v727) = 1; | |
3281 break; | |
3282 } | |
3283 | |
3284 uint power = 300 * v2; | |
3285 if ( v731 == 2 ) | |
3286 { | |
3287 power = 600 * v2; | |
3288 } | |
3289 else if ( v731 == 3 ) | |
3290 power = 29030400; | |
3291 | |
3292 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3293 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3294 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3295 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3296 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3297 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3298 v731, 0, 0, 0); | |
924 | 3299 pSpellSprite.stru_24.Reset(); |
3300 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3301 pSpellSprite.spell_level = v2; | |
3302 pSpellSprite.spell_skill = v731; | |
3303 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3304 v61 = PID_ID(a2); |
993 | 3305 v600 = pActors[v61].vPosition.y; |
3306 v601 = pActors[v61].vPosition.x; | |
3307 pSpellSprite.uObjectDescID = v60; | |
3308 pSpellSprite.vPosition.x = v601; | |
3309 v602 = pActors[v61].uActorHeight; | |
3310 v603 = pActors[v61].vPosition.z; | |
3311 pSpellSprite.vPosition.y = v600; | |
3312 v676 = v603 + v602; | |
3313 v665 = v600; | |
3314 pSpellSprite.vPosition.z = v603 + v602; | |
3315 v657 = v601; | |
3316 pSpellSprite.uAttributes = 0; | |
3317 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
3318 pSpellSprite.uSpriteFrameID = 0; | |
3319 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3320 pSpellSprite.spell_target_pid = a2; | |
3321 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3322 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3323 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
3324 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3325 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
3326 LODWORD(v727) = 1; | |
3327 break; | |
1005 | 3328 } |
3329 case SPELL_DARK_SHRINKING_RAY: | |
3330 { | |
889 | 3331 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3332 break; |
924 | 3333 pSpellSprite.stru_24.Reset(); |
3334 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3335 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3336 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3337 pSpellSprite.uAttributes = 0; | |
3338 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3339 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3340 pParty->vPosition.x, |
3341 pParty->vPosition.y, | |
3342 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3343 pSpellSprite.uSpriteFrameID = 0; |
3344 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3345 pSpellSprite.spell_target_pid = a2; | |
3346 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3347 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3348 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3349 pSpellSprite.spell_skill = v731; | |
3350 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3351 pSpellSprite.spell_level = 300 * v2; | |
890 | 3352 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3353 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3354 | |
3355 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3356 | |
3357 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3358 ++pTurnEngine->field_1C; |
3359 LODWORD(v727) = 1; | |
890 | 3360 break; |
1005 | 3361 } |
3362 case SPELL_FIRE_FIRE_AURA: | |
3363 { | |
1009 | 3364 switch (v731) |
3365 { | |
3366 case 1: LODWORD(v733) = 3600 * v2; amount = 10; break; | |
3367 case 2: LODWORD(v733) = 3600 * v2; amount = 11; break; | |
3368 case 3: LODWORD(v733) = 3600 * v2; amount = 12; break; | |
3369 case 4: LODWORD(v733) = 0; amount = 12; break; | |
3370 default: | |
3371 assert(false); | |
3372 } | |
3373 | |
889 | 3374 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3375 break; |
924 | 3376 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3377 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3378 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3379 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3380 && !v730c->Broken() | |
3381 && !v730c->uSpecEnchantmentType | |
3382 && !v730c->uEnchantmentType | |
3383 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3384 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3385 { | |
3386 v69 = v730c; | |
3387 v14 = v731 == 4; | |
3388 v730c->uSpecEnchantmentType = amount; | |
3389 if ( !v14 ) | |
889 | 3390 { |
890 | 3391 v69->uExpireTime = pParty->uTimePlayed |
3392 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3393 * 0.033333335); | |
3394 v69->uAttributes |= 8u; | |
889 | 3395 } |
890 | 3396 v69->uAttributes |= 0x10u; |
984 | 3397 _50C9A8_item_enchantment_timer = 256; |
890 | 3398 LODWORD(v727) = 1; |
3399 break; | |
889 | 3400 } |
3401 | |
3402 dword_50C9D0 = 113; | |
3403 dword_50C9D4 = 0; | |
3404 dword_50C9D8 = 1; | |
3405 | |
3406 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3407 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3408 pCastSpell->spellnum = 0; |
890 | 3409 continue; |
1005 | 3410 } |
3411 case SPELL_BODY_REGENERATION: | |
3412 { | |
1009 | 3413 switch (v731) |
3414 { | |
3415 case 1: LODWORD(v733) = 3600 * v2; amount = 1; break; | |
3416 case 2: LODWORD(v733) = 3600 * v2; amount = 1; break; | |
3417 case 3: LODWORD(v733) = 3600 * v2; amount = 3; break; | |
3418 case 4: LODWORD(v733) = 3600 * v2; amount = 10; break; | |
3419 default: | |
3420 assert(false); | |
3421 } | |
3422 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3423 break; | |
3424 | |
3425 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
3426 | |
3427 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); | |
3428 LODWORD(v727) = 1; | |
890 | 3429 break; |
1005 | 3430 } |
3431 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3432 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3433 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3434 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3435 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3436 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3437 { | |
1009 | 3438 switch (v731) |
3439 { | |
3440 case 1: | |
3441 case 2: | |
3442 case 3: | |
3443 case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break; | |
3444 default: | |
3445 assert(false); | |
3446 } | |
3447 | |
3448 switch (pCastSpell->spellnum) | |
3449 { | |
3450 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3451 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3452 break; | |
3453 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3454 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3455 break; | |
3456 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3457 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3458 break; | |
3459 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3460 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3461 break; | |
3462 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3463 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3464 break; | |
3465 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3466 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3467 break; | |
3468 default: | |
3469 assert(false); | |
3470 continue; | |
3471 } | |
3472 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3473 break; | |
3474 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3475 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3476 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3477 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
3478 v90 = (double)(signed int)v733 * 4.2666669; | |
3479 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3480 LODWORD(v727) = 1; | |
3481 break; | |
1005 | 3482 } |
3483 case SPELL_FIRE_HASTE: | |
3484 { | |
1009 | 3485 switch (v731) |
3486 { | |
3487 case 1: LODWORD(v733) = 60 * (v2 + 60); break; | |
3488 case 2: LODWORD(v733) = 60 * (v2 + 60); break; | |
3489 case 3: LODWORD(v733) = 180 * (v2 + 20); break; | |
3490 case 4: LODWORD(v733) = 240 * (v2 + 15); break; | |
3491 default: | |
3492 assert(false); | |
993 | 3493 } |
889 | 3494 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
3495 { | |
890 | 3496 v92 = pParty->pPlayers;//[0].pConditions[1]; |
3497 LODWORD(v727) = 1; | |
3498 do | |
3499 { | |
993 | 3500 if ( v92->pConditions ) |
3501 LODWORD(v727) = 0; | |
3502 ++v92; | |
890 | 3503 } |
3504 while ( v92 <= &pParty->pPlayers[3] ); | |
3505 if (LODWORD(v727)) | |
3506 { | |
993 | 3507 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
3508 | |
3509 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3510 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3511 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3512 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 3513 } |
3514 } | |
3515 break; | |
1005 | 3516 } |
3517 case SPELL_SPIRIT_BLESS: | |
3518 { | |
1009 | 3519 switch (v731) |
3520 { | |
3521 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
3522 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
3523 case 3: LODWORD(v733) = 900 * (v2 + 4); break; | |
3524 case 4: LODWORD(v733) = 3600 * (v2 + 1); break; | |
3525 default: | |
3526 assert(false); | |
3527 } | |
889 | 3528 amount = v2 + 5; |
3529 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3530 break; |
889 | 3531 if ( v731 == 1 ) |
3532 { | |
924 | 3533 v108 = pCastSpell->uPlayerID_2; |
3534 v109 = pCastSpell->spellnum; | |
890 | 3535 v110 = pGame->GetStru6(); |
3536 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 3537 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 3538 //v668 = 0; |
3539 v716 = v111; | |
3540 //v658 = v111; | |
3541 //v653 = amount; | |
3542 //v651 = 1; | |
3543 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3544 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
1009 | 3545 //LABEL_103: |
3546 //HIDWORD(v650) = HIDWORD(v28); | |
3547 //LABEL_104: | |
3548 //LODWORD(v650) = v28; | |
3549 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); | |
3550 LODWORD(v727) = 1; | |
3551 break; | |
889 | 3552 } |
3553 v105 = 0; | |
3554 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3555 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
3556 do | |
3557 { | |
924 | 3558 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 3559 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
3560 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
3561 ++v730b; | |
3562 ++v105; | |
889 | 3563 } |
3564 while ( v730b <= &pParty->pPlayers[3] ); | |
3565 LODWORD(v727) = 1; | |
890 | 3566 break; |
1005 | 3567 } |
890 | 3568 case SPELL_SPIRIT_SPIRIT_LASH: |
1005 | 3569 { |
889 | 3570 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
3571 { | |
890 | 3572 //v730 = a2 >> 3; |
3573 v112 = &pActors[PID_ID(a2)]; | |
3574 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
3575 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
3576 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
3577 _this = (ItemGen *)v113; | |
3578 v114 = v721; | |
3579 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
3580 if ( v113 < v721 ) | |
3581 { | |
1009 | 3582 v116 = v113; |
3583 v113 = v721; | |
3584 v114 = v116; | |
890 | 3585 } |
3586 if ( v113 < (signed int)v115 ) | |
3587 { | |
1009 | 3588 v117 = v113; |
3589 v113 = (int)v115; | |
3590 v115 = v117; | |
890 | 3591 } |
3592 if ( v114 < (signed int)v115 ) | |
3593 { | |
1009 | 3594 v118 = v115; |
3595 v115 = v114; | |
3596 v114 = v118; | |
890 | 3597 } |
3598 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
3599 if ( (double)(signed int)this <= 307.2 ) | |
3600 { | |
1009 | 3601 v701.x = 0; |
3602 v701.y = 0; | |
3603 v701.z = 0; | |
3604 pSpellSprite.stru_24.Reset(); | |
1013 | 3605 pSpellSprite.spell_id = pCastSpell->spellnum; |
1009 | 3606 pSpellSprite.spell_level = v723; |
3607 pSpellSprite.spell_skill = v731; | |
3608 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3609 pSpellSprite.uAttributes = 0; | |
3610 pSpellSprite.uSectorID = 0; | |
3611 pSpellSprite.uSpriteFrameID = 0; | |
3612 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
1013 | 3613 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
1009 | 3614 pSpellSprite.uFacing = 0; |
1013 | 3615 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
1009 | 3616 pSpellSprite.vPosition.x = v112->vPosition.x; |
3617 pSpellSprite.vPosition.y = v112->vPosition.y; | |
3618 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
3619 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
3620 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
3621 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); | |
3622 LODWORD(v727) = 1; | |
890 | 3623 } |
3624 else | |
3625 { | |
1009 | 3626 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
3627 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1013 | 3628 pCastSpell->spellnum = 0; |
890 | 3629 } |
1013 | 3630 //pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 3631 } |
3632 break; | |
3633 } | |
3634 case SPELL_AIR_SHIELD: | |
3635 case SPELL_EARTH_STONESKIN: | |
3636 case SPELL_SPIRIT_HEROISM: | |
993 | 3637 { |
1009 | 3638 switch (v731) |
3639 { | |
3640 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
3641 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
3642 case 3: LODWORD(v733) = 900 * (v2 + 4); break; | |
3643 case 4: LODWORD(v733) = 3600 * (v2 + 1); break; | |
3644 default: | |
3645 assert(false); | |
3646 } | |
924 | 3647 v127 = pCastSpell->spellnum; |
889 | 3648 if ( v127 == 17 ) |
3649 { | |
890 | 3650 amount = 0; |
3651 LODWORD(v725) = 14; | |
889 | 3652 } |
3653 else | |
3654 { | |
890 | 3655 if ( v127 == 38 ) |
3656 { | |
1009 | 3657 LODWORD(v725) = 15; |
3658 amount = v2 + 5; | |
890 | 3659 } |
3660 else | |
3661 { | |
1009 | 3662 if ( v127 != 51 ) |
3663 continue; | |
3664 LODWORD(v725) = 9; | |
3665 amount = v2 + 5; | |
890 | 3666 } |
889 | 3667 } |
3668 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3669 break; |
924 | 3670 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3671 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3672 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3673 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3674 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
3675 //LABEL_304: | |
3676 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3677 LODWORD(v727) = 1; | |
890 | 3678 break; |
1005 | 3679 } |
890 | 3680 case SPELL_FIRE_IMMOLATION: |
1005 | 3681 { |
1013 | 3682 if ( v731 == 4 ) |
993 | 3683 LODWORD(v733) = 600 * v2; |
889 | 3684 else |
993 | 3685 LODWORD(v733) = 60 * v2; |
889 | 3686 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3687 break; |
889 | 3688 |
924 | 3689 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3690 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3691 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3692 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3693 |
3694 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
3695 LODWORD(v727) = 1; | |
890 | 3696 break; |
1005 | 3697 } |
890 | 3698 case SPELL_FIRE_METEOR_SHOWER: |
1005 | 3699 { |
1009 | 3700 //v149 = v731 - 1; |
3701 //if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
1013 | 3702 int i; |
1009 | 3703 if ( v731 == 4 ) |
889 | 3704 { |
1013 | 3705 i = 20; |
889 | 3706 } |
3707 else | |
3708 { | |
1013 | 3709 i = 16; |
889 | 3710 } |
3711 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3712 { | |
890 | 3713 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
3714 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3715 pCastSpell->spellnum = 0; |
890 | 3716 continue; |
889 | 3717 } |
3718 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3719 break; |
889 | 3720 LODWORD(v725) = PID_TYPE(a2); |
3721 if (PID_TYPE(a2) == OBJECT_Actor) | |
3722 { | |
890 | 3723 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
3724 v153 = pActors[PID_ID(a2)].vPosition.y; | |
3725 v154 = pActors[PID_ID(a2)].vPosition.z; | |
3726 LODWORD(v727) = v153; | |
889 | 3727 } |
3728 else | |
3729 { | |
890 | 3730 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
3731 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
3732 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
3733 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
3734 v154 = pParty->vPosition.z; | |
889 | 3735 } |
1013 | 3736 unsigned __int64 k = 0; |
3737 int j = 0; | |
3738 if ( (signed int)i > 0 ) | |
3739 { | |
890 | 3740 v730 = LODWORD(v725) == 3 ? a2 : 0; |
3741 do | |
3742 { | |
1009 | 3743 a2 = rand() % 1000; |
1013 | 3744 if ( sqrt((double)(rand() % 1000) - 2500 * |
3745 (double)(rand() % 1000) - 2500 + | |
3746 j * j + k * k) <= 1.0 ) | |
1009 | 3747 { |
3748 LODWORD(v687) = 0; | |
3749 HIDWORD(v687) = 0; | |
3750 } | |
3751 else | |
3752 { | |
3753 v687 = __PAIR__( | |
1013 | 3754 stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), |
3755 (double)(rand() % 1000) - 2500), | |
3756 stru_5C6E00->Atan2(j, k)); | |
1009 | 3757 } |
3758 pSpellSprite.stru_24.Reset(); | |
3759 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3760 pSpellSprite.spell_level = v2; | |
3761 pSpellSprite.spell_skill = v731; | |
3762 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3763 pSpellSprite.uAttributes = 0; | |
3764 pSpellSprite.vPosition.x = uRequiredMana; | |
3765 pSpellSprite.vPosition.y = LODWORD(v727); | |
3766 pSpellSprite.uSectorID = 0; | |
3767 pSpellSprite.vPosition.z = a2 + v713; | |
3768 pSpellSprite.uSpriteFrameID = 0; | |
3769 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3770 pSpellSprite.spell_target_pid = v730; | |
3771 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
3772 pSpellSprite.uFacing = v687; | |
3773 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3774 if ( pParty->bTurnBasedModeOn == 1 ) | |
3775 pSpellSprite.uAttributes = 4; | |
3776 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
3777 && pParty->bTurnBasedModeOn == 1 ) | |
3778 ++pTurnEngine->field_1C; | |
1013 | 3779 j = rand() % 1024 - 512; |
3780 k = rand() % 1024 - 512; | |
890 | 3781 } |
1013 | 3782 while ( i-- != 1 ); |
889 | 3783 } |
3784 LODWORD(v727) = 1; | |
890 | 3785 break; |
3786 } | |
3787 case SPELL_FIRE_INFERNO: | |
3788 { | |
1009 | 3789 //v67 = 2; |
3790 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3791 { | |
3792 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
3793 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3794 pCastSpell->spellnum = 0; | |
3795 continue; | |
3796 } | |
3797 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3798 break; | |
3799 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
3800 v700.z = 0; | |
3801 v700.y = 0; | |
3802 v700.x = 0; | |
3803 pSpellSprite.stru_24.Reset(); | |
3804 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3805 pSpellSprite.spell_level = v2; | |
3806 pSpellSprite.spell_skill = v731; | |
3807 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3808 pSpellSprite.uAttributes = 0; | |
3809 pSpellSprite.uSectorID = 0; | |
3810 pSpellSprite.uSpriteFrameID = 0; | |
3811 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3812 pSpellSprite.uFacing = 0; | |
3813 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3814 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3815 a2 = 0; | |
3816 if ( (signed int)_v726 > 0 ) | |
3817 { | |
3818 do | |
3819 { | |
3820 v162 = dword_50BF30[a2]; | |
3821 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; | |
3822 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
3823 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
3824 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
3825 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
3826 v165 = a2; | |
3827 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
3828 pGame->GetStru6()->_4A81CA(&pSpellSprite); | |
3829 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
3830 a2 = v165 + 1; | |
3831 } | |
3832 while ( v165 + 1 < (signed int)_v726 ); | |
3833 } | |
3834 LODWORD(v727) = 1; | |
890 | 3835 break; |
1009 | 3836 } |
3837 case SPELL_AIR_WIZARD_EYE: | |
890 | 3838 { |
889 | 3839 LODWORD(v733) = 3600 * v2; |
3840 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3841 break; |
889 | 3842 v168 = 0; |
3843 do | |
3844 { | |
890 | 3845 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
3846 v716 = v169; | |
889 | 3847 } |
3848 while ( v168 < 4 ); | |
3849 | |
3850 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
3851 LODWORD(v727) = 1; | |
890 | 3852 break; |
1005 | 3853 } |
890 | 3854 case SPELL_AIR_FEATHER_FALL: |
1005 | 3855 { |
3856 switch (v731) | |
3857 { | |
3858 case 1: LODWORD(v733) = 300 * v2; break; | |
3859 case 2: LODWORD(v733) = 600 * v2; break; | |
1009 | 3860 case 3: LODWORD(v733) = 3600 * v2; break; |
1005 | 3861 case 4: LODWORD(v733) = 3600 * v2; break; |
3862 default: | |
3863 assert(false); | |
889 | 3864 } |
3865 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3866 break; |
889 | 3867 v174 = 0; |
3868 do | |
890 | 3869 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 3870 while ( v174 < 4 ); |
924 | 3871 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3872 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3873 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3874 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3875 |
3876 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); | |
3877 LODWORD(v727) = 1; | |
890 | 3878 break; |
1005 | 3879 } |
890 | 3880 case SPELL_AIR_SPARKS: |
3881 { | |
1005 | 3882 switch (v731) |
3883 { | |
3884 case 1: amount = 3; break; | |
3885 case 2: amount = 5; break; | |
3886 case 3: amount = 7; break; | |
3887 case 4: amount = 9; break; | |
3888 default: | |
3889 assert(false); | |
3890 } | |
3891 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3892 break; | |
3893 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
3894 pSpellSprite.stru_24.Reset(); | |
3895 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3896 pSpellSprite.spell_level = v2; | |
3897 pSpellSprite.spell_skill = v731; | |
3898 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3899 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3900 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3901 pSpellSprite.uAttributes = 0; | |
3902 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3903 pSpellSprite.uSectorID = pIndoor->GetSector( | |
3904 pParty->vPosition.x, | |
3905 pParty->vPosition.y, | |
3906 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3907 pSpellSprite.uSpriteFrameID = 0; | |
3908 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3909 pSpellSprite.spell_target_pid = a2; | |
3910 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3911 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3912 if ( pParty->bTurnBasedModeOn == 1 ) | |
3913 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3914 v188 = (signed int)_v726 / -2; | |
3915 v189 = (signed int)_v726 / 2; | |
3916 while ( v188 <= v189 ) | |
3917 { | |
3918 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); | |
3919 if ( pSpellSprite.Create( | |
3920 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
3921 v715.uPitchAngle, | |
3922 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3923 pCastSpell->uPlayerID + 1) != -1 | |
1009 | 3924 && pParty->bTurnBasedModeOn == 1 ) |
3925 + +pTurnEngine->field_1C; | |
1005 | 3926 v188 += _v726 / (amount - 1); |
3927 } | |
3928 LODWORD(v727) = 1; | |
890 | 3929 break; |
1005 | 3930 } |
890 | 3931 case SPELL_AIR_JUMP: |
1005 | 3932 { |
890 | 3933 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) |
3934 { | |
3935 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
3936 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3937 break; | |
889 | 3938 } |
3939 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3940 break; |
889 | 3941 v191 = 0; |
3942 do | |
890 | 3943 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 3944 while ( v191 < 4 ); |
3945 BYTE1(pParty->uFlags) |= 1u; | |
3946 pParty->uFallSpeed = 1000; | |
3947 LODWORD(v727) = 1; | |
890 | 3948 break; |
1005 | 3949 } |
890 | 3950 case SPELL_AIR_INVISIBILITY: |
1005 | 3951 { |
3952 switch (v731) | |
3953 { | |
3954 case 1: LODWORD(v733) = 600 * v2; amount = v2; break; | |
3955 case 2: LODWORD(v733) = 600 * v2; amount = 2 * v2; break; | |
3956 case 3: LODWORD(v733) = 600 * v2; amount = 3 * v2; break; | |
3957 case 4: LODWORD(v733) = 3600 * v2; amount = 4 * v2; break; | |
3958 default: | |
3959 assert(false); | |
3960 } | |
889 | 3961 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
3962 { | |
890 | 3963 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
3964 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3965 pCastSpell->spellnum = 0; |
890 | 3966 continue; |
889 | 3967 } |
3968 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
3969 { | |
924 | 3970 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3971 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3972 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3973 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 3974 |
3975 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
3976 LODWORD(v727) = 1; | |
3977 } | |
3978 break; | |
1005 | 3979 } |
890 | 3980 case SPELL_AIR_FLY: |
3981 { | |
1005 | 3982 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3983 { | |
3984 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
3985 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3986 break; | |
3987 } | |
3988 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
3989 { | |
3990 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3991 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3992 break; | |
3993 } | |
3994 LODWORD(v733) = 3600 * v2; | |
1009 | 3995 if ( v731 == 1 || v731 == 2 || v731 == 3 ) |
1005 | 3996 amount = 1; |
1009 | 3997 else |
3998 amount = 0; | |
1005 | 3999 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4000 break; | |
4001 v205 = 0; | |
4002 do | |
4003 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4004 while ( v205 < 4 ); | |
4005 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
4006 v207 = pCastSpell->uPlayerID + 1; | |
4007 v716 = v206; | |
4008 | |
4009 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4010 LODWORD(v727) = 1; | |
890 | 4011 break; |
4012 } | |
4013 case SPELL_AIR_STARBURST: | |
4014 { | |
1005 | 4015 //v67 = 2; |
4016 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4017 { | |
4018 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4019 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4020 pCastSpell->spellnum = 0; | |
4021 continue; | |
4022 } | |
4023 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4024 break; | |
4025 v208 = PID_TYPE(a2); | |
4026 LODWORD(v725) = PID_TYPE(a2); | |
4027 if ( v208 == 3 ) | |
4028 { | |
4029 v209 = PID_ID(a2); | |
4030 LODWORD(v718) = pActors[v209].vPosition.x; | |
4031 v210 = pActors[v209].vPosition.y; | |
4032 v211 = pActors[v209].vPosition.z; | |
4033 v713 = v210; | |
889 | 4034 } |
4035 else | |
4036 { | |
1005 | 4037 v212 = stru_5C6E00->Cos(pParty->sRotationY); |
4038 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4039 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4040 v214 = sub_42EBBE(2048, v213); | |
4041 v211 = pParty->vPosition.z; | |
4042 v713 = pParty->vPosition.y + v214; | |
4043 v208 = LODWORD(v725); | |
4044 } | |
1013 | 4045 signed int _v733 = 0; |
1005 | 4046 *(float *)&v732 = (double)v211; |
4047 LODWORD(v725) = v211 + 2500; | |
4048 v721 = 0; | |
4049 *(float *)&y = (double)(v211 + 2500); | |
4050 v730 = v208 == 3 ? a2 : 0; | |
4051 a2 = 20; | |
4052 do | |
4053 { | |
4054 v215 = rand(); | |
4055 v216 = (double)v721; | |
1013 | 4056 v217 = (double)_v733; |
1005 | 4057 *(float *)&uRequiredMana = v217; |
4058 _this = (ItemGen *)(v215 % 1000); | |
4059 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4060 *(float *)&v721 = v217 * v217; | |
4061 //*(float *)&v726 = v216 * v216; | |
4062 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4063 { | |
1009 | 4064 LODWORD(v685) = 0; |
4065 HIDWORD(v685) = 0; | |
1005 | 4066 } |
4067 else | |
4068 { | |
1009 | 4069 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4070 v685 = __PAIR__( | |
4071 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4072 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
1005 | 4073 } |
4074 pSpellSprite.stru_24.Reset(); | |
4075 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4076 pSpellSprite.spell_level = v2; | |
4077 pSpellSprite.spell_skill = v731; | |
4078 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4079 pSpellSprite.uAttributes = 0; | |
4080 pSpellSprite.vPosition.x = LODWORD(v718); | |
4081 pSpellSprite.vPosition.y = v713; | |
4082 pSpellSprite.uSectorID = 0; | |
4083 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4084 pSpellSprite.uSpriteFrameID = 0; | |
4085 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4086 pSpellSprite.spell_target_pid = v730; | |
4087 //__debugbreak();//çâåçäîïàä | |
4088 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | |
4089 pSpellSprite.uFacing = v685; | |
4090 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4091 if ( pParty->bTurnBasedModeOn == 1 ) | |
4092 pSpellSprite.uAttributes = 4; | |
4093 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4094 && pParty->bTurnBasedModeOn == 1 ) | |
4095 ++pTurnEngine->field_1C; | |
4096 v721 = rand() % 1024 - 512; | |
4097 v218 = rand(); | |
4098 v14 = a2-- == 1; | |
1013 | 4099 _v733 = (unsigned __int64)(v218 % 1024) - 512; |
1005 | 4100 } |
4101 while ( !v14 ); | |
4102 LODWORD(v727) = 1; | |
4103 break; | |
4104 } | |
890 | 4105 case SPELL_WATER_AWAKEN: |
993 | 4106 { |
1005 | 4107 switch (v731) |
4108 { | |
4109 case 1: amount = 180 * v2; break; | |
4110 case 2: amount = 3600 * v2; break; | |
4111 case 3: amount = 86400 * v2; break; | |
4112 case 4: amount = 0; break; | |
4113 default: | |
4114 assert(false); | |
4115 } | |
889 | 4116 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4117 break; |
1005 | 4118 for( int i=0; i < 4; i++ ) |
4119 { | |
4120 pPlayer = &pParty->pPlayers[i]; | |
890 | 4121 if ( v731 == 4 ) |
4122 { | |
1005 | 4123 if ( pPlayer->pConditions[2] ) |
4124 { | |
4125 //*((int *)v222 + 4) = 0; | |
4126 //*((int *)v222 + 5) = 0; | |
4127 pPlayer->pConditions[2] = 0; | |
4128 pPlayer->PlaySound(SPEECH_103, 0); | |
4129 } | |
890 | 4130 } |
4131 else | |
889 | 4132 { |
1005 | 4133 v223 = pPlayer->DiscardConditionIfLastsLongerThan( |
4134 2u, | |
4135 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4136 if ( v223 ) | |
4137 pPlayer->PlaySound(SPEECH_103, 0); | |
890 | 4138 } |
1005 | 4139 } |
4140 LODWORD(v727) = 1; | |
4141 break; | |
4142 } | |
890 | 4143 case SPELL_WATER_POISON_SPRAY: |
993 | 4144 { |
1009 | 4145 switch (v731) |
4146 { | |
4147 case 1: amount = 1; break; | |
4148 case 2: amount = 3; break; | |
4149 case 3: amount = 5; break; | |
4150 case 4: amount = 7; break; | |
4151 default: | |
4152 assert(false); | |
4153 } | |
889 | 4154 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4155 break; |
1013 | 4156 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
890 | 4157 if ( amount == 1 ) |
4158 { | |
924 | 4159 pSpellSprite.stru_24.Reset(); |
4160 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4161 pSpellSprite.spell_skill = v731; | |
4162 pSpellSprite.spell_level = v2; | |
4163 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4164 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4165 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4166 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4167 v660 = pParty->vPosition.y; | |
993 | 4168 // LABEL_153: |
924 | 4169 pSpellSprite.uAttributes = 0; |
4170 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4171 pSpellSprite.vPosition.z = v51; | |
890 | 4172 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4173 pSpellSprite.uSpriteFrameID = 0; |
4174 pSpellSprite.uSectorID = v52; | |
4175 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4176 pSpellSprite.spell_target_pid = a2; | |
4177 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4178 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4179 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4180 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4181 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4182 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4183 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4184 ++pTurnEngine->field_1C; | |
890 | 4185 } |
4186 else | |
4187 { | |
924 | 4188 pSpellSprite.stru_24.Reset(); |
4189 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4190 pSpellSprite.spell_level = v2; | |
4191 pSpellSprite.spell_skill = v731; | |
4192 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4193 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4194 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4195 pSpellSprite.uAttributes = 0; | |
4196 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4197 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4198 pSpellSprite.uSpriteFrameID = 0; | |
4199 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4200 pSpellSprite.spell_target_pid = a2; | |
4201 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4202 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4203 if ( pParty->bTurnBasedModeOn == 1 ) |
1009 | 4204 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4205 v227 = SHIDWORD(v733) / -2; |
1013 | 4206 signed int _y = _v733 / 2; |
4207 if ( _v733 / -2 <= _v733 / 2 ) | |
890 | 4208 { |
1009 | 4209 v228 = v715.uYawAngle; |
4210 do | |
4211 { | |
4212 pSpellSprite.uFacing = v227 + v228; | |
4213 if ( pSpellSprite.Create( | |
4214 v227 + v228, | |
4215 v715.uPitchAngle, | |
4216 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
4217 pCastSpell->uPlayerID + 1) != -1 | |
4218 && pParty->bTurnBasedModeOn == 1 ) | |
4219 ++pTurnEngine->field_1C; | |
1013 | 4220 v227 += _v733 / (amount - 1); |
1009 | 4221 } |
1013 | 4222 while ( v227 <= _y ); |
890 | 4223 } |
889 | 4224 } |
4225 LODWORD(v727) = 1; | |
890 | 4226 break; |
4227 } | |
4228 case SPELL_WATER_WATER_WALK: | |
1009 | 4229 { |
4230 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
4231 { | |
4232 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4233 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4234 break; | |
4235 } | |
4236 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4237 v229 = 600 * v2; | |
4238 else | |
4239 v229 = 3600 * v2; | |
4240 LODWORD(v733) = v229; | |
4241 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4242 break; | |
4243 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
4244 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4245 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4246 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4247 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4248 | |
4249 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4250 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4251 v731, | |
4252 amount, | |
4253 v716, | |
4254 pCastSpell->uPlayerID + 1); | |
4255 if ( v731 == 4 ) | |
4256 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4257 LODWORD(v727) = 1; | |
4258 break; | |
4259 } | |
4260 case SPELL_WATER_RECHARGE_ITEM: | |
890 | 4261 { |
1009 | 4262 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4263 break; | |
1013 | 4264 v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
4265 | |
4266 if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 ) | |
1009 | 4267 { |
4268 dword_50C9D0 = 113; | |
4269 dword_50C9D4 = 0; | |
4270 dword_50C9D8 = 1; | |
4271 | |
4272 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4273 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4274 pCastSpell->spellnum = 0; | |
4275 continue; | |
4276 } | |
4277 if ( v731 == 1 || v731 == 2 ) | |
4278 { | |
4279 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4280 } | |
4281 else if ( v731 == 3 ) | |
4282 { | |
4283 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
4284 } | |
4285 else if ( v731 == 4 ) | |
4286 { | |
4287 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4288 } | |
4289 else | |
4290 { | |
4291 v241 = 0.0; | |
4292 } | |
4293 if ( v241 > 1.0 ) | |
4294 v241 = 1.0; | |
1013 | 4295 int uNewCharges = v240->uMaxCharges * v241; |
4296 v240->uMaxCharges = uNewCharges; | |
4297 v240->uNumCharges = uNewCharges; | |
4298 if ( uNewCharges <= 0 ) | |
4299 { | |
4300 v240 = 0; | |
1009 | 4301 dword_50C9D0 = 113; |
4302 dword_50C9D4 = 0; | |
4303 dword_50C9D8 = 1; | |
4304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4305 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4306 pCastSpell->spellnum = 0; | |
4307 v2 = v723; | |
4308 continue; | |
4309 } | |
1013 | 4310 v240->uAttributes |= 0x40u; |
1009 | 4311 _50C9A8_item_enchantment_timer = 256; |
4312 LODWORD(v727) = 1; | |
890 | 4313 break; |
4314 } | |
1009 | 4315 case SPELL_WATER_ENCHANT_ITEM: |
890 | 4316 { |
1009 | 4317 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4318 break; | |
4319 uRequiredMana = 0; | |
1013 | 4320 amount = 10 * v2; |
1009 | 4321 v730 = 1; |
1013 | 4322 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
4323 v245 = &pPlayer->pInventoryItems[a2]; | |
4324 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; | |
4325 if ( | |
4326 v731 == 1 || v731 == 2 && _v725->uEquipType > 2 || | |
4327 v731 == 3 || v731 == 4 && | |
4328 v245->uItemID <= 134 && | |
4329 v245->uSpecEnchantmentType == 0 && | |
4330 v245->uEnchantmentType == 0 && | |
4331 v245->_bonus_strength== 0 && | |
4332 !v245->Broken() ) | |
4333 { | |
4334 if ( v245->GetValue() < 450 || | |
4335 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2) | |
4336 ) | |
890 | 4337 { |
1013 | 4338 v730 = 0; |
889 | 4339 } |
1013 | 4340 if ( rand() % 100 < 10 * v2 || |
4341 (rand() % 100 < 80 && (v731 == 3 || v731 == 4 )) || | |
4342 v245->GetValue() < 450 || | |
4343 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && v271 >= 0 && v271 <= 2) | |
4344 ) | |
1009 | 4345 { |
1013 | 4346 v313 = _v725->uEquipType; |
4347 if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 ) | |
1009 | 4348 { |
1013 | 4349 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; |
4350 v245->uEnchantmentType = 0; | |
4351 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1]; | |
4352 ; | |
4353 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1] ) | |
1009 | 4354 { |
1013 | 4355 ++v245->uEnchantmentType; |
4356 if ( kk >= v295 ) | |
1009 | 4357 break; |
4358 } | |
1013 | 4359 v255 = 10;//pItemsTable->field_116D8[17]; |
4360 v256 = 10;//pItemsTable->field_116D8[16]; | |
4361 v245->_bonus_strength = v256 + rand() % (v255 - v256 + 1); | |
4362 v245->uAttributes |= 0x20u; | |
993 | 4363 _50C9A8_item_enchantment_timer = 256; |
4364 LODWORD(v727) = 1; | |
4365 break; | |
890 | 4366 } |
1013 | 4367 else if ( v731 == 3 || v731 == 4) |
993 | 4368 { |
4369 v257 = pItemsTable->pSpecialEnchantments_count; | |
4370 v258 = 0; | |
4371 v725 = 0.0; | |
1013 | 4372 int _v733 = 0; |
993 | 4373 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
890 | 4374 { |
993 | 4375 v730 = (int)&v679; |
4376 do | |
4377 { | |
4378 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
4379 if ( !v259 || v259 == 1 ) | |
4380 { | |
4381 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
4382 + 4] | |
4383 + v258 * 28); | |
4384 LODWORD(v725) += v260; | |
4385 if ( v260 ) | |
4386 { | |
4387 v261 = v730; | |
4388 v730 += 4; | |
1013 | 4389 *(int *)v261 = _v733; |
993 | 4390 } |
4391 } | |
1013 | 4392 ++_v733; |
993 | 4393 ++v258; |
4394 } | |
1013 | 4395 while ( _v733 < v257 ); |
890 | 4396 } |
993 | 4397 v262 = rand() % SLODWORD(v725); |
4398 v263 = v679; | |
1013 | 4399 v245->uSpecEnchantmentType = v679[0]; |
4400 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
993 | 4401 v265 = v262 + 1; |
4402 if ( v264 < v265 ) | |
4403 { | |
1013 | 4404 for ( ii = v679; ; ii = (int *)v732 ) |
993 | 4405 { |
4406 v267 = (int)(ii + 1); | |
4407 v732 = v267; | |
4408 v268 = *(int *)v267; | |
4409 *(int *)(v245 + 12) = v268; | |
4410 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
4411 + 4]; | |
4412 if ( v264 >= v265 ) | |
1009 | 4413 break; |
993 | 4414 } |
4415 } | |
1013 | 4416 |
4417 v277 = pItemsTable->pSpecialEnchantments_count; | |
4418 v278 = 0; | |
4419 v725 = 0.0; | |
4420 _v733 = 0; | |
4421 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
4422 { | |
4423 int *_v730 = v679; | |
4424 do | |
4425 { | |
4426 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); | |
4427 if ( !v279 || v279 == 1 ) | |
4428 { | |
4429 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]); | |
4430 _v733 += v280; | |
4431 if ( v280 ) | |
4432 { | |
4433 v281 = _v730; | |
4434 ++_v730; | |
4435 *v281 = _v733; | |
4436 } | |
4437 } | |
4438 ++_v733; | |
4439 ++v278; | |
4440 } | |
4441 while ( _v733 < v277 ); | |
4442 } | |
4443 v282 = rand() % _v733; | |
4444 v283 = v679; | |
4445 v245->uSpecEnchantmentType = v679[0]; | |
4446 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType ]; | |
4447 v285 = v282 + 1; | |
4448 for ( l = v679; v284 < v285; ++l ) | |
4449 { | |
4450 v245->uSpecEnchantmentType = *(l+1); | |
4451 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]; | |
4452 } | |
4453 ++v245->uSpecEnchantmentType; | |
4454 v245->uAttributes |= 0x20u; | |
4455 _50C9A8_item_enchantment_timer = 256; | |
4456 LODWORD(v727) = 1; | |
4457 break; | |
4458 } | |
890 | 4459 } |
1013 | 4460 else |
1009 | 4461 { |
1013 | 4462 if ( !(BYTE1(v245->uAttributes) & 2) ) |
4463 { | |
4464 v245->uAttributes |= 2; | |
4465 } | |
1009 | 4466 } |
1013 | 4467 |
4468 } | |
4469 | |
4470 if ( LODWORD(v727) == 0 ) | |
4471 { | |
4472 v317 = pGlobalTXT_LocalizationStrings[428]; | |
4473 if ( v730 == 0 ) | |
4474 v317 = pGlobalTXT_LocalizationStrings[585]; | |
4475 ShowStatusBarString(v317, 2u); | |
4476 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4477 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4478 pCastSpell->spellnum = 0; | |
4479 v318->PlaySound(SPEECH_43, 0); | |
4480 } | |
4481 | |
993 | 4482 break; |
890 | 4483 } |
1009 | 4484 case SPELL_WATER_TOWN_PORTAL: |
4485 { | |
4486 amount = 10 * v2; | |
4487 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
4488 break; | |
4489 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
4490 { | |
4491 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4492 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4493 pCastSpell->spellnum = 0; | |
4494 continue; | |
4495 } | |
4496 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); | |
4497 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
4498 LODWORD(v727) = 1; | |
4499 break; | |
4500 } | |
4501 case SPELL_WATER_LLOYDS_BEACON: | |
993 | 4502 { |
1009 | 4503 LODWORD(v733) = 604800 * v2; |
4504 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
4505 { | |
4506 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
993 | 4507 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4508 pCastSpell->spellnum = 0; | |
1009 | 4509 continue; |
4510 } | |
4511 v319 = uRequiredMana; | |
4512 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
4513 { | |
4514 pEventTimer->Pause(); | |
4515 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); | |
4516 qword_506350 = (signed int)v733; | |
4517 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; | |
4518 ::uRequiredMana = v319; | |
4519 ::sRecoveryTime = sRecoveryTime; | |
4520 dword_50633C = pCastSpell->sound_id; | |
4521 dword_506338 = pCastSpell->spellnum; | |
4522 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
993 | 4523 } |
4524 break; | |
4525 } | |
1009 | 4526 case SPELL_EARTH_STONE_TO_FLESH: |
890 | 4527 { |
1009 | 4528 __debugbreak(); // missing GM ? |
4529 switch (v731) | |
4530 { | |
4531 case 1: amount = 3600 * v2; break; | |
4532 case 2: amount = 3600 * v2; break; | |
4533 case 3: amount = 86400 * v2; break; | |
4534 case 4: break; | |
4535 default: | |
4536 assert(false); | |
4537 } | |
4538 //LABEL_634: | |
4539 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4540 break; |
1009 | 4541 v323 = pCastSpell->uPlayerID_2; |
4542 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
4543 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
4544 { | |
4545 LODWORD(v727) = 1; | |
4546 break; | |
4547 } | |
4548 if ( v731 == 4 ) | |
4549 { | |
4550 *(int *)v324 = 0; | |
4551 *((int *)v324 + 1) = 0; | |
4552 LODWORD(v727) = 1; | |
4553 break; | |
4554 } | |
4555 v732 = amount << 7; | |
4556 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
4557 v656 = 15; | |
4558 v325 = &pParty->pPlayers[v323]; | |
4559 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
4560 LODWORD(v727) = 1; | |
4561 break; | |
890 | 4562 } |
1009 | 4563 case SPELL_EARTH_ROCK_BLAST: |
890 | 4564 { |
1009 | 4565 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4566 break; | |
4567 pSpellSprite.stru_24.Reset(); | |
4568 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4569 pSpellSprite.spell_level = v2; | |
4570 pSpellSprite.spell_skill = v731; | |
4571 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4572 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4573 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4574 pSpellSprite.uAttributes = 0; | |
4575 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4576 pSpellSprite.uSectorID = pIndoor->GetSector( | |
4577 pParty->vPosition.x, | |
4578 pParty->vPosition.y, | |
4579 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4580 pSpellSprite.uSpriteFrameID = 0; | |
4581 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4582 pSpellSprite.spell_target_pid = a2; | |
4583 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4584 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
4585 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4586 if ( pParty->bTurnBasedModeOn == 1 ) | |
4587 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
4588 | |
4589 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4590 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4591 ++pTurnEngine->field_1C; | |
890 | 4592 LODWORD(v727) = 1; |
4593 break; | |
4594 } | |
1009 | 4595 case SPELL_EARTH_DEATH_BLOSSOM: |
890 | 4596 { |
1009 | 4597 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4598 { | |
4599 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4600 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4601 pCastSpell->spellnum = 0; | |
4602 continue; | |
4603 } | |
4604 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4605 break; | |
4606 pSpellSprite.uType = 4090; | |
4607 pSpellSprite.stru_24.Reset(); | |
4608 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4609 pSpellSprite.spell_level = v2; | |
4610 pSpellSprite.spell_skill = v731; | |
4611 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4612 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4613 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4614 pSpellSprite.uAttributes = 0; | |
4615 pSpellSprite.uSectorID = 0; | |
4616 pSpellSprite.uSpriteFrameID = 0; | |
4617 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4618 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4619 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4620 pSpellSprite.spell_target_pid = a2; | |
4621 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
4622 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4623 if ( pParty->bTurnBasedModeOn == 1 ) | |
4624 pSpellSprite.uAttributes = 4; | |
4625 | |
4626 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4627 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4628 ++pTurnEngine->field_1C; | |
4629 LODWORD(v727) = 1; | |
4630 break; | |
4631 } | |
4632 case SPELL_SPIRIT_DETECT_LIFE: | |
4633 { | |
4634 v328 = v731 - 2; | |
4635 if ( v328 ) | |
4636 { | |
4637 v329 = v328 - 1; | |
4638 if ( v329 && v329 != 1 ) | |
4639 v330 = 600 * v2; | |
4640 else | |
4641 v330 = 3600 * v2; | |
4642 } | |
4643 else | |
4644 { | |
4645 v330 = 1800 * v2; | |
4646 } | |
4647 LODWORD(v733) = v330; | |
4648 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4649 break; | |
4650 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4651 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4652 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4653 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4654 | |
4655 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); | |
890 | 4656 LODWORD(v727) = 1; |
4657 break; | |
4658 } | |
1009 | 4659 case SPELL_SPIRIT_FATE: |
890 | 4660 { |
1009 | 4661 switch (v731) |
4662 { | |
4663 case 1: amount = 1 * v2; break; | |
4664 case 2: amount = 2 * v2; break; | |
4665 case 3: amount = 4 * v2; break; | |
4666 case 4: amount = 6 * v2; break; | |
4667 default: | |
4668 assert(false); | |
4669 } | |
4670 LODWORD(v733) = 300; | |
4671 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4672 break; | |
4673 v342 = pCastSpell->spell_target_pid; | |
4674 if ( v342 == 0 ) | |
4675 { | |
4676 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4677 | |
4678 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
4679 LODWORD(v727) = 1; | |
4680 break; | |
4681 } | |
4682 if (PID_TYPE(v342) == OBJECT_Actor) | |
4683 { | |
4684 v343 = PID_ID(v342); | |
4685 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
4686 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
4687 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
4688 BYTE2(pActors[v343].uAttributes) |= 8u; | |
4689 //v672 = 0; | |
4690 v661 = &pActors[v343]; | |
4691 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
4692 } | |
4693 LODWORD(v727) = 1; | |
890 | 4694 break; |
1009 | 4695 } |
4696 case SPELL_SPIRIT_REMOVE_CURSE: | |
890 | 4697 { |
1009 | 4698 switch (v731) |
4699 { | |
4700 case 1: amount = 3600 * v2; break; | |
4701 case 2: amount = 3600 * v2; break; | |
4702 case 3: amount = 86400 * v2; break; | |
4703 case 4: amount = 0; break; | |
4704 default: | |
4705 assert(false); | |
4706 } | |
4707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4708 break; | |
4709 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4710 if ( !v351->pConditions[0] ) | |
4711 { | |
4712 LODWORD(v727) = 1; | |
4713 break; | |
4714 } | |
4715 if ( v731 == 4 ) | |
4716 { | |
4717 LODWORD(v351->pConditions[0]) = 0; | |
4718 HIDWORD(v351->pConditions[0]) = 0; | |
4719 } | |
890 | 4720 else |
1009 | 4721 { |
4722 v732 = amount << 7; | |
4723 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
4724 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) | |
4725 { | |
4726 LODWORD(v727) = 1; | |
4727 break; | |
4728 } | |
4729 } | |
924 | 4730 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 4731 LODWORD(v727) = 1; |
4732 break; | |
4733 } | |
1009 | 4734 case SPELL_SPIRIT_PRESERVATION: |
890 | 4735 { |
1009 | 4736 if ( v731 == 4 ) |
4737 LODWORD(v733) = 900 * (v2 + 4); | |
4738 else | |
4739 LODWORD(v733) = 300 * (v2 + 12); | |
4740 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4741 break; | |
4742 if ( v731 == 1 || v731 == 2 ) | |
4743 { | |
4744 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4745 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); | |
4746 LODWORD(v727) = 1; | |
4747 break; | |
4748 } | |
4749 a2 = 0; | |
4750 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4751 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
4752 do | |
4753 { | |
4754 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); | |
4755 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
4756 ++a2; | |
4757 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
4758 } | |
4759 while ( v357 <= &pParty->pPlayers[3] ); | |
890 | 4760 LODWORD(v727) = 1; |
4761 break; | |
4762 } | |
4763 case SPELL_SPIRIT_TURN_UNDEAD: | |
4764 { | |
1009 | 4765 if ( v731 == 1 || v731 == 2) |
4766 LODWORD(v733) = 60 * (v2 + 3); | |
4767 else | |
4768 LODWORD(v733) = 300 * v2 + 180; | |
4769 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4770 break; | |
4771 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4772 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
4773 ++pSpellSprite.uType; | |
4774 pSpellSprite.stru_24.Reset(); | |
4775 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4776 pSpellSprite.spell_level = v2; | |
4777 pSpellSprite.spell_skill = v731; | |
4778 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4779 pSpellSprite.uAttributes = 0; | |
4780 pSpellSprite.uSectorID = 0; | |
4781 pSpellSprite.uSpriteFrameID = 0; | |
4782 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4783 pSpellSprite.uFacing = 0; | |
4784 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4785 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4786 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
4787 { | |
4788 v369 = &pActors[dword_50BF30[a2]]; | |
4789 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
4790 { | |
4791 pSpellSprite.vPosition.x = v369->vPosition.x; | |
4792 pSpellSprite.vPosition.y = v369->vPosition.y; | |
4793 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
4794 | |
4795 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4796 pSpellSprite.Create(0, 0, 0, 0); | |
4797 v369->pActorBuffs[4].Apply( | |
4798 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
4799 v731, 0, 0, 0); | |
4800 } | |
4801 } | |
4802 LODWORD(v727) = 1; | |
890 | 4803 break; |
4804 } | |
1009 | 4805 case SPELL_SPIRIT_RAISE_DEAD: |
890 | 4806 { |
4807 if ( v731 == 4 ) | |
1009 | 4808 amount = 0; |
4809 else | |
4810 amount = 86400 * v2; | |
4811 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4812 break; | |
4813 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); | |
4814 v373 = pCastSpell->uPlayerID_2; | |
4815 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
4816 { | |
4817 LODWORD(v727) = 1; | |
4818 break; | |
4819 } | |
4820 v14 = v731 == 4; | |
4821 pParty->pPlayers[v373].sHealth = 1; | |
4822 if ( v14 ) | |
4823 { | |
4824 v374 = pCastSpell->uPlayerID_2; | |
4825 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
4826 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
4827 v376 = pCastSpell->uPlayerID_2; | |
4828 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
4829 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
890 | 4830 } |
889 | 4831 else |
890 | 4832 { |
1009 | 4833 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
4834 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
4835 0xEu, | |
890 | 4836 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
1009 | 4837 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
4838 0xDu, | |
4839 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4840 } | |
4841 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4842 v377->SetCondition(1, 0); | |
889 | 4843 LODWORD(v727) = 1; |
890 | 4844 break; |
4845 } | |
1009 | 4846 case SPELL_SPIRIT_SHARED_LIFE: |
993 | 4847 { |
1009 | 4848 if ( v731 == 4 ) |
4849 amount = 4 * v2; | |
4850 else | |
4851 amount = 3 * v2; | |
4852 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4853 break; | |
4854 v381 = 0; | |
1013 | 4855 signed int _v733 = amount; |
1009 | 4856 v730 = 0; |
4857 v382 = 1; | |
4858 do | |
4859 { | |
4860 v383 = pPlayers[v382]; | |
4861 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
4862 v682[v381++] = v382; | |
4863 ++v382; | |
4864 } | |
4865 while ( v382 <= 4 ); | |
4866 v384 = 0; | |
4867 v730 = v381; | |
4868 if ( v381 > 0 ) | |
4869 { | |
4870 do | |
1013 | 4871 _v733 += pPlayers[v682[v384++]]->sHealth; |
1009 | 4872 while ( v384 < v381 ); |
4873 } | |
1013 | 4874 v732 = (signed __int64)((double)_v733 / (double)v730); |
4875 _v733 = 0; | |
1009 | 4876 if ( v381 > 0 ) |
4877 { | |
4878 do | |
4879 { | |
4880 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
1013 | 4881 v726 = pPlayers[v682[_v733]]; |
1009 | 4882 v726->sHealth = v732; |
4883 //v386 = v726->GetMaxHealth(); | |
4884 if ( v726->sHealth > v726->GetMaxHealth()) | |
4885 v726->sHealth = v726->GetMaxHealth(); | |
4886 if ( v726->sHealth > 0 ) | |
4887 { | |
4888 v726->pConditions[Player::Condition_Unconcious] = 0; | |
4889 } | |
1013 | 4890 v388 = _v733; |
4891 | |
4892 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[_v733]) - 1); | |
4893 _v733 = v388 + 1; | |
1009 | 4894 } |
4895 while ( v388 + 1 < v730 ); | |
4896 } | |
890 | 4897 LODWORD(v727) = 1; |
4898 break; | |
4899 } | |
1009 | 4900 case SPELL_SPIRIT_RESSURECTION: |
4901 { | |
4902 switch (v731) | |
4903 { | |
4904 case 1: amount = 180 * v2; break; | |
4905 case 2: amount = 10800 * v2; break; | |
4906 case 3: amount = 259200 * v2; break; | |
4907 case 4: amount = 0; break; | |
4908 default: | |
4909 assert(false); | |
4910 } | |
4911 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4912 break; | |
4913 v396 = pCastSpell->uPlayerID_2; | |
4914 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
4915 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
4916 { | |
4917 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
4918 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
4919 if ( v731 == 4 ) | |
4920 { | |
4921 v397 = pCastSpell->uPlayerID_2; | |
4922 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
4923 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
4924 v398 = pCastSpell->uPlayerID_2; | |
4925 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
4926 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
4927 v399 = pCastSpell->uPlayerID_2; | |
4928 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
4929 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
4930 } | |
4931 else | |
4932 { | |
4933 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
4934 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | |
4935 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4936 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | |
4937 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4938 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | |
4939 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4940 } | |
4941 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); | |
4942 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
4943 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4944 } | |
4945 LODWORD(v727) = 1; | |
4946 break; | |
4947 } | |
4948 case SPELL_MIND_CURE_PARALYSIS: | |
4949 { | |
4950 switch (v731) | |
4951 { | |
4952 case 1: amount = 3600 * v2; break; | |
4953 case 2: amount = 3600 * v2; break; | |
4954 case 3: amount = 86400 * v2; break; | |
4955 case 4: amount = 0; break; | |
4956 default: | |
4957 assert(false); | |
4958 } | |
4959 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4960 break; | |
4961 | |
4962 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4963 v323 = pCastSpell->uPlayerID_2; | |
4964 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
4965 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
4966 { | |
4967 LODWORD(v727) = 1; | |
4968 break; | |
4969 } | |
4970 if ( v731 == 4 ) | |
4971 { | |
4972 *(int *)v324 = 0; | |
4973 *((int *)v324 + 1) = 0; | |
4974 LODWORD(v727) = 1; | |
4975 break; | |
4976 } | |
4977 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
4978 v656 = 12; | |
4979 v325 = &pParty->pPlayers[v323]; | |
4980 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
4981 LODWORD(v727) = 1; | |
4982 break; | |
4983 } | |
4984 case SPELL_MIND_REMOVE_FEAR: | |
4985 { | |
4986 switch (v731) | |
4987 { | |
4988 case 1: amount = 180 * v2; break; | |
4989 case 2: amount = 3600 * v2; break; | |
4990 case 3: amount = 86400 * v2; break; | |
4991 case 4: amount = 0; break; | |
4992 default: | |
4993 assert(false); | |
4994 } | |
4995 | |
4996 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4997 break; | |
4998 | |
4999 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5000 v323 = pCastSpell->uPlayerID_2; | |
5001 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
5002 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
5003 { | |
5004 LODWORD(v727) = 1; | |
5005 break; | |
5006 } | |
5007 if ( v731 == 4 ) | |
5008 { | |
5009 *(int *)v324 = 0; | |
5010 *((int *)v324 + 1) = 0; | |
5011 LODWORD(v727) = 1; | |
5012 break; | |
5013 } | |
5014 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5015 v656 = 3; | |
5016 v325 = &pParty->pPlayers[v323]; | |
5017 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5018 LODWORD(v727) = 1; | |
5019 break; | |
993 | 5020 } |
890 | 5021 case SPELL_MIND_TELEPATHY: |
993 | 5022 { |
5023 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5024 break; | |
5025 if (PID_TYPE(a2) != OBJECT_Actor) | |
5026 { | |
5027 LODWORD(v727) = 1; | |
5028 break; | |
5029 } | |
1013 | 5030 v417 = &pActors[PID_ID(a2)]; |
5031 Actor * _v730 = v417; | |
5032 if ( !(BYTE2(v417->uAttributes) & 0x80) ) | |
5033 { | |
5034 v417->SetRandomGoldIfTheresNoItem(); | |
5035 v417 = _v730; | |
5036 } | |
5037 v418 = v417->array_000234[3].uItemID; | |
5038 signed int _v733 = 0; | |
993 | 5039 if ( pItemsTable->pItems[v418].uEquipType == 18 ) |
1013 | 5040 _v733 = v417->array_000234[3].uSpecEnchantmentType; |
993 | 5041 |
5042 //ItemGen::ItemGen(&v683); | |
5043 v683.Reset(); | |
5044 | |
1013 | 5045 v419 = _v730->uCarriedItemID; |
993 | 5046 if (v419) |
5047 { | |
5048 v683.uItemID = v419; | |
5049 //goto LABEL_799; | |
5050 } | |
5051 else | |
5052 { | |
5053 v420 = 0; | |
1013 | 5054 v421 = _v730->array_000234; |
5055 while ( !v421->uItemID || pItemsTable->pItems[v421->uItemID].uEquipType == 18 ) | |
993 | 5056 { |
5057 ++v420; | |
1013 | 5058 ++v421; |
993 | 5059 if ( v420 >= 4 ) |
5060 break; | |
5061 } | |
5062 if ( v420 < 4 ) | |
5063 { | |
1013 | 5064 memcpy(&v683, &_v730->array_000234[v420], sizeof(v683)); |
1009 | 5065 v2 = v723; |
5066 //v1 = 0; | |
993 | 5067 } |
5068 } | |
5069 // LABEL_799: | |
1013 | 5070 if ( _v733 != 0 ) |
5071 { | |
5072 v675 = _v733; | |
993 | 5073 if (v683.uItemID) |
5074 { | |
5075 v422 = v683.GetDisplayName(); | |
5076 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
1013 | 5077 |
993 | 5078 } |
5079 else | |
5080 { | |
5081 v664 = "%d gold"; | |
5082 sprintf(pTmpBuf2, v664, v675); | |
5083 } | |
5084 } | |
5085 else | |
5086 { | |
5087 if (v683.uItemID) | |
5088 { | |
1013 | 5089 const char *_v675 = v683.GetDisplayName(); |
993 | 5090 v664 = "(%s)"; |
1013 | 5091 sprintf(pTmpBuf2, v664, _v675); |
993 | 5092 } |
5093 else | |
5094 { | |
5095 strcpy(pTmpBuf2, "nothing"); | |
5096 ShowStatusBarString(pTmpBuf2, 2u); | |
5097 } | |
5098 } | |
1013 | 5099 ShowStatusBarString(pTmpBuf2, 2u); |
5100 pSpellSprite.stru_24.Reset(); | |
5101 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5102 pSpellSprite.spell_level = v2; | |
5103 pSpellSprite.spell_skill = v731; | |
5104 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5105 pSpellSprite.vPosition.x = _v730->vPosition.x; | |
5106 pSpellSprite.vPosition.y = _v730->vPosition.y; | |
5107 v676 = _v730->uActorHeight; | |
5108 v665 = pSpellSprite.vPosition.y; | |
5109 pSpellSprite.vPosition.z = _v730->uActorHeight; | |
5110 v657 = pSpellSprite.vPosition.x; | |
993 | 5111 pSpellSprite.uAttributes = 0; |
5112 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5113 pSpellSprite.uSpriteFrameID = 0; | |
5114 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5115 pSpellSprite.spell_target_pid = a2; | |
5116 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5117 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5118 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5119 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5120 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
889 | 5121 LODWORD(v727) = 1; |
890 | 5122 break; |
5123 } | |
993 | 5124 case SPELL_MIND_BERSERK: |
5125 { | |
1009 | 5126 switch (v731) |
5127 { | |
5128 case 1: amount = 300 * v2; break; | |
5129 case 2: amount = 300 * v2; break; | |
5130 case 3: amount = 600 * v2; break; | |
5131 case 4: amount = 3600; break; | |
5132 default: | |
5133 assert(false); | |
5134 } | |
993 | 5135 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5136 break; | |
5137 v426 = PID_ID(a2); | |
5138 if (PID_TYPE(a2) != OBJECT_Actor) | |
5139 { | |
5140 LODWORD(v727) = 1; | |
5141 break; | |
5142 } | |
5143 v730 = 836 * v426; | |
5144 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
5145 { | |
5146 pActors[v426].pActorBuffs[1].Reset(); | |
5147 pActors[v426].pActorBuffs[12].Reset(); | |
5148 pActors[v426].pActorBuffs[9].Apply( | |
5149 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5150 v731, 0, 0, 0); | |
5151 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5152 } | |
924 | 5153 pSpellSprite.stru_24.Reset(); |
5154 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5155 pSpellSprite.spell_level = v2; | |
5156 pSpellSprite.spell_skill = v731; | |
993 | 5157 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
5158 v61 = v426; | |
5159 v600 = pActors[v61].vPosition.y; | |
5160 v601 = pActors[v61].vPosition.x; | |
5161 pSpellSprite.uObjectDescID = v60; | |
5162 pSpellSprite.vPosition.x = v601; | |
5163 v602 = pActors[v61].uActorHeight; | |
5164 v603 = pActors[v61].vPosition.z; | |
5165 pSpellSprite.vPosition.y = v600; | |
5166 v676 = v603 + v602; | |
5167 v665 = v600; | |
5168 pSpellSprite.vPosition.z = v603 + v602; | |
5169 v657 = v601; | |
5170 pSpellSprite.uAttributes = 0; | |
5171 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5172 pSpellSprite.uSpriteFrameID = 0; | |
5173 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5174 pSpellSprite.spell_target_pid = a2; | |
5175 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5176 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5177 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5178 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5179 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 5180 LODWORD(v727) = 1; |
5181 break; | |
5182 } | |
5183 case SPELL_MIND_ENSLAVE: | |
993 | 5184 { |
5185 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5186 break; | |
5187 amount = 600 * v2; | |
5188 if (PID_TYPE(a2) != OBJECT_Actor) | |
5189 { | |
5190 LODWORD(v727) = 1; | |
5191 break; | |
5192 } | |
5193 v730 = 836 * PID_ID(a2); | |
5194 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5195 break; | |
5196 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
5197 { | |
5198 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
5199 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
5200 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5201 v731, 0, 0, 0); | |
5202 } | |
5203 pSpellSprite.stru_24.Reset(); | |
5204 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5205 pSpellSprite.spell_level = v2; | |
5206 pSpellSprite.spell_skill = v731; | |
5207 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5208 v61 = PID_ID(a2); | |
5209 v600 = pActors[v61].vPosition.y; | |
5210 v601 = pActors[v61].vPosition.x; | |
5211 pSpellSprite.uObjectDescID = v60; | |
5212 pSpellSprite.vPosition.x = v601; | |
5213 v602 = pActors[v61].uActorHeight; | |
5214 v603 = pActors[v61].vPosition.z; | |
5215 pSpellSprite.vPosition.y = v600; | |
5216 v676 = v603 + v602; | |
5217 v665 = v600; | |
5218 pSpellSprite.vPosition.z = v603 + v602; | |
5219 v657 = v601; | |
5220 pSpellSprite.uAttributes = 0; | |
5221 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5222 pSpellSprite.uSpriteFrameID = 0; | |
5223 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5224 pSpellSprite.spell_target_pid = a2; | |
5225 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5226 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5227 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5228 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5229 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 5230 LODWORD(v727) = 1; |
5231 break; | |
5232 } | |
5233 case SPELL_MIND_MASS_FEAR: | |
5234 { | |
1009 | 5235 if ( v731 == 4 ) |
5236 amount = 300 * v2; | |
5237 else | |
5238 amount = 180 * v2; | |
5239 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5240 break; | |
5241 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5242 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
5243 ++pSpellSprite.uType; | |
5244 pSpellSprite.stru_24.Reset(); | |
5245 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5246 pSpellSprite.spell_level = v2; | |
5247 pSpellSprite.spell_skill = v731; | |
5248 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5249 pSpellSprite.uAttributes = 0; | |
5250 pSpellSprite.uSectorID = 0; | |
5251 pSpellSprite.uSpriteFrameID = 0; | |
5252 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5253 pSpellSprite.uFacing = 0; | |
5254 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5255 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5256 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
5257 { | |
5258 v433 = &pActors[dword_50BF30[a2]]; | |
5259 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5260 break; | |
5261 pSpellSprite.vPosition.x = v433->vPosition.x; | |
5262 pSpellSprite.vPosition.y = v433->vPosition.y; | |
5263 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
5264 | |
5265 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5266 pSpellSprite.Create(0, 0, 0, 0); | |
5267 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | |
5268 { | |
5269 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5270 v731, 0, 0, 0); | |
5271 } | |
5272 } | |
5273 LODWORD(v727) = 1; | |
890 | 5274 break; |
5275 } | |
1009 | 5276 case SPELL_MIND_CURE_INSANITY: |
890 | 5277 { |
1009 | 5278 v435 = v731 - 2; |
5279 if ( v731 == 4 ) | |
5280 amount = 0; | |
889 | 5281 else |
1009 | 5282 amount = 86400 * v2; |
5283 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5284 break; | |
5285 | |
5286 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5287 v440 = pCastSpell->uPlayerID_2; | |
5288 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
5289 { | |
5290 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
5291 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
5292 if ( v731 == 4 ) | |
890 | 5293 { |
1009 | 5294 v441 = pCastSpell->uPlayerID_2; |
5295 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
5296 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
890 | 5297 } |
5298 else | |
1009 | 5299 { |
5300 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | |
5301 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
5302 } | |
5303 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5304 v377->SetCondition(1, 0); | |
5305 } | |
889 | 5306 LODWORD(v727) = 1; |
890 | 5307 break; |
5308 } | |
1009 | 5309 case SPELL_EARTH_TELEKINESIS: |
890 | 5310 { |
1009 | 5311 switch (v731) |
5312 { | |
5313 case 1: amount = 2 * v2; break; | |
5314 case 2: amount = 2 * v2; break; | |
5315 case 3: amount = 3 * v2; break; | |
5316 case 4: amount = 4 * v2; break; | |
5317 default: | |
5318 assert(false); | |
5319 } | |
5320 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5321 break; | |
5322 v445 = PID_ID(a2); | |
5323 if (PID_TYPE(a2) == OBJECT_Item) | |
5324 { | |
5325 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
5326 v450 = *(int *)v449; | |
5327 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
5328 { | |
5329 party_finds_gold(*((int *)v449 + 3), 0); | |
5330 viewparams->bRedrawGameUI = 1; | |
5331 } | |
5332 else | |
5333 { | |
5334 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); | |
5335 ShowStatusBarString(pTmpBuf2, 2u); | |
5336 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
5337 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
5338 } | |
5339 SpriteObject::OnInteraction(v445); | |
5340 } | |
5341 else | |
5342 { | |
5343 if (PID_TYPE(a2) == OBJECT_Actor) | |
5344 { | |
5345 stru_50C198.LootActor(&pActors[v445]); | |
5346 } | |
5347 else | |
5348 { | |
5349 if (PID_TYPE(a2) != OBJECT_Decoration) | |
5350 { | |
5351 if (PID_TYPE(a2) != OBJECT_BModel) | |
5352 { | |
5353 LODWORD(v727) = 1; | |
5354 break; | |
5355 } | |
5356 dword_507CD8 = 1; | |
5357 v677 = 1; | |
5358 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5359 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
5360 else | |
5361 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
5362 EventProcessor(v446, a2, v677); | |
5363 LODWORD(v727) = 1; | |
5364 break; | |
5365 } | |
5366 v447 = &pLevelDecorations[v445]; | |
5367 dword_507CD8 = 1; | |
5368 v448 = v447->field_16_event_id; | |
5369 if (v448) | |
5370 { | |
5371 v677 = 1; | |
5372 v446 = v448; | |
5373 EventProcessor(v446, a2, v677); | |
5374 LODWORD(v727) = 1; | |
5375 break; | |
5376 } | |
5377 if ( v447->IsInteractive() ) | |
5378 { | |
5379 activeLevelDecoration = v447; | |
5380 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
5381 activeLevelDecoration = NULL; | |
5382 } | |
5383 } | |
5384 } | |
890 | 5385 LODWORD(v727) = 1; |
5386 break; | |
5387 } | |
1009 | 5388 case SPELL_BODY_CURE_WEAKNESS: |
890 | 5389 { |
1009 | 5390 switch (v731) |
5391 { | |
5392 case 1: amount = 180 * v2; break; | |
5393 case 2: amount = 3600 * v2; break; | |
5394 case 3: amount = 86400 * v2; break; | |
5395 case 4: amount = 0; break; | |
5396 default: | |
5397 assert(false); | |
5398 } | |
5399 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5400 break; | |
5401 | |
5402 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5403 v323 = pCastSpell->uPlayerID_2; | |
5404 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
5405 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
5406 { | |
5407 LODWORD(v727) = 1; | |
5408 break; | |
5409 } | |
5410 if ( v731 == 4 ) | |
5411 { | |
5412 *(int *)v324 = 0; | |
5413 *((int *)v324 + 1) = 0; | |
5414 LODWORD(v727) = 1; | |
5415 break; | |
5416 } | |
5417 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5418 v656 = 1; | |
5419 v325 = &pParty->pPlayers[v323]; | |
5420 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
890 | 5421 LODWORD(v727) = 1; |
5422 break; | |
5423 } | |
1009 | 5424 case SPELL_BODY_FIRST_AID: |
890 | 5425 { |
1009 | 5426 switch (v731) |
5427 { | |
5428 case 1: amount = 2 * v2 + 5; break; | |
5429 case 2: amount = 3 * v2 + 5; break; | |
5430 case 3: amount = 4 * v2 + 5; break; | |
5431 case 4: amount = 5 * v2 + 5; break; | |
5432 default: | |
5433 assert(false); | |
5434 } | |
5435 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5436 break; | |
5437 v460 = pCastSpell->spell_target_pid; | |
5438 if (!v460) | |
5439 { | |
5440 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); | |
5441 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5442 } | |
5443 else | |
5444 { | |
5445 if (PID_TYPE(v460) == OBJECT_Actor) | |
5446 { | |
5447 v461 = &pActors[PID_ID(v460)]; | |
5448 v462 = v461->uAIState; | |
5449 v463 = v461->pMonsterInfo.uHP; | |
5450 if ( v462 != 5 ) | |
5451 { | |
5452 if ( v462 != 4 ) | |
5453 { | |
5454 if ( v462 != 19 ) | |
5455 { | |
5456 if ( v462 != 11 ) | |
5457 { | |
5458 v461->sCurrentHP += amount; | |
5459 if ( v461->sCurrentHP > v463 ) | |
5460 v461->sCurrentHP = v463; | |
5461 } | |
5462 } | |
5463 } | |
5464 } | |
5465 } | |
5466 } | |
890 | 5467 LODWORD(v727) = 1; |
5468 break; | |
5469 } | |
1009 | 5470 case SPELL_BODY_CURE_POISON: |
5471 { | |
5472 switch (v731) | |
5473 { | |
5474 case 1: amount = 3600 * v2; break; | |
5475 case 2: amount = 3600 * v2; break; | |
5476 case 3: amount = 86400 * v2; break; | |
5477 case 4: amount = 0; break; | |
5478 default: | |
5479 assert(false); | |
5480 } | |
5481 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5482 break; | |
5483 | |
5484 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5485 v470 = pCastSpell->uPlayerID_2; | |
5486 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
5487 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
5488 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
5489 { | |
5490 LODWORD(v727) = 1; | |
5491 break; | |
5492 } | |
5493 if ( v731 == 4 ) | |
5494 { | |
5495 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
5496 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
5497 v471 = pCastSpell->uPlayerID_2; | |
5498 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
5499 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
5500 v472 = pCastSpell->uPlayerID_2; | |
5501 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
5502 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
5503 LODWORD(v727) = 1; | |
5504 break; | |
5505 } | |
5506 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5507 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
5508 6u, | |
5509 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5510 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5511 8u, | |
5512 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5513 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
5514 v656 = 10; | |
5515 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5516 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5517 LODWORD(v727) = 1; | |
5518 break; | |
993 | 5519 } |
890 | 5520 case SPELL_BODY_PROTECTION_FROM_MAGIC: |
5521 { | |
1009 | 5522 amount = v2; |
5523 LODWORD(v733) = 3600 * v2; | |
5524 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5525 break; | |
5526 | |
924 | 5527 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5528 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5529 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5530 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
1009 | 5531 |
5532 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
890 | 5533 LODWORD(v727) = 1; |
5534 break; | |
5535 } | |
1009 | 5536 case SPELL_BODY_HAMMERHANDS: |
890 | 5537 { |
1009 | 5538 LODWORD(v733) = 3600 * v2; |
5539 amount = v2; | |
5540 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5541 break; | |
5542 if ( v731 == 4 ) | |
5543 { | |
5544 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5545 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5546 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5547 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5548 v732 = (int)v733 << 7; | |
5549 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5550 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5551 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5552 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5553 | |
5554 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
5555 LODWORD(v727) = 1; | |
5556 break; | |
5557 } | |
5558 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5559 | |
5560 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 | 5561 LODWORD(v727) = 1; |
5562 break; | |
5563 } | |
1009 | 5564 case SPELL_BODY_CURE_DISEASE: |
890 | 5565 { |
1009 | 5566 if ( v731 == 4 ) |
5567 amount = 0; | |
5568 else | |
5569 amount = 86400 * v2; | |
5570 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5571 break; | |
5572 | |
5573 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5574 v498 = pCastSpell->uPlayerID_2; | |
5575 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
5576 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
5577 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
5578 { | |
5579 LODWORD(v727) = 1; | |
5580 break; | |
5581 } | |
5582 if ( v731 == 4 ) | |
5583 { | |
5584 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
5585 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
5586 v499 = pCastSpell->uPlayerID_2; | |
5587 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
5588 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
5589 v500 = pCastSpell->uPlayerID_2; | |
5590 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
5591 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
5592 } | |
5593 else | |
5594 { | |
5595 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5596 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
5597 7u, | |
5598 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5599 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5600 9u, | |
5601 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5602 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
5603 v656 = 11; | |
5604 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5605 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5606 } | |
890 | 5607 LODWORD(v727) = 1; |
5608 break; | |
1009 | 5609 } |
890 | 5610 case SPELL_BODY_POWER_CURE: |
5611 { | |
1009 | 5612 amount = 5 * v2 + 10; |
5613 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5614 break; | |
5615 v501 = pParty->pPlayers; | |
5616 int v1 = 0; | |
5617 do | |
5618 { | |
5619 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); | |
5620 v501->Heal(amount); | |
5621 ++v501; | |
5622 ++v1; | |
5623 } | |
5624 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
890 | 5625 LODWORD(v727) = 1; |
5626 break; | |
5627 } | |
5628 case SPELL_LIGHT_DISPEL_MAGIC: | |
5629 { | |
1009 | 5630 sRecoveryTime -= v2; |
5631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5632 break; | |
5633 | |
5634 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
5635 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5636 ++pSpellSprite.uType; | |
1013 | 5637 signed int _v733 = v505; |
1009 | 5638 v688.x = 0; |
5639 v688.y = 0; | |
5640 v688.z = 0; | |
5641 pSpellSprite.stru_24.Reset(); | |
5642 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5643 pSpellSprite.spell_level = v2; | |
5644 pSpellSprite.spell_skill = v731; | |
5645 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5646 pSpellSprite.uAttributes = 0; | |
5647 pSpellSprite.uSectorID = 0; | |
5648 pSpellSprite.uSpriteFrameID = 0; | |
5649 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5650 pSpellSprite.uFacing = 0; | |
5651 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5652 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5653 a2 = 0; | |
1013 | 5654 if ( _v733 > 0 ) |
1009 | 5655 { |
5656 do | |
5657 { | |
5658 v507 = dword_50BF30[a2]; | |
5659 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; | |
5660 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
5661 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
5662 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5663 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
5664 v510 = a2; | |
1013 | 5665 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], &v688); |
1009 | 5666 a2 = v510 + 1; |
5667 } | |
1013 | 5668 while ( v510 + 1 < _v733 ); |
5669 } | |
5670 for ( a2 = 0; a2 < _v733; ++a2 ) | |
5671 { | |
5672 pActor = &pActors[dword_50BF30[a2]]; | |
5673 pSpellSprite.vPosition.x = pActor->vPosition.x; | |
5674 pSpellSprite.vPosition.y = pActor->vPosition.y; | |
5675 pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * unk_4D8548); | |
1009 | 5676 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
5677 pSpellSprite.Create(0, 0, 0, 0); | |
1013 | 5678 for (int i = 0; i < 22; ++i) |
1009 | 5679 { |
1013 | 5680 pActor->pActorBuffs[i].Reset(); |
1009 | 5681 } |
5682 } | |
890 | 5683 LODWORD(v727) = 1; |
5684 break; | |
5685 } | |
1009 | 5686 case SPELL_LIGHT_SUMMON_ELEMENTAL: |
993 | 5687 { |
1009 | 5688 switch (v731) |
5689 { | |
5690 case 1: v733 = 300 * v2; amount = 1; break; | |
5691 case 2: v733 = 300 * v2; amount = 1; break; | |
5692 case 3: v733 = 900 * v2; amount = 3; break; | |
5693 case 4: v733 = 900 * v2; amount = 5; break; | |
5694 default: | |
5695 assert(false); | |
5696 } | |
5697 //v733 = __PAIR__(0, v516); | |
1013 | 5698 signed int _v733 = 0; |
1009 | 5699 if ( (signed int)uNumActors > 0 ) |
5700 { | |
5701 v518 = pActors;//[0].uAIState; | |
5702 auto _v726 = uNumActors; | |
5703 do | |
5704 { | |
5705 v519 = v518->uAIState; | |
5706 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) | |
1013 | 5707 ++_v733; |
1009 | 5708 ++v518; |
5709 --_v726; | |
5710 } | |
5711 while ( _v726 != 0 ); | |
5712 } | |
1013 | 5713 if ( _v733 >= amount ) |
1009 | 5714 { |
5715 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
5716 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5717 pCastSpell->spellnum = 0; | |
5718 continue; | |
5719 } | |
5720 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5721 break; | |
5722 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); | |
5723 LODWORD(v727) = 1; | |
5724 break; | |
993 | 5725 } |
1009 | 5726 case SPELL_LIGHT_DAY_OF_THE_GODS: |
993 | 5727 { |
1009 | 5728 switch (v731) |
5729 { | |
5730 case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break; | |
5731 case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break; | |
5732 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break; | |
5733 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break; | |
5734 default: | |
5735 assert(false); | |
5736 } | |
5737 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5738 break; | |
5739 | |
924 | 5740 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5741 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5742 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5743 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 5744 |
1009 | 5745 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); |
5746 LODWORD(v727) = 1; | |
5747 break; | |
890 | 5748 } |
1009 | 5749 case SPELL_LIGHT_PRISMATIC_LIGHT: |
890 | 5750 { |
1009 | 5751 //v67 = 2; |
5752 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
5753 { | |
5754 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
5755 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5756 pCastSpell->spellnum = 0; | |
5757 continue; | |
5758 } | |
5759 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5760 break; | |
5761 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5762 ++pSpellSprite.uType; | |
5763 v694.x = 0; | |
5764 v694.y = 0; | |
5765 v694.z = 0; | |
5766 pSpellSprite.stru_24.Reset(); | |
5767 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5768 pSpellSprite.spell_level = v2; | |
5769 pSpellSprite.spell_skill = v731; | |
5770 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5771 pSpellSprite.uAttributes = 0; | |
5772 pSpellSprite.uSectorID = 0; | |
5773 pSpellSprite.uSpriteFrameID = 0; | |
5774 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5775 pSpellSprite.uFacing = 0; | |
5776 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5777 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5778 a2 = 0; | |
5779 if ( (signed int)v531 > 0 ) | |
5780 { | |
5781 do | |
5782 { | |
5783 v533 = dword_50BF30[a2]; | |
5784 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; | |
5785 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
5786 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
5787 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5788 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
5789 v536 = a2; | |
5790 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
5791 a2 = v536 + 1; | |
5792 } | |
5793 while ( v536 + 1 < (signed int)v531 ); | |
5794 } | |
5795 v537 = pGame->GetStru6(); | |
5796 pGame->GetStru6()->_4A8BFC(); | |
890 | 5797 LODWORD(v727) = 1; |
5798 break; | |
5799 } | |
1009 | 5800 case SPELL_LIGHT_DAY_OF_PROTECTION: |
890 | 5801 { |
1009 | 5802 switch (v731) |
5803 { | |
5804 case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5805 case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5806 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5807 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break; | |
5808 default: | |
5809 assert(false); | |
5810 } | |
5811 v730 = LODWORD(v733); | |
5812 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5813 break; | |
5814 | |
5815 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5816 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5817 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5818 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5819 | |
5820 v732 = v730 << 7; | |
5821 v549 = (double)(v730 << 7) * 0.033333335; | |
5822 *((float *)&v733 + 1) = v549; | |
5823 v712 = (signed __int64)v549; | |
5824 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
5825 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5826 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5827 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5828 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5829 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5830 v550 = v2 + 5; | |
5831 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
5832 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
5833 v731, | |
5834 v550, 0, 0); | |
5835 | |
5836 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
890 | 5837 LODWORD(v727) = 1; |
5838 break; | |
5839 } | |
1009 | 5840 case SPELL_LIGHT_HOUR_OF_POWER: |
993 | 5841 { |
1009 | 5842 switch (v731) |
5843 { | |
5844 case 1: LODWORD(v733) = 4; amount = 4; break; | |
5845 case 2: LODWORD(v733) = 4; amount = 4; break; | |
5846 case 3: LODWORD(v733) = 12; amount = 12; break; | |
5847 case 4: LODWORD(v733) = 20; amount = 15; break; | |
5848 default: | |
5849 assert(false); | |
5850 } | |
993 | 5851 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5852 break; | |
1013 | 5853 y = (char *)(60 * (v2 * LODWORD(v733) + 60)); |
1009 | 5854 v732 = (300 * amount * v2 + 60) << 7; |
5855 v730 = v2 + 5; | |
5856 int _v726 = 0; | |
5857 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
1013 | 5858 *((float *)&v733) = (double)v732 * 0.033333335; |
1009 | 5859 do |
5860 { | |
5861 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5862 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5863 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5864 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5865 | |
5866 //((SpellBuff *)(v553 + 6056))->Apply( | |
1013 | 5867 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0); |
1009 | 5868 if ( *(_QWORD *)v553 ) |
5869 _v726 = 1; | |
5870 ++v553; | |
5871 } | |
5872 while ( v553 <= &pParty->pPlayers[3] ); | |
5873 v562 = v731; | |
1013 | 5874 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0); |
5875 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, 0, 0, 0); | |
5876 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, v730, 0, 0); | |
1009 | 5877 if (!_v726) |
5878 { | |
5879 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); | |
5880 } | |
5881 LODWORD(v727) = 1; | |
5882 break; | |
5883 } | |
5884 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
5885 { | |
5886 amount = 3; | |
5887 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
993 | 5888 { |
5889 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5890 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5891 pCastSpell->spellnum = 0; | |
5892 continue; | |
5893 } | |
1009 | 5894 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5895 break; | |
5896 a2 = 0; | |
5897 _this = (ItemGen *)&pPlayers[1]; | |
5898 do | |
5899 { | |
5900 v563 = 0; | |
5901 do | |
5902 { | |
5903 v564 = _this->uItemID; | |
5904 *(int *)(v563 + _this->uItemID) = 0; | |
5905 v563 += 8; | |
5906 *(int *)(v563 + v564 - 4) = 0; | |
5907 } | |
5908 while ( v563 <= 128 ); | |
5909 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
5910 v566 = (Player **)_this; | |
5911 *(int *)(_this->uItemID + 6460) = v565; | |
5912 v567 = (*v566)->GetMaxMana(); | |
5913 *(int *)(_this->uItemID + 6464) = v567; | |
5914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); | |
5915 ++a2; | |
5916 _this = (ItemGen *)((char *)_this + 4); | |
5917 } | |
5918 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
5919 v571 = pPlayer; | |
5920 v572 = (char *)&pPlayer->sAgeModifier; | |
5921 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
5922 *(short *)v572 = 120; | |
5923 else | |
5924 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
5925 sRecoveryTime += -5 * v2; | |
5926 ++v571->uNumDivineInterventionCastsThisDay; | |
5927 LODWORD(v727) = 1; | |
5928 break; | |
5929 } | |
5930 case SPELL_DARK_REANIMATE: | |
5931 { | |
5932 switch (v731) | |
5933 { | |
5934 case 1: amount = 2 * v2; break; | |
5935 case 2: amount = 3 * v2; break; | |
5936 case 3: amount = 4 * v2; break; | |
5937 case 4: amount = 5 * v2; break; | |
5938 default: | |
5939 assert(false); | |
5940 } | |
5941 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5942 break; | |
5943 v576 = pCastSpell->spell_target_pid; | |
5944 if (!v576) | |
5945 { | |
5946 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5947 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5948 if ( *((_QWORD *)v585 + 14) ) | |
5949 { | |
5950 ((Player *)v585)->SetCondition(0x11u, 1); | |
5951 v587 = ((Player *)v585)->GetSexByVoice(); | |
5952 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); | |
5953 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
5954 } | |
5955 break; | |
5956 } | |
5957 v577 = (Player *)(PID_ID(v576)); | |
5958 //v726 = v577; | |
5959 if ( v577 == (Player *)-1 ) | |
5960 { | |
5961 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
5962 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5963 pCastSpell->spellnum = 0; | |
5964 continue; | |
5965 } | |
5966 v578 = (int)&pActors[(int)v577]; | |
5967 v721 = v578; | |
5968 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
5969 { | |
5970 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5971 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5972 pCastSpell->spellnum = 0; | |
5973 continue; | |
5974 } | |
5975 ++pSpellSprite.uType; | |
5976 pSpellSprite.stru_24.Reset(); | |
5977 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5978 pSpellSprite.spell_level = v2; | |
5979 pSpellSprite.spell_skill = v731; | |
5980 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5981 pSpellSprite.uAttributes = 0; | |
5982 pSpellSprite.uSectorID = 0; | |
5983 pSpellSprite.uSpriteFrameID = 0; | |
5984 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5985 v581 = v721; | |
5986 pSpellSprite.uFacing = 0; | |
5987 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5988 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5989 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
5990 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
5991 v732 = *(short *)(v721 + 138); | |
5992 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | |
5993 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
5994 pSpellSprite.Create(0, 0, 0, 0); | |
5995 if ( *(char *)(v581 + 52) > amount ) | |
5996 break; | |
5997 Actor::Resurrect((unsigned int)v577); | |
5998 *(char *)(v581 + 61) = 0; | |
5999 *(char *)(v581 + 53) = 0; | |
6000 *(char *)(v581 + 54) = 0; | |
6001 *(char *)(v581 + 55) = 0; | |
6002 *(char *)(v581 + 56) = 0; | |
6003 *(char *)(v581 + 57) = 0; | |
6004 *(int *)(v581 + 712) = 9999; | |
6005 *(char *)(v581 + 38) &= 0xF7u; | |
6006 *(int *)(v581 + 708) = 0; | |
6007 ((SpellBuff *)(v581 + 356))->Reset(); | |
6008 ((SpellBuff *)(v581 + 228))->Reset(); | |
6009 ((SpellBuff *)(v581 + 404))->Reset(); | |
6010 if ( *(short *)(v581 + 40) > 10 * amount ) | |
6011 *(short *)(v581 + 40) = 10 * amount; | |
6012 LODWORD(v727) = 1; | |
6013 break; | |
6014 } | |
6015 case SPELL_DARK_VAMPIRIC_WEAPON: | |
6016 { | |
6017 amount = 16; | |
6018 if ( v731 == 4 ) | |
6019 { | |
6020 LODWORD(v733) = 0; | |
6021 } | |
6022 else | |
6023 { | |
6024 LODWORD(v733) = 3600 * v2; | |
6025 } | |
6026 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6027 break; | |
6028 __debugbreak(); | |
1013 | 6029 //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
6030 ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; | |
6031 ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; | |
6032 _v733->UpdateTempBonus(pParty->uTimePlayed); | |
6033 if ( _v733->uItemID >= 64 && _v733->uItemID <= 65 | |
6034 || LOBYTE(_v733->uAttributes) & 2 | |
6035 || _v733->uSpecEnchantmentType != 0 | |
6036 || _v733->uEnchantmentType != 0 | |
6037 || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2 | |
6038 || pItemsTable->IsMaterialNonCommon(_v733) ) | |
1009 | 6039 { |
6040 dword_50C9D0 = 113; | |
6041 dword_50C9D4 = 0; | |
6042 dword_50C9D8 = 1; | |
6043 | |
6044 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6045 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6046 pCastSpell->spellnum = 0; | |
6047 continue; | |
6048 } | |
1013 | 6049 v592 = _v733; |
1009 | 6050 v14 = v731 == 4; |
1013 | 6051 _v733->uSpecEnchantmentType = 16; |
1009 | 6052 if ( !v14 ) |
6053 { | |
6054 v732 = (int)v733 << 7; | |
1013 | 6055 v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
6056 v592->uAttributes |= 8u; | |
6057 } | |
6058 LOBYTE(v592->uAttributes) |= 0x80u; | |
1009 | 6059 _50C9A8_item_enchantment_timer = 256; |
6060 LODWORD(v727) = 1; | |
6061 break; | |
6062 } | |
6063 case SPELL_DARK_SHARPMETAL: | |
6064 { | |
6065 switch (v731) | |
6066 { | |
6067 case 1: amount = 5; break; | |
6068 case 2: amount = 5; break; | |
6069 case 3: amount = 7; break; | |
6070 case 4: amount = 9; break; | |
6071 default: | |
6072 assert(false); | |
6073 } | |
6074 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6075 break; | |
6076 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
6077 pSpellSprite.stru_24.Reset(); | |
6078 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6079 pSpellSprite.spell_level = v2; | |
6080 pSpellSprite.spell_skill = v731; | |
6081 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6082 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
6083 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
6084 pSpellSprite.uAttributes = 0; | |
6085 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
6086 pSpellSprite.uSectorID = pIndoor->GetSector( | |
6087 pParty->vPosition.x, | |
6088 pParty->vPosition.y, | |
6089 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
6090 pSpellSprite.uSpriteFrameID = 0; | |
6091 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6092 pSpellSprite.spell_target_pid = a2; | |
6093 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6094 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6095 if ( pParty->bTurnBasedModeOn == 1 ) | |
6096 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
6097 v596 = (signed int)_v726 / -2; | |
6098 y = (char *)((signed int)_v726 / 2); | |
6099 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
6100 { | |
6101 v597 = v715.uYawAngle; | |
6102 do | |
6103 { | |
6104 pSpellSprite.uFacing = v596 + v597; | |
6105 if ( pSpellSprite.Create( | |
6106 v596 + v597, | |
6107 v715.uPitchAngle, | |
6108 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
6109 pCastSpell->uPlayerID + 1) != -1 | |
6110 && pParty->bTurnBasedModeOn == 1 ) | |
6111 ++pTurnEngine->field_1C; | |
6112 v596 += _v726 / (amount - 1); | |
6113 } | |
6114 while ( v596 <= (signed int)y ); | |
6115 } | |
6116 LODWORD(v727) = 1; | |
6117 break; | |
6118 } | |
6119 case SPELL_DARK_CONTROL_UNDEAD: | |
6120 { | |
6121 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6122 break; | |
6123 switch (v731) | |
6124 { | |
6125 case 1: LODWORD(v733) = 180 * v2; break; | |
6126 case 2: LODWORD(v733) = 180 * v2; break; | |
6127 case 3: LODWORD(v733) = 300 * v2; break; | |
6128 case 4: LODWORD(v733) = 29030400; break; | |
6129 default: | |
6130 assert(false); | |
6131 } | |
6132 if (PID_TYPE(a2) != OBJECT_Actor) | |
6133 { | |
6134 LODWORD(v727) = 1; | |
6135 break; | |
6136 } | |
6137 pActor = &pActors[PID_ID(a2)]; | |
6138 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6139 break; | |
6140 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) ) | |
6141 { | |
6142 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6143 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6144 pCastSpell->spellnum = 0; | |
6145 continue; | |
6146 } | |
6147 pActor->pActorBuffs[9].Reset(); | |
6148 pActor->pActorBuffs[1].Reset(); | |
6149 pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
993 | 6150 v731, 0, 0, 0); |
6151 pSpellSprite.stru_24.Reset(); | |
6152 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6153 pSpellSprite.spell_level = v2; | |
6154 pSpellSprite.spell_skill = v731; | |
6155 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1009 | 6156 |
6157 v600 = pActor->vPosition.y; | |
6158 v601 = pActor->vPosition.x; | |
993 | 6159 pSpellSprite.uObjectDescID = v60; |
6160 pSpellSprite.vPosition.x = v601; | |
1009 | 6161 v602 = pActor->uActorHeight; |
6162 v603 = pActor->vPosition.z; | |
993 | 6163 pSpellSprite.vPosition.y = v600; |
6164 v676 = v603 + v602; | |
6165 v665 = v600; | |
6166 pSpellSprite.vPosition.z = v603 + v602; | |
6167 v657 = v601; | |
6168 pSpellSprite.uAttributes = 0; | |
6169 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6170 pSpellSprite.uSpriteFrameID = 0; | |
6171 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6172 pSpellSprite.spell_target_pid = a2; | |
6173 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6174 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6175 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6176 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6177 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6178 LODWORD(v727) = 1; |
6179 break; | |
6180 } | |
6181 case SPELL_DARK_SACRIFICE: | |
993 | 6182 { |
6183 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6184 break; | |
1013 | 6185 int _v733 = 0; |
993 | 6186 memset(&achieved_awards, 0, 4000); |
1013 | 6187 int i = 0; |
1009 | 6188 pNPCData = pParty->pHirelings; |
889 | 6189 do |
6190 { | |
1009 | 6191 if ( pNPCData->pName != 0) |
993 | 6192 { |
1013 | 6193 v606 = _v733++; |
6194 achieved_awards[v606] = (AwardType)(i + 1); | |
993 | 6195 } |
1013 | 6196 ++i; |
1009 | 6197 ++pNPCData; |
6198 } | |
6199 while ( pNPCData <= &pParty->pHirelings[1] ); | |
1013 | 6200 i = 0; |
993 | 6201 if ( (signed int)pNPCStats->uNumNewNPCs > 0) |
6202 { | |
1009 | 6203 pNPCData = pNPCStats->pNewNPCData; |
993 | 6204 __debugbreak(); // data offset |
1013 | 6205 AwardType *_v734 = &achieved_awards[_v733]; |
993 | 6206 do |
6207 { | |
1009 | 6208 if ( pNPCData->uFlags & 0x80 |
6209 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName)) | |
6210 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) ) | |
993 | 6211 { |
1013 | 6212 v607 = _v734; |
6213 ++_v734; | |
6214 *v607 = (AwardType)(i + 3); | |
993 | 6215 } |
1013 | 6216 ++i; |
1009 | 6217 ++pNPCData; |
993 | 6218 } |
1013 | 6219 while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs ); |
993 | 6220 } |
6221 v608 = pCastSpell->uPlayerID_2; | |
6222 if ( v608 != 4 && v608 != 5 | |
6223 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
6224 || v609 >= 3 ) | |
6225 { | |
6226 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6227 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6228 pCastSpell->spellnum = 0; | |
6229 continue; | |
6230 } | |
6231 v610 = 76 * v609; | |
6232 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
6233 v611 = pIconsFrameTable->FindIcon("spell96"); | |
1009 | 6234 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); |
6235 pParty->pHirelings[v609-1].evt_B = pIconsFrameTable->GetIconAnimLength(v611); | |
6236 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
6237 pParty->pHirelings[v609-1].field_24 = 1; | |
6238 | |
993 | 6239 v612 = pParty->pPlayers; |
6240 do | |
6241 { | |
6242 v612->sHealth = v612->GetMaxHealth(); | |
6243 v612->sMana = v612->GetMaxMana(); | |
6244 ++v612; | |
6245 } | |
6246 while ( v612 <= &pParty->pPlayers[3] ); | |
6247 v613 = &pOutdoor->ddm; | |
6248 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
6249 v613 = &pIndoor->dlv; | |
6250 v613->uReputation += 15; | |
6251 if ( v613->uReputation > 10000 ) | |
6252 v613->uReputation = 10000; | |
890 | 6253 LODWORD(v727) = 1; |
6254 break; | |
6255 } | |
993 | 6256 case SPELL_DARK_PAIN_REFLECTION: |
6257 { | |
1009 | 6258 switch (v731) |
6259 { | |
6260 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
6261 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
6262 case 3: LODWORD(v733) = 300 * (v2 + 12); break; | |
6263 case 4: LODWORD(v733) = 900 * (v2 + 4); break; | |
6264 default: | |
6265 assert(false); | |
6266 } | |
6267 amount = v2 + 5; | |
993 | 6268 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6269 break; | |
6270 if ( v731 != 3 && v731 != 4 ) | |
6271 { | |
6272 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
1013 | 6273 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, amount, v716, 0); |
993 | 6274 LODWORD(v727) = 1; |
6275 break; | |
6276 } | |
6277 a2 = 0; | |
6278 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6279 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
889 | 6280 do |
6281 { | |
993 | 6282 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
6283 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
6284 ++a2; | |
6285 ++v619; | |
6286 } | |
6287 while ( v619 <= &pParty->pPlayers[3] ); | |
6288 LODWORD(v727) = 1; | |
6289 break; | |
6290 } | |
6291 case SPELL_DARK_SOULDRINKER: | |
6292 { | |
6293 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6294 break; | |
6295 pGame->GetIndoorCamera(); | |
6296 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
1013 | 6297 signed int _v733 = sub_46A6AC((int)dword_50BF30, 100, v623); |
993 | 6298 v707.x = 0; |
6299 v707.y = 0; | |
6300 v707.z = 0; | |
6301 pSpellSprite.stru_24.Reset(); | |
6302 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6303 pSpellSprite.spell_level = v2; | |
6304 pSpellSprite.spell_skill = v731; | |
6305 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6306 pSpellSprite.uAttributes = 0; | |
6307 pSpellSprite.uSectorID = 0; | |
6308 pSpellSprite.uSpriteFrameID = 0; | |
6309 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6310 pSpellSprite.uFacing = 0; | |
6311 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6312 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6313 a2 = 0; | |
6314 int _v726 = 0; | |
1013 | 6315 if ( _v733 > 0 ) |
6316 { | |
6317 _v726 = (_v733 * (7 * v2 + 25)); | |
993 | 6318 do |
6319 { | |
6320 v625 = dword_50BF30[a2]; | |
6321 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; | |
6322 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
6323 //v732 = pActors[v625].uActorHeight; | |
6324 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
6325 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6326 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
6327 v628 = a2; | |
6328 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
6329 a2 = v628 + 1; | |
6330 } | |
1013 | 6331 while ( v628 + 1 < _v733 ); |
993 | 6332 } |
6333 v730 = 0; | |
6334 v629 = 1; | |
890 | 6335 do |
6336 { | |
993 | 6337 v630 = pPlayers[v629]; |
6338 if ( !v630->pConditions[2] | |
6339 && !v630->pConditions[12] | |
6340 && !v630->pConditions[13] | |
6341 && !v630->pConditions[14] | |
6342 && !v630->pConditions[15] | |
6343 && !v630->pConditions[16] ) | |
6344 { | |
6345 v631 = v730++; | |
6346 v681[v631] = v629; | |
6347 } | |
6348 ++v629; | |
6349 } | |
6350 while ( v629 <= 4 ); | |
6351 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
1013 | 6352 _v733 = 0; |
993 | 6353 if ( v730 > 0 ) |
6354 { | |
6355 do | |
6356 { | |
6357 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
1013 | 6358 v726 = pPlayers[v681[_v733]]; |
993 | 6359 //v633 = pPlayers[v681[HIDWORD(v733)]]; |
6360 v726->sHealth += v732; | |
6361 //v726 = *(Player **)v632; | |
6362 //v634 = v726->GetMaxHealth(); | |
6363 if ( v726->sHealth > v726->GetMaxHealth()) | |
6364 v726->sHealth = v726->GetMaxHealth(); | |
1013 | 6365 v635 = _v733; |
993 | 6366 |
6367 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); | |
1013 | 6368 _v733 = v635 + 1; |
1009 | 6369 } |
6370 while ( v635 + 1 < v730 ); | |
993 | 6371 } |
6372 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
890 | 6373 LODWORD(v727) = 1; |
6374 break; | |
6375 } | |
6376 case SPELL_DARK_ARMAGEDDON: | |
6377 { | |
993 | 6378 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
6379 { | |
6380 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
6381 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6382 pCastSpell->spellnum = 0; | |
6383 continue; | |
6384 } | |
1009 | 6385 if ( v731 == 4) |
6386 amount = 4; | |
6387 else | |
993 | 6388 amount = 3; |
6389 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
6390 { | |
6391 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6392 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6393 pCastSpell->spellnum = 0; | |
6394 continue; | |
6395 } | |
6396 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6397 break; | |
6398 pParty->armageddon_timer = 256; | |
6399 pParty->field_16140 = v2; | |
6400 ++pPlayer->uNumArmageddonCasts; | |
6401 if ( pParty->bTurnBasedModeOn == 1 ) | |
6402 ++pTurnEngine->field_1C; | |
6403 auto _v726 = 50; | |
6404 do | |
6405 { | |
6406 v642 = rand() % 4096 - 2048; | |
6407 v643 = rand(); | |
6408 v721 = v642 + pParty->vPosition.x; | |
6409 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
6410 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
6411 v644 = rand(); | |
6412 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
6413 --_v726; | |
6414 } | |
6415 while ( _v726 != 0 ); | |
890 | 6416 LODWORD(v727) = 1; |
6417 break; | |
6418 } | |
6419 | |
6420 default: | |
993 | 6421 break; |
890 | 6422 } |
924 | 6423 if ( pCastSpell->field_8 & 0x20 ) |
890 | 6424 { |
6425 if ( v727 != 0.0 ) | |
924 | 6426 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 6427 } |
6428 else | |
6429 { | |
6430 if ( sRecoveryTime < 0 ) | |
6431 sRecoveryTime = 0; | |
6432 if ( pParty->bTurnBasedModeOn ) | |
6433 { | |
6434 v645 = sRecoveryTime; | |
924 | 6435 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 6436 pPlayer->SetRecoveryTime(v645); |
6437 if ( !some_active_character ) | |
6438 pTurnEngine->_40471C(); | |
6439 } | |
6440 else | |
6441 { | |
6442 pPlayer->SetRecoveryTime( | |
6443 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
6444 } | |
6445 if ( v727 != 0.0 ) | |
6446 { | |
6447 pPlayer->PlaySound(SPEECH_49, 0); | |
6448 if ( v727 != 0.0 ) | |
924 | 6449 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
889 | 6450 } |
6451 } | |
924 | 6452 pCastSpell->spellnum = 0; |
890 | 6453 v2 = v723; |
6454 continue; | |
0 | 6455 } |
488 | 6456 |
0 | 6457 } |
6458 //----- (0042EB42) -------------------------------------------------------- | |
6459 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
6460 { | |
6461 unsigned int v2; // edx@1 | |
6462 signed int v3; // eax@1 | |
6463 char *v4; // ecx@2 | |
6464 | |
6465 v2 = this->uNumObjects; | |
6466 v3 = 0; | |
6467 if ( (signed int)this->uNumObjects <= 0 ) | |
6468 { | |
6469 LABEL_5: | |
6470 LOWORD(v3) = 0; | |
6471 } | |
6472 else | |
6473 { | |
6474 v4 = (char *)&this->pObjects->uObjectID; | |
6475 while ( uItemID != *(short *)v4 ) | |
6476 { | |
6477 ++v3; | |
6478 v4 += 56; | |
6479 if ( v3 >= (signed int)v2 ) | |
6480 goto LABEL_5; | |
6481 } | |
6482 } | |
6483 return v3; | |
6484 } | |
6485 | |
6486 //----- (0042EB78) -------------------------------------------------------- | |
6487 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
6488 { | |
6489 return 8 * this->pIcons[uIconID].uAnimLength; | |
6490 } | |
6491 | |
437 | 6492 const wchar_t *UIMessage2String(UIMessageType msg) |
6493 { | |
6494 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
6495 static wchar_t b[256]; // bad for threads | |
6496 switch (msg) | |
6497 { | |
6498 CASE(UIMSG_SelectSpell) | |
6499 CASE(UIMSG_ChangeGameState) | |
6500 CASE(UIMSG_Attack) | |
6501 CASE(UIMSG_PlayArcomage) | |
6502 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
6503 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
6504 CASE(UIMSG_ShowCredits) | |
6505 CASE(UIMSG_ExitToWindows) | |
6506 CASE(UIMSG_PlayerCreationChangeName) | |
6507 CASE(UIMSG_PlayerCreationClickPlus) | |
6508 CASE(UIMSG_PlayerCreationClickMinus) | |
6509 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
6510 CASE(UIMSG_PlayerCreationSelectClass) | |
6511 CASE(UIMSG_PlayerCreationClickOK) | |
6512 CASE(UIMSG_PlayerCreationClickReset) | |
996 | 6513 CASE(UIMSG_ClickBooksBtn) |
437 | 6514 CASE(UIMSG_PlayerCreationRemoveUpSkill) |
6515 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
6516 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
6517 CASE(UIMSG_LoadGame) | |
6518 CASE(UIMSG_SaveGame) | |
6519 CASE(UIMSG_ShowStatus_DateTime) | |
6520 CASE(UIMSG_ShowStatus_ManaHP) | |
6521 CASE(UIMSG_ShowStatus_Player) | |
6522 CASE(UIMSG_Wait5Minutes) | |
6523 CASE(UIMSG_Wait1Hour) | |
6524 CASE(UIMSG_ShowStatus_Food) | |
6525 CASE(UIMSG_ShowStatus_Funds) | |
6526 CASE(UIMSG_QuickReference) | |
6527 CASE(UIMSG_GameMenuButton) | |
6528 CASE(UIMSG_AlreadyResting) | |
6529 CASE(UIMSG_SelectCharacter) | |
6530 CASE(UIMSG_ChangeSoundVolume) | |
6531 CASE(UIMSG_ChangeMusicVolume) | |
6532 CASE(UIMSG_Escape) | |
6533 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
6534 CASE(UIMSG_InventoryLeftClick) | |
6535 CASE(UIMSG_SkillUp) | |
6536 CASE(UIMSG_GameMenu_ReturnToGame) | |
6537 CASE(UIMSG_StartNewGame) | |
6538 CASE(UIMSG_Game_OpenLoadGameDialog) | |
6539 CASE(UIMSG_Game_OpenSaveGameDialog) | |
6540 CASE(UIMSG_Game_OpenOptionsDialog) | |
6541 CASE(UIMSG_SetGraphicsMode) | |
6542 CASE(UIMSG_Quit) | |
6543 CASE(UIMSG_StartHireling1Dialogue) | |
6544 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 6545 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 6546 CASE(UIMSG_CastSpellFromBook) |
6547 CASE(UIMSG_PlayerCreation_VoicePrev) | |
6548 CASE(UIMSG_PlayerCreation_VoiceNext) | |
6549 CASE(UIMSG_StartNPCDialogue) | |
6550 CASE(UIMSG_ArrowUp) | |
6551 CASE(UIMSG_DownArrow) | |
961 | 6552 CASE(UIMSG_SaveLoadBtn) |
437 | 6553 CASE(UIMSG_SelectLoadSlot) |
6554 CASE(UIMSG_Cancel) | |
6555 CASE(UIMSG_ExitRest) | |
6556 CASE(UIMSG_PlayerCreation_FacePrev) | |
6557 CASE(UIMSG_PlayerCreation_FaceNext) | |
6558 CASE(UIMSG_CycleCharacters) | |
6559 CASE(UIMSG_SetTurnSpeed) | |
6560 CASE(UIMSG_ToggleWalkSound) | |
6561 CASE(UIMSG_ChangeVoiceVolume) | |
6562 CASE(UIMSG_ToggleShowDamage) | |
6563 CASE(UIMSG_ScrollNPCPanel) | |
6564 CASE(UIMSG_ShowFinalWindow) | |
6565 CASE(UIMSG_OpenQuestBook) | |
6566 CASE(UIMSG_OpenAutonotes) | |
6567 CASE(UIMSG_OpenMapBook) | |
6568 CASE(UIMSG_OpenCalendar) | |
6569 CASE(UIMSG_OpenHistoryBook) | |
6570 CASE(UIMSG_ToggleAlwaysRun) | |
6571 CASE(UIMSG_ToggleFlipOnExit) | |
6572 CASE(UIMSG_Game_Action) | |
907 | 6573 CASE(UIMSG_RentRoom) |
437 | 6574 CASE(UIMSG_TransitionUI_Confirm) |
6575 CASE(UIMSG_OpenKeyMappingOptions) | |
6576 CASE(UIMSG_SelectKeyPage1) | |
6577 CASE(UIMSG_SelectKeyPage2) | |
6578 CASE(UIMSG_ResetKeyMapping) | |
6579 CASE(UIMSG_ChangeKeyButton) | |
6580 CASE(UIMSG_OpenVideoOptions) | |
6581 CASE(UIMSG_ToggleBloodsplats) | |
6582 CASE(UIMSG_ToggleColoredLights) | |
6583 CASE(UIMSG_ToggleTint) | |
6584 default: | |
6585 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
6586 }; | |
6587 #undef CASE | |
6588 } | |
6589 | |
0 | 6590 //----- (0042EB8D) -------------------------------------------------------- |
437 | 6591 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 6592 { |
482 | 6593 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 6594 if (uNumMessages < 40) |
6595 { | |
437 | 6596 files[uNumMessages] = file; |
6597 lines[uNumMessages] = line; | |
6598 | |
0 | 6599 pMessages[uNumMessages].eType = msg; |
6600 pMessages[uNumMessages].param = param; | |
6601 pMessages[uNumMessages++].field_8 = a4; | |
6602 } | |
6603 } | |
6604 | |
6605 //----- (0042EBBE) -------------------------------------------------------- | |
6606 int __fastcall sub_42EBBE(int a1, int a2) | |
6607 { | |
6608 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
6609 } | |
6610 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
6611 | |
6612 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 6613 int stru193_math::Sin(int angle) |
0 | 6614 { |
323 | 6615 return Cos(angle - this->uIntegerHalfPi); |
0 | 6616 } |
6617 | |
6618 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 6619 void _42ECB5_PlayerAttacksActor() |
0 | 6620 { |
271 | 6621 //unsigned int v0; // ebx@1 |
6622 //Player *v1; // esi@1 | |
6623 //bool result; // eax@1 | |
295 | 6624 //int v3; // edi@2 |
271 | 6625 //unsigned int v4; // eax@7 |
0 | 6626 char *v5; // eax@8 |
271 | 6627 //int v6; // ecx@9 |
6628 //signed int v7; // eax@16 | |
295 | 6629 //Actor *v8; // edi@20 |
0 | 6630 unsigned int v9; // ecx@21 |
295 | 6631 //char *v10; // eax@26 |
0 | 6632 char *v11; // eax@26 |
6633 unsigned int v12; // eax@47 | |
295 | 6634 //char *v13; // eax@47 |
6635 //char *v14; // eax@47 | |
6636 //unsigned int v15; // ebx@54 | |
6637 //int v16; // [sp-10h] [bp-4Ch]@24 | |
6638 //int v17; // [sp-10h] [bp-4Ch]@44 | |
6639 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
6640 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
6641 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
6642 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
6643 //int v22; // [sp-4h] [bp-40h]@24 | |
6644 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 6645 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 6646 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 6647 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
6648 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 6649 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 6650 //unsigned int *v28b; |
295 | 6651 //int v29; // [sp+24h] [bp-18h]@16 |
6652 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 6653 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 6654 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 6655 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 6656 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 6657 |
271 | 6658 //v0 = uActiveCharacter; |
6659 //v27 = 6972 * uActiveCharacter; | |
6660 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
6661 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
6662 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
6663 if (!player->CanAct()) | |
6664 return; | |
6665 | |
924 | 6666 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 6667 //v3 = 0; |
271 | 6668 if (pParty->Invisible()) |
6669 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
6670 | |
6671 //v31 = player->pEquipment.uBow; | |
6672 int bow_idx = player->pEquipment.uBow; | |
6673 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
6674 bow_idx = 0; | |
6675 | |
295 | 6676 //v32 = 0; |
6677 int wand_item_id = 0; | |
271 | 6678 //v33 = 0; |
6679 //v4 = v1->pEquipment.uMainHand; | |
6680 int laser_weapon_item_id = 0; | |
6681 | |
6682 int main_hand_idx = player->pEquipment.uMainHand; | |
6683 if (main_hand_idx) | |
0 | 6684 { |
271 | 6685 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 6686 //v5 = (char *)v1 + 36 * v4; |
271 | 6687 if (!item->Broken()) |
6688 { | |
6689 //v28b = &v1->pInventoryItems[v4].uItemID; | |
6690 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 6691 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 6692 { |
295 | 6693 if (item->uNumCharges <= 0) |
6694 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 6695 else |
295 | 6696 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 6697 } |
271 | 6698 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
6699 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 6700 } |
271 | 6701 } |
6702 | |
295 | 6703 //v30 = 0; |
6704 //v29 = 0; | |
6705 //v28 = 0; | |
271 | 6706 //v7 = pMouse->uPointingObjectID; |
6707 | |
6708 int target_pid = pMouse->uPointingObjectID; | |
848 | 6709 int target_type = PID_TYPE(target_pid), |
6710 target_id = PID_ID(target_pid); | |
271 | 6711 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
6712 { | |
6713 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 6714 target_type = PID_TYPE(target_pid); |
6715 target_id = PID_ID(target_pid); | |
271 | 6716 } |
295 | 6717 |
6718 auto actor = &pActors[target_id]; | |
6719 int actor_distance = 0; | |
271 | 6720 if (target_type == OBJECT_Actor) |
6721 { | |
295 | 6722 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
6723 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
6724 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
6725 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
6726 if (actor_distance < 0) | |
6727 actor_distance = 0; | |
6728 } | |
6729 | |
6730 bool shooting_bow = false, | |
6731 shotting_laser = false, | |
816 | 6732 shooting_wand = false, |
6733 melee_attack = false; | |
295 | 6734 if (laser_weapon_item_id) |
6735 { | |
6736 shotting_laser = true; | |
490 | 6737 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 6738 } |
6739 else if (wand_item_id) | |
6740 { | |
6741 shooting_wand = true; | |
6742 | |
6743 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 6744 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 6745 |
6746 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
6747 player->pEquipment.uMainHand = 0; | |
6748 } | |
303 | 6749 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 6750 { |
816 | 6751 melee_attack = true; |
6752 | |
303 | 6753 Vec3_int_ a3; |
6754 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
6755 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
6756 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
6757 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
6758 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6759 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 6760 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 6761 _42FA66_do_explosive_impact( |
6762 actor->vPosition.x, | |
6763 actor->vPosition.y, | |
6764 actor->vPosition.z + actor->uActorHeight / 2, | |
6765 0, 512, uActiveCharacter); | |
303 | 6766 } |
6767 else if (bow_idx) | |
6768 { | |
6769 shooting_bow = true; | |
490 | 6770 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 6771 } |
6772 else | |
6773 { | |
816 | 6774 melee_attack = true; |
303 | 6775 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
6776 } | |
6777 | |
816 | 6778 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 6779 { |
816 | 6780 int recovery = player->GetAttackRecoveryTime(false); |
303 | 6781 if (recovery < 30 ) |
6782 recovery = 30; | |
816 | 6783 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 6784 } |
6785 | |
6786 | |
6787 int v34 = 0; | |
6788 if (shooting_wand) | |
6789 return; | |
6790 else if (shooting_bow) | |
6791 { | |
6792 v34 = 5; | |
6793 player->PlaySound(SPEECH_50, 0); | |
6794 } | |
6795 if (shotting_laser) | |
6796 v34 = 7; | |
6797 else | |
6798 { | |
6799 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 6800 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 6801 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
6802 pTurnEngine->_40471C(); | |
6803 } | |
6804 | |
6805 switch (v34) | |
6806 { | |
6807 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
6808 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
6809 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
6810 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
6811 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
6812 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
6813 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
6814 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
6815 } | |
0 | 6816 } |
6817 | |
6818 //----- (0042F184) -------------------------------------------------------- | |
295 | 6819 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 6820 { |
6821 int v4; // edi@1 | |
6822 stru319 *v5; // esi@1 | |
6823 int v6; // eax@2 | |
6824 int v7; // eax@4 | |
6825 int result; // eax@5 | |
6826 int *v9; // edx@8 | |
6827 signed int v10; // ebx@10 | |
6828 int v11; // edi@11 | |
6829 Actor *v12; // esi@12 | |
6830 unsigned __int16 v13; // ax@12 | |
6831 int v14; // eax@22 | |
6832 char v15; // zf@30 | |
6833 int v16; // esi@32 | |
6834 int v17; // ecx@34 | |
6835 stru319 *v18; // eax@39 | |
6836 int v19; // edx@39 | |
6837 int v20; // ecx@41 | |
6838 unsigned __int16 v21; // ax@42 | |
6839 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
6840 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
6841 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
6842 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
6843 int *v26; // [sp+18h] [bp-14h]@8 | |
6844 int v27; // [sp+1Ch] [bp-10h]@10 | |
6845 int *v28; // [sp+20h] [bp-Ch]@10 | |
6846 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
6847 int v30; // [sp+28h] [bp-4h]@6 | |
6848 int i; // [sp+38h] [bp+Ch]@33 | |
6849 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
6850 | |
6851 v4 = 0; | |
6852 v5 = this; | |
6853 v24 = this; | |
6854 if ( pRenderer->pRenderD3D ) | |
6855 { | |
6856 v6 = a3 != 0; | |
6857 if ( a4 ) | |
6858 LOBYTE(v6) = v6 | 8; | |
295 | 6859 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 6860 if ( v7 != -1 ) |
6861 return (unsigned __int16)v7; | |
295 | 6862 else return 0; |
0 | 6863 } |
6864 else | |
6865 { | |
6866 v30 = 0; | |
6867 if ( pRenderer->pActiveZBuffer ) | |
6868 { | |
692 | 6869 v29 = viewparams->uScreen_topL_X; |
6870 v23 = viewparams->uScreen_BttmR_X; | |
6871 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 6872 { |
692 | 6873 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
6874 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
6875 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 6876 do |
6877 { | |
6878 if ( (signed int)v29 < (signed int)v23 ) | |
6879 { | |
6880 v28 = v9; | |
6881 v10 = v4; | |
6882 v27 = v23 - v29; | |
6883 do | |
6884 { | |
6885 v22 = *v28; | |
6886 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6887 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 6888 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6889 v12 = &pActors[PID_ID(v11)]; |
0 | 6890 v13 = v12->uAIState; |
6891 if ( v13 != 5 ) | |
6892 { | |
6893 if ( v13 != 4 | |
6894 && v13 != 11 | |
6895 && v13 != 19 | |
6896 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6897 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 6898 { |
6899 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 6900 && v22 <= pick_depth << 16 ) |
0 | 6901 { |
6902 v14 = 0; | |
6903 if ( v10 > 0 ) | |
6904 { | |
6905 do | |
6906 { | |
6907 if ( dword_50BDA0[v14] == v11 ) | |
6908 break; | |
6909 ++v14; | |
6910 } | |
6911 while ( v14 < v30 ); | |
6912 } | |
6913 if ( v14 == v30 && v10 < 100 ) | |
6914 { | |
6915 ++v30; | |
6916 dword_50BC10[v10] = v22; | |
6917 dword_50BDA0[v10] = v11; | |
6918 ++v10; | |
6919 } | |
6920 } | |
6921 } | |
6922 } | |
6923 } | |
6924 ++v28; | |
6925 --v27; | |
6926 } | |
6927 while ( v27 ); | |
6928 v4 = v30; | |
6929 v5 = v24; | |
6930 } | |
6931 v9 = v26 + 640; | |
6932 v15 = v25-- == 1; | |
6933 v26 += 640; | |
6934 } | |
6935 while ( !v15 ); | |
6936 } | |
6937 if ( v4 > 0 ) | |
6938 { | |
6939 v32 = 1; | |
6940 v16 = (int)dword_50BC10; | |
6941 do | |
6942 { | |
6943 for ( i = v32; i < v4; ++i ) | |
6944 { | |
6945 v17 = dword_50BC10[i]; | |
6946 if ( v17 < *(int *)v16 ) | |
6947 { | |
6948 dword_50BC10[i] = *(int *)v16; | |
6949 *(int *)v16 = v17; | |
6950 } | |
6951 } | |
6952 ++v32; | |
6953 v16 += 4; | |
6954 } | |
6955 while ( v32 - 1 < v4 ); | |
6956 v5 = v24; | |
6957 if ( v4 > 0 ) | |
6958 { | |
6959 v18 = v24; | |
6960 v19 = v4; | |
6961 do | |
6962 { | |
6963 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
6964 v18 += 4; | |
6965 --v19; | |
6966 } | |
6967 while ( v19 ); | |
6968 } | |
6969 } | |
6970 v20 = 0; | |
6971 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
6972 { | |
6973 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
6974 if ( v21 != 4 && v21 != 5 ) | |
6975 break; | |
6976 } | |
6977 if ( v20 != v4 ) | |
6978 { | |
6979 result = 8 * *(int *)&v5[4 * v20].field_0; | |
6980 LOBYTE(result) = result | 3; | |
6981 return result; | |
6982 } | |
6983 } | |
6984 } | |
6985 return 0; | |
6986 } | |
6987 | |
6988 //----- (0042F3D6) -------------------------------------------------------- | |
6989 void InitializeTurnBasedAnimations(void *_this) | |
6990 { | |
6991 unsigned int *v1; // edi@1 | |
6992 | |
6993 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
6994 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
6995 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
6996 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
6997 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
6998 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
6999 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
7000 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
7001 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
7002 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
7003 v1 = pIconIDs_Turn; | |
7004 do | |
7005 { | |
7006 pIconsFrameTable->InitializeAnimation(*v1); | |
7007 ++v1; | |
7008 } | |
7009 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
7010 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
7011 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
7012 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
7013 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
7014 } | |
7015 | |
7016 //----- (0042F4DA) -------------------------------------------------------- | |
7017 signed int __cdecl sub_42F4DA() | |
7018 { | |
7019 signed int v0; // edi@1 | |
82 | 7020 Actor *v1; // esi@4 |
0 | 7021 int v2; // ebx@5 |
7022 int v3; // eax@5 | |
7023 int v4; // ebx@5 | |
7024 unsigned int v5; // ecx@5 | |
7025 int v6; // edx@6 | |
7026 unsigned int v7; // edx@8 | |
7027 unsigned int v8; // edx@10 | |
7028 __int16 v9; // ax@12 | |
7029 signed int result; // eax@20 | |
7030 int v11; // [sp+Ch] [bp-10h]@5 | |
7031 int v12; // [sp+10h] [bp-Ch]@5 | |
7032 signed int v13; // [sp+14h] [bp-8h]@3 | |
7033 | |
7034 v0 = 5120; | |
7035 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7036 v0 = 2560; | |
7037 v13 = 0; | |
7038 if ( (signed int)uNumActors <= 0 ) | |
7039 { | |
7040 LABEL_20: | |
7041 result = 0; | |
7042 } | |
7043 else | |
7044 { | |
82 | 7045 v1 = pActors; |
0 | 7046 while ( 1 ) |
7047 { | |
82 | 7048 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
7049 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
7050 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 7051 v3 = v2; |
7052 v4 = v11; | |
7053 v5 = v12; | |
7054 if ( v3 < v11 ) | |
7055 { | |
7056 v6 = v3; | |
7057 v3 = v11; | |
7058 v4 = v6; | |
7059 } | |
7060 if ( v3 < v12 ) | |
7061 { | |
7062 v7 = v3; | |
7063 v3 = v12; | |
7064 v5 = v7; | |
7065 } | |
7066 if ( v4 < (signed int)v5 ) | |
7067 { | |
7068 v8 = v5; | |
7069 v5 = v4; | |
7070 v4 = v8; | |
7071 } | |
7072 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
7073 { | |
82 | 7074 v9 = v1->uAIState; |
7075 if ( v1->uAIState != 5 ) | |
0 | 7076 { |
7077 if ( v9 != 4 | |
7078 && v9 != 11 | |
7079 && v9 != 19 | |
7080 && v9 != 17 | |
82 | 7081 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 7082 break; |
7083 } | |
7084 } | |
7085 ++v13; | |
82 | 7086 ++v1; |
0 | 7087 if ( v13 >= (signed int)uNumActors ) |
7088 goto LABEL_20; | |
7089 } | |
7090 result = 1; | |
7091 } | |
7092 return result; | |
7093 } | |
7094 | |
7095 //----- (0042F7EB) -------------------------------------------------------- | |
7096 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) | |
7097 { | |
7098 unsigned int v9; // edi@1 | |
7099 signed int v10; // edx@3 | |
7100 char *v11; // ecx@4 | |
7101 unsigned __int16 v12; // ax@7 | |
7102 unsigned int v13; // edx@9 | |
7103 char *v14; // ecx@10 | |
7104 int v15; // esi@17 | |
7105 int v16; // eax@18 | |
7106 int v17; // edi@20 | |
7107 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7108 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 7109 int v21; // [sp+7Ch] [bp-8h]@1 |
7110 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
7111 | |
7112 v9 = uSpriteID; | |
7113 v21 = x; | |
7114 v22 = uSpriteID; | |
7115 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7116 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
|
7117 //SpriteObject::SpriteObject(&a1a); |
0 | 7118 a1a.stru_24.Reset(); |
7119 | |
7120 if ( a9 ) | |
7121 { | |
7122 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
7123 v9 = v22; | |
7124 } | |
7125 v10 = 0; | |
822 | 7126 a1a.spell_skill = 0; |
7127 a1a.spell_level = 0; | |
7128 a1a.spell_id = 0; | |
0 | 7129 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7130 a1a.uType = v9; |
0 | 7131 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
7132 { | |
7133 LABEL_7: | |
7134 v12 = 0; | |
7135 } | |
7136 else | |
7137 { | |
7138 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
7139 while ( (short)v9 != *(short *)v11 ) | |
7140 { | |
7141 ++v10; | |
7142 v11 += 56; | |
7143 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
7144 goto LABEL_7; | |
7145 } | |
7146 v12 = v10; | |
7147 } | |
7148 a1a.uObjectDescID = v12; | |
7149 a1a.vPosition.z = z; | |
7150 a1a.vPosition.x = v21; | |
7151 a1a.vPosition.y = y; | |
7152 a1a.uSoundID = 0; | |
7153 a1a.uAttributes = attributes; | |
7154 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
7155 a1a.uSpriteFrameID = 0; | |
822 | 7156 a1a.spell_caster_pid = 0; |
823 | 7157 a1a.spell_target_pid = 0; |
0 | 7158 if ( !(a1a.uAttributes & 0x10) ) |
7159 { | |
7160 v13 = 0; | |
222 | 7161 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 7162 { |
7163 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
7164 while ( *(short *)v14 != v9 ) | |
7165 { | |
7166 ++v13; | |
7167 v14 += 48; | |
222 | 7168 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 7169 goto LABEL_16; |
7170 } | |
7171 a1a.stru_24.uItemID = v13; | |
7172 } | |
7173 } | |
7174 LABEL_16: | |
7175 if ( a7 ) | |
7176 { | |
7177 v15 = count; | |
7178 if ( count > 0 ) | |
7179 { | |
7180 do | |
7181 { | |
7182 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
7183 v16 = rand(); | |
7184 a1a.Create( | |
7185 (signed __int16)a1a.uFacing, | |
7186 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
7187 a4, | |
7188 0); | |
7189 --v15; | |
7190 } | |
7191 while ( v15 ); | |
7192 } | |
7193 } | |
7194 else | |
7195 { | |
7196 v17 = count; | |
7197 v18 = stru_5C6E00->uIntegerHalfPi; | |
7198 a1a.uFacing = 0; | |
7199 if ( count > 0 ) | |
7200 { | |
7201 do | |
7202 { | |
7203 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
7204 --v17; | |
7205 } | |
7206 while ( v17 ); | |
7207 } | |
7208 } | |
7209 return 1; | |
7210 } | |
7211 | |
7212 //----- (0042F960) -------------------------------------------------------- | |
7213 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
7214 { | |
7215 int v3; // ebx@1 | |
7216 int v4; // edi@1 | |
7217 signed int v5; // edx@1 | |
7218 char *v6; // ecx@2 | |
7219 unsigned __int16 v7; // ax@5 | |
7220 signed int v8; // eax@6 | |
7221 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7222 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 7223 |
7224 v3 = x; | |
7225 v4 = y; | |
7226 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7227 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
|
7228 //SpriteObject::SpriteObject(&a1); |
0 | 7229 a1.stru_24.Reset(); |
7230 | |
7231 v5 = 0; | |
822 | 7232 a1.spell_skill = 0; |
7233 a1.spell_level = 0; | |
7234 a1.spell_id = 0; | |
0 | 7235 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7236 a1.uType = 800; |
0 | 7237 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
7238 { | |
7239 LABEL_5: | |
7240 v7 = 0; | |
7241 } | |
7242 else | |
7243 { | |
7244 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
7245 while ( *(short *)v6 != 800 ) | |
7246 { | |
7247 ++v5; | |
7248 v6 += 56; | |
7249 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
7250 goto LABEL_5; | |
7251 } | |
7252 v7 = v5; | |
7253 } | |
7254 a1.uObjectDescID = v7; | |
7255 a1.vPosition.x = v3; | |
7256 a1.vPosition.y = v4; | |
7257 a1.vPosition.z = z; | |
7258 a1.uSoundID = 0; | |
7259 a1.uAttributes = 0; | |
7260 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
7261 a1.uSpriteFrameID = 0; | |
822 | 7262 a1.spell_caster_pid = 0; |
823 | 7263 a1.spell_target_pid = 0; |
0 | 7264 v8 = a1.Create(0, 0, 0, 0); |
7265 if ( v8 != -1 ) | |
7266 { | |
7267 v9 = 8 * v8; | |
7268 LOBYTE(v9) = v9 | 2; | |
7269 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
7270 } | |
7271 } | |
7272 | |
810 | 7273 |
0 | 7274 |
7275 //----- (0042FA66) -------------------------------------------------------- | |
7276 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
7277 { | |
7278 int v6; // edi@1 | |
7279 int v7; // esi@1 | |
7280 char *v8; // ecx@2 | |
7281 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7282 //int v10; // eax@10 |
0 | 7283 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7284 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7285 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 7286 int v14; // [sp+7Ch] [bp-4h]@1 |
7287 | |
7288 v6 = a1; | |
7289 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7290 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
|
7291 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7292 a1a.uType = 600; |
0 | 7293 a1a.stru_24.Reset(); |
7294 | |
822 | 7295 a1a.spell_id = SPELL_FIRE_FIREBALL; |
7296 a1a.spell_level = 8; | |
7297 a1a.spell_skill = 3; | |
0 | 7298 v14 = 0; |
7299 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
7300 { | |
7301 LABEL_5: | |
7302 v9 = 0; | |
7303 } | |
7304 else | |
7305 { | |
7306 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7307 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 7308 { |
7309 ++v14; | |
7310 v8 += 56; | |
7311 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
7312 goto LABEL_5; | |
7313 } | |
7314 v9 = v14; | |
7315 } | |
7316 a1a.uObjectDescID = v9; | |
7317 a1a.vPosition.x = v6; | |
7318 a1a.vPosition.y = v7; | |
7319 a1a.vPosition.z = a3; | |
7320 a1a.uAttributes = 0; | |
7321 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
7322 a1a.uSpriteFrameID = 0; | |
823 | 7323 a1a.spell_target_pid = 0; |
0 | 7324 a1a.field_60_distance_related_prolly_lod = 0; |
7325 a1a.uFacing = 0; | |
7326 a1a.uSoundID = 0; | |
7327 if ( a6 >= 1 || a6 <= 4 ) | |
7328 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7329 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 7330 } |
7331 else | |
7332 { | |
822 | 7333 a1a.spell_caster_pid = 0; |
0 | 7334 } |
7335 result = a1a.Create(0, 0, 0, 0); | |
7336 if ( result != -1 ) | |
7337 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7338 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 7339 a5, |
7340 SLOWORD(a1a.vPosition.x), | |
7341 SLOWORD(a1a.vPosition.y), | |
7342 SLOWORD(a1a.vPosition.z), | |
7343 0, | |
7344 0); | |
7345 } | |
7346 return result; | |
7347 } | |
7348 | |
7349 //----- (0042FB5C) -------------------------------------------------------- | |
7350 bool __fastcall sub_42FB5C(signed int a1) | |
7351 { | |
7352 int v1; // ecx@3 | |
7353 int v2; // ecx@4 | |
7354 int v3; // ecx@5 | |
7355 int v4; // ecx@6 | |
7356 int v5; // ecx@7 | |
7357 int v6; // ecx@8 | |
7358 char v7; // zf@9 | |
7359 | |
7360 if ( a1 > 39 ) | |
7361 { | |
7362 if ( a1 > 77 ) | |
7363 { | |
7364 if ( a1 == 80 ) | |
7365 return 0; | |
7366 if ( a1 > 84 ) | |
7367 { | |
7368 if ( a1 <= 86 ) | |
7369 return 0; | |
7370 v7 = a1 == 95; | |
7371 goto LABEL_20; | |
7372 } | |
7373 } | |
7374 else | |
7375 { | |
7376 if ( a1 == 77 ) | |
7377 return 0; | |
7378 if ( a1 >= 46 ) | |
7379 { | |
7380 if ( a1 <= 47 || a1 == 51 ) | |
7381 return 0; | |
7382 v7 = a1 == 73; | |
7383 goto LABEL_20; | |
7384 } | |
7385 } | |
7386 return 1; | |
7387 } | |
7388 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
7389 return 1; | |
7390 v2 = v1 - 3; | |
7391 if ( !v2 ) | |
7392 return 0; | |
7393 v3 = v2 - 1; | |
7394 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
7395 return 1; | |
7396 v5 = v4 - 8; | |
7397 if ( !v5 ) | |
7398 return 0; | |
7399 v6 = v5 - 1; | |
7400 if ( !v6 ) | |
7401 return 1; | |
7402 v7 = v6 == 20; | |
7403 LABEL_20: | |
7404 if ( !v7 ) | |
7405 return 1; | |
7406 return 0; | |
7407 } | |
7408 | |
7409 //----- (0042FBDD) -------------------------------------------------------- | |
7410 void __cdecl sub_42FBDD() | |
7411 { | |
388 | 7412 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 7413 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
7414 pRenderer->Present(); | |
7415 } | |
7416 | |
7417 //----- (0042FC15) -------------------------------------------------------- | |
11 | 7418 void __cdecl CloseWindowBackground() |
0 | 7419 { |
388 | 7420 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 7421 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
7422 pRenderer->Present(); | |
7423 } | |
7424 | |
7425 //----- (0042FC4E) -------------------------------------------------------- | |
7426 void __cdecl ProcessInputActions() | |
7427 { | |
7428 char v4; // al@9 | |
7429 char v8; // bl@100 | |
7430 unsigned __int16 v9; // ax@102 | |
7431 int v10; // eax@103 | |
7432 char v14; // al@159 | |
7433 unsigned int v15; // eax@168 | |
7434 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
7435 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
7436 int v24; // [sp+4h] [bp-4h]@87 | |
7437 | |
7438 pGame->pKeyboardInstance->EnterCriticalSection(); | |
7439 auto pKeyboard = pGame->pKeyboardInstance; | |
7440 if (!bAlwaysRun) | |
7441 { | |
7442 if (pKeyboard->IsShiftHeld()) | |
7443 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
7444 else | |
7445 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
7446 } | |
7447 else | |
7448 { | |
7449 if (pKeyboard->IsShiftHeld()) | |
7450 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
7451 else | |
7452 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
7453 } | |
7454 | |
140 | 7455 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
998 | 7456 for ( uint i = 0; i < 30; ++i ) |
7457 { | |
7458 if ( pKeyActionMap->pToggleTypes[i] ) | |
7459 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
7460 else | |
7461 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
7462 if ( v14 && i == 9 ) | |
7463 { | |
7464 if ( !pCurrentScreen ) | |
7465 { | |
7466 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
7467 continue; | |
7468 } | |
7469 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
7470 { | |
7471 v15 = pMessageQueue_50CBD0->uNumMessages; | |
7472 if ( pMessageQueue_50CBD0->uNumMessages ) | |
7473 { | |
7474 v15 = 0; | |
7475 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
7476 { | |
7477 v15 = 1; | |
7478 pMessageQueue_50CBD0->uNumMessages = 0; | |
7479 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
7480 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7481 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7482 ++pMessageQueue_50CBD0->uNumMessages; | |
7483 continue; | |
7484 } | |
7485 pMessageQueue_50CBD0->uNumMessages = 0; | |
7486 } | |
7487 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7488 } | |
7489 } | |
7490 } | |
0 | 7491 if ( !pEventTimer->bPaused ) |
7492 { | |
998 | 7493 for ( uint i = 0; i < 30; ++i ) |
0 | 7494 { |
998 | 7495 inputAction = (InputAction)i; |
7496 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
7497 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 7498 else |
998 | 7499 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 7500 if ( v4 ) |
7501 { | |
7502 switch ( inputAction ) | |
7503 { | |
7504 case INPUT_MoveForward: | |
271 | 7505 if (pCurrentScreen != SCREEN_GAME) |
0 | 7506 break; |
7507 if (!pParty->bTurnBasedModeOn) | |
7508 { | |
140 | 7509 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 7510 partyAction = PARTY_RunForward; |
7511 else | |
7512 partyAction = PARTY_WalkForward; | |
998 | 7513 pPartyActionQueue->Add(partyAction); |
163 | 7514 break; |
7515 } | |
7516 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
7517 { | |
7518 pTurnEngine->uActionPointsLeft -= 26; | |
7519 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
7520 partyAction = PARTY_RunForward; | |
7521 else | |
7522 partyAction = PARTY_WalkForward; | |
998 | 7523 pPartyActionQueue->Add(partyAction); |
163 | 7524 break; |
0 | 7525 } |
7526 break; | |
7527 case INPUT_MoveBackwards: | |
271 | 7528 if (pCurrentScreen != SCREEN_GAME) |
0 | 7529 break; |
7530 if (!pParty->bTurnBasedModeOn) | |
17 | 7531 { |
7532 if ( pParty->uFlags2 & 2 ) | |
7533 partyAction = PARTY_RunBackward; | |
7534 else | |
7535 partyAction = PARTY_WalkBackward; | |
998 | 7536 pPartyActionQueue->Add(partyAction); |
163 | 7537 break; |
17 | 7538 } |
0 | 7539 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
7540 { | |
7541 pTurnEngine->uActionPointsLeft -= 26; | |
7542 if ( pParty->uFlags2 & 2 ) | |
7543 partyAction = PARTY_RunBackward; | |
7544 else | |
7545 partyAction = PARTY_WalkBackward; | |
998 | 7546 pPartyActionQueue->Add(partyAction); |
163 | 7547 break; |
0 | 7548 } |
7549 break; | |
7550 case INPUT_StrafeLeft: | |
271 | 7551 if (pCurrentScreen != SCREEN_GAME) |
0 | 7552 break; |
7553 if (!pParty->bTurnBasedModeOn) | |
17 | 7554 { |
7555 partyAction = PARTY_StrafeLeft; | |
998 | 7556 pPartyActionQueue->Add(partyAction); |
163 | 7557 break; |
17 | 7558 } |
0 | 7559 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
7560 break; | |
7561 pTurnEngine->uActionPointsLeft -= 26; | |
7562 partyAction = PARTY_StrafeLeft; | |
998 | 7563 pPartyActionQueue->Add(partyAction); |
7564 break; | |
0 | 7565 case INPUT_StrafeRight: |
271 | 7566 if (pCurrentScreen != SCREEN_GAME) |
0 | 7567 break; |
7568 if (!pParty->bTurnBasedModeOn) | |
17 | 7569 { |
7570 partyAction = PARTY_StrafeRight; | |
998 | 7571 pPartyActionQueue->Add(partyAction); |
163 | 7572 break; |
17 | 7573 } |
0 | 7574 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
7575 break; | |
7576 pTurnEngine->uActionPointsLeft -= 26; | |
7577 partyAction = PARTY_StrafeRight; | |
998 | 7578 pPartyActionQueue->Add(partyAction); |
163 | 7579 break; |
0 | 7580 case INPUT_TurnLeft: |
271 | 7581 if (pCurrentScreen != SCREEN_GAME) |
0 | 7582 break; |
7583 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
7584 { | |
7585 if (pParty->bTurnBasedModeOn) | |
7586 { | |
7587 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
7588 break; | |
7589 pTurnEngine->uActionPointsLeft -= 26; | |
7590 } | |
998 | 7591 partyAction = PARTY_StrafeLeft; |
0 | 7592 } |
7593 else | |
7594 { | |
7595 if ( pParty->uFlags2 & 2 ) | |
998 | 7596 partyAction = PARTY_FastTurnLeft; |
0 | 7597 else |
998 | 7598 partyAction = PARTY_TurnLeft; |
0 | 7599 } |
998 | 7600 pPartyActionQueue->Add(partyAction); |
0 | 7601 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
7602 { | |
271 | 7603 pWeather->OnPlayerTurn(10); |
0 | 7604 } |
7605 break; | |
7606 case INPUT_TurnRight: | |
271 | 7607 if (pCurrentScreen != SCREEN_GAME) |
0 | 7608 break; |
7609 if ( GetAsyncKeyState(17) ) // strafing | |
7610 { | |
7611 if (pParty->bTurnBasedModeOn) | |
7612 { | |
7613 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
7614 break; | |
7615 pTurnEngine->uActionPointsLeft -= 26; | |
7616 } | |
998 | 7617 partyAction = PARTY_StrafeRight; |
0 | 7618 } |
7619 else | |
7620 { | |
7621 if ( pParty->uFlags2 & 2 ) | |
998 | 7622 partyAction = PARTY_FastTurnRight; |
0 | 7623 else |
998 | 7624 partyAction = PARTY_TurnRight; |
0 | 7625 } |
998 | 7626 pPartyActionQueue->Add(partyAction); |
0 | 7627 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
7628 { | |
271 | 7629 pWeather->OnPlayerTurn(-10); |
0 | 7630 } |
7631 break; | |
7632 case INPUT_Jump: | |
271 | 7633 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 7634 break; |
7635 partyAction = (PartyAction)12; | |
998 | 7636 pPartyActionQueue->Add(partyAction); |
163 | 7637 break; |
0 | 7638 case INPUT_Yell: |
187 | 7639 if (!pCurrentScreen && uActiveCharacter) |
0 | 7640 { |
7641 pParty->Yell(); | |
187 | 7642 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 7643 } |
187 | 7644 break; |
0 | 7645 case INPUT_Pass: |
7646 if ( pCurrentScreen ) | |
7647 break; | |
7648 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 7649 { |
7650 pTurnEngine->field_18 |= 8u; | |
7651 break; | |
7652 } | |
0 | 7653 if ( uActiveCharacter ) |
7654 { | |
998 | 7655 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 7656 { |
998 | 7657 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 7658 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7659 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 7660 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 7661 pTurnEngine->_40471C(); |
7662 } | |
7663 } | |
7664 break; | |
998 | 7665 case INPUT_Combat://if press ENTER |
271 | 7666 if (pCurrentScreen == SCREEN_GAME) |
0 | 7667 { |
7668 if (pParty->bTurnBasedModeOn) | |
7669 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7670 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 7671 { |
7672 pParty->bTurnBasedModeOn = 0; | |
7673 pTurnEngine->End(true); | |
7674 } | |
7675 } | |
7676 else | |
7677 { | |
7678 pTurnEngine->Start(); | |
7679 pParty->bTurnBasedModeOn = true; | |
7680 } | |
7681 } | |
7682 break; | |
7683 case INPUT_CastReady: | |
271 | 7684 if (pCurrentScreen != SCREEN_GAME) |
0 | 7685 break; |
7686 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 7687 { |
7688 pTurnEngine->field_18 |= 8u; | |
7689 break; | |
7690 } | |
0 | 7691 if ( !uActiveCharacter ) |
7692 break; | |
998 | 7693 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 7694 if ( !v8 |
7695 || bUnderwater | |
998 | 7696 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
7697 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
7698 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
7699 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
7700 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
7701 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 7702 { |
998 | 7703 pPartyActionQueue = pPartyActionQueue; |
437 | 7704 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
7705 break; | |
0 | 7706 } |
7707 else | |
7708 { | |
1012 | 7709 /* if ( dword_50C9E8 < 40 ) |
7710 { | |
7711 dword_50C9EC[3 * dword_50C9E8] = 25; | |
7712 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; | |
7713 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
7714 ++dword_50C9E8; | |
7715 }*/ | |
7716 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); | |
0 | 7717 } |
7718 break; | |
7719 case INPUT_Attack: | |
271 | 7720 if (pCurrentScreen != SCREEN_GAME) |
0 | 7721 break; |
998 | 7722 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3) |
7723 { | |
7724 pTurnEngine->field_18 |= 8u; | |
7725 break; | |
7726 } | |
7727 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 7728 break; |
7729 case INPUT_EventTrigger: | |
271 | 7730 if (pCurrentScreen == SCREEN_GAME) |
0 | 7731 { |
437 | 7732 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 7733 break; |
0 | 7734 } |
151 | 7735 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 7736 { |
7737 if ( pMessageQueue_50CBD0->uNumMessages ) | |
7738 { | |
437 | 7739 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 7740 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
7741 { | |
7742 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 7743 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7744 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7745 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7746 ++pMessageQueue_50CBD0->uNumMessages; | |
7747 break; | |
7748 } | |
437 | 7749 break; |
0 | 7750 } |
437 | 7751 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 7752 } |
7753 break; | |
7754 case INPUT_CharCycle: | |
1012 | 7755 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 7756 break; |
1012 | 7757 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40 |
437 | 7758 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7759 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 7760 ++dword_50C9E8;*/ |
7761 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); | |
163 | 7762 break; |
0 | 7763 case INPUT_LookUp: |
7764 if ( pEventTimer->bPaused ) | |
7765 break; | |
7766 partyAction = (PartyAction)7; | |
998 | 7767 pPartyActionQueue->Add(partyAction); |
163 | 7768 break; |
0 | 7769 case INPUT_CenterView: |
7770 if ( pEventTimer->bPaused ) | |
7771 break; | |
7772 partyAction = (PartyAction)9; | |
998 | 7773 pPartyActionQueue->Add(partyAction); |
163 | 7774 break; |
0 | 7775 case INPUT_LookDown: |
7776 if ( pEventTimer->bPaused ) | |
7777 break; | |
7778 partyAction = (PartyAction)8; | |
998 | 7779 pPartyActionQueue->Add(partyAction); |
163 | 7780 break; |
0 | 7781 case INPUT_FlyUp: |
998 | 7782 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 7783 break; |
7784 partyAction = (PartyAction)13; | |
998 | 7785 pPartyActionQueue->Add(partyAction); |
163 | 7786 break; |
0 | 7787 case INPUT_Land: |
998 | 7788 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 7789 break; |
7790 partyAction = (PartyAction)15; | |
998 | 7791 pPartyActionQueue->Add(partyAction); |
163 | 7792 break; |
0 | 7793 case INPUT_FlyDown: |
7794 if ( !pCurrentScreen | |
7795 && !pEventTimer->bPaused ) | |
7796 { | |
7797 partyAction = (PartyAction)14; | |
998 | 7798 pPartyActionQueue->Add(partyAction); |
0 | 7799 } |
7800 break; | |
7801 case INPUT_ZoomIn: | |
1012 | 7802 /*if ( dword_50C9E8 >= 40 ) |
0 | 7803 break; |
7804 dword_50C9EC[3 * dword_50C9E8] = 367; | |
437 | 7805 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7806 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 7807 ++dword_50C9E8;*/ |
7808 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); | |
163 | 7809 break; |
0 | 7810 case INPUT_ZoomOut: |
1012 | 7811 /*if ( dword_50C9E8 < 40 ) |
0 | 7812 { |
7813 dword_50C9EC[3 * dword_50C9E8] = 368; | |
437 | 7814 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7815 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 7816 ++dword_50C9E8; |
1012 | 7817 }*/ |
7818 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); | |
0 | 7819 break; |
7820 case INPUT_AlwaysRun: | |
7821 bAlwaysRun = bAlwaysRun == 0; | |
7822 break; | |
17 | 7823 default: |
7824 break; | |
0 | 7825 } |
7826 } | |
7827 } | |
7828 } | |
7829 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
7830 { | |
7831 AsyncKeyboard::LeaveCriticalSection(); | |
998 | 7832 //v16 = pAsyncKeyboard; |
0 | 7833 AsyncKeyboard::EnterCriticalSection(); |
998 | 7834 memset((char *)pAsyncKeyboard + 521, 0, 0x100u); |
0 | 7835 AsyncKeyboard::LeaveCriticalSection(); |
7836 } | |
7837 } |