Mercurial > mm7
annotate mm7_6.cpp @ 1121:72eb21a62633
sacrifice working
author | zipi |
---|---|
date | Thu, 30 May 2013 20:25:50 +0100 |
parents | 17a01695926b |
children | 45a8862d8b6e |
rev | line source |
---|---|
0 | 1 #include "MM7.h" |
2 | |
1016 | 3 |
4 | |
5 #include "Sprites.h" | |
6 #include "BSPModel.h" | |
7 #include "OutdoorCamera.h" | |
8 #include "Mouse.h" | |
9 #include "Keyboard.h" | |
10 #include "stru6.h" | |
11 | |
12 #include "Vis.h" | |
0 | 13 #include "Game.h" |
14 #include "GUIWindow.h" | |
15 #include "GUIFont.h" | |
16 #include "Party.h" | |
17 #include "AudioPlayer.h" | |
18 #include "Outdoor.h" | |
19 #include "Overlays.h" | |
20 #include "LOD.h" | |
21 #include "Actor.h" | |
22 #include "Events.h" | |
23 #include "Viewport.h" | |
24 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
25 #include "SpriteObject.h" |
0 | 26 #include "ObjectList.h" |
27 #include "stru123.h" | |
28 #include "Time.h" | |
29 #include "IconFrameTable.h" | |
30 #include "Awards.h" | |
31 #include "TurnEngine.h" | |
924 | 32 #include "CastSpellInfo.h" |
0 | 33 #include "stru298.h" |
189 | 34 #include "texts.h" |
0 | 35 |
36 #include "mm7_data.h" | |
37 | |
38 | |
39 | |
40 //----- (00424EE0) -------------------------------------------------------- | |
41 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
42 { | |
43 unsigned int v1; // edx@1 | |
44 double v2; // st7@1 | |
45 signed int v3; // edi@1 | |
46 char *v4; // esi@4 | |
47 char *v5; // ecx@4 | |
48 unsigned int v6; // eax@4 | |
49 char *v7; // edx@4 | |
50 double v8; // st6@10 | |
51 double v9; // st5@10 | |
52 double v10; // st6@11 | |
53 unsigned __int8 v11; // c2@15 | |
54 unsigned __int8 v12; // c3@15 | |
55 void *v13; // edi@22 | |
56 char *v14; // eax@22 | |
57 double v15; // st6@22 | |
58 char *v16; // ecx@22 | |
59 signed int result; // eax@24 | |
60 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
61 bool v19; // [sp+Ch] [bp-28h]@6 | |
62 char *v20; // [sp+10h] [bp-24h]@4 | |
63 char *v21; // [sp+14h] [bp-20h]@4 | |
64 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
65 char *v23; // [sp+1Ch] [bp-18h]@4 | |
66 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
67 char *v25; // [sp+24h] [bp-10h]@4 | |
68 char *v26; // [sp+28h] [bp-Ch]@4 | |
69 char *v27; // [sp+2Ch] [bp-8h]@4 | |
70 char *v28; // [sp+30h] [bp-4h]@4 | |
71 | |
72 v1 = uVertexID; | |
73 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
74 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
75 v3 = 0; | |
76 v22 = 0; | |
77 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
78 v3 = 1; | |
79 if ( (signed int)(uVertexID + 1) <= 1 ) | |
80 return 0; | |
81 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
82 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
83 v6 = v1; | |
84 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 85 v26 = (char *)&array_507D30[0]._rhw; |
0 | 86 v24 = array_507D30; |
87 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
88 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
89 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
90 v27 = (char *)&array_507D30[0].v; | |
91 v28 = (char *)&array_507D30[0].u; | |
92 v7 = (char *)&array_50AC10[0].v; | |
93 v18 = v6; | |
94 do | |
95 { | |
96 v19 = v2 >= *((float *)v7 + 5); | |
97 if ( v3 != v19 ) | |
98 { | |
99 if ( v19 ) | |
100 { | |
101 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
102 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
103 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
104 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
105 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
106 } | |
107 else | |
108 { | |
109 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
110 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
111 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
112 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
113 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
114 } | |
115 *(float *)v27 = v9; | |
116 *(float *)v25 = v2; | |
117 *(float *)v26 = 1.0 / v2; | |
118 if ( v3 ) | |
119 { | |
120 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
121 { | |
122 v11 = 0; | |
123 v12 = *(float *)v4 == *((float *)v7 - 5); | |
124 goto LABEL_19; | |
125 } | |
126 } | |
127 else | |
128 { | |
129 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
130 { | |
131 v11 = 0; | |
132 v12 = *(float *)v4 == *((float *)v7 + 7); | |
133 LABEL_19: | |
134 if ( v12 | v11 ) | |
135 goto LABEL_21; | |
136 goto LABEL_20; | |
137 } | |
138 } | |
139 LABEL_20: | |
140 v26 += 48; | |
141 ++v24; | |
142 v25 += 48; | |
143 v27 += 48; | |
144 v28 += 48; | |
145 v5 += 48; | |
146 v4 += 48; | |
147 ++v22; | |
148 v23 += 48; | |
149 v21 = v5; | |
150 v20 = v4; | |
151 } | |
152 LABEL_21: | |
153 if ( v19 ) | |
154 { | |
155 v13 = v24; | |
156 v14 = v26; | |
157 v21 += 48; | |
158 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
159 v20 += 48; | |
160 ++v22; | |
161 v28 += 48; | |
162 v27 += 48; | |
163 v25 += 48; | |
164 ++v24; | |
165 v26 += 48; | |
166 memcpy(v13, v7 + 8, 0x30u); | |
167 v16 = v23; | |
168 v23 += 48; | |
169 v4 = v20; | |
170 *(float *)v14 = v15; | |
171 *(int *)v16 = *((int *)v7 + 13); | |
172 v5 = v21; | |
173 } | |
174 v3 = v19; | |
175 v7 += 48; | |
176 --v18; | |
177 } | |
178 while ( v18 ); | |
179 result = v22; | |
180 if ( v22 < 3 ) | |
181 return 0; | |
182 return result; | |
183 } | |
184 | |
185 //----- (004250FE) -------------------------------------------------------- | |
186 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
187 { | |
188 unsigned int v1; // edx@1 | |
189 char *v2; // edi@5 | |
190 char *v3; // esi@5 | |
191 char *v4; // ecx@5 | |
192 int v5; // ebx@6 | |
193 double v6; // st6@11 | |
194 double v7; // st5@11 | |
195 double v8; // st6@12 | |
196 unsigned __int8 v9; // c2@16 | |
197 unsigned __int8 v10; // c3@16 | |
198 void *v11; // edi@23 | |
199 double v12; // st6@23 | |
200 char *v13; // ecx@23 | |
201 char v14; // zf@24 | |
202 signed int result; // eax@25 | |
203 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
204 bool v17; // [sp+Ch] [bp-24h]@2 | |
205 bool v18; // [sp+10h] [bp-20h]@7 | |
206 char *v19; // [sp+14h] [bp-1Ch]@5 | |
207 char *v20; // [sp+18h] [bp-18h]@5 | |
208 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
209 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
210 char *v23; // [sp+24h] [bp-Ch]@5 | |
211 char *v24; // [sp+28h] [bp-8h]@5 | |
212 char *v25; // [sp+2Ch] [bp-4h]@5 | |
213 | |
214 v1 = uVertexID; | |
215 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
216 v21 = 0; | |
217 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
218 if ( (signed int)(uVertexID + 1) <= 1 ) | |
219 return 0; | |
220 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
221 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 222 v24 = (char *)&array_507D30[0]._rhw; |
0 | 223 v22 = array_507D30; |
224 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
225 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
226 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
227 v25 = (char *)&array_507D30[0].flt_2C; | |
228 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
229 v16 = v1; | |
230 do | |
231 { | |
232 v5 = (int)(v4 + 48); | |
233 v18 = *((float *)v4 + 12) >= 8.0; | |
234 if ( v17 != v18 ) | |
235 { | |
236 if ( v18 ) | |
237 { | |
238 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
239 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
240 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
241 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
242 } | |
243 else | |
244 { | |
245 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
246 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
247 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
248 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
249 } | |
250 *(float *)v25 = v7; | |
251 *(float *)v23 = 8.0; | |
252 *(int *)v24 = 0x3E000000u; | |
253 if ( v17 ) | |
254 { | |
255 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
256 { | |
257 v9 = 0; | |
258 v10 = *(float *)v2 == *((float *)v4 + 2); | |
259 goto LABEL_20; | |
260 } | |
261 } | |
262 else | |
263 { | |
264 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
265 { | |
266 v9 = 0; | |
267 v10 = *(float *)v2 == *((float *)v4 + 14); | |
268 LABEL_20: | |
269 if ( v10 | v9 ) | |
270 goto LABEL_22; | |
271 goto LABEL_21; | |
272 } | |
273 } | |
274 LABEL_21: | |
275 ++v22; | |
276 v23 += 48; | |
277 v25 += 48; | |
278 v3 += 48; | |
279 v2 += 48; | |
280 ++v21; | |
281 v24 += 48; | |
282 v20 = v3; | |
283 v19 = v2; | |
284 } | |
285 LABEL_22: | |
286 if ( v18 ) | |
287 { | |
288 v11 = v22; | |
289 v20 += 48; | |
290 v19 += 48; | |
291 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
292 ++v21; | |
293 v25 += 48; | |
294 v23 += 48; | |
295 ++v22; | |
296 memcpy(v11, v4 + 36, 0x30u); | |
297 v13 = v24; | |
298 v24 += 48; | |
299 v3 = v20; | |
300 v2 = v19; | |
301 *(float *)v13 = v12; | |
302 } | |
303 v14 = v16-- == 1; | |
304 v17 = v18; | |
305 v4 = (char *)v5; | |
306 } | |
307 while ( !v14 ); | |
308 result = v21; | |
309 if ( v21 < 3 ) | |
310 return 0; | |
311 return result; | |
312 } | |
313 | |
314 //----- (004252E8) -------------------------------------------------------- | |
315 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
316 { | |
317 unsigned int v1; // edx@1 | |
318 double v2; // st7@1 | |
319 char *v3; // edi@5 | |
320 char *v4; // esi@5 | |
321 char *v5; // ecx@5 | |
322 int v6; // ebx@6 | |
323 double v7; // st6@11 | |
324 double v8; // st5@11 | |
325 double v9; // st6@12 | |
326 unsigned __int8 v10; // c2@16 | |
327 unsigned __int8 v11; // c3@16 | |
328 void *v12; // edi@23 | |
329 double v13; // st6@23 | |
330 char *v14; // ecx@23 | |
331 char v15; // zf@24 | |
332 signed int result; // eax@25 | |
333 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
334 bool v18; // [sp+Ch] [bp-24h]@2 | |
335 bool v19; // [sp+10h] [bp-20h]@7 | |
336 char *v20; // [sp+14h] [bp-1Ch]@5 | |
337 char *v21; // [sp+18h] [bp-18h]@5 | |
338 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
339 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
340 char *v24; // [sp+24h] [bp-Ch]@5 | |
341 char *v25; // [sp+28h] [bp-8h]@5 | |
342 char *v26; // [sp+2Ch] [bp-4h]@5 | |
343 | |
344 v1 = uVertexID; | |
345 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
346 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
347 v22 = 0; | |
348 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
349 if ( (signed int)(uVertexID + 1) <= 1 ) | |
350 return 0; | |
351 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
352 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 353 v25 = (char *)&array_507D30[0]._rhw; |
0 | 354 v23 = array_507D30; |
355 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
356 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
357 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
358 v26 = (char *)&array_507D30[0].flt_2C; | |
359 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
360 v17 = v1; | |
361 do | |
362 { | |
363 v6 = (int)(v5 + 48); | |
364 v19 = v2 >= *((float *)v5 + 12); | |
365 if ( v18 != v19 ) | |
366 { | |
367 if ( v19 ) | |
368 { | |
369 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
370 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
371 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
372 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
373 } | |
374 else | |
375 { | |
376 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
377 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
378 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
379 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
380 } | |
381 *(float *)v26 = v8; | |
382 *(float *)v24 = v2; | |
383 *(float *)v25 = 1.0 / v2; | |
384 if ( v18 ) | |
385 { | |
386 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
387 { | |
388 v10 = 0; | |
389 v11 = *(float *)v3 == *((float *)v5 + 2); | |
390 goto LABEL_20; | |
391 } | |
392 } | |
393 else | |
394 { | |
395 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
396 { | |
397 v10 = 0; | |
398 v11 = *(float *)v3 == *((float *)v5 + 14); | |
399 LABEL_20: | |
400 if ( v11 | v10 ) | |
401 goto LABEL_22; | |
402 goto LABEL_21; | |
403 } | |
404 } | |
405 LABEL_21: | |
406 ++v23; | |
407 v24 += 48; | |
408 v26 += 48; | |
409 v4 += 48; | |
410 v3 += 48; | |
411 ++v22; | |
412 v25 += 48; | |
413 v21 = v4; | |
414 v20 = v3; | |
415 } | |
416 LABEL_22: | |
417 if ( v19 ) | |
418 { | |
419 v12 = v23; | |
420 v21 += 48; | |
421 v20 += 48; | |
422 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
423 ++v22; | |
424 v26 += 48; | |
425 v24 += 48; | |
426 ++v23; | |
427 memcpy(v12, v5 + 36, 0x30u); | |
428 v14 = v25; | |
429 v25 += 48; | |
430 v4 = v21; | |
431 v3 = v20; | |
432 *(float *)v14 = v13; | |
433 } | |
434 v15 = v17-- == 1; | |
435 v18 = v19; | |
436 v5 = (char *)v6; | |
437 } | |
438 while ( !v15 ); | |
439 result = v22; | |
440 if ( v22 < 3 ) | |
441 return 0; | |
442 return result; | |
443 } | |
444 | |
445 //----- (004254D2) -------------------------------------------------------- | |
446 int __fastcall sr_4254D2(signed int a1) | |
447 { | |
448 signed int v1; // ebx@2 | |
449 int v2; // ecx@2 | |
450 int result; // eax@11 | |
451 double v4; // ST74_8@12 | |
452 bool v5; // edi@12 | |
453 char *v6; // esi@13 | |
454 char *v7; // ebx@13 | |
455 double v8; // st7@15 | |
456 double v9; // st7@16 | |
457 double v10; // st6@16 | |
458 double v11; // st7@17 | |
459 float v12; // eax@18 | |
460 double v13; // ST4C_8@19 | |
461 double v14; // ST10_8@19 | |
462 double v15; // ST28_8@20 | |
463 double v16; // ST34_8@20 | |
464 char v17; // zf@20 | |
465 double v18; // ST18_8@21 | |
466 double v19; // ST3C_8@21 | |
467 double v20; // ST44_8@22 | |
468 double v21; // ST54_8@22 | |
469 void *v22; // edi@26 | |
470 double v23; // ST54_8@29 | |
471 bool v24; // esi@29 | |
472 char *v25; // edi@30 | |
473 char *v26; // ebx@30 | |
474 bool v27; // ecx@32 | |
475 double v28; // st7@33 | |
476 double v29; // st7@34 | |
477 double v30; // st6@34 | |
478 double v31; // st7@35 | |
479 double v32; // ST44_8@37 | |
480 double v33; // ST3C_8@37 | |
481 double v34; // ST18_8@38 | |
482 double v35; // ST34_8@38 | |
483 char v36; // zf@38 | |
484 double v37; // ST28_8@39 | |
485 double v38; // ST10_8@39 | |
486 double v39; // ST20_8@40 | |
487 double v40; // ST5C_8@40 | |
488 void *v41; // edi@44 | |
489 double v42; // ST5C_8@47 | |
490 bool v43; // edi@47 | |
491 char *v44; // esi@48 | |
492 char *v45; // ebx@48 | |
493 bool v46; // ecx@49 | |
494 double v47; // st6@50 | |
495 double v48; // st6@51 | |
496 double v49; // st5@51 | |
497 double v50; // st6@52 | |
498 double v51; // ST20_8@54 | |
499 double v52; // ST54_8@54 | |
500 double v53; // ST44_8@55 | |
501 double v54; // ST3C_8@55 | |
502 char v55; // zf@55 | |
503 double v56; // ST18_8@56 | |
504 double v57; // ST34_8@56 | |
505 double v58; // ST28_8@57 | |
506 double v59; // ST10_8@57 | |
507 void *v60; // edi@61 | |
508 double v61; // ST5C_8@64 | |
509 bool v62; // edi@64 | |
510 char *v63; // esi@65 | |
511 char *v64; // ebx@65 | |
512 bool v65; // ecx@66 | |
513 double v66; // st6@67 | |
514 double v67; // st6@68 | |
515 double v68; // st5@68 | |
516 double v69; // st6@69 | |
517 double v70; // ST20_8@71 | |
518 double v71; // ST54_8@71 | |
519 double v72; // ST44_8@72 | |
520 double v73; // ST3C_8@72 | |
521 char v74; // zf@72 | |
522 double v75; // ST18_8@73 | |
523 double v76; // ST34_8@73 | |
524 double v77; // ST28_8@74 | |
525 double v78; // ST10_8@74 | |
526 void *v79; // edi@78 | |
527 int v80; // ebx@81 | |
528 char *v81; // ecx@82 | |
529 signed int v82; // esi@82 | |
530 float v83; // ST78_4@83 | |
531 double v84; // ST5C_8@83 | |
532 float v85; // eax@84 | |
533 double v86; // ST20_8@85 | |
534 double v87; // ST54_8@88 | |
535 float v88; // eax@89 | |
536 double v89; // ST44_8@90 | |
537 unsigned __int8 v90; // sf@94 | |
538 unsigned __int8 v91; // of@94 | |
539 int v92; // edx@97 | |
540 int v93; // esi@97 | |
541 int v94; // edi@97 | |
542 int v95; // eax@97 | |
543 int v96; // eax@104 | |
544 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
545 double v98; // [sp+54h] [bp-84h]@49 | |
546 double v99; // [sp+54h] [bp-84h]@66 | |
547 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
548 float v101; // [sp+60h] [bp-78h]@1 | |
549 float v102; // [sp+64h] [bp-74h]@1 | |
550 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
551 float v104; // [sp+A8h] [bp-30h]@1 | |
552 signed int v105; // [sp+A8h] [bp-30h]@96 | |
553 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
554 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
555 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
556 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
557 signed int v110; // [sp+B0h] [bp-28h]@12 | |
558 char *v111; // [sp+B8h] [bp-20h]@30 | |
559 signed int v112; // [sp+B8h] [bp-20h]@48 | |
560 signed int v113; // [sp+B8h] [bp-20h]@65 | |
561 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
562 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
563 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
564 signed int v117; // [sp+C0h] [bp-18h]@1 | |
565 char *v118; // [sp+C0h] [bp-18h]@30 | |
566 char *v119; // [sp+C0h] [bp-18h]@48 | |
567 char *v120; // [sp+C0h] [bp-18h]@65 | |
568 char *v121; // [sp+C4h] [bp-14h]@13 | |
569 char *v122; // [sp+C4h] [bp-14h]@30 | |
570 signed int v123; // [sp+C4h] [bp-14h]@47 | |
571 char *v124; // [sp+C8h] [bp-10h]@30 | |
572 char *v125; // [sp+C8h] [bp-10h]@48 | |
573 char *v126; // [sp+C8h] [bp-10h]@65 | |
574 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
575 char *v128; // [sp+CCh] [bp-Ch]@13 | |
576 char *v129; // [sp+CCh] [bp-Ch]@30 | |
577 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
578 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
579 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
580 char *v133; // [sp+D0h] [bp-8h]@30 | |
581 char *v134; // [sp+D0h] [bp-8h]@48 | |
582 char *v135; // [sp+D0h] [bp-8h]@65 | |
583 signed int v136; // [sp+D4h] [bp-4h]@1 | |
584 char *v137; // [sp+D4h] [bp-4h]@13 | |
585 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
586 char *v139; // [sp+D4h] [bp-4h]@48 | |
587 char *v140; // [sp+D4h] [bp-4h]@65 | |
588 | |
693 | 589 v101 = (double)(signed int)pViewport->uViewportTL_X; |
590 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 591 v117 = a1; |
592 v136 = 1; | |
693 | 593 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
594 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 595 if ( a1 <= 0 ) |
596 return v117; | |
597 v127 = a1; | |
598 v1 = a1; | |
599 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
600 v2 = 0; | |
601 do | |
602 { | |
603 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
604 v136 = 0; | |
605 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
606 v136 = 0; | |
607 ++v2; | |
608 --v127; | |
609 } | |
610 while ( v127 ); | |
611 if ( v136 ) | |
612 return v117; | |
613 v110 = 0; | |
614 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
615 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 616 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 617 if ( v117 < 1 ) |
618 goto LABEL_112; | |
619 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
620 v132 = array_50A2B0; | |
621 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
622 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
623 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 624 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 625 v7 = (char *)&array_50AC10[0].flt_2C; |
626 do | |
627 { | |
628 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 629 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 630 if ( !(v5 ^ v106) ) |
631 goto LABEL_25; | |
632 v8 = v101; | |
693 | 633 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 634 { |
635 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
636 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
637 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
638 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
639 } | |
640 else | |
641 { | |
642 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
643 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
644 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
645 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
646 } | |
647 *(float *)v121 = v10; | |
648 *(int *)v137 = LODWORD(v101); | |
649 LODWORD(v12) = *(int *)v6; | |
650 if ( v5 ) | |
651 { | |
652 v13 = v12 + 6.7553994e15; | |
653 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
654 if ( LODWORD(v13) == LODWORD(v14) ) | |
655 { | |
656 v15 = *(float *)v137 + 6.7553994e15; | |
657 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
658 v17 = LODWORD(v15) == LODWORD(v16); | |
659 goto LABEL_23; | |
660 } | |
661 } | |
662 else | |
663 { | |
664 v18 = v12 + 6.7553994e15; | |
665 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
666 if ( LODWORD(v18) == LODWORD(v19) ) | |
667 { | |
668 v20 = *(float *)v137 + 6.7553994e15; | |
669 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
670 v17 = LODWORD(v20) == LODWORD(v21); | |
671 LABEL_23: | |
672 if ( v17 ) | |
673 goto LABEL_25; | |
674 goto LABEL_24; | |
675 } | |
676 } | |
677 LABEL_24: | |
678 v121 += 48; | |
679 v114 += 48; | |
680 v6 += 48; | |
681 ++v110; | |
682 ++v132; | |
683 v128 = v6; | |
684 v137 += 48; | |
685 LABEL_25: | |
686 if ( v106 ) | |
687 { | |
688 v22 = v132; | |
689 v128 += 48; | |
690 ++v110; | |
691 v114 += 48; | |
692 v121 += 48; | |
693 v137 += 48; | |
694 ++v132; | |
695 memcpy(v22, v7 + 4, 0x30u); | |
696 v6 = v128; | |
697 } | |
698 v5 = v106; | |
699 v7 += 48; | |
700 --v117; | |
701 } | |
702 while ( v117 ); | |
703 if ( v110 < 3 | |
704 || (v115 = 0, | |
705 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
706 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 707 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 708 v110 < 1) ) |
709 goto LABEL_112; | |
168 | 710 v25 = (char *)&array_509950[0]._rhw; |
0 | 711 v138 = array_509950; |
712 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
713 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
714 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
715 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
716 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 717 v111 = (char *)&array_509950[0]._rhw; |
0 | 718 v26 = (char *)&array_50A2B0[0].flt_2C; |
719 while ( 2 ) | |
720 { | |
721 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 722 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
723 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 724 if ( v24 != v27 ) |
725 { | |
726 v28 = v100; | |
693 | 727 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 728 { |
729 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
730 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
731 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
732 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
733 } | |
734 else | |
735 { | |
736 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
737 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
738 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
739 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
740 } | |
741 *(float *)v124 = v30; | |
742 *(int *)v133 = LODWORD(v100); | |
743 if ( v24 ) | |
744 { | |
745 v32 = *(float *)v122 + 6.7553994e15; | |
746 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
747 if ( LODWORD(v32) == LODWORD(v33) ) | |
748 { | |
749 v34 = *(float *)v133 + 6.7553994e15; | |
750 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
751 v36 = LODWORD(v34) == LODWORD(v35); | |
752 goto LABEL_41; | |
753 } | |
754 goto LABEL_42; | |
755 } | |
756 v37 = *(float *)v118 + 6.7553994e15; | |
757 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
758 if ( LODWORD(v37) != LODWORD(v38) ) | |
759 goto LABEL_42; | |
760 v39 = *(float *)v129 + 6.7553994e15; | |
761 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
762 v36 = LODWORD(v39) == LODWORD(v40); | |
763 LABEL_41: | |
764 if ( !v36 ) | |
765 { | |
766 LABEL_42: | |
767 v129 += 48; | |
768 v118 += 48; | |
769 v133 += 48; | |
770 v122 += 48; | |
771 v124 += 48; | |
772 v111 += 48; | |
773 ++v115; | |
774 ++v138; | |
775 } | |
776 } | |
777 if ( v27 ) | |
778 { | |
779 v41 = v138; | |
780 ++v115; | |
781 v111 += 48; | |
782 v124 += 48; | |
783 v122 += 48; | |
784 v133 += 48; | |
785 v118 += 48; | |
786 v129 += 48; | |
787 ++v138; | |
788 memcpy(v41, v26 + 4, 0x30u); | |
789 } | |
790 v24 = v107; | |
791 v26 += 48; | |
792 --v110; | |
793 if ( v110 ) | |
794 { | |
795 v25 = v111; | |
796 continue; | |
797 } | |
798 break; | |
799 } | |
800 if ( v115 < 3 | |
801 || (v123 = 0, | |
802 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
803 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 804 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 805 v115 < 1) ) |
806 goto LABEL_112; | |
807 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
808 v130 = array_508FF0; | |
809 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
810 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
811 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 812 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 813 v45 = (char *)&array_509950[0].flt_2C; |
814 v112 = v115; | |
815 while ( 2 ) | |
816 { | |
817 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 818 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
819 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 820 if ( v43 != v46 ) |
821 { | |
822 v47 = v104; | |
693 | 823 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 824 { |
825 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
826 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
827 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
828 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
829 } | |
830 else | |
831 { | |
832 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
833 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
834 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
835 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
836 } | |
837 *(float *)v125 = v49; | |
838 *(float *)v139 = v104; | |
839 if ( v43 ) | |
840 { | |
841 v51 = v104 + 6.7553994e15; | |
842 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
843 if ( LODWORD(v51) == LODWORD(v52) ) | |
844 { | |
845 v53 = *(float *)v44 + 6.7553994e15; | |
846 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
847 v55 = LODWORD(v53) == LODWORD(v54); | |
848 goto LABEL_58; | |
849 } | |
850 goto LABEL_59; | |
851 } | |
852 v56 = v104 + 6.7553994e15; | |
853 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
854 if ( LODWORD(v56) != LODWORD(v57) ) | |
855 goto LABEL_59; | |
856 v58 = *(float *)v44 + 6.7553994e15; | |
857 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
858 v55 = LODWORD(v58) == LODWORD(v59); | |
859 LABEL_58: | |
860 if ( !v55 ) | |
861 { | |
862 LABEL_59: | |
863 v139 += 48; | |
864 v125 += 48; | |
865 v134 += 48; | |
866 v44 += 48; | |
867 ++v123; | |
868 ++v130; | |
869 v119 = v44; | |
870 } | |
871 } | |
872 if ( v46 ) | |
873 { | |
874 v60 = v130; | |
875 v119 += 48; | |
876 ++v123; | |
877 v134 += 48; | |
878 v125 += 48; | |
879 v139 += 48; | |
880 ++v130; | |
881 memcpy(v60, v45 + 4, 0x30u); | |
882 v44 = v119; | |
883 } | |
884 v43 = v108; | |
885 v45 += 48; | |
886 --v112; | |
887 if ( v112 ) | |
888 continue; | |
889 break; | |
890 } | |
891 if ( v123 < 3 | |
892 || (v116 = 0, | |
893 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
894 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 895 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 896 v123 < 1) ) |
897 goto LABEL_112; | |
898 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
899 v131 = array_508690; | |
900 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
901 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
902 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 903 v135 = (char *)&array_508690[0]._rhw; |
0 | 904 v64 = (char *)&array_508FF0[0].flt_2C; |
905 v113 = v123; | |
906 while ( 2 ) | |
907 { | |
908 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 909 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
910 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 911 if ( v62 != v65 ) |
912 { | |
913 v66 = v102; | |
693 | 914 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 915 { |
916 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
917 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
918 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
919 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
920 } | |
921 else | |
922 { | |
923 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
924 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
925 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
926 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
927 } | |
928 *(float *)v126 = v68; | |
929 *(float *)v140 = v102; | |
930 if ( v62 ) | |
931 { | |
932 v70 = v102 + 6.7553994e15; | |
933 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
934 if ( LODWORD(v70) == LODWORD(v71) ) | |
935 { | |
936 v72 = *(float *)v63 + 6.7553994e15; | |
937 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
938 v74 = LODWORD(v72) == LODWORD(v73); | |
939 goto LABEL_75; | |
940 } | |
941 goto LABEL_76; | |
942 } | |
943 v75 = v102 + 6.7553994e15; | |
944 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
945 if ( LODWORD(v75) != LODWORD(v76) ) | |
946 goto LABEL_76; | |
947 v77 = *(float *)v63 + 6.7553994e15; | |
948 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
949 v74 = LODWORD(v77) == LODWORD(v78); | |
950 LABEL_75: | |
951 if ( !v74 ) | |
952 { | |
953 LABEL_76: | |
954 v140 += 48; | |
955 v126 += 48; | |
956 v135 += 48; | |
957 v63 += 48; | |
958 ++v116; | |
959 ++v131; | |
960 v120 = v63; | |
961 } | |
962 } | |
963 if ( v65 ) | |
964 { | |
965 v79 = v131; | |
966 v120 += 48; | |
967 ++v116; | |
968 v135 += 48; | |
969 v126 += 48; | |
970 v140 += 48; | |
971 ++v131; | |
972 memcpy(v79, v64 + 4, 0x30u); | |
973 v63 = v120; | |
974 } | |
975 v62 = v109; | |
976 v64 += 48; | |
977 --v113; | |
978 if ( v113 ) | |
979 continue; | |
980 break; | |
981 } | |
982 if ( v116 < 3 ) | |
983 goto LABEL_112; | |
984 v80 = v116; | |
985 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
986 if ( v116 > 0 ) | |
987 { | |
988 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
989 v82 = v116; | |
990 do | |
991 { | |
992 LODWORD(v83) = *(int *)v81; | |
993 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
994 v84 = v83 + 6.7553994e15; | |
693 | 995 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 996 { |
997 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 998 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 999 goto LABEL_88; |
1000 v85 = v101; | |
1001 } | |
1002 else | |
1003 { | |
1004 v85 = v100; | |
1005 } | |
1006 *(int *)v81 = LODWORD(v85); | |
1007 LABEL_88: | |
1008 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1009 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1010 { |
1011 v88 = v102; | |
1012 LABEL_92: | |
1013 *((int *)v81 + 1) = LODWORD(v88); | |
1014 goto LABEL_93; | |
1015 } | |
1016 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1017 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1018 { |
1019 v88 = v104; | |
1020 goto LABEL_92; | |
1021 } | |
1022 LABEL_93: | |
1023 v81 += 48; | |
1024 --v82; | |
1025 } | |
1026 while ( v82 ); | |
1027 } | |
1028 v91 = __OFSUB__(v116, 3); | |
1029 v90 = v116 - 3 < 0; | |
1030 if ( v116 > 3 ) | |
1031 { | |
1032 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1033 if ( v116 > 0 ) | |
1034 { | |
1035 v105 = 1; | |
1036 do | |
1037 { | |
1038 v92 = v105; | |
1039 v93 = v105 - 1; | |
1040 v94 = v105 + 1; | |
1041 v95 = v105 + 1; | |
1042 if ( v105 - 1 >= v80 ) | |
1043 v93 -= v80; | |
1044 if ( v105 >= v80 ) | |
1045 v92 = v105 - v80; | |
1046 if ( v94 >= v80 ) | |
1047 v95 = v94 - v80; | |
1048 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1049 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1050 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1051 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1052 { | |
1053 ++v105; | |
1054 } | |
1055 else | |
1056 { | |
1057 v96 = v105; | |
1058 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1059 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1060 --v80; | |
1061 } | |
1062 } | |
1063 while ( v105 - 1 < v80 ); | |
1064 } | |
1065 v91 = __OFSUB__(v80, 3); | |
1066 v90 = v80 - 3 < 0; | |
1067 } | |
1068 if ( v90 ^ v91 ) | |
1069 LABEL_112: | |
1070 result = 0; | |
1071 else | |
1072 result = v80; | |
1073 return result; | |
1074 } | |
1075 | |
1076 //----- (0042620A) -------------------------------------------------------- | |
1077 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1078 { | |
1079 __int16 v1; // fps@1 | |
1080 unsigned __int8 v2; // c0@2 | |
1081 char v3; // c2@2 | |
1082 unsigned __int8 v4; // c3@2 | |
1083 bool result; // eax@2 | |
1084 unsigned __int8 v6; // c0@4 | |
1085 char v7; // c2@4 | |
1086 unsigned __int8 v8; // c3@4 | |
1087 unsigned __int8 v9; // c0@6 | |
1088 char v10; // c2@6 | |
1089 unsigned __int8 v11; // c3@6 | |
1090 double v12; // st6@7 | |
1091 float v13; // ST04_4@7 | |
1092 float v14; // ST00_4@7 | |
1093 double v15; // st7@7 | |
1094 double v16; // st6@8 | |
1095 float v17; // ST04_4@8 | |
1096 float v18; // ST00_4@8 | |
1097 double v19; // st7@8 | |
1098 | |
1099 //UNDEF(v1); | |
1100 if ( p->vWorldViewPosition.x < 300.0 | |
1101 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1102 v3 = 0, | |
1103 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1104 //BYTE1(result) = HIBYTE(v1), |
0 | 1105 !(v2 | v4)) ) |
1106 { | |
1107 if ( p->vWorldViewPosition.x < 300.0 ) | |
1108 { | |
1109 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1110 v7 = 0; | |
1111 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1112 //BYTE1(result) = HIBYTE(v1); |
0 | 1113 if ( !(v6 | v8) ) |
1114 { | |
921 | 1115 //LOBYTE(result) = 0; |
1116 return false; | |
0 | 1117 } |
1118 } | |
1119 v9 = 300.0 < p->vWorldViewPosition.x; | |
1120 v10 = 0; | |
1121 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1122 //BYTE1(result) = HIBYTE(v1); |
0 | 1123 if ( v9 | v11 ) |
1124 { | |
1125 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1126 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1127 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1128 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1129 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1130 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1131 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1132 } | |
1133 else | |
1134 { | |
1135 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1136 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1137 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1138 v15 = 300.0 - p->vWorldViewPosition.x; | |
1139 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1140 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1141 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1142 } | |
1143 } | |
921 | 1144 //LOBYTE(result) = 1; |
1145 return true; | |
0 | 1146 } |
1147 | |
1148 //----- (004268E3) -------------------------------------------------------- | |
1149 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1150 { | |
1151 unsigned int v1; // eax@1 | |
1152 unsigned int v2; // edx@1 | |
1153 int v3; // eax@1 | |
1154 int v4; // edx@1 | |
1155 unsigned int v5; // ecx@1 | |
1156 | |
1157 v1 = uColor >> 9; | |
1158 v2 = uColor >> 6; | |
1159 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1160 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1161 v3 = v2 | v1; | |
1162 v4 = (unsigned __int8)uColor >> 3; | |
1163 v5 = uColor >> 16; | |
1164 LOWORD(v5) = v5 & 0x8000; | |
1165 return v5 | v4 | v3; | |
1166 } | |
1167 | |
1168 //----- (0042690D) -------------------------------------------------------- | |
1169 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1170 { | |
1171 unsigned int v1; // eax@1 | |
1172 unsigned int v2; // edx@1 | |
1173 | |
1174 v1 = a1 >> 8; | |
1175 v2 = a1 >> 5; | |
1176 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1177 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1178 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1179 } | |
1180 //----- (00426947) -------------------------------------------------------- | |
1181 void __cdecl sub_426947() | |
1182 { | |
893 | 1183 stru_50C198.field_0 = 0; |
0 | 1184 dword_50C994 = 0; |
1185 dword_50C998_turnbased_icon_1A = 0; | |
1186 } | |
1187 // 50C968: using guessed type int dword_50C968; | |
1188 // 50C994: using guessed type int dword_50C994; | |
1189 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1190 | |
1191 //----- (004269A2) -------------------------------------------------------- | |
958 | 1192 void __fastcall GivePartyExp(unsigned int pEXPNum) |
0 | 1193 { |
958 | 1194 signed int pActivePlayerCount; // ecx@1 |
1195 int pLearningPercent; // eax@13 | |
1196 | |
1197 pActivePlayerCount = 0; | |
1198 for ( uint i = 0; i < 4; ++i ) | |
1199 { | |
1200 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) | |
1201 pActivePlayerCount ++; | |
1202 } | |
1203 if ( pActivePlayerCount ) | |
0 | 1204 { |
958 | 1205 pEXPNum = pEXPNum / pActivePlayerCount; |
1206 for ( uint i = 0; i < 4; ++i ) | |
0 | 1207 { |
958 | 1208 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) |
0 | 1209 { |
958 | 1210 if ( pEXPNum ) |
0 | 1211 { |
958 | 1212 pLearningPercent = pParty->pPlayers[i].GetLearningPercent(); |
1213 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100; | |
1214 pParty->pPlayers[i].uExperience += pEXPNum; | |
1215 if ( pParty->pPlayers[i].uExperience > 4000000000i64 ) | |
0 | 1216 { |
958 | 1217 pParty->pPlayers[i].uExperience = 0; |
0 | 1218 } |
1219 } | |
1220 } | |
1221 } | |
1222 } | |
1223 } | |
1224 | |
1225 //----- (00426A5A) -------------------------------------------------------- | |
1226 void stru319::LootActor(Actor *pActor) | |
1227 { | |
1228 signed int v2; // edi@1 | |
1229 char v3; // zf@1 | |
1230 unsigned int v4; // eax@13 | |
1231 unsigned int v5; // esi@13 | |
1232 int v6; // eax@14 | |
1233 unsigned __int8 v7; // al@30 | |
1234 Party *v8; // esi@34 | |
1235 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1236 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1237 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1238 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1239 int v13; // [sp+30h] [bp-8h]@1 | |
1240 int v14; // [sp+34h] [bp-4h]@1 | |
1241 | |
1242 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1243 Dst.Reset(); | |
1244 v2 = 0; | |
1245 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1246 v13 = 0; | |
1247 v14 = 0; | |
1248 if ( v3 ) | |
1249 { | |
1250 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1251 goto LABEL_9; | |
1252 do | |
1253 { | |
1254 ++v2; | |
1255 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1256 } | |
1257 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1258 } | |
1259 else | |
1260 { | |
1261 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1262 goto LABEL_9; | |
377 | 1263 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1264 pActor->array_000234[3].Reset(); |
1265 } | |
1266 if ( v14 ) | |
1267 { | |
1268 party_finds_gold(v14, 0); | |
1269 viewparams->bRedrawGameUI = 1; | |
1270 } | |
1271 LABEL_9: | |
1272 if ( pActor->uCarriedItemID ) | |
1273 { | |
1274 Dst.Reset(); | |
1275 Dst.uItemID = pActor->uCarriedItemID; | |
1276 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1277 if ( v14 ) | |
721 | 1278 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1279 else |
721 | 1280 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1281 ShowStatusBarString(pTmpBuf2, 2u); |
1282 v4 = Dst.uItemID; | |
1283 v5 = Dst.uItemID; | |
1284 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1285 { | |
1286 v5 = Dst.uItemID; | |
1287 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1288 Dst.uNumCharges = v6; | |
1289 Dst.uMaxCharges = v6; | |
1290 v4 = Dst.uItemID; | |
1291 } | |
1292 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1293 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1294 pItemsTable->SetSpecialBonus(&Dst); |
1295 if ( !pParty->AddItem(&Dst) ) | |
1296 pParty->SetHoldingItem(&Dst); | |
1297 pActor->uCarriedItemID = 0; | |
1298 if ( pActor->array_000234[0].uItemID ) | |
1299 { | |
1300 if ( !pParty->AddItem(pActor->array_000234) ) | |
1301 { | |
1302 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1303 pParty->SetHoldingItem(pActor->array_000234); | |
1304 } | |
1305 pActor->array_000234[0].Reset(); | |
1306 } | |
1307 if ( pActor->array_000234[1].uItemID ) | |
1308 { | |
1309 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1310 { | |
1311 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1312 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1313 } | |
1314 pActor->array_000234[1].Reset(); | |
1315 } | |
1316 LABEL_55: | |
1317 pActor->Remove(); | |
1318 return; | |
1319 } | |
1320 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1321 { | |
1322 if ( pActor->array_000234[3].uItemID ) | |
1323 { | |
1324 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1325 pActor->array_000234[3].Reset(); | |
1326 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1327 if ( v14 ) | |
721 | 1328 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1329 else |
721 | 1330 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1331 ShowStatusBarString(pTmpBuf2, 2u); |
1332 if ( !pParty->AddItem(&Dst) ) | |
1333 pParty->SetHoldingItem(&Dst); | |
1334 v13 = 1; | |
1335 } | |
1336 goto LABEL_44; | |
1337 } | |
1338 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1339 { | |
1340 LABEL_44: | |
1341 v8 = pParty; | |
1342 goto LABEL_45; | |
1343 } | |
1344 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1345 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1346 if ( v14 ) | |
721 | 1347 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1348 else |
721 | 1349 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1350 ShowStatusBarString(pTmpBuf2, 2u); |
1351 v8 = pParty; | |
1352 if ( !pParty->AddItem(&Dst) ) | |
1353 pParty->SetHoldingItem(&Dst); | |
1354 v13 = 1; | |
1355 LABEL_45: | |
1356 if ( pActor->array_000234[0].uItemID ) | |
1357 { | |
1358 if ( !v8->AddItem(pActor->array_000234) ) | |
1359 { | |
1360 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1361 v8->SetHoldingItem(pActor->array_000234); | |
1362 v13 = 1; | |
1363 } | |
1364 pActor->array_000234[0].Reset(); | |
1365 } | |
1366 if ( pActor->array_000234[1].uItemID ) | |
1367 { | |
1368 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1369 { | |
1370 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1371 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1372 v13 = 1; | |
1373 } | |
1374 pActor->array_000234[1].Reset(); | |
1375 } | |
1376 if ( !v13 || rand() % 100 < 90 ) | |
1377 goto LABEL_55; | |
1378 } | |
1379 | |
1380 //----- (00426E10) -------------------------------------------------------- | |
1381 int stru319::which_player_would_attack(Actor *pActor) | |
1382 { | |
1383 signed int v2; // ebx@1 | |
1384 int v3; // ecx@2 | |
1385 signed int v4; // edx@3 | |
1386 char v5; // zf@3 | |
1387 unsigned int v6; // eax@3 | |
1388 int v7; // eax@6 | |
1389 int v8; // eax@7 | |
1390 int v9; // eax@8 | |
1391 int v10; // eax@9 | |
1392 int v11; // eax@10 | |
1393 int v12; // eax@11 | |
1394 int v13; // esi@35 | |
1395 signed int v14; // edi@37 | |
1396 enum CHARACTER_RACE v15; // eax@44 | |
1397 Player *v16; // ecx@47 | |
1398 unsigned __int8 v17; // sf@50 | |
1399 unsigned __int8 v18; // of@50 | |
1400 int v19; // esi@52 | |
1401 Player *v20; // ecx@53 | |
1402 int result; // eax@57 | |
1403 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1404 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1405 int v24; // [sp+138h] [bp-10h]@2 | |
1406 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1407 int v26; // [sp+140h] [bp-8h]@1 | |
1408 int v27; // [sp+144h] [bp-4h]@1 | |
1409 | |
1410 v27 = -1; | |
1411 v26 = -1; | |
1412 v25 = -1; | |
1413 v2 = 0; | |
1414 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1415 { | |
1416 v3 = 0; | |
1417 v24 = 0; | |
1418 do | |
1419 { | |
1420 v4 = 1; | |
1421 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1422 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1423 v22[v3] = v6; | |
1424 if ( !v5 ) | |
1425 { | |
1426 if ( (signed int)v6 > 128 ) | |
1427 { | |
1428 switch ( v6 ) | |
1429 { | |
1430 case 0x100u: | |
1431 v27 = 8; | |
1432 break; | |
1433 case 0x200u: | |
1434 v25 = 0; | |
1435 break; | |
1436 case 0x400u: | |
1437 v25 = 1; | |
1438 break; | |
1439 case 0x800u: | |
1440 v26 = 0; | |
1441 break; | |
1442 case 0x1000u: | |
1443 v26 = 1; | |
1444 break; | |
1445 case 0x2000u: | |
1446 v26 = 3; | |
1447 break; | |
1448 case 0x4000u: | |
1449 v26 = 2; | |
1450 break; | |
1451 } | |
1452 } | |
1453 else | |
1454 { | |
1455 if ( v6 == 128 ) | |
1456 { | |
1457 v27 = 4; | |
1458 } | |
1459 else | |
1460 { | |
1461 v7 = v6 - 1; | |
1462 if ( v7 ) | |
1463 { | |
1464 v8 = v7 - 1; | |
1465 if ( v8 ) | |
1466 { | |
1467 v9 = v8 - 2; | |
1468 if ( v9 ) | |
1469 { | |
1470 v10 = v9 - 4; | |
1471 if ( v10 ) | |
1472 { | |
1473 v11 = v10 - 8; | |
1474 if ( v11 ) | |
1475 { | |
1476 v12 = v11 - 16; | |
1477 if ( v12 ) | |
1478 { | |
1479 if ( v12 == 32 ) | |
1480 v27 = 20; | |
1481 } | |
1482 else | |
1483 { | |
1484 v27 = 32; | |
1485 } | |
1486 } | |
1487 else | |
1488 { | |
1489 v27 = 24; | |
1490 } | |
1491 } | |
1492 else | |
1493 { | |
1494 v27 = 28; | |
1495 } | |
1496 } | |
1497 else | |
1498 { | |
1499 v27 = 16; | |
1500 } | |
1501 } | |
1502 else | |
1503 { | |
1504 v27 = 12; | |
1505 } | |
1506 } | |
1507 else | |
1508 { | |
1509 v27 = 0; | |
1510 } | |
1511 } | |
1512 } | |
1513 v2 = 0; | |
1514 v13 = 0; | |
1515 while ( 1 ) | |
1516 { | |
1517 v14 = 0; | |
135 | 1518 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1519 v14 = v4; |
1520 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1521 v14 = v4; | |
1522 if ( v26 != -1 ) | |
1523 { | |
1524 v15 = pPlayers[v13 + 1]->GetRace(); | |
1525 if ( v26 == v15 ) | |
1526 v14 = 1; | |
1527 } | |
1528 if ( v14 == 1 ) | |
1529 { | |
1530 v16 = pPlayers[v13 + 1]; | |
1531 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1532 v23[v2++] = v13; | |
1533 } | |
1534 ++v13; | |
1535 if ( v13 >= 4 ) | |
1536 break; | |
1537 v4 = 1; | |
1538 } | |
1539 } | |
1540 v3 = v24 + 1; | |
1541 v18 = __OFSUB__(v24 + 1, 15); | |
1542 v17 = v24++ - 14 < 0; | |
1543 } | |
1544 while ( v17 ^ v18 ); | |
1545 if ( v2 ) | |
1546 goto LABEL_61; | |
1547 } | |
1548 v19 = 0; | |
1549 do | |
1550 { | |
1551 v20 = pPlayers[v19 + 1]; | |
1552 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1553 v23[v2++] = v19; | |
1554 ++v19; | |
1555 } | |
1556 while ( v19 < 4 ); | |
1557 if ( v2 ) | |
1558 LABEL_61: | |
1559 result = v23[rand() % v2]; | |
1560 else | |
1561 result = 0; | |
1562 return result; | |
1563 } | |
1564 | |
1565 //----- (0042704B) -------------------------------------------------------- | |
1566 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1567 { | |
1568 stru319 *v3; // edi@1 | |
1569 signed int v4; // ebx@5 | |
1570 signed int v5; // edi@5 | |
1571 | |
1572 v3 = this; | |
1573 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1574 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1575 && rand() % 100 < 5 ) | |
1576 pActor->_44FD29(a2); | |
1577 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1578 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1579 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1580 return 2; | |
1581 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1582 return 3; | |
1583 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1584 } | |
1585 | |
1586 //----- (00427102) -------------------------------------------------------- | |
1587 int stru319::_427102(Actor *pActor, signed int a2) | |
1588 { | |
1589 unsigned __int8 v3; // cf@11 | |
1590 unsigned __int8 v4; // zf@11 | |
1591 SpellBuff *v6; // ecx@46 | |
89 | 1592 Player *v7; // esi@49 |
0 | 1593 signed int v8; // edx@50 |
89 | 1594 SpellBuff *v9; // ecx@50 |
0 | 1595 |
597 | 1596 switch(a2) |
0 | 1597 { |
597 | 1598 case 77: |
1599 { | |
1600 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1601 return 0; | |
1602 return 1; | |
1603 } | |
1604 case 80: | |
1605 { | |
1606 v6 = pParty->pPartyBuffs; | |
1607 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1608 { | |
1609 ++v6; | |
1610 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1611 { | |
1612 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1613 v8 = 0; | |
1614 v9 = v7->pPlayerBuffs; | |
1615 while ( v9->uExpireTime <= 0i64 ) | |
1616 { | |
1617 ++v8; | |
1618 ++v9; | |
1619 if ( v8 >= 24 ) | |
1620 { | |
1621 ++v7; | |
1622 if ( v7 <= &pParty->pPlayers[3] ) | |
1623 { | |
1624 v8 = 0; | |
1625 v9 = v7->pPlayerBuffs; | |
1626 } | |
1627 else | |
1628 return 0; | |
1629 } | |
1630 } | |
1631 return 1; | |
1632 } | |
1633 } | |
1634 return 1; | |
1635 } | |
1636 case 85: | |
1637 { | |
1638 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1639 return 1; | |
1640 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1641 return 0; | |
1642 v3 = 0; | |
1643 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1644 break; | |
1645 } | |
1646 case 86: | |
1647 { | |
0 | 1648 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1649 return 1; |
0 | 1650 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1651 return 0; |
0 | 1652 v3 = 0; |
1653 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1654 break; |
1655 } | |
1656 case 95: | |
1657 { | |
1658 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1659 return 1; | |
0 | 1660 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1661 return 0; |
0 | 1662 v3 = 0; |
1663 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1664 break; |
1665 } | |
1666 case 73: | |
1667 { | |
1668 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1669 return 1; | |
1670 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1671 return 0; | |
1672 v3 = 0; | |
1673 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1674 break; | |
1675 } | |
1676 case 5: | |
1677 { | |
1678 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1679 return 1; | |
1680 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1681 return 0; | |
1682 v3 = 0; | |
1683 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1684 break; | |
1685 } | |
1686 case 17: | |
1687 { | |
1688 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1689 return 1; | |
1690 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1691 return 0; | |
1692 v3 = 0; | |
1693 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1694 break; | |
1695 } | |
1696 case 38: | |
89 | 1697 { |
597 | 1698 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1699 return 1; | |
1700 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1701 return 0; | |
1702 v3 = 0; | |
1703 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1704 } | |
1705 case 46: | |
1706 { | |
1707 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1708 return 1; |
597 | 1709 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1710 return 0; | |
1711 v3 = 0; | |
1712 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1713 break; | |
1714 } | |
1715 case 47: | |
1716 { | |
1717 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1718 return 1; | |
1719 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1720 return 0; | |
1721 v3 = 0; | |
1722 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1723 break; | |
1724 } | |
1725 case 51: | |
1726 { | |
1727 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1728 return 1; | |
1729 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1730 { | |
89 | 1731 v3 = 0; |
1732 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1733 } | |
1734 else | |
597 | 1735 return 0; |
1736 break; | |
1737 } | |
1738 default: | |
89 | 1739 { |
597 | 1740 return 1; |
89 | 1741 } |
0 | 1742 } |
1743 if ( !(v3 | v4) ) | |
1744 return 0; | |
1745 return 1; | |
1746 } | |
1747 | |
1748 //----- (004272F5) -------------------------------------------------------- | |
1749 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1750 { | |
1751 signed int v5; // esi@1 | |
1752 signed int v6; // edi@1 | |
1753 int v7; // esi@8 | |
1754 int v8; // eax@9 | |
1755 int v9; // edx@11 | |
1756 int v10; // edx@13 | |
1757 int v11; // esi@13 | |
1758 unsigned __int8 v12; // sf@13 | |
1759 unsigned __int8 v13; // of@13 | |
1760 int v14; // edx@14 | |
1761 int v15; // eax@14 | |
1762 signed int result; // eax@17 | |
1763 | |
1764 v5 = pActor->pMonsterInfo.uAC; | |
1765 v6 = 0; | |
1766 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1767 v5 /= 2; | |
1768 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1769 v6 = pActor->pActorBuffs[15].uPower; | |
1770 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1771 v6 = pActor->pActorBuffs[16].uPower; | |
1772 v7 = v6 + v5; | |
1773 if ( a3 ) | |
1774 v8 = pPlayer->GetRangedAttack(); | |
1775 else | |
1776 v8 = pPlayer->GetActualAttack(0); | |
1777 v9 = rand() % (v7 + 2 * v8 + 30); | |
1778 if ( a3 == 2 ) | |
1779 { | |
1780 v14 = a4 + v9; | |
1781 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1782 } | |
1783 else | |
1784 { | |
1785 if ( a3 != 3 ) | |
1786 { | |
1787 v10 = a4 + v9; | |
1788 v11 = v7 + 15; | |
1789 v13 = __OFSUB__(v10, v11); | |
1790 v12 = v10 - v11 < 0; | |
1791 goto LABEL_16; | |
1792 } | |
1793 v14 = a4 + v9; | |
1794 v15 = 2 * v7 + 30; | |
1795 } | |
1796 v13 = __OFSUB__(v14, v15); | |
1797 v12 = v14 - v15 < 0; | |
1798 LABEL_16: | |
1799 if ( v12 ^ v13 ) | |
1800 result = 0; | |
1801 else | |
1802 result = 1; | |
1803 return result; | |
1804 } | |
1805 | |
1806 //----- (004273BB) -------------------------------------------------------- | |
1807 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1808 { | |
1809 Actor *v5; // ecx@1 | |
1810 signed int v6; // ebx@1 | |
1811 signed int v7; // esi@1 | |
1812 unsigned __int8 v8; // zf@1 | |
1813 unsigned __int8 v9; // sf@1 | |
1814 int v10; // ebx@10 | |
1815 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1816 | |
1817 v5 = a2; | |
1818 v6 = a2->pMonsterInfo.uAC; | |
1819 v7 = 0; | |
1820 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1821 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1822 a2a = 0; | |
1823 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1824 v6 /= 2; | |
1825 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1826 v7 = v5->pActorBuffs[14].uPower; | |
1827 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1828 v7 = v5->pActorBuffs[16].uPower; | |
1829 v10 = v7 + v6; | |
1830 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1831 a2a = pActor->pActorBuffs[14].uPower; | |
1832 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1833 a2a = pActor->pActorBuffs[17].uPower; | |
1834 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1835 { | |
1836 a2a += pActor->pActorBuffs[11].uPower; | |
1837 pActor->pActorBuffs[11].Reset(); | |
1838 } | |
1839 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1840 } | |
1841 | |
1842 //----- (004274AD) -------------------------------------------------------- | |
1843 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1844 { | |
1845 signed int v3; // edi@1 | |
1846 signed int v4; // esi@8 | |
1847 int v5; // esi@8 | |
1848 | |
1849 v3 = 0; | |
1850 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1851 v3 = pActor->pActorBuffs[14].uPower; | |
1852 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1853 v3 = pActor->pActorBuffs[17].uPower; | |
1854 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1855 { | |
1856 v3 += pActor->pActorBuffs[11].uPower; | |
1857 pActor->pActorBuffs[11].Reset(); | |
1858 } | |
1859 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1860 v5 = rand() % v4 + 1; | |
1861 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1862 } | |
1863 | |
1864 //----- (00427546) -------------------------------------------------------- | |
1865 int stru319::_427546(int a2) | |
1866 { | |
1867 int result; // eax@2 | |
1868 | |
1869 if ( a2 >= 0 ) | |
1870 { | |
1871 if ( a2 >= 1 ) | |
1872 result = (a2 >= 2) + 2; | |
1873 else | |
1874 result = 1; | |
1875 } | |
1876 else | |
1877 { | |
1878 result = 0; | |
1879 } | |
1880 return result; | |
1881 } | |
1882 | |
1883 //----- (0042756B) -------------------------------------------------------- | |
1884 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1885 { | |
1886 int v4; // edx@1 | |
1887 int v5; // ecx@1 | |
1888 signed int v6; // eax@4 | |
1889 signed int result; // eax@17 | |
1890 signed int v8; // esi@18 | |
1891 | |
1892 v4 = 0; | |
1893 v5 = 0; | |
1894 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1895 v5 = pActor->pActorBuffs[14].uPower; | |
1896 switch ( a2 ) | |
1897 { | |
1898 case 4: | |
1899 v6 = pActor->pMonsterInfo.uResPhysical; | |
1900 break; | |
1901 case 0: | |
1902 v6 = pActor->pMonsterInfo.uResFire; | |
1903 goto LABEL_12; | |
1904 case 1: | |
1905 v6 = pActor->pMonsterInfo.uResAir; | |
1906 goto LABEL_12; | |
1907 case 2: | |
1908 v6 = pActor->pMonsterInfo.uResWater; | |
1909 goto LABEL_12; | |
1910 case 3: | |
1911 v6 = pActor->pMonsterInfo.uResEarth; | |
1912 goto LABEL_12; | |
1913 case 6: | |
1914 v6 = pActor->pMonsterInfo.uResSpirit; | |
1915 break; | |
1916 case 7: | |
1917 v6 = pActor->pMonsterInfo.uResMind; | |
1918 goto LABEL_12; | |
1919 case 8: | |
1920 v6 = pActor->pMonsterInfo.uResBody; | |
1921 LABEL_12: | |
1922 v4 = v5; | |
1923 break; | |
1924 case 9: | |
1925 v6 = pActor->pMonsterInfo.uResLight; | |
1926 break; | |
1927 case 10: | |
1928 v6 = pActor->pMonsterInfo.uResDark; | |
1929 break; | |
1930 default: | |
1931 v6 = 0; | |
1932 break; | |
1933 } | |
1934 if ( v6 < 200 ) | |
1935 { | |
1936 v8 = v4 + v6 + 30; | |
1937 if ( rand() % v8 >= 30 ) | |
1938 { | |
1939 a3 >>= 1; | |
1940 if ( rand() % v8 >= 30 ) | |
1941 { | |
1942 a3 >>= 1; | |
1943 if ( rand() % v8 >= 30 ) | |
1944 { | |
1945 a3 >>= 1; | |
1946 if ( rand() % v8 >= 30 ) | |
1947 a3 >>= 1; | |
1948 } | |
1949 } | |
1950 } | |
1951 result = a3; | |
1952 } | |
1953 else | |
1954 { | |
1955 result = 0; | |
1956 } | |
1957 return result; | |
1958 } | |
1959 | |
1960 //----- (00427662) -------------------------------------------------------- | |
1961 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
1962 { | |
1963 Actor *v3; // edi@2 | |
1964 signed int v4; // esi@2 | |
1965 bool result; // eax@13 | |
1966 | |
1967 switch ( uType ) | |
1968 { | |
1969 case 0u: | |
1970 v3 = pActor; | |
1971 v4 = pActor->pMonsterInfo.uResFire; | |
1972 goto LABEL_12; | |
1973 case 1u: | |
1974 v3 = pActor; | |
1975 v4 = pActor->pMonsterInfo.uResAir; | |
1976 goto LABEL_12; | |
1977 case 2u: | |
1978 v3 = pActor; | |
1979 v4 = pActor->pMonsterInfo.uResWater; | |
1980 goto LABEL_12; | |
1981 case 3u: | |
1982 v3 = pActor; | |
1983 v4 = pActor->pMonsterInfo.uResEarth; | |
1984 goto LABEL_12; | |
1985 case 7u: | |
1986 v3 = pActor; | |
1987 v4 = pActor->pMonsterInfo.uResMind; | |
1988 goto LABEL_12; | |
1989 case 6u: | |
1990 v3 = pActor; | |
1991 v4 = pActor->pMonsterInfo.uResSpirit; | |
1992 goto LABEL_12; | |
1993 case 8u: | |
1994 v3 = pActor; | |
1995 v4 = pActor->pMonsterInfo.uResBody; | |
1996 goto LABEL_12; | |
1997 case 9u: | |
1998 v3 = pActor; | |
1999 v4 = pActor->pMonsterInfo.uResLight; | |
2000 goto LABEL_12; | |
2001 case 0xAu: | |
2002 v3 = pActor; | |
2003 v4 = pActor->pMonsterInfo.uResDark; | |
2004 goto LABEL_12; | |
2005 case 4u: | |
2006 v3 = pActor; | |
2007 v4 = pActor->pMonsterInfo.uResPhysical; | |
2008 LABEL_12: | |
2009 if ( v4 < 200 ) | |
2010 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2011 else | |
2012 result = 0; | |
2013 break; | |
2014 default: | |
2015 result = 1; | |
2016 break; | |
2017 } | |
2018 return result; | |
2019 } | |
2020 | |
2021 //----- (00427769) -------------------------------------------------------- | |
2022 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2023 { | |
2024 bool result; // eax@2 | |
2025 | |
710 | 2026 __debugbreak(); // refactor |
0 | 2027 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2028 result = 1; | |
2029 else | |
2030 result = 0; | |
2031 return result; | |
2032 } | |
2033 | |
2034 //----- (0042777D) -------------------------------------------------------- | |
319 | 2035 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2036 { |
370 | 2037 //bool result; // eax@2 |
486 | 2038 //__int16 v6; // bx@4 |
437 | 2039 //Player *v7; // eax@4 |
486 | 2040 //char v8; // zf@12 |
0 | 2041 unsigned __int16 v9; // cx@16 |
2042 unsigned int v10; // eax@18 | |
2043 unsigned __int8 v11; // sf@18 | |
2044 unsigned __int8 v12; // of@18 | |
2045 unsigned __int16 v13; // cx@21 | |
2046 unsigned int v14; // eax@23 | |
486 | 2047 //stru277 *v15; // esi@27 |
2048 //stru277 *v16; // eax@28 | |
832 | 2049 //GUIWindow *v17; // eax@43 |
2050 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2051 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2052 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2053 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2054 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2055 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2056 //int v24; // [sp-18h] [bp-30h]@44 | |
2057 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2058 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2059 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2060 //char *v28; // [sp-8h] [bp-20h]@43 | |
2061 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2062 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2063 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2064 | |
2065 //a3a = uPlayerID; | |
2066 //a2a = a1; | |
370 | 2067 |
2068 //if ( pParty->bTurnBasedModeOn != 1 | |
2069 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2070 if (pParty->bTurnBasedModeOn) | |
0 | 2071 { |
370 | 2072 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2073 return; | |
2074 } | |
2075 | |
2076 | |
486 | 2077 //v6 = a5; |
437 | 2078 //v7 = &pParty->pPlayers[uPlayerID]; |
2079 assert(uPlayerID < 4); | |
2080 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2081 if ( !(a5 & 0x10) ) |
2082 { | |
2083 switch ( a1 ) | |
2084 { | |
486 | 2085 case SPELL_SPIRIT_FATE: |
2086 case SPELL_BODY_FIRST_AID: | |
2087 case SPELL_DARK_REANIMATE: | |
2088 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2089 a5 |= 0x0100; | |
0 | 2090 break; |
486 | 2091 |
2092 case SPELL_FIRE_FIRE_AURA: | |
2093 case SPELL_WATER_RECHARGE_ITEM: | |
2094 case SPELL_WATER_ENCHANT_ITEM: | |
2095 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2096 //LOBYTE(v6) = a5 | 0x80; | |
2097 a5 |= 0x0080; | |
0 | 2098 break; |
486 | 2099 |
2100 case SPELL_FIRE_FIRE_BOLT: | |
2101 case SPELL_FIRE_FIREBALL: | |
2102 case SPELL_FIRE_INCINERATE: | |
2103 case SPELL_AIR_LIGHNING_BOLT: | |
2104 case SPELL_AIR_IMPLOSION: | |
2105 case SPELL_WATER_POISON_SPRAY: | |
2106 case SPELL_WATER_ICE_BOLT: | |
2107 case SPELL_WATER_ACID_BURST: | |
2108 case SPELL_WATER_ICE_BLAST: | |
2109 case SPELL_EARTH_STUN: | |
2110 case SPELL_EARTH_SLOW: | |
2111 case SPELL_EARTH_DEADLY_SWARM: | |
2112 case SPELL_EARTH_BLADES: | |
2113 case SPELL_EARTH_MASS_DISTORTION: | |
2114 case SPELL_SPIRIT_SPIRIT_LASH: | |
2115 case SPELL_MIND_MIND_BLAST: | |
2116 case SPELL_MIND_CHARM: | |
2117 case SPELL_MIND_PSYCHIC_SHOCK: | |
2118 case SPELL_BODY_HARM: | |
2119 case SPELL_BODY_FLYING_FIST: | |
2120 case SPELL_LIGHT_LIGHT_BOLT: | |
2121 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2122 case SPELL_LIGHT_SUNRAY: | |
2123 case SPELL_DARK_TOXIC_CLOUD: | |
2124 case SPELL_DARK_SHRINKING_RAY: | |
2125 case SPELL_DARK_SHARPMETAL: | |
2126 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2127 if ( !a6 ) |
486 | 2128 a5 |= 0x0008; |
0 | 2129 break; |
486 | 2130 case SPELL_MIND_TELEPATHY: |
2131 case SPELL_MIND_BERSERK: | |
2132 case SPELL_MIND_ENSLAVE: | |
2133 case SPELL_LIGHT_PARALYZE: | |
2134 case SPELL_DARK_CONTROL_UNDEAD: | |
2135 //LABEL_9: | |
2136 //v6 = a5 | 8; | |
2137 a5 |= 0x0008; | |
0 | 2138 break; |
486 | 2139 |
2140 case SPELL_EARTH_TELEKINESIS: | |
2141 a5 |= 0x0040; | |
2142 break; | |
2143 | |
2144 case SPELL_SPIRIT_BLESS: | |
2145 if (a4 && ~a4 & 0x01C0) | |
961 | 2146 //goto LABEL_25; |
2147 { | |
2148 a5 |= 0x0002; | |
2149 break; | |
2150 } | |
1108
a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents:
1106
diff
changeset
|
2151 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0) |
961 | 2152 //goto LABEL_25; |
2153 { | |
2154 a5 |= 0x0002; | |
2155 break; | |
2156 } | |
0 | 2157 break; |
486 | 2158 |
2159 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2160 v9 = a4; |
2161 if ( !a4 ) | |
437 | 2162 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
961 | 2163 //goto LABEL_18; |
2164 v10 = SkillToMastery(v9); | |
2165 v12 = __OFSUB__(v10, 3); | |
2166 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2167 //goto LABEL_24; | |
2168 if ( v11 ^ v12 ) | |
2169 { | |
2170 a5 |= 0x0002; | |
2171 break; | |
2172 } | |
2173 break; | |
486 | 2174 |
2175 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2176 v9 = a4; |
2177 if ( !a4 ) | |
437 | 2178 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
961 | 2179 //LABEL_18: |
0 | 2180 v10 = SkillToMastery(v9); |
2181 v12 = __OFSUB__(v10, 3); | |
2182 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
961 | 2183 //goto LABEL_24; |
2184 if ( v11 ^ v12 ) | |
2185 { | |
2186 a5 |= 0x0002; | |
2187 break; | |
2188 } | |
2189 break; | |
486 | 2190 |
2191 case SPELL_BODY_HAMMERHANDS: | |
0 | 2192 v13 = a4; |
2193 if ( !a4 ) | |
437 | 2194 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2195 v14 = SkillToMastery(v13); |
2196 v12 = __OFSUB__(v14, 4); | |
2197 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
961 | 2198 //LABEL_24: |
0 | 2199 if ( v11 ^ v12 ) |
961 | 2200 //goto LABEL_25; |
2201 { | |
2202 a5 |= 0x0002; | |
2203 break; | |
2204 } | |
0 | 2205 break; |
486 | 2206 |
2207 case SPELL_EARTH_STONE_TO_FLESH: | |
2208 case SPELL_SPIRIT_REMOVE_CURSE: | |
2209 case SPELL_SPIRIT_RAISE_DEAD: | |
2210 case SPELL_SPIRIT_RESSURECTION: | |
2211 case SPELL_MIND_REMOVE_FEAR: | |
2212 case SPELL_MIND_CURE_PARALYSIS: | |
2213 case SPELL_MIND_CURE_INSANITY: | |
2214 case SPELL_BODY_CURE_WEAKNESS: | |
2215 case SPELL_BODY_REGENERATION: | |
2216 case SPELL_BODY_CURE_POISON: | |
2217 case SPELL_BODY_CURE_DISEASE: | |
961 | 2218 //LABEL_25: |
486 | 2219 //v6 = a5 | 2; |
2220 a5 |= 0x0002; | |
0 | 2221 break; |
486 | 2222 |
2223 case SPELL_DARK_SACRIFICE: | |
2224 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2225 a5 |= 0x0200; | |
0 | 2226 break; |
2227 default: | |
2228 break; | |
2229 } | |
2230 } | |
370 | 2231 |
486 | 2232 |
2233 if (a5 & 0x3CA) | |
0 | 2234 { |
924 | 2235 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2236 for (uint i = 0; i < 10; ++i) |
924 | 2237 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2238 { |
924 | 2239 pCastSpellInfo[i].spellnum = 0; |
486 | 2240 break; |
2241 } | |
0 | 2242 } |
486 | 2243 |
924 | 2244 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2245 for (uint i = 0; i < 10; ++i) |
0 | 2246 { |
924 | 2247 auto spell = pCastSpellInfo + i; |
486 | 2248 if (!spell->spellnum) |
2249 continue; | |
2250 | |
2251 spell->spellnum = 0; | |
2252 if (spell->field_8 & 0x3CA) | |
0 | 2253 { |
486 | 2254 pGUIWindow_Settings->Release(); |
2255 pGUIWindow_Settings = nullptr; | |
2256 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2257 GameUI_Footer_TimeLeft = 0; |
486 | 2258 unk_50C9A0 = 0; |
2259 back_to_game(); | |
0 | 2260 } |
2261 } | |
486 | 2262 |
924 | 2263 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2264 if ( result != -1 ) |
2265 { | |
486 | 2266 if ( a5 & 2 ) |
0 | 2267 { |
2268 if ( pGUIWindow_Settings ) | |
319 | 2269 return; |
961 | 2270 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2271 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0); |
2272 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0); | |
2273 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0); | |
2274 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0); | |
319 | 2275 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2276 return; | |
0 | 2277 } |
486 | 2278 if ( a5 & 8 ) |
0 | 2279 { |
2280 if ( pGUIWindow_Settings ) | |
319 | 2281 return; |
832 | 2282 |
961 | 2283 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2284 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0); |
319 | 2285 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2286 return; | |
0 | 2287 } |
486 | 2288 if ( a5 & 0x40 ) |
0 | 2289 { |
2290 if ( pGUIWindow_Settings ) | |
319 | 2291 return; |
832 | 2292 |
961 | 2293 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
2294 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_BE, 0, 0, "", 0); | |
832 | 2295 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2296 return; | |
0 | 2297 } |
486 | 2298 if ( (char)a5 < 0 ) |
0 | 2299 { |
2300 if ( pGUIWindow_Settings ) | |
319 | 2301 return; |
0 | 2302 ++pIcons_LOD->uTexturePacksCount; |
2303 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2304 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2305 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2306 unk_50C9A0 = 1; |
2307 some_active_character = uActiveCharacter; | |
319 | 2308 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2309 return; | |
0 | 2310 } |
486 | 2311 if ( HIBYTE(a5) & 1 ) |
0 | 2312 { |
2313 if ( pGUIWindow_Settings ) | |
319 | 2314 return; |
961 | 2315 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2316 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0); |
2317 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0); | |
2318 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0); | |
2319 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0); | |
2320 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL); | |
961 | 2321 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2322 } |
486 | 2323 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2324 { |
961 | 2325 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
832 | 2326 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2327 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2328 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
960 | 2329 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", |
832 | 2330 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2331 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2332 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2333 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
960 | 2334 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", |
832 | 2335 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
998 | 2336 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0); |
2337 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0); | |
0 | 2338 } |
2339 } | |
2340 } | |
2341 | |
2342 //----- (00427D48) -------------------------------------------------------- | |
924 | 2343 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2344 { |
924 | 2345 CastSpellInfo *v2; // esi@1 |
0 | 2346 signed int v3; // ebx@1 |
2347 | |
2348 v2 = this; | |
2349 v3 = 10; | |
2350 do | |
2351 { | |
2352 if ( v2->spellnum ) | |
2353 { | |
2354 if ( v2->field_8 & 0x3CA ) | |
2355 { | |
2356 v2->spellnum = 0; | |
2357 pGUIWindow_Settings->Release(); | |
2358 pGUIWindow_Settings = 0; | |
2359 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2360 GameUI_Footer_TimeLeft = 0; |
0 | 2361 unk_50C9A0 = 0; |
2362 back_to_game(); | |
2363 } | |
2364 } | |
2365 ++v2; | |
2366 --v3; | |
2367 } | |
2368 while ( v3 ); | |
2369 } | |
2370 | |
2371 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2372 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2373 { |
2374 unsigned int result; // eax@1 | |
924 | 2375 CastSpellInfo *v7; // edx@1 |
2376 CastSpellInfo *v8; // ecx@5 | |
0 | 2377 |
2378 result = 0; | |
2379 v7 = this; | |
2380 while ( v7->spellnum ) | |
2381 { | |
2382 ++result; | |
2383 ++v7; | |
2384 if ( (signed int)result >= 10 ) | |
2385 goto LABEL_8; | |
2386 } | |
2387 v8 = &this[result]; | |
2388 v8->spellnum = a2; | |
2389 v8->uPlayerID = uPlayerID; | |
2390 if ( a5 & 0x10 ) | |
2391 v8->uPlayerID_2 = uPlayerID; | |
2392 v8->field_6 = 0; | |
488 | 2393 v8->spell_target_pid = 0; |
0 | 2394 v8->field_8 = a5; |
488 | 2395 v8->forced_spell_skill_level = skill_level; |
823 | 2396 v8->sound_id = spell_sound_id; |
0 | 2397 LABEL_8: |
2398 if ( result == 10 ) | |
2399 result = -1; | |
2400 return result; | |
2401 } | |
2402 | |
2403 //----- (00427E01) -------------------------------------------------------- | |
924 | 2404 void CastSpellInfo::_427E01_cast_spell() |
0 | 2405 { |
2406 int v2; // edi@1 | |
924 | 2407 CastSpellInfo *pCastSpell; // ebx@2 |
0 | 2408 signed int v6; // eax@14 |
2409 unsigned __int16 v11; // cx@45 | |
2410 unsigned __int8 v14; // zf@53 | |
2411 signed int i; // esi@76 | |
2412 __int16 v23; // ax@88 | |
2413 int v51; // eax@146 | |
2414 __int16 v52; // ax@153 | |
2415 signed __int64 v54; // qax@164 | |
1005 | 2416 Actor *v55; // edi@164 |
0 | 2417 signed __int64 v58; // qax@177 |
1005 | 2418 Actor *pActor; // edi@177 |
0 | 2419 unsigned __int16 v60; // ax@184 |
2420 int v61; // ecx@184 | |
89 | 2421 ItemGen *v69; // esi@211 |
0 | 2422 double v90; // st7@245 |
89 | 2423 Player *v92; // eax@255 |
0 | 2424 int v105; // edi@271 |
2425 __int16 v108; // ST1C_2@274 | |
2426 __int16 v109; // ST18_2@274 | |
2427 stru6 *v110; // eax@274 | |
2428 int v111; // eax@274 | |
2429 Actor *v112; // esi@278 | |
2430 int v113; // eax@278 | |
2431 int v114; // ebx@278 | |
2432 unsigned int v115; // ecx@278 | |
2433 int v116; // edx@279 | |
2434 int v117; // edx@281 | |
2435 int v118; // edx@283 | |
2436 signed int v122; // eax@286 | |
2437 int v127; // eax@296 | |
2438 int v153; // ecx@322 | |
2439 int v154; // eax@322 | |
2440 int v155; // eax@323 | |
2441 int v156; // eax@323 | |
2442 int v162; // edi@340 | |
2443 signed int v164; // eax@340 | |
2444 signed int v165; // edi@340 | |
2445 signed int v168; // edi@343 | |
2446 int v169; // eax@344 | |
2447 signed int v174; // edi@355 | |
2448 int v188; // esi@369 | |
2449 int v189; // edi@369 | |
2450 signed int v191; // edi@379 | |
2451 signed int v205; // edi@405 | |
2452 int v206; // eax@407 | |
2453 __int16 v207; // cx@407 | |
2454 int v208; // eax@411 | |
2455 signed int v209; // ecx@412 | |
2456 int v210; // edx@412 | |
2457 signed int v211; // ecx@412 | |
2458 int v212; // eax@413 | |
2459 int v213; // eax@413 | |
2460 int v214; // eax@413 | |
2461 int v215; // eax@415 | |
2462 double v216; // st7@415 | |
2463 double v217; // st6@415 | |
2464 signed __int64 v218; // qtt@423 | |
2465 char v223; // al@438 | |
1009 | 2466 |
0 | 2467 int v227; // esi@453 |
2468 unsigned int v228; // edi@454 | |
2469 int v229; // edi@466 | |
1009 | 2470 |
1013 | 2471 ItemGen *v240; // ecx@472 |
0 | 2472 double v241; // st7@478 |
1013 | 2473 ItemGen *v245; // edi@492 |
0 | 2474 int v254; // eax@513 |
2475 int v255; // esi@513 | |
2476 int v256; // ecx@513 | |
2477 int v257; // edx@514 | |
2478 int v258; // ecx@514 | |
2479 char v259; // al@516 | |
2480 int v260; // eax@518 | |
2481 int v261; // esi@519 | |
2482 int v262; // edx@521 | |
1013 | 2483 int *v263; // ecx@521 |
0 | 2484 int v264; // esi@521 |
2485 int v265; // edx@521 | |
2486 int *ii; // eax@522 | |
2487 int v267; // eax@524 | |
2488 int v268; // eax@524 | |
2489 char v271; // al@531 | |
2490 int v277; // edx@548 | |
2491 int v278; // ecx@548 | |
2492 char v279; // al@550 | |
2493 int v280; // eax@552 | |
1013 | 2494 int *v281; // esi@553 |
0 | 2495 int v282; // edx@555 |
1013 | 2496 int *v283; // ecx@555 |
0 | 2497 int v284; // esi@555 |
2498 int v285; // edx@555 | |
2499 int *l; // eax@556 | |
2500 ItemGen *v294; // esi@575 | |
2501 int v295; // edx@575 | |
2502 int kk; // edi@575 | |
488 | 2503 char v313; // al@606pGame->GetStru6() |
0 | 2504 const char *v317; // ecx@617 |
2505 Player *v318; // ecx@619 | |
2506 unsigned int v319; // edi@627 | |
2507 int v323; // edi@635 | |
2508 char *v324; // eax@635 | |
2509 Player *v325; // ecx@640 | |
2510 int v328; // ecx@651 | |
2511 int v329; // ecx@652 | |
2512 int v330; // edi@654 | |
2513 signed int v342; // edi@668 | |
2514 signed int v343; // edi@670 | |
2515 unsigned __int64 v344; // ST08_8@670 | |
2516 Player *v351; // edi@680 | |
112 | 2517 Player *v357; // edi@694 |
0 | 2518 Actor *v369; // edi@705 |
2519 int v373; // eax@715 | |
2520 int v374; // eax@717 | |
2521 int v376; // eax@717 | |
2522 Player *v377; // ecx@719 | |
2523 int v381; // edi@727 | |
2524 int v382; // ecx@727 | |
2525 Player *v383; // eax@728 | |
2526 int v384; // eax@733 | |
2527 int v388; // edi@740 | |
2528 int v396; // eax@752 | |
2529 int v397; // eax@757 | |
2530 int v398; // eax@757 | |
2531 int v399; // eax@757 | |
1013 | 2532 Actor *v417; // eax@787 |
0 | 2533 int v418; // ecx@789 |
2534 __int16 v419; // ax@791 | |
2535 signed int v420; // eax@793 | |
1013 | 2536 ItemGen *v421; // edx@793 |
0 | 2537 const char *v422; // eax@801 |
2538 signed int v426; // eax@815 | |
2539 Actor *v433; // edi@832 | |
2540 int v435; // ecx@837 | |
2541 int v440; // eax@843 | |
2542 int v441; // eax@847 | |
2543 signed int v445; // edi@857 | |
2544 int v446; // ecx@862 | |
2545 LevelDecoration *v447; // edi@864 | |
2546 __int16 v448; // ax@864 | |
2547 char *v449; // esi@870 | |
2548 int v450; // eax@870 | |
2549 signed int v460; // eax@895 | |
2550 Actor *v461; // eax@897 | |
2551 unsigned __int16 v462; // cx@897 | |
2552 signed int v463; // edx@897 | |
2553 int v470; // edi@913 | |
2554 int v471; // eax@917 | |
2555 int v472; // eax@917 | |
2556 int v498; // edi@931 | |
2557 int v499; // eax@935 | |
2558 int v500; // eax@935 | |
2559 Player *v501; // edi@939 | |
2560 int v505; // eax@943 | |
2561 int v507; // edi@944 | |
2562 signed int v509; // eax@944 | |
1102 | 2563 //signed int v510; // edi@944 |
90 | 2564 Actor *v518; // edx@957 |
0 | 2565 __int16 v519; // cx@958 |
2566 int v531; // eax@982 | |
2567 int v533; // edi@983 | |
2568 signed int v535; // eax@983 | |
2569 signed int v536; // edi@983 | |
2570 stru6 *v537; // eax@984 | |
2571 double v549; // st7@991 | |
2572 unsigned __int16 v550; // di@991 | |
89 | 2573 Player *v553; // edi@1001 |
0 | 2574 unsigned __int16 v562; // di@1005 |
2575 signed int v563; // eax@1010 | |
2576 unsigned int v564; // ecx@1011 | |
2577 signed int v565; // eax@1012 | |
2578 Player **v566; // ecx@1012 | |
2579 int v567; // eax@1012 | |
2580 Player *v571; // eax@1013 | |
2581 char *v572; // ecx@1013 | |
2582 signed int v576; // eax@1025 | |
2583 Player *v577; // eax@1026 | |
2584 int v578; // eax@1028 | |
2585 __int16 v579; // ax@1029 | |
2586 int v581; // edi@1031 | |
2587 char *v585; // esi@1034 | |
2588 signed int v587; // eax@1035 | |
2589 char v591; // al@1048 | |
1013 | 2590 ItemGen *v592; // esi@1052 |
0 | 2591 int v596; // esi@1066 |
2592 unsigned int v597; // edi@1067 | |
2593 int v600; // edi@1086 | |
2594 int v601; // edx@1086 | |
2595 int v602; // eax@1086 | |
2596 int v603; // ecx@1086 | |
1009 | 2597 NPCData *pNPCData; // eax@1089 |
0 | 2598 int v606; // edx@1091 |
1013 | 2599 AwardType *v607; // ecx@1100 |
0 | 2600 __int16 v608; // ax@1102 |
2601 signed int v609; // eax@1104 | |
2602 int v610; // edi@1106 | |
2603 unsigned int v611; // eax@1106 | |
89 | 2604 Player *v612; // edi@1106 |
2605 DDM_DLV_Header *v613; // eax@1108 | |
0 | 2606 int v615; // edi@1119 |
112 | 2607 Player *v619; // edi@1123 |
0 | 2608 signed __int64 v623; // qax@1127 |
2609 int v625; // edi@1129 | |
2610 signed int v627; // eax@1129 | |
2611 signed int v628; // edi@1129 | |
2612 int v629; // ecx@1130 | |
2613 Player *v630; // eax@1131 | |
2614 int v631; // eax@1137 | |
2615 int v635; // edi@1142 | |
2616 int v642; // edi@1156 | |
2617 int v643; // eax@1156 | |
2618 int v644; // eax@1156 | |
2619 signed int v645; // eax@1158 | |
2620 unsigned int v656; // [sp-4h] [bp-E88h]@639 | |
2621 int v657; // [sp-4h] [bp-E88h]@807 | |
2622 int v659; // [sp+0h] [bp-E84h]@123 | |
2623 int v660; // [sp+0h] [bp-E84h]@146 | |
2624 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
2625 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 | |
2626 const char *v664; // [sp+0h] [bp-E84h]@802 | |
2627 int v665; // [sp+0h] [bp-E84h]@807 | |
2628 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 2629 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
0 | 2630 int v671; // [sp+4h] [bp-E80h]@146 |
1013 | 2631 int v675; // [sp+4h] [bp-E80h]@800 |
0 | 2632 int v676; // [sp+4h] [bp-E80h]@807 |
2633 int v677; // [sp+4h] [bp-E80h]@861 | |
1013 | 2634 int v679[800]; // [sp+14h] [bp-E70h]@515 |
0 | 2635 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 |
2636 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
2637 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
2638 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
2639 int v684; // [sp+D04h] [bp-180h]@416 | |
2640 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
2641 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2642 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2643 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2644 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2645 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0 | 2646 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2647 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2648 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2649 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
1119 | 2650 int v710; // [sp+D8Ch] [bp-F8h]@1156 |
0 | 2651 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
2652 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
2653 int n; // [sp+DA0h] [bp-E4h]@1 | |
2654 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
2655 int v716; // [sp+DC0h] [bp-C4h]@272 | |
2656 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
2657 float v718; // [sp+DCCh] [bp-B8h]@176 | |
2658 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
2659 char *y; // [sp+DD4h] [bp-B0h]@325 | |
2660 int v721; // [sp+DD8h] [bp-ACh]@163 | |
2661 int v723; // [sp+E4Ch] [bp-38h]@1 | |
2662 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
2663 float v725; // [sp+E54h] [bp-30h]@23 | |
2664 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
2665 float v727; // [sp+E5Ch] [bp-28h]@1 | |
2666 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
2667 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
2668 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 2669 Player *v730b; |
2670 ItemGen *v730c; | |
0 | 2671 int v731; // [sp+E6Ch] [bp-18h]@48 |
2672 signed int v732; // [sp+E70h] [bp-14h]@325 | |
2673 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
2674 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
2675 int amount; // [sp+E80h] [bp-4h]@1 | |
2676 | |
924 | 2677 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 |
1009 | 2678 |
0 | 2679 v2 = 0; |
2680 amount = 0; | |
2681 LODWORD(v733) = 0; | |
2682 v723 = 0; | |
2683 v727 = 0.0; | |
889 | 2684 for(n = 0; n < 10; ++n) |
0 | 2685 { |
924 | 2686 pCastSpell = &this[n]; |
2687 HIDWORD(v733) = (int)pCastSpell; | |
2688 if ( pCastSpell->spellnum == 0 ) | |
889 | 2689 continue; |
486 | 2690 |
2691 if (pParty->Invisible()) | |
2692 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
2693 | |
924 | 2694 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 2695 { |
924 | 2696 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
2697 this->_427D48(1); | |
889 | 2698 continue; |
0 | 2699 } |
924 | 2700 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
2701 | |
2702 a2 = pCastSpell->spell_target_pid; | |
2703 if (!pCastSpell->spell_target_pid) | |
0 | 2704 { |
924 | 2705 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
2706 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
2707 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 2708 v666 = 1; |
2709 else | |
2710 v666 = 0; | |
2711 | |
2712 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
2713 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2714 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 2715 a2 = pMouse->uPointingObjectID; |
0 | 2716 } |
488 | 2717 |
2718 | |
924 | 2719 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
2720 if (pSpellSprite.uType) | |
0 | 2721 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2722 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 2723 { |
924 | 2724 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 2725 v2 = v723; |
2726 } | |
2727 else | |
2728 { | |
2729 v715.uYawAngle = pParty->sRotationY; | |
2730 v715.uPitchAngle = pParty->sRotationX; | |
2731 } | |
2732 } | |
488 | 2733 |
486 | 2734 LODWORD(v725) = 0; |
2735 _this = 0; | |
924 | 2736 if (pCastSpell->forced_spell_skill_level) |
488 | 2737 { |
924 | 2738 v11 = pCastSpell->forced_spell_skill_level; |
993 | 2739 v723 = v11 & 0x3F; // 6 bytes |
488 | 2740 v2 = v723; |
2741 } | |
2742 else | |
0 | 2743 { |
488 | 2744 //v667 = PLAYER_SKILL_STAFF; |
924 | 2745 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 2746 v667 = PLAYER_SKILL_FIRE; |
924 | 2747 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 2748 v667 = PLAYER_SKILL_AIR; |
924 | 2749 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 2750 v667 = PLAYER_SKILL_WATER; |
924 | 2751 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 2752 v667 = PLAYER_SKILL_EARTH; |
924 | 2753 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 2754 v667 = PLAYER_SKILL_SPIRIT; |
924 | 2755 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 2756 v667 = PLAYER_SKILL_MIND; |
924 | 2757 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 2758 v667 = PLAYER_SKILL_BODY; |
924 | 2759 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 2760 v667 = PLAYER_SKILL_LIGHT; |
924 | 2761 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 2762 v667 = PLAYER_SKILL_DARK; |
924 | 2763 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 2764 v667 = PLAYER_SKILL_BOW; |
2765 else assert(false && "Unknown spell"); | |
2766 | |
0 | 2767 LODWORD(v725) = v667; |
488 | 2768 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
2769 v2 = v723; | |
2770 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 2771 } |
488 | 2772 |
993 | 2773 v731 = SkillToMastery(v11); |
488 | 2774 |
924 | 2775 if (pCastSpell->forced_spell_skill_level) |
486 | 2776 uRequiredMana = 0; |
488 | 2777 else |
924 | 2778 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
2779 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 2780 |
2781 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 2782 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 2783 uRequiredMana = 0; |
488 | 2784 |
924 | 2785 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
2786 { | |
2787 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
2788 pCastSpell->spellnum = 0; | |
2789 continue; | |
2790 } | |
2791 v730 = pCastSpell->spellnum; | |
2792 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
2793 { | |
2794 if (!pParty->bTurnBasedModeOn) | |
2795 { | |
2796 //v646 = pPlayer; | |
2797 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
2798 //v647 = n; | |
2799 } | |
2800 else | |
2801 { | |
2802 //v647 = n; | |
2803 //v646 = pPlayer; | |
2804 //v648 = sRecoveryTime; | |
2805 //v649 = pPlayer; | |
2806 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
2807 pPlayer->SetRecoveryTime(sRecoveryTime); | |
2808 pTurnEngine->_40471C(); | |
2809 } | |
2810 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
2811 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2812 this[n].spellnum = 0; | |
2813 pPlayer->sMana -= uRequiredMana; | |
2814 return; | |
2815 } | |
2816 | |
2817 switch ( pCastSpell->spellnum ) | |
2818 { | |
1005 | 2819 case SPELL_101: |
2820 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
2821 case SPELL_BOW_ARROW: | |
2822 { | |
2823 amount = 1; | |
2824 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
2825 amount = 2; | |
2826 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); | |
2827 pSpellSprite.stru_24.Reset(); | |
2828 pSpellSprite.spell_level = v2; | |
2829 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2830 pSpellSprite.spell_skill = v731; | |
2831 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1080 | 2832 if ( pPlayer->WearsItem(ITEM_ARTEFACT_ULLYSES, EQUIP_BOW) ) |
1005 | 2833 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); |
2834 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2835 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2836 pSpellSprite.uAttributes = 0; | |
2837 pSpellSprite.uSpriteFrameID = 0; | |
2838 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2839 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2840 pSpellSprite.spell_target_pid = a2; | |
2841 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2842 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2843 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2844 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
1100 | 2845 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); |
1005 | 2846 pSpellSprite.uAttributes = 256; |
2847 if ( pParty->bTurnBasedModeOn == 1 ) | |
2848 pSpellSprite.uAttributes = 260; | |
2849 for ( i = 0; i < amount; ++i ) | |
2850 { | |
2851 if ( i ) | |
2852 pSpellSprite.vPosition.z += 32; | |
2853 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
2854 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
2855 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
2856 ++pTurnEngine->field_1C; | |
2857 } | |
2858 break; | |
2859 } | |
2860 case SPELL_LASER_PROJECTILE: | |
2861 { | |
924 | 2862 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); |
2863 pSpellSprite.stru_24.Reset(); | |
2864 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2865 pSpellSprite.spell_level = v723; | |
2866 pSpellSprite.spell_skill = v731; | |
2867 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2868 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2869 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2870 pSpellSprite.uAttributes = 0; | |
2871 pSpellSprite.uSpriteFrameID = 0; | |
2872 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
2873 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2874 pSpellSprite.spell_target_pid = a2; | |
2875 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2876 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2877 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1005 | 2878 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
2879 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); | |
2880 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
2881 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); | |
924 | 2882 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); |
2883 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
2884 pSpellSprite.uSectorID = v23; | |
889 | 2885 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 2886 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
2887 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
2888 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 2889 ++pTurnEngine->field_1C; |
924 | 2890 break; |
1005 | 2891 } |
2892 case SPELL_FIRE_TORCH_LIGHT: | |
2893 { | |
889 | 2894 switch (v731) |
2895 { | |
890 | 2896 case 1: amount = 2; break; |
2897 case 2: amount = 3; break; | |
2898 case 3: | |
2899 case 4: amount = 4; break; | |
2900 default: | |
889 | 2901 assert(false); |
2902 } | |
2903 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 2904 break; |
889 | 2905 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
2906 LODWORD(v727) = 1; | |
890 | 2907 break; |
1005 | 2908 } |
2909 case SPELL_FIRE_FIRE_SPIKE: | |
2910 { | |
2911 switch (v731) | |
2912 { | |
2913 case 1: amount = 3; break; | |
2914 case 2: amount = 5; break; | |
2915 case 3: amount = 7; break; | |
2916 case 4: amount = 9; break; | |
2917 default: | |
2918 assert(false); | |
2919 } | |
2920 | |
2921 //v31 = v3->uPlayerID; | |
2922 //v32 = 8 * v31; | |
2923 //LOBYTE(v32) = v32 | OBJECT_Player; | |
2924 | |
2925 //if ( (signed int)uNumSpriteObjects > 0 ) | |
2926 int _v733 = 0; | |
2927 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
2928 { | |
2929 auto object = pSpriteObjects + i; | |
2930 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) | |
2931 ++_v733; | |
2932 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
2933 v730 = uNumSpriteObjects; | |
2934 do | |
2935 { | |
2936 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
2937 ++HIDWORD(v733); | |
2938 v33 += 112; | |
2939 --v730; | |
2940 } | |
2941 while ( v730 );*/ | |
2942 } | |
2943 if (_v733 > amount) | |
2944 { | |
2945 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2946 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2947 pCastSpell->spellnum = 0; | |
2948 continue; | |
2949 } | |
2950 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2951 break; | |
2952 pSpellSprite.stru_24.Reset(); | |
2953 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2954 pSpellSprite.spell_level = v2; | |
2955 pSpellSprite.spell_skill = v731; | |
2956 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2957 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2958 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2959 pSpellSprite.uAttributes = 0; | |
2960 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2961 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
2962 pSpellSprite.uSpriteFrameID = 0; | |
2963 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2964 pSpellSprite.spell_target_pid = a2; | |
2965 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2966 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2967 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2968 if ( pParty->bTurnBasedModeOn == 1 ) | |
2969 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
2970 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
2971 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
2972 ++pTurnEngine->field_1C; | |
889 | 2973 LODWORD(v727) = 1; |
890 | 2974 break; |
2975 } | |
1005 | 2976 case SPELL_AIR_IMPLOSION: |
2977 { | |
2978 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2979 break; | |
2980 if (!a2) | |
2981 { | |
2982 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2983 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2984 pCastSpell->spellnum = 0; | |
2985 continue; | |
2986 } | |
2987 if (PID_TYPE(a2) != OBJECT_Actor) | |
2988 { | |
2989 LODWORD(v727) = 1; | |
2990 break; | |
2991 } | |
2992 v697.x = 0; | |
2993 v697.y = 0; | |
2994 v697.z = 0; | |
2995 pSpellSprite.stru_24.Reset(); | |
2996 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2997 pSpellSprite.spell_level = v2; | |
2998 pSpellSprite.spell_skill = v731; | |
2999 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3000 pSpellSprite.uAttributes = 0; | |
3001 pSpellSprite.uSectorID = 0; | |
3002 pSpellSprite.uSpriteFrameID = 0; | |
3003 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3004 pSpellSprite.uFacing = 0; | |
3005 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3006 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3007 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3008 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3009 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3010 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3011 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
3012 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | |
890 | 3013 LODWORD(v727) = 1; |
3014 break; | |
3015 } | |
1005 | 3016 case SPELL_EARTH_MASS_DISTORTION: |
3017 { | |
3018 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3019 break; | |
3020 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3021 { | |
3022 LODWORD(v727) = 1; | |
3023 break; | |
3024 } | |
3025 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3026 v704.x = 0; | |
3027 v704.y = 0; | |
3028 v704.z = 0; | |
3029 pSpellSprite.stru_24.Reset(); | |
3030 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3031 pSpellSprite.spell_level = v2; | |
3032 pSpellSprite.spell_skill = v731; | |
3033 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3034 pSpellSprite.uAttributes = 0; | |
3035 pSpellSprite.uSectorID = 0; | |
3036 pSpellSprite.uSpriteFrameID = 0; | |
3037 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3038 pSpellSprite.uFacing = 0; | |
3039 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3040 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3041 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3042 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3043 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
1090 | 3044 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); |
1005 | 3045 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3046 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | |
3047 LODWORD(v727) = 1; | |
890 | 3048 break; |
1005 | 3049 } |
3050 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3051 { | |
3052 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | |
3053 break; | |
3054 //v730 = a2 >> 3; | |
3055 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3056 v691.x = 0; | |
3057 v691.y = 0; | |
3058 v691.z = 0; | |
3059 pSpellSprite.stru_24.Reset(); | |
3060 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3061 pSpellSprite.spell_level = v2; | |
3062 pSpellSprite.spell_skill = v731; | |
3063 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3064 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3065 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3066 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3067 pSpellSprite.uAttributes = 0; | |
3068 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3069 pSpellSprite.uSpriteFrameID = 0; | |
3070 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3071 pSpellSprite.spell_target_pid = a2; | |
3072 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3073 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3074 pSpellSprite.uAttributes |= 0x80u; | |
3075 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3076 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
1013 | 3077 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
1005 | 3078 { |
3079 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3080 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3081 pCastSpell->spellnum = 0; | |
3082 continue; | |
3083 } | |
3084 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3085 LODWORD(v727) = 1; | |
3086 break; | |
3087 } | |
3088 case SPELL_FIRE_FIRE_BOLT: | |
3089 case SPELL_FIRE_FIREBALL: | |
3090 case SPELL_FIRE_INCINERATE: | |
3091 case SPELL_AIR_LIGHNING_BOLT: | |
3092 case SPELL_WATER_ICE_BOLT: | |
3093 case SPELL_WATER_ICE_BLAST: | |
3094 case SPELL_EARTH_STUN: | |
3095 case SPELL_EARTH_DEADLY_SWARM: | |
3096 case SPELL_MIND_MIND_BLAST: | |
3097 case SPELL_MIND_PSYCHIC_SHOCK: | |
3098 case SPELL_BODY_HARM: | |
3099 case SPELL_LIGHT_LIGHT_BOLT: | |
3100 case SPELL_DARK_DRAGON_BREATH: | |
3101 { | |
889 | 3102 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3103 break; |
924 | 3104 pSpellSprite.stru_24.Reset(); |
3105 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3106 pSpellSprite.spell_level = v2; | |
3107 pSpellSprite.spell_skill = v731; | |
3108 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3109 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3110 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3111 pSpellSprite.uAttributes = 0; | |
3112 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3113 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3114 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3115 else | |
3116 pSpellSprite.uSectorID = 0; | |
3117 pSpellSprite.uSpriteFrameID = 0; | |
3118 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3119 pSpellSprite.spell_target_pid = a2; | |
3120 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3121 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3122 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3123 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3124 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3125 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3126 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3127 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3128 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3129 ++pTurnEngine->field_1C; |
3130 LODWORD(v727) = 1; | |
890 | 3131 break; |
1005 | 3132 } |
3133 case SPELL_WATER_ACID_BURST: | |
3134 case SPELL_EARTH_BLADES: | |
3135 case SPELL_BODY_FLYING_FIST: | |
3136 case SPELL_DARK_TOXIC_CLOUD: | |
3137 { | |
889 | 3138 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3139 break; |
924 | 3140 pSpellSprite.stru_24.Reset(); |
3141 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3142 pSpellSprite.spell_level = v2; | |
3143 pSpellSprite.spell_skill = v731; | |
3144 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3145 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3146 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3147 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3148 v660 = pParty->vPosition.y; | |
993 | 3149 pSpellSprite.uAttributes = 0; |
3150 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3151 pSpellSprite.vPosition.z = v51; | |
3152 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3153 pSpellSprite.uSpriteFrameID = 0; | |
3154 pSpellSprite.uSectorID = v52; | |
3155 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3156 pSpellSprite.spell_target_pid = a2; | |
3157 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3158 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3159 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3160 if ( pParty->bTurnBasedModeOn == 1 ) | |
3161 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3162 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3163 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3164 ++pTurnEngine->field_1C; | |
3165 LODWORD(v727) = 1; | |
3166 break; | |
1009 | 3167 } |
1005 | 3168 case SPELL_LIGHT_SUNRAY: |
3169 { | |
889 | 3170 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
1009 | 3171 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) ) |
890 | 3172 { |
3173 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3174 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3175 pCastSpell->spellnum = 0; |
890 | 3176 continue; |
889 | 3177 } |
3178 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3179 { |
3180 pSpellSprite.stru_24.Reset(); | |
3181 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3182 pSpellSprite.spell_skill = v731; | |
3183 pSpellSprite.spell_level = v2; | |
3184 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3185 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3186 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3187 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3188 v660 = pParty->vPosition.y; | |
993 | 3189 pSpellSprite.uAttributes = 0; |
3190 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3191 pSpellSprite.vPosition.z = v51; | |
3192 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3193 pSpellSprite.uSpriteFrameID = 0; | |
3194 pSpellSprite.uSectorID = v52; | |
3195 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3196 pSpellSprite.spell_target_pid = a2; | |
3197 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3198 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3199 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3200 if ( pParty->bTurnBasedModeOn == 1 ) | |
3201 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3202 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3203 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3204 ++pTurnEngine->field_1C; | |
3205 LODWORD(v727) = 1; | |
924 | 3206 } |
3207 break; | |
1005 | 3208 } |
3209 case SPELL_LIGHT_PARALYZE: | |
3210 { | |
3211 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3212 break; | |
3213 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], | |
3214 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
3215 { | |
3216 LODWORD(v727) = 1; | |
3217 break; | |
3218 } | |
3219 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3220 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3221 v55 = &pActors[PID_ID(a2)]; | |
3222 v55->pActorBuffs[6].Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3223 BYTE2(v55->uAttributes) |= 8u; | |
3224 v55->vVelocity.x = 0; | |
3225 //v672 = 0; | |
3226 v55->vVelocity.y = 0; | |
3227 v661 = v55; | |
3228 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
3229 LODWORD(v727) = 1; | |
890 | 3230 break; |
1005 | 3231 } |
3232 case SPELL_EARTH_SLOW: | |
3233 { | |
3234 switch (v731) | |
3235 { | |
3236 case 1: LODWORD(v733) = 180 * v2; amount = 2; break; | |
3237 case 2: LODWORD(v733) = 300 * v2; amount = 2; break; | |
3238 case 3: LODWORD(v733) = 300 * v2; amount = 4; break; | |
3239 case 4: LODWORD(v733) = 300 * v2; amount = 8; break; | |
3240 default: | |
3241 assert(false); | |
3242 } | |
889 | 3243 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3244 break; |
889 | 3245 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3246 || (v721 = 836 * PID_ID(a2), |
3247 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3248 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3249 { | |
3250 LODWORD(v727) = 1; | |
3251 break; | |
889 | 3252 } |
3253 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
1005 | 3254 //v59 = v721; |
3255 pActor = &pActors[PID_ID(a2)]; | |
889 | 3256 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( |
1005 | 3257 pActor->pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, v731, amount, 0, 0); |
3258 //*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | |
3259 BYTE2(pActor->uAttributes) |= 8u; | |
3260 //v672 = 0; | |
889 | 3261 v661 = (Actor *)LODWORD(v718); |
1005 | 3262 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); |
993 | 3263 LODWORD(v727) = 1; |
3264 break; | |
924 | 3265 } |
1005 | 3266 case SPELL_MIND_CHARM: |
3267 { | |
890 | 3268 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3269 break; | |
3270 | |
3271 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3272 { | |
3273 LODWORD(v727) = 1; | |
3274 break; | |
3275 } | |
3276 | |
3277 uint power = 300 * v2; | |
3278 if ( v731 == 2 ) | |
3279 { | |
3280 power = 600 * v2; | |
3281 } | |
3282 else if ( v731 == 3 ) | |
3283 power = 29030400; | |
3284 | |
3285 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3286 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3287 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3288 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3289 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3290 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3291 v731, 0, 0, 0); | |
924 | 3292 pSpellSprite.stru_24.Reset(); |
3293 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3294 pSpellSprite.spell_level = v2; | |
3295 pSpellSprite.spell_skill = v731; | |
3296 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3297 v61 = PID_ID(a2); |
993 | 3298 v600 = pActors[v61].vPosition.y; |
3299 v601 = pActors[v61].vPosition.x; | |
3300 pSpellSprite.uObjectDescID = v60; | |
3301 pSpellSprite.vPosition.x = v601; | |
3302 v602 = pActors[v61].uActorHeight; | |
3303 v603 = pActors[v61].vPosition.z; | |
3304 pSpellSprite.vPosition.y = v600; | |
3305 v676 = v603 + v602; | |
3306 v665 = v600; | |
3307 pSpellSprite.vPosition.z = v603 + v602; | |
3308 v657 = v601; | |
3309 pSpellSprite.uAttributes = 0; | |
3310 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
3311 pSpellSprite.uSpriteFrameID = 0; | |
3312 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3313 pSpellSprite.spell_target_pid = a2; | |
3314 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3315 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3316 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
3317 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3318 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
3319 LODWORD(v727) = 1; | |
3320 break; | |
1005 | 3321 } |
3322 case SPELL_DARK_SHRINKING_RAY: | |
3323 { | |
889 | 3324 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3325 break; |
924 | 3326 pSpellSprite.stru_24.Reset(); |
3327 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3328 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3329 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3330 pSpellSprite.uAttributes = 0; | |
3331 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3332 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3333 pParty->vPosition.x, |
3334 pParty->vPosition.y, | |
3335 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3336 pSpellSprite.uSpriteFrameID = 0; |
3337 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3338 pSpellSprite.spell_target_pid = a2; | |
3339 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3340 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3341 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3342 pSpellSprite.spell_skill = v731; | |
3343 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3344 pSpellSprite.spell_level = 300 * v2; | |
890 | 3345 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3346 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3347 | |
3348 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3349 | |
3350 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3351 ++pTurnEngine->field_1C; |
3352 LODWORD(v727) = 1; | |
890 | 3353 break; |
1005 | 3354 } |
3355 case SPELL_FIRE_FIRE_AURA: | |
3356 { | |
1009 | 3357 switch (v731) |
3358 { | |
3359 case 1: LODWORD(v733) = 3600 * v2; amount = 10; break; | |
3360 case 2: LODWORD(v733) = 3600 * v2; amount = 11; break; | |
3361 case 3: LODWORD(v733) = 3600 * v2; amount = 12; break; | |
3362 case 4: LODWORD(v733) = 0; amount = 12; break; | |
3363 default: | |
3364 assert(false); | |
3365 } | |
3366 | |
889 | 3367 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3368 break; |
924 | 3369 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3370 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3371 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3372 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3373 && !v730c->Broken() | |
3374 && !v730c->uSpecEnchantmentType | |
3375 && !v730c->uEnchantmentType | |
3376 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3377 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3378 { | |
3379 v69 = v730c; | |
3380 v14 = v731 == 4; | |
3381 v730c->uSpecEnchantmentType = amount; | |
3382 if ( !v14 ) | |
889 | 3383 { |
890 | 3384 v69->uExpireTime = pParty->uTimePlayed |
3385 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3386 * 0.033333335); | |
3387 v69->uAttributes |= 8u; | |
889 | 3388 } |
890 | 3389 v69->uAttributes |= 0x10u; |
984 | 3390 _50C9A8_item_enchantment_timer = 256; |
890 | 3391 LODWORD(v727) = 1; |
3392 break; | |
889 | 3393 } |
3394 | |
3395 dword_50C9D0 = 113; | |
3396 dword_50C9D4 = 0; | |
3397 dword_50C9D8 = 1; | |
3398 | |
3399 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3400 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3401 pCastSpell->spellnum = 0; |
890 | 3402 continue; |
1005 | 3403 } |
3404 case SPELL_BODY_REGENERATION: | |
3405 { | |
1009 | 3406 switch (v731) |
3407 { | |
3408 case 1: LODWORD(v733) = 3600 * v2; amount = 1; break; | |
3409 case 2: LODWORD(v733) = 3600 * v2; amount = 1; break; | |
3410 case 3: LODWORD(v733) = 3600 * v2; amount = 3; break; | |
3411 case 4: LODWORD(v733) = 3600 * v2; amount = 10; break; | |
3412 default: | |
3413 assert(false); | |
3414 } | |
3415 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3416 break; | |
3417 | |
3418 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
3419 | |
3420 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); | |
3421 LODWORD(v727) = 1; | |
890 | 3422 break; |
1005 | 3423 } |
3424 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3425 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3426 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3427 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3428 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3429 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3430 { | |
1009 | 3431 switch (v731) |
3432 { | |
3433 case 1: | |
3434 case 2: | |
3435 case 3: | |
3436 case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break; | |
3437 default: | |
3438 assert(false); | |
3439 } | |
3440 | |
3441 switch (pCastSpell->spellnum) | |
3442 { | |
3443 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3444 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3445 break; | |
3446 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3447 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3448 break; | |
3449 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3450 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3451 break; | |
3452 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3453 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3454 break; | |
3455 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3456 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3457 break; | |
3458 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3459 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3460 break; | |
3461 default: | |
3462 assert(false); | |
3463 continue; | |
3464 } | |
3465 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3466 break; | |
3467 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3468 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3469 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3470 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
3471 v90 = (double)(signed int)v733 * 4.2666669; | |
3472 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3473 LODWORD(v727) = 1; | |
3474 break; | |
1005 | 3475 } |
3476 case SPELL_FIRE_HASTE: | |
3477 { | |
1009 | 3478 switch (v731) |
3479 { | |
3480 case 1: LODWORD(v733) = 60 * (v2 + 60); break; | |
3481 case 2: LODWORD(v733) = 60 * (v2 + 60); break; | |
3482 case 3: LODWORD(v733) = 180 * (v2 + 20); break; | |
3483 case 4: LODWORD(v733) = 240 * (v2 + 15); break; | |
3484 default: | |
3485 assert(false); | |
993 | 3486 } |
889 | 3487 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
3488 { | |
890 | 3489 v92 = pParty->pPlayers;//[0].pConditions[1]; |
3490 LODWORD(v727) = 1; | |
3491 do | |
3492 { | |
1090 | 3493 if ( v92->pConditions[1] ) |
993 | 3494 LODWORD(v727) = 0; |
3495 ++v92; | |
890 | 3496 } |
3497 while ( v92 <= &pParty->pPlayers[3] ); | |
3498 if (LODWORD(v727)) | |
3499 { | |
993 | 3500 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
3501 | |
3502 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3503 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3504 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3505 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 3506 } |
3507 } | |
3508 break; | |
1005 | 3509 } |
3510 case SPELL_SPIRIT_BLESS: | |
3511 { | |
1009 | 3512 switch (v731) |
3513 { | |
3514 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
3515 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
3516 case 3: LODWORD(v733) = 900 * (v2 + 4); break; | |
3517 case 4: LODWORD(v733) = 3600 * (v2 + 1); break; | |
3518 default: | |
3519 assert(false); | |
3520 } | |
889 | 3521 amount = v2 + 5; |
3522 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3523 break; |
889 | 3524 if ( v731 == 1 ) |
3525 { | |
924 | 3526 v108 = pCastSpell->uPlayerID_2; |
3527 v109 = pCastSpell->spellnum; | |
890 | 3528 v110 = pGame->GetStru6(); |
3529 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 3530 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 3531 //v668 = 0; |
3532 v716 = v111; | |
3533 //v658 = v111; | |
3534 //v653 = amount; | |
3535 //v651 = 1; | |
3536 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3537 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
1009 | 3538 //LABEL_103: |
3539 //HIDWORD(v650) = HIDWORD(v28); | |
3540 //LABEL_104: | |
3541 //LODWORD(v650) = v28; | |
3542 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); | |
3543 LODWORD(v727) = 1; | |
3544 break; | |
889 | 3545 } |
3546 v105 = 0; | |
3547 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3548 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
3549 do | |
3550 { | |
924 | 3551 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 3552 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
3553 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
3554 ++v730b; | |
3555 ++v105; | |
889 | 3556 } |
3557 while ( v730b <= &pParty->pPlayers[3] ); | |
3558 LODWORD(v727) = 1; | |
890 | 3559 break; |
1005 | 3560 } |
890 | 3561 case SPELL_SPIRIT_SPIRIT_LASH: |
1005 | 3562 { |
889 | 3563 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
3564 { | |
890 | 3565 //v730 = a2 >> 3; |
3566 v112 = &pActors[PID_ID(a2)]; | |
3567 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
3568 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
3569 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
3570 _this = (ItemGen *)v113; | |
3571 v114 = v721; | |
3572 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
3573 if ( v113 < v721 ) | |
3574 { | |
1009 | 3575 v116 = v113; |
3576 v113 = v721; | |
3577 v114 = v116; | |
890 | 3578 } |
3579 if ( v113 < (signed int)v115 ) | |
3580 { | |
1009 | 3581 v117 = v113; |
3582 v113 = (int)v115; | |
3583 v115 = v117; | |
890 | 3584 } |
3585 if ( v114 < (signed int)v115 ) | |
3586 { | |
1009 | 3587 v118 = v115; |
3588 v115 = v114; | |
3589 v114 = v118; | |
890 | 3590 } |
3591 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
3592 if ( (double)(signed int)this <= 307.2 ) | |
3593 { | |
1009 | 3594 v701.x = 0; |
3595 v701.y = 0; | |
3596 v701.z = 0; | |
3597 pSpellSprite.stru_24.Reset(); | |
1013 | 3598 pSpellSprite.spell_id = pCastSpell->spellnum; |
1009 | 3599 pSpellSprite.spell_level = v723; |
3600 pSpellSprite.spell_skill = v731; | |
3601 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3602 pSpellSprite.uAttributes = 0; | |
3603 pSpellSprite.uSectorID = 0; | |
3604 pSpellSprite.uSpriteFrameID = 0; | |
3605 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
1013 | 3606 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
1009 | 3607 pSpellSprite.uFacing = 0; |
1013 | 3608 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
1009 | 3609 pSpellSprite.vPosition.x = v112->vPosition.x; |
3610 pSpellSprite.vPosition.y = v112->vPosition.y; | |
3611 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
3612 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
3613 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
3614 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); | |
3615 LODWORD(v727) = 1; | |
890 | 3616 } |
3617 else | |
3618 { | |
1009 | 3619 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
3620 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1013 | 3621 pCastSpell->spellnum = 0; |
890 | 3622 } |
1013 | 3623 //pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 3624 } |
3625 break; | |
3626 } | |
3627 case SPELL_AIR_SHIELD: | |
3628 case SPELL_EARTH_STONESKIN: | |
3629 case SPELL_SPIRIT_HEROISM: | |
993 | 3630 { |
1009 | 3631 switch (v731) |
3632 { | |
3633 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
3634 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
3635 case 3: LODWORD(v733) = 900 * (v2 + 4); break; | |
3636 case 4: LODWORD(v733) = 3600 * (v2 + 1); break; | |
3637 default: | |
3638 assert(false); | |
3639 } | |
924 | 3640 v127 = pCastSpell->spellnum; |
889 | 3641 if ( v127 == 17 ) |
3642 { | |
890 | 3643 amount = 0; |
3644 LODWORD(v725) = 14; | |
889 | 3645 } |
3646 else | |
3647 { | |
890 | 3648 if ( v127 == 38 ) |
3649 { | |
1009 | 3650 LODWORD(v725) = 15; |
3651 amount = v2 + 5; | |
890 | 3652 } |
3653 else | |
3654 { | |
1009 | 3655 if ( v127 != 51 ) |
3656 continue; | |
3657 LODWORD(v725) = 9; | |
3658 amount = v2 + 5; | |
890 | 3659 } |
889 | 3660 } |
3661 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3662 break; |
924 | 3663 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3664 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3665 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3666 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3667 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
3668 //LABEL_304: | |
3669 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3670 LODWORD(v727) = 1; | |
890 | 3671 break; |
1005 | 3672 } |
890 | 3673 case SPELL_FIRE_IMMOLATION: |
1005 | 3674 { |
1013 | 3675 if ( v731 == 4 ) |
993 | 3676 LODWORD(v733) = 600 * v2; |
889 | 3677 else |
993 | 3678 LODWORD(v733) = 60 * v2; |
889 | 3679 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3680 break; |
889 | 3681 |
924 | 3682 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3683 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3684 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3685 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3686 |
3687 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
3688 LODWORD(v727) = 1; | |
890 | 3689 break; |
1005 | 3690 } |
890 | 3691 case SPELL_FIRE_METEOR_SHOWER: |
1005 | 3692 { |
1009 | 3693 //v149 = v731 - 1; |
3694 //if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
1013 | 3695 int i; |
1009 | 3696 if ( v731 == 4 ) |
889 | 3697 { |
1013 | 3698 i = 20; |
889 | 3699 } |
3700 else | |
3701 { | |
1013 | 3702 i = 16; |
889 | 3703 } |
3704 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3705 { | |
890 | 3706 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
3707 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3708 pCastSpell->spellnum = 0; |
890 | 3709 continue; |
889 | 3710 } |
3711 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3712 break; |
889 | 3713 LODWORD(v725) = PID_TYPE(a2); |
3714 if (PID_TYPE(a2) == OBJECT_Actor) | |
3715 { | |
890 | 3716 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
3717 v153 = pActors[PID_ID(a2)].vPosition.y; | |
3718 v154 = pActors[PID_ID(a2)].vPosition.z; | |
3719 LODWORD(v727) = v153; | |
889 | 3720 } |
3721 else | |
3722 { | |
890 | 3723 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
3724 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
3725 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
3726 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
3727 v154 = pParty->vPosition.z; | |
889 | 3728 } |
1013 | 3729 unsigned __int64 k = 0; |
3730 int j = 0; | |
3731 if ( (signed int)i > 0 ) | |
3732 { | |
890 | 3733 v730 = LODWORD(v725) == 3 ? a2 : 0; |
3734 do | |
3735 { | |
1009 | 3736 a2 = rand() % 1000; |
1013 | 3737 if ( sqrt((double)(rand() % 1000) - 2500 * |
3738 (double)(rand() % 1000) - 2500 + | |
3739 j * j + k * k) <= 1.0 ) | |
1009 | 3740 { |
3741 LODWORD(v687) = 0; | |
3742 HIDWORD(v687) = 0; | |
3743 } | |
3744 else | |
3745 { | |
3746 v687 = __PAIR__( | |
1013 | 3747 stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), |
3748 (double)(rand() % 1000) - 2500), | |
3749 stru_5C6E00->Atan2(j, k)); | |
1009 | 3750 } |
3751 pSpellSprite.stru_24.Reset(); | |
3752 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3753 pSpellSprite.spell_level = v2; | |
3754 pSpellSprite.spell_skill = v731; | |
3755 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3756 pSpellSprite.uAttributes = 0; | |
3757 pSpellSprite.vPosition.x = uRequiredMana; | |
3758 pSpellSprite.vPosition.y = LODWORD(v727); | |
3759 pSpellSprite.uSectorID = 0; | |
1090 | 3760 pSpellSprite.vPosition.z = a2 + v154; |
1009 | 3761 pSpellSprite.uSpriteFrameID = 0; |
3762 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3763 pSpellSprite.spell_target_pid = v730; | |
3764 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
3765 pSpellSprite.uFacing = v687; | |
3766 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3767 if ( pParty->bTurnBasedModeOn == 1 ) | |
3768 pSpellSprite.uAttributes = 4; | |
3769 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
3770 && pParty->bTurnBasedModeOn == 1 ) | |
3771 ++pTurnEngine->field_1C; | |
1013 | 3772 j = rand() % 1024 - 512; |
3773 k = rand() % 1024 - 512; | |
890 | 3774 } |
1013 | 3775 while ( i-- != 1 ); |
889 | 3776 } |
3777 LODWORD(v727) = 1; | |
890 | 3778 break; |
3779 } | |
3780 case SPELL_FIRE_INFERNO: | |
3781 { | |
1009 | 3782 //v67 = 2; |
3783 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3784 { | |
3785 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
3786 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3787 pCastSpell->spellnum = 0; | |
3788 continue; | |
3789 } | |
3790 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3791 break; | |
3792 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
3793 v700.z = 0; | |
3794 v700.y = 0; | |
3795 v700.x = 0; | |
3796 pSpellSprite.stru_24.Reset(); | |
3797 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3798 pSpellSprite.spell_level = v2; | |
3799 pSpellSprite.spell_skill = v731; | |
3800 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3801 pSpellSprite.uAttributes = 0; | |
3802 pSpellSprite.uSectorID = 0; | |
3803 pSpellSprite.uSpriteFrameID = 0; | |
3804 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3805 pSpellSprite.uFacing = 0; | |
3806 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3807 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3808 a2 = 0; | |
3809 if ( (signed int)_v726 > 0 ) | |
3810 { | |
3811 do | |
3812 { | |
3813 v162 = dword_50BF30[a2]; | |
3814 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; | |
3815 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
3816 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
3817 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
3818 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
3819 v165 = a2; | |
3820 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
3821 pGame->GetStru6()->_4A81CA(&pSpellSprite); | |
3822 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
3823 a2 = v165 + 1; | |
3824 } | |
3825 while ( v165 + 1 < (signed int)_v726 ); | |
3826 } | |
3827 LODWORD(v727) = 1; | |
890 | 3828 break; |
1009 | 3829 } |
3830 case SPELL_AIR_WIZARD_EYE: | |
890 | 3831 { |
889 | 3832 LODWORD(v733) = 3600 * v2; |
3833 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3834 break; |
889 | 3835 v168 = 0; |
3836 do | |
3837 { | |
890 | 3838 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
3839 v716 = v169; | |
889 | 3840 } |
3841 while ( v168 < 4 ); | |
3842 | |
3843 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
3844 LODWORD(v727) = 1; | |
890 | 3845 break; |
1005 | 3846 } |
890 | 3847 case SPELL_AIR_FEATHER_FALL: |
1005 | 3848 { |
3849 switch (v731) | |
3850 { | |
3851 case 1: LODWORD(v733) = 300 * v2; break; | |
3852 case 2: LODWORD(v733) = 600 * v2; break; | |
1009 | 3853 case 3: LODWORD(v733) = 3600 * v2; break; |
1005 | 3854 case 4: LODWORD(v733) = 3600 * v2; break; |
3855 default: | |
3856 assert(false); | |
889 | 3857 } |
3858 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3859 break; |
889 | 3860 v174 = 0; |
3861 do | |
890 | 3862 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 3863 while ( v174 < 4 ); |
924 | 3864 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3865 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3866 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3867 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3868 |
3869 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); | |
3870 LODWORD(v727) = 1; | |
890 | 3871 break; |
1005 | 3872 } |
890 | 3873 case SPELL_AIR_SPARKS: |
3874 { | |
1005 | 3875 switch (v731) |
3876 { | |
3877 case 1: amount = 3; break; | |
3878 case 2: amount = 5; break; | |
3879 case 3: amount = 7; break; | |
3880 case 4: amount = 9; break; | |
3881 default: | |
3882 assert(false); | |
3883 } | |
3884 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3885 break; | |
3886 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
3887 pSpellSprite.stru_24.Reset(); | |
3888 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3889 pSpellSprite.spell_level = v2; | |
3890 pSpellSprite.spell_skill = v731; | |
3891 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3892 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3893 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3894 pSpellSprite.uAttributes = 0; | |
3895 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3896 pSpellSprite.uSectorID = pIndoor->GetSector( | |
3897 pParty->vPosition.x, | |
3898 pParty->vPosition.y, | |
3899 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3900 pSpellSprite.uSpriteFrameID = 0; | |
3901 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3902 pSpellSprite.spell_target_pid = a2; | |
3903 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3904 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3905 if ( pParty->bTurnBasedModeOn == 1 ) | |
3906 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3907 v188 = (signed int)_v726 / -2; | |
3908 v189 = (signed int)_v726 / 2; | |
3909 while ( v188 <= v189 ) | |
3910 { | |
3911 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); | |
3912 if ( pSpellSprite.Create( | |
3913 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
3914 v715.uPitchAngle, | |
3915 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3916 pCastSpell->uPlayerID + 1) != -1 | |
1009 | 3917 && pParty->bTurnBasedModeOn == 1 ) |
1106
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1104
diff
changeset
|
3918 ++pTurnEngine->field_1C; |
1005 | 3919 v188 += _v726 / (amount - 1); |
3920 } | |
3921 LODWORD(v727) = 1; | |
890 | 3922 break; |
1005 | 3923 } |
890 | 3924 case SPELL_AIR_JUMP: |
1005 | 3925 { |
890 | 3926 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) |
3927 { | |
3928 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
3929 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3930 break; | |
889 | 3931 } |
3932 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3933 break; |
889 | 3934 v191 = 0; |
3935 do | |
890 | 3936 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 3937 while ( v191 < 4 ); |
3938 BYTE1(pParty->uFlags) |= 1u; | |
3939 pParty->uFallSpeed = 1000; | |
3940 LODWORD(v727) = 1; | |
890 | 3941 break; |
1005 | 3942 } |
890 | 3943 case SPELL_AIR_INVISIBILITY: |
1005 | 3944 { |
3945 switch (v731) | |
3946 { | |
3947 case 1: LODWORD(v733) = 600 * v2; amount = v2; break; | |
3948 case 2: LODWORD(v733) = 600 * v2; amount = 2 * v2; break; | |
3949 case 3: LODWORD(v733) = 600 * v2; amount = 3 * v2; break; | |
3950 case 4: LODWORD(v733) = 3600 * v2; amount = 4 * v2; break; | |
3951 default: | |
3952 assert(false); | |
3953 } | |
889 | 3954 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
3955 { | |
890 | 3956 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
3957 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3958 pCastSpell->spellnum = 0; |
890 | 3959 continue; |
889 | 3960 } |
3961 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
3962 { | |
924 | 3963 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3964 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3965 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3966 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 3967 |
3968 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
3969 LODWORD(v727) = 1; | |
3970 } | |
3971 break; | |
1005 | 3972 } |
890 | 3973 case SPELL_AIR_FLY: |
3974 { | |
1005 | 3975 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3976 { | |
3977 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
3978 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3979 break; | |
3980 } | |
3981 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
3982 { | |
3983 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3984 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3985 break; | |
3986 } | |
3987 LODWORD(v733) = 3600 * v2; | |
1009 | 3988 if ( v731 == 1 || v731 == 2 || v731 == 3 ) |
1005 | 3989 amount = 1; |
1009 | 3990 else |
3991 amount = 0; | |
1005 | 3992 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3993 break; | |
3994 v205 = 0; | |
3995 do | |
3996 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
3997 while ( v205 < 4 ); | |
3998 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
3999 v207 = pCastSpell->uPlayerID + 1; | |
4000 v716 = v206; | |
4001 | |
4002 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4003 LODWORD(v727) = 1; | |
890 | 4004 break; |
4005 } | |
4006 case SPELL_AIR_STARBURST: | |
4007 { | |
1005 | 4008 //v67 = 2; |
4009 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4010 { | |
4011 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4012 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4013 pCastSpell->spellnum = 0; | |
4014 continue; | |
4015 } | |
4016 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4017 break; | |
4018 v208 = PID_TYPE(a2); | |
4019 LODWORD(v725) = PID_TYPE(a2); | |
4020 if ( v208 == 3 ) | |
4021 { | |
4022 v209 = PID_ID(a2); | |
4023 LODWORD(v718) = pActors[v209].vPosition.x; | |
4024 v210 = pActors[v209].vPosition.y; | |
4025 v211 = pActors[v209].vPosition.z; | |
4026 v713 = v210; | |
889 | 4027 } |
4028 else | |
4029 { | |
1005 | 4030 v212 = stru_5C6E00->Cos(pParty->sRotationY); |
4031 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4032 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4033 v214 = sub_42EBBE(2048, v213); | |
4034 v211 = pParty->vPosition.z; | |
4035 v713 = pParty->vPosition.y + v214; | |
4036 v208 = LODWORD(v725); | |
4037 } | |
1013 | 4038 signed int _v733 = 0; |
1005 | 4039 *(float *)&v732 = (double)v211; |
4040 LODWORD(v725) = v211 + 2500; | |
4041 v721 = 0; | |
4042 *(float *)&y = (double)(v211 + 2500); | |
4043 v730 = v208 == 3 ? a2 : 0; | |
4044 a2 = 20; | |
4045 do | |
4046 { | |
4047 v215 = rand(); | |
4048 v216 = (double)v721; | |
1013 | 4049 v217 = (double)_v733; |
1005 | 4050 *(float *)&uRequiredMana = v217; |
4051 _this = (ItemGen *)(v215 % 1000); | |
4052 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4053 *(float *)&v721 = v217 * v217; | |
4054 //*(float *)&v726 = v216 * v216; | |
4055 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4056 { | |
1009 | 4057 LODWORD(v685) = 0; |
4058 HIDWORD(v685) = 0; | |
1005 | 4059 } |
4060 else | |
4061 { | |
1009 | 4062 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4063 v685 = __PAIR__( | |
4064 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4065 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
1005 | 4066 } |
4067 pSpellSprite.stru_24.Reset(); | |
4068 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4069 pSpellSprite.spell_level = v2; | |
4070 pSpellSprite.spell_skill = v731; | |
4071 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4072 pSpellSprite.uAttributes = 0; | |
4073 pSpellSprite.vPosition.x = LODWORD(v718); | |
4074 pSpellSprite.vPosition.y = v713; | |
4075 pSpellSprite.uSectorID = 0; | |
4076 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4077 pSpellSprite.uSpriteFrameID = 0; | |
4078 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4079 pSpellSprite.spell_target_pid = v730; | |
4080 //__debugbreak();//çâåçäîïàä | |
4081 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | |
4082 pSpellSprite.uFacing = v685; | |
4083 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4084 if ( pParty->bTurnBasedModeOn == 1 ) | |
4085 pSpellSprite.uAttributes = 4; | |
4086 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4087 && pParty->bTurnBasedModeOn == 1 ) | |
4088 ++pTurnEngine->field_1C; | |
4089 v721 = rand() % 1024 - 512; | |
4090 v218 = rand(); | |
4091 v14 = a2-- == 1; | |
1013 | 4092 _v733 = (unsigned __int64)(v218 % 1024) - 512; |
1005 | 4093 } |
4094 while ( !v14 ); | |
4095 LODWORD(v727) = 1; | |
4096 break; | |
4097 } | |
890 | 4098 case SPELL_WATER_AWAKEN: |
993 | 4099 { |
1005 | 4100 switch (v731) |
4101 { | |
4102 case 1: amount = 180 * v2; break; | |
4103 case 2: amount = 3600 * v2; break; | |
4104 case 3: amount = 86400 * v2; break; | |
4105 case 4: amount = 0; break; | |
4106 default: | |
4107 assert(false); | |
4108 } | |
889 | 4109 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4110 break; |
1005 | 4111 for( int i=0; i < 4; i++ ) |
4112 { | |
4113 pPlayer = &pParty->pPlayers[i]; | |
890 | 4114 if ( v731 == 4 ) |
4115 { | |
1005 | 4116 if ( pPlayer->pConditions[2] ) |
4117 { | |
4118 //*((int *)v222 + 4) = 0; | |
4119 //*((int *)v222 + 5) = 0; | |
4120 pPlayer->pConditions[2] = 0; | |
4121 pPlayer->PlaySound(SPEECH_103, 0); | |
4122 } | |
890 | 4123 } |
4124 else | |
889 | 4125 { |
1005 | 4126 v223 = pPlayer->DiscardConditionIfLastsLongerThan( |
4127 2u, | |
4128 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4129 if ( v223 ) | |
4130 pPlayer->PlaySound(SPEECH_103, 0); | |
890 | 4131 } |
1005 | 4132 } |
4133 LODWORD(v727) = 1; | |
4134 break; | |
4135 } | |
890 | 4136 case SPELL_WATER_POISON_SPRAY: |
993 | 4137 { |
1009 | 4138 switch (v731) |
4139 { | |
4140 case 1: amount = 1; break; | |
4141 case 2: amount = 3; break; | |
4142 case 3: amount = 5; break; | |
4143 case 4: amount = 7; break; | |
4144 default: | |
4145 assert(false); | |
4146 } | |
889 | 4147 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4148 break; |
1013 | 4149 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
890 | 4150 if ( amount == 1 ) |
4151 { | |
924 | 4152 pSpellSprite.stru_24.Reset(); |
4153 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4154 pSpellSprite.spell_skill = v731; | |
4155 pSpellSprite.spell_level = v2; | |
4156 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4157 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4158 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4159 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4160 v660 = pParty->vPosition.y; | |
993 | 4161 // LABEL_153: |
924 | 4162 pSpellSprite.uAttributes = 0; |
4163 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4164 pSpellSprite.vPosition.z = v51; | |
890 | 4165 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4166 pSpellSprite.uSpriteFrameID = 0; |
4167 pSpellSprite.uSectorID = v52; | |
4168 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4169 pSpellSprite.spell_target_pid = a2; | |
4170 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4171 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4172 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4173 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4174 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4175 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4176 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4177 ++pTurnEngine->field_1C; | |
890 | 4178 } |
4179 else | |
4180 { | |
924 | 4181 pSpellSprite.stru_24.Reset(); |
4182 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4183 pSpellSprite.spell_level = v2; | |
4184 pSpellSprite.spell_skill = v731; | |
4185 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4186 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4187 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4188 pSpellSprite.uAttributes = 0; | |
4189 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4190 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4191 pSpellSprite.uSpriteFrameID = 0; | |
4192 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4193 pSpellSprite.spell_target_pid = a2; | |
4194 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4195 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4196 if ( pParty->bTurnBasedModeOn == 1 ) |
1009 | 4197 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
1088 | 4198 v227 = _v733 / -2; |
1013 | 4199 signed int _y = _v733 / 2; |
4200 if ( _v733 / -2 <= _v733 / 2 ) | |
890 | 4201 { |
1009 | 4202 v228 = v715.uYawAngle; |
4203 do | |
4204 { | |
4205 pSpellSprite.uFacing = v227 + v228; | |
4206 if ( pSpellSprite.Create( | |
4207 v227 + v228, | |
4208 v715.uPitchAngle, | |
4209 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
4210 pCastSpell->uPlayerID + 1) != -1 | |
4211 && pParty->bTurnBasedModeOn == 1 ) | |
4212 ++pTurnEngine->field_1C; | |
1013 | 4213 v227 += _v733 / (amount - 1); |
1009 | 4214 } |
1013 | 4215 while ( v227 <= _y ); |
890 | 4216 } |
889 | 4217 } |
4218 LODWORD(v727) = 1; | |
890 | 4219 break; |
4220 } | |
4221 case SPELL_WATER_WATER_WALK: | |
1009 | 4222 { |
4223 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
4224 { | |
4225 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4226 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4227 break; | |
4228 } | |
4229 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4230 v229 = 600 * v2; | |
4231 else | |
4232 v229 = 3600 * v2; | |
4233 LODWORD(v733) = v229; | |
4234 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4235 break; | |
4236 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
4237 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4238 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4239 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4240 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4241 | |
4242 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4243 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4244 v731, | |
4245 amount, | |
4246 v716, | |
4247 pCastSpell->uPlayerID + 1); | |
4248 if ( v731 == 4 ) | |
4249 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4250 LODWORD(v727) = 1; | |
4251 break; | |
4252 } | |
4253 case SPELL_WATER_RECHARGE_ITEM: | |
890 | 4254 { |
1009 | 4255 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4256 break; | |
1013 | 4257 v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
4258 | |
4259 if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 ) | |
1009 | 4260 { |
4261 dword_50C9D0 = 113; | |
4262 dword_50C9D4 = 0; | |
4263 dword_50C9D8 = 1; | |
4264 | |
4265 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4266 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4267 pCastSpell->spellnum = 0; | |
4268 continue; | |
4269 } | |
4270 if ( v731 == 1 || v731 == 2 ) | |
4271 { | |
4272 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4273 } | |
4274 else if ( v731 == 3 ) | |
4275 { | |
4276 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
4277 } | |
4278 else if ( v731 == 4 ) | |
4279 { | |
4280 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4281 } | |
4282 else | |
4283 { | |
4284 v241 = 0.0; | |
4285 } | |
4286 if ( v241 > 1.0 ) | |
4287 v241 = 1.0; | |
1013 | 4288 int uNewCharges = v240->uMaxCharges * v241; |
4289 v240->uMaxCharges = uNewCharges; | |
4290 v240->uNumCharges = uNewCharges; | |
4291 if ( uNewCharges <= 0 ) | |
4292 { | |
4293 v240 = 0; | |
1009 | 4294 dword_50C9D0 = 113; |
4295 dword_50C9D4 = 0; | |
4296 dword_50C9D8 = 1; | |
4297 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4298 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4299 pCastSpell->spellnum = 0; | |
4300 v2 = v723; | |
4301 continue; | |
4302 } | |
1013 | 4303 v240->uAttributes |= 0x40u; |
1009 | 4304 _50C9A8_item_enchantment_timer = 256; |
4305 LODWORD(v727) = 1; | |
890 | 4306 break; |
4307 } | |
1009 | 4308 case SPELL_WATER_ENCHANT_ITEM: |
890 | 4309 { |
1009 | 4310 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4311 break; | |
4312 uRequiredMana = 0; | |
1013 | 4313 amount = 10 * v2; |
1009 | 4314 v730 = 1; |
1013 | 4315 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
4316 v245 = &pPlayer->pInventoryItems[a2]; | |
4317 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; | |
4318 if ( | |
4319 v731 == 1 || v731 == 2 && _v725->uEquipType > 2 || | |
4320 v731 == 3 || v731 == 4 && | |
4321 v245->uItemID <= 134 && | |
4322 v245->uSpecEnchantmentType == 0 && | |
4323 v245->uEnchantmentType == 0 && | |
4324 v245->_bonus_strength== 0 && | |
4325 !v245->Broken() ) | |
4326 { | |
4327 if ( v245->GetValue() < 450 || | |
4328 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2) | |
4329 ) | |
890 | 4330 { |
1013 | 4331 v730 = 0; |
889 | 4332 } |
1013 | 4333 if ( rand() % 100 < 10 * v2 || |
4334 (rand() % 100 < 80 && (v731 == 3 || v731 == 4 )) || | |
4335 v245->GetValue() < 450 || | |
4336 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && v271 >= 0 && v271 <= 2) | |
4337 ) | |
1009 | 4338 { |
1013 | 4339 v313 = _v725->uEquipType; |
4340 if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 ) | |
1009 | 4341 { |
1013 | 4342 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; |
4343 v245->uEnchantmentType = 0; | |
4344 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1]; | |
4345 ; | |
4346 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1] ) | |
1009 | 4347 { |
1013 | 4348 ++v245->uEnchantmentType; |
4349 if ( kk >= v295 ) | |
1009 | 4350 break; |
4351 } | |
1013 | 4352 v255 = 10;//pItemsTable->field_116D8[17]; |
4353 v256 = 10;//pItemsTable->field_116D8[16]; | |
4354 v245->_bonus_strength = v256 + rand() % (v255 - v256 + 1); | |
4355 v245->uAttributes |= 0x20u; | |
993 | 4356 _50C9A8_item_enchantment_timer = 256; |
4357 LODWORD(v727) = 1; | |
4358 break; | |
890 | 4359 } |
1013 | 4360 else if ( v731 == 3 || v731 == 4) |
993 | 4361 { |
4362 v257 = pItemsTable->pSpecialEnchantments_count; | |
4363 v258 = 0; | |
4364 v725 = 0.0; | |
1013 | 4365 int _v733 = 0; |
993 | 4366 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
890 | 4367 { |
993 | 4368 v730 = (int)&v679; |
4369 do | |
4370 { | |
4371 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
4372 if ( !v259 || v259 == 1 ) | |
4373 { | |
4374 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
4375 + 4] | |
4376 + v258 * 28); | |
4377 LODWORD(v725) += v260; | |
4378 if ( v260 ) | |
4379 { | |
4380 v261 = v730; | |
4381 v730 += 4; | |
1013 | 4382 *(int *)v261 = _v733; |
993 | 4383 } |
4384 } | |
1013 | 4385 ++_v733; |
993 | 4386 ++v258; |
4387 } | |
1013 | 4388 while ( _v733 < v257 ); |
890 | 4389 } |
993 | 4390 v262 = rand() % SLODWORD(v725); |
4391 v263 = v679; | |
1013 | 4392 v245->uSpecEnchantmentType = v679[0]; |
4393 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
993 | 4394 v265 = v262 + 1; |
4395 if ( v264 < v265 ) | |
4396 { | |
1013 | 4397 for ( ii = v679; ; ii = (int *)v732 ) |
993 | 4398 { |
4399 v267 = (int)(ii + 1); | |
4400 v732 = v267; | |
4401 v268 = *(int *)v267; | |
4402 *(int *)(v245 + 12) = v268; | |
4403 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
4404 + 4]; | |
4405 if ( v264 >= v265 ) | |
1009 | 4406 break; |
993 | 4407 } |
4408 } | |
1013 | 4409 |
4410 v277 = pItemsTable->pSpecialEnchantments_count; | |
4411 v278 = 0; | |
4412 v725 = 0.0; | |
4413 _v733 = 0; | |
4414 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
4415 { | |
4416 int *_v730 = v679; | |
4417 do | |
4418 { | |
4419 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); | |
4420 if ( !v279 || v279 == 1 ) | |
4421 { | |
4422 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]); | |
4423 _v733 += v280; | |
4424 if ( v280 ) | |
4425 { | |
4426 v281 = _v730; | |
4427 ++_v730; | |
4428 *v281 = _v733; | |
4429 } | |
4430 } | |
4431 ++_v733; | |
4432 ++v278; | |
4433 } | |
4434 while ( _v733 < v277 ); | |
4435 } | |
4436 v282 = rand() % _v733; | |
4437 v283 = v679; | |
4438 v245->uSpecEnchantmentType = v679[0]; | |
4439 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType ]; | |
4440 v285 = v282 + 1; | |
4441 for ( l = v679; v284 < v285; ++l ) | |
4442 { | |
4443 v245->uSpecEnchantmentType = *(l+1); | |
4444 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]; | |
4445 } | |
4446 ++v245->uSpecEnchantmentType; | |
4447 v245->uAttributes |= 0x20u; | |
4448 _50C9A8_item_enchantment_timer = 256; | |
4449 LODWORD(v727) = 1; | |
4450 break; | |
4451 } | |
890 | 4452 } |
1013 | 4453 else |
1009 | 4454 { |
1013 | 4455 if ( !(BYTE1(v245->uAttributes) & 2) ) |
4456 { | |
4457 v245->uAttributes |= 2; | |
4458 } | |
1009 | 4459 } |
1013 | 4460 |
4461 } | |
4462 | |
4463 if ( LODWORD(v727) == 0 ) | |
4464 { | |
4465 v317 = pGlobalTXT_LocalizationStrings[428]; | |
4466 if ( v730 == 0 ) | |
4467 v317 = pGlobalTXT_LocalizationStrings[585]; | |
4468 ShowStatusBarString(v317, 2u); | |
4469 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4470 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4471 pCastSpell->spellnum = 0; | |
4472 v318->PlaySound(SPEECH_43, 0); | |
4473 } | |
4474 | |
993 | 4475 break; |
890 | 4476 } |
1009 | 4477 case SPELL_WATER_TOWN_PORTAL: |
4478 { | |
4479 amount = 10 * v2; | |
4480 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
4481 break; | |
4482 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
4483 { | |
4484 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4485 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4486 pCastSpell->spellnum = 0; | |
4487 continue; | |
4488 } | |
4489 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); | |
4490 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
4491 LODWORD(v727) = 1; | |
4492 break; | |
4493 } | |
4494 case SPELL_WATER_LLOYDS_BEACON: | |
993 | 4495 { |
1009 | 4496 LODWORD(v733) = 604800 * v2; |
1104 | 4497 if ( !_stricmp(pCurrentMapName, "d05.blv") ) |
1009 | 4498 { |
4499 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
993 | 4500 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4501 pCastSpell->spellnum = 0; | |
1009 | 4502 continue; |
4503 } | |
4504 v319 = uRequiredMana; | |
4505 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
4506 { | |
4507 pEventTimer->Pause(); | |
4508 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); | |
4509 qword_506350 = (signed int)v733; | |
4510 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; | |
4511 ::uRequiredMana = v319; | |
4512 ::sRecoveryTime = sRecoveryTime; | |
4513 dword_50633C = pCastSpell->sound_id; | |
4514 dword_506338 = pCastSpell->spellnum; | |
4515 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
993 | 4516 } |
4517 break; | |
4518 } | |
1009 | 4519 case SPELL_EARTH_STONE_TO_FLESH: |
890 | 4520 { |
1009 | 4521 __debugbreak(); // missing GM ? |
4522 switch (v731) | |
4523 { | |
4524 case 1: amount = 3600 * v2; break; | |
4525 case 2: amount = 3600 * v2; break; | |
4526 case 3: amount = 86400 * v2; break; | |
4527 case 4: break; | |
4528 default: | |
4529 assert(false); | |
4530 } | |
4531 //LABEL_634: | |
4532 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4533 break; |
1009 | 4534 v323 = pCastSpell->uPlayerID_2; |
4535 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
4536 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
4537 { | |
4538 LODWORD(v727) = 1; | |
4539 break; | |
4540 } | |
4541 if ( v731 == 4 ) | |
4542 { | |
4543 *(int *)v324 = 0; | |
4544 *((int *)v324 + 1) = 0; | |
4545 LODWORD(v727) = 1; | |
4546 break; | |
4547 } | |
4548 v732 = amount << 7; | |
4549 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
4550 v656 = 15; | |
4551 v325 = &pParty->pPlayers[v323]; | |
4552 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
4553 LODWORD(v727) = 1; | |
4554 break; | |
890 | 4555 } |
1009 | 4556 case SPELL_EARTH_ROCK_BLAST: |
890 | 4557 { |
1009 | 4558 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4559 break; | |
4560 pSpellSprite.stru_24.Reset(); | |
4561 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4562 pSpellSprite.spell_level = v2; | |
4563 pSpellSprite.spell_skill = v731; | |
4564 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4565 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4566 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4567 pSpellSprite.uAttributes = 0; | |
4568 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4569 pSpellSprite.uSectorID = pIndoor->GetSector( | |
4570 pParty->vPosition.x, | |
4571 pParty->vPosition.y, | |
4572 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4573 pSpellSprite.uSpriteFrameID = 0; | |
4574 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4575 pSpellSprite.spell_target_pid = a2; | |
4576 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4577 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
4578 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4579 if ( pParty->bTurnBasedModeOn == 1 ) | |
4580 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
4581 | |
4582 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4583 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4584 ++pTurnEngine->field_1C; | |
890 | 4585 LODWORD(v727) = 1; |
4586 break; | |
4587 } | |
1009 | 4588 case SPELL_EARTH_DEATH_BLOSSOM: |
890 | 4589 { |
1009 | 4590 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4591 { | |
4592 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4593 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4594 pCastSpell->spellnum = 0; | |
4595 continue; | |
4596 } | |
4597 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4598 break; | |
4599 pSpellSprite.uType = 4090; | |
4600 pSpellSprite.stru_24.Reset(); | |
4601 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4602 pSpellSprite.spell_level = v2; | |
4603 pSpellSprite.spell_skill = v731; | |
4604 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4605 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4606 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4607 pSpellSprite.uAttributes = 0; | |
4608 pSpellSprite.uSectorID = 0; | |
4609 pSpellSprite.uSpriteFrameID = 0; | |
4610 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4611 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4612 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4613 pSpellSprite.spell_target_pid = a2; | |
4614 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
4615 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4616 if ( pParty->bTurnBasedModeOn == 1 ) | |
4617 pSpellSprite.uAttributes = 4; | |
4618 | |
4619 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4620 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4621 ++pTurnEngine->field_1C; | |
4622 LODWORD(v727) = 1; | |
4623 break; | |
4624 } | |
4625 case SPELL_SPIRIT_DETECT_LIFE: | |
4626 { | |
4627 v328 = v731 - 2; | |
4628 if ( v328 ) | |
4629 { | |
4630 v329 = v328 - 1; | |
4631 if ( v329 && v329 != 1 ) | |
4632 v330 = 600 * v2; | |
4633 else | |
4634 v330 = 3600 * v2; | |
4635 } | |
4636 else | |
4637 { | |
4638 v330 = 1800 * v2; | |
4639 } | |
4640 LODWORD(v733) = v330; | |
4641 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4642 break; | |
4643 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4644 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4645 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4646 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4647 | |
4648 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 | 4649 LODWORD(v727) = 1; |
4650 break; | |
4651 } | |
1009 | 4652 case SPELL_SPIRIT_FATE: |
890 | 4653 { |
1009 | 4654 switch (v731) |
4655 { | |
4656 case 1: amount = 1 * v2; break; | |
4657 case 2: amount = 2 * v2; break; | |
4658 case 3: amount = 4 * v2; break; | |
4659 case 4: amount = 6 * v2; break; | |
4660 default: | |
4661 assert(false); | |
4662 } | |
4663 LODWORD(v733) = 300; | |
4664 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4665 break; | |
4666 v342 = pCastSpell->spell_target_pid; | |
4667 if ( v342 == 0 ) | |
4668 { | |
4669 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4670 | |
4671 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
4672 LODWORD(v727) = 1; | |
4673 break; | |
4674 } | |
4675 if (PID_TYPE(v342) == OBJECT_Actor) | |
4676 { | |
4677 v343 = PID_ID(v342); | |
4678 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
4679 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
4680 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
4681 BYTE2(pActors[v343].uAttributes) |= 8u; | |
4682 //v672 = 0; | |
4683 v661 = &pActors[v343]; | |
4684 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
4685 } | |
4686 LODWORD(v727) = 1; | |
890 | 4687 break; |
1009 | 4688 } |
4689 case SPELL_SPIRIT_REMOVE_CURSE: | |
890 | 4690 { |
1009 | 4691 switch (v731) |
4692 { | |
4693 case 1: amount = 3600 * v2; break; | |
4694 case 2: amount = 3600 * v2; break; | |
4695 case 3: amount = 86400 * v2; break; | |
4696 case 4: amount = 0; break; | |
4697 default: | |
4698 assert(false); | |
4699 } | |
4700 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4701 break; | |
4702 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4703 if ( !v351->pConditions[0] ) | |
4704 { | |
4705 LODWORD(v727) = 1; | |
4706 break; | |
4707 } | |
4708 if ( v731 == 4 ) | |
4709 { | |
4710 LODWORD(v351->pConditions[0]) = 0; | |
4711 HIDWORD(v351->pConditions[0]) = 0; | |
4712 } | |
890 | 4713 else |
1009 | 4714 { |
4715 v732 = amount << 7; | |
4716 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
4717 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) | |
4718 { | |
4719 LODWORD(v727) = 1; | |
4720 break; | |
4721 } | |
4722 } | |
924 | 4723 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 4724 LODWORD(v727) = 1; |
4725 break; | |
4726 } | |
1009 | 4727 case SPELL_SPIRIT_PRESERVATION: |
890 | 4728 { |
1009 | 4729 if ( v731 == 4 ) |
4730 LODWORD(v733) = 900 * (v2 + 4); | |
4731 else | |
4732 LODWORD(v733) = 300 * (v2 + 12); | |
4733 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4734 break; | |
4735 if ( v731 == 1 || v731 == 2 ) | |
4736 { | |
4737 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4738 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); | |
4739 LODWORD(v727) = 1; | |
4740 break; | |
4741 } | |
4742 a2 = 0; | |
4743 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4744 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
4745 do | |
4746 { | |
4747 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); | |
4748 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
4749 ++a2; | |
4750 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
4751 } | |
4752 while ( v357 <= &pParty->pPlayers[3] ); | |
890 | 4753 LODWORD(v727) = 1; |
4754 break; | |
4755 } | |
4756 case SPELL_SPIRIT_TURN_UNDEAD: | |
4757 { | |
1009 | 4758 if ( v731 == 1 || v731 == 2) |
4759 LODWORD(v733) = 60 * (v2 + 3); | |
4760 else | |
4761 LODWORD(v733) = 300 * v2 + 180; | |
4762 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4763 break; | |
4764 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4765 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
4766 ++pSpellSprite.uType; | |
4767 pSpellSprite.stru_24.Reset(); | |
4768 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4769 pSpellSprite.spell_level = v2; | |
4770 pSpellSprite.spell_skill = v731; | |
4771 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4772 pSpellSprite.uAttributes = 0; | |
4773 pSpellSprite.uSectorID = 0; | |
4774 pSpellSprite.uSpriteFrameID = 0; | |
4775 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4776 pSpellSprite.uFacing = 0; | |
4777 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4778 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4779 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
4780 { | |
4781 v369 = &pActors[dword_50BF30[a2]]; | |
4782 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
4783 { | |
4784 pSpellSprite.vPosition.x = v369->vPosition.x; | |
4785 pSpellSprite.vPosition.y = v369->vPosition.y; | |
4786 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
4787 | |
4788 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4789 pSpellSprite.Create(0, 0, 0, 0); | |
4790 v369->pActorBuffs[4].Apply( | |
4791 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
4792 v731, 0, 0, 0); | |
4793 } | |
4794 } | |
4795 LODWORD(v727) = 1; | |
890 | 4796 break; |
4797 } | |
1009 | 4798 case SPELL_SPIRIT_RAISE_DEAD: |
890 | 4799 { |
4800 if ( v731 == 4 ) | |
1009 | 4801 amount = 0; |
4802 else | |
4803 amount = 86400 * v2; | |
4804 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4805 break; | |
4806 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); | |
4807 v373 = pCastSpell->uPlayerID_2; | |
4808 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
4809 { | |
4810 LODWORD(v727) = 1; | |
4811 break; | |
4812 } | |
4813 v14 = v731 == 4; | |
4814 pParty->pPlayers[v373].sHealth = 1; | |
4815 if ( v14 ) | |
4816 { | |
4817 v374 = pCastSpell->uPlayerID_2; | |
4818 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
4819 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
4820 v376 = pCastSpell->uPlayerID_2; | |
4821 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
4822 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
890 | 4823 } |
889 | 4824 else |
890 | 4825 { |
1009 | 4826 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
4827 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
4828 0xEu, | |
890 | 4829 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
1009 | 4830 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
4831 0xDu, | |
4832 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4833 } | |
4834 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4835 v377->SetCondition(1, 0); | |
889 | 4836 LODWORD(v727) = 1; |
890 | 4837 break; |
4838 } | |
1009 | 4839 case SPELL_SPIRIT_SHARED_LIFE: |
993 | 4840 { |
1009 | 4841 if ( v731 == 4 ) |
4842 amount = 4 * v2; | |
4843 else | |
4844 amount = 3 * v2; | |
4845 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4846 break; | |
4847 v381 = 0; | |
1013 | 4848 signed int _v733 = amount; |
1009 | 4849 v730 = 0; |
4850 v382 = 1; | |
4851 do | |
4852 { | |
4853 v383 = pPlayers[v382]; | |
4854 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
4855 v682[v381++] = v382; | |
4856 ++v382; | |
4857 } | |
4858 while ( v382 <= 4 ); | |
4859 v384 = 0; | |
4860 v730 = v381; | |
4861 if ( v381 > 0 ) | |
4862 { | |
4863 do | |
1013 | 4864 _v733 += pPlayers[v682[v384++]]->sHealth; |
1009 | 4865 while ( v384 < v381 ); |
4866 } | |
1013 | 4867 v732 = (signed __int64)((double)_v733 / (double)v730); |
4868 _v733 = 0; | |
1009 | 4869 if ( v381 > 0 ) |
4870 { | |
4871 do | |
4872 { | |
4873 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
1013 | 4874 v726 = pPlayers[v682[_v733]]; |
1009 | 4875 v726->sHealth = v732; |
4876 //v386 = v726->GetMaxHealth(); | |
4877 if ( v726->sHealth > v726->GetMaxHealth()) | |
4878 v726->sHealth = v726->GetMaxHealth(); | |
4879 if ( v726->sHealth > 0 ) | |
4880 { | |
4881 v726->pConditions[Player::Condition_Unconcious] = 0; | |
4882 } | |
1013 | 4883 v388 = _v733; |
4884 | |
4885 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[_v733]) - 1); | |
4886 _v733 = v388 + 1; | |
1009 | 4887 } |
4888 while ( v388 + 1 < v730 ); | |
4889 } | |
890 | 4890 LODWORD(v727) = 1; |
4891 break; | |
4892 } | |
1009 | 4893 case SPELL_SPIRIT_RESSURECTION: |
4894 { | |
4895 switch (v731) | |
4896 { | |
4897 case 1: amount = 180 * v2; break; | |
4898 case 2: amount = 10800 * v2; break; | |
4899 case 3: amount = 259200 * v2; break; | |
4900 case 4: amount = 0; break; | |
4901 default: | |
4902 assert(false); | |
4903 } | |
4904 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4905 break; | |
4906 v396 = pCastSpell->uPlayerID_2; | |
4907 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
4908 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
4909 { | |
4910 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
4911 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
4912 if ( v731 == 4 ) | |
4913 { | |
4914 v397 = pCastSpell->uPlayerID_2; | |
4915 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
4916 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
4917 v398 = pCastSpell->uPlayerID_2; | |
4918 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
4919 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
4920 v399 = pCastSpell->uPlayerID_2; | |
4921 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
4922 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
4923 } | |
4924 else | |
4925 { | |
4926 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
4927 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | |
4928 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4929 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | |
4930 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4931 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | |
4932 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4933 } | |
4934 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); | |
4935 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
4936 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4937 } | |
4938 LODWORD(v727) = 1; | |
4939 break; | |
4940 } | |
4941 case SPELL_MIND_CURE_PARALYSIS: | |
4942 { | |
4943 switch (v731) | |
4944 { | |
4945 case 1: amount = 3600 * v2; break; | |
4946 case 2: amount = 3600 * v2; break; | |
4947 case 3: amount = 86400 * v2; break; | |
4948 case 4: amount = 0; break; | |
4949 default: | |
4950 assert(false); | |
4951 } | |
4952 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4953 break; | |
4954 | |
4955 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4956 v323 = pCastSpell->uPlayerID_2; | |
4957 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
4958 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
4959 { | |
4960 LODWORD(v727) = 1; | |
4961 break; | |
4962 } | |
4963 if ( v731 == 4 ) | |
4964 { | |
4965 *(int *)v324 = 0; | |
4966 *((int *)v324 + 1) = 0; | |
4967 LODWORD(v727) = 1; | |
4968 break; | |
4969 } | |
4970 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
4971 v656 = 12; | |
4972 v325 = &pParty->pPlayers[v323]; | |
4973 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
4974 LODWORD(v727) = 1; | |
4975 break; | |
4976 } | |
4977 case SPELL_MIND_REMOVE_FEAR: | |
4978 { | |
4979 switch (v731) | |
4980 { | |
4981 case 1: amount = 180 * v2; break; | |
4982 case 2: amount = 3600 * v2; break; | |
4983 case 3: amount = 86400 * v2; break; | |
4984 case 4: amount = 0; break; | |
4985 default: | |
4986 assert(false); | |
4987 } | |
4988 | |
4989 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4990 break; | |
4991 | |
4992 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4993 v323 = pCastSpell->uPlayerID_2; | |
4994 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
4995 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
4996 { | |
4997 LODWORD(v727) = 1; | |
4998 break; | |
4999 } | |
5000 if ( v731 == 4 ) | |
5001 { | |
5002 *(int *)v324 = 0; | |
5003 *((int *)v324 + 1) = 0; | |
5004 LODWORD(v727) = 1; | |
5005 break; | |
5006 } | |
5007 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5008 v656 = 3; | |
5009 v325 = &pParty->pPlayers[v323]; | |
5010 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5011 LODWORD(v727) = 1; | |
5012 break; | |
993 | 5013 } |
890 | 5014 case SPELL_MIND_TELEPATHY: |
993 | 5015 { |
5016 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5017 break; | |
5018 if (PID_TYPE(a2) != OBJECT_Actor) | |
5019 { | |
5020 LODWORD(v727) = 1; | |
5021 break; | |
5022 } | |
1013 | 5023 v417 = &pActors[PID_ID(a2)]; |
5024 Actor * _v730 = v417; | |
5025 if ( !(BYTE2(v417->uAttributes) & 0x80) ) | |
5026 { | |
5027 v417->SetRandomGoldIfTheresNoItem(); | |
5028 v417 = _v730; | |
5029 } | |
5030 v418 = v417->array_000234[3].uItemID; | |
5031 signed int _v733 = 0; | |
993 | 5032 if ( pItemsTable->pItems[v418].uEquipType == 18 ) |
1013 | 5033 _v733 = v417->array_000234[3].uSpecEnchantmentType; |
993 | 5034 |
5035 //ItemGen::ItemGen(&v683); | |
5036 v683.Reset(); | |
5037 | |
1013 | 5038 v419 = _v730->uCarriedItemID; |
993 | 5039 if (v419) |
5040 { | |
5041 v683.uItemID = v419; | |
5042 //goto LABEL_799; | |
5043 } | |
5044 else | |
5045 { | |
5046 v420 = 0; | |
1013 | 5047 v421 = _v730->array_000234; |
5048 while ( !v421->uItemID || pItemsTable->pItems[v421->uItemID].uEquipType == 18 ) | |
993 | 5049 { |
5050 ++v420; | |
1013 | 5051 ++v421; |
993 | 5052 if ( v420 >= 4 ) |
5053 break; | |
5054 } | |
5055 if ( v420 < 4 ) | |
5056 { | |
1013 | 5057 memcpy(&v683, &_v730->array_000234[v420], sizeof(v683)); |
1009 | 5058 v2 = v723; |
5059 //v1 = 0; | |
993 | 5060 } |
5061 } | |
5062 // LABEL_799: | |
1013 | 5063 if ( _v733 != 0 ) |
5064 { | |
5065 v675 = _v733; | |
993 | 5066 if (v683.uItemID) |
5067 { | |
5068 v422 = v683.GetDisplayName(); | |
5069 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
1013 | 5070 |
993 | 5071 } |
5072 else | |
5073 { | |
5074 v664 = "%d gold"; | |
5075 sprintf(pTmpBuf2, v664, v675); | |
5076 } | |
5077 } | |
5078 else | |
5079 { | |
5080 if (v683.uItemID) | |
5081 { | |
1013 | 5082 const char *_v675 = v683.GetDisplayName(); |
993 | 5083 v664 = "(%s)"; |
1013 | 5084 sprintf(pTmpBuf2, v664, _v675); |
993 | 5085 } |
5086 else | |
5087 { | |
5088 strcpy(pTmpBuf2, "nothing"); | |
5089 ShowStatusBarString(pTmpBuf2, 2u); | |
5090 } | |
5091 } | |
1013 | 5092 ShowStatusBarString(pTmpBuf2, 2u); |
5093 pSpellSprite.stru_24.Reset(); | |
5094 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5095 pSpellSprite.spell_level = v2; | |
5096 pSpellSprite.spell_skill = v731; | |
5097 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5098 pSpellSprite.vPosition.x = _v730->vPosition.x; | |
5099 pSpellSprite.vPosition.y = _v730->vPosition.y; | |
5100 v676 = _v730->uActorHeight; | |
5101 v665 = pSpellSprite.vPosition.y; | |
5102 pSpellSprite.vPosition.z = _v730->uActorHeight; | |
5103 v657 = pSpellSprite.vPosition.x; | |
993 | 5104 pSpellSprite.uAttributes = 0; |
5105 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5106 pSpellSprite.uSpriteFrameID = 0; | |
5107 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5108 pSpellSprite.spell_target_pid = a2; | |
5109 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5110 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5111 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5112 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5113 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
889 | 5114 LODWORD(v727) = 1; |
890 | 5115 break; |
5116 } | |
993 | 5117 case SPELL_MIND_BERSERK: |
5118 { | |
1009 | 5119 switch (v731) |
5120 { | |
5121 case 1: amount = 300 * v2; break; | |
5122 case 2: amount = 300 * v2; break; | |
5123 case 3: amount = 600 * v2; break; | |
5124 case 4: amount = 3600; break; | |
5125 default: | |
5126 assert(false); | |
5127 } | |
993 | 5128 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5129 break; | |
5130 v426 = PID_ID(a2); | |
5131 if (PID_TYPE(a2) != OBJECT_Actor) | |
5132 { | |
5133 LODWORD(v727) = 1; | |
5134 break; | |
5135 } | |
5136 v730 = 836 * v426; | |
5137 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
5138 { | |
5139 pActors[v426].pActorBuffs[1].Reset(); | |
5140 pActors[v426].pActorBuffs[12].Reset(); | |
5141 pActors[v426].pActorBuffs[9].Apply( | |
5142 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5143 v731, 0, 0, 0); | |
5144 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5145 } | |
924 | 5146 pSpellSprite.stru_24.Reset(); |
5147 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5148 pSpellSprite.spell_level = v2; | |
5149 pSpellSprite.spell_skill = v731; | |
993 | 5150 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
5151 v61 = v426; | |
5152 v600 = pActors[v61].vPosition.y; | |
5153 v601 = pActors[v61].vPosition.x; | |
5154 pSpellSprite.uObjectDescID = v60; | |
5155 pSpellSprite.vPosition.x = v601; | |
5156 v602 = pActors[v61].uActorHeight; | |
5157 v603 = pActors[v61].vPosition.z; | |
5158 pSpellSprite.vPosition.y = v600; | |
5159 v676 = v603 + v602; | |
5160 v665 = v600; | |
5161 pSpellSprite.vPosition.z = v603 + v602; | |
5162 v657 = v601; | |
5163 pSpellSprite.uAttributes = 0; | |
5164 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5165 pSpellSprite.uSpriteFrameID = 0; | |
5166 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5167 pSpellSprite.spell_target_pid = a2; | |
5168 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5169 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5170 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5171 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5172 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 5173 LODWORD(v727) = 1; |
5174 break; | |
5175 } | |
5176 case SPELL_MIND_ENSLAVE: | |
993 | 5177 { |
5178 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5179 break; | |
5180 amount = 600 * v2; | |
5181 if (PID_TYPE(a2) != OBJECT_Actor) | |
5182 { | |
5183 LODWORD(v727) = 1; | |
5184 break; | |
5185 } | |
5186 v730 = 836 * PID_ID(a2); | |
5187 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5188 break; | |
5189 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
5190 { | |
5191 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
5192 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
5193 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5194 v731, 0, 0, 0); | |
5195 } | |
5196 pSpellSprite.stru_24.Reset(); | |
5197 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5198 pSpellSprite.spell_level = v2; | |
5199 pSpellSprite.spell_skill = v731; | |
5200 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5201 v61 = PID_ID(a2); | |
5202 v600 = pActors[v61].vPosition.y; | |
5203 v601 = pActors[v61].vPosition.x; | |
5204 pSpellSprite.uObjectDescID = v60; | |
5205 pSpellSprite.vPosition.x = v601; | |
5206 v602 = pActors[v61].uActorHeight; | |
5207 v603 = pActors[v61].vPosition.z; | |
5208 pSpellSprite.vPosition.y = v600; | |
5209 v676 = v603 + v602; | |
5210 v665 = v600; | |
5211 pSpellSprite.vPosition.z = v603 + v602; | |
5212 v657 = v601; | |
5213 pSpellSprite.uAttributes = 0; | |
5214 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5215 pSpellSprite.uSpriteFrameID = 0; | |
5216 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5217 pSpellSprite.spell_target_pid = a2; | |
5218 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5219 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5220 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5221 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5222 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 5223 LODWORD(v727) = 1; |
5224 break; | |
5225 } | |
5226 case SPELL_MIND_MASS_FEAR: | |
5227 { | |
1009 | 5228 if ( v731 == 4 ) |
5229 amount = 300 * v2; | |
5230 else | |
5231 amount = 180 * v2; | |
5232 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5233 break; | |
5234 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5235 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
5236 ++pSpellSprite.uType; | |
5237 pSpellSprite.stru_24.Reset(); | |
5238 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5239 pSpellSprite.spell_level = v2; | |
5240 pSpellSprite.spell_skill = v731; | |
5241 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5242 pSpellSprite.uAttributes = 0; | |
5243 pSpellSprite.uSectorID = 0; | |
5244 pSpellSprite.uSpriteFrameID = 0; | |
5245 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5246 pSpellSprite.uFacing = 0; | |
5247 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5248 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5249 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
5250 { | |
5251 v433 = &pActors[dword_50BF30[a2]]; | |
5252 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5253 break; | |
5254 pSpellSprite.vPosition.x = v433->vPosition.x; | |
5255 pSpellSprite.vPosition.y = v433->vPosition.y; | |
5256 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
5257 | |
5258 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5259 pSpellSprite.Create(0, 0, 0, 0); | |
5260 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | |
5261 { | |
5262 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5263 v731, 0, 0, 0); | |
5264 } | |
5265 } | |
5266 LODWORD(v727) = 1; | |
890 | 5267 break; |
5268 } | |
1009 | 5269 case SPELL_MIND_CURE_INSANITY: |
890 | 5270 { |
1009 | 5271 v435 = v731 - 2; |
5272 if ( v731 == 4 ) | |
5273 amount = 0; | |
889 | 5274 else |
1009 | 5275 amount = 86400 * v2; |
5276 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5277 break; | |
5278 | |
5279 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5280 v440 = pCastSpell->uPlayerID_2; | |
5281 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
5282 { | |
5283 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
5284 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
5285 if ( v731 == 4 ) | |
890 | 5286 { |
1009 | 5287 v441 = pCastSpell->uPlayerID_2; |
5288 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
5289 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
890 | 5290 } |
5291 else | |
1009 | 5292 { |
5293 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | |
5294 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
5295 } | |
5296 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5297 v377->SetCondition(1, 0); | |
5298 } | |
889 | 5299 LODWORD(v727) = 1; |
890 | 5300 break; |
5301 } | |
1009 | 5302 case SPELL_EARTH_TELEKINESIS: |
890 | 5303 { |
1009 | 5304 switch (v731) |
5305 { | |
5306 case 1: amount = 2 * v2; break; | |
5307 case 2: amount = 2 * v2; break; | |
5308 case 3: amount = 3 * v2; break; | |
5309 case 4: amount = 4 * v2; break; | |
5310 default: | |
5311 assert(false); | |
5312 } | |
5313 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5314 break; | |
5315 v445 = PID_ID(a2); | |
5316 if (PID_TYPE(a2) == OBJECT_Item) | |
5317 { | |
5318 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
5319 v450 = *(int *)v449; | |
5320 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
5321 { | |
5322 party_finds_gold(*((int *)v449 + 3), 0); | |
5323 viewparams->bRedrawGameUI = 1; | |
5324 } | |
5325 else | |
5326 { | |
5327 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); | |
5328 ShowStatusBarString(pTmpBuf2, 2u); | |
5329 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
5330 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
5331 } | |
5332 SpriteObject::OnInteraction(v445); | |
5333 } | |
5334 else | |
5335 { | |
5336 if (PID_TYPE(a2) == OBJECT_Actor) | |
5337 { | |
5338 stru_50C198.LootActor(&pActors[v445]); | |
5339 } | |
5340 else | |
5341 { | |
5342 if (PID_TYPE(a2) != OBJECT_Decoration) | |
5343 { | |
5344 if (PID_TYPE(a2) != OBJECT_BModel) | |
5345 { | |
5346 LODWORD(v727) = 1; | |
5347 break; | |
5348 } | |
5349 dword_507CD8 = 1; | |
5350 v677 = 1; | |
5351 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5352 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
5353 else | |
5354 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
5355 EventProcessor(v446, a2, v677); | |
5356 LODWORD(v727) = 1; | |
5357 break; | |
5358 } | |
5359 v447 = &pLevelDecorations[v445]; | |
5360 dword_507CD8 = 1; | |
5361 v448 = v447->field_16_event_id; | |
5362 if (v448) | |
5363 { | |
5364 v677 = 1; | |
5365 v446 = v448; | |
5366 EventProcessor(v446, a2, v677); | |
5367 LODWORD(v727) = 1; | |
5368 break; | |
5369 } | |
5370 if ( v447->IsInteractive() ) | |
5371 { | |
5372 activeLevelDecoration = v447; | |
5373 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
5374 activeLevelDecoration = NULL; | |
5375 } | |
5376 } | |
5377 } | |
890 | 5378 LODWORD(v727) = 1; |
5379 break; | |
5380 } | |
1009 | 5381 case SPELL_BODY_CURE_WEAKNESS: |
890 | 5382 { |
1009 | 5383 switch (v731) |
5384 { | |
5385 case 1: amount = 180 * v2; break; | |
5386 case 2: amount = 3600 * v2; break; | |
5387 case 3: amount = 86400 * v2; break; | |
5388 case 4: amount = 0; break; | |
5389 default: | |
5390 assert(false); | |
5391 } | |
5392 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5393 break; | |
5394 | |
5395 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5396 v323 = pCastSpell->uPlayerID_2; | |
5397 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
5398 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
5399 { | |
5400 LODWORD(v727) = 1; | |
5401 break; | |
5402 } | |
5403 if ( v731 == 4 ) | |
5404 { | |
5405 *(int *)v324 = 0; | |
5406 *((int *)v324 + 1) = 0; | |
5407 LODWORD(v727) = 1; | |
5408 break; | |
5409 } | |
5410 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5411 v656 = 1; | |
5412 v325 = &pParty->pPlayers[v323]; | |
5413 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
890 | 5414 LODWORD(v727) = 1; |
5415 break; | |
5416 } | |
1009 | 5417 case SPELL_BODY_FIRST_AID: |
890 | 5418 { |
1009 | 5419 switch (v731) |
5420 { | |
5421 case 1: amount = 2 * v2 + 5; break; | |
5422 case 2: amount = 3 * v2 + 5; break; | |
5423 case 3: amount = 4 * v2 + 5; break; | |
5424 case 4: amount = 5 * v2 + 5; break; | |
5425 default: | |
5426 assert(false); | |
5427 } | |
5428 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5429 break; | |
5430 v460 = pCastSpell->spell_target_pid; | |
5431 if (!v460) | |
5432 { | |
5433 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); | |
5434 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5435 } | |
5436 else | |
5437 { | |
5438 if (PID_TYPE(v460) == OBJECT_Actor) | |
5439 { | |
5440 v461 = &pActors[PID_ID(v460)]; | |
5441 v462 = v461->uAIState; | |
5442 v463 = v461->pMonsterInfo.uHP; | |
5443 if ( v462 != 5 ) | |
5444 { | |
5445 if ( v462 != 4 ) | |
5446 { | |
5447 if ( v462 != 19 ) | |
5448 { | |
5449 if ( v462 != 11 ) | |
5450 { | |
5451 v461->sCurrentHP += amount; | |
5452 if ( v461->sCurrentHP > v463 ) | |
5453 v461->sCurrentHP = v463; | |
5454 } | |
5455 } | |
5456 } | |
5457 } | |
5458 } | |
5459 } | |
890 | 5460 LODWORD(v727) = 1; |
5461 break; | |
5462 } | |
1009 | 5463 case SPELL_BODY_CURE_POISON: |
5464 { | |
5465 switch (v731) | |
5466 { | |
5467 case 1: amount = 3600 * v2; break; | |
5468 case 2: amount = 3600 * v2; break; | |
5469 case 3: amount = 86400 * v2; break; | |
5470 case 4: amount = 0; break; | |
5471 default: | |
5472 assert(false); | |
5473 } | |
5474 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5475 break; | |
5476 | |
5477 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5478 v470 = pCastSpell->uPlayerID_2; | |
5479 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
5480 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
5481 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
5482 { | |
5483 LODWORD(v727) = 1; | |
5484 break; | |
5485 } | |
5486 if ( v731 == 4 ) | |
5487 { | |
5488 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
5489 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
5490 v471 = pCastSpell->uPlayerID_2; | |
5491 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
5492 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
5493 v472 = pCastSpell->uPlayerID_2; | |
5494 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
5495 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
5496 LODWORD(v727) = 1; | |
5497 break; | |
5498 } | |
5499 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5500 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
5501 6u, | |
5502 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5503 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5504 8u, | |
5505 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5506 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
5507 v656 = 10; | |
5508 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5509 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5510 LODWORD(v727) = 1; | |
5511 break; | |
993 | 5512 } |
890 | 5513 case SPELL_BODY_PROTECTION_FROM_MAGIC: |
5514 { | |
1009 | 5515 amount = v2; |
5516 LODWORD(v733) = 3600 * v2; | |
5517 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5518 break; | |
5519 | |
924 | 5520 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5521 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5522 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5523 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
1009 | 5524 |
5525 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 | 5526 LODWORD(v727) = 1; |
5527 break; | |
5528 } | |
1009 | 5529 case SPELL_BODY_HAMMERHANDS: |
890 | 5530 { |
1009 | 5531 LODWORD(v733) = 3600 * v2; |
5532 amount = v2; | |
5533 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5534 break; | |
5535 if ( v731 == 4 ) | |
5536 { | |
5537 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5538 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5539 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5540 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5541 v732 = (int)v733 << 7; | |
5542 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5543 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5544 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5545 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5546 | |
5547 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
5548 LODWORD(v727) = 1; | |
5549 break; | |
5550 } | |
5551 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5552 | |
5553 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 | 5554 LODWORD(v727) = 1; |
5555 break; | |
5556 } | |
1009 | 5557 case SPELL_BODY_CURE_DISEASE: |
890 | 5558 { |
1009 | 5559 if ( v731 == 4 ) |
5560 amount = 0; | |
5561 else | |
5562 amount = 86400 * v2; | |
5563 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5564 break; | |
5565 | |
5566 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5567 v498 = pCastSpell->uPlayerID_2; | |
5568 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
5569 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
5570 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
5571 { | |
5572 LODWORD(v727) = 1; | |
5573 break; | |
5574 } | |
5575 if ( v731 == 4 ) | |
5576 { | |
5577 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
5578 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
5579 v499 = pCastSpell->uPlayerID_2; | |
5580 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
5581 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
5582 v500 = pCastSpell->uPlayerID_2; | |
5583 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
5584 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
5585 } | |
5586 else | |
5587 { | |
5588 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5589 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
5590 7u, | |
5591 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5592 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5593 9u, | |
5594 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5595 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
5596 v656 = 11; | |
5597 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5598 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5599 } | |
890 | 5600 LODWORD(v727) = 1; |
5601 break; | |
1009 | 5602 } |
890 | 5603 case SPELL_BODY_POWER_CURE: |
5604 { | |
1009 | 5605 amount = 5 * v2 + 10; |
5606 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5607 break; | |
5608 v501 = pParty->pPlayers; | |
5609 int v1 = 0; | |
5610 do | |
5611 { | |
5612 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); | |
5613 v501->Heal(amount); | |
5614 ++v501; | |
5615 ++v1; | |
5616 } | |
5617 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
890 | 5618 LODWORD(v727) = 1; |
5619 break; | |
5620 } | |
5621 case SPELL_LIGHT_DISPEL_MAGIC: | |
5622 { | |
1009 | 5623 sRecoveryTime -= v2; |
5624 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5625 break; | |
5626 | |
5627 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
5628 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5629 ++pSpellSprite.uType; | |
1102 | 5630 //signed int _v733 = v505; |
1009 | 5631 v688.x = 0; |
5632 v688.y = 0; | |
5633 v688.z = 0; | |
5634 pSpellSprite.stru_24.Reset(); | |
5635 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5636 pSpellSprite.spell_level = v2; | |
5637 pSpellSprite.spell_skill = v731; | |
5638 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5639 pSpellSprite.uAttributes = 0; | |
5640 pSpellSprite.uSectorID = 0; | |
5641 pSpellSprite.uSpriteFrameID = 0; | |
5642 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5643 pSpellSprite.uFacing = 0; | |
5644 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5645 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5646 a2 = 0; | |
1102 | 5647 for ( a2 = 0; a2 < v505; ++a2 ) |
5648 { | |
5649 v507 = dword_50BF30[a2]; | |
5650 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; | |
5651 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
5652 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
5653 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5654 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
5655 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], &v688); | |
5656 } | |
5657 for ( a2 = 0; a2 < v505; ++a2 ) | |
1013 | 5658 { |
5659 pActor = &pActors[dword_50BF30[a2]]; | |
5660 pSpellSprite.vPosition.x = pActor->vPosition.x; | |
5661 pSpellSprite.vPosition.y = pActor->vPosition.y; | |
5662 pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * unk_4D8548); | |
1009 | 5663 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
5664 pSpellSprite.Create(0, 0, 0, 0); | |
1013 | 5665 for (int i = 0; i < 22; ++i) |
1009 | 5666 { |
1013 | 5667 pActor->pActorBuffs[i].Reset(); |
1009 | 5668 } |
5669 } | |
890 | 5670 LODWORD(v727) = 1; |
5671 break; | |
5672 } | |
1009 | 5673 case SPELL_LIGHT_SUMMON_ELEMENTAL: |
993 | 5674 { |
1009 | 5675 switch (v731) |
5676 { | |
5677 case 1: v733 = 300 * v2; amount = 1; break; | |
5678 case 2: v733 = 300 * v2; amount = 1; break; | |
5679 case 3: v733 = 900 * v2; amount = 3; break; | |
5680 case 4: v733 = 900 * v2; amount = 5; break; | |
5681 default: | |
5682 assert(false); | |
5683 } | |
5684 //v733 = __PAIR__(0, v516); | |
1013 | 5685 signed int _v733 = 0; |
1009 | 5686 if ( (signed int)uNumActors > 0 ) |
5687 { | |
5688 v518 = pActors;//[0].uAIState; | |
5689 auto _v726 = uNumActors; | |
5690 do | |
5691 { | |
5692 v519 = v518->uAIState; | |
5693 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) | |
1013 | 5694 ++_v733; |
1009 | 5695 ++v518; |
5696 --_v726; | |
5697 } | |
5698 while ( _v726 != 0 ); | |
5699 } | |
1013 | 5700 if ( _v733 >= amount ) |
1009 | 5701 { |
5702 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
5703 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5704 pCastSpell->spellnum = 0; | |
5705 continue; | |
5706 } | |
5707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5708 break; | |
5709 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); | |
5710 LODWORD(v727) = 1; | |
5711 break; | |
993 | 5712 } |
1009 | 5713 case SPELL_LIGHT_DAY_OF_THE_GODS: |
993 | 5714 { |
1009 | 5715 switch (v731) |
5716 { | |
5717 case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break; | |
5718 case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break; | |
5719 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break; | |
5720 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break; | |
5721 default: | |
5722 assert(false); | |
5723 } | |
5724 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5725 break; | |
5726 | |
924 | 5727 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5728 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5729 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5730 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 5731 |
1009 | 5732 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); |
5733 LODWORD(v727) = 1; | |
5734 break; | |
890 | 5735 } |
1009 | 5736 case SPELL_LIGHT_PRISMATIC_LIGHT: |
890 | 5737 { |
1009 | 5738 //v67 = 2; |
5739 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
5740 { | |
5741 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
5742 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5743 pCastSpell->spellnum = 0; | |
5744 continue; | |
5745 } | |
5746 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5747 break; | |
5748 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5749 ++pSpellSprite.uType; | |
5750 v694.x = 0; | |
5751 v694.y = 0; | |
5752 v694.z = 0; | |
5753 pSpellSprite.stru_24.Reset(); | |
5754 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5755 pSpellSprite.spell_level = v2; | |
5756 pSpellSprite.spell_skill = v731; | |
5757 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5758 pSpellSprite.uAttributes = 0; | |
5759 pSpellSprite.uSectorID = 0; | |
5760 pSpellSprite.uSpriteFrameID = 0; | |
5761 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5762 pSpellSprite.uFacing = 0; | |
5763 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5764 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5765 a2 = 0; | |
5766 if ( (signed int)v531 > 0 ) | |
5767 { | |
5768 do | |
5769 { | |
5770 v533 = dword_50BF30[a2]; | |
5771 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; | |
5772 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
5773 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
5774 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5775 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
5776 v536 = a2; | |
5777 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
5778 a2 = v536 + 1; | |
5779 } | |
5780 while ( v536 + 1 < (signed int)v531 ); | |
5781 } | |
5782 v537 = pGame->GetStru6(); | |
5783 pGame->GetStru6()->_4A8BFC(); | |
890 | 5784 LODWORD(v727) = 1; |
5785 break; | |
5786 } | |
1009 | 5787 case SPELL_LIGHT_DAY_OF_PROTECTION: |
890 | 5788 { |
1009 | 5789 switch (v731) |
5790 { | |
5791 case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5792 case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5793 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5794 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break; | |
5795 default: | |
5796 assert(false); | |
5797 } | |
5798 v730 = LODWORD(v733); | |
5799 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5800 break; | |
5801 | |
5802 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5803 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5804 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5805 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5806 | |
5807 v732 = v730 << 7; | |
5808 v549 = (double)(v730 << 7) * 0.033333335; | |
5809 *((float *)&v733 + 1) = v549; | |
5810 v712 = (signed __int64)v549; | |
5811 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
5812 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5813 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5814 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5815 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5816 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5817 v550 = v2 + 5; | |
5818 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
5819 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
5820 v731, | |
5821 v550, 0, 0); | |
5822 | |
5823 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
890 | 5824 LODWORD(v727) = 1; |
5825 break; | |
5826 } | |
1009 | 5827 case SPELL_LIGHT_HOUR_OF_POWER: |
993 | 5828 { |
1009 | 5829 switch (v731) |
5830 { | |
5831 case 1: LODWORD(v733) = 4; amount = 4; break; | |
5832 case 2: LODWORD(v733) = 4; amount = 4; break; | |
5833 case 3: LODWORD(v733) = 12; amount = 12; break; | |
5834 case 4: LODWORD(v733) = 20; amount = 15; break; | |
5835 default: | |
5836 assert(false); | |
5837 } | |
993 | 5838 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5839 break; | |
1013 | 5840 y = (char *)(60 * (v2 * LODWORD(v733) + 60)); |
1009 | 5841 v732 = (300 * amount * v2 + 60) << 7; |
5842 v730 = v2 + 5; | |
5843 int _v726 = 0; | |
5844 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
1013 | 5845 *((float *)&v733) = (double)v732 * 0.033333335; |
1009 | 5846 do |
5847 { | |
5848 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5849 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5850 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5851 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5852 | |
5853 //((SpellBuff *)(v553 + 6056))->Apply( | |
1013 | 5854 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0); |
1009 | 5855 if ( *(_QWORD *)v553 ) |
5856 _v726 = 1; | |
5857 ++v553; | |
5858 } | |
5859 while ( v553 <= &pParty->pPlayers[3] ); | |
5860 v562 = v731; | |
1013 | 5861 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0); |
5862 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, 0, 0, 0); | |
5863 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, v730, 0, 0); | |
1009 | 5864 if (!_v726) |
5865 { | |
5866 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); | |
5867 } | |
5868 LODWORD(v727) = 1; | |
5869 break; | |
5870 } | |
5871 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
5872 { | |
5873 amount = 3; | |
5874 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
993 | 5875 { |
5876 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5877 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5878 pCastSpell->spellnum = 0; | |
5879 continue; | |
5880 } | |
1009 | 5881 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5882 break; | |
5883 a2 = 0; | |
5884 _this = (ItemGen *)&pPlayers[1]; | |
5885 do | |
5886 { | |
5887 v563 = 0; | |
5888 do | |
5889 { | |
5890 v564 = _this->uItemID; | |
5891 *(int *)(v563 + _this->uItemID) = 0; | |
5892 v563 += 8; | |
5893 *(int *)(v563 + v564 - 4) = 0; | |
5894 } | |
5895 while ( v563 <= 128 ); | |
5896 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
5897 v566 = (Player **)_this; | |
5898 *(int *)(_this->uItemID + 6460) = v565; | |
5899 v567 = (*v566)->GetMaxMana(); | |
5900 *(int *)(_this->uItemID + 6464) = v567; | |
5901 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); | |
5902 ++a2; | |
5903 _this = (ItemGen *)((char *)_this + 4); | |
5904 } | |
5905 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
5906 v571 = pPlayer; | |
5907 v572 = (char *)&pPlayer->sAgeModifier; | |
5908 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
5909 *(short *)v572 = 120; | |
5910 else | |
5911 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
5912 sRecoveryTime += -5 * v2; | |
5913 ++v571->uNumDivineInterventionCastsThisDay; | |
5914 LODWORD(v727) = 1; | |
5915 break; | |
5916 } | |
5917 case SPELL_DARK_REANIMATE: | |
5918 { | |
5919 switch (v731) | |
5920 { | |
5921 case 1: amount = 2 * v2; break; | |
5922 case 2: amount = 3 * v2; break; | |
5923 case 3: amount = 4 * v2; break; | |
5924 case 4: amount = 5 * v2; break; | |
5925 default: | |
5926 assert(false); | |
5927 } | |
5928 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5929 break; | |
5930 v576 = pCastSpell->spell_target_pid; | |
5931 if (!v576) | |
5932 { | |
5933 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5934 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5935 if ( *((_QWORD *)v585 + 14) ) | |
5936 { | |
5937 ((Player *)v585)->SetCondition(0x11u, 1); | |
5938 v587 = ((Player *)v585)->GetSexByVoice(); | |
5939 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); | |
5940 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
5941 } | |
5942 break; | |
5943 } | |
5944 v577 = (Player *)(PID_ID(v576)); | |
5945 //v726 = v577; | |
5946 if ( v577 == (Player *)-1 ) | |
5947 { | |
5948 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
5949 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5950 pCastSpell->spellnum = 0; | |
5951 continue; | |
5952 } | |
5953 v578 = (int)&pActors[(int)v577]; | |
5954 v721 = v578; | |
5955 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
5956 { | |
5957 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5958 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5959 pCastSpell->spellnum = 0; | |
5960 continue; | |
5961 } | |
5962 ++pSpellSprite.uType; | |
5963 pSpellSprite.stru_24.Reset(); | |
5964 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5965 pSpellSprite.spell_level = v2; | |
5966 pSpellSprite.spell_skill = v731; | |
5967 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5968 pSpellSprite.uAttributes = 0; | |
5969 pSpellSprite.uSectorID = 0; | |
5970 pSpellSprite.uSpriteFrameID = 0; | |
5971 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5972 v581 = v721; | |
5973 pSpellSprite.uFacing = 0; | |
5974 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5975 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5976 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
5977 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
5978 v732 = *(short *)(v721 + 138); | |
5979 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | |
5980 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
5981 pSpellSprite.Create(0, 0, 0, 0); | |
5982 if ( *(char *)(v581 + 52) > amount ) | |
5983 break; | |
5984 Actor::Resurrect((unsigned int)v577); | |
5985 *(char *)(v581 + 61) = 0; | |
5986 *(char *)(v581 + 53) = 0; | |
5987 *(char *)(v581 + 54) = 0; | |
5988 *(char *)(v581 + 55) = 0; | |
5989 *(char *)(v581 + 56) = 0; | |
5990 *(char *)(v581 + 57) = 0; | |
5991 *(int *)(v581 + 712) = 9999; | |
5992 *(char *)(v581 + 38) &= 0xF7u; | |
5993 *(int *)(v581 + 708) = 0; | |
5994 ((SpellBuff *)(v581 + 356))->Reset(); | |
5995 ((SpellBuff *)(v581 + 228))->Reset(); | |
5996 ((SpellBuff *)(v581 + 404))->Reset(); | |
5997 if ( *(short *)(v581 + 40) > 10 * amount ) | |
5998 *(short *)(v581 + 40) = 10 * amount; | |
5999 LODWORD(v727) = 1; | |
6000 break; | |
6001 } | |
6002 case SPELL_DARK_VAMPIRIC_WEAPON: | |
6003 { | |
6004 amount = 16; | |
6005 if ( v731 == 4 ) | |
6006 { | |
6007 LODWORD(v733) = 0; | |
6008 } | |
6009 else | |
6010 { | |
6011 LODWORD(v733) = 3600 * v2; | |
6012 } | |
6013 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6014 break; | |
6015 __debugbreak(); | |
1013 | 6016 //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
6017 ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; | |
6018 ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; | |
6019 _v733->UpdateTempBonus(pParty->uTimePlayed); | |
6020 if ( _v733->uItemID >= 64 && _v733->uItemID <= 65 | |
6021 || LOBYTE(_v733->uAttributes) & 2 | |
6022 || _v733->uSpecEnchantmentType != 0 | |
6023 || _v733->uEnchantmentType != 0 | |
6024 || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2 | |
6025 || pItemsTable->IsMaterialNonCommon(_v733) ) | |
1009 | 6026 { |
6027 dword_50C9D0 = 113; | |
6028 dword_50C9D4 = 0; | |
6029 dword_50C9D8 = 1; | |
6030 | |
6031 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6032 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6033 pCastSpell->spellnum = 0; | |
6034 continue; | |
6035 } | |
1013 | 6036 v592 = _v733; |
1009 | 6037 v14 = v731 == 4; |
1013 | 6038 _v733->uSpecEnchantmentType = 16; |
1009 | 6039 if ( !v14 ) |
6040 { | |
6041 v732 = (int)v733 << 7; | |
1013 | 6042 v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
6043 v592->uAttributes |= 8u; | |
6044 } | |
6045 LOBYTE(v592->uAttributes) |= 0x80u; | |
1009 | 6046 _50C9A8_item_enchantment_timer = 256; |
6047 LODWORD(v727) = 1; | |
6048 break; | |
6049 } | |
6050 case SPELL_DARK_SHARPMETAL: | |
6051 { | |
6052 switch (v731) | |
6053 { | |
6054 case 1: amount = 5; break; | |
6055 case 2: amount = 5; break; | |
6056 case 3: amount = 7; break; | |
6057 case 4: amount = 9; break; | |
6058 default: | |
6059 assert(false); | |
6060 } | |
6061 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6062 break; | |
6063 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
6064 pSpellSprite.stru_24.Reset(); | |
6065 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6066 pSpellSprite.spell_level = v2; | |
6067 pSpellSprite.spell_skill = v731; | |
6068 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6069 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
6070 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
6071 pSpellSprite.uAttributes = 0; | |
6072 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
6073 pSpellSprite.uSectorID = pIndoor->GetSector( | |
6074 pParty->vPosition.x, | |
6075 pParty->vPosition.y, | |
6076 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
6077 pSpellSprite.uSpriteFrameID = 0; | |
6078 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6079 pSpellSprite.spell_target_pid = a2; | |
6080 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6081 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6082 if ( pParty->bTurnBasedModeOn == 1 ) | |
6083 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
6084 v596 = (signed int)_v726 / -2; | |
6085 y = (char *)((signed int)_v726 / 2); | |
6086 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
6087 { | |
6088 v597 = v715.uYawAngle; | |
6089 do | |
6090 { | |
6091 pSpellSprite.uFacing = v596 + v597; | |
6092 if ( pSpellSprite.Create( | |
6093 v596 + v597, | |
6094 v715.uPitchAngle, | |
6095 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
6096 pCastSpell->uPlayerID + 1) != -1 | |
6097 && pParty->bTurnBasedModeOn == 1 ) | |
6098 ++pTurnEngine->field_1C; | |
6099 v596 += _v726 / (amount - 1); | |
6100 } | |
6101 while ( v596 <= (signed int)y ); | |
6102 } | |
6103 LODWORD(v727) = 1; | |
6104 break; | |
6105 } | |
6106 case SPELL_DARK_CONTROL_UNDEAD: | |
6107 { | |
6108 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6109 break; | |
6110 switch (v731) | |
6111 { | |
6112 case 1: LODWORD(v733) = 180 * v2; break; | |
6113 case 2: LODWORD(v733) = 180 * v2; break; | |
6114 case 3: LODWORD(v733) = 300 * v2; break; | |
6115 case 4: LODWORD(v733) = 29030400; break; | |
6116 default: | |
6117 assert(false); | |
6118 } | |
6119 if (PID_TYPE(a2) != OBJECT_Actor) | |
6120 { | |
6121 LODWORD(v727) = 1; | |
6122 break; | |
6123 } | |
6124 pActor = &pActors[PID_ID(a2)]; | |
6125 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6126 break; | |
6127 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) ) | |
6128 { | |
6129 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6130 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6131 pCastSpell->spellnum = 0; | |
6132 continue; | |
6133 } | |
6134 pActor->pActorBuffs[9].Reset(); | |
6135 pActor->pActorBuffs[1].Reset(); | |
6136 pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
993 | 6137 v731, 0, 0, 0); |
6138 pSpellSprite.stru_24.Reset(); | |
6139 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6140 pSpellSprite.spell_level = v2; | |
6141 pSpellSprite.spell_skill = v731; | |
6142 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1009 | 6143 |
6144 v600 = pActor->vPosition.y; | |
6145 v601 = pActor->vPosition.x; | |
993 | 6146 pSpellSprite.uObjectDescID = v60; |
6147 pSpellSprite.vPosition.x = v601; | |
1009 | 6148 v602 = pActor->uActorHeight; |
6149 v603 = pActor->vPosition.z; | |
993 | 6150 pSpellSprite.vPosition.y = v600; |
6151 v676 = v603 + v602; | |
6152 v665 = v600; | |
6153 pSpellSprite.vPosition.z = v603 + v602; | |
6154 v657 = v601; | |
6155 pSpellSprite.uAttributes = 0; | |
6156 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6157 pSpellSprite.uSpriteFrameID = 0; | |
6158 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6159 pSpellSprite.spell_target_pid = a2; | |
6160 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6161 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6162 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6163 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6164 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6165 LODWORD(v727) = 1; |
6166 break; | |
6167 } | |
6168 case SPELL_DARK_SACRIFICE: | |
993 | 6169 { |
6170 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6171 break; | |
1013 | 6172 int _v733 = 0; |
993 | 6173 memset(&achieved_awards, 0, 4000); |
1013 | 6174 int i = 0; |
1009 | 6175 pNPCData = pParty->pHirelings; |
889 | 6176 do |
6177 { | |
1009 | 6178 if ( pNPCData->pName != 0) |
993 | 6179 { |
1013 | 6180 v606 = _v733++; |
6181 achieved_awards[v606] = (AwardType)(i + 1); | |
993 | 6182 } |
1013 | 6183 ++i; |
1009 | 6184 ++pNPCData; |
6185 } | |
6186 while ( pNPCData <= &pParty->pHirelings[1] ); | |
1013 | 6187 i = 0; |
993 | 6188 if ( (signed int)pNPCStats->uNumNewNPCs > 0) |
6189 { | |
1009 | 6190 pNPCData = pNPCStats->pNewNPCData; |
1120 | 6191 //__debugbreak(); // data offset |
1013 | 6192 AwardType *_v734 = &achieved_awards[_v733]; |
993 | 6193 do |
6194 { | |
1009 | 6195 if ( pNPCData->uFlags & 0x80 |
6196 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName)) | |
6197 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) ) | |
993 | 6198 { |
1013 | 6199 v607 = _v734; |
6200 ++_v734; | |
6201 *v607 = (AwardType)(i + 3); | |
993 | 6202 } |
1013 | 6203 ++i; |
1009 | 6204 ++pNPCData; |
993 | 6205 } |
1013 | 6206 while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs ); |
993 | 6207 } |
6208 v608 = pCastSpell->uPlayerID_2; | |
6209 if ( v608 != 4 && v608 != 5 | |
1121 | 6210 //|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) |
6211 || (v609 = achieved_awards[v608 + (unsigned __int8)pParty->field_709 - 4], v609 <= 0) | |
993 | 6212 || v609 >= 3 ) |
6213 { | |
6214 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6215 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6216 pCastSpell->spellnum = 0; | |
6217 continue; | |
6218 } | |
6219 v610 = 76 * v609; | |
1120 | 6220 //*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; |
6221 pParty->pHirelings[v609-1].evt_B = 0; | |
993 | 6222 v611 = pIconsFrameTable->FindIcon("spell96"); |
1009 | 6223 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); |
1120 | 6224 pParty->pHirelings[v609-1].evt_C = pIconsFrameTable->GetIconAnimLength(v611); |
1009 | 6225 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; |
1120 | 6226 pParty->pHirelings[v609-1].evt_A = 1; |
1009 | 6227 |
993 | 6228 v612 = pParty->pPlayers; |
6229 do | |
6230 { | |
6231 v612->sHealth = v612->GetMaxHealth(); | |
6232 v612->sMana = v612->GetMaxMana(); | |
6233 ++v612; | |
6234 } | |
6235 while ( v612 <= &pParty->pPlayers[3] ); | |
6236 v613 = &pOutdoor->ddm; | |
6237 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
6238 v613 = &pIndoor->dlv; | |
6239 v613->uReputation += 15; | |
6240 if ( v613->uReputation > 10000 ) | |
6241 v613->uReputation = 10000; | |
890 | 6242 LODWORD(v727) = 1; |
6243 break; | |
6244 } | |
993 | 6245 case SPELL_DARK_PAIN_REFLECTION: |
6246 { | |
1009 | 6247 switch (v731) |
6248 { | |
6249 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
6250 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
6251 case 3: LODWORD(v733) = 300 * (v2 + 12); break; | |
6252 case 4: LODWORD(v733) = 900 * (v2 + 4); break; | |
6253 default: | |
6254 assert(false); | |
6255 } | |
6256 amount = v2 + 5; | |
993 | 6257 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6258 break; | |
6259 if ( v731 != 3 && v731 != 4 ) | |
6260 { | |
6261 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
1013 | 6262 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 | 6263 LODWORD(v727) = 1; |
6264 break; | |
6265 } | |
6266 a2 = 0; | |
6267 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6268 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
889 | 6269 do |
6270 { | |
993 | 6271 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
6272 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
6273 ++a2; | |
6274 ++v619; | |
6275 } | |
6276 while ( v619 <= &pParty->pPlayers[3] ); | |
6277 LODWORD(v727) = 1; | |
6278 break; | |
6279 } | |
6280 case SPELL_DARK_SOULDRINKER: | |
6281 { | |
6282 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6283 break; | |
6284 pGame->GetIndoorCamera(); | |
6285 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
1013 | 6286 signed int _v733 = sub_46A6AC((int)dword_50BF30, 100, v623); |
993 | 6287 v707.x = 0; |
6288 v707.y = 0; | |
6289 v707.z = 0; | |
6290 pSpellSprite.stru_24.Reset(); | |
6291 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6292 pSpellSprite.spell_level = v2; | |
6293 pSpellSprite.spell_skill = v731; | |
6294 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6295 pSpellSprite.uAttributes = 0; | |
6296 pSpellSprite.uSectorID = 0; | |
6297 pSpellSprite.uSpriteFrameID = 0; | |
6298 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6299 pSpellSprite.uFacing = 0; | |
6300 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6301 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6302 a2 = 0; | |
6303 int _v726 = 0; | |
1013 | 6304 if ( _v733 > 0 ) |
6305 { | |
6306 _v726 = (_v733 * (7 * v2 + 25)); | |
993 | 6307 do |
6308 { | |
6309 v625 = dword_50BF30[a2]; | |
6310 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; | |
6311 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
6312 //v732 = pActors[v625].uActorHeight; | |
6313 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
6314 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6315 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
6316 v628 = a2; | |
6317 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
6318 a2 = v628 + 1; | |
6319 } | |
1013 | 6320 while ( v628 + 1 < _v733 ); |
993 | 6321 } |
6322 v730 = 0; | |
6323 v629 = 1; | |
890 | 6324 do |
6325 { | |
993 | 6326 v630 = pPlayers[v629]; |
6327 if ( !v630->pConditions[2] | |
6328 && !v630->pConditions[12] | |
6329 && !v630->pConditions[13] | |
6330 && !v630->pConditions[14] | |
6331 && !v630->pConditions[15] | |
6332 && !v630->pConditions[16] ) | |
6333 { | |
6334 v631 = v730++; | |
6335 v681[v631] = v629; | |
6336 } | |
6337 ++v629; | |
6338 } | |
6339 while ( v629 <= 4 ); | |
6340 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
1013 | 6341 _v733 = 0; |
993 | 6342 if ( v730 > 0 ) |
6343 { | |
6344 do | |
6345 { | |
6346 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
1013 | 6347 v726 = pPlayers[v681[_v733]]; |
993 | 6348 //v633 = pPlayers[v681[HIDWORD(v733)]]; |
6349 v726->sHealth += v732; | |
6350 //v726 = *(Player **)v632; | |
6351 //v634 = v726->GetMaxHealth(); | |
6352 if ( v726->sHealth > v726->GetMaxHealth()) | |
6353 v726->sHealth = v726->GetMaxHealth(); | |
1013 | 6354 v635 = _v733; |
993 | 6355 |
6356 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); | |
1013 | 6357 _v733 = v635 + 1; |
1009 | 6358 } |
6359 while ( v635 + 1 < v730 ); | |
993 | 6360 } |
6361 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
890 | 6362 LODWORD(v727) = 1; |
6363 break; | |
6364 } | |
6365 case SPELL_DARK_ARMAGEDDON: | |
6366 { | |
993 | 6367 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
6368 { | |
6369 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
6370 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6371 pCastSpell->spellnum = 0; | |
6372 continue; | |
6373 } | |
1009 | 6374 if ( v731 == 4) |
6375 amount = 4; | |
6376 else | |
993 | 6377 amount = 3; |
6378 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
6379 { | |
6380 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6381 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6382 pCastSpell->spellnum = 0; | |
6383 continue; | |
6384 } | |
6385 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6386 break; | |
6387 pParty->armageddon_timer = 256; | |
6388 pParty->field_16140 = v2; | |
6389 ++pPlayer->uNumArmageddonCasts; | |
6390 if ( pParty->bTurnBasedModeOn == 1 ) | |
6391 ++pTurnEngine->field_1C; | |
6392 auto _v726 = 50; | |
6393 do | |
6394 { | |
6395 v642 = rand() % 4096 - 2048; | |
6396 v643 = rand(); | |
6397 v721 = v642 + pParty->vPosition.x; | |
6398 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
1119 | 6399 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0); |
993 | 6400 v644 = rand(); |
6401 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
6402 --_v726; | |
6403 } | |
6404 while ( _v726 != 0 ); | |
890 | 6405 LODWORD(v727) = 1; |
6406 break; | |
6407 } | |
6408 | |
6409 default: | |
993 | 6410 break; |
890 | 6411 } |
924 | 6412 if ( pCastSpell->field_8 & 0x20 ) |
890 | 6413 { |
6414 if ( v727 != 0.0 ) | |
924 | 6415 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 6416 } |
6417 else | |
6418 { | |
6419 if ( sRecoveryTime < 0 ) | |
6420 sRecoveryTime = 0; | |
6421 if ( pParty->bTurnBasedModeOn ) | |
6422 { | |
6423 v645 = sRecoveryTime; | |
924 | 6424 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 6425 pPlayer->SetRecoveryTime(v645); |
6426 if ( !some_active_character ) | |
6427 pTurnEngine->_40471C(); | |
6428 } | |
6429 else | |
6430 { | |
6431 pPlayer->SetRecoveryTime( | |
6432 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
6433 } | |
6434 if ( v727 != 0.0 ) | |
6435 { | |
6436 pPlayer->PlaySound(SPEECH_49, 0); | |
6437 if ( v727 != 0.0 ) | |
924 | 6438 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
889 | 6439 } |
6440 } | |
924 | 6441 pCastSpell->spellnum = 0; |
890 | 6442 v2 = v723; |
6443 continue; | |
0 | 6444 } |
488 | 6445 |
0 | 6446 } |
6447 //----- (0042EB42) -------------------------------------------------------- | |
6448 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
6449 { | |
6450 unsigned int v2; // edx@1 | |
6451 signed int v3; // eax@1 | |
6452 char *v4; // ecx@2 | |
6453 | |
6454 v2 = this->uNumObjects; | |
6455 v3 = 0; | |
6456 if ( (signed int)this->uNumObjects <= 0 ) | |
6457 { | |
6458 LABEL_5: | |
6459 LOWORD(v3) = 0; | |
6460 } | |
6461 else | |
6462 { | |
6463 v4 = (char *)&this->pObjects->uObjectID; | |
6464 while ( uItemID != *(short *)v4 ) | |
6465 { | |
6466 ++v3; | |
6467 v4 += 56; | |
6468 if ( v3 >= (signed int)v2 ) | |
6469 goto LABEL_5; | |
6470 } | |
6471 } | |
6472 return v3; | |
6473 } | |
6474 | |
6475 //----- (0042EB78) -------------------------------------------------------- | |
6476 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
6477 { | |
6478 return 8 * this->pIcons[uIconID].uAnimLength; | |
6479 } | |
6480 | |
437 | 6481 const wchar_t *UIMessage2String(UIMessageType msg) |
6482 { | |
6483 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
6484 static wchar_t b[256]; // bad for threads | |
6485 switch (msg) | |
6486 { | |
6487 CASE(UIMSG_SelectSpell) | |
6488 CASE(UIMSG_ChangeGameState) | |
6489 CASE(UIMSG_Attack) | |
6490 CASE(UIMSG_PlayArcomage) | |
6491 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
6492 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
6493 CASE(UIMSG_ShowCredits) | |
6494 CASE(UIMSG_ExitToWindows) | |
6495 CASE(UIMSG_PlayerCreationChangeName) | |
6496 CASE(UIMSG_PlayerCreationClickPlus) | |
6497 CASE(UIMSG_PlayerCreationClickMinus) | |
6498 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
6499 CASE(UIMSG_PlayerCreationSelectClass) | |
6500 CASE(UIMSG_PlayerCreationClickOK) | |
6501 CASE(UIMSG_PlayerCreationClickReset) | |
996 | 6502 CASE(UIMSG_ClickBooksBtn) |
437 | 6503 CASE(UIMSG_PlayerCreationRemoveUpSkill) |
6504 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
6505 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
6506 CASE(UIMSG_LoadGame) | |
6507 CASE(UIMSG_SaveGame) | |
6508 CASE(UIMSG_ShowStatus_DateTime) | |
6509 CASE(UIMSG_ShowStatus_ManaHP) | |
6510 CASE(UIMSG_ShowStatus_Player) | |
6511 CASE(UIMSG_Wait5Minutes) | |
6512 CASE(UIMSG_Wait1Hour) | |
6513 CASE(UIMSG_ShowStatus_Food) | |
6514 CASE(UIMSG_ShowStatus_Funds) | |
6515 CASE(UIMSG_QuickReference) | |
6516 CASE(UIMSG_GameMenuButton) | |
6517 CASE(UIMSG_AlreadyResting) | |
6518 CASE(UIMSG_SelectCharacter) | |
6519 CASE(UIMSG_ChangeSoundVolume) | |
6520 CASE(UIMSG_ChangeMusicVolume) | |
6521 CASE(UIMSG_Escape) | |
6522 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
6523 CASE(UIMSG_InventoryLeftClick) | |
6524 CASE(UIMSG_SkillUp) | |
6525 CASE(UIMSG_GameMenu_ReturnToGame) | |
6526 CASE(UIMSG_StartNewGame) | |
6527 CASE(UIMSG_Game_OpenLoadGameDialog) | |
6528 CASE(UIMSG_Game_OpenSaveGameDialog) | |
6529 CASE(UIMSG_Game_OpenOptionsDialog) | |
6530 CASE(UIMSG_SetGraphicsMode) | |
6531 CASE(UIMSG_Quit) | |
6532 CASE(UIMSG_StartHireling1Dialogue) | |
6533 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 6534 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 6535 CASE(UIMSG_CastSpellFromBook) |
6536 CASE(UIMSG_PlayerCreation_VoicePrev) | |
6537 CASE(UIMSG_PlayerCreation_VoiceNext) | |
6538 CASE(UIMSG_StartNPCDialogue) | |
6539 CASE(UIMSG_ArrowUp) | |
6540 CASE(UIMSG_DownArrow) | |
961 | 6541 CASE(UIMSG_SaveLoadBtn) |
437 | 6542 CASE(UIMSG_SelectLoadSlot) |
6543 CASE(UIMSG_Cancel) | |
6544 CASE(UIMSG_ExitRest) | |
6545 CASE(UIMSG_PlayerCreation_FacePrev) | |
6546 CASE(UIMSG_PlayerCreation_FaceNext) | |
6547 CASE(UIMSG_CycleCharacters) | |
6548 CASE(UIMSG_SetTurnSpeed) | |
6549 CASE(UIMSG_ToggleWalkSound) | |
6550 CASE(UIMSG_ChangeVoiceVolume) | |
6551 CASE(UIMSG_ToggleShowDamage) | |
6552 CASE(UIMSG_ScrollNPCPanel) | |
6553 CASE(UIMSG_ShowFinalWindow) | |
6554 CASE(UIMSG_OpenQuestBook) | |
6555 CASE(UIMSG_OpenAutonotes) | |
6556 CASE(UIMSG_OpenMapBook) | |
6557 CASE(UIMSG_OpenCalendar) | |
6558 CASE(UIMSG_OpenHistoryBook) | |
6559 CASE(UIMSG_ToggleAlwaysRun) | |
6560 CASE(UIMSG_ToggleFlipOnExit) | |
6561 CASE(UIMSG_Game_Action) | |
907 | 6562 CASE(UIMSG_RentRoom) |
437 | 6563 CASE(UIMSG_TransitionUI_Confirm) |
6564 CASE(UIMSG_OpenKeyMappingOptions) | |
6565 CASE(UIMSG_SelectKeyPage1) | |
6566 CASE(UIMSG_SelectKeyPage2) | |
6567 CASE(UIMSG_ResetKeyMapping) | |
6568 CASE(UIMSG_ChangeKeyButton) | |
6569 CASE(UIMSG_OpenVideoOptions) | |
6570 CASE(UIMSG_ToggleBloodsplats) | |
6571 CASE(UIMSG_ToggleColoredLights) | |
6572 CASE(UIMSG_ToggleTint) | |
6573 default: | |
6574 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
6575 }; | |
6576 #undef CASE | |
6577 } | |
6578 | |
0 | 6579 //----- (0042EB8D) -------------------------------------------------------- |
437 | 6580 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 6581 { |
482 | 6582 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 6583 if (uNumMessages < 40) |
6584 { | |
437 | 6585 files[uNumMessages] = file; |
6586 lines[uNumMessages] = line; | |
6587 | |
0 | 6588 pMessages[uNumMessages].eType = msg; |
6589 pMessages[uNumMessages].param = param; | |
6590 pMessages[uNumMessages++].field_8 = a4; | |
6591 } | |
6592 } | |
6593 | |
6594 //----- (0042EBBE) -------------------------------------------------------- | |
6595 int __fastcall sub_42EBBE(int a1, int a2) | |
6596 { | |
6597 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
6598 } | |
6599 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
6600 | |
6601 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 6602 int stru193_math::Sin(int angle) |
0 | 6603 { |
323 | 6604 return Cos(angle - this->uIntegerHalfPi); |
0 | 6605 } |
6606 | |
6607 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 6608 void _42ECB5_PlayerAttacksActor() |
0 | 6609 { |
271 | 6610 //unsigned int v0; // ebx@1 |
6611 //Player *v1; // esi@1 | |
6612 //bool result; // eax@1 | |
295 | 6613 //int v3; // edi@2 |
271 | 6614 //unsigned int v4; // eax@7 |
0 | 6615 char *v5; // eax@8 |
271 | 6616 //int v6; // ecx@9 |
6617 //signed int v7; // eax@16 | |
295 | 6618 //Actor *v8; // edi@20 |
0 | 6619 unsigned int v9; // ecx@21 |
295 | 6620 //char *v10; // eax@26 |
0 | 6621 char *v11; // eax@26 |
6622 unsigned int v12; // eax@47 | |
295 | 6623 //char *v13; // eax@47 |
6624 //char *v14; // eax@47 | |
6625 //unsigned int v15; // ebx@54 | |
6626 //int v16; // [sp-10h] [bp-4Ch]@24 | |
6627 //int v17; // [sp-10h] [bp-4Ch]@44 | |
6628 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
6629 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
6630 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
6631 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
6632 //int v22; // [sp-4h] [bp-40h]@24 | |
6633 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 6634 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 6635 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 6636 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
6637 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 6638 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 6639 //unsigned int *v28b; |
295 | 6640 //int v29; // [sp+24h] [bp-18h]@16 |
6641 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 6642 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 6643 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 6644 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 6645 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 6646 |
271 | 6647 //v0 = uActiveCharacter; |
6648 //v27 = 6972 * uActiveCharacter; | |
6649 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
6650 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
6651 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
6652 if (!player->CanAct()) | |
6653 return; | |
6654 | |
924 | 6655 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 6656 //v3 = 0; |
271 | 6657 if (pParty->Invisible()) |
6658 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
6659 | |
6660 //v31 = player->pEquipment.uBow; | |
6661 int bow_idx = player->pEquipment.uBow; | |
6662 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
6663 bow_idx = 0; | |
6664 | |
295 | 6665 //v32 = 0; |
6666 int wand_item_id = 0; | |
271 | 6667 //v33 = 0; |
6668 //v4 = v1->pEquipment.uMainHand; | |
6669 int laser_weapon_item_id = 0; | |
6670 | |
6671 int main_hand_idx = player->pEquipment.uMainHand; | |
6672 if (main_hand_idx) | |
0 | 6673 { |
271 | 6674 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 6675 //v5 = (char *)v1 + 36 * v4; |
271 | 6676 if (!item->Broken()) |
6677 { | |
6678 //v28b = &v1->pInventoryItems[v4].uItemID; | |
6679 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 6680 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 6681 { |
295 | 6682 if (item->uNumCharges <= 0) |
6683 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 6684 else |
295 | 6685 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 6686 } |
271 | 6687 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
6688 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 6689 } |
271 | 6690 } |
6691 | |
295 | 6692 //v30 = 0; |
6693 //v29 = 0; | |
6694 //v28 = 0; | |
271 | 6695 //v7 = pMouse->uPointingObjectID; |
6696 | |
6697 int target_pid = pMouse->uPointingObjectID; | |
848 | 6698 int target_type = PID_TYPE(target_pid), |
6699 target_id = PID_ID(target_pid); | |
271 | 6700 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
6701 { | |
6702 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 6703 target_type = PID_TYPE(target_pid); |
6704 target_id = PID_ID(target_pid); | |
271 | 6705 } |
295 | 6706 |
6707 auto actor = &pActors[target_id]; | |
6708 int actor_distance = 0; | |
271 | 6709 if (target_type == OBJECT_Actor) |
6710 { | |
295 | 6711 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
6712 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
6713 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
6714 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
6715 if (actor_distance < 0) | |
6716 actor_distance = 0; | |
6717 } | |
6718 | |
6719 bool shooting_bow = false, | |
6720 shotting_laser = false, | |
816 | 6721 shooting_wand = false, |
6722 melee_attack = false; | |
295 | 6723 if (laser_weapon_item_id) |
6724 { | |
6725 shotting_laser = true; | |
490 | 6726 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 6727 } |
6728 else if (wand_item_id) | |
6729 { | |
6730 shooting_wand = true; | |
6731 | |
6732 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 6733 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 6734 |
6735 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
6736 player->pEquipment.uMainHand = 0; | |
6737 } | |
303 | 6738 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 6739 { |
816 | 6740 melee_attack = true; |
6741 | |
303 | 6742 Vec3_int_ a3; |
6743 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
6744 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
6745 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
6746 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
6747 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6748 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
1080 | 6749 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) |
295 | 6750 _42FA66_do_explosive_impact( |
6751 actor->vPosition.x, | |
6752 actor->vPosition.y, | |
6753 actor->vPosition.z + actor->uActorHeight / 2, | |
6754 0, 512, uActiveCharacter); | |
303 | 6755 } |
6756 else if (bow_idx) | |
6757 { | |
6758 shooting_bow = true; | |
490 | 6759 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 6760 } |
6761 else | |
6762 { | |
816 | 6763 melee_attack = true; |
303 | 6764 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
6765 } | |
6766 | |
816 | 6767 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 6768 { |
816 | 6769 int recovery = player->GetAttackRecoveryTime(false); |
303 | 6770 if (recovery < 30 ) |
6771 recovery = 30; | |
816 | 6772 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 6773 } |
6774 | |
6775 | |
6776 int v34 = 0; | |
6777 if (shooting_wand) | |
6778 return; | |
6779 else if (shooting_bow) | |
6780 { | |
6781 v34 = 5; | |
6782 player->PlaySound(SPEECH_50, 0); | |
6783 } | |
6784 if (shotting_laser) | |
6785 v34 = 7; | |
6786 else | |
6787 { | |
6788 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 6789 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 6790 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
6791 pTurnEngine->_40471C(); | |
6792 } | |
6793 | |
6794 switch (v34) | |
6795 { | |
6796 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
6797 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
6798 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
6799 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
6800 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
6801 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
6802 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
6803 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
6804 } | |
0 | 6805 } |
6806 | |
6807 //----- (0042F184) -------------------------------------------------------- | |
295 | 6808 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 6809 { |
6810 int v4; // edi@1 | |
6811 stru319 *v5; // esi@1 | |
6812 int v6; // eax@2 | |
6813 int v7; // eax@4 | |
6814 int result; // eax@5 | |
6815 int *v9; // edx@8 | |
6816 signed int v10; // ebx@10 | |
6817 int v11; // edi@11 | |
6818 Actor *v12; // esi@12 | |
6819 unsigned __int16 v13; // ax@12 | |
6820 int v14; // eax@22 | |
6821 char v15; // zf@30 | |
6822 int v16; // esi@32 | |
6823 int v17; // ecx@34 | |
6824 stru319 *v18; // eax@39 | |
6825 int v19; // edx@39 | |
6826 int v20; // ecx@41 | |
6827 unsigned __int16 v21; // ax@42 | |
6828 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
6829 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
6830 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
6831 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
6832 int *v26; // [sp+18h] [bp-14h]@8 | |
6833 int v27; // [sp+1Ch] [bp-10h]@10 | |
6834 int *v28; // [sp+20h] [bp-Ch]@10 | |
6835 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
6836 int v30; // [sp+28h] [bp-4h]@6 | |
6837 int i; // [sp+38h] [bp+Ch]@33 | |
6838 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
6839 | |
6840 v4 = 0; | |
6841 v5 = this; | |
6842 v24 = this; | |
6843 if ( pRenderer->pRenderD3D ) | |
6844 { | |
6845 v6 = a3 != 0; | |
6846 if ( a4 ) | |
6847 LOBYTE(v6) = v6 | 8; | |
295 | 6848 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 6849 if ( v7 != -1 ) |
6850 return (unsigned __int16)v7; | |
295 | 6851 else return 0; |
0 | 6852 } |
6853 else | |
6854 { | |
6855 v30 = 0; | |
6856 if ( pRenderer->pActiveZBuffer ) | |
6857 { | |
692 | 6858 v29 = viewparams->uScreen_topL_X; |
6859 v23 = viewparams->uScreen_BttmR_X; | |
6860 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 6861 { |
692 | 6862 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
6863 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
6864 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 6865 do |
6866 { | |
6867 if ( (signed int)v29 < (signed int)v23 ) | |
6868 { | |
6869 v28 = v9; | |
6870 v10 = v4; | |
6871 v27 = v23 - v29; | |
6872 do | |
6873 { | |
6874 v22 = *v28; | |
6875 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6876 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 6877 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6878 v12 = &pActors[PID_ID(v11)]; |
0 | 6879 v13 = v12->uAIState; |
6880 if ( v13 != 5 ) | |
6881 { | |
6882 if ( v13 != 4 | |
6883 && v13 != 11 | |
6884 && v13 != 19 | |
6885 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6886 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 6887 { |
6888 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 6889 && v22 <= pick_depth << 16 ) |
0 | 6890 { |
6891 v14 = 0; | |
6892 if ( v10 > 0 ) | |
6893 { | |
6894 do | |
6895 { | |
6896 if ( dword_50BDA0[v14] == v11 ) | |
6897 break; | |
6898 ++v14; | |
6899 } | |
6900 while ( v14 < v30 ); | |
6901 } | |
6902 if ( v14 == v30 && v10 < 100 ) | |
6903 { | |
6904 ++v30; | |
6905 dword_50BC10[v10] = v22; | |
6906 dword_50BDA0[v10] = v11; | |
6907 ++v10; | |
6908 } | |
6909 } | |
6910 } | |
6911 } | |
6912 } | |
6913 ++v28; | |
6914 --v27; | |
6915 } | |
6916 while ( v27 ); | |
6917 v4 = v30; | |
6918 v5 = v24; | |
6919 } | |
6920 v9 = v26 + 640; | |
6921 v15 = v25-- == 1; | |
6922 v26 += 640; | |
6923 } | |
6924 while ( !v15 ); | |
6925 } | |
6926 if ( v4 > 0 ) | |
6927 { | |
6928 v32 = 1; | |
6929 v16 = (int)dword_50BC10; | |
6930 do | |
6931 { | |
6932 for ( i = v32; i < v4; ++i ) | |
6933 { | |
6934 v17 = dword_50BC10[i]; | |
6935 if ( v17 < *(int *)v16 ) | |
6936 { | |
6937 dword_50BC10[i] = *(int *)v16; | |
6938 *(int *)v16 = v17; | |
6939 } | |
6940 } | |
6941 ++v32; | |
6942 v16 += 4; | |
6943 } | |
6944 while ( v32 - 1 < v4 ); | |
6945 v5 = v24; | |
6946 if ( v4 > 0 ) | |
6947 { | |
6948 v18 = v24; | |
6949 v19 = v4; | |
6950 do | |
6951 { | |
6952 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
6953 v18 += 4; | |
6954 --v19; | |
6955 } | |
6956 while ( v19 ); | |
6957 } | |
6958 } | |
6959 v20 = 0; | |
6960 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
6961 { | |
6962 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
6963 if ( v21 != 4 && v21 != 5 ) | |
6964 break; | |
6965 } | |
6966 if ( v20 != v4 ) | |
6967 { | |
6968 result = 8 * *(int *)&v5[4 * v20].field_0; | |
6969 LOBYTE(result) = result | 3; | |
6970 return result; | |
6971 } | |
6972 } | |
6973 } | |
6974 return 0; | |
6975 } | |
6976 | |
6977 //----- (0042F3D6) -------------------------------------------------------- | |
6978 void InitializeTurnBasedAnimations(void *_this) | |
6979 { | |
6980 unsigned int *v1; // edi@1 | |
6981 | |
6982 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
6983 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
6984 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
6985 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
6986 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
6987 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
6988 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
6989 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
6990 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
6991 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
6992 v1 = pIconIDs_Turn; | |
6993 do | |
6994 { | |
6995 pIconsFrameTable->InitializeAnimation(*v1); | |
6996 ++v1; | |
6997 } | |
6998 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
6999 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
7000 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
7001 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
7002 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
7003 } | |
7004 | |
7005 //----- (0042F4DA) -------------------------------------------------------- | |
7006 signed int __cdecl sub_42F4DA() | |
7007 { | |
7008 signed int v0; // edi@1 | |
82 | 7009 Actor *v1; // esi@4 |
0 | 7010 int v2; // ebx@5 |
7011 int v3; // eax@5 | |
7012 int v4; // ebx@5 | |
7013 unsigned int v5; // ecx@5 | |
7014 int v6; // edx@6 | |
7015 unsigned int v7; // edx@8 | |
7016 unsigned int v8; // edx@10 | |
7017 __int16 v9; // ax@12 | |
7018 signed int result; // eax@20 | |
7019 int v11; // [sp+Ch] [bp-10h]@5 | |
7020 int v12; // [sp+10h] [bp-Ch]@5 | |
7021 signed int v13; // [sp+14h] [bp-8h]@3 | |
7022 | |
7023 v0 = 5120; | |
7024 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7025 v0 = 2560; | |
7026 v13 = 0; | |
7027 if ( (signed int)uNumActors <= 0 ) | |
7028 { | |
7029 LABEL_20: | |
7030 result = 0; | |
7031 } | |
7032 else | |
7033 { | |
82 | 7034 v1 = pActors; |
0 | 7035 while ( 1 ) |
7036 { | |
82 | 7037 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
7038 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
7039 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 7040 v3 = v2; |
7041 v4 = v11; | |
7042 v5 = v12; | |
7043 if ( v3 < v11 ) | |
7044 { | |
7045 v6 = v3; | |
7046 v3 = v11; | |
7047 v4 = v6; | |
7048 } | |
7049 if ( v3 < v12 ) | |
7050 { | |
7051 v7 = v3; | |
7052 v3 = v12; | |
7053 v5 = v7; | |
7054 } | |
7055 if ( v4 < (signed int)v5 ) | |
7056 { | |
7057 v8 = v5; | |
7058 v5 = v4; | |
7059 v4 = v8; | |
7060 } | |
7061 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
7062 { | |
82 | 7063 v9 = v1->uAIState; |
7064 if ( v1->uAIState != 5 ) | |
0 | 7065 { |
7066 if ( v9 != 4 | |
7067 && v9 != 11 | |
7068 && v9 != 19 | |
7069 && v9 != 17 | |
82 | 7070 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 7071 break; |
7072 } | |
7073 } | |
7074 ++v13; | |
82 | 7075 ++v1; |
0 | 7076 if ( v13 >= (signed int)uNumActors ) |
7077 goto LABEL_20; | |
7078 } | |
7079 result = 1; | |
7080 } | |
7081 return result; | |
7082 } | |
7083 | |
7084 //----- (0042F7EB) -------------------------------------------------------- | |
7085 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) | |
7086 { | |
7087 unsigned int v9; // edi@1 | |
7088 signed int v10; // edx@3 | |
7089 char *v11; // ecx@4 | |
7090 unsigned __int16 v12; // ax@7 | |
7091 unsigned int v13; // edx@9 | |
7092 char *v14; // ecx@10 | |
7093 int v15; // esi@17 | |
7094 int v16; // eax@18 | |
7095 int v17; // edi@20 | |
7096 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7097 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 7098 int v21; // [sp+7Ch] [bp-8h]@1 |
7099 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
7100 | |
7101 v9 = uSpriteID; | |
7102 v21 = x; | |
7103 v22 = uSpriteID; | |
7104 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7105 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
|
7106 //SpriteObject::SpriteObject(&a1a); |
0 | 7107 a1a.stru_24.Reset(); |
7108 | |
7109 if ( a9 ) | |
7110 { | |
7111 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
7112 v9 = v22; | |
7113 } | |
7114 v10 = 0; | |
822 | 7115 a1a.spell_skill = 0; |
7116 a1a.spell_level = 0; | |
7117 a1a.spell_id = 0; | |
0 | 7118 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7119 a1a.uType = v9; |
0 | 7120 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
7121 { | |
7122 LABEL_7: | |
7123 v12 = 0; | |
7124 } | |
7125 else | |
7126 { | |
7127 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
7128 while ( (short)v9 != *(short *)v11 ) | |
7129 { | |
7130 ++v10; | |
7131 v11 += 56; | |
7132 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
7133 goto LABEL_7; | |
7134 } | |
7135 v12 = v10; | |
7136 } | |
7137 a1a.uObjectDescID = v12; | |
7138 a1a.vPosition.z = z; | |
7139 a1a.vPosition.x = v21; | |
7140 a1a.vPosition.y = y; | |
7141 a1a.uSoundID = 0; | |
7142 a1a.uAttributes = attributes; | |
7143 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
7144 a1a.uSpriteFrameID = 0; | |
822 | 7145 a1a.spell_caster_pid = 0; |
823 | 7146 a1a.spell_target_pid = 0; |
0 | 7147 if ( !(a1a.uAttributes & 0x10) ) |
7148 { | |
7149 v13 = 0; | |
222 | 7150 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 7151 { |
7152 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
7153 while ( *(short *)v14 != v9 ) | |
7154 { | |
7155 ++v13; | |
7156 v14 += 48; | |
222 | 7157 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 7158 goto LABEL_16; |
7159 } | |
7160 a1a.stru_24.uItemID = v13; | |
7161 } | |
7162 } | |
7163 LABEL_16: | |
7164 if ( a7 ) | |
7165 { | |
7166 v15 = count; | |
7167 if ( count > 0 ) | |
7168 { | |
7169 do | |
7170 { | |
7171 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
7172 v16 = rand(); | |
7173 a1a.Create( | |
7174 (signed __int16)a1a.uFacing, | |
7175 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
7176 a4, | |
7177 0); | |
7178 --v15; | |
7179 } | |
7180 while ( v15 ); | |
7181 } | |
7182 } | |
7183 else | |
7184 { | |
7185 v17 = count; | |
7186 v18 = stru_5C6E00->uIntegerHalfPi; | |
7187 a1a.uFacing = 0; | |
7188 if ( count > 0 ) | |
7189 { | |
7190 do | |
7191 { | |
7192 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
7193 --v17; | |
7194 } | |
7195 while ( v17 ); | |
7196 } | |
7197 } | |
7198 return 1; | |
7199 } | |
7200 | |
7201 //----- (0042F960) -------------------------------------------------------- | |
7202 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
7203 { | |
7204 int v3; // ebx@1 | |
7205 int v4; // edi@1 | |
7206 signed int v5; // edx@1 | |
7207 char *v6; // ecx@2 | |
7208 unsigned __int16 v7; // ax@5 | |
7209 signed int v8; // eax@6 | |
7210 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7211 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 7212 |
7213 v3 = x; | |
7214 v4 = y; | |
7215 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7216 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
|
7217 //SpriteObject::SpriteObject(&a1); |
0 | 7218 a1.stru_24.Reset(); |
7219 | |
7220 v5 = 0; | |
822 | 7221 a1.spell_skill = 0; |
7222 a1.spell_level = 0; | |
7223 a1.spell_id = 0; | |
0 | 7224 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7225 a1.uType = 800; |
0 | 7226 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
7227 { | |
7228 LABEL_5: | |
7229 v7 = 0; | |
7230 } | |
7231 else | |
7232 { | |
7233 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
7234 while ( *(short *)v6 != 800 ) | |
7235 { | |
7236 ++v5; | |
7237 v6 += 56; | |
7238 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
7239 goto LABEL_5; | |
7240 } | |
7241 v7 = v5; | |
7242 } | |
7243 a1.uObjectDescID = v7; | |
7244 a1.vPosition.x = v3; | |
7245 a1.vPosition.y = v4; | |
7246 a1.vPosition.z = z; | |
7247 a1.uSoundID = 0; | |
7248 a1.uAttributes = 0; | |
7249 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
7250 a1.uSpriteFrameID = 0; | |
822 | 7251 a1.spell_caster_pid = 0; |
823 | 7252 a1.spell_target_pid = 0; |
0 | 7253 v8 = a1.Create(0, 0, 0, 0); |
7254 if ( v8 != -1 ) | |
7255 { | |
7256 v9 = 8 * v8; | |
7257 LOBYTE(v9) = v9 | 2; | |
7258 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
7259 } | |
7260 } | |
7261 | |
810 | 7262 |
0 | 7263 |
7264 //----- (0042FA66) -------------------------------------------------------- | |
7265 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
7266 { | |
7267 int v6; // edi@1 | |
7268 int v7; // esi@1 | |
7269 char *v8; // ecx@2 | |
7270 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7271 //int v10; // eax@10 |
0 | 7272 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7273 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7274 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 7275 int v14; // [sp+7Ch] [bp-4h]@1 |
7276 | |
7277 v6 = a1; | |
7278 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7279 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
|
7280 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7281 a1a.uType = 600; |
0 | 7282 a1a.stru_24.Reset(); |
7283 | |
822 | 7284 a1a.spell_id = SPELL_FIRE_FIREBALL; |
7285 a1a.spell_level = 8; | |
7286 a1a.spell_skill = 3; | |
0 | 7287 v14 = 0; |
7288 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
7289 { | |
7290 LABEL_5: | |
7291 v9 = 0; | |
7292 } | |
7293 else | |
7294 { | |
7295 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7296 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 7297 { |
7298 ++v14; | |
7299 v8 += 56; | |
7300 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
7301 goto LABEL_5; | |
7302 } | |
7303 v9 = v14; | |
7304 } | |
7305 a1a.uObjectDescID = v9; | |
7306 a1a.vPosition.x = v6; | |
7307 a1a.vPosition.y = v7; | |
7308 a1a.vPosition.z = a3; | |
7309 a1a.uAttributes = 0; | |
7310 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
7311 a1a.uSpriteFrameID = 0; | |
823 | 7312 a1a.spell_target_pid = 0; |
0 | 7313 a1a.field_60_distance_related_prolly_lod = 0; |
7314 a1a.uFacing = 0; | |
7315 a1a.uSoundID = 0; | |
7316 if ( a6 >= 1 || a6 <= 4 ) | |
7317 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7318 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 7319 } |
7320 else | |
7321 { | |
822 | 7322 a1a.spell_caster_pid = 0; |
0 | 7323 } |
7324 result = a1a.Create(0, 0, 0, 0); | |
7325 if ( result != -1 ) | |
7326 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7327 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 7328 a5, |
7329 SLOWORD(a1a.vPosition.x), | |
7330 SLOWORD(a1a.vPosition.y), | |
7331 SLOWORD(a1a.vPosition.z), | |
7332 0, | |
7333 0); | |
7334 } | |
7335 return result; | |
7336 } | |
7337 | |
7338 //----- (0042FB5C) -------------------------------------------------------- | |
7339 bool __fastcall sub_42FB5C(signed int a1) | |
7340 { | |
7341 int v1; // ecx@3 | |
7342 int v2; // ecx@4 | |
7343 int v3; // ecx@5 | |
7344 int v4; // ecx@6 | |
7345 int v5; // ecx@7 | |
7346 int v6; // ecx@8 | |
7347 char v7; // zf@9 | |
7348 | |
7349 if ( a1 > 39 ) | |
7350 { | |
7351 if ( a1 > 77 ) | |
7352 { | |
7353 if ( a1 == 80 ) | |
7354 return 0; | |
7355 if ( a1 > 84 ) | |
7356 { | |
7357 if ( a1 <= 86 ) | |
7358 return 0; | |
7359 v7 = a1 == 95; | |
7360 goto LABEL_20; | |
7361 } | |
7362 } | |
7363 else | |
7364 { | |
7365 if ( a1 == 77 ) | |
7366 return 0; | |
7367 if ( a1 >= 46 ) | |
7368 { | |
7369 if ( a1 <= 47 || a1 == 51 ) | |
7370 return 0; | |
7371 v7 = a1 == 73; | |
7372 goto LABEL_20; | |
7373 } | |
7374 } | |
7375 return 1; | |
7376 } | |
7377 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
7378 return 1; | |
7379 v2 = v1 - 3; | |
7380 if ( !v2 ) | |
7381 return 0; | |
7382 v3 = v2 - 1; | |
7383 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
7384 return 1; | |
7385 v5 = v4 - 8; | |
7386 if ( !v5 ) | |
7387 return 0; | |
7388 v6 = v5 - 1; | |
7389 if ( !v6 ) | |
7390 return 1; | |
7391 v7 = v6 == 20; | |
7392 LABEL_20: | |
7393 if ( !v7 ) | |
7394 return 1; | |
7395 return 0; | |
7396 } | |
7397 | |
7398 //----- (0042FBDD) -------------------------------------------------------- | |
7399 void __cdecl sub_42FBDD() | |
7400 { | |
388 | 7401 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 7402 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
7403 pRenderer->Present(); | |
7404 } | |
7405 | |
7406 //----- (0042FC15) -------------------------------------------------------- | |
11 | 7407 void __cdecl CloseWindowBackground() |
0 | 7408 { |
388 | 7409 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 7410 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
7411 pRenderer->Present(); | |
7412 } | |
7413 | |
7414 //----- (0042FC4E) -------------------------------------------------------- | |
7415 void __cdecl ProcessInputActions() | |
7416 { | |
7417 char v4; // al@9 | |
7418 char v8; // bl@100 | |
7419 unsigned __int16 v9; // ax@102 | |
7420 int v10; // eax@103 | |
7421 char v14; // al@159 | |
7422 unsigned int v15; // eax@168 | |
7423 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
7424 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
7425 int v24; // [sp+4h] [bp-4h]@87 | |
7426 | |
7427 pGame->pKeyboardInstance->EnterCriticalSection(); | |
7428 auto pKeyboard = pGame->pKeyboardInstance; | |
7429 if (!bAlwaysRun) | |
7430 { | |
7431 if (pKeyboard->IsShiftHeld()) | |
7432 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
7433 else | |
7434 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
7435 } | |
7436 else | |
7437 { | |
7438 if (pKeyboard->IsShiftHeld()) | |
7439 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
7440 else | |
7441 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
7442 } | |
7443 | |
140 | 7444 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
1052 | 7445 |
7446 | |
7447 // WUT? double event trigger | |
7448 /*for ( uint i = 0; i < 30; ++i ) | |
998 | 7449 { |
7450 if ( pKeyActionMap->pToggleTypes[i] ) | |
7451 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
7452 else | |
7453 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1052 | 7454 if ( v14 ) |
998 | 7455 { |
1052 | 7456 if (pCurrentScreen == SCREEN_GAME) |
998 | 7457 { |
7458 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
7459 continue; | |
7460 } | |
7461 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
7462 { | |
7463 v15 = pMessageQueue_50CBD0->uNumMessages; | |
7464 if ( pMessageQueue_50CBD0->uNumMessages ) | |
7465 { | |
7466 v15 = 0; | |
7467 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
7468 { | |
7469 v15 = 1; | |
7470 pMessageQueue_50CBD0->uNumMessages = 0; | |
7471 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
7472 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7473 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7474 ++pMessageQueue_50CBD0->uNumMessages; | |
7475 continue; | |
7476 } | |
7477 pMessageQueue_50CBD0->uNumMessages = 0; | |
7478 } | |
7479 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7480 } | |
7481 } | |
1052 | 7482 }*/ |
0 | 7483 if ( !pEventTimer->bPaused ) |
7484 { | |
998 | 7485 for ( uint i = 0; i < 30; ++i ) |
0 | 7486 { |
998 | 7487 inputAction = (InputAction)i; |
7488 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
7489 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 7490 else |
998 | 7491 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 7492 if ( v4 ) |
7493 { | |
7494 switch ( inputAction ) | |
7495 { | |
7496 case INPUT_MoveForward: | |
271 | 7497 if (pCurrentScreen != SCREEN_GAME) |
0 | 7498 break; |
7499 if (!pParty->bTurnBasedModeOn) | |
7500 { | |
140 | 7501 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 7502 partyAction = PARTY_RunForward; |
7503 else | |
7504 partyAction = PARTY_WalkForward; | |
998 | 7505 pPartyActionQueue->Add(partyAction); |
163 | 7506 break; |
7507 } | |
7508 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
7509 { | |
7510 pTurnEngine->uActionPointsLeft -= 26; | |
7511 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
7512 partyAction = PARTY_RunForward; | |
7513 else | |
7514 partyAction = PARTY_WalkForward; | |
998 | 7515 pPartyActionQueue->Add(partyAction); |
163 | 7516 break; |
0 | 7517 } |
7518 break; | |
7519 case INPUT_MoveBackwards: | |
271 | 7520 if (pCurrentScreen != SCREEN_GAME) |
0 | 7521 break; |
7522 if (!pParty->bTurnBasedModeOn) | |
17 | 7523 { |
7524 if ( pParty->uFlags2 & 2 ) | |
7525 partyAction = PARTY_RunBackward; | |
7526 else | |
7527 partyAction = PARTY_WalkBackward; | |
998 | 7528 pPartyActionQueue->Add(partyAction); |
163 | 7529 break; |
17 | 7530 } |
0 | 7531 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
7532 { | |
7533 pTurnEngine->uActionPointsLeft -= 26; | |
7534 if ( pParty->uFlags2 & 2 ) | |
7535 partyAction = PARTY_RunBackward; | |
7536 else | |
7537 partyAction = PARTY_WalkBackward; | |
998 | 7538 pPartyActionQueue->Add(partyAction); |
163 | 7539 break; |
0 | 7540 } |
7541 break; | |
7542 case INPUT_StrafeLeft: | |
271 | 7543 if (pCurrentScreen != SCREEN_GAME) |
0 | 7544 break; |
7545 if (!pParty->bTurnBasedModeOn) | |
17 | 7546 { |
7547 partyAction = PARTY_StrafeLeft; | |
998 | 7548 pPartyActionQueue->Add(partyAction); |
163 | 7549 break; |
17 | 7550 } |
0 | 7551 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
7552 break; | |
7553 pTurnEngine->uActionPointsLeft -= 26; | |
7554 partyAction = PARTY_StrafeLeft; | |
998 | 7555 pPartyActionQueue->Add(partyAction); |
7556 break; | |
0 | 7557 case INPUT_StrafeRight: |
271 | 7558 if (pCurrentScreen != SCREEN_GAME) |
0 | 7559 break; |
7560 if (!pParty->bTurnBasedModeOn) | |
17 | 7561 { |
7562 partyAction = PARTY_StrafeRight; | |
998 | 7563 pPartyActionQueue->Add(partyAction); |
163 | 7564 break; |
17 | 7565 } |
0 | 7566 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
7567 break; | |
7568 pTurnEngine->uActionPointsLeft -= 26; | |
7569 partyAction = PARTY_StrafeRight; | |
998 | 7570 pPartyActionQueue->Add(partyAction); |
163 | 7571 break; |
0 | 7572 case INPUT_TurnLeft: |
271 | 7573 if (pCurrentScreen != SCREEN_GAME) |
0 | 7574 break; |
7575 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
7576 { | |
7577 if (pParty->bTurnBasedModeOn) | |
7578 { | |
7579 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
7580 break; | |
7581 pTurnEngine->uActionPointsLeft -= 26; | |
7582 } | |
998 | 7583 partyAction = PARTY_StrafeLeft; |
0 | 7584 } |
7585 else | |
7586 { | |
7587 if ( pParty->uFlags2 & 2 ) | |
998 | 7588 partyAction = PARTY_FastTurnLeft; |
0 | 7589 else |
998 | 7590 partyAction = PARTY_TurnLeft; |
0 | 7591 } |
998 | 7592 pPartyActionQueue->Add(partyAction); |
0 | 7593 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
7594 { | |
271 | 7595 pWeather->OnPlayerTurn(10); |
0 | 7596 } |
7597 break; | |
7598 case INPUT_TurnRight: | |
271 | 7599 if (pCurrentScreen != SCREEN_GAME) |
0 | 7600 break; |
7601 if ( GetAsyncKeyState(17) ) // strafing | |
7602 { | |
7603 if (pParty->bTurnBasedModeOn) | |
7604 { | |
7605 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
7606 break; | |
7607 pTurnEngine->uActionPointsLeft -= 26; | |
7608 } | |
998 | 7609 partyAction = PARTY_StrafeRight; |
0 | 7610 } |
7611 else | |
7612 { | |
7613 if ( pParty->uFlags2 & 2 ) | |
998 | 7614 partyAction = PARTY_FastTurnRight; |
0 | 7615 else |
998 | 7616 partyAction = PARTY_TurnRight; |
0 | 7617 } |
998 | 7618 pPartyActionQueue->Add(partyAction); |
0 | 7619 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
7620 { | |
271 | 7621 pWeather->OnPlayerTurn(-10); |
0 | 7622 } |
7623 break; | |
7624 case INPUT_Jump: | |
271 | 7625 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 7626 break; |
7627 partyAction = (PartyAction)12; | |
998 | 7628 pPartyActionQueue->Add(partyAction); |
163 | 7629 break; |
0 | 7630 case INPUT_Yell: |
187 | 7631 if (!pCurrentScreen && uActiveCharacter) |
0 | 7632 { |
7633 pParty->Yell(); | |
187 | 7634 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 7635 } |
187 | 7636 break; |
0 | 7637 case INPUT_Pass: |
7638 if ( pCurrentScreen ) | |
7639 break; | |
7640 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 7641 { |
7642 pTurnEngine->field_18 |= 8u; | |
7643 break; | |
7644 } | |
0 | 7645 if ( uActiveCharacter ) |
7646 { | |
998 | 7647 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 7648 { |
998 | 7649 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 7650 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7651 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 7652 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 7653 pTurnEngine->_40471C(); |
7654 } | |
7655 } | |
7656 break; | |
998 | 7657 case INPUT_Combat://if press ENTER |
271 | 7658 if (pCurrentScreen == SCREEN_GAME) |
0 | 7659 { |
7660 if (pParty->bTurnBasedModeOn) | |
7661 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7662 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 7663 { |
7664 pParty->bTurnBasedModeOn = 0; | |
7665 pTurnEngine->End(true); | |
7666 } | |
7667 } | |
7668 else | |
7669 { | |
7670 pTurnEngine->Start(); | |
7671 pParty->bTurnBasedModeOn = true; | |
7672 } | |
7673 } | |
7674 break; | |
7675 case INPUT_CastReady: | |
271 | 7676 if (pCurrentScreen != SCREEN_GAME) |
0 | 7677 break; |
7678 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 7679 { |
7680 pTurnEngine->field_18 |= 8u; | |
7681 break; | |
7682 } | |
0 | 7683 if ( !uActiveCharacter ) |
7684 break; | |
998 | 7685 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 7686 if ( !v8 |
7687 || bUnderwater | |
998 | 7688 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
7689 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
7690 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
7691 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
7692 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
7693 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 7694 { |
998 | 7695 pPartyActionQueue = pPartyActionQueue; |
437 | 7696 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
7697 break; | |
0 | 7698 } |
7699 else | |
7700 { | |
1012 | 7701 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); |
0 | 7702 } |
7703 break; | |
7704 case INPUT_Attack: | |
271 | 7705 if (pCurrentScreen != SCREEN_GAME) |
0 | 7706 break; |
998 | 7707 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3) |
7708 { | |
7709 pTurnEngine->field_18 |= 8u; | |
7710 break; | |
7711 } | |
7712 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 7713 break; |
7714 case INPUT_EventTrigger: | |
271 | 7715 if (pCurrentScreen == SCREEN_GAME) |
0 | 7716 { |
437 | 7717 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 7718 break; |
0 | 7719 } |
151 | 7720 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 7721 { |
7722 if ( pMessageQueue_50CBD0->uNumMessages ) | |
7723 { | |
437 | 7724 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 7725 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
7726 { | |
7727 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 7728 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7729 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7730 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7731 ++pMessageQueue_50CBD0->uNumMessages; | |
7732 break; | |
7733 } | |
437 | 7734 break; |
0 | 7735 } |
437 | 7736 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 7737 } |
7738 break; | |
7739 case INPUT_CharCycle: | |
1012 | 7740 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 7741 break; |
1012 | 7742 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40 |
437 | 7743 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7744 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 7745 ++dword_50C9E8;*/ |
7746 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); | |
163 | 7747 break; |
0 | 7748 case INPUT_LookUp: |
7749 if ( pEventTimer->bPaused ) | |
7750 break; | |
7751 partyAction = (PartyAction)7; | |
998 | 7752 pPartyActionQueue->Add(partyAction); |
163 | 7753 break; |
0 | 7754 case INPUT_CenterView: |
7755 if ( pEventTimer->bPaused ) | |
7756 break; | |
7757 partyAction = (PartyAction)9; | |
998 | 7758 pPartyActionQueue->Add(partyAction); |
163 | 7759 break; |
0 | 7760 case INPUT_LookDown: |
7761 if ( pEventTimer->bPaused ) | |
7762 break; | |
7763 partyAction = (PartyAction)8; | |
998 | 7764 pPartyActionQueue->Add(partyAction); |
163 | 7765 break; |
0 | 7766 case INPUT_FlyUp: |
998 | 7767 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 7768 break; |
7769 partyAction = (PartyAction)13; | |
998 | 7770 pPartyActionQueue->Add(partyAction); |
163 | 7771 break; |
0 | 7772 case INPUT_Land: |
998 | 7773 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 7774 break; |
7775 partyAction = (PartyAction)15; | |
998 | 7776 pPartyActionQueue->Add(partyAction); |
163 | 7777 break; |
0 | 7778 case INPUT_FlyDown: |
7779 if ( !pCurrentScreen | |
7780 && !pEventTimer->bPaused ) | |
7781 { | |
7782 partyAction = (PartyAction)14; | |
998 | 7783 pPartyActionQueue->Add(partyAction); |
0 | 7784 } |
7785 break; | |
7786 case INPUT_ZoomIn: | |
1012 | 7787 /*if ( dword_50C9E8 >= 40 ) |
0 | 7788 break; |
7789 dword_50C9EC[3 * dword_50C9E8] = 367; | |
437 | 7790 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7791 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 7792 ++dword_50C9E8;*/ |
7793 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); | |
163 | 7794 break; |
0 | 7795 case INPUT_ZoomOut: |
1012 | 7796 /*if ( dword_50C9E8 < 40 ) |
0 | 7797 { |
7798 dword_50C9EC[3 * dword_50C9E8] = 368; | |
437 | 7799 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7800 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 7801 ++dword_50C9E8; |
1012 | 7802 }*/ |
7803 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); | |
0 | 7804 break; |
7805 case INPUT_AlwaysRun: | |
7806 bAlwaysRun = bAlwaysRun == 0; | |
7807 break; | |
17 | 7808 default: |
7809 break; | |
0 | 7810 } |
7811 } | |
7812 } | |
7813 } | |
7814 } |