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