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