Mercurial > mm7
annotate mm7_6.cpp @ 932:02984766816f
m
author | Ritor1 |
---|---|
date | Wed, 01 May 2013 15:18:41 +0600 |
parents | 88e15900c982 |
children | b462b598b97a |
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 "stru279.h" | |
35 #include "TurnEngine.h" | |
924 | 36 #include "CastSpellInfo.h" |
0 | 37 #include "Weather.h" |
38 #include "stru272.h" | |
39 #include "stru298.h" | |
189 | 40 #include "texts.h" |
0 | 41 #include "StorylineTextTable.h" |
42 #include "Events2D.h" | |
370 | 43 #include "Log.h" |
0 | 44 |
45 #include "mm7_data.h" | |
46 | |
47 | |
48 | |
49 //----- (00424EE0) -------------------------------------------------------- | |
50 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
51 { | |
52 unsigned int v1; // edx@1 | |
53 double v2; // st7@1 | |
54 signed int v3; // edi@1 | |
55 char *v4; // esi@4 | |
56 char *v5; // ecx@4 | |
57 unsigned int v6; // eax@4 | |
58 char *v7; // edx@4 | |
59 double v8; // st6@10 | |
60 double v9; // st5@10 | |
61 double v10; // st6@11 | |
62 unsigned __int8 v11; // c2@15 | |
63 unsigned __int8 v12; // c3@15 | |
64 void *v13; // edi@22 | |
65 char *v14; // eax@22 | |
66 double v15; // st6@22 | |
67 char *v16; // ecx@22 | |
68 signed int result; // eax@24 | |
69 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
70 bool v19; // [sp+Ch] [bp-28h]@6 | |
71 char *v20; // [sp+10h] [bp-24h]@4 | |
72 char *v21; // [sp+14h] [bp-20h]@4 | |
73 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
74 char *v23; // [sp+1Ch] [bp-18h]@4 | |
75 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
76 char *v25; // [sp+24h] [bp-10h]@4 | |
77 char *v26; // [sp+28h] [bp-Ch]@4 | |
78 char *v27; // [sp+2Ch] [bp-8h]@4 | |
79 char *v28; // [sp+30h] [bp-4h]@4 | |
80 | |
81 v1 = uVertexID; | |
82 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
83 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
84 v3 = 0; | |
85 v22 = 0; | |
86 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
87 v3 = 1; | |
88 if ( (signed int)(uVertexID + 1) <= 1 ) | |
89 return 0; | |
90 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
91 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
92 v6 = v1; | |
93 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 94 v26 = (char *)&array_507D30[0]._rhw; |
0 | 95 v24 = array_507D30; |
96 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
97 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
98 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
99 v27 = (char *)&array_507D30[0].v; | |
100 v28 = (char *)&array_507D30[0].u; | |
101 v7 = (char *)&array_50AC10[0].v; | |
102 v18 = v6; | |
103 do | |
104 { | |
105 v19 = v2 >= *((float *)v7 + 5); | |
106 if ( v3 != v19 ) | |
107 { | |
108 if ( v19 ) | |
109 { | |
110 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
111 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
112 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
113 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
114 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
115 } | |
116 else | |
117 { | |
118 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
119 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
120 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
121 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
122 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
123 } | |
124 *(float *)v27 = v9; | |
125 *(float *)v25 = v2; | |
126 *(float *)v26 = 1.0 / v2; | |
127 if ( v3 ) | |
128 { | |
129 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
130 { | |
131 v11 = 0; | |
132 v12 = *(float *)v4 == *((float *)v7 - 5); | |
133 goto LABEL_19; | |
134 } | |
135 } | |
136 else | |
137 { | |
138 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
139 { | |
140 v11 = 0; | |
141 v12 = *(float *)v4 == *((float *)v7 + 7); | |
142 LABEL_19: | |
143 if ( v12 | v11 ) | |
144 goto LABEL_21; | |
145 goto LABEL_20; | |
146 } | |
147 } | |
148 LABEL_20: | |
149 v26 += 48; | |
150 ++v24; | |
151 v25 += 48; | |
152 v27 += 48; | |
153 v28 += 48; | |
154 v5 += 48; | |
155 v4 += 48; | |
156 ++v22; | |
157 v23 += 48; | |
158 v21 = v5; | |
159 v20 = v4; | |
160 } | |
161 LABEL_21: | |
162 if ( v19 ) | |
163 { | |
164 v13 = v24; | |
165 v14 = v26; | |
166 v21 += 48; | |
167 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
168 v20 += 48; | |
169 ++v22; | |
170 v28 += 48; | |
171 v27 += 48; | |
172 v25 += 48; | |
173 ++v24; | |
174 v26 += 48; | |
175 memcpy(v13, v7 + 8, 0x30u); | |
176 v16 = v23; | |
177 v23 += 48; | |
178 v4 = v20; | |
179 *(float *)v14 = v15; | |
180 *(int *)v16 = *((int *)v7 + 13); | |
181 v5 = v21; | |
182 } | |
183 v3 = v19; | |
184 v7 += 48; | |
185 --v18; | |
186 } | |
187 while ( v18 ); | |
188 result = v22; | |
189 if ( v22 < 3 ) | |
190 return 0; | |
191 return result; | |
192 } | |
193 | |
194 //----- (004250FE) -------------------------------------------------------- | |
195 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
196 { | |
197 unsigned int v1; // edx@1 | |
198 char *v2; // edi@5 | |
199 char *v3; // esi@5 | |
200 char *v4; // ecx@5 | |
201 int v5; // ebx@6 | |
202 double v6; // st6@11 | |
203 double v7; // st5@11 | |
204 double v8; // st6@12 | |
205 unsigned __int8 v9; // c2@16 | |
206 unsigned __int8 v10; // c3@16 | |
207 void *v11; // edi@23 | |
208 double v12; // st6@23 | |
209 char *v13; // ecx@23 | |
210 char v14; // zf@24 | |
211 signed int result; // eax@25 | |
212 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
213 bool v17; // [sp+Ch] [bp-24h]@2 | |
214 bool v18; // [sp+10h] [bp-20h]@7 | |
215 char *v19; // [sp+14h] [bp-1Ch]@5 | |
216 char *v20; // [sp+18h] [bp-18h]@5 | |
217 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
218 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
219 char *v23; // [sp+24h] [bp-Ch]@5 | |
220 char *v24; // [sp+28h] [bp-8h]@5 | |
221 char *v25; // [sp+2Ch] [bp-4h]@5 | |
222 | |
223 v1 = uVertexID; | |
224 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
225 v21 = 0; | |
226 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
227 if ( (signed int)(uVertexID + 1) <= 1 ) | |
228 return 0; | |
229 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
230 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 231 v24 = (char *)&array_507D30[0]._rhw; |
0 | 232 v22 = array_507D30; |
233 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
234 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
235 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
236 v25 = (char *)&array_507D30[0].flt_2C; | |
237 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
238 v16 = v1; | |
239 do | |
240 { | |
241 v5 = (int)(v4 + 48); | |
242 v18 = *((float *)v4 + 12) >= 8.0; | |
243 if ( v17 != v18 ) | |
244 { | |
245 if ( v18 ) | |
246 { | |
247 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
248 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
249 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
250 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
251 } | |
252 else | |
253 { | |
254 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
255 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
256 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
257 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
258 } | |
259 *(float *)v25 = v7; | |
260 *(float *)v23 = 8.0; | |
261 *(int *)v24 = 0x3E000000u; | |
262 if ( v17 ) | |
263 { | |
264 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
265 { | |
266 v9 = 0; | |
267 v10 = *(float *)v2 == *((float *)v4 + 2); | |
268 goto LABEL_20; | |
269 } | |
270 } | |
271 else | |
272 { | |
273 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
274 { | |
275 v9 = 0; | |
276 v10 = *(float *)v2 == *((float *)v4 + 14); | |
277 LABEL_20: | |
278 if ( v10 | v9 ) | |
279 goto LABEL_22; | |
280 goto LABEL_21; | |
281 } | |
282 } | |
283 LABEL_21: | |
284 ++v22; | |
285 v23 += 48; | |
286 v25 += 48; | |
287 v3 += 48; | |
288 v2 += 48; | |
289 ++v21; | |
290 v24 += 48; | |
291 v20 = v3; | |
292 v19 = v2; | |
293 } | |
294 LABEL_22: | |
295 if ( v18 ) | |
296 { | |
297 v11 = v22; | |
298 v20 += 48; | |
299 v19 += 48; | |
300 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
301 ++v21; | |
302 v25 += 48; | |
303 v23 += 48; | |
304 ++v22; | |
305 memcpy(v11, v4 + 36, 0x30u); | |
306 v13 = v24; | |
307 v24 += 48; | |
308 v3 = v20; | |
309 v2 = v19; | |
310 *(float *)v13 = v12; | |
311 } | |
312 v14 = v16-- == 1; | |
313 v17 = v18; | |
314 v4 = (char *)v5; | |
315 } | |
316 while ( !v14 ); | |
317 result = v21; | |
318 if ( v21 < 3 ) | |
319 return 0; | |
320 return result; | |
321 } | |
322 | |
323 //----- (004252E8) -------------------------------------------------------- | |
324 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
325 { | |
326 unsigned int v1; // edx@1 | |
327 double v2; // st7@1 | |
328 char *v3; // edi@5 | |
329 char *v4; // esi@5 | |
330 char *v5; // ecx@5 | |
331 int v6; // ebx@6 | |
332 double v7; // st6@11 | |
333 double v8; // st5@11 | |
334 double v9; // st6@12 | |
335 unsigned __int8 v10; // c2@16 | |
336 unsigned __int8 v11; // c3@16 | |
337 void *v12; // edi@23 | |
338 double v13; // st6@23 | |
339 char *v14; // ecx@23 | |
340 char v15; // zf@24 | |
341 signed int result; // eax@25 | |
342 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
343 bool v18; // [sp+Ch] [bp-24h]@2 | |
344 bool v19; // [sp+10h] [bp-20h]@7 | |
345 char *v20; // [sp+14h] [bp-1Ch]@5 | |
346 char *v21; // [sp+18h] [bp-18h]@5 | |
347 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
348 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
349 char *v24; // [sp+24h] [bp-Ch]@5 | |
350 char *v25; // [sp+28h] [bp-8h]@5 | |
351 char *v26; // [sp+2Ch] [bp-4h]@5 | |
352 | |
353 v1 = uVertexID; | |
354 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
355 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
356 v22 = 0; | |
357 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
358 if ( (signed int)(uVertexID + 1) <= 1 ) | |
359 return 0; | |
360 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
361 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 362 v25 = (char *)&array_507D30[0]._rhw; |
0 | 363 v23 = array_507D30; |
364 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
365 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
366 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
367 v26 = (char *)&array_507D30[0].flt_2C; | |
368 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
369 v17 = v1; | |
370 do | |
371 { | |
372 v6 = (int)(v5 + 48); | |
373 v19 = v2 >= *((float *)v5 + 12); | |
374 if ( v18 != v19 ) | |
375 { | |
376 if ( v19 ) | |
377 { | |
378 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
379 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
380 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
381 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
382 } | |
383 else | |
384 { | |
385 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
386 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
387 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
388 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
389 } | |
390 *(float *)v26 = v8; | |
391 *(float *)v24 = v2; | |
392 *(float *)v25 = 1.0 / v2; | |
393 if ( v18 ) | |
394 { | |
395 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
396 { | |
397 v10 = 0; | |
398 v11 = *(float *)v3 == *((float *)v5 + 2); | |
399 goto LABEL_20; | |
400 } | |
401 } | |
402 else | |
403 { | |
404 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
405 { | |
406 v10 = 0; | |
407 v11 = *(float *)v3 == *((float *)v5 + 14); | |
408 LABEL_20: | |
409 if ( v11 | v10 ) | |
410 goto LABEL_22; | |
411 goto LABEL_21; | |
412 } | |
413 } | |
414 LABEL_21: | |
415 ++v23; | |
416 v24 += 48; | |
417 v26 += 48; | |
418 v4 += 48; | |
419 v3 += 48; | |
420 ++v22; | |
421 v25 += 48; | |
422 v21 = v4; | |
423 v20 = v3; | |
424 } | |
425 LABEL_22: | |
426 if ( v19 ) | |
427 { | |
428 v12 = v23; | |
429 v21 += 48; | |
430 v20 += 48; | |
431 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
432 ++v22; | |
433 v26 += 48; | |
434 v24 += 48; | |
435 ++v23; | |
436 memcpy(v12, v5 + 36, 0x30u); | |
437 v14 = v25; | |
438 v25 += 48; | |
439 v4 = v21; | |
440 v3 = v20; | |
441 *(float *)v14 = v13; | |
442 } | |
443 v15 = v17-- == 1; | |
444 v18 = v19; | |
445 v5 = (char *)v6; | |
446 } | |
447 while ( !v15 ); | |
448 result = v22; | |
449 if ( v22 < 3 ) | |
450 return 0; | |
451 return result; | |
452 } | |
453 | |
454 //----- (004254D2) -------------------------------------------------------- | |
455 int __fastcall sr_4254D2(signed int a1) | |
456 { | |
457 signed int v1; // ebx@2 | |
458 int v2; // ecx@2 | |
459 int result; // eax@11 | |
460 double v4; // ST74_8@12 | |
461 bool v5; // edi@12 | |
462 char *v6; // esi@13 | |
463 char *v7; // ebx@13 | |
464 double v8; // st7@15 | |
465 double v9; // st7@16 | |
466 double v10; // st6@16 | |
467 double v11; // st7@17 | |
468 float v12; // eax@18 | |
469 double v13; // ST4C_8@19 | |
470 double v14; // ST10_8@19 | |
471 double v15; // ST28_8@20 | |
472 double v16; // ST34_8@20 | |
473 char v17; // zf@20 | |
474 double v18; // ST18_8@21 | |
475 double v19; // ST3C_8@21 | |
476 double v20; // ST44_8@22 | |
477 double v21; // ST54_8@22 | |
478 void *v22; // edi@26 | |
479 double v23; // ST54_8@29 | |
480 bool v24; // esi@29 | |
481 char *v25; // edi@30 | |
482 char *v26; // ebx@30 | |
483 bool v27; // ecx@32 | |
484 double v28; // st7@33 | |
485 double v29; // st7@34 | |
486 double v30; // st6@34 | |
487 double v31; // st7@35 | |
488 double v32; // ST44_8@37 | |
489 double v33; // ST3C_8@37 | |
490 double v34; // ST18_8@38 | |
491 double v35; // ST34_8@38 | |
492 char v36; // zf@38 | |
493 double v37; // ST28_8@39 | |
494 double v38; // ST10_8@39 | |
495 double v39; // ST20_8@40 | |
496 double v40; // ST5C_8@40 | |
497 void *v41; // edi@44 | |
498 double v42; // ST5C_8@47 | |
499 bool v43; // edi@47 | |
500 char *v44; // esi@48 | |
501 char *v45; // ebx@48 | |
502 bool v46; // ecx@49 | |
503 double v47; // st6@50 | |
504 double v48; // st6@51 | |
505 double v49; // st5@51 | |
506 double v50; // st6@52 | |
507 double v51; // ST20_8@54 | |
508 double v52; // ST54_8@54 | |
509 double v53; // ST44_8@55 | |
510 double v54; // ST3C_8@55 | |
511 char v55; // zf@55 | |
512 double v56; // ST18_8@56 | |
513 double v57; // ST34_8@56 | |
514 double v58; // ST28_8@57 | |
515 double v59; // ST10_8@57 | |
516 void *v60; // edi@61 | |
517 double v61; // ST5C_8@64 | |
518 bool v62; // edi@64 | |
519 char *v63; // esi@65 | |
520 char *v64; // ebx@65 | |
521 bool v65; // ecx@66 | |
522 double v66; // st6@67 | |
523 double v67; // st6@68 | |
524 double v68; // st5@68 | |
525 double v69; // st6@69 | |
526 double v70; // ST20_8@71 | |
527 double v71; // ST54_8@71 | |
528 double v72; // ST44_8@72 | |
529 double v73; // ST3C_8@72 | |
530 char v74; // zf@72 | |
531 double v75; // ST18_8@73 | |
532 double v76; // ST34_8@73 | |
533 double v77; // ST28_8@74 | |
534 double v78; // ST10_8@74 | |
535 void *v79; // edi@78 | |
536 int v80; // ebx@81 | |
537 char *v81; // ecx@82 | |
538 signed int v82; // esi@82 | |
539 float v83; // ST78_4@83 | |
540 double v84; // ST5C_8@83 | |
541 float v85; // eax@84 | |
542 double v86; // ST20_8@85 | |
543 double v87; // ST54_8@88 | |
544 float v88; // eax@89 | |
545 double v89; // ST44_8@90 | |
546 unsigned __int8 v90; // sf@94 | |
547 unsigned __int8 v91; // of@94 | |
548 int v92; // edx@97 | |
549 int v93; // esi@97 | |
550 int v94; // edi@97 | |
551 int v95; // eax@97 | |
552 int v96; // eax@104 | |
553 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
554 double v98; // [sp+54h] [bp-84h]@49 | |
555 double v99; // [sp+54h] [bp-84h]@66 | |
556 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
557 float v101; // [sp+60h] [bp-78h]@1 | |
558 float v102; // [sp+64h] [bp-74h]@1 | |
559 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
560 float v104; // [sp+A8h] [bp-30h]@1 | |
561 signed int v105; // [sp+A8h] [bp-30h]@96 | |
562 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
563 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
564 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
565 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
566 signed int v110; // [sp+B0h] [bp-28h]@12 | |
567 char *v111; // [sp+B8h] [bp-20h]@30 | |
568 signed int v112; // [sp+B8h] [bp-20h]@48 | |
569 signed int v113; // [sp+B8h] [bp-20h]@65 | |
570 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
571 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
572 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
573 signed int v117; // [sp+C0h] [bp-18h]@1 | |
574 char *v118; // [sp+C0h] [bp-18h]@30 | |
575 char *v119; // [sp+C0h] [bp-18h]@48 | |
576 char *v120; // [sp+C0h] [bp-18h]@65 | |
577 char *v121; // [sp+C4h] [bp-14h]@13 | |
578 char *v122; // [sp+C4h] [bp-14h]@30 | |
579 signed int v123; // [sp+C4h] [bp-14h]@47 | |
580 char *v124; // [sp+C8h] [bp-10h]@30 | |
581 char *v125; // [sp+C8h] [bp-10h]@48 | |
582 char *v126; // [sp+C8h] [bp-10h]@65 | |
583 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
584 char *v128; // [sp+CCh] [bp-Ch]@13 | |
585 char *v129; // [sp+CCh] [bp-Ch]@30 | |
586 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
587 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
588 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
589 char *v133; // [sp+D0h] [bp-8h]@30 | |
590 char *v134; // [sp+D0h] [bp-8h]@48 | |
591 char *v135; // [sp+D0h] [bp-8h]@65 | |
592 signed int v136; // [sp+D4h] [bp-4h]@1 | |
593 char *v137; // [sp+D4h] [bp-4h]@13 | |
594 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
595 char *v139; // [sp+D4h] [bp-4h]@48 | |
596 char *v140; // [sp+D4h] [bp-4h]@65 | |
597 | |
693 | 598 v101 = (double)(signed int)pViewport->uViewportTL_X; |
599 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 600 v117 = a1; |
601 v136 = 1; | |
693 | 602 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
603 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 604 if ( a1 <= 0 ) |
605 return v117; | |
606 v127 = a1; | |
607 v1 = a1; | |
608 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
609 v2 = 0; | |
610 do | |
611 { | |
612 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
613 v136 = 0; | |
614 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
615 v136 = 0; | |
616 ++v2; | |
617 --v127; | |
618 } | |
619 while ( v127 ); | |
620 if ( v136 ) | |
621 return v117; | |
622 v110 = 0; | |
623 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
624 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 625 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 626 if ( v117 < 1 ) |
627 goto LABEL_112; | |
628 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
629 v132 = array_50A2B0; | |
630 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
631 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
632 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 633 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 634 v7 = (char *)&array_50AC10[0].flt_2C; |
635 do | |
636 { | |
637 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 638 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 639 if ( !(v5 ^ v106) ) |
640 goto LABEL_25; | |
641 v8 = v101; | |
693 | 642 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 643 { |
644 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
645 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
646 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
647 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
648 } | |
649 else | |
650 { | |
651 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
652 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
653 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
654 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
655 } | |
656 *(float *)v121 = v10; | |
657 *(int *)v137 = LODWORD(v101); | |
658 LODWORD(v12) = *(int *)v6; | |
659 if ( v5 ) | |
660 { | |
661 v13 = v12 + 6.7553994e15; | |
662 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
663 if ( LODWORD(v13) == LODWORD(v14) ) | |
664 { | |
665 v15 = *(float *)v137 + 6.7553994e15; | |
666 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
667 v17 = LODWORD(v15) == LODWORD(v16); | |
668 goto LABEL_23; | |
669 } | |
670 } | |
671 else | |
672 { | |
673 v18 = v12 + 6.7553994e15; | |
674 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
675 if ( LODWORD(v18) == LODWORD(v19) ) | |
676 { | |
677 v20 = *(float *)v137 + 6.7553994e15; | |
678 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
679 v17 = LODWORD(v20) == LODWORD(v21); | |
680 LABEL_23: | |
681 if ( v17 ) | |
682 goto LABEL_25; | |
683 goto LABEL_24; | |
684 } | |
685 } | |
686 LABEL_24: | |
687 v121 += 48; | |
688 v114 += 48; | |
689 v6 += 48; | |
690 ++v110; | |
691 ++v132; | |
692 v128 = v6; | |
693 v137 += 48; | |
694 LABEL_25: | |
695 if ( v106 ) | |
696 { | |
697 v22 = v132; | |
698 v128 += 48; | |
699 ++v110; | |
700 v114 += 48; | |
701 v121 += 48; | |
702 v137 += 48; | |
703 ++v132; | |
704 memcpy(v22, v7 + 4, 0x30u); | |
705 v6 = v128; | |
706 } | |
707 v5 = v106; | |
708 v7 += 48; | |
709 --v117; | |
710 } | |
711 while ( v117 ); | |
712 if ( v110 < 3 | |
713 || (v115 = 0, | |
714 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
715 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 716 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 717 v110 < 1) ) |
718 goto LABEL_112; | |
168 | 719 v25 = (char *)&array_509950[0]._rhw; |
0 | 720 v138 = array_509950; |
721 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
722 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
723 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
724 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
725 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 726 v111 = (char *)&array_509950[0]._rhw; |
0 | 727 v26 = (char *)&array_50A2B0[0].flt_2C; |
728 while ( 2 ) | |
729 { | |
730 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 731 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
732 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 733 if ( v24 != v27 ) |
734 { | |
735 v28 = v100; | |
693 | 736 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 737 { |
738 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
739 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
740 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
741 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
742 } | |
743 else | |
744 { | |
745 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
746 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
747 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
748 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
749 } | |
750 *(float *)v124 = v30; | |
751 *(int *)v133 = LODWORD(v100); | |
752 if ( v24 ) | |
753 { | |
754 v32 = *(float *)v122 + 6.7553994e15; | |
755 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
756 if ( LODWORD(v32) == LODWORD(v33) ) | |
757 { | |
758 v34 = *(float *)v133 + 6.7553994e15; | |
759 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
760 v36 = LODWORD(v34) == LODWORD(v35); | |
761 goto LABEL_41; | |
762 } | |
763 goto LABEL_42; | |
764 } | |
765 v37 = *(float *)v118 + 6.7553994e15; | |
766 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
767 if ( LODWORD(v37) != LODWORD(v38) ) | |
768 goto LABEL_42; | |
769 v39 = *(float *)v129 + 6.7553994e15; | |
770 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
771 v36 = LODWORD(v39) == LODWORD(v40); | |
772 LABEL_41: | |
773 if ( !v36 ) | |
774 { | |
775 LABEL_42: | |
776 v129 += 48; | |
777 v118 += 48; | |
778 v133 += 48; | |
779 v122 += 48; | |
780 v124 += 48; | |
781 v111 += 48; | |
782 ++v115; | |
783 ++v138; | |
784 } | |
785 } | |
786 if ( v27 ) | |
787 { | |
788 v41 = v138; | |
789 ++v115; | |
790 v111 += 48; | |
791 v124 += 48; | |
792 v122 += 48; | |
793 v133 += 48; | |
794 v118 += 48; | |
795 v129 += 48; | |
796 ++v138; | |
797 memcpy(v41, v26 + 4, 0x30u); | |
798 } | |
799 v24 = v107; | |
800 v26 += 48; | |
801 --v110; | |
802 if ( v110 ) | |
803 { | |
804 v25 = v111; | |
805 continue; | |
806 } | |
807 break; | |
808 } | |
809 if ( v115 < 3 | |
810 || (v123 = 0, | |
811 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
812 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 813 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 814 v115 < 1) ) |
815 goto LABEL_112; | |
816 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
817 v130 = array_508FF0; | |
818 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
819 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
820 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 821 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 822 v45 = (char *)&array_509950[0].flt_2C; |
823 v112 = v115; | |
824 while ( 2 ) | |
825 { | |
826 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 827 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
828 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 829 if ( v43 != v46 ) |
830 { | |
831 v47 = v104; | |
693 | 832 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 833 { |
834 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
835 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
836 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
837 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
838 } | |
839 else | |
840 { | |
841 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
842 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
843 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
844 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
845 } | |
846 *(float *)v125 = v49; | |
847 *(float *)v139 = v104; | |
848 if ( v43 ) | |
849 { | |
850 v51 = v104 + 6.7553994e15; | |
851 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
852 if ( LODWORD(v51) == LODWORD(v52) ) | |
853 { | |
854 v53 = *(float *)v44 + 6.7553994e15; | |
855 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
856 v55 = LODWORD(v53) == LODWORD(v54); | |
857 goto LABEL_58; | |
858 } | |
859 goto LABEL_59; | |
860 } | |
861 v56 = v104 + 6.7553994e15; | |
862 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
863 if ( LODWORD(v56) != LODWORD(v57) ) | |
864 goto LABEL_59; | |
865 v58 = *(float *)v44 + 6.7553994e15; | |
866 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
867 v55 = LODWORD(v58) == LODWORD(v59); | |
868 LABEL_58: | |
869 if ( !v55 ) | |
870 { | |
871 LABEL_59: | |
872 v139 += 48; | |
873 v125 += 48; | |
874 v134 += 48; | |
875 v44 += 48; | |
876 ++v123; | |
877 ++v130; | |
878 v119 = v44; | |
879 } | |
880 } | |
881 if ( v46 ) | |
882 { | |
883 v60 = v130; | |
884 v119 += 48; | |
885 ++v123; | |
886 v134 += 48; | |
887 v125 += 48; | |
888 v139 += 48; | |
889 ++v130; | |
890 memcpy(v60, v45 + 4, 0x30u); | |
891 v44 = v119; | |
892 } | |
893 v43 = v108; | |
894 v45 += 48; | |
895 --v112; | |
896 if ( v112 ) | |
897 continue; | |
898 break; | |
899 } | |
900 if ( v123 < 3 | |
901 || (v116 = 0, | |
902 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
903 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 904 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 905 v123 < 1) ) |
906 goto LABEL_112; | |
907 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
908 v131 = array_508690; | |
909 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
910 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
911 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 912 v135 = (char *)&array_508690[0]._rhw; |
0 | 913 v64 = (char *)&array_508FF0[0].flt_2C; |
914 v113 = v123; | |
915 while ( 2 ) | |
916 { | |
917 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 918 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
919 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 920 if ( v62 != v65 ) |
921 { | |
922 v66 = v102; | |
693 | 923 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 924 { |
925 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
926 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
927 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
928 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
929 } | |
930 else | |
931 { | |
932 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
933 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
934 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
935 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
936 } | |
937 *(float *)v126 = v68; | |
938 *(float *)v140 = v102; | |
939 if ( v62 ) | |
940 { | |
941 v70 = v102 + 6.7553994e15; | |
942 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
943 if ( LODWORD(v70) == LODWORD(v71) ) | |
944 { | |
945 v72 = *(float *)v63 + 6.7553994e15; | |
946 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
947 v74 = LODWORD(v72) == LODWORD(v73); | |
948 goto LABEL_75; | |
949 } | |
950 goto LABEL_76; | |
951 } | |
952 v75 = v102 + 6.7553994e15; | |
953 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
954 if ( LODWORD(v75) != LODWORD(v76) ) | |
955 goto LABEL_76; | |
956 v77 = *(float *)v63 + 6.7553994e15; | |
957 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
958 v74 = LODWORD(v77) == LODWORD(v78); | |
959 LABEL_75: | |
960 if ( !v74 ) | |
961 { | |
962 LABEL_76: | |
963 v140 += 48; | |
964 v126 += 48; | |
965 v135 += 48; | |
966 v63 += 48; | |
967 ++v116; | |
968 ++v131; | |
969 v120 = v63; | |
970 } | |
971 } | |
972 if ( v65 ) | |
973 { | |
974 v79 = v131; | |
975 v120 += 48; | |
976 ++v116; | |
977 v135 += 48; | |
978 v126 += 48; | |
979 v140 += 48; | |
980 ++v131; | |
981 memcpy(v79, v64 + 4, 0x30u); | |
982 v63 = v120; | |
983 } | |
984 v62 = v109; | |
985 v64 += 48; | |
986 --v113; | |
987 if ( v113 ) | |
988 continue; | |
989 break; | |
990 } | |
991 if ( v116 < 3 ) | |
992 goto LABEL_112; | |
993 v80 = v116; | |
994 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
995 if ( v116 > 0 ) | |
996 { | |
997 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
998 v82 = v116; | |
999 do | |
1000 { | |
1001 LODWORD(v83) = *(int *)v81; | |
1002 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1003 v84 = v83 + 6.7553994e15; | |
693 | 1004 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1005 { |
1006 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1007 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1008 goto LABEL_88; |
1009 v85 = v101; | |
1010 } | |
1011 else | |
1012 { | |
1013 v85 = v100; | |
1014 } | |
1015 *(int *)v81 = LODWORD(v85); | |
1016 LABEL_88: | |
1017 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1018 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1019 { |
1020 v88 = v102; | |
1021 LABEL_92: | |
1022 *((int *)v81 + 1) = LODWORD(v88); | |
1023 goto LABEL_93; | |
1024 } | |
1025 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1026 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1027 { |
1028 v88 = v104; | |
1029 goto LABEL_92; | |
1030 } | |
1031 LABEL_93: | |
1032 v81 += 48; | |
1033 --v82; | |
1034 } | |
1035 while ( v82 ); | |
1036 } | |
1037 v91 = __OFSUB__(v116, 3); | |
1038 v90 = v116 - 3 < 0; | |
1039 if ( v116 > 3 ) | |
1040 { | |
1041 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1042 if ( v116 > 0 ) | |
1043 { | |
1044 v105 = 1; | |
1045 do | |
1046 { | |
1047 v92 = v105; | |
1048 v93 = v105 - 1; | |
1049 v94 = v105 + 1; | |
1050 v95 = v105 + 1; | |
1051 if ( v105 - 1 >= v80 ) | |
1052 v93 -= v80; | |
1053 if ( v105 >= v80 ) | |
1054 v92 = v105 - v80; | |
1055 if ( v94 >= v80 ) | |
1056 v95 = v94 - v80; | |
1057 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1058 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1059 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1060 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1061 { | |
1062 ++v105; | |
1063 } | |
1064 else | |
1065 { | |
1066 v96 = v105; | |
1067 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1068 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1069 --v80; | |
1070 } | |
1071 } | |
1072 while ( v105 - 1 < v80 ); | |
1073 } | |
1074 v91 = __OFSUB__(v80, 3); | |
1075 v90 = v80 - 3 < 0; | |
1076 } | |
1077 if ( v90 ^ v91 ) | |
1078 LABEL_112: | |
1079 result = 0; | |
1080 else | |
1081 result = v80; | |
1082 return result; | |
1083 } | |
1084 | |
1085 //----- (0042620A) -------------------------------------------------------- | |
1086 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1087 { | |
1088 __int16 v1; // fps@1 | |
1089 unsigned __int8 v2; // c0@2 | |
1090 char v3; // c2@2 | |
1091 unsigned __int8 v4; // c3@2 | |
1092 bool result; // eax@2 | |
1093 unsigned __int8 v6; // c0@4 | |
1094 char v7; // c2@4 | |
1095 unsigned __int8 v8; // c3@4 | |
1096 unsigned __int8 v9; // c0@6 | |
1097 char v10; // c2@6 | |
1098 unsigned __int8 v11; // c3@6 | |
1099 double v12; // st6@7 | |
1100 float v13; // ST04_4@7 | |
1101 float v14; // ST00_4@7 | |
1102 double v15; // st7@7 | |
1103 double v16; // st6@8 | |
1104 float v17; // ST04_4@8 | |
1105 float v18; // ST00_4@8 | |
1106 double v19; // st7@8 | |
1107 | |
1108 //UNDEF(v1); | |
1109 if ( p->vWorldViewPosition.x < 300.0 | |
1110 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1111 v3 = 0, | |
1112 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1113 //BYTE1(result) = HIBYTE(v1), |
0 | 1114 !(v2 | v4)) ) |
1115 { | |
1116 if ( p->vWorldViewPosition.x < 300.0 ) | |
1117 { | |
1118 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1119 v7 = 0; | |
1120 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1121 //BYTE1(result) = HIBYTE(v1); |
0 | 1122 if ( !(v6 | v8) ) |
1123 { | |
921 | 1124 //LOBYTE(result) = 0; |
1125 return false; | |
0 | 1126 } |
1127 } | |
1128 v9 = 300.0 < p->vWorldViewPosition.x; | |
1129 v10 = 0; | |
1130 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1131 //BYTE1(result) = HIBYTE(v1); |
0 | 1132 if ( v9 | v11 ) |
1133 { | |
1134 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1135 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1136 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1137 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1138 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1139 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1140 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1141 } | |
1142 else | |
1143 { | |
1144 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1145 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1146 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1147 v15 = 300.0 - p->vWorldViewPosition.x; | |
1148 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1149 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1150 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1151 } | |
1152 } | |
921 | 1153 //LOBYTE(result) = 1; |
1154 return true; | |
0 | 1155 } |
1156 | |
1157 //----- (004268E3) -------------------------------------------------------- | |
1158 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1159 { | |
1160 unsigned int v1; // eax@1 | |
1161 unsigned int v2; // edx@1 | |
1162 int v3; // eax@1 | |
1163 int v4; // edx@1 | |
1164 unsigned int v5; // ecx@1 | |
1165 | |
1166 v1 = uColor >> 9; | |
1167 v2 = uColor >> 6; | |
1168 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1169 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1170 v3 = v2 | v1; | |
1171 v4 = (unsigned __int8)uColor >> 3; | |
1172 v5 = uColor >> 16; | |
1173 LOWORD(v5) = v5 & 0x8000; | |
1174 return v5 | v4 | v3; | |
1175 } | |
1176 | |
1177 //----- (0042690D) -------------------------------------------------------- | |
1178 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1179 { | |
1180 unsigned int v1; // eax@1 | |
1181 unsigned int v2; // edx@1 | |
1182 | |
1183 v1 = a1 >> 8; | |
1184 v2 = a1 >> 5; | |
1185 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1186 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1187 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1188 } | |
932 | 1189 |
0 | 1190 //----- (00426947) -------------------------------------------------------- |
1191 void __cdecl sub_426947() | |
1192 { | |
893 | 1193 stru_50C198.field_0 = 0; |
0 | 1194 dword_50C994 = 0; |
1195 dword_50C998_turnbased_icon_1A = 0; | |
1196 } | |
1197 // 50C968: using guessed type int dword_50C968; | |
1198 // 50C994: using guessed type int dword_50C994; | |
1199 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1200 | |
1201 //----- (004269A2) -------------------------------------------------------- | |
792 | 1202 int __fastcall GivePartyExp(unsigned int a1) |
0 | 1203 { |
89 | 1204 //unsigned __int64 v1; // qax@1 |
1205 Player *v1; | |
1206 int v1b; | |
0 | 1207 signed int v2; // ecx@1 |
82 | 1208 int *v3; // esi@1 |
0 | 1209 bool v4; // edi@6 |
82 | 1210 int *v5; // edi@10 |
1211 Player *v6; // esi@10 | |
0 | 1212 int v7; // eax@13 |
1213 unsigned __int8 v8; // cf@13 | |
89 | 1214 int v10[4]; // [sp+Ch] [bp-14h]@1 |
0 | 1215 int v11; // [sp+1Ch] [bp-4h]@10 |
1216 | |
89 | 1217 //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); |
1218 v1 = pParty->pPlayers; | |
1219 v1b = a1; | |
0 | 1220 v2 = 0; |
89 | 1221 v3 = v10; |
0 | 1222 do |
1223 { | |
89 | 1224 /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) |
0 | 1225 && !*(int *)HIDWORD(v1) |
1226 && !*(_QWORD *)(HIDWORD(v1) + 8) | |
89 | 1227 && !*(_QWORD *)(HIDWORD(v1) + 16);*/ |
1228 v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) | |
1229 && !v1->pConditions[14] | |
1230 && !v1->pConditions[15] | |
1231 && !v1->pConditions[16]; | |
82 | 1232 *v3 = v4; |
89 | 1233 //HIDWORD(v1) += 6972; |
1234 ++v1; | |
0 | 1235 v2 += v4; |
82 | 1236 ++v3; |
0 | 1237 } |
89 | 1238 while ( v1 <= &pParty->pPlayers[3] ); |
0 | 1239 if ( v2 ) |
1240 { | |
89 | 1241 v1b = v1b / v2; |
1242 v5 = v10; | |
82 | 1243 v6 = pParty->pPlayers;//[0].uExperience; |
89 | 1244 v11 = v1b; |
0 | 1245 do |
1246 { | |
82 | 1247 if ( *v5 ) |
0 | 1248 { |
1249 if ( v11 ) | |
1250 { | |
82 | 1251 LOBYTE(v7) = v6->GetLearningPercent(); |
922 | 1252 v1b = v11 + v11 * (char)v7 / 100; |
89 | 1253 //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); |
1254 //need review | |
1255 LODWORD(v6->uExperience) += v1b; | |
1256 //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; | |
82 | 1257 if ( v6->uExperience > 4000000000i64 ) |
0 | 1258 { |
82 | 1259 HIDWORD(v6->uExperience) = 0; |
1260 LODWORD(v6->uExperience) = -294967296; | |
0 | 1261 } |
1262 } | |
1263 } | |
82 | 1264 ++v6; |
1265 ++v5; | |
0 | 1266 } |
82 | 1267 while ( v6 <= &pParty->pPlayers[3] ); |
0 | 1268 } |
89 | 1269 return v1b; |
0 | 1270 } |
1271 | |
1272 //----- (00426A5A) -------------------------------------------------------- | |
1273 void stru319::LootActor(Actor *pActor) | |
1274 { | |
1275 signed int v2; // edi@1 | |
1276 char v3; // zf@1 | |
1277 unsigned int v4; // eax@13 | |
1278 unsigned int v5; // esi@13 | |
1279 int v6; // eax@14 | |
1280 unsigned __int8 v7; // al@30 | |
1281 Party *v8; // esi@34 | |
1282 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1283 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1284 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1285 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1286 int v13; // [sp+30h] [bp-8h]@1 | |
1287 int v14; // [sp+34h] [bp-4h]@1 | |
1288 | |
1289 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1290 Dst.Reset(); | |
1291 v2 = 0; | |
1292 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1293 v13 = 0; | |
1294 v14 = 0; | |
1295 if ( v3 ) | |
1296 { | |
1297 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1298 goto LABEL_9; | |
1299 do | |
1300 { | |
1301 ++v2; | |
1302 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1303 } | |
1304 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1305 } | |
1306 else | |
1307 { | |
1308 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1309 goto LABEL_9; | |
377 | 1310 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1311 pActor->array_000234[3].Reset(); |
1312 } | |
1313 if ( v14 ) | |
1314 { | |
1315 party_finds_gold(v14, 0); | |
1316 viewparams->bRedrawGameUI = 1; | |
1317 } | |
1318 LABEL_9: | |
1319 if ( pActor->uCarriedItemID ) | |
1320 { | |
1321 Dst.Reset(); | |
1322 Dst.uItemID = pActor->uCarriedItemID; | |
1323 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1324 if ( v14 ) | |
721 | 1325 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1326 else |
721 | 1327 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1328 ShowStatusBarString(pTmpBuf2, 2u); |
1329 v4 = Dst.uItemID; | |
1330 v5 = Dst.uItemID; | |
1331 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1332 { | |
1333 v5 = Dst.uItemID; | |
1334 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1335 Dst.uNumCharges = v6; | |
1336 Dst.uMaxCharges = v6; | |
1337 v4 = Dst.uItemID; | |
1338 } | |
1339 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1340 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1341 pItemsTable->SetSpecialBonus(&Dst); |
1342 if ( !pParty->AddItem(&Dst) ) | |
1343 pParty->SetHoldingItem(&Dst); | |
1344 pActor->uCarriedItemID = 0; | |
1345 if ( pActor->array_000234[0].uItemID ) | |
1346 { | |
1347 if ( !pParty->AddItem(pActor->array_000234) ) | |
1348 { | |
1349 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1350 pParty->SetHoldingItem(pActor->array_000234); | |
1351 } | |
1352 pActor->array_000234[0].Reset(); | |
1353 } | |
1354 if ( pActor->array_000234[1].uItemID ) | |
1355 { | |
1356 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1357 { | |
1358 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1359 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1360 } | |
1361 pActor->array_000234[1].Reset(); | |
1362 } | |
1363 LABEL_55: | |
1364 pActor->Remove(); | |
1365 return; | |
1366 } | |
1367 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1368 { | |
1369 if ( pActor->array_000234[3].uItemID ) | |
1370 { | |
1371 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1372 pActor->array_000234[3].Reset(); | |
1373 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1374 if ( v14 ) | |
721 | 1375 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1376 else |
721 | 1377 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1378 ShowStatusBarString(pTmpBuf2, 2u); |
1379 if ( !pParty->AddItem(&Dst) ) | |
1380 pParty->SetHoldingItem(&Dst); | |
1381 v13 = 1; | |
1382 } | |
1383 goto LABEL_44; | |
1384 } | |
1385 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1386 { | |
1387 LABEL_44: | |
1388 v8 = pParty; | |
1389 goto LABEL_45; | |
1390 } | |
1391 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1392 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1393 if ( v14 ) | |
721 | 1394 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1395 else |
721 | 1396 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1397 ShowStatusBarString(pTmpBuf2, 2u); |
1398 v8 = pParty; | |
1399 if ( !pParty->AddItem(&Dst) ) | |
1400 pParty->SetHoldingItem(&Dst); | |
1401 v13 = 1; | |
1402 LABEL_45: | |
1403 if ( pActor->array_000234[0].uItemID ) | |
1404 { | |
1405 if ( !v8->AddItem(pActor->array_000234) ) | |
1406 { | |
1407 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1408 v8->SetHoldingItem(pActor->array_000234); | |
1409 v13 = 1; | |
1410 } | |
1411 pActor->array_000234[0].Reset(); | |
1412 } | |
1413 if ( pActor->array_000234[1].uItemID ) | |
1414 { | |
1415 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1416 { | |
1417 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1418 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1419 v13 = 1; | |
1420 } | |
1421 pActor->array_000234[1].Reset(); | |
1422 } | |
1423 if ( !v13 || rand() % 100 < 90 ) | |
1424 goto LABEL_55; | |
1425 } | |
1426 | |
1427 //----- (00426E10) -------------------------------------------------------- | |
1428 int stru319::which_player_would_attack(Actor *pActor) | |
1429 { | |
1430 signed int v2; // ebx@1 | |
1431 int v3; // ecx@2 | |
1432 signed int v4; // edx@3 | |
1433 char v5; // zf@3 | |
1434 unsigned int v6; // eax@3 | |
1435 int v7; // eax@6 | |
1436 int v8; // eax@7 | |
1437 int v9; // eax@8 | |
1438 int v10; // eax@9 | |
1439 int v11; // eax@10 | |
1440 int v12; // eax@11 | |
1441 int v13; // esi@35 | |
1442 signed int v14; // edi@37 | |
1443 enum CHARACTER_RACE v15; // eax@44 | |
1444 Player *v16; // ecx@47 | |
1445 unsigned __int8 v17; // sf@50 | |
1446 unsigned __int8 v18; // of@50 | |
1447 int v19; // esi@52 | |
1448 Player *v20; // ecx@53 | |
1449 int result; // eax@57 | |
1450 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1451 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1452 int v24; // [sp+138h] [bp-10h]@2 | |
1453 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1454 int v26; // [sp+140h] [bp-8h]@1 | |
1455 int v27; // [sp+144h] [bp-4h]@1 | |
1456 | |
1457 v27 = -1; | |
1458 v26 = -1; | |
1459 v25 = -1; | |
1460 v2 = 0; | |
1461 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1462 { | |
1463 v3 = 0; | |
1464 v24 = 0; | |
1465 do | |
1466 { | |
1467 v4 = 1; | |
1468 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1469 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1470 v22[v3] = v6; | |
1471 if ( !v5 ) | |
1472 { | |
1473 if ( (signed int)v6 > 128 ) | |
1474 { | |
1475 switch ( v6 ) | |
1476 { | |
1477 case 0x100u: | |
1478 v27 = 8; | |
1479 break; | |
1480 case 0x200u: | |
1481 v25 = 0; | |
1482 break; | |
1483 case 0x400u: | |
1484 v25 = 1; | |
1485 break; | |
1486 case 0x800u: | |
1487 v26 = 0; | |
1488 break; | |
1489 case 0x1000u: | |
1490 v26 = 1; | |
1491 break; | |
1492 case 0x2000u: | |
1493 v26 = 3; | |
1494 break; | |
1495 case 0x4000u: | |
1496 v26 = 2; | |
1497 break; | |
1498 } | |
1499 } | |
1500 else | |
1501 { | |
1502 if ( v6 == 128 ) | |
1503 { | |
1504 v27 = 4; | |
1505 } | |
1506 else | |
1507 { | |
1508 v7 = v6 - 1; | |
1509 if ( v7 ) | |
1510 { | |
1511 v8 = v7 - 1; | |
1512 if ( v8 ) | |
1513 { | |
1514 v9 = v8 - 2; | |
1515 if ( v9 ) | |
1516 { | |
1517 v10 = v9 - 4; | |
1518 if ( v10 ) | |
1519 { | |
1520 v11 = v10 - 8; | |
1521 if ( v11 ) | |
1522 { | |
1523 v12 = v11 - 16; | |
1524 if ( v12 ) | |
1525 { | |
1526 if ( v12 == 32 ) | |
1527 v27 = 20; | |
1528 } | |
1529 else | |
1530 { | |
1531 v27 = 32; | |
1532 } | |
1533 } | |
1534 else | |
1535 { | |
1536 v27 = 24; | |
1537 } | |
1538 } | |
1539 else | |
1540 { | |
1541 v27 = 28; | |
1542 } | |
1543 } | |
1544 else | |
1545 { | |
1546 v27 = 16; | |
1547 } | |
1548 } | |
1549 else | |
1550 { | |
1551 v27 = 12; | |
1552 } | |
1553 } | |
1554 else | |
1555 { | |
1556 v27 = 0; | |
1557 } | |
1558 } | |
1559 } | |
1560 v2 = 0; | |
1561 v13 = 0; | |
1562 while ( 1 ) | |
1563 { | |
1564 v14 = 0; | |
135 | 1565 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1566 v14 = v4; |
1567 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1568 v14 = v4; | |
1569 if ( v26 != -1 ) | |
1570 { | |
1571 v15 = pPlayers[v13 + 1]->GetRace(); | |
1572 if ( v26 == v15 ) | |
1573 v14 = 1; | |
1574 } | |
1575 if ( v14 == 1 ) | |
1576 { | |
1577 v16 = pPlayers[v13 + 1]; | |
1578 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1579 v23[v2++] = v13; | |
1580 } | |
1581 ++v13; | |
1582 if ( v13 >= 4 ) | |
1583 break; | |
1584 v4 = 1; | |
1585 } | |
1586 } | |
1587 v3 = v24 + 1; | |
1588 v18 = __OFSUB__(v24 + 1, 15); | |
1589 v17 = v24++ - 14 < 0; | |
1590 } | |
1591 while ( v17 ^ v18 ); | |
1592 if ( v2 ) | |
1593 goto LABEL_61; | |
1594 } | |
1595 v19 = 0; | |
1596 do | |
1597 { | |
1598 v20 = pPlayers[v19 + 1]; | |
1599 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1600 v23[v2++] = v19; | |
1601 ++v19; | |
1602 } | |
1603 while ( v19 < 4 ); | |
1604 if ( v2 ) | |
1605 LABEL_61: | |
1606 result = v23[rand() % v2]; | |
1607 else | |
1608 result = 0; | |
1609 return result; | |
1610 } | |
1611 | |
1612 //----- (0042704B) -------------------------------------------------------- | |
1613 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1614 { | |
1615 stru319 *v3; // edi@1 | |
1616 signed int v4; // ebx@5 | |
1617 signed int v5; // edi@5 | |
1618 | |
1619 v3 = this; | |
1620 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1621 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1622 && rand() % 100 < 5 ) | |
1623 pActor->_44FD29(a2); | |
1624 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1625 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1626 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1627 return 2; | |
1628 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1629 return 3; | |
1630 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1631 } | |
1632 | |
1633 //----- (00427102) -------------------------------------------------------- | |
1634 int stru319::_427102(Actor *pActor, signed int a2) | |
1635 { | |
1636 unsigned __int8 v3; // cf@11 | |
1637 unsigned __int8 v4; // zf@11 | |
1638 SpellBuff *v6; // ecx@46 | |
89 | 1639 Player *v7; // esi@49 |
0 | 1640 signed int v8; // edx@50 |
89 | 1641 SpellBuff *v9; // ecx@50 |
0 | 1642 |
597 | 1643 switch(a2) |
0 | 1644 { |
597 | 1645 case 77: |
1646 { | |
1647 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1648 return 0; | |
1649 return 1; | |
1650 } | |
1651 case 80: | |
1652 { | |
1653 v6 = pParty->pPartyBuffs; | |
1654 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1655 { | |
1656 ++v6; | |
1657 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1658 { | |
1659 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1660 v8 = 0; | |
1661 v9 = v7->pPlayerBuffs; | |
1662 while ( v9->uExpireTime <= 0i64 ) | |
1663 { | |
1664 ++v8; | |
1665 ++v9; | |
1666 if ( v8 >= 24 ) | |
1667 { | |
1668 ++v7; | |
1669 if ( v7 <= &pParty->pPlayers[3] ) | |
1670 { | |
1671 v8 = 0; | |
1672 v9 = v7->pPlayerBuffs; | |
1673 } | |
1674 else | |
1675 return 0; | |
1676 } | |
1677 } | |
1678 return 1; | |
1679 } | |
1680 } | |
1681 return 1; | |
1682 } | |
1683 case 85: | |
1684 { | |
1685 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1686 return 1; | |
1687 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1688 return 0; | |
1689 v3 = 0; | |
1690 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1691 break; | |
1692 } | |
1693 case 86: | |
1694 { | |
0 | 1695 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1696 return 1; |
0 | 1697 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1698 return 0; |
0 | 1699 v3 = 0; |
1700 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1701 break; |
1702 } | |
1703 case 95: | |
1704 { | |
1705 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1706 return 1; | |
0 | 1707 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1708 return 0; |
0 | 1709 v3 = 0; |
1710 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1711 break; |
1712 } | |
1713 case 73: | |
1714 { | |
1715 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1716 return 1; | |
1717 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1718 return 0; | |
1719 v3 = 0; | |
1720 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1721 break; | |
1722 } | |
1723 case 5: | |
1724 { | |
1725 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1726 return 1; | |
1727 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1728 return 0; | |
1729 v3 = 0; | |
1730 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1731 break; | |
1732 } | |
1733 case 17: | |
1734 { | |
1735 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1736 return 1; | |
1737 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1738 return 0; | |
1739 v3 = 0; | |
1740 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1741 break; | |
1742 } | |
1743 case 38: | |
89 | 1744 { |
597 | 1745 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1746 return 1; | |
1747 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1748 return 0; | |
1749 v3 = 0; | |
1750 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1751 } | |
1752 case 46: | |
1753 { | |
1754 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1755 return 1; |
597 | 1756 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1757 return 0; | |
1758 v3 = 0; | |
1759 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1760 break; | |
1761 } | |
1762 case 47: | |
1763 { | |
1764 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1765 return 1; | |
1766 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1767 return 0; | |
1768 v3 = 0; | |
1769 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1770 break; | |
1771 } | |
1772 case 51: | |
1773 { | |
1774 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1775 return 1; | |
1776 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1777 { | |
89 | 1778 v3 = 0; |
1779 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1780 } | |
1781 else | |
597 | 1782 return 0; |
1783 break; | |
1784 } | |
1785 default: | |
89 | 1786 { |
597 | 1787 return 1; |
89 | 1788 } |
0 | 1789 } |
1790 if ( !(v3 | v4) ) | |
1791 return 0; | |
1792 return 1; | |
1793 } | |
1794 | |
1795 //----- (004272F5) -------------------------------------------------------- | |
1796 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1797 { | |
1798 signed int v5; // esi@1 | |
1799 signed int v6; // edi@1 | |
1800 int v7; // esi@8 | |
1801 int v8; // eax@9 | |
1802 int v9; // edx@11 | |
1803 int v10; // edx@13 | |
1804 int v11; // esi@13 | |
1805 unsigned __int8 v12; // sf@13 | |
1806 unsigned __int8 v13; // of@13 | |
1807 int v14; // edx@14 | |
1808 int v15; // eax@14 | |
1809 signed int result; // eax@17 | |
1810 | |
1811 v5 = pActor->pMonsterInfo.uAC; | |
1812 v6 = 0; | |
1813 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1814 v5 /= 2; | |
1815 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1816 v6 = pActor->pActorBuffs[15].uPower; | |
1817 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1818 v6 = pActor->pActorBuffs[16].uPower; | |
1819 v7 = v6 + v5; | |
1820 if ( a3 ) | |
1821 v8 = pPlayer->GetRangedAttack(); | |
1822 else | |
1823 v8 = pPlayer->GetActualAttack(0); | |
1824 v9 = rand() % (v7 + 2 * v8 + 30); | |
1825 if ( a3 == 2 ) | |
1826 { | |
1827 v14 = a4 + v9; | |
1828 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1829 } | |
1830 else | |
1831 { | |
1832 if ( a3 != 3 ) | |
1833 { | |
1834 v10 = a4 + v9; | |
1835 v11 = v7 + 15; | |
1836 v13 = __OFSUB__(v10, v11); | |
1837 v12 = v10 - v11 < 0; | |
1838 goto LABEL_16; | |
1839 } | |
1840 v14 = a4 + v9; | |
1841 v15 = 2 * v7 + 30; | |
1842 } | |
1843 v13 = __OFSUB__(v14, v15); | |
1844 v12 = v14 - v15 < 0; | |
1845 LABEL_16: | |
1846 if ( v12 ^ v13 ) | |
1847 result = 0; | |
1848 else | |
1849 result = 1; | |
1850 return result; | |
1851 } | |
1852 | |
1853 //----- (004273BB) -------------------------------------------------------- | |
1854 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1855 { | |
1856 Actor *v5; // ecx@1 | |
1857 signed int v6; // ebx@1 | |
1858 signed int v7; // esi@1 | |
1859 unsigned __int8 v8; // zf@1 | |
1860 unsigned __int8 v9; // sf@1 | |
1861 int v10; // ebx@10 | |
1862 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1863 | |
1864 v5 = a2; | |
1865 v6 = a2->pMonsterInfo.uAC; | |
1866 v7 = 0; | |
1867 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1868 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1869 a2a = 0; | |
1870 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1871 v6 /= 2; | |
1872 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1873 v7 = v5->pActorBuffs[14].uPower; | |
1874 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1875 v7 = v5->pActorBuffs[16].uPower; | |
1876 v10 = v7 + v6; | |
1877 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1878 a2a = pActor->pActorBuffs[14].uPower; | |
1879 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1880 a2a = pActor->pActorBuffs[17].uPower; | |
1881 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1882 { | |
1883 a2a += pActor->pActorBuffs[11].uPower; | |
1884 pActor->pActorBuffs[11].Reset(); | |
1885 } | |
1886 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1887 } | |
1888 | |
1889 //----- (004274AD) -------------------------------------------------------- | |
1890 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1891 { | |
1892 signed int v3; // edi@1 | |
1893 signed int v4; // esi@8 | |
1894 int v5; // esi@8 | |
1895 | |
1896 v3 = 0; | |
1897 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1898 v3 = pActor->pActorBuffs[14].uPower; | |
1899 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1900 v3 = pActor->pActorBuffs[17].uPower; | |
1901 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1902 { | |
1903 v3 += pActor->pActorBuffs[11].uPower; | |
1904 pActor->pActorBuffs[11].Reset(); | |
1905 } | |
1906 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1907 v5 = rand() % v4 + 1; | |
1908 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1909 } | |
1910 | |
1911 //----- (00427546) -------------------------------------------------------- | |
1912 int stru319::_427546(int a2) | |
1913 { | |
1914 int result; // eax@2 | |
1915 | |
1916 if ( a2 >= 0 ) | |
1917 { | |
1918 if ( a2 >= 1 ) | |
1919 result = (a2 >= 2) + 2; | |
1920 else | |
1921 result = 1; | |
1922 } | |
1923 else | |
1924 { | |
1925 result = 0; | |
1926 } | |
1927 return result; | |
1928 } | |
1929 | |
1930 //----- (0042756B) -------------------------------------------------------- | |
1931 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1932 { | |
1933 int v4; // edx@1 | |
1934 int v5; // ecx@1 | |
1935 signed int v6; // eax@4 | |
1936 signed int result; // eax@17 | |
1937 signed int v8; // esi@18 | |
1938 | |
1939 v4 = 0; | |
1940 v5 = 0; | |
1941 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1942 v5 = pActor->pActorBuffs[14].uPower; | |
1943 switch ( a2 ) | |
1944 { | |
1945 case 4: | |
1946 v6 = pActor->pMonsterInfo.uResPhysical; | |
1947 break; | |
1948 case 0: | |
1949 v6 = pActor->pMonsterInfo.uResFire; | |
1950 goto LABEL_12; | |
1951 case 1: | |
1952 v6 = pActor->pMonsterInfo.uResAir; | |
1953 goto LABEL_12; | |
1954 case 2: | |
1955 v6 = pActor->pMonsterInfo.uResWater; | |
1956 goto LABEL_12; | |
1957 case 3: | |
1958 v6 = pActor->pMonsterInfo.uResEarth; | |
1959 goto LABEL_12; | |
1960 case 6: | |
1961 v6 = pActor->pMonsterInfo.uResSpirit; | |
1962 break; | |
1963 case 7: | |
1964 v6 = pActor->pMonsterInfo.uResMind; | |
1965 goto LABEL_12; | |
1966 case 8: | |
1967 v6 = pActor->pMonsterInfo.uResBody; | |
1968 LABEL_12: | |
1969 v4 = v5; | |
1970 break; | |
1971 case 9: | |
1972 v6 = pActor->pMonsterInfo.uResLight; | |
1973 break; | |
1974 case 10: | |
1975 v6 = pActor->pMonsterInfo.uResDark; | |
1976 break; | |
1977 default: | |
1978 v6 = 0; | |
1979 break; | |
1980 } | |
1981 if ( v6 < 200 ) | |
1982 { | |
1983 v8 = v4 + v6 + 30; | |
1984 if ( rand() % v8 >= 30 ) | |
1985 { | |
1986 a3 >>= 1; | |
1987 if ( rand() % v8 >= 30 ) | |
1988 { | |
1989 a3 >>= 1; | |
1990 if ( rand() % v8 >= 30 ) | |
1991 { | |
1992 a3 >>= 1; | |
1993 if ( rand() % v8 >= 30 ) | |
1994 a3 >>= 1; | |
1995 } | |
1996 } | |
1997 } | |
1998 result = a3; | |
1999 } | |
2000 else | |
2001 { | |
2002 result = 0; | |
2003 } | |
2004 return result; | |
2005 } | |
2006 | |
2007 //----- (00427662) -------------------------------------------------------- | |
2008 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
2009 { | |
2010 Actor *v3; // edi@2 | |
2011 signed int v4; // esi@2 | |
2012 bool result; // eax@13 | |
2013 | |
2014 switch ( uType ) | |
2015 { | |
2016 case 0u: | |
2017 v3 = pActor; | |
2018 v4 = pActor->pMonsterInfo.uResFire; | |
2019 goto LABEL_12; | |
2020 case 1u: | |
2021 v3 = pActor; | |
2022 v4 = pActor->pMonsterInfo.uResAir; | |
2023 goto LABEL_12; | |
2024 case 2u: | |
2025 v3 = pActor; | |
2026 v4 = pActor->pMonsterInfo.uResWater; | |
2027 goto LABEL_12; | |
2028 case 3u: | |
2029 v3 = pActor; | |
2030 v4 = pActor->pMonsterInfo.uResEarth; | |
2031 goto LABEL_12; | |
2032 case 7u: | |
2033 v3 = pActor; | |
2034 v4 = pActor->pMonsterInfo.uResMind; | |
2035 goto LABEL_12; | |
2036 case 6u: | |
2037 v3 = pActor; | |
2038 v4 = pActor->pMonsterInfo.uResSpirit; | |
2039 goto LABEL_12; | |
2040 case 8u: | |
2041 v3 = pActor; | |
2042 v4 = pActor->pMonsterInfo.uResBody; | |
2043 goto LABEL_12; | |
2044 case 9u: | |
2045 v3 = pActor; | |
2046 v4 = pActor->pMonsterInfo.uResLight; | |
2047 goto LABEL_12; | |
2048 case 0xAu: | |
2049 v3 = pActor; | |
2050 v4 = pActor->pMonsterInfo.uResDark; | |
2051 goto LABEL_12; | |
2052 case 4u: | |
2053 v3 = pActor; | |
2054 v4 = pActor->pMonsterInfo.uResPhysical; | |
2055 LABEL_12: | |
2056 if ( v4 < 200 ) | |
2057 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2058 else | |
2059 result = 0; | |
2060 break; | |
2061 default: | |
2062 result = 1; | |
2063 break; | |
2064 } | |
2065 return result; | |
2066 } | |
2067 | |
2068 //----- (00427769) -------------------------------------------------------- | |
2069 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2070 { | |
2071 bool result; // eax@2 | |
2072 | |
710 | 2073 __debugbreak(); // refactor |
0 | 2074 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2075 result = 1; | |
2076 else | |
2077 result = 0; | |
2078 return result; | |
2079 } | |
2080 | |
2081 //----- (0042777D) -------------------------------------------------------- | |
319 | 2082 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2083 { |
370 | 2084 //bool result; // eax@2 |
486 | 2085 //__int16 v6; // bx@4 |
437 | 2086 //Player *v7; // eax@4 |
486 | 2087 //char v8; // zf@12 |
0 | 2088 unsigned __int16 v9; // cx@16 |
2089 unsigned int v10; // eax@18 | |
2090 unsigned __int8 v11; // sf@18 | |
2091 unsigned __int8 v12; // of@18 | |
2092 unsigned __int16 v13; // cx@21 | |
2093 unsigned int v14; // eax@23 | |
486 | 2094 //stru277 *v15; // esi@27 |
2095 //stru277 *v16; // eax@28 | |
832 | 2096 //GUIWindow *v17; // eax@43 |
2097 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2098 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2099 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2100 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2101 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2102 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2103 //int v24; // [sp-18h] [bp-30h]@44 | |
2104 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2105 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2106 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2107 //char *v28; // [sp-8h] [bp-20h]@43 | |
2108 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2109 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2110 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2111 | |
2112 //a3a = uPlayerID; | |
2113 //a2a = a1; | |
370 | 2114 |
2115 //if ( pParty->bTurnBasedModeOn != 1 | |
2116 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2117 if (pParty->bTurnBasedModeOn) | |
0 | 2118 { |
370 | 2119 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2120 return; | |
2121 } | |
2122 | |
2123 | |
486 | 2124 //v6 = a5; |
437 | 2125 //v7 = &pParty->pPlayers[uPlayerID]; |
2126 assert(uPlayerID < 4); | |
2127 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2128 if ( !(a5 & 0x10) ) |
2129 { | |
2130 switch ( a1 ) | |
2131 { | |
486 | 2132 case SPELL_SPIRIT_FATE: |
2133 case SPELL_BODY_FIRST_AID: | |
2134 case SPELL_DARK_REANIMATE: | |
2135 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2136 a5 |= 0x0100; | |
0 | 2137 break; |
486 | 2138 |
2139 case SPELL_FIRE_FIRE_AURA: | |
2140 case SPELL_WATER_RECHARGE_ITEM: | |
2141 case SPELL_WATER_ENCHANT_ITEM: | |
2142 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2143 //LOBYTE(v6) = a5 | 0x80; | |
2144 a5 |= 0x0080; | |
0 | 2145 break; |
486 | 2146 |
2147 case SPELL_FIRE_FIRE_BOLT: | |
2148 case SPELL_FIRE_FIREBALL: | |
2149 case SPELL_FIRE_INCINERATE: | |
2150 case SPELL_AIR_LIGHNING_BOLT: | |
2151 case SPELL_AIR_IMPLOSION: | |
2152 case SPELL_WATER_POISON_SPRAY: | |
2153 case SPELL_WATER_ICE_BOLT: | |
2154 case SPELL_WATER_ACID_BURST: | |
2155 case SPELL_WATER_ICE_BLAST: | |
2156 case SPELL_EARTH_STUN: | |
2157 case SPELL_EARTH_SLOW: | |
2158 case SPELL_EARTH_DEADLY_SWARM: | |
2159 case SPELL_EARTH_BLADES: | |
2160 case SPELL_EARTH_MASS_DISTORTION: | |
2161 case SPELL_SPIRIT_SPIRIT_LASH: | |
2162 case SPELL_MIND_MIND_BLAST: | |
2163 case SPELL_MIND_CHARM: | |
2164 case SPELL_MIND_PSYCHIC_SHOCK: | |
2165 case SPELL_BODY_HARM: | |
2166 case SPELL_BODY_FLYING_FIST: | |
2167 case SPELL_LIGHT_LIGHT_BOLT: | |
2168 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2169 case SPELL_LIGHT_SUNRAY: | |
2170 case SPELL_DARK_TOXIC_CLOUD: | |
2171 case SPELL_DARK_SHRINKING_RAY: | |
2172 case SPELL_DARK_SHARPMETAL: | |
2173 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2174 if ( !a6 ) |
486 | 2175 a5 |= 0x0008; |
0 | 2176 break; |
486 | 2177 case SPELL_MIND_TELEPATHY: |
2178 case SPELL_MIND_BERSERK: | |
2179 case SPELL_MIND_ENSLAVE: | |
2180 case SPELL_LIGHT_PARALYZE: | |
2181 case SPELL_DARK_CONTROL_UNDEAD: | |
2182 //LABEL_9: | |
2183 //v6 = a5 | 8; | |
2184 a5 |= 0x0008; | |
0 | 2185 break; |
486 | 2186 |
2187 case SPELL_EARTH_TELEKINESIS: | |
2188 a5 |= 0x0040; | |
2189 break; | |
2190 | |
2191 case SPELL_SPIRIT_BLESS: | |
2192 if (a4 && ~a4 & 0x01C0) | |
2193 goto LABEL_25; | |
2194 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); | |
0 | 2195 goto LABEL_25; |
2196 break; | |
486 | 2197 |
2198 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2199 v9 = a4; |
2200 if ( !a4 ) | |
437 | 2201 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
0 | 2202 goto LABEL_18; |
486 | 2203 |
2204 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2205 v9 = a4; |
2206 if ( !a4 ) | |
437 | 2207 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
0 | 2208 LABEL_18: |
2209 v10 = SkillToMastery(v9); | |
2210 v12 = __OFSUB__(v10, 3); | |
2211 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2212 goto LABEL_24; | |
486 | 2213 |
2214 case SPELL_BODY_HAMMERHANDS: | |
0 | 2215 v13 = a4; |
2216 if ( !a4 ) | |
437 | 2217 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2218 v14 = SkillToMastery(v13); |
2219 v12 = __OFSUB__(v14, 4); | |
2220 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
2221 LABEL_24: | |
2222 if ( v11 ^ v12 ) | |
2223 goto LABEL_25; | |
2224 break; | |
486 | 2225 |
2226 case SPELL_EARTH_STONE_TO_FLESH: | |
2227 case SPELL_SPIRIT_REMOVE_CURSE: | |
2228 case SPELL_SPIRIT_RAISE_DEAD: | |
2229 case SPELL_SPIRIT_RESSURECTION: | |
2230 case SPELL_MIND_REMOVE_FEAR: | |
2231 case SPELL_MIND_CURE_PARALYSIS: | |
2232 case SPELL_MIND_CURE_INSANITY: | |
2233 case SPELL_BODY_CURE_WEAKNESS: | |
2234 case SPELL_BODY_REGENERATION: | |
2235 case SPELL_BODY_CURE_POISON: | |
2236 case SPELL_BODY_CURE_DISEASE: | |
0 | 2237 LABEL_25: |
486 | 2238 //v6 = a5 | 2; |
2239 a5 |= 0x0002; | |
0 | 2240 break; |
486 | 2241 |
2242 case SPELL_DARK_SACRIFICE: | |
2243 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2244 a5 |= 0x0200; | |
0 | 2245 break; |
2246 default: | |
2247 break; | |
2248 } | |
2249 } | |
370 | 2250 |
486 | 2251 |
2252 if (a5 & 0x3CA) | |
0 | 2253 { |
924 | 2254 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2255 for (uint i = 0; i < 10; ++i) |
924 | 2256 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2257 { |
924 | 2258 pCastSpellInfo[i].spellnum = 0; |
486 | 2259 break; |
2260 } | |
0 | 2261 } |
486 | 2262 |
924 | 2263 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2264 for (uint i = 0; i < 10; ++i) |
0 | 2265 { |
924 | 2266 auto spell = pCastSpellInfo + i; |
486 | 2267 if (!spell->spellnum) |
2268 continue; | |
2269 | |
2270 spell->spellnum = 0; | |
2271 if (spell->field_8 & 0x3CA) | |
0 | 2272 { |
486 | 2273 pGUIWindow_Settings->Release(); |
2274 pGUIWindow_Settings = nullptr; | |
2275 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2276 GameUI_Footer_TimeLeft = 0; |
486 | 2277 unk_50C9A0 = 0; |
2278 back_to_game(); | |
0 | 2279 } |
2280 } | |
486 | 2281 |
924 | 2282 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2283 if ( result != -1 ) |
2284 { | |
486 | 2285 if ( a5 & 2 ) |
0 | 2286 { |
2287 if ( pGUIWindow_Settings ) | |
319 | 2288 return; |
924 | 2289 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2290 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); |
2291 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); | |
2292 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); | |
2293 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); | |
319 | 2294 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2295 return; | |
0 | 2296 } |
486 | 2297 if ( a5 & 8 ) |
0 | 2298 { |
2299 if ( pGUIWindow_Settings ) | |
319 | 2300 return; |
832 | 2301 |
924 | 2302 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2303 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); |
319 | 2304 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2305 return; | |
0 | 2306 } |
486 | 2307 if ( a5 & 0x40 ) |
0 | 2308 { |
2309 if ( pGUIWindow_Settings ) | |
319 | 2310 return; |
832 | 2311 |
924 | 2312 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2313 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); |
2314 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2315 return; | |
0 | 2316 } |
486 | 2317 if ( (char)a5 < 0 ) |
0 | 2318 { |
2319 if ( pGUIWindow_Settings ) | |
319 | 2320 return; |
0 | 2321 ++pIcons_LOD->uTexturePacksCount; |
2322 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2323 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2324 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2325 unk_50C9A0 = 1; |
2326 some_active_character = uActiveCharacter; | |
319 | 2327 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2328 return; | |
0 | 2329 } |
486 | 2330 if ( HIBYTE(a5) & 1 ) |
0 | 2331 { |
2332 if ( pGUIWindow_Settings ) | |
319 | 2333 return; |
924 | 2334 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2335 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); |
2336 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); | |
2337 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); | |
2338 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); | |
2339 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); | |
423 | 2340 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2341 } |
486 | 2342 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2343 { |
924 | 2344 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2345 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2346 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2347 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
0 | 2348 1, |
2349 0, | |
832 | 2350 UIMSG_ScrollNPCPanel, 0, |
0 | 2351 0, |
2352 "", | |
832 | 2353 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2354 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2355 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2356 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
0 | 2357 1, |
2358 0, | |
832 | 2359 UIMSG_ScrollNPCPanel, 1, |
0 | 2360 0, |
2361 "", | |
832 | 2362 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
2363 pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0); | |
2364 pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0); | |
0 | 2365 } |
2366 } | |
2367 } | |
2368 | |
2369 //----- (00427D48) -------------------------------------------------------- | |
924 | 2370 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2371 { |
924 | 2372 CastSpellInfo *v2; // esi@1 |
0 | 2373 signed int v3; // ebx@1 |
2374 | |
2375 v2 = this; | |
2376 v3 = 10; | |
2377 do | |
2378 { | |
2379 if ( v2->spellnum ) | |
2380 { | |
2381 if ( v2->field_8 & 0x3CA ) | |
2382 { | |
2383 v2->spellnum = 0; | |
2384 pGUIWindow_Settings->Release(); | |
2385 pGUIWindow_Settings = 0; | |
2386 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2387 GameUI_Footer_TimeLeft = 0; |
0 | 2388 unk_50C9A0 = 0; |
2389 back_to_game(); | |
2390 } | |
2391 } | |
2392 ++v2; | |
2393 --v3; | |
2394 } | |
2395 while ( v3 ); | |
2396 } | |
2397 | |
2398 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2399 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2400 { |
2401 unsigned int result; // eax@1 | |
924 | 2402 CastSpellInfo *v7; // edx@1 |
2403 CastSpellInfo *v8; // ecx@5 | |
0 | 2404 |
2405 result = 0; | |
2406 v7 = this; | |
2407 while ( v7->spellnum ) | |
2408 { | |
2409 ++result; | |
2410 ++v7; | |
2411 if ( (signed int)result >= 10 ) | |
2412 goto LABEL_8; | |
2413 } | |
2414 v8 = &this[result]; | |
2415 v8->spellnum = a2; | |
2416 v8->uPlayerID = uPlayerID; | |
2417 if ( a5 & 0x10 ) | |
2418 v8->uPlayerID_2 = uPlayerID; | |
2419 v8->field_6 = 0; | |
488 | 2420 v8->spell_target_pid = 0; |
0 | 2421 v8->field_8 = a5; |
488 | 2422 v8->forced_spell_skill_level = skill_level; |
823 | 2423 v8->sound_id = spell_sound_id; |
0 | 2424 LABEL_8: |
2425 if ( result == 10 ) | |
2426 result = -1; | |
2427 return result; | |
2428 } | |
2429 | |
2430 //----- (00427E01) -------------------------------------------------------- | |
924 | 2431 void CastSpellInfo::_427E01_cast_spell() |
0 | 2432 { |
486 | 2433 //int v1; // esi@1 |
0 | 2434 int v2; // edi@1 |
924 | 2435 CastSpellInfo *pCastSpell; // ebx@2 |
488 | 2436 //signed int v4; // eax@8 |
2437 //__int16 v5; // ax@9 | |
0 | 2438 signed int v6; // eax@14 |
488 | 2439 //__int16 v7; // ax@23 |
2440 //__int16 v8; // ax@24 | |
2441 //char v9; // al@44 | |
2442 //int v10; // eax@45 | |
0 | 2443 unsigned __int16 v11; // cx@45 |
822 | 2444 //signed int v12; // ecx@48 |
490 | 2445 //int v13; // eax@53 |
0 | 2446 unsigned __int8 v14; // zf@53 |
488 | 2447 //unsigned int v15; // edx@53 |
2448 //signed int v16; // eax@53 | |
0 | 2449 Player *v17; // esi@70 |
822 | 2450 //int v18; // eax@72 |
823 | 2451 //int v19; // eax@74 |
888 | 2452 Player *v20; // eax@74 |
0 | 2453 signed int i; // esi@76 |
823 | 2454 //int v22; // eax@88 |
0 | 2455 __int16 v23; // ax@88 |
488 | 2456 //int v24; // ecx@93 |
2457 //int v25; // ecx@94 | |
2458 //signed __int64 v26; // qax@100 | |
2459 //char *v27; // ecx@100 | |
2460 //unsigned __int64 v28; // qax@102 | |
0 | 2461 int v29; // ecx@105 |
2462 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2463 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2464 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2465 //char *v33; // edx@113 |
823 | 2466 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2467 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2468 //int v36; // edx@125 |
823 | 2469 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2470 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2471 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2472 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2473 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2474 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2475 //int *v43; // ecx@129 |
823 | 2476 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2477 //int v45; // ecx@132 |
0 | 2478 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2479 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2480 //int v48; // eax@137 |
823 | 2481 //int v49; // eax@137 |
822 | 2482 //int v50; // eax@141 |
0 | 2483 int v51; // eax@146 |
2484 __int16 v52; // ax@153 | |
823 | 2485 //int v53; // eax@153 |
0 | 2486 signed __int64 v54; // qax@164 |
2487 int v55; // edi@164 | |
488 | 2488 //stru6 *v56; // eax@165 |
0 | 2489 int v57; // eax@169 |
2490 signed __int64 v58; // qax@177 | |
2491 int v59; // edi@177 | |
2492 unsigned __int16 v60; // ax@184 | |
2493 int v61; // ecx@184 | |
823 | 2494 //int v62; // eax@186 |
0 | 2495 int v63; // ecx@187 |
2496 int v64; // ecx@188 | |
2497 int v65; // ecx@189 | |
710 | 2498 //const char *v66; // ecx@200 |
2499 //unsigned int v67; // edx@201 | |
0 | 2500 char v68; // al@207 |
89 | 2501 ItemGen *v69; // esi@211 |
0 | 2502 int v70; // ecx@214 |
2503 int v71; // ecx@215 | |
2504 int v72; // ecx@216 | |
488 | 2505 //__int16 v73; // ST1C_2@222 |
2506 //__int16 v74; // ST18_2@222 | |
2507 //stru6 *v75; // eax@222 | |
0 | 2508 int v76; // ecx@223 |
2509 int v77; // ecx@224 | |
2510 int v78; // ecx@225 | |
2511 int v79; // eax@227 | |
488 | 2512 //int v80; // eax@232 |
2513 //__int16 v81; // ST18_2@245 | |
2514 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2515 //signed int v83; // edi@245 |
488 | 2516 //__int16 v84; // ST18_2@245 |
2517 //stru6 *v85; // eax@245 | |
2518 //__int16 v86; // ST18_2@245 | |
2519 //stru6 *v87; // eax@245 | |
2520 //__int16 v88; // ST18_2@245 | |
2521 //stru6 *v89; // eax@245 | |
0 | 2522 double v90; // st7@245 |
2523 int v91; // eax@250 | |
89 | 2524 Player *v92; // eax@255 |
488 | 2525 //__int16 v93; // ST18_2@260 |
2526 //stru6 *v94; // eax@260 | |
2527 //__int16 v95; // ST18_2@260 | |
2528 //stru6 *v96; // eax@260 | |
2529 //__int16 v97; // ST18_2@260 | |
2530 //stru6 *v98; // eax@260 | |
2531 //__int16 v99; // ST18_2@260 | |
2532 //stru6 *v100; // eax@260 | |
0 | 2533 int v101; // ecx@261 |
2534 int v102; // ecx@262 | |
2535 int v103; // ecx@263 | |
2536 int v104; // eax@265 | |
2537 int v105; // edi@271 | |
488 | 2538 //__int16 v106; // ST18_2@272 |
2539 //stru6 *v107; // eax@272 | |
0 | 2540 __int16 v108; // ST1C_2@274 |
2541 __int16 v109; // ST18_2@274 | |
2542 stru6 *v110; // eax@274 | |
2543 int v111; // eax@274 | |
2544 Actor *v112; // esi@278 | |
2545 int v113; // eax@278 | |
2546 int v114; // ebx@278 | |
2547 unsigned int v115; // ecx@278 | |
2548 int v116; // edx@279 | |
2549 int v117; // edx@281 | |
2550 int v118; // edx@283 | |
2551 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2552 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2553 //int v121; // eax@286 |
0 | 2554 signed int v122; // eax@286 |
2555 int v123; // ecx@288 | |
2556 int v124; // ecx@289 | |
2557 int v125; // ecx@290 | |
2558 int v126; // eax@292 | |
2559 int v127; // eax@296 | |
488 | 2560 //__int16 v128; // ST18_2@303 |
2561 //stru6 *v129; // eax@303 | |
2562 //__int16 v130; // ST18_2@303 | |
2563 //stru6 *v131; // eax@303 | |
2564 //__int16 v132; // ST18_2@303 | |
2565 //stru6 *v133; // eax@303 | |
2566 //__int16 v134; // ST18_2@303 | |
2567 //stru6 *v135; // eax@303 | |
2568 //unsigned __int64 v136; // qax@304 | |
2569 //char *v137; // ecx@304 | |
0 | 2570 int v138; // ecx@305 |
2571 int v139; // ecx@306 | |
2572 int v140; // eax@308 | |
488 | 2573 //__int16 v141; // ST18_2@311 |
2574 //stru6 *v142; // eax@311 | |
2575 //__int16 v143; // ST18_2@311 | |
2576 //stru6 *v144; // eax@311 | |
2577 //__int16 v145; // ST18_2@311 | |
2578 //stru6 *v146; // eax@311 | |
2579 //__int16 v147; // ST18_2@311 | |
2580 //stru6 *v148; // eax@311 | |
0 | 2581 int v149; // ecx@312 |
2582 int v150; // ecx@313 | |
2583 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2584 //signed int v152; // eax@322 |
0 | 2585 int v153; // ecx@322 |
2586 int v154; // eax@322 | |
2587 int v155; // eax@323 | |
2588 int v156; // eax@323 | |
2589 int v157; // eax@326 | |
2590 double v158; // st7@326 | |
2591 double v159; // st6@326 | |
2592 signed __int64 v160; // qtt@334 | |
823 | 2593 //int v161; // eax@339 |
0 | 2594 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2595 //int v163; // eax@340 |
0 | 2596 signed int v164; // eax@340 |
2597 signed int v165; // edi@340 | |
488 | 2598 //stru6 *v166; // eax@340 |
2599 //stru6 *v167; // eax@340 | |
0 | 2600 signed int v168; // edi@343 |
2601 int v169; // eax@344 | |
2602 int v170; // ecx@346 | |
2603 int v171; // ecx@347 | |
2604 int v172; // ecx@348 | |
2605 int v173; // edi@350 | |
2606 signed int v174; // edi@355 | |
488 | 2607 //__int16 v175; // ST18_2@357 |
2608 //stru6 *v176; // eax@357 | |
2609 //__int16 v177; // ST18_2@357 | |
2610 //stru6 *v178; // eax@357 | |
2611 //__int16 v179; // ST18_2@357 | |
2612 //stru6 *v180; // eax@357 | |
2613 //__int16 v181; // ST18_2@357 | |
2614 //stru6 *v182; // eax@357 | |
2615 //signed __int64 v183; // qax@357 | |
0 | 2616 int v184; // ecx@358 |
2617 int v185; // ecx@359 | |
2618 int v186; // ecx@360 | |
823 | 2619 //int v187; // eax@367 |
0 | 2620 int v188; // esi@369 |
2621 int v189; // edi@369 | |
710 | 2622 //const char *v190; // ecx@377 |
0 | 2623 signed int v191; // edi@379 |
2624 int v192; // ecx@382 | |
2625 int v193; // ecx@383 | |
2626 int v194; // ecx@384 | |
2627 int v195; // eax@386 | |
2628 int v196; // eax@387 | |
488 | 2629 //__int16 v197; // ST18_2@395 |
2630 //stru6 *v198; // eax@395 | |
2631 //__int16 v199; // ST18_2@395 | |
2632 //stru6 *v200; // eax@395 | |
2633 //__int16 v201; // ST18_2@395 | |
2634 //stru6 *v202; // eax@395 | |
2635 //__int16 v203; // ST18_2@395 | |
2636 //stru6 *v204; // eax@395 | |
0 | 2637 signed int v205; // edi@405 |
2638 int v206; // eax@407 | |
2639 __int16 v207; // cx@407 | |
2640 int v208; // eax@411 | |
2641 signed int v209; // ecx@412 | |
2642 int v210; // edx@412 | |
2643 signed int v211; // ecx@412 | |
2644 int v212; // eax@413 | |
2645 int v213; // eax@413 | |
2646 int v214; // eax@413 | |
2647 int v215; // eax@415 | |
2648 double v216; // st7@415 | |
2649 double v217; // st6@415 | |
2650 signed __int64 v218; // qtt@423 | |
2651 int v219; // ecx@425 | |
2652 int v220; // ecx@426 | |
2653 int v221; // edi@428 | |
890 | 2654 Player *v222; // edi@434 |
0 | 2655 char v223; // al@438 |
2656 int v224; // ecx@442 | |
2657 int v225; // ecx@443 | |
823 | 2658 //int v226; // eax@451 |
0 | 2659 int v227; // esi@453 |
2660 unsigned int v228; // edi@454 | |
2661 int v229; // edi@466 | |
488 | 2662 //__int16 v230; // ST18_2@469 |
2663 //stru6 *v231; // eax@469 | |
2664 //signed int v232; // esi@469 | |
2665 //__int16 v233; // ST18_2@469 | |
2666 //stru6 *v234; // eax@469 | |
2667 //__int16 v235; // ST18_2@469 | |
2668 //stru6 *v236; // eax@469 | |
2669 //__int16 v237; // ST18_2@469 | |
2670 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2671 //__int16 v239; // ST1C_2@469 |
0 | 2672 char *v240; // ecx@472 |
2673 double v241; // st7@478 | |
2674 signed __int64 v242; // qax@484 | |
2675 char *v243; // ecx@484 | |
2676 char *v244; // eax@488 | |
2677 int v245; // edi@492 | |
2678 int v246; // eax@492 | |
2679 char *v247; // eax@497 | |
2680 char v248; // al@497 | |
2681 char v249; // cf@500 | |
2682 float v250; // esi@507 | |
2683 char v251; // al@507 | |
2684 int v252; // edx@510 | |
2685 int m; // esi@510 | |
2686 int v254; // eax@513 | |
2687 int v255; // esi@513 | |
2688 int v256; // ecx@513 | |
2689 int v257; // edx@514 | |
2690 int v258; // ecx@514 | |
2691 char v259; // al@516 | |
2692 int v260; // eax@518 | |
2693 int v261; // esi@519 | |
2694 int v262; // edx@521 | |
2695 int v263; // ecx@521 | |
2696 int v264; // esi@521 | |
2697 int v265; // edx@521 | |
2698 int *ii; // eax@522 | |
2699 int v267; // eax@524 | |
2700 int v268; // eax@524 | |
2701 int v269; // eax@526 | |
2702 char *v270; // eax@531 | |
2703 char v271; // al@531 | |
2704 char v272; // cf@534 | |
2705 float v273; // esi@541 | |
2706 char v274; // al@541 | |
2707 int v275; // edx@544 | |
2708 int k; // esi@544 | |
2709 int v277; // edx@548 | |
2710 int v278; // ecx@548 | |
2711 char v279; // al@550 | |
2712 int v280; // eax@552 | |
2713 int v281; // esi@553 | |
2714 int v282; // edx@555 | |
2715 int v283; // ecx@555 | |
2716 int v284; // esi@555 | |
2717 int v285; // edx@555 | |
2718 int *l; // eax@556 | |
2719 int v287; // eax@558 | |
2720 int v288; // eax@558 | |
2721 ItemGen *v289; // eax@560 | |
2722 signed int v290; // eax@560 | |
2723 unsigned __int8 v291; // al@564 | |
2724 char v292; // al@573 | |
2725 int v293; // eax@575 | |
2726 ItemGen *v294; // esi@575 | |
2727 int v295; // edx@575 | |
2728 int kk; // edi@575 | |
2729 int v297; // edx@579 | |
2730 int v298; // ecx@579 | |
2731 char v299; // al@581 | |
2732 int v300; // eax@583 | |
2733 int v301; // edi@584 | |
2734 int v302; // edx@586 | |
2735 int v303; // ecx@586 | |
2736 int v304; // edi@586 | |
2737 int v305; // edx@586 | |
2738 int *jj; // eax@587 | |
2739 int v307; // eax@589 | |
2740 int v308; // eax@589 | |
2741 char *v309; // ecx@593 | |
2742 char v310; // sf@593 | |
2743 unsigned __int8 v311; // of@593 | |
2744 char v312; // cl@597 | |
488 | 2745 char v313; // al@606pGame->GetStru6() |
0 | 2746 int v314; // edx@607 |
2747 int j; // esi@607 | |
2748 unsigned int v316; // eax@613 | |
2749 const char *v317; // ecx@617 | |
2750 Player *v318; // ecx@619 | |
2751 unsigned int v319; // edi@627 | |
2752 int v320; // ecx@629 | |
2753 int v321; // ecx@630 | |
2754 int v322; // edi@632 | |
2755 int v323; // edi@635 | |
2756 char *v324; // eax@635 | |
2757 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2758 //int v326; // eax@643 |
823 | 2759 //int v327; // eax@648 |
0 | 2760 int v328; // ecx@651 |
2761 int v329; // ecx@652 | |
2762 int v330; // edi@654 | |
488 | 2763 //__int16 v331; // ST18_2@658 |
2764 //stru6 *v332; // eax@658 | |
2765 //__int16 v333; // ST18_2@658 | |
2766 //stru6 *v334; // eax@658 | |
2767 //__int16 v335; // ST18_2@658 | |
2768 //stru6 *v336; // eax@658 | |
2769 //__int16 v337; // ST18_2@658 | |
2770 //stru6 *v338; // eax@658 | |
0 | 2771 int v339; // ecx@659 |
2772 int v340; // ecx@660 | |
2773 int v341; // eax@663 | |
2774 signed int v342; // edi@668 | |
2775 signed int v343; // edi@670 | |
2776 unsigned __int64 v344; // ST08_8@670 | |
488 | 2777 //__int16 v345; // ST1C_2@671 |
2778 //__int16 v346; // ST18_2@671 | |
2779 //stru6 *v347; // eax@671 | |
0 | 2780 int v348; // ecx@672 |
2781 int v349; // ecx@673 | |
2782 int v350; // edi@676 | |
2783 Player *v351; // edi@680 | |
488 | 2784 //__int16 v352; // ST18_2@685 |
2785 //stru6 *v353; // eax@685 | |
0 | 2786 int v354; // ecx@686 |
2787 int v355; // ecx@687 | |
2788 int v356; // eax@689 | |
112 | 2789 Player *v357; // edi@694 |
488 | 2790 //unsigned __int16 v358; // ST1C_2@695 |
2791 //__int16 v359; // ST18_2@695 | |
2792 //stru6 *v360; // eax@695 | |
2793 //__int16 v361; // ST1C_2@697 | |
2794 //__int16 v362; // ST18_2@697 | |
2795 //stru6 *v363; // eax@697 | |
0 | 2796 int v364; // ecx@698 |
2797 int v365; // ecx@699 | |
2798 int v366; // eax@701 | |
488 | 2799 //stru6 *v367; // eax@704 |
823 | 2800 //int v368; // eax@704 |
0 | 2801 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2802 //int v370; // eax@706 |
0 | 2803 int v371; // ecx@709 |
2804 int v372; // ecx@710 | |
2805 int v373; // eax@715 | |
2806 int v374; // eax@717 | |
112 | 2807 Player *v375; // edi@717 |
0 | 2808 int v376; // eax@717 |
2809 Player *v377; // ecx@719 | |
2810 int v378; // ecx@721 | |
2811 int v379; // ecx@722 | |
2812 int v380; // eax@724 | |
2813 int v381; // edi@727 | |
2814 int v382; // ecx@727 | |
2815 Player *v383; // eax@728 | |
2816 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2817 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2818 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2819 //Player *v387; // edi@738 |
0 | 2820 int v388; // edi@740 |
488 | 2821 //unsigned __int16 v389; // ST1C_2@740 |
2822 //__int16 v390; // ST18_2@740 | |
2823 //stru6 *v391; // eax@740 | |
0 | 2824 int v392; // ecx@742 |
2825 int v393; // ecx@743 | |
2826 int v394; // ecx@744 | |
2827 int v395; // edi@747 | |
2828 int v396; // eax@752 | |
2829 int v397; // eax@757 | |
2830 int v398; // eax@757 | |
2831 int v399; // eax@757 | |
2832 char *v400; // esi@757 | |
488 | 2833 //Game *v401; // ecx@759 |
2834 //__int16 v402; // ST1C_2@759 | |
2835 //__int16 v403; // ST18_2@759 | |
2836 //stru6 *v404; // eax@759 | |
0 | 2837 int v405; // ecx@761 |
2838 int v406; // ecx@762 | |
2839 int v407; // edi@765 | |
488 | 2840 //__int16 v408; // ST1C_2@769 |
2841 //__int16 v409; // ST18_2@769 | |
2842 //stru6 *v410; // eax@769 | |
0 | 2843 int v411; // ecx@772 |
2844 int v412; // ecx@773 | |
2845 int v413; // edi@775 | |
488 | 2846 //__int16 v414; // ST1C_2@781 |
2847 //__int16 v415; // ST18_2@781 | |
2848 //stru6 *v416; // eax@781 | |
0 | 2849 int v417; // eax@787 |
2850 int v418; // ecx@789 | |
2851 __int16 v419; // ax@791 | |
2852 signed int v420; // eax@793 | |
2853 int v421; // edx@793 | |
2854 const char *v422; // eax@801 | |
2855 int v423; // ecx@808 | |
2856 int v424; // ecx@809 | |
2857 int v425; // eax@811 | |
2858 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2859 //signed int v427; // eax@820 |
0 | 2860 int v428; // ecx@825 |
2861 int v429; // ecx@826 | |
2862 int v430; // eax@828 | |
488 | 2863 //stru6 *v431; // eax@831 |
823 | 2864 //int v432; // eax@831 |
0 | 2865 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2866 //int v434; // eax@833 |
0 | 2867 int v435; // ecx@837 |
2868 int v436; // ecx@838 | |
488 | 2869 //__int16 v437; // ST1C_2@843 |
2870 //__int16 v438; // ST18_2@843 | |
2871 //stru6 *v439; // eax@843 | |
0 | 2872 int v440; // eax@843 |
2873 int v441; // eax@847 | |
2874 int v442; // ecx@850 | |
2875 int v443; // ecx@851 | |
2876 int v444; // eax@853 | |
2877 signed int v445; // edi@857 | |
2878 int v446; // ecx@862 | |
2879 LevelDecoration *v447; // edi@864 | |
2880 __int16 v448; // ax@864 | |
2881 char *v449; // esi@870 | |
2882 int v450; // eax@870 | |
2883 int v451; // ecx@875 | |
2884 int v452; // ecx@876 | |
2885 int v453; // edi@878 | |
488 | 2886 //__int16 v454; // ST1C_2@884 |
2887 //__int16 v455; // ST18_2@884 | |
2888 //stru6 *v456; // eax@884 | |
0 | 2889 int v457; // ecx@887 |
2890 int v458; // ecx@888 | |
2891 int v459; // eax@890 | |
2892 signed int v460; // eax@895 | |
2893 Actor *v461; // eax@897 | |
2894 unsigned __int16 v462; // cx@897 | |
2895 signed int v463; // edx@897 | |
2896 int v464; // ecx@905 | |
2897 int v465; // ecx@906 | |
2898 int v466; // edi@909 | |
488 | 2899 //__int16 v467; // ST1C_2@913 |
2900 //__int16 v468; // ST18_2@913 | |
2901 //stru6 *v469; // eax@913 | |
0 | 2902 int v470; // edi@913 |
2903 int v471; // eax@917 | |
2904 int v472; // eax@917 | |
2905 char *v473; // esi@918 | |
488 | 2906 //__int16 v474; // ST18_2@920 |
2907 //stru6 *v475; // eax@920 | |
2908 //__int16 v476; // ST18_2@920 | |
2909 //stru6 *v477; // eax@920 | |
2910 //__int16 v478; // ST18_2@920 | |
2911 //stru6 *v479; // eax@920 | |
2912 //__int16 v480; // ST18_2@920 | |
2913 //stru6 *v481; // eax@920 | |
2914 //__int16 v482; // ST18_2@923 | |
2915 //stru6 *v483; // eax@923 | |
2916 //__int16 v484; // ST18_2@923 | |
2917 //stru6 *v485; // eax@923 | |
2918 //__int16 v486; // ST18_2@923 | |
2919 //stru6 *v487; // eax@923 | |
2920 //__int16 v488; // ST18_2@923 | |
2921 //stru6 *v489; // eax@923 | |
2922 //__int16 v490; // ST1C_2@924 | |
2923 //__int16 v491; // ST18_2@924 | |
2924 //stru6 *v492; // eax@924 | |
0 | 2925 int v493; // ecx@925 |
2926 int v494; // ecx@926 | |
488 | 2927 //__int16 v495; // ST1C_2@931 |
2928 //__int16 v496; // ST18_2@931 | |
2929 //stru6 *v497; // eax@931 | |
0 | 2930 int v498; // edi@931 |
2931 int v499; // eax@935 | |
2932 int v500; // eax@935 | |
2933 Player *v501; // edi@939 | |
488 | 2934 //__int16 v502; // ST18_2@940 |
2935 //stru6 *v503; // eax@940 | |
2936 //stru6 *v504; // eax@943 | |
0 | 2937 int v505; // eax@943 |
823 | 2938 //int v506; // eax@943 |
0 | 2939 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2940 //int v508; // eax@944 |
0 | 2941 signed int v509; // eax@944 |
2942 signed int v510; // edi@944 | |
2943 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2944 //int v512; // eax@946 |
0 | 2945 SpellBuff *v513; // edi@946 |
2946 int v514; // ecx@950 | |
2947 int v515; // ecx@951 | |
2948 int v516; // eax@953 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2949 //int v517; // eax@956 |
90 | 2950 Actor *v518; // edx@957 |
0 | 2951 __int16 v519; // cx@958 |
2952 int v520; // ecx@968 | |
2953 int v521; // ecx@969 | |
2954 int v522; // eax@971 | |
488 | 2955 //__int16 v523; // ST18_2@975 |
2956 //stru6 *v524; // eax@975 | |
2957 //__int16 v525; // ST18_2@975 | |
2958 //stru6 *v526; // eax@975 | |
2959 //__int16 v527; // ST18_2@975 | |
2960 //stru6 *v528; // eax@975 | |
2961 //__int16 v529; // ST18_2@975 | |
2962 //stru6 *v530; // eax@975 | |
0 | 2963 int v531; // eax@982 |
823 | 2964 //int v532; // eax@982 |
0 | 2965 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2966 //int v534; // eax@983 |
0 | 2967 signed int v535; // eax@983 |
2968 signed int v536; // edi@983 | |
2969 stru6 *v537; // eax@984 | |
2970 int v538; // ecx@985 | |
2971 int v539; // ecx@986 | |
2972 int v540; // eax@988 | |
488 | 2973 //__int16 v541; // ST18_2@991 |
2974 //stru6 *v542; // eax@991 | |
2975 //__int16 v543; // ST18_2@991 | |
2976 //stru6 *v544; // eax@991 | |
2977 //__int16 v545; // ST18_2@991 | |
2978 //stru6 *v546; // eax@991 | |
2979 //__int16 v547; // ST18_2@991 | |
0 | 2980 stru6 *v548; // eax@991 |
2981 double v549; // st7@991 | |
2982 unsigned __int16 v550; // di@991 | |
2983 int v551; // ecx@993 | |
2984 int v552; // ecx@994 | |
89 | 2985 Player *v553; // edi@1001 |
488 | 2986 //__int16 v554; // ST18_2@1002 |
2987 //stru6 *v555; // eax@1002 | |
2988 //__int16 v556; // ST18_2@1002 | |
2989 //stru6 *v557; // eax@1002 | |
2990 //__int16 v558; // ST18_2@1002 | |
2991 //stru6 *v559; // eax@1002 | |
2992 //__int16 v560; // ST18_2@1002 | |
2993 //stru6 *v561; // eax@1002 | |
0 | 2994 unsigned __int16 v562; // di@1005 |
2995 signed int v563; // eax@1010 | |
2996 unsigned int v564; // ecx@1011 | |
2997 signed int v565; // eax@1012 | |
2998 Player **v566; // ecx@1012 | |
2999 int v567; // eax@1012 | |
488 | 3000 //unsigned __int16 v568; // ST1C_2@1012 |
3001 //__int16 v569; // ST18_2@1012 | |
3002 //stru6 *v570; // eax@1012 | |
0 | 3003 Player *v571; // eax@1013 |
3004 char *v572; // ecx@1013 | |
3005 int v573; // ecx@1017 | |
3006 int v574; // ecx@1018 | |
3007 int v575; // eax@1020 | |
3008 signed int v576; // eax@1025 | |
3009 Player *v577; // eax@1026 | |
3010 int v578; // eax@1028 | |
3011 __int16 v579; // ax@1029 | |
823 | 3012 //int v580; // eax@1031 |
0 | 3013 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3014 //int v582; // eax@1031 |
488 | 3015 //__int16 v583; // ST1C_2@1034 |
3016 //__int16 v584; // ST18_2@1034 | |
0 | 3017 char *v585; // esi@1034 |
488 | 3018 //stru6 *v586; // eax@1034 |
0 | 3019 signed int v587; // eax@1035 |
3020 int v588; // ecx@1036 | |
3021 int v589; // ecx@1037 | |
3022 int v590; // ecx@1038 | |
3023 char v591; // al@1048 | |
3024 int v592; // esi@1052 | |
3025 int v593; // ecx@1057 | |
3026 int v594; // ecx@1058 | |
823 | 3027 //int v595; // eax@1064 |
0 | 3028 int v596; // esi@1066 |
3029 unsigned int v597; // edi@1067 | |
3030 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3031 //signed int v599; // eax@1082 |
0 | 3032 int v600; // edi@1086 |
3033 int v601; // edx@1086 | |
3034 int v602; // eax@1086 | |
3035 int v603; // ecx@1086 | |
823 | 3036 //int v604; // eax@1087 |
0 | 3037 char *v605; // eax@1089 |
3038 int v606; // edx@1091 | |
3039 int v607; // ecx@1100 | |
3040 __int16 v608; // ax@1102 | |
3041 signed int v609; // eax@1104 | |
3042 int v610; // edi@1106 | |
3043 unsigned int v611; // eax@1106 | |
89 | 3044 Player *v612; // edi@1106 |
3045 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3046 int v614; // eax@1116 |
3047 int v615; // edi@1119 | |
488 | 3048 //__int16 v616; // ST1C_2@1122 |
3049 //__int16 v617; // ST18_2@1122 | |
3050 //stru6 *v618; // eax@1122 | |
112 | 3051 Player *v619; // edi@1123 |
488 | 3052 //unsigned __int16 v620; // ST1C_2@1124 |
3053 //__int16 v621; // ST18_2@1124 | |
3054 //stru6 *v622; // eax@1124 | |
0 | 3055 signed __int64 v623; // qax@1127 |
823 | 3056 //int v624; // eax@1127 |
0 | 3057 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3058 //int v626; // eax@1129 |
0 | 3059 signed int v627; // eax@1129 |
3060 signed int v628; // edi@1129 | |
3061 int v629; // ecx@1130 | |
3062 Player *v630; // eax@1131 | |
3063 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3064 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3065 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3066 //signed int v634; // eax@1140 |
0 | 3067 int v635; // edi@1142 |
488 | 3068 //unsigned __int16 v636; // ST1C_2@1142 |
3069 //__int16 v637; // ST18_2@1142 | |
3070 //stru6 *v638; // eax@1142 | |
3071 //stru6 *v639; // eax@1143 | |
0 | 3072 int v640; // ecx@1146 |
3073 int v641; // ecx@1147 | |
3074 int v642; // edi@1156 | |
3075 int v643; // eax@1156 | |
3076 int v644; // eax@1156 | |
3077 signed int v645; // eax@1158 | |
488 | 3078 //Player *v646; // ebx@1169 |
3079 //int v647; // edi@1169 | |
3080 //signed int v648; // ST1C_4@1170 | |
3081 //Player *v649; // ecx@1170 | |
3082 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3083 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3084 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3085 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3086 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3087 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3088 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3089 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3090 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3091 int v659; // [sp+0h] [bp-E84h]@123 |
3092 int v660; // [sp+0h] [bp-E84h]@146 | |
3093 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3094 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3095 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3096 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3097 int v665; // [sp+0h] [bp-E84h]@807 | |
3098 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3099 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3100 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3101 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3102 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3103 int v671; // [sp+4h] [bp-E80h]@146 |
3104 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3105 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3106 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3107 const char *v675; // [sp+4h] [bp-E80h]@800 |
3108 int v676; // [sp+4h] [bp-E80h]@807 | |
3109 int v677; // [sp+4h] [bp-E80h]@861 | |
3110 int v678; // [sp+4h] [bp-E80h]@997 | |
3111 int v679; // [sp+14h] [bp-E70h]@515 | |
3112 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3113 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3114 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3115 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3116 int v684; // [sp+D04h] [bp-180h]@416 | |
3117 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3118 int x; // [sp+D20h] [bp-164h]@327 | |
3119 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3120 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3121 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3122 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3123 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3124 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3125 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3126 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3127 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3128 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3129 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3130 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3131 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3132 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3133 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3134 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3135 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3136 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3137 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3138 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3139 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3140 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3141 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3142 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
924 | 3143 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
0 | 3144 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3145 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3146 int n; // [sp+DA0h] [bp-E4h]@1 | |
3147 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3148 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3149 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3150 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3151 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3152 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3153 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
|
3154 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3155 int v723; // [sp+E4Ch] [bp-38h]@1 |
3156 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3157 float v725; // [sp+E54h] [bp-30h]@23 | |
3158 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3159 //int v726b; |
0 | 3160 float v727; // [sp+E5Ch] [bp-28h]@1 |
3161 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3162 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3163 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3164 Player *v730b; |
3165 ItemGen *v730c; | |
0 | 3166 int v731; // [sp+E6Ch] [bp-18h]@48 |
3167 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3168 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3169 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3170 int amount; // [sp+E80h] [bp-4h]@1 | |
3171 | |
924 | 3172 //auto ecx0 = this; |
3173 | |
3174 //v711 = ecx0; | |
3175 | |
3176 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
|
3177 //SpriteObject::SpriteObject(&a1); |
0 | 3178 |
486 | 3179 //v1 = 0; |
0 | 3180 v2 = 0; |
3181 amount = 0; | |
3182 LODWORD(v733) = 0; | |
3183 v723 = 0; | |
3184 v727 = 0.0; | |
889 | 3185 //n = 0; |
3186 //while ( 1 ) | |
3187 for(n = 0; n < 10; ++n) | |
0 | 3188 { |
924 | 3189 pCastSpell = &this[n]; |
3190 HIDWORD(v733) = (int)pCastSpell; | |
3191 if ( pCastSpell->spellnum == 0 ) | |
889 | 3192 continue; |
486 | 3193 |
3194 if (pParty->Invisible()) | |
3195 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3196 | |
924 | 3197 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 3198 { |
924 | 3199 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3200 this->_427D48(1); | |
889 | 3201 continue; |
0 | 3202 } |
924 | 3203 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3204 | |
3205 a2 = pCastSpell->spell_target_pid; | |
3206 if (!pCastSpell->spell_target_pid) | |
0 | 3207 { |
924 | 3208 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3209 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3210 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 3211 v666 = 1; |
3212 else | |
3213 v666 = 0; | |
3214 | |
3215 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3216 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3217 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3218 a2 = pMouse->uPointingObjectID; |
0 | 3219 } |
488 | 3220 |
3221 | |
924 | 3222 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3223 if (pSpellSprite.uType) | |
0 | 3224 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3225 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3226 { |
924 | 3227 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3228 v2 = v723; |
3229 } | |
3230 else | |
3231 { | |
3232 v715.uYawAngle = pParty->sRotationY; | |
3233 v715.uPitchAngle = pParty->sRotationX; | |
3234 } | |
3235 } | |
488 | 3236 |
486 | 3237 LODWORD(v725) = 0; |
3238 _this = 0; | |
924 | 3239 if (pCastSpell->forced_spell_skill_level) |
488 | 3240 { |
924 | 3241 v11 = pCastSpell->forced_spell_skill_level; |
488 | 3242 v723 = v11 & 0x3F; |
3243 v2 = v723; | |
3244 } | |
3245 else | |
0 | 3246 { |
488 | 3247 //v667 = PLAYER_SKILL_STAFF; |
924 | 3248 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 3249 v667 = PLAYER_SKILL_FIRE; |
924 | 3250 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 3251 v667 = PLAYER_SKILL_AIR; |
924 | 3252 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 3253 v667 = PLAYER_SKILL_WATER; |
924 | 3254 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 3255 v667 = PLAYER_SKILL_EARTH; |
924 | 3256 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 3257 v667 = PLAYER_SKILL_SPIRIT; |
924 | 3258 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 3259 v667 = PLAYER_SKILL_MIND; |
924 | 3260 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 3261 v667 = PLAYER_SKILL_BODY; |
924 | 3262 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 3263 v667 = PLAYER_SKILL_LIGHT; |
924 | 3264 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 3265 v667 = PLAYER_SKILL_DARK; |
924 | 3266 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 3267 v667 = PLAYER_SKILL_BOW; |
3268 else assert(false && "Unknown spell"); | |
3269 | |
0 | 3270 LODWORD(v725) = v667; |
488 | 3271 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3272 v2 = v723; | |
3273 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3274 } |
488 | 3275 |
0 | 3276 if ( HIBYTE(v11) & 1 ) |
3277 { | |
3278 v731 = 4; | |
3279 } | |
3280 else | |
3281 { | |
3282 if ( (v11 & 0x80u) == 0 ) | |
3283 { | |
3284 v731 = ((v11 & 0x40) != 0) + 1; | |
3285 } | |
3286 else | |
3287 { | |
3288 v731 = 3; | |
3289 } | |
3290 } | |
488 | 3291 |
924 | 3292 if (pCastSpell->forced_spell_skill_level) |
486 | 3293 uRequiredMana = 0; |
488 | 3294 else |
924 | 3295 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3296 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3297 |
3298 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3299 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3300 uRequiredMana = 0; |
488 | 3301 |
924 | 3302 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3303 { | |
3304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
3305 pCastSpell->spellnum = 0; | |
3306 continue; | |
3307 } | |
3308 v730 = pCastSpell->spellnum; | |
3309 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
3310 { | |
3311 if (!pParty->bTurnBasedModeOn) | |
3312 { | |
3313 //v646 = pPlayer; | |
3314 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3315 //v647 = n; | |
3316 } | |
3317 else | |
3318 { | |
3319 //v647 = n; | |
3320 //v646 = pPlayer; | |
3321 //v648 = sRecoveryTime; | |
3322 //v649 = pPlayer; | |
3323 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
3324 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3325 pTurnEngine->_40471C(); | |
3326 } | |
3327 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3328 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3329 this[n].spellnum = 0; | |
3330 pPlayer->sMana -= uRequiredMana; | |
3331 return; | |
3332 } | |
3333 | |
3334 switch ( pCastSpell->spellnum ) | |
3335 { | |
3336 case SPELL_101: | |
3337 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3338 case SPELL_BOW_ARROW: | |
3339 { | |
3340 v17 = pPlayer; | |
3341 _this = (ItemGen *)1; | |
3342 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3343 _this = (ItemGen *)2; | |
3344 sRecoveryTime = v17->GetAttackRecoveryTime(true); | |
3345 pSpellSprite.stru_24.Reset(); | |
3346 pSpellSprite.spell_level = v2; | |
3347 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3348 pSpellSprite.spell_skill = v731; | |
3349 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3350 if ( v17->WearsItem(510, 2) ) | |
3351 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3352 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3353 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3354 pSpellSprite.uAttributes = 0; | |
3355 pSpellSprite.uSpriteFrameID = 0; | |
3356 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3357 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3358 pSpellSprite.spell_target_pid = a2; | |
3359 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3360 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3361 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3362 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
3363 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
3364 pSpellSprite.uAttributes = 256; | |
3365 if ( pParty->bTurnBasedModeOn == 1 ) | |
3366 pSpellSprite.uAttributes = 260; | |
3367 for ( i = 0; i < (signed int)_this; ++i ) | |
3368 { | |
3369 if ( i ) | |
3370 pSpellSprite.vPosition.z += 32; | |
3371 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3372 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3373 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3374 ++pTurnEngine->field_1C; | |
3375 } | |
3376 break; | |
3377 } | |
3378 case SPELL_LASER_PROJECTILE: | |
3379 { | |
3380 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3381 pSpellSprite.stru_24.Reset(); | |
3382 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3383 pSpellSprite.spell_level = v723; | |
3384 pSpellSprite.spell_skill = v731; | |
3385 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3386 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3387 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3388 pSpellSprite.uAttributes = 0; | |
3389 pSpellSprite.uSpriteFrameID = 0; | |
3390 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3391 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3392 pSpellSprite.spell_target_pid = a2; | |
3393 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3394 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3395 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3396 memcpy(&pSpellSprite.stru_24, | |
3397 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3398 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3399 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3400 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3401 pSpellSprite.uSectorID = v23; | |
889 | 3402 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3403 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3404 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3405 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3406 ++pTurnEngine->field_1C; |
924 | 3407 break; |
3408 } | |
3409 case SPELL_FIRE_TORCH_LIGHT: | |
3410 { | |
889 | 3411 LODWORD(v733) = 3600 * v2; |
3412 | |
3413 switch (v731) | |
3414 { | |
890 | 3415 case 1: amount = 2; break; |
3416 case 2: amount = 3; break; | |
3417 case 3: | |
3418 case 4: amount = 4; break; | |
3419 default: | |
889 | 3420 assert(false); |
3421 } | |
3422 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3423 break; |
889 | 3424 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3425 LODWORD(v727) = 1; | |
890 | 3426 break; |
924 | 3427 } |
3428 case SPELL_FIRE_FIRE_SPIKE: | |
3429 { | |
890 | 3430 v29 = v731 - 2; |
3431 if ( v29 ) | |
3432 { | |
3433 v30 = v29 - 1; | |
3434 if ( v30 ) | |
3435 { | |
3436 if ( v30 == 1 ) | |
3437 amount = 9; | |
3438 else | |
3439 amount = 3; | |
889 | 3440 } |
3441 else | |
3442 { | |
890 | 3443 amount = 7; |
3444 } | |
3445 } | |
3446 else | |
3447 { | |
3448 amount = 5; | |
3449 } | |
3450 //v31 = v3->uPlayerID; | |
3451 //v32 = 8 * v31; | |
3452 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3453 | |
3454 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3455 int _v733 = 0; | |
3456 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3457 { | |
3458 auto object = pSpriteObjects + i; | |
924 | 3459 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
890 | 3460 ++_v733; |
3461 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3462 v730 = uNumSpriteObjects; | |
3463 do | |
3464 { | |
3465 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3466 ++HIDWORD(v733); | |
3467 v33 += 112; | |
3468 --v730; | |
3469 } | |
3470 while ( v730 );*/ | |
3471 } | |
3472 if (_v733 > amount) | |
3473 { | |
3474 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3475 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3476 pCastSpell->spellnum = 0; |
890 | 3477 continue; |
3478 } | |
3479 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3480 break; | |
924 | 3481 pSpellSprite.stru_24.Reset(); |
3482 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3483 pSpellSprite.spell_level = v2; | |
3484 pSpellSprite.spell_skill = v731; | |
3485 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3486 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3487 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3488 pSpellSprite.uAttributes = 0; | |
3489 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3490 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3491 pSpellSprite.uSpriteFrameID = 0; | |
3492 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3493 pSpellSprite.spell_target_pid = a2; | |
3494 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3495 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3496 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 3497 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3498 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3499 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3500 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 3501 ++pTurnEngine->field_1C; |
3502 LODWORD(v727) = 1; | |
3503 break; | |
924 | 3504 } |
3505 case SPELL_AIR_IMPLOSION: | |
3506 { | |
890 | 3507 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3508 break; | |
3509 if (!a2) | |
3510 { | |
3511 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3512 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3513 pCastSpell->spellnum = 0; |
890 | 3514 continue; |
3515 } | |
3516 if (PID_TYPE(a2) != OBJECT_Actor) | |
3517 { | |
889 | 3518 LODWORD(v727) = 1; |
890 | 3519 break; |
3520 } | |
3521 v697.x = 0; | |
3522 v697.y = 0; | |
3523 v697.z = 0; | |
924 | 3524 pSpellSprite.stru_24.Reset(); |
3525 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3526 pSpellSprite.spell_level = v2; | |
3527 pSpellSprite.spell_skill = v731; | |
3528 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3529 pSpellSprite.uAttributes = 0; | |
3530 pSpellSprite.uSectorID = 0; | |
3531 pSpellSprite.uSpriteFrameID = 0; | |
3532 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3533 pSpellSprite.uFacing = 0; | |
3534 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3535 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3536 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3537 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3538 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3539 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3540 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3541 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3542 LODWORD(v727) = 1; | |
3543 break; | |
924 | 3544 } |
3545 case SPELL_EARTH_MASS_DISTORTION: | |
3546 { | |
890 | 3547 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3548 break; | |
3549 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3550 { | |
3551 LODWORD(v727) = 1; | |
3552 break; | |
3553 } | |
3554 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3555 v704.x = 0; | |
3556 v704.y = 0; | |
3557 v704.z = 0; | |
924 | 3558 pSpellSprite.stru_24.Reset(); |
3559 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3560 pSpellSprite.spell_level = v2; | |
3561 pSpellSprite.spell_skill = v731; | |
3562 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3563 pSpellSprite.uAttributes = 0; | |
3564 pSpellSprite.uSectorID = 0; | |
3565 pSpellSprite.uSpriteFrameID = 0; | |
3566 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3567 pSpellSprite.uFacing = 0; | |
3568 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3569 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3570 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3571 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3572 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3573 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3574 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3575 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3576 LODWORD(v727) = 1; | |
3577 break; | |
924 | 3578 } |
3579 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3580 { | |
890 | 3581 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3582 break; | |
3583 //v730 = a2 >> 3; | |
3584 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3585 v691.x = 0; | |
3586 v691.y = 0; | |
3587 v691.z = 0; | |
924 | 3588 pSpellSprite.stru_24.Reset(); |
3589 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3590 pSpellSprite.spell_level = v2; | |
3591 pSpellSprite.spell_skill = v731; | |
3592 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3593 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3594 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3595 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3596 pSpellSprite.uAttributes = 0; | |
3597 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3598 pSpellSprite.uSpriteFrameID = 0; | |
3599 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3600 pSpellSprite.spell_target_pid = a2; | |
3601 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3602 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3603 pSpellSprite.uAttributes |= 0x80u; | |
3604 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3605 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3606 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3607 { | |
3608 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3609 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3610 pCastSpell->spellnum = 0; |
890 | 3611 continue; |
3612 } | |
3613 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3614 LODWORD(v727) = 1; | |
3615 break; | |
924 | 3616 } |
3617 case SPELL_FIRE_FIRE_BOLT: | |
3618 case SPELL_FIRE_FIREBALL: | |
3619 case SPELL_FIRE_INCINERATE: | |
3620 case SPELL_AIR_LIGHNING_BOLT: | |
3621 case SPELL_WATER_ICE_BOLT: | |
3622 case SPELL_WATER_ICE_BLAST: | |
3623 case SPELL_EARTH_STUN: | |
3624 case SPELL_EARTH_DEADLY_SWARM: | |
3625 case SPELL_MIND_MIND_BLAST: | |
3626 case SPELL_MIND_PSYCHIC_SHOCK: | |
3627 case SPELL_BODY_HARM: | |
3628 case SPELL_LIGHT_LIGHT_BOLT: | |
3629 case SPELL_DARK_DRAGON_BREATH: | |
3630 { | |
889 | 3631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3632 break; |
924 | 3633 pSpellSprite.stru_24.Reset(); |
3634 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3635 pSpellSprite.spell_level = v2; | |
3636 pSpellSprite.spell_skill = v731; | |
3637 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3638 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3639 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3640 pSpellSprite.uAttributes = 0; | |
3641 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3642 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3643 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3644 else | |
3645 pSpellSprite.uSectorID = 0; | |
3646 pSpellSprite.uSpriteFrameID = 0; | |
3647 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3648 pSpellSprite.spell_target_pid = a2; | |
3649 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3650 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3651 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3652 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3653 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3654 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3655 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3656 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3657 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3658 ++pTurnEngine->field_1C; |
3659 LODWORD(v727) = 1; | |
890 | 3660 break; |
924 | 3661 } |
3662 case SPELL_WATER_ACID_BURST: | |
3663 case SPELL_EARTH_BLADES: | |
3664 case SPELL_BODY_FLYING_FIST: | |
3665 case SPELL_DARK_TOXIC_CLOUD: | |
3666 { | |
889 | 3667 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3668 break; |
924 | 3669 pSpellSprite.stru_24.Reset(); |
3670 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3671 pSpellSprite.spell_level = v2; | |
3672 pSpellSprite.spell_skill = v731; | |
3673 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3674 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3675 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3676 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3677 v660 = pParty->vPosition.y; | |
3678 goto LABEL_153; | |
924 | 3679 } |
3680 case SPELL_LIGHT_SUNRAY: | |
3681 { | |
889 | 3682 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
890 | 3683 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3684 { | |
3685 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3686 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3687 pCastSpell->spellnum = 0; |
890 | 3688 continue; |
889 | 3689 } |
3690 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3691 { |
3692 pSpellSprite.stru_24.Reset(); | |
3693 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3694 pSpellSprite.spell_skill = v731; | |
3695 pSpellSprite.spell_level = v2; | |
3696 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3697 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3698 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3699 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3700 v660 = pParty->vPosition.y; | |
3701 goto LABEL_153; | |
3702 } | |
3703 break; | |
3704 } | |
3705 case SPELL_LIGHT_PARALYZE: | |
3706 { | |
890 | 3707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3708 break; | |
924 | 3709 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3710 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
890 | 3711 { |
3712 LODWORD(v727) = 1; | |
3713 break; | |
3714 } | |
3715 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3716 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3717 v55 = v721; | |
3718 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3719 *(char *)(v55 + 38) |= 8u; | |
3720 *(short *)(v55 + 148) = 0; | |
3721 v672 = 0; | |
3722 *(short *)(v55 + 150) = 0; | |
3723 v661 = (Actor *)v55; | |
3724 goto LABEL_165; | |
924 | 3725 } |
3726 case SPELL_EARTH_SLOW: | |
3727 { | |
889 | 3728 if ( v731 == 2 ) |
3729 { | |
890 | 3730 v57 = 300 * v2; |
889 | 3731 } |
3732 else | |
3733 { | |
890 | 3734 if ( v731 == 3 ) |
3735 { | |
889 | 3736 amount = 4; |
3737 v57 = 300 * v2; | |
3738 goto LABEL_174; | |
890 | 3739 } |
3740 if ( v731 == 4 ) | |
3741 { | |
889 | 3742 v57 = 300 * v2; |
3743 amount = 8; | |
3744 goto LABEL_174; | |
890 | 3745 } |
3746 v57 = 180 * v2; | |
889 | 3747 } |
3748 amount = 2; | |
3749 LABEL_174: | |
3750 LODWORD(v733) = v57; | |
3751 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3752 break; |
889 | 3753 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3754 || (v721 = 836 * PID_ID(a2), |
3755 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3756 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3757 { | |
3758 LODWORD(v727) = 1; | |
3759 break; | |
889 | 3760 } |
3761 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3762 v59 = v721; | |
3763 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3764 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
890 | 3765 v731, |
3766 amount, | |
3767 0, | |
3768 0); | |
889 | 3769 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3770 v672 = 0; | |
3771 v661 = (Actor *)LODWORD(v718); | |
3772 goto LABEL_165; | |
924 | 3773 } |
3774 case SPELL_MIND_CHARM: | |
3775 { | |
890 | 3776 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3777 break; | |
3778 | |
3779 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3780 { | |
3781 LODWORD(v727) = 1; | |
3782 break; | |
3783 } | |
3784 | |
3785 uint power = 300 * v2; | |
3786 if ( v731 == 2 ) | |
3787 { | |
3788 power = 600 * v2; | |
3789 } | |
3790 else if ( v731 == 3 ) | |
3791 power = 29030400; | |
3792 | |
3793 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3794 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3795 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3796 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3797 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3798 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3799 v731, 0, 0, 0); | |
924 | 3800 pSpellSprite.stru_24.Reset(); |
3801 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3802 pSpellSprite.spell_level = v2; | |
3803 pSpellSprite.spell_skill = v731; | |
3804 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3805 v61 = PID_ID(a2); |
3806 goto LABEL_1086; | |
924 | 3807 } |
3808 case SPELL_DARK_SHRINKING_RAY: | |
3809 { | |
889 | 3810 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3811 break; |
924 | 3812 pSpellSprite.stru_24.Reset(); |
3813 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3814 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3815 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3816 pSpellSprite.uAttributes = 0; | |
3817 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3818 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3819 pParty->vPosition.x, |
3820 pParty->vPosition.y, | |
3821 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3822 pSpellSprite.uSpriteFrameID = 0; |
3823 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3824 pSpellSprite.spell_target_pid = a2; | |
3825 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3826 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3827 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3828 pSpellSprite.spell_skill = v731; | |
3829 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3830 pSpellSprite.spell_level = 300 * v2; | |
890 | 3831 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3832 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3833 | |
3834 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3835 | |
3836 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3837 ++pTurnEngine->field_1C; |
3838 LODWORD(v727) = 1; | |
890 | 3839 break; |
924 | 3840 } |
3841 case SPELL_FIRE_FIRE_AURA: | |
3842 { | |
889 | 3843 v63 = v731 - 1; |
3844 if ( !v63 ) | |
3845 { | |
890 | 3846 amount = 10; |
3847 LODWORD(v733) = 3600 * v2; | |
3848 } | |
3849 else | |
3850 { | |
889 | 3851 v64 = v63 - 1; |
3852 if ( !v64 ) | |
3853 { | |
890 | 3854 amount = 11; |
3855 LODWORD(v733) = 3600 * v2; | |
3856 } | |
3857 else | |
3858 { | |
889 | 3859 v65 = v64 - 1; |
3860 if ( !v65 ) | |
3861 { | |
890 | 3862 amount = 12; |
889 | 3863 LABEL_195: |
890 | 3864 LODWORD(v733) = 3600 * v2; |
3865 } | |
3866 else if ( v65 == 1 ) | |
3867 { | |
3868 LODWORD(v733) = 0; | |
3869 amount = 12; | |
3870 } | |
3871 } | |
889 | 3872 } |
3873 LABEL_196: | |
3874 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3875 break; |
924 | 3876 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3877 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3878 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3879 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3880 && !v730c->Broken() | |
3881 && !v730c->uSpecEnchantmentType | |
3882 && !v730c->uEnchantmentType | |
3883 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3884 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3885 { | |
3886 v69 = v730c; | |
3887 v14 = v731 == 4; | |
3888 v730c->uSpecEnchantmentType = amount; | |
3889 if ( !v14 ) | |
889 | 3890 { |
890 | 3891 v69->uExpireTime = pParty->uTimePlayed |
3892 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3893 * 0.033333335); | |
3894 v69->uAttributes |= 8u; | |
889 | 3895 } |
890 | 3896 v69->uAttributes |= 0x10u; |
3897 dword_50C9A8 = 256; | |
3898 LODWORD(v727) = 1; | |
3899 break; | |
889 | 3900 } |
3901 | |
3902 dword_50C9D0 = 113; | |
3903 dword_50C9D4 = 0; | |
3904 dword_50C9D8 = 1; | |
3905 | |
3906 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3907 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3908 pCastSpell->spellnum = 0; |
890 | 3909 continue; |
924 | 3910 } |
3911 case SPELL_BODY_REGENERATION: | |
3912 { | |
890 | 3913 v70 = v731 - 1; |
3914 LODWORD(v733) = 3600 * v2; | |
3915 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3916 { | |
3917 v72 = v71 - 1; | |
3918 if ( v72 ) | |
3919 { | |
3920 if ( v72 == 1 ) | |
3921 amount = 10; | |
889 | 3922 } |
3923 else | |
3924 { | |
890 | 3925 amount = 3; |
3926 } | |
3927 } | |
3928 else | |
3929 { | |
3930 amount = 1; | |
3931 } | |
3932 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3933 break; | |
3934 | |
924 | 3935 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3936 | |
3937 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 | 3938 LODWORD(v727) = 1; |
3939 break; | |
924 | 3940 } |
3941 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3942 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3943 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3944 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3945 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3946 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3947 { | |
3948 v76 = v731 - 1; | |
3949 LODWORD(v733) = 3600 * v2; | |
3950 if ( v76 ) | |
3951 { | |
3952 v77 = v76 - 1; | |
3953 if ( v77 ) | |
3954 { | |
3955 v78 = v77 - 1; | |
3956 if ( v78 ) | |
3957 { | |
3958 if ( v78 != 1 ) | |
3959 goto LABEL_232; | |
3960 v79 = 4 * v2; | |
3961 } | |
3962 else | |
3963 { | |
3964 v79 = 3 * v2; | |
3965 } | |
3966 } | |
3967 else | |
3968 { | |
3969 v79 = 2 * v2; | |
3970 } | |
3971 amount = v79; | |
3972 } | |
3973 else | |
3974 { | |
3975 amount = v2; | |
3976 } | |
3977 LABEL_232: | |
3978 //v80 = v3->spellnum; | |
3979 switch (pCastSpell->spellnum) | |
3980 { | |
3981 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3982 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3983 break; | |
3984 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3985 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3986 break; | |
3987 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3988 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3989 break; | |
3990 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3991 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3992 break; | |
3993 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3994 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3995 break; | |
3996 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3997 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3998 break; | |
3999 default: | |
4000 assert(false); | |
4001 continue; | |
4002 } | |
4003 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4004 break; | |
4005 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4007 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4008 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4009 v90 = (double)(signed int)v733 * 4.2666669; | |
4010 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4011 LODWORD(v727) = 1; | |
4012 break; | |
4013 } | |
4014 case SPELL_FIRE_HASTE: | |
4015 { | |
889 | 4016 if ( v731 <= 0 ) |
890 | 4017 goto LABEL_254; |
889 | 4018 if ( v731 <= 2 ) |
4019 { | |
890 | 4020 v91 = 60 * (v2 + 60); |
889 | 4021 } |
4022 else | |
4023 { | |
890 | 4024 if ( v731 == 3 ) |
4025 { | |
889 | 4026 v91 = 180 * (v2 + 20); |
890 | 4027 } |
4028 else | |
4029 { | |
889 | 4030 if ( v731 != 4 ) |
890 | 4031 goto LABEL_254; |
889 | 4032 v91 = 240 * (v2 + 15); |
890 | 4033 } |
889 | 4034 } |
4035 LODWORD(v733) = v91; | |
4036 LABEL_254: | |
4037 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4038 { | |
890 | 4039 v92 = pParty->pPlayers;//[0].pConditions[1]; |
4040 LODWORD(v727) = 1; | |
4041 do | |
4042 { | |
889 | 4043 if ( v92->pConditions ) |
890 | 4044 LODWORD(v727) = 0; |
889 | 4045 ++v92; |
890 | 4046 } |
4047 while ( v92 <= &pParty->pPlayers[3] ); | |
4048 if (LODWORD(v727)) | |
4049 { | |
889 | 4050 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4051 | |
924 | 4052 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4053 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4054 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4055 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4056 } |
4057 } | |
4058 break; | |
924 | 4059 } |
4060 case SPELL_SPIRIT_BLESS: | |
4061 { | |
889 | 4062 v101 = v731 - 1; |
4063 if ( v101 && (v102 = v101 - 1) != 0 ) | |
4064 { | |
890 | 4065 v103 = v102 - 1; |
4066 if ( v103 ) | |
4067 { | |
889 | 4068 if ( v103 != 1 ) |
890 | 4069 goto LABEL_269; |
889 | 4070 v104 = 3600 * (v2 + 1); |
890 | 4071 } |
4072 else | |
4073 { | |
889 | 4074 v104 = 900 * (v2 + 4); |
890 | 4075 } |
889 | 4076 } |
4077 else | |
4078 { | |
890 | 4079 v104 = 300 * (v2 + 12); |
889 | 4080 } |
4081 LODWORD(v733) = v104; | |
4082 LABEL_269: | |
4083 amount = v2 + 5; | |
4084 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4085 break; |
889 | 4086 if ( v731 == 1 ) |
4087 { | |
924 | 4088 v108 = pCastSpell->uPlayerID_2; |
4089 v109 = pCastSpell->spellnum; | |
890 | 4090 v110 = pGame->GetStru6(); |
4091 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 4092 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 4093 //v668 = 0; |
4094 v716 = v111; | |
4095 //v658 = v111; | |
4096 //v653 = amount; | |
4097 //v651 = 1; | |
4098 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4099 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
889 | 4100 //LABEL_103: |
4101 //HIDWORD(v650) = HIDWORD(v28); | |
4102 //LABEL_104: | |
4103 //LODWORD(v650) = v28; | |
924 | 4104 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 | 4105 LODWORD(v727) = 1; |
890 | 4106 break; |
889 | 4107 } |
4108 v105 = 0; | |
4109 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4110 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4111 do | |
4112 { | |
924 | 4113 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 4114 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4115 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4116 ++v730b; | |
4117 ++v105; | |
889 | 4118 } |
4119 while ( v730b <= &pParty->pPlayers[3] ); | |
4120 LODWORD(v727) = 1; | |
890 | 4121 break; |
4122 } | |
4123 case SPELL_SPIRIT_SPIRIT_LASH: | |
4124 { | |
889 | 4125 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4126 { | |
890 | 4127 //v730 = a2 >> 3; |
4128 v112 = &pActors[PID_ID(a2)]; | |
4129 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4130 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4131 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4132 _this = (ItemGen *)v113; | |
4133 v114 = v721; | |
4134 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4135 if ( v113 < v721 ) | |
4136 { | |
889 | 4137 v116 = v113; |
4138 v113 = v721; | |
4139 v114 = v116; | |
890 | 4140 } |
4141 if ( v113 < (signed int)v115 ) | |
4142 { | |
889 | 4143 v117 = v113; |
4144 v113 = (int)v115; | |
4145 v115 = v117; | |
890 | 4146 } |
4147 if ( v114 < (signed int)v115 ) | |
4148 { | |
889 | 4149 v118 = v115; |
4150 v115 = v114; | |
4151 v114 = v118; | |
890 | 4152 } |
4153 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4154 if ( (double)(signed int)this <= 307.2 ) | |
4155 { | |
889 | 4156 v701.x = 0; |
4157 v701.y = 0; | |
4158 v701.z = 0; | |
924 | 4159 pSpellSprite.stru_24.Reset(); |
889 | 4160 v119 = HIDWORD(v733); |
924 | 4161 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4162 pSpellSprite.spell_level = v723; | |
4163 pSpellSprite.spell_skill = v731; | |
4164 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4165 pSpellSprite.uAttributes = 0; | |
4166 pSpellSprite.uSectorID = 0; | |
4167 pSpellSprite.uSpriteFrameID = 0; | |
4168 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4169 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4170 pSpellSprite.uFacing = 0; | |
4171 pSpellSprite.uSoundID = *(short *)(v119 + 16); | |
4172 pSpellSprite.vPosition.x = v112->vPosition.x; | |
4173 pSpellSprite.vPosition.y = v112->vPosition.y; | |
4174 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4175 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
4176 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
889 | 4177 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4178 LODWORD(v727) = 1; | |
890 | 4179 } |
4180 else | |
4181 { | |
889 | 4182 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4183 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4184 *(int *)HIDWORD(v733) = 0; | |
890 | 4185 } |
924 | 4186 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 4187 } |
4188 break; | |
4189 } | |
4190 case SPELL_AIR_SHIELD: | |
4191 case SPELL_EARTH_STONESKIN: | |
4192 case SPELL_SPIRIT_HEROISM: | |
4193 { | |
889 | 4194 v123 = v731 - 1; |
4195 if ( v123 && (v124 = v123 - 1) != 0 ) | |
4196 { | |
890 | 4197 v125 = v124 - 1; |
4198 if ( v125 ) | |
4199 { | |
889 | 4200 if ( v125 != 1 ) |
890 | 4201 goto LABEL_296; |
889 | 4202 v126 = 3600 * (v2 + 1); |
890 | 4203 } |
4204 else | |
4205 { | |
889 | 4206 v126 = 900 * (v2 + 4); |
890 | 4207 } |
889 | 4208 } |
4209 else | |
4210 { | |
890 | 4211 v126 = 300 * (v2 + 12); |
889 | 4212 } |
4213 LODWORD(v733) = v126; | |
4214 LABEL_296: | |
924 | 4215 v127 = pCastSpell->spellnum; |
889 | 4216 if ( v127 == 17 ) |
4217 { | |
890 | 4218 amount = 0; |
4219 LODWORD(v725) = 14; | |
889 | 4220 } |
4221 else | |
4222 { | |
890 | 4223 if ( v127 == 38 ) |
4224 { | |
889 | 4225 LODWORD(v725) = 15; |
4226 amount = v2 + 5; | |
890 | 4227 } |
4228 else | |
4229 { | |
889 | 4230 if ( v127 != 51 ) |
890 | 4231 continue; |
889 | 4232 LODWORD(v725) = 9; |
4233 amount = v2 + 5; | |
890 | 4234 } |
889 | 4235 } |
4236 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4237 break; |
924 | 4238 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4239 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4240 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4241 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4242 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4243 //LABEL_304: | |
4244 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4245 LODWORD(v727) = 1; | |
890 | 4246 break; |
4247 } | |
4248 case SPELL_FIRE_IMMOLATION: | |
4249 { | |
889 | 4250 v138 = v731 - 2; |
4251 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) | |
890 | 4252 v140 = 600 * v2; |
889 | 4253 else |
890 | 4254 v140 = 60 * v2; |
889 | 4255 LODWORD(v733) = v140; |
4256 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4257 break; |
889 | 4258 |
924 | 4259 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4260 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4261 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4262 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4263 |
4264 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4265 LODWORD(v727) = 1; | |
890 | 4266 break; |
4267 } | |
4268 case SPELL_FIRE_METEOR_SHOWER: | |
4269 { | |
889 | 4270 v149 = v731 - 1; |
4271 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4272 { | |
890 | 4273 if ( v151 == 1 ) |
889 | 4274 _this = (ItemGen *)20; |
4275 } | |
4276 else | |
4277 { | |
890 | 4278 _this = (ItemGen *)16; |
889 | 4279 } |
4280 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4281 { | |
890 | 4282 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4283 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4284 pCastSpell->spellnum = 0; |
890 | 4285 continue; |
889 | 4286 } |
4287 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4288 break; |
889 | 4289 LODWORD(v725) = PID_TYPE(a2); |
4290 if (PID_TYPE(a2) == OBJECT_Actor) | |
4291 { | |
890 | 4292 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
4293 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4294 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4295 LODWORD(v727) = v153; | |
889 | 4296 } |
4297 else | |
4298 { | |
890 | 4299 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
4300 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4301 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4302 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4303 v154 = pParty->vPosition.z; | |
889 | 4304 } |
4305 HIDWORD(v733) = v154; | |
4306 v713 = v154 + 2500; | |
4307 v721 = 0; | |
4308 LODWORD(v718) = 0; | |
4309 if ( (signed int)_this > 0 ) | |
4310 { | |
890 | 4311 *(float *)&y = (double)SHIDWORD(v733); |
4312 *(float *)&v732 = (double)v713; | |
4313 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4314 auto _this_cpy = (int)_this; | |
4315 do | |
4316 { | |
924 | 4317 //v157 = rand(); |
889 | 4318 v158 = (double)SLODWORD(v718); |
4319 v718 = v158; | |
4320 v159 = (double)v721; | |
4321 *(float *)&v721 = v159; | |
924 | 4322 a2 = rand() % 1000; |
4323 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; | |
889 | 4324 v725 = v159 * v159; |
4325 *(float *)&_this = v158 * v158; | |
4326 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4327 { | |
890 | 4328 LODWORD(v687) = 0; |
4329 HIDWORD(v687) = 0; | |
889 | 4330 } |
4331 else | |
4332 { | |
890 | 4333 x = (signed __int64)sqrt(*(float *)&_this + v725); |
4334 v687 = __PAIR__( | |
4335 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4336 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
889 | 4337 } |
924 | 4338 pSpellSprite.stru_24.Reset(); |
4339 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4340 pSpellSprite.spell_level = v2; | |
4341 pSpellSprite.spell_skill = v731; | |
4342 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4343 pSpellSprite.uAttributes = 0; | |
4344 pSpellSprite.vPosition.x = uRequiredMana; | |
4345 pSpellSprite.vPosition.y = LODWORD(v727); | |
4346 pSpellSprite.uSectorID = 0; | |
4347 pSpellSprite.vPosition.z = a2 + v713; | |
4348 pSpellSprite.uSpriteFrameID = 0; | |
4349 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4350 pSpellSprite.spell_target_pid = v730; | |
4351 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4352 pSpellSprite.uFacing = v687; | |
4353 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 4354 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4355 pSpellSprite.uAttributes = 4; |
4356 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
890 | 4357 && pParty->bTurnBasedModeOn == 1 ) |
4358 ++pTurnEngine->field_1C; | |
889 | 4359 LODWORD(v718) = rand() % 1024 - 512; |
924 | 4360 //v160 = rand(); |
889 | 4361 v14 = _this_cpy-- == 1; |
924 | 4362 v721 = (unsigned __int64)(rand() % 1024) - 512; |
890 | 4363 } |
4364 while ( !v14 ); | |
889 | 4365 } |
4366 LODWORD(v727) = 1; | |
890 | 4367 break; |
4368 } | |
4369 case SPELL_FIRE_INFERNO: | |
4370 { | |
4371 //v67 = 2; | |
4372 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4373 { | |
4374 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4375 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4376 pCastSpell->spellnum = 0; |
890 | 4377 continue; |
4378 } | |
4379 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4380 break; | |
4381 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4382 v700.z = 0; | |
4383 v700.y = 0; | |
4384 v700.x = 0; | |
924 | 4385 pSpellSprite.stru_24.Reset(); |
4386 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4387 pSpellSprite.spell_level = v2; | |
4388 pSpellSprite.spell_skill = v731; | |
4389 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4390 pSpellSprite.uAttributes = 0; | |
4391 pSpellSprite.uSectorID = 0; | |
4392 pSpellSprite.uSpriteFrameID = 0; | |
4393 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4394 pSpellSprite.uFacing = 0; | |
4395 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4396 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4397 a2 = 0; |
4398 if ( (signed int)_v726 > 0 ) | |
4399 { | |
4400 do | |
4401 { | |
4402 v162 = dword_50BF30[a2]; | |
924 | 4403 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4404 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
4405 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4406 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4407 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 4408 v165 = a2; |
4409 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
924 | 4410 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
890 | 4411 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4412 a2 = v165 + 1; | |
4413 } | |
4414 while ( v165 + 1 < (signed int)_v726 ); | |
4415 } | |
4416 LODWORD(v727) = 1; | |
4417 break; | |
4418 } | |
4419 | |
4420 case SPELL_AIR_WIZARD_EYE: | |
4421 { | |
889 | 4422 LODWORD(v733) = 3600 * v2; |
4423 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4424 break; |
889 | 4425 v168 = 0; |
4426 do | |
4427 { | |
890 | 4428 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
4429 v716 = v169; | |
889 | 4430 } |
4431 while ( v168 < 4 ); | |
4432 | |
4433 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4434 LODWORD(v727) = 1; | |
890 | 4435 break; |
4436 } | |
4437 case SPELL_AIR_FEATHER_FALL: | |
4438 { | |
889 | 4439 v170 = v731 - 1; |
4440 if ( !v170 ) | |
4441 { | |
890 | 4442 v173 = 300 * v2; |
4443 goto LABEL_353; | |
889 | 4444 } |
4445 v171 = v170 - 1; | |
4446 if ( !v171 ) | |
4447 { | |
890 | 4448 v173 = 600 * v2; |
4449 goto LABEL_353; | |
889 | 4450 } |
4451 v172 = v171 - 1; | |
4452 if ( !v172 || v172 == 1 ) | |
4453 { | |
890 | 4454 v173 = 3600 * v2; |
889 | 4455 LABEL_353: |
890 | 4456 LODWORD(v733) = v173; |
889 | 4457 } |
4458 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4459 break; |
889 | 4460 v174 = 0; |
4461 do | |
890 | 4462 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 4463 while ( v174 < 4 ); |
924 | 4464 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4465 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4466 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4467 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4468 |
4469 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); | |
4470 LODWORD(v727) = 1; | |
890 | 4471 break; |
4472 } | |
4473 case SPELL_AIR_SPARKS: | |
4474 { | |
4475 v184 = v731 - 1; | |
4476 if ( v184 ) | |
4477 { | |
4478 v185 = v184 - 1; | |
4479 if ( v185 ) | |
4480 { | |
4481 v186 = v185 - 1; | |
4482 if ( v186 ) | |
4483 { | |
4484 if ( v186 == 1 ) | |
4485 amount = 9; | |
4486 } | |
4487 else | |
4488 { | |
4489 amount = 7; | |
4490 } | |
889 | 4491 } |
4492 else | |
4493 { | |
890 | 4494 amount = 5; |
4495 } | |
4496 } | |
4497 else | |
4498 { | |
4499 amount = 3; | |
4500 } | |
4501 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4502 break; | |
4503 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
924 | 4504 pSpellSprite.stru_24.Reset(); |
4505 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4506 pSpellSprite.spell_level = v2; | |
4507 pSpellSprite.spell_skill = v731; | |
4508 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4509 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4510 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4511 pSpellSprite.uAttributes = 0; | |
4512 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4513 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 4514 pParty->vPosition.x, |
4515 pParty->vPosition.y, | |
4516 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 4517 pSpellSprite.uSpriteFrameID = 0; |
4518 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4519 pSpellSprite.spell_target_pid = a2; | |
4520 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4521 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4522 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4523 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4524 v188 = (signed int)_v726 / -2; |
4525 v189 = (signed int)_v726 / 2; | |
4526 while ( v188 <= v189 ) | |
4527 { | |
924 | 4528 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4529 if ( pSpellSprite.Create( | |
890 | 4530 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4531 v715.uPitchAngle, | |
924 | 4532 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4533 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4534 && pParty->bTurnBasedModeOn == 1 ) |
4535 ++pTurnEngine->field_1C; | |
4536 v188 += _v726 / (amount - 1); | |
4537 } | |
4538 LODWORD(v727) = 1; | |
4539 break; | |
4540 } | |
4541 | |
4542 case SPELL_AIR_JUMP: | |
4543 { | |
4544 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4545 { | |
4546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4547 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4548 break; | |
889 | 4549 } |
4550 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4551 break; |
889 | 4552 v191 = 0; |
4553 do | |
890 | 4554 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 4555 while ( v191 < 4 ); |
4556 BYTE1(pParty->uFlags) |= 1u; | |
4557 pParty->uFallSpeed = 1000; | |
4558 LODWORD(v727) = 1; | |
890 | 4559 break; |
4560 } | |
4561 case SPELL_AIR_INVISIBILITY: | |
4562 { | |
889 | 4563 v192 = v731 - 1; |
4564 if ( !v192 ) | |
4565 { | |
890 | 4566 amount = v2; |
924 | 4567 //goto LABEL_391; |
4568 v195 = 600 * v2; | |
4569 goto LABEL_392; | |
889 | 4570 } |
4571 v193 = v192 - 1; | |
4572 if ( !v193 ) | |
4573 { | |
890 | 4574 v196 = 2 * v2; |
924 | 4575 //LABEL_389: |
890 | 4576 amount = v196; |
924 | 4577 //LABEL_391: |
890 | 4578 v195 = 600 * v2; |
4579 goto LABEL_392; | |
889 | 4580 } |
4581 v194 = v193 - 1; | |
4582 if ( !v194 ) | |
4583 { | |
890 | 4584 v196 = 3 * v2; |
924 | 4585 //goto LABEL_389; |
4586 amount = v196; | |
4587 v195 = 600 * v2; | |
4588 goto LABEL_392; | |
889 | 4589 } |
4590 if ( v194 != 1 ) | |
890 | 4591 goto LABEL_393; |
889 | 4592 amount = 4 * v2; |
4593 v195 = 3600 * v2; | |
4594 LABEL_392: | |
4595 LODWORD(v733) = v195; | |
4596 LABEL_393: | |
4597 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
4598 { | |
890 | 4599 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4600 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4601 pCastSpell->spellnum = 0; |
890 | 4602 continue; |
889 | 4603 } |
4604 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4605 { | |
924 | 4606 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4607 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4608 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4609 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4610 |
4611 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4612 LODWORD(v727) = 1; | |
4613 } | |
4614 break; | |
4615 } | |
4616 case SPELL_AIR_FLY: | |
4617 { | |
4618 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4619 { | |
4620 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4621 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4622 break; | |
4623 } | |
924 | 4624 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4625 { |
4626 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4627 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4628 break; | |
4629 } | |
4630 LODWORD(v733) = 3600 * v2; | |
4631 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4632 amount = 1; | |
4633 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4634 break; | |
4635 v205 = 0; | |
4636 do | |
4637 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4638 while ( v205 < 4 ); | |
4639 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
924 | 4640 v207 = pCastSpell->uPlayerID + 1; |
890 | 4641 v716 = v206; |
4642 | |
4643 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4644 LODWORD(v727) = 1; | |
4645 break; | |
4646 } | |
4647 | |
4648 case SPELL_AIR_STARBURST: | |
4649 { | |
4650 //v67 = 2; | |
4651 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4652 { | |
4653 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4654 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4655 pCastSpell->spellnum = 0; |
890 | 4656 continue; |
4657 } | |
4658 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4659 break; | |
4660 v208 = PID_TYPE(a2); | |
4661 LODWORD(v725) = PID_TYPE(a2); | |
4662 if ( v208 == 3 ) | |
4663 { | |
4664 v209 = PID_ID(a2); | |
4665 LODWORD(v718) = pActors[v209].vPosition.x; | |
4666 v210 = pActors[v209].vPosition.y; | |
4667 v211 = pActors[v209].vPosition.z; | |
4668 v713 = v210; | |
4669 } | |
4670 else | |
4671 { | |
4672 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4673 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4674 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4675 v214 = sub_42EBBE(2048, v213); | |
4676 v211 = pParty->vPosition.z; | |
4677 v713 = pParty->vPosition.y + v214; | |
4678 v208 = LODWORD(v725); | |
4679 } | |
4680 HIDWORD(v733) = 0; | |
4681 *(float *)&v732 = (double)v211; | |
4682 LODWORD(v725) = v211 + 2500; | |
4683 v721 = 0; | |
4684 *(float *)&y = (double)(v211 + 2500); | |
4685 v730 = v208 == 3 ? a2 : 0; | |
4686 a2 = 20; | |
4687 do | |
4688 { | |
4689 v215 = rand(); | |
4690 v216 = (double)v721; | |
4691 v217 = (double)SHIDWORD(v733); | |
4692 *(float *)&uRequiredMana = v217; | |
4693 _this = (ItemGen *)(v215 % 1000); | |
4694 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4695 *(float *)&v721 = v217 * v217; | |
4696 //*(float *)&v726 = v216 * v216; | |
4697 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4698 { | |
4699 LODWORD(v685) = 0; | |
4700 HIDWORD(v685) = 0; | |
889 | 4701 } |
4702 else | |
4703 { | |
890 | 4704 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4705 v685 = __PAIR__( | |
4706 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4707 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4708 } | |
924 | 4709 pSpellSprite.stru_24.Reset(); |
4710 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4711 pSpellSprite.spell_level = v2; | |
4712 pSpellSprite.spell_skill = v731; | |
4713 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4714 pSpellSprite.uAttributes = 0; | |
4715 pSpellSprite.vPosition.x = LODWORD(v718); | |
4716 pSpellSprite.vPosition.y = v713; | |
4717 pSpellSprite.uSectorID = 0; | |
4718 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4719 pSpellSprite.uSpriteFrameID = 0; | |
4720 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4721 pSpellSprite.spell_target_pid = v730; | |
921 | 4722 //__debugbreak();//çâåçäîïàä |
924 | 4723 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4724 pSpellSprite.uFacing = v685; | |
4725 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4726 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4727 pSpellSprite.uAttributes = 4; |
4728 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4729 && pParty->bTurnBasedModeOn == 1 ) | |
4730 ++pTurnEngine->field_1C; | |
890 | 4731 v721 = rand() % 1024 - 512; |
4732 v218 = rand(); | |
4733 v14 = a2-- == 1; | |
4734 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4735 } | |
4736 while ( !v14 ); | |
4737 LODWORD(v727) = 1; | |
4738 break; | |
4739 } | |
4740 | |
4741 case SPELL_WATER_AWAKEN: | |
4742 { | |
4743 v219 = v731 - 2; | |
4744 if ( v219 ) | |
4745 { | |
4746 v220 = v219 - 1; | |
4747 if ( v220 ) | |
4748 { | |
4749 if ( v220 == 1 ) | |
4750 { | |
4751 amount = 0; | |
4752 goto LABEL_433; | |
4753 } | |
4754 v221 = 180 * v2; | |
4755 } | |
4756 else | |
4757 { | |
4758 v221 = 86400 * v2; | |
4759 } | |
889 | 4760 } |
4761 else | |
4762 { | |
890 | 4763 v221 = 3600 * v2; |
4764 } | |
4765 amount = v221; | |
4766 LABEL_433: | |
889 | 4767 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4768 break; |
4769 v222 = pParty->pPlayers; | |
4770 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4771 while ( 2 ) | |
4772 { | |
4773 if ( v731 == 4 ) | |
4774 { | |
4775 if ( v222->pConditions[2] ) | |
4776 { | |
4777 //*((int *)v222 + 4) = 0; | |
4778 //*((int *)v222 + 5) = 0; | |
4779 v222->pConditions[2] = 0; | |
4780 v222->PlaySound(SPEECH_103, 0); | |
4781 } | |
4782 } | |
4783 else | |
889 | 4784 { |
890 | 4785 v223 = v222->DiscardConditionIfLastsLongerThan( |
4786 2u, | |
4787 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4788 v222 = (Player *)HIDWORD(v733); | |
4789 if ( v223 ) | |
4790 v222->PlaySound(SPEECH_103, 0); | |
4791 } | |
4792 ++v222;// += 6972; | |
4793 HIDWORD(v733) = (int)v222; | |
4794 if ( v222 >= &pParty->pPlayers[3] ) | |
4795 { | |
4796 LODWORD(v727) = 1; | |
4797 break; | |
4798 } | |
4799 } | |
4800 } | |
4801 case SPELL_WATER_POISON_SPRAY: | |
4802 { | |
4803 v224 = v731 - 2; | |
4804 if ( v224 ) | |
4805 { | |
4806 v225 = v224 - 1; | |
4807 if ( v225 ) | |
4808 { | |
4809 if ( v225 == 1 ) | |
4810 amount = 7; | |
4811 else | |
4812 amount = 1; | |
4813 } | |
4814 else | |
4815 { | |
4816 amount = 5; | |
889 | 4817 } |
890 | 4818 } |
4819 else | |
4820 { | |
4821 amount = 3; | |
4822 } | |
889 | 4823 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4824 break; |
4825 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4826 if ( amount == 1 ) | |
4827 { | |
924 | 4828 pSpellSprite.stru_24.Reset(); |
4829 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4830 pSpellSprite.spell_skill = v731; | |
4831 pSpellSprite.spell_level = v2; | |
4832 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4833 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4834 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4835 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4836 v660 = pParty->vPosition.y; | |
4837 LABEL_153: | |
924 | 4838 pSpellSprite.uAttributes = 0; |
4839 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4840 pSpellSprite.vPosition.z = v51; | |
890 | 4841 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4842 pSpellSprite.uSpriteFrameID = 0; |
4843 pSpellSprite.uSectorID = v52; | |
4844 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4845 pSpellSprite.spell_target_pid = a2; | |
4846 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4847 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4848 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4849 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4850 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4851 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4852 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4853 ++pTurnEngine->field_1C; | |
890 | 4854 } |
4855 else | |
4856 { | |
924 | 4857 pSpellSprite.stru_24.Reset(); |
4858 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4859 pSpellSprite.spell_level = v2; | |
4860 pSpellSprite.spell_skill = v731; | |
4861 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4862 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4863 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4864 pSpellSprite.uAttributes = 0; | |
4865 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4866 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4867 pSpellSprite.uSpriteFrameID = 0; | |
4868 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4869 pSpellSprite.spell_target_pid = a2; | |
4870 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4871 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4872 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4873 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4874 v227 = SHIDWORD(v733) / -2; |
4875 y = (char *)(SHIDWORD(v733) / 2); | |
4876 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4877 { | |
4878 v228 = v715.uYawAngle; | |
4879 do | |
4880 { | |
924 | 4881 pSpellSprite.uFacing = v227 + v228; |
4882 if ( pSpellSprite.Create( | |
890 | 4883 v227 + v228, |
4884 v715.uPitchAngle, | |
924 | 4885 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4886 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4887 && pParty->bTurnBasedModeOn == 1 ) |
4888 ++pTurnEngine->field_1C; | |
4889 v227 += SHIDWORD(v733) / (amount - 1); | |
4890 } | |
4891 while ( v227 <= (signed int)y ); | |
4892 } | |
889 | 4893 } |
4894 LODWORD(v727) = 1; | |
890 | 4895 break; |
4896 } | |
4897 case SPELL_WATER_WATER_WALK: | |
4898 { | |
924 | 4899 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4900 { |
4901 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4902 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4903 break; | |
4904 } | |
4905 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4906 v229 = 600 * v2; | |
4907 else | |
4908 v229 = 3600 * v2; | |
4909 LODWORD(v733) = v229; | |
4910 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4911 break; | |
4912 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
924 | 4913 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4915 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4916 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4917 |
4918 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4919 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4920 v731, | |
4921 amount, | |
4922 v716, | |
924 | 4923 pCastSpell->uPlayerID + 1); |
890 | 4924 if ( v731 == 4 ) |
4925 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4926 LODWORD(v727) = 1; | |
4927 break; | |
4928 } | |
4929 case SPELL_WATER_RECHARGE_ITEM: | |
4930 { | |
4931 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4932 break; | |
924 | 4933 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
890 | 4934 y = v240; |
4935 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4936 { | |
4937 dword_50C9D0 = 113; | |
4938 dword_50C9D4 = 0; | |
4939 dword_50C9D8 = 1; | |
4940 | |
4941 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4942 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4943 pCastSpell->spellnum = 0; |
890 | 4944 continue; |
4945 } | |
4946 if ( v731 == 1 || v731 == 2 ) | |
4947 { | |
4948 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4949 } | |
4950 else | |
4951 { | |
4952 if ( v731 == 3 ) | |
4953 { | |
4954 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
889 | 4955 } |
4956 else | |
4957 { | |
890 | 4958 if ( v731 != 4 ) |
4959 { | |
4960 v241 = 0.0; | |
4961 goto LABEL_484; | |
4962 } | |
4963 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4964 } | |
4965 } | |
4966 if ( v241 > 1.0 ) | |
4967 v241 = 1.0; | |
4968 LABEL_484: | |
4969 v732 = (unsigned __int8)v240[25]; | |
4970 v242 = (signed __int64)((double)v732 * v241); | |
4971 v243 = y; | |
4972 y[25] = v242; | |
4973 *((int *)v243 + 4) = (unsigned __int8)v242; | |
4974 if ( (unsigned __int8)v242 <= 0 ) | |
4975 { | |
4976 *(int *)v243 = 0; | |
4977 dword_50C9D0 = 113; | |
4978 dword_50C9D4 = 0; | |
4979 dword_50C9D8 = 1; | |
4980 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4981 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4982 pCastSpell->spellnum = 0; |
890 | 4983 v2 = v723; |
4984 continue; | |
4985 } | |
4986 *((int *)v243 + 5) |= 0x40u; | |
4987 dword_50C9A8 = 256; | |
4988 LODWORD(v727) = 1; | |
4989 break; | |
4990 } | |
4991 case SPELL_WATER_ENCHANT_ITEM: | |
4992 { | |
4993 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4994 break; | |
4995 uRequiredMana = 0; | |
4996 HIDWORD(v733) = 10 * v2; | |
4997 v730 = 1; | |
924 | 4998 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 4999 if ( v731 == 1 ) |
5000 { | |
5001 v245 = (int)&v244[36 * a2 + 532]; | |
5002 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5003 v311 = __OFSUB__(*(int *)v245, 134); | |
5004 v14 = *(int *)v245 == 134; | |
5005 v310 = *(int *)v245 - 134 < 0; | |
5006 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5007 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5008 { | |
5009 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
5010 { | |
5011 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
5012 { | |
5013 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
889 | 5014 { |
890 | 5015 v312 = v309[28]; |
5016 if ( v312 ) | |
5017 { | |
5018 if ( v312 != 1 ) | |
5019 { | |
5020 if ( v312 != 2 ) | |
5021 { | |
5022 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5023 if ( !(v244[36 * a2 + 552] & 2) ) | |
5024 { | |
5025 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5026 { | |
5027 uRequiredMana = 1; | |
5028 v730 = 0; | |
5029 } | |
5030 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5031 uRequiredMana = 1; | |
5032 if (!uRequiredMana) | |
5033 { | |
5034 v313 = *(char *)(LODWORD(v725) + 28); | |
5035 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5036 { | |
5037 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5038 *(int *)(v245 + 4) = 0; | |
5039 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5040 + 1]; | |
5041 ; | |
5042 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5043 + 1] ) | |
5044 { | |
5045 ++*(int *)(v245 + 4); | |
5046 if ( j >= v314 ) | |
5047 break; | |
5048 } | |
5049 v254 = rand(); | |
5050 v255 = 10;//pItemsTable->field_116D8[17]; | |
5051 v256 = 10;//pItemsTable->field_116D8[16]; | |
5052 LABEL_611: | |
5053 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5054 LABEL_612: | |
5055 _this->uItemID |= 0x20u; | |
5056 | |
5057 dword_50C9A8 = 256; | |
5058 LODWORD(v727) = 1; | |
5059 break; | |
5060 } | |
924 | 5061 goto LABEL_616; |
890 | 5062 } |
5063 LABEL_613: | |
5064 v316 = _this->uItemID; | |
5065 if ( !(BYTE1(v316) & 2) ) | |
5066 { | |
5067 LOBYTE(v316) = v316 | 2; | |
5068 _this->uItemID = v316; | |
5069 } | |
5070 } | |
5071 } | |
5072 } | |
5073 } | |
5074 } | |
889 | 5075 } |
890 | 5076 } |
5077 } | |
5078 LABEL_616: | |
5079 if ( LODWORD(v727) == 0 ) | |
5080 { | |
5081 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5082 if ( v730 == 0 ) | |
5083 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5084 ShowStatusBarString(v317, 2u); | |
5085 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5086 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5087 pCastSpell->spellnum = 0; | |
890 | 5088 v318->PlaySound(SPEECH_43, 0); |
5089 } | |
5090 break; | |
5091 } | |
5092 if ( v731 != 2 ) | |
5093 { | |
5094 if ( v731 == 3 ) | |
5095 { | |
5096 v245 = (int)&v244[36 * a2 + 532]; | |
5097 v269 = *(int *)v245; | |
5098 if ( *(int *)v245 > 134 | |
5099 || *(int *)(v245 + 12) != 0 | |
5100 || *(int *)(v245 + 4) != 0 | |
5101 || *(int *)(v245 + 8) != 0 | |
5102 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
5103 goto LABEL_616; | |
5104 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5105 LODWORD(v725) = (int)v270; | |
5106 v271 = v270[28]; | |
5107 if ( v271 && v271 != 1 && v271 != 2 ) | |
5108 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5109 else | |
5110 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5111 if ( v272 ) | |
5112 { | |
5113 uRequiredMana = 1; | |
5114 v730 = 0; | |
5115 } | |
5116 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5117 uRequiredMana = 1; | |
5118 if (uRequiredMana) | |
5119 goto LABEL_613; | |
5120 v273 = v725; | |
5121 v274 = *(char *)(LODWORD(v725) + 28); | |
5122 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 ) | |
5123 { | |
5124 if ( rand() % 100 < 80 | |
5125 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5126 { | |
5127 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5128 *(int *)(v245 + 4) = 0; | |
5129 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5130 ; | |
5131 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5132 + 1] ) | |
5133 { | |
5134 ++*(int *)(v245 + 4); | |
5135 if ( k >= v275 ) | |
5136 break; | |
5137 } | |
5138 v254 = rand(); | |
5139 v255 = 10;//pItemsTable->field_116D8[19]; | |
5140 v256 = 10;//pItemsTable->field_116D8[18]; | |
5141 goto LABEL_611; | |
5142 } | |
5143 v277 = pItemsTable->pSpecialEnchantments_count; | |
5144 v278 = 0; | |
5145 v725 = 0.0; | |
5146 HIDWORD(v733) = 0; | |
5147 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5148 { | |
5149 v730 = (int)&v679; | |
5150 do | |
5151 { | |
5152 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5153 if ( !v279 || v279 == 1 ) | |
5154 { | |
5155 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5156 + 4] | |
5157 + v278 * 28); | |
5158 LODWORD(v725) += v280; | |
5159 if ( v280 ) | |
5160 { | |
5161 v281 = v730; | |
5162 v730 += 4; | |
5163 *(int *)v281 = HIDWORD(v733); | |
5164 } | |
5165 } | |
5166 ++HIDWORD(v733); | |
5167 ++v278; | |
5168 } | |
5169 while ( SHIDWORD(v733) < v277 ); | |
5170 } | |
5171 v282 = rand() % SLODWORD(v725); | |
5172 v283 = v679; | |
5173 *(int *)(v245 + 12) = v679; | |
5174 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5175 v285 = v282 + 1; | |
5176 if ( v284 < v285 ) | |
5177 { | |
5178 for ( l = &v679; ; l = (int *)v732 ) | |
5179 { | |
5180 v287 = (int)(l + 1); | |
5181 v732 = v287; | |
5182 v288 = *(int *)v287; | |
5183 *(int *)(v245 + 12) = v288; | |
5184 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5185 + 4]; | |
5186 if ( v284 >= v285 ) | |
5187 break; | |
5188 } | |
5189 } | |
924 | 5190 ++*(int *)(v245 + 12); |
5191 goto LABEL_612; | |
890 | 5192 } |
889 | 5193 } |
5194 else | |
5195 { | |
890 | 5196 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5197 if ( v731 != 4 | |
5198 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5199 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5200 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5201 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5202 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
5203 goto LABEL_616; | |
5204 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5205 LODWORD(v725) = (int)v247; | |
5206 v248 = v247[28]; | |
5207 if ( v248 && v248 != 1 && v248 != 2 ) | |
5208 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5209 else | |
5210 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5211 if ( v249 ) | |
5212 { | |
5213 uRequiredMana = 1; | |
5214 v730 = 0; | |
5215 } | |
5216 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5217 uRequiredMana = 1; | |
5218 if (uRequiredMana) | |
5219 goto LABEL_613; | |
5220 v250 = v725; | |
5221 v251 = *(char *)(LODWORD(v725) + 28); | |
5222 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 ) | |
5223 { | |
5224 if ( rand() % 100 < 80 | |
5225 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5226 { | |
5227 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5228 *(int *)(v245 + 4) = 0; | |
5229 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5230 ; | |
5231 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5232 + 1] ) | |
5233 { | |
5234 ++*(int *)(v245 + 4); | |
5235 if ( m >= v252 ) | |
5236 break; | |
5237 } | |
5238 v254 = rand(); | |
5239 v255 = 10;// pItemsTable->field_116D8[21]; | |
5240 v256 = 10;//pItemsTable->field_116D8[20]; | |
5241 goto LABEL_611; | |
5242 } | |
5243 v257 = pItemsTable->pSpecialEnchantments_count; | |
5244 v258 = 0; | |
5245 v725 = 0.0; | |
5246 HIDWORD(v733) = 0; | |
5247 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5248 { | |
5249 v730 = (int)&v679; | |
5250 do | |
5251 { | |
5252 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5253 if ( !v259 || v259 == 1 ) | |
5254 { | |
5255 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5256 + 4] | |
5257 + v258 * 28); | |
5258 LODWORD(v725) += v260; | |
5259 if ( v260 ) | |
5260 { | |
5261 v261 = v730; | |
5262 v730 += 4; | |
5263 *(int *)v261 = HIDWORD(v733); | |
5264 } | |
5265 } | |
5266 ++HIDWORD(v733); | |
5267 ++v258; | |
5268 } | |
5269 while ( SHIDWORD(v733) < v257 ); | |
5270 } | |
5271 v262 = rand() % SLODWORD(v725); | |
5272 v263 = v679; | |
5273 *(int *)(v245 + 12) = v679; | |
5274 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5275 v265 = v262 + 1; | |
5276 if ( v264 < v265 ) | |
5277 { | |
5278 for ( ii = &v679; ; ii = (int *)v732 ) | |
5279 { | |
5280 v267 = (int)(ii + 1); | |
5281 v732 = v267; | |
5282 v268 = *(int *)v267; | |
5283 *(int *)(v245 + 12) = v268; | |
5284 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5285 + 4]; | |
5286 if ( v264 >= v265 ) | |
5287 break; | |
5288 } | |
5289 } | |
5290 ++*(int *)(v245 + 12); | |
5291 goto LABEL_612; | |
5292 } | |
5293 } | |
5294 //v1 = 0; | |
5295 goto LABEL_616; | |
5296 } | |
5297 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5298 _this = v289; | |
5299 v290 = v289->uItemID; | |
5300 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5301 if ( v290 > 134 | |
5302 || _this->uSpecEnchantmentType != 0 | |
5303 || _this->uEnchantmentType != 0 | |
5304 || _this->_bonus_strength != 0 | |
5305 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5306 || v291 == 1 | |
5307 || v291 == 2 | |
5308 || _this->Broken()) | |
5309 goto LABEL_616; | |
5310 if ( _this->GetValue() < 0x1C2 ) | |
5311 uRequiredMana = 1; | |
5312 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5313 uRequiredMana = 1; | |
5314 if ( uRequiredMana != 0 ) | |
5315 { | |
5316 dword_50C9D0 = 113; | |
5317 dword_50C9D4 = 0; | |
5318 dword_50C9D8 = 1; | |
5319 | |
5320 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5321 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5322 pCastSpell->spellnum = 0; |
890 | 5323 continue; |
5324 } | |
5325 v292 = *(char *)(LODWORD(v725) + 28); | |
5326 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5327 { | |
889 | 5328 v2 = v723; |
5329 //v1 = 0; | |
890 | 5330 |
5331 dword_50C9D0 = 113; | |
5332 dword_50C9D4 = 0; | |
5333 dword_50C9D8 = 1; | |
5334 | |
5335 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5336 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5337 pCastSpell->spellnum = 0; |
890 | 5338 continue; |
5339 } | |
5340 if ( rand() % 100 >= 80 ) | |
5341 { | |
5342 v297 = pItemsTable->pSpecialEnchantments_count; | |
5343 v294 = _this; | |
5344 v298 = 0; | |
5345 v725 = 0.0; | |
5346 HIDWORD(v733) = 0; | |
5347 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5348 { | |
5349 v730 = (int)&v679; | |
5350 do | |
5351 { | |
5352 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5353 if ( !v299 || v299 == 1 ) | |
5354 { | |
5355 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5356 + v298 * 28); | |
5357 LODWORD(v725) += v300; | |
5358 if ( v300 ) | |
5359 { | |
5360 v301 = v730; | |
5361 v730 += 4; | |
5362 *(int *)v301 = HIDWORD(v733); | |
5363 } | |
5364 } | |
5365 ++HIDWORD(v733); | |
5366 ++v298; | |
5367 } | |
5368 while ( SHIDWORD(v733) < v297 ); | |
5369 } | |
5370 v302 = rand() % SLODWORD(v725); | |
5371 v303 = v679; | |
5372 v294->uSpecEnchantmentType = v679; | |
5373 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5374 v305 = v302 + 1; | |
5375 if ( v304 < v305 ) | |
5376 { | |
5377 for ( jj = &v679; ; jj = (int *)v732 ) | |
5378 { | |
5379 v307 = (int)(jj + 1); | |
5380 v732 = v307; | |
5381 v308 = *(int *)v307; | |
5382 v294->uSpecEnchantmentType = v308; | |
5383 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5384 if ( v304 >= v305 ) | |
5385 break; | |
5386 } | |
5387 } | |
5388 ++v294->uSpecEnchantmentType; | |
5389 } | |
5390 else | |
5391 { | |
5392 v293 = rand(); | |
5393 v294 = _this; | |
5394 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5395 _this->uEnchantmentType = 0; | |
5396 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5397 ; | |
5398 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5399 + 1] ) | |
5400 { | |
5401 ++v294->uEnchantmentType; | |
5402 if ( kk >= v295 ) | |
5403 break; | |
5404 } | |
5405 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5406 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5407 } | |
5408 v294->uAttributes |= 0x20u; | |
5409 dword_50C9A8 = 256; | |
5410 LODWORD(v727) = 1; | |
5411 break; | |
5412 } | |
5413 case SPELL_WATER_TOWN_PORTAL: | |
5414 { | |
5415 amount = 10 * v2; | |
5416 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5417 break; | |
5418 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5419 { | |
5420 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5421 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5422 pCastSpell->spellnum = 0; |
890 | 5423 continue; |
5424 } | |
924 | 5425 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
890 | 5426 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5427 LODWORD(v727) = 1; | |
5428 break; | |
5429 } | |
5430 case SPELL_WATER_LLOYDS_BEACON: | |
5431 { | |
5432 LODWORD(v733) = 604800 * v2; | |
5433 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5434 { | |
5435 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5436 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5437 pCastSpell->spellnum = 0; |
890 | 5438 continue; |
5439 } | |
5440 v319 = uRequiredMana; | |
5441 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5442 { | |
5443 pEventTimer->Pause(); | |
5444 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | |
5445 qword_506350 = (signed int)v733; | |
924 | 5446 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
890 | 5447 ::uRequiredMana = v319; |
5448 ::sRecoveryTime = sRecoveryTime; | |
924 | 5449 dword_50633C = pCastSpell->sound_id; |
5450 dword_506338 = pCastSpell->spellnum; | |
5451 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
890 | 5452 } |
5453 break; | |
5454 } | |
5455 case SPELL_EARTH_STONE_TO_FLESH: | |
5456 { | |
5457 v320 = v731 - 2; | |
5458 if ( !v320 ) | |
5459 goto LABEL_632; | |
5460 v321 = v320 - 1; | |
5461 if ( v321 ) | |
5462 { | |
5463 if ( v321 == 1 ) | |
5464 goto LABEL_634; | |
5465 LABEL_632: | |
5466 v322 = 3600 * v2; | |
5467 } | |
5468 else | |
5469 { | |
5470 v322 = 86400 * v2; | |
5471 } | |
5472 amount = v322; | |
5473 LABEL_634: | |
5474 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5475 break; | |
924 | 5476 v323 = pCastSpell->uPlayerID_2; |
890 | 5477 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5478 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5479 { | |
5480 LODWORD(v727) = 1; | |
5481 break; | |
5482 } | |
5483 if ( v731 == 4 ) | |
5484 { | |
5485 *(int *)v324 = 0; | |
5486 *((int *)v324 + 1) = 0; | |
5487 LODWORD(v727) = 1; | |
5488 break; | |
5489 } | |
5490 v732 = amount << 7; | |
5491 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5492 v656 = 15; | |
924 | 5493 v325 = &pParty->pPlayers[v323]; |
5494 goto LABEL_641; | |
890 | 5495 } |
5496 case SPELL_EARTH_ROCK_BLAST: | |
5497 { | |
5498 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5499 break; | |
924 | 5500 pSpellSprite.stru_24.Reset(); |
5501 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5502 pSpellSprite.spell_level = v2; | |
5503 pSpellSprite.spell_skill = v731; | |
5504 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5505 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5506 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5507 pSpellSprite.uAttributes = 0; | |
5508 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5509 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 5510 pParty->vPosition.x, |
5511 pParty->vPosition.y, | |
5512 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 5513 pSpellSprite.uSpriteFrameID = 0; |
5514 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5515 pSpellSprite.spell_target_pid = a2; | |
5516 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5517 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5518 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5519 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5520 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5521 | |
5522 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5523 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5524 ++pTurnEngine->field_1C; |
5525 LODWORD(v727) = 1; | |
5526 break; | |
5527 } | |
5528 case SPELL_EARTH_DEATH_BLOSSOM: | |
5529 { | |
5530 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5531 { | |
5532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5533 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5534 pCastSpell->spellnum = 0; |
890 | 5535 continue; |
5536 } | |
5537 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5538 break; | |
924 | 5539 pSpellSprite.uType = 4090; |
5540 pSpellSprite.stru_24.Reset(); | |
5541 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5542 pSpellSprite.spell_level = v2; | |
5543 pSpellSprite.spell_skill = v731; | |
5544 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5545 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5546 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5547 pSpellSprite.uAttributes = 0; | |
5548 pSpellSprite.uSectorID = 0; | |
5549 pSpellSprite.uSpriteFrameID = 0; | |
5550 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5551 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5552 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5553 pSpellSprite.spell_target_pid = a2; | |
5554 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5555 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5556 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5557 pSpellSprite.uAttributes = 4; |
5558 | |
5559 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5560 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5561 ++pTurnEngine->field_1C; |
5562 LODWORD(v727) = 1; | |
5563 break; | |
5564 } | |
5565 case SPELL_SPIRIT_DETECT_LIFE: | |
5566 { | |
5567 v328 = v731 - 2; | |
5568 if ( v328 ) | |
5569 { | |
5570 v329 = v328 - 1; | |
5571 if ( v329 && v329 != 1 ) | |
5572 v330 = 600 * v2; | |
5573 else | |
5574 v330 = 3600 * v2; | |
5575 } | |
5576 else | |
5577 { | |
5578 v330 = 1800 * v2; | |
5579 } | |
5580 LODWORD(v733) = v330; | |
5581 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5582 break; | |
924 | 5583 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5584 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5585 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5586 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 5587 |
5588 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); | |
5589 LODWORD(v727) = 1; | |
5590 break; | |
5591 } | |
5592 case SPELL_SPIRIT_FATE: | |
5593 { | |
5594 LODWORD(v733) = 300; | |
5595 v339 = v731 - 2; | |
5596 if ( v339 ) | |
5597 { | |
5598 v340 = v339 - 1; | |
5599 if ( v340 ) | |
5600 { | |
5601 if ( v340 != 1 ) | |
5602 { | |
5603 amount = v2; | |
5604 goto LABEL_667; | |
5605 } | |
5606 v341 = 6 * v2; | |
889 | 5607 } |
5608 else | |
5609 { | |
890 | 5610 v341 = 4 * v2; |
5611 } | |
5612 } | |
5613 else | |
5614 { | |
5615 v341 = 2 * v2; | |
5616 } | |
5617 amount = v341; | |
5618 LABEL_667: | |
5619 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5620 break; | |
924 | 5621 v342 = pCastSpell->spell_target_pid; |
890 | 5622 if ( v342 == 0 ) |
5623 { | |
924 | 5624 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5625 | |
5626 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
890 | 5627 LODWORD(v727) = 1; |
5628 break; | |
5629 } | |
5630 if (PID_TYPE(v342) == OBJECT_Actor) | |
5631 { | |
5632 v343 = PID_ID(v342); | |
5633 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5634 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5635 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5636 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5637 v672 = 0; | |
5638 v661 = &pActors[v343]; | |
5639 LABEL_165: | |
5640 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5641 } | |
5642 LODWORD(v727) = 1; | |
5643 break; | |
5644 } | |
5645 case SPELL_SPIRIT_REMOVE_CURSE: | |
5646 { | |
5647 v348 = v731 - 2; | |
5648 if ( !v348 ) | |
5649 goto LABEL_677; | |
5650 v349 = v348 - 1; | |
5651 if ( v349 ) | |
5652 { | |
5653 if ( v349 == 1 ) | |
5654 { | |
5655 amount = 0; | |
5656 goto LABEL_679; | |
5657 } | |
5658 LABEL_677: | |
5659 v350 = 3600 * v2; | |
5660 } | |
5661 else | |
5662 { | |
5663 v350 = 86400 * v2; | |
5664 } | |
5665 amount = v350; | |
5666 LABEL_679: | |
5667 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5668 break; | |
924 | 5669 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5670 if ( !v351->pConditions[0] ) |
5671 { | |
5672 LODWORD(v727) = 1; | |
5673 break; | |
5674 } | |
5675 if ( v731 == 4 ) | |
5676 { | |
5677 LODWORD(v351->pConditions[0]) = 0; | |
5678 HIDWORD(v351->pConditions[0]) = 0; | |
5679 } | |
5680 else | |
5681 { | |
5682 v732 = amount << 7; | |
5683 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
924 | 5684 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
890 | 5685 { |
5686 LODWORD(v727) = 1; | |
5687 break; | |
5688 } | |
5689 } | |
924 | 5690 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 5691 LODWORD(v727) = 1; |
5692 break; | |
5693 } | |
5694 case SPELL_SPIRIT_PRESERVATION: | |
5695 { | |
5696 v354 = v731 - 2; | |
5697 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5698 v356 = 900 * (v2 + 4); | |
5699 else | |
5700 v356 = 300 * (v2 + 12); | |
5701 LODWORD(v733) = v356; | |
5702 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5703 break; | |
5704 if ( v731 == 1 || v731 == 2 ) | |
5705 { | |
924 | 5706 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5707 | |
5708 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 | 5709 LODWORD(v727) = 1; |
5710 break; | |
5711 } | |
5712 a2 = 0; | |
5713 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5714 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5715 do | |
5716 { | |
924 | 5717 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 5718 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5719 ++a2; | |
5720 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5721 } | |
5722 while ( v357 <= &pParty->pPlayers[3] ); | |
5723 LODWORD(v727) = 1; | |
5724 break; | |
5725 } | |
5726 case SPELL_SPIRIT_TURN_UNDEAD: | |
5727 { | |
5728 v364 = v731 - 2; | |
5729 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5730 v366 = 60 * (v2 + 3); | |
5731 else | |
5732 v366 = 300 * v2 + 180; | |
5733 LODWORD(v733) = v366; | |
5734 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5735 break; | |
5736 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5737 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
924 | 5738 ++pSpellSprite.uType; |
5739 pSpellSprite.stru_24.Reset(); | |
5740 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5741 pSpellSprite.spell_level = v2; | |
5742 pSpellSprite.spell_skill = v731; | |
5743 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5744 pSpellSprite.uAttributes = 0; | |
5745 pSpellSprite.uSectorID = 0; | |
5746 pSpellSprite.uSpriteFrameID = 0; | |
5747 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5748 pSpellSprite.uFacing = 0; | |
5749 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5750 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5751 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5752 { | |
5753 v369 = &pActors[dword_50BF30[a2]]; | |
5754 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5755 { | |
924 | 5756 pSpellSprite.vPosition.x = v369->vPosition.x; |
5757 pSpellSprite.vPosition.y = v369->vPosition.y; | |
5758 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5759 | |
5760 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5761 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 5762 v369->pActorBuffs[4].Apply( |
5763 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
889 | 5764 v731, 0, 0, 0); |
5765 } | |
890 | 5766 } |
5767 LODWORD(v727) = 1; | |
5768 } | |
5769 break; | |
5770 | |
5771 case SPELL_SPIRIT_RAISE_DEAD: | |
5772 { | |
5773 v371 = v731 - 2; | |
5774 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5775 amount = 0; | |
5776 else | |
5777 amount = 86400 * v2; | |
5778 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5779 break; | |
924 | 5780 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5781 v373 = pCastSpell->uPlayerID_2; | |
890 | 5782 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5783 { | |
5784 LODWORD(v727) = 1; | |
5785 break; | |
5786 } | |
5787 v14 = v731 == 4; | |
5788 pParty->pPlayers[v373].sHealth = 1; | |
5789 if ( v14 ) | |
5790 { | |
924 | 5791 v374 = pCastSpell->uPlayerID_2; |
890 | 5792 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5793 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
924 | 5794 v376 = pCastSpell->uPlayerID_2; |
890 | 5795 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5796 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5797 } | |
5798 else | |
5799 { | |
5800 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5801 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5802 0xEu, |
5803 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 5804 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5805 0xDu, |
5806 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5807 } | |
924 | 5808 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5809 goto LABEL_720; |
5810 } | |
5811 case SPELL_SPIRIT_SHARED_LIFE: | |
5812 { | |
5813 v378 = v731 - 2; | |
5814 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5815 v380 = 4 * v2; | |
5816 else | |
5817 v380 = 3 * v2; | |
5818 amount = v380; | |
5819 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5820 break; | |
5821 v381 = 0; | |
5822 HIDWORD(v733) = amount; | |
5823 v730 = 0; | |
5824 v382 = 1; | |
5825 do | |
5826 { | |
5827 v383 = pPlayers[v382]; | |
5828 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5829 v682[v381++] = v382; | |
5830 ++v382; | |
5831 } | |
5832 while ( v382 <= 4 ); | |
5833 v384 = 0; | |
5834 v730 = v381; | |
5835 if ( v381 > 0 ) | |
5836 { | |
5837 do | |
5838 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5839 while ( v384 < v381 ); | |
5840 } | |
5841 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5842 HIDWORD(v733) = 0; | |
5843 if ( v381 > 0 ) | |
5844 { | |
5845 do | |
5846 { | |
5847 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5848 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5849 v726->sHealth = v732; | |
5850 //v386 = v726->GetMaxHealth(); | |
5851 if ( v726->sHealth > v726->GetMaxHealth()) | |
5852 v726->sHealth = v726->GetMaxHealth(); | |
5853 if ( v726->sHealth > 0 ) | |
5854 { | |
5855 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5856 } | |
5857 v388 = HIDWORD(v733); | |
5858 | |
924 | 5859 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
890 | 5860 HIDWORD(v733) = v388 + 1; |
5861 } | |
5862 while ( v388 + 1 < v730 ); | |
5863 } | |
5864 LODWORD(v727) = 1; | |
5865 break; | |
5866 } | |
5867 case SPELL_SPIRIT_RESSURECTION: | |
5868 { | |
5869 v392 = v731 - 1; | |
5870 if ( !v392 ) | |
5871 { | |
5872 v395 = 180 * v2; | |
924 | 5873 amount = v395; |
5874 goto LABEL_751; | |
890 | 5875 } |
5876 v393 = v392 - 1; | |
5877 if ( !v393 ) | |
5878 { | |
5879 v395 = 10800 * v2; | |
924 | 5880 amount = v395; |
5881 goto LABEL_751; | |
890 | 5882 } |
5883 v394 = v393 - 1; | |
5884 if ( !v394 ) | |
5885 { | |
5886 v395 = 259200 * v2; | |
5887 amount = v395; | |
5888 goto LABEL_751; | |
5889 } | |
5890 if ( v394 == 1 ) | |
5891 amount = 0; | |
5892 LABEL_751: | |
5893 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5894 break; | |
924 | 5895 v396 = pCastSpell->uPlayerID_2; |
890 | 5896 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5897 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5898 { | |
5899 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5900 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5901 if ( v731 == 4 ) | |
5902 { | |
924 | 5903 v397 = pCastSpell->uPlayerID_2; |
890 | 5904 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5905 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
924 | 5906 v398 = pCastSpell->uPlayerID_2; |
890 | 5907 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5908 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
924 | 5909 v399 = pCastSpell->uPlayerID_2; |
890 | 5910 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5911 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5912 } | |
889 | 5913 else |
890 | 5914 { |
5915 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5916 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
890 | 5917 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5918 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
890 | 5919 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5920 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
890 | 5921 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5922 } | |
924 | 5923 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5924 | |
5925 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
5926 | |
5927 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 5928 } |
5929 LODWORD(v727) = 1; | |
5930 break; | |
5931 } | |
5932 case SPELL_MIND_CURE_PARALYSIS: | |
5933 { | |
5934 v405 = v731 - 2; | |
5935 if ( !v405 ) | |
5936 goto LABEL_766; | |
5937 v406 = v405 - 1; | |
5938 if ( v406 ) | |
5939 { | |
5940 if ( v406 == 1 ) | |
5941 { | |
5942 amount = 0; | |
5943 goto LABEL_768; | |
5944 } | |
5945 LABEL_766: | |
5946 v407 = 3600 * v2; | |
5947 } | |
5948 else | |
5949 { | |
5950 v407 = 86400 * v2; | |
5951 } | |
5952 amount = v407; | |
5953 LABEL_768: | |
5954 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5955 break; | |
5956 | |
924 | 5957 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5958 v323 = pCastSpell->uPlayerID_2; | |
890 | 5959 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5960 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5961 { | |
5962 LODWORD(v727) = 1; | |
5963 break; | |
5964 } | |
5965 if ( v731 == 4 ) | |
5966 { | |
5967 *(int *)v324 = 0; | |
5968 *((int *)v324 + 1) = 0; | |
889 | 5969 LODWORD(v727) = 1; |
890 | 5970 break; |
5971 } | |
5972 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5973 v656 = 12; | |
924 | 5974 v325 = &pParty->pPlayers[v323]; |
5975 goto LABEL_641; | |
890 | 5976 |
5977 } | |
5978 case SPELL_MIND_REMOVE_FEAR: | |
5979 { | |
5980 v411 = v731 - 2; | |
5981 if ( v411 ) | |
5982 { | |
5983 v412 = v411 - 1; | |
5984 if ( v412 ) | |
5985 { | |
5986 if ( v412 == 1 ) | |
5987 { | |
5988 amount = 0; | |
5989 goto LABEL_780; | |
5990 } | |
5991 v413 = 180 * v2; | |
889 | 5992 } |
5993 else | |
5994 { | |
890 | 5995 v413 = 86400 * v2; |
5996 } | |
5997 } | |
5998 else | |
5999 { | |
6000 v413 = 3600 * v2; | |
6001 } | |
6002 amount = v413; | |
6003 LABEL_780: | |
6004 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6005 break; | |
6006 | |
924 | 6007 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6008 v323 = pCastSpell->uPlayerID_2; | |
890 | 6009 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
6010 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
6011 { | |
6012 LODWORD(v727) = 1; | |
6013 break; | |
6014 } | |
6015 if ( v731 == 4 ) | |
6016 { | |
6017 *(int *)v324 = 0; | |
6018 *((int *)v324 + 1) = 0; | |
6019 LODWORD(v727) = 1; | |
6020 break; | |
6021 } | |
6022 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6023 v656 = 3; | |
924 | 6024 v325 = &pParty->pPlayers[v323]; |
6025 goto LABEL_641; | |
890 | 6026 } |
6027 case SPELL_MIND_TELEPATHY: | |
6028 { | |
6029 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6030 break; | |
6031 if (PID_TYPE(a2) != OBJECT_Actor) | |
6032 { | |
889 | 6033 LODWORD(v727) = 1; |
890 | 6034 break; |
6035 } | |
6036 v417 = (int)&pActors[PID_ID(a2)]; | |
6037 v730 = v417; | |
6038 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6039 { | |
6040 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6041 v417 = v730; | |
6042 } | |
6043 v418 = *(int *)(v417 + 672); | |
6044 HIDWORD(v733) = 0; | |
6045 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6046 HIDWORD(v733) = *(int *)(v417 + 684); | |
6047 | |
6048 //ItemGen::ItemGen(&v683); | |
6049 v683.Reset(); | |
6050 | |
6051 v419 = *(short *)(v730 + 180); | |
6052 if (v419) | |
6053 { | |
6054 v683.uItemID = v419; | |
6055 goto LABEL_799; | |
6056 } | |
6057 v420 = 0; | |
6058 v421 = v730 + 564; | |
6059 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6060 { | |
6061 ++v420; | |
6062 v421 += 36; | |
6063 if ( v420 >= 4 ) | |
6064 goto LABEL_799; | |
6065 } | |
6066 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6067 v2 = v723; | |
6068 //v1 = 0; | |
6069 LABEL_799: | |
6070 if ( HIDWORD(v733) != 0 ) | |
6071 { | |
6072 v675 = (const char *)HIDWORD(v733); | |
6073 if (v683.uItemID) | |
6074 { | |
6075 v422 = v683.GetDisplayName(); | |
6076 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
924 | 6077 ShowStatusBarString(pTmpBuf2, 2u); |
6078 pSpellSprite.stru_24.Reset(); | |
6079 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6080 pSpellSprite.spell_level = v2; | |
6081 pSpellSprite.spell_skill = v731; | |
6082 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6083 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6084 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6085 v676 = *(short *)(v730 + 138); | |
6086 v665 = pSpellSprite.vPosition.y; | |
6087 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6088 v657 = pSpellSprite.vPosition.x; | |
6089 goto LABEL_1087; | |
890 | 6090 } |
6091 v664 = "%d gold"; | |
924 | 6092 sprintf(pTmpBuf2, v664, v675); |
6093 ShowStatusBarString(pTmpBuf2, 2u); | |
6094 pSpellSprite.stru_24.Reset(); | |
6095 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6096 pSpellSprite.spell_level = v2; | |
6097 pSpellSprite.spell_skill = v731; | |
6098 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6099 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6100 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6101 v676 = *(short *)(v730 + 138); | |
6102 v665 = pSpellSprite.vPosition.y; | |
6103 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6104 v657 = pSpellSprite.vPosition.x; | |
6105 goto LABEL_1087; | |
890 | 6106 } |
6107 if (v683.uItemID) | |
6108 { | |
6109 v675 = v683.GetDisplayName(); | |
6110 v664 = "(%s)"; | |
6111 sprintf(pTmpBuf2, v664, v675); | |
924 | 6112 ShowStatusBarString(pTmpBuf2, 2u); |
6113 pSpellSprite.stru_24.Reset(); | |
6114 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6115 pSpellSprite.spell_level = v2; | |
6116 pSpellSprite.spell_skill = v731; | |
6117 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6118 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6119 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6120 v676 = *(short *)(v730 + 138); | |
6121 v665 = pSpellSprite.vPosition.y; | |
6122 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6123 v657 = pSpellSprite.vPosition.x; | |
6124 goto LABEL_1087; | |
890 | 6125 } |
6126 strcpy(pTmpBuf2, "nothing"); | |
6127 ShowStatusBarString(pTmpBuf2, 2u); | |
924 | 6128 pSpellSprite.stru_24.Reset(); |
6129 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6130 pSpellSprite.spell_level = v2; | |
6131 pSpellSprite.spell_skill = v731; | |
6132 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6133 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6134 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
890 | 6135 v676 = *(short *)(v730 + 138); |
924 | 6136 v665 = pSpellSprite.vPosition.y; |
6137 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6138 v657 = pSpellSprite.vPosition.x; | |
890 | 6139 goto LABEL_1087; |
6140 } | |
6141 case SPELL_MIND_BERSERK: | |
6142 { | |
6143 v423 = v731 - 2; | |
6144 if ( !v423 ) | |
6145 goto LABEL_813; | |
6146 v424 = v423 - 1; | |
6147 if ( v424 ) | |
6148 { | |
6149 if ( v424 == 1 ) | |
6150 v425 = 3600 * v2; | |
6151 else | |
6152 LABEL_813: | |
6153 v425 = 300 * v2; | |
6154 } | |
6155 else | |
6156 { | |
6157 v425 = 600 * v2; | |
6158 } | |
6159 amount = v425; | |
6160 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6161 break; | |
6162 v426 = PID_ID(a2); | |
6163 if (PID_TYPE(a2) != OBJECT_Actor) | |
6164 { | |
6165 LODWORD(v727) = 1; | |
6166 break; | |
6167 } | |
6168 v730 = 836 * v426; | |
6169 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6170 { | |
6171 pActors[v426].pActorBuffs[1].Reset(); | |
6172 pActors[v426].pActorBuffs[12].Reset(); | |
6173 pActors[v426].pActorBuffs[9].Apply( | |
6174 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6175 v731, 0, 0, 0); | |
6176 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6177 } | |
924 | 6178 pSpellSprite.stru_24.Reset(); |
6179 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6180 pSpellSprite.spell_level = v2; | |
6181 pSpellSprite.spell_skill = v731; | |
6182 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6183 v61 = v426; |
6184 goto LABEL_1086; | |
6185 | |
6186 } | |
6187 case SPELL_MIND_ENSLAVE: | |
6188 { | |
6189 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6190 break; | |
6191 amount = 600 * v2; | |
6192 if (PID_TYPE(a2) != OBJECT_Actor) | |
6193 { | |
6194 LODWORD(v727) = 1; | |
6195 break; | |
6196 } | |
6197 v730 = 836 * PID_ID(a2); | |
6198 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6199 break; | |
6200 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6201 { | |
6202 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6203 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6204 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6205 v731, 0, 0, 0); | |
6206 } | |
924 | 6207 pSpellSprite.stru_24.Reset(); |
6208 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6209 pSpellSprite.spell_level = v2; | |
6210 pSpellSprite.spell_skill = v731; | |
6211 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6212 v61 = PID_ID(a2); |
6213 goto LABEL_1086; | |
6214 } | |
6215 case SPELL_MIND_MASS_FEAR: | |
6216 { | |
6217 v428 = v731 - 2; | |
6218 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6219 v430 = 300 * v2; | |
6220 else | |
6221 v430 = 180 * v2; | |
6222 amount = v430; | |
6223 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6224 break; | |
6225 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6226 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
924 | 6227 ++pSpellSprite.uType; |
6228 pSpellSprite.stru_24.Reset(); | |
6229 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6230 pSpellSprite.spell_level = v2; | |
6231 pSpellSprite.spell_skill = v731; | |
6232 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6233 pSpellSprite.uAttributes = 0; | |
6234 pSpellSprite.uSectorID = 0; | |
6235 pSpellSprite.uSpriteFrameID = 0; | |
6236 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6237 pSpellSprite.uFacing = 0; | |
6238 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6239 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6240 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6241 { | |
6242 v433 = &pActors[dword_50BF30[a2]]; | |
6243 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6244 break; | |
924 | 6245 pSpellSprite.vPosition.x = v433->vPosition.x; |
6246 pSpellSprite.vPosition.y = v433->vPosition.y; | |
6247 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6248 | |
6249 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6250 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6251 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6252 { | |
6253 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6254 v731, 0, 0, 0); | |
6255 } | |
6256 } | |
6257 LODWORD(v727) = 1; | |
6258 break; | |
6259 } | |
6260 | |
6261 case SPELL_MIND_CURE_INSANITY: | |
6262 { | |
6263 v435 = v731 - 2; | |
6264 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6265 amount = 0; | |
6266 else | |
6267 amount = 86400 * v2; | |
6268 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6269 break; | |
6270 | |
924 | 6271 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6272 v440 = pCastSpell->uPlayerID_2; | |
890 | 6273 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6274 { | |
6275 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6276 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6277 if ( v731 == 4 ) | |
6278 { | |
924 | 6279 v441 = pCastSpell->uPlayerID_2; |
890 | 6280 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6281 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
889 | 6282 } |
6283 else | |
6284 { | |
924 | 6285 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
890 | 6286 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6287 } | |
924 | 6288 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6289 LABEL_720: |
6290 v377->SetCondition(1, 0); | |
6291 } | |
6292 LODWORD(v727) = 1; | |
6293 break; | |
6294 } | |
6295 case SPELL_EARTH_TELEKINESIS: | |
6296 { | |
6297 v442 = v731 - 2; | |
6298 if ( !v442 ) | |
6299 goto LABEL_855; | |
6300 v443 = v442 - 1; | |
6301 if ( v443 ) | |
6302 { | |
6303 if ( v443 == 1 ) | |
6304 v444 = 4 * v2; | |
6305 else | |
6306 LABEL_855: | |
6307 v444 = 2 * v2; | |
6308 } | |
6309 else | |
6310 { | |
6311 v444 = 3 * v2; | |
6312 } | |
6313 amount = v444; | |
6314 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6315 break; | |
6316 v445 = PID_ID(a2); | |
6317 if (PID_TYPE(a2) == OBJECT_Item) | |
6318 { | |
6319 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6320 v450 = *(int *)v449; | |
6321 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6322 { | |
6323 party_finds_gold(*((int *)v449 + 3), 0); | |
6324 viewparams->bRedrawGameUI = 1; | |
889 | 6325 } |
6326 else | |
6327 { | |
890 | 6328 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
6329 ShowStatusBarString(pTmpBuf2, 2u); | |
6330 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6331 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6332 } | |
6333 SpriteObject::OnInteraction(v445); | |
6334 } | |
6335 else | |
6336 { | |
6337 if (PID_TYPE(a2) == OBJECT_Actor) | |
6338 { | |
6339 stru_50C198.LootActor(&pActors[v445]); | |
6340 } | |
6341 else | |
6342 { | |
6343 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6344 { | |
6345 if (PID_TYPE(a2) != OBJECT_BModel) | |
6346 { | |
6347 LODWORD(v727) = 1; | |
6348 break; | |
6349 } | |
6350 dword_507CD8 = 1; | |
6351 v677 = 1; | |
6352 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6353 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6354 else | |
6355 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6356 | |
6357 EventProcessor(v446, a2, v677); | |
6358 LODWORD(v727) = 1; | |
6359 break; | |
6360 } | |
6361 v447 = &pLevelDecorations[v445]; | |
6362 dword_507CD8 = 1; | |
6363 v448 = v447->field_16_event_id; | |
6364 if (v448) | |
6365 { | |
6366 v677 = 1; | |
6367 v446 = v448; | |
6368 EventProcessor(v446, a2, v677); | |
6369 LODWORD(v727) = 1; | |
6370 break; | |
6371 } | |
6372 if ( v447->IsInteractive() ) | |
6373 { | |
6374 activeLevelDecoration = v447; | |
6375 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6376 activeLevelDecoration = NULL; | |
6377 } | |
6378 } | |
6379 } | |
6380 LODWORD(v727) = 1; | |
6381 break; | |
6382 } | |
6383 case SPELL_BODY_CURE_WEAKNESS: | |
6384 { | |
6385 v451 = v731 - 2; | |
6386 if ( v451 ) | |
6387 { | |
6388 v452 = v451 - 1; | |
6389 if ( v452 ) | |
6390 { | |
6391 if ( v452 == 1 ) | |
6392 { | |
6393 amount = 0; | |
6394 goto LABEL_883; | |
6395 } | |
6396 v453 = 180 * v2; | |
889 | 6397 } |
6398 else | |
6399 { | |
890 | 6400 v453 = 86400 * v2; |
6401 } | |
6402 } | |
6403 else | |
6404 { | |
6405 v453 = 3600 * v2; | |
6406 } | |
6407 amount = v453; | |
6408 LABEL_883: | |
6409 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6410 break; | |
6411 | |
924 | 6412 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6413 v323 = pCastSpell->uPlayerID_2; | |
890 | 6414 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6415 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6416 { | |
889 | 6417 LODWORD(v727) = 1; |
890 | 6418 break; |
6419 } | |
6420 if ( v731 == 4 ) | |
6421 { | |
6422 *(int *)v324 = 0; | |
6423 *((int *)v324 + 1) = 0; | |
6424 LODWORD(v727) = 1; | |
6425 break; | |
6426 } | |
6427 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6428 v656 = 1; | |
6429 v325 = &pParty->pPlayers[v323]; | |
6430 goto LABEL_641; | |
6431 } | |
6432 case SPELL_BODY_FIRST_AID: | |
6433 { | |
6434 v457 = v731 - 2; | |
6435 if ( v457 ) | |
6436 { | |
6437 v458 = v457 - 1; | |
6438 if ( v458 ) | |
6439 { | |
6440 if ( v458 == 1 ) | |
6441 v459 = 5 * v2 + 5; | |
6442 else | |
6443 v459 = 2 * v2 + 5; | |
889 | 6444 } |
6445 else | |
6446 { | |
890 | 6447 v459 = 4 * v2 + 5; |
6448 } | |
6449 } | |
6450 else | |
6451 { | |
6452 v459 = 3 * v2 + 5; | |
6453 } | |
6454 amount = v459; | |
6455 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6456 break; | |
924 | 6457 v460 = pCastSpell->spell_target_pid; |
890 | 6458 if (!v460) |
6459 { | |
924 | 6460 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6461 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 6462 } |
6463 else | |
6464 { | |
6465 if (PID_TYPE(v460) == OBJECT_Actor) | |
6466 { | |
6467 v461 = &pActors[PID_ID(v460)]; | |
6468 v462 = v461->uAIState; | |
6469 v463 = v461->pMonsterInfo.uHP; | |
6470 if ( v462 != 5 ) | |
6471 { | |
6472 if ( v462 != 4 ) | |
6473 { | |
6474 if ( v462 != 19 ) | |
6475 { | |
6476 if ( v462 != 11 ) | |
6477 { | |
6478 v461->sCurrentHP += amount; | |
6479 if ( v461->sCurrentHP > v463 ) | |
6480 v461->sCurrentHP = v463; | |
6481 } | |
6482 } | |
6483 } | |
6484 } | |
6485 } | |
6486 } | |
6487 LODWORD(v727) = 1; | |
6488 break; | |
6489 } | |
6490 case SPELL_BODY_CURE_POISON: | |
6491 { | |
6492 v464 = v731 - 2; | |
6493 if ( !v464 ) | |
6494 goto LABEL_910; | |
6495 v465 = v464 - 1; | |
6496 if ( v465 ) | |
6497 { | |
6498 if ( v465 == 1 ) | |
6499 { | |
6500 amount = 0; | |
6501 goto LABEL_912; | |
6502 } | |
6503 LABEL_910: | |
6504 v466 = 3600 * v2; | |
6505 } | |
6506 else | |
6507 { | |
6508 v466 = 86400 * v2; | |
6509 } | |
6510 amount = v466; | |
6511 LABEL_912: | |
6512 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6513 break; | |
6514 | |
924 | 6515 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6516 v470 = pCastSpell->uPlayerID_2; | |
890 | 6517 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6518 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6519 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6520 { | |
6521 LODWORD(v727) = 1; | |
6522 break; | |
6523 } | |
6524 if ( v731 == 4 ) | |
6525 { | |
6526 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6527 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
924 | 6528 v471 = pCastSpell->uPlayerID_2; |
890 | 6529 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6530 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
924 | 6531 v472 = pCastSpell->uPlayerID_2; |
890 | 6532 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6533 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6534 LODWORD(v727) = 1; | |
6535 break; | |
6536 } | |
6537 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6538 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6539 6u, | |
6540 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6541 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6542 8u, |
6543 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6544 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6545 v656 = 10; | |
6546 goto LABEL_937; | |
6547 | |
6548 } | |
6549 case SPELL_BODY_PROTECTION_FROM_MAGIC: | |
6550 { | |
6551 amount = v2; | |
6552 LODWORD(v733) = 3600 * v2; | |
6553 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6554 break; | |
6555 | |
924 | 6556 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6557 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6558 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6559 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6560 |
6561 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6562 LODWORD(v727) = 1; | |
6563 break; | |
6564 } | |
6565 case SPELL_BODY_HAMMERHANDS: | |
6566 { | |
6567 LODWORD(v733) = 3600 * v2; | |
6568 amount = v2; | |
6569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6570 break; | |
6571 if ( v731 == 4 ) | |
6572 { | |
924 | 6573 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6574 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6575 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6576 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6577 v732 = (int)v733 << 7; |
6578 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6579 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6580 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6581 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6582 | |
6583 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6584 LODWORD(v727) = 1; | |
6585 break; | |
6586 } | |
924 | 6587 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6588 | |
6589 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); | |
890 | 6590 LODWORD(v727) = 1; |
6591 break; | |
6592 } | |
6593 case SPELL_BODY_CURE_DISEASE: | |
6594 { | |
6595 v493 = v731 - 2; | |
6596 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6597 amount = 0; | |
6598 else | |
6599 amount = 86400 * v2; | |
6600 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6601 break; | |
6602 | |
924 | 6603 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6604 v498 = pCastSpell->uPlayerID_2; | |
890 | 6605 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6606 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6607 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6608 { | |
6609 LODWORD(v727) = 1; | |
6610 break; | |
6611 } | |
6612 if ( v731 == 4 ) | |
6613 { | |
6614 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6615 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
924 | 6616 v499 = pCastSpell->uPlayerID_2; |
890 | 6617 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6618 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
924 | 6619 v500 = pCastSpell->uPlayerID_2; |
890 | 6620 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6621 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6622 } | |
6623 else | |
6624 { | |
6625 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6626 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6627 7u, | |
6628 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6629 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6630 9u, |
6631 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6632 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6633 v656 = 11; | |
6634 LABEL_937: | |
924 | 6635 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6636 LABEL_641: |
6637 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6638 } | |
6639 LODWORD(v727) = 1; | |
6640 break; | |
6641 } | |
6642 case SPELL_BODY_POWER_CURE: | |
6643 { | |
6644 amount = 5 * v2 + 10; | |
6645 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6646 break; | |
6647 v501 = pParty->pPlayers; | |
6648 int v1 = 0; | |
6649 do | |
6650 { | |
924 | 6651 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
890 | 6652 v501->Heal(amount); |
6653 ++v501; | |
6654 ++v1; | |
6655 } | |
6656 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6657 LODWORD(v727) = 1; | |
6658 break; | |
6659 } | |
6660 case SPELL_LIGHT_DISPEL_MAGIC: | |
6661 { | |
6662 sRecoveryTime -= v2; | |
6663 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6664 break; | |
6665 | |
6666 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6667 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6668 ++pSpellSprite.uType; |
890 | 6669 HIDWORD(v733) = v505; |
6670 v688.x = 0; | |
6671 v688.y = 0; | |
6672 v688.z = 0; | |
924 | 6673 pSpellSprite.stru_24.Reset(); |
6674 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6675 pSpellSprite.spell_level = v2; | |
6676 pSpellSprite.spell_skill = v731; | |
6677 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6678 pSpellSprite.uAttributes = 0; | |
6679 pSpellSprite.uSectorID = 0; | |
6680 pSpellSprite.uSpriteFrameID = 0; | |
6681 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6682 pSpellSprite.uFacing = 0; | |
6683 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6684 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6685 a2 = 0; |
6686 if ( SHIDWORD(v733) > 0 ) | |
6687 { | |
6688 do | |
6689 { | |
6690 v507 = dword_50BF30[a2]; | |
924 | 6691 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6692 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
6693 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6694 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6695 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6696 v510 = a2; |
6697 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6698 a2 = v510 + 1; | |
6699 } | |
6700 while ( v510 + 1 < SHIDWORD(v733) ); | |
6701 } | |
6702 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6703 { | |
6704 v511 = &pActors[dword_50BF30[a2]]; | |
924 | 6705 pSpellSprite.vPosition.x = v511->vPosition.x; |
6706 pSpellSprite.vPosition.y = v511->vPosition.y; | |
6707 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6708 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6709 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6710 v513 = v511->pActorBuffs; |
6711 for (int _v726 = 22; _v726 != 0; --_v726) | |
6712 { | |
6713 v513->Reset(); | |
6714 ++v513; | |
6715 } | |
6716 } | |
6717 LODWORD(v727) = 1; | |
6718 break; | |
6719 } | |
6720 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
6721 { | |
6722 v514 = v731 - 2; | |
6723 if ( !v514 ) | |
6724 goto LABEL_955; | |
6725 v515 = v514 - 1; | |
6726 if ( v515 ) | |
6727 { | |
6728 if ( v515 == 1 ) | |
6729 { | |
6730 v516 = 900 * v2; | |
6731 amount = 5; | |
889 | 6732 } |
6733 else | |
6734 { | |
890 | 6735 LABEL_955: |
6736 v516 = 300 * v2; | |
6737 amount = 1; | |
6738 } | |
6739 } | |
6740 else | |
6741 { | |
6742 v516 = 900 * v2; | |
6743 amount = 3; | |
6744 } | |
6745 v733 = __PAIR__(0, v516); | |
6746 | |
6747 if ( (signed int)uNumActors > 0 ) | |
6748 { | |
6749 v518 = pActors;//[0].uAIState; | |
6750 auto _v726 = uNumActors; | |
889 | 6751 do |
6752 { | |
890 | 6753 v519 = v518->uAIState; |
924 | 6754 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
890 | 6755 ++HIDWORD(v733); |
6756 ++v518; | |
6757 --_v726; | |
6758 } | |
6759 while ( _v726 != 0 ); | |
6760 } | |
6761 if ( SHIDWORD(v733) >= amount ) | |
6762 { | |
6763 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6764 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6765 pCastSpell->spellnum = 0; |
890 | 6766 continue; |
6767 } | |
6768 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6769 break; | |
924 | 6770 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
890 | 6771 LODWORD(v727) = 1; |
6772 break; | |
6773 } | |
6774 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
6775 { | |
6776 v520 = v731 - 2; | |
6777 if ( !v520 ) | |
6778 goto LABEL_973; | |
6779 v521 = v520 - 1; | |
6780 if ( v521 ) | |
6781 { | |
6782 if ( v521 == 1 ) | |
6783 { | |
6784 LODWORD(v733) = 18000 * v2; | |
6785 v522 = 5 * v2 + 10; | |
889 | 6786 } |
6787 else | |
6788 { | |
890 | 6789 LABEL_973: |
6790 LODWORD(v733) = 10800 * v2; | |
6791 v522 = 3 * v2 + 10; | |
6792 } | |
6793 } | |
6794 else | |
6795 { | |
6796 LODWORD(v733) = 14400 * v2; | |
6797 v522 = 4 * v2 + 10; | |
6798 } | |
6799 amount = v522; | |
6800 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6801 break; | |
6802 | |
924 | 6803 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6804 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6805 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6806 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6807 |
6808 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6809 LODWORD(v727) = 1; | |
6810 break; | |
6811 } | |
6812 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
6813 { | |
6814 //v67 = 2; | |
6815 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6816 { | |
6817 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6818 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6819 pCastSpell->spellnum = 0; |
890 | 6820 continue; |
6821 } | |
6822 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6823 break; | |
6824 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6825 ++pSpellSprite.uType; |
890 | 6826 v694.x = 0; |
6827 v694.y = 0; | |
6828 v694.z = 0; | |
924 | 6829 pSpellSprite.stru_24.Reset(); |
6830 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6831 pSpellSprite.spell_level = v2; | |
6832 pSpellSprite.spell_skill = v731; | |
6833 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6834 pSpellSprite.uAttributes = 0; | |
6835 pSpellSprite.uSectorID = 0; | |
6836 pSpellSprite.uSpriteFrameID = 0; | |
6837 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6838 pSpellSprite.uFacing = 0; | |
6839 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6840 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6841 a2 = 0; |
6842 if ( (signed int)v531 > 0 ) | |
6843 { | |
6844 do | |
6845 { | |
6846 v533 = dword_50BF30[a2]; | |
924 | 6847 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6848 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
6849 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6850 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6851 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6852 v536 = a2; |
6853 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6854 a2 = v536 + 1; | |
6855 } | |
6856 while ( v536 + 1 < (signed int)v531 ); | |
6857 } | |
6858 v537 = pGame->GetStru6(); | |
6859 pGame->GetStru6()->_4A8BFC(); | |
889 | 6860 LODWORD(v727) = 1; |
890 | 6861 break; |
6862 } | |
6863 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6864 { | |
6865 v538 = v731 - 2; | |
6866 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6867 { | |
6868 amount = 5 * v2; | |
6869 v540 = 18000 * v2; | |
6870 } | |
6871 else | |
6872 { | |
6873 amount = 4 * v2; | |
6874 v540 = 14400 * v2; | |
6875 } | |
6876 v730 = v540; | |
6877 LODWORD(v733) = v540; | |
6878 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6879 break; | |
6880 | |
924 | 6881 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6882 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6883 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6884 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6885 |
6886 v732 = v730 << 7; | |
6887 v549 = (double)(v730 << 7) * 0.033333335; | |
6888 *((float *)&v733 + 1) = v549; | |
6889 v712 = (signed __int64)v549; | |
6890 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6891 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6892 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6893 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6894 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6895 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6896 v550 = v2 + 5; | |
6897 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6898 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6899 v731, | |
6900 v550, 0, 0); | |
6901 | |
6902 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6903 LODWORD(v727) = 1; | |
6904 break; | |
6905 } | |
6906 | |
6907 case SPELL_LIGHT_HOUR_OF_POWER: | |
6908 { | |
6909 v551 = v731 - 2; | |
6910 if ( !v551 ) | |
6911 goto LABEL_998; | |
6912 v552 = v551 - 1; | |
6913 if ( v552 ) | |
6914 { | |
6915 if ( v552 == 1 ) | |
6916 { | |
6917 amount = 15; | |
6918 HIDWORD(v733) = 20; | |
6919 goto LABEL_1000; | |
6920 } | |
6921 LABEL_998: | |
6922 v678 = 4; | |
6923 } | |
6924 else | |
6925 { | |
6926 v678 = 12; | |
6927 } | |
6928 amount = v678; | |
6929 HIDWORD(v733) = v678; | |
6930 LABEL_1000: | |
6931 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6932 break; | |
6933 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6934 v732 = (300 * amount * v2 + 60) << 7; | |
6935 v730 = v2 + 5; | |
6936 int _v726 = 0; | |
6937 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6938 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6939 do | |
6940 { | |
924 | 6941 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6942 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6943 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6944 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 6945 |
890 | 6946 //((SpellBuff *)(v553 + 6056))->Apply( |
6947 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6948 if ( *(_QWORD *)v553 ) | |
6949 _v726 = 1; | |
6950 ++v553; | |
6951 } | |
6952 while ( v553 <= &pParty->pPlayers[3] ); | |
6953 v562 = v731; | |
6954 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6955 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6956 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6957 if (!_v726) | |
6958 { | |
6959 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); | |
6960 } | |
6961 LODWORD(v727) = 1; | |
6962 break; | |
6963 } | |
6964 | |
6965 | |
6966 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
6967 { | |
6968 amount = 3; | |
6969 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6970 { | |
6971 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6972 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6973 pCastSpell->spellnum = 0; |
890 | 6974 continue; |
6975 } | |
6976 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6977 break; | |
6978 a2 = 0; | |
6979 _this = (ItemGen *)&pPlayers[1]; | |
6980 do | |
6981 { | |
6982 v563 = 0; | |
889 | 6983 do |
6984 { | |
890 | 6985 v564 = _this->uItemID; |
6986 *(int *)(v563 + _this->uItemID) = 0; | |
6987 v563 += 8; | |
6988 *(int *)(v563 + v564 - 4) = 0; | |
6989 } | |
6990 while ( v563 <= 128 ); | |
6991 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6992 v566 = (Player **)_this; | |
6993 *(int *)(_this->uItemID + 6460) = v565; | |
6994 v567 = (*v566)->GetMaxMana(); | |
6995 *(int *)(_this->uItemID + 6464) = v567; | |
924 | 6996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 6997 ++a2; |
6998 _this = (ItemGen *)((char *)_this + 4); | |
6999 } | |
7000 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
7001 v571 = pPlayer; | |
7002 v572 = (char *)&pPlayer->sAgeModifier; | |
7003 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
7004 *(short *)v572 = 120; | |
7005 else | |
7006 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
7007 sRecoveryTime += -5 * v2; | |
7008 ++v571->uNumDivineInterventionCastsThisDay; | |
7009 LODWORD(v727) = 1; | |
7010 break; | |
7011 } | |
7012 case SPELL_DARK_REANIMATE: | |
7013 { | |
7014 v573 = v731 - 2; | |
7015 if ( v573 ) | |
7016 { | |
7017 v574 = v573 - 1; | |
7018 if ( v574 ) | |
7019 { | |
7020 if ( v574 == 1 ) | |
7021 v575 = 5 * v2; | |
889 | 7022 else |
890 | 7023 v575 = 2 * v2; |
889 | 7024 } |
7025 else | |
7026 { | |
890 | 7027 v575 = 4 * v2; |
7028 } | |
7029 } | |
7030 else | |
7031 { | |
7032 v575 = 3 * v2; | |
7033 } | |
7034 amount = v575; | |
7035 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7036 break; | |
924 | 7037 v576 = pCastSpell->spell_target_pid; |
890 | 7038 if (!v576) |
7039 { | |
924 | 7040 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7041 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 7042 if ( *((_QWORD *)v585 + 14) ) |
7043 { | |
7044 ((Player *)v585)->SetCondition(0x11u, 1); | |
7045 v587 = ((Player *)v585)->GetSexByVoice(); | |
924 | 7046 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
890 | 7047 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7048 } | |
7049 break; | |
7050 } | |
7051 v577 = (Player *)(PID_ID(v576)); | |
7052 //v726 = v577; | |
7053 if ( v577 == (Player *)-1 ) | |
7054 { | |
7055 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7056 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7057 pCastSpell->spellnum = 0; |
890 | 7058 continue; |
7059 } | |
7060 v578 = (int)&pActors[(int)v577]; | |
7061 v721 = v578; | |
7062 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7063 { | |
7064 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7065 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7066 pCastSpell->spellnum = 0; |
890 | 7067 continue; |
7068 } | |
924 | 7069 ++pSpellSprite.uType; |
7070 pSpellSprite.stru_24.Reset(); | |
7071 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7072 pSpellSprite.spell_level = v2; | |
7073 pSpellSprite.spell_skill = v731; | |
7074 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7075 pSpellSprite.uAttributes = 0; | |
7076 pSpellSprite.uSectorID = 0; | |
7077 pSpellSprite.uSpriteFrameID = 0; | |
7078 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
890 | 7079 v581 = v721; |
924 | 7080 pSpellSprite.uFacing = 0; |
7081 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7082 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7083 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
7084 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
890 | 7085 v732 = *(short *)(v721 + 138); |
924 | 7086 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7087 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7088 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7089 if ( *(char *)(v581 + 52) > amount ) |
7090 break; | |
7091 Actor::Resurrect((unsigned int)v577); | |
7092 *(char *)(v581 + 61) = 0; | |
7093 *(char *)(v581 + 53) = 0; | |
7094 *(char *)(v581 + 54) = 0; | |
7095 *(char *)(v581 + 55) = 0; | |
7096 *(char *)(v581 + 56) = 0; | |
7097 *(char *)(v581 + 57) = 0; | |
7098 *(int *)(v581 + 712) = 9999; | |
7099 *(char *)(v581 + 38) &= 0xF7u; | |
7100 *(int *)(v581 + 708) = 0; | |
7101 ((SpellBuff *)(v581 + 356))->Reset(); | |
7102 ((SpellBuff *)(v581 + 228))->Reset(); | |
7103 ((SpellBuff *)(v581 + 404))->Reset(); | |
7104 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7105 *(short *)(v581 + 40) = 10 * amount; | |
889 | 7106 LODWORD(v727) = 1; |
890 | 7107 break; |
7108 } | |
7109 case SPELL_DARK_VAMPIRIC_WEAPON: | |
7110 { | |
7111 v588 = v731 - 1; | |
7112 amount = 16; | |
7113 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7114 { | |
7115 if ( v590 == 1 ) | |
7116 LODWORD(v733) = 0; | |
7117 } | |
7118 else | |
7119 { | |
7120 LODWORD(v733) = 3600 * v2; | |
7121 } | |
7122 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7123 break; | |
7124 __debugbreak(); | |
924 | 7125 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
890 | 7126 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7127 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7128 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7129 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7130 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7131 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7132 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7133 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7134 { | |
7135 dword_50C9D0 = 113; | |
7136 dword_50C9D4 = 0; | |
7137 dword_50C9D8 = 1; | |
7138 | |
7139 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7140 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7141 pCastSpell->spellnum = 0; |
890 | 7142 continue; |
7143 } | |
7144 v592 = HIDWORD(v733); | |
7145 v14 = v731 == 4; | |
7146 *(int *)(HIDWORD(v733) + 12) = 16; | |
7147 if ( !v14 ) | |
7148 { | |
7149 v732 = (int)v733 << 7; | |
7150 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7151 *(int *)(v592 + 20) |= 8u; | |
7152 } | |
7153 *(char *)(v592 + 20) |= 0x80u; | |
7154 dword_50C9A8 = 256; | |
7155 LODWORD(v727) = 1; | |
7156 break; | |
7157 } | |
7158 case SPELL_DARK_SHARPMETAL: | |
7159 { | |
7160 v593 = v731 - 2; | |
7161 if ( !v593 ) | |
7162 goto LABEL_1062; | |
7163 v594 = v593 - 1; | |
7164 if ( v594 ) | |
7165 { | |
7166 if ( v594 == 1 ) | |
7167 amount = 9; | |
889 | 7168 else |
890 | 7169 LABEL_1062: |
7170 amount = 5; | |
7171 } | |
7172 else | |
7173 { | |
7174 amount = 7; | |
7175 } | |
7176 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7177 break; | |
7178 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
924 | 7179 pSpellSprite.stru_24.Reset(); |
7180 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7181 pSpellSprite.spell_level = v2; | |
7182 pSpellSprite.spell_skill = v731; | |
7183 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7184 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
7185 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
7186 pSpellSprite.uAttributes = 0; | |
7187 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7188 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 7189 pParty->vPosition.x, |
7190 pParty->vPosition.y, | |
7191 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
924 | 7192 pSpellSprite.uSpriteFrameID = 0; |
7193 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7194 pSpellSprite.spell_target_pid = a2; | |
7195 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7196 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7197 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 7198 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 7199 v596 = (signed int)_v726 / -2; |
7200 y = (char *)((signed int)_v726 / 2); | |
7201 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7202 { | |
7203 v597 = v715.uYawAngle; | |
889 | 7204 do |
7205 { | |
924 | 7206 pSpellSprite.uFacing = v596 + v597; |
7207 if ( pSpellSprite.Create( | |
890 | 7208 v596 + v597, |
7209 v715.uPitchAngle, | |
924 | 7210 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7211 pCastSpell->uPlayerID + 1) != -1 | |
890 | 7212 && pParty->bTurnBasedModeOn == 1 ) |
7213 ++pTurnEngine->field_1C; | |
7214 v596 += _v726 / (amount - 1); | |
7215 } | |
7216 while ( v596 <= (signed int)y ); | |
7217 } | |
7218 LODWORD(v727) = 1; | |
7219 break; | |
7220 } | |
7221 | |
7222 case SPELL_DARK_CONTROL_UNDEAD: | |
7223 { | |
7224 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7225 break; | |
7226 if ( v731 == 1 || v731 == 2 ) | |
7227 { | |
7228 v598 = 180 * v2; | |
924 | 7229 LODWORD(v733) = v598; |
7230 goto LABEL_1082; | |
890 | 7231 } |
7232 if ( v731 == 3 ) | |
7233 { | |
7234 v598 = 300 * v2; | |
7235 LODWORD(v733) = v598; | |
7236 goto LABEL_1082; | |
7237 } | |
7238 if ( v731 == 4 ) | |
7239 LODWORD(v733) = 29030400; | |
7240 LABEL_1082: | |
7241 if (PID_TYPE(a2) != OBJECT_Actor) | |
7242 { | |
7243 LODWORD(v727) = 1; | |
7244 break; | |
7245 } | |
7246 v730 = 836 * PID_ID(a2); | |
7247 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7248 break; | |
7249 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7250 { | |
7251 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7252 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7253 pCastSpell->spellnum = 0; |
890 | 7254 continue; |
7255 } | |
7256 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7257 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7258 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7259 v731, 0, 0, 0); | |
924 | 7260 pSpellSprite.stru_24.Reset(); |
7261 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7262 pSpellSprite.spell_level = v2; | |
7263 pSpellSprite.spell_skill = v731; | |
7264 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 7265 v61 = PID_ID(a2); |
7266 LABEL_1086: | |
7267 v600 = pActors[v61].vPosition.y; | |
7268 v601 = pActors[v61].vPosition.x; | |
924 | 7269 pSpellSprite.uObjectDescID = v60; |
7270 pSpellSprite.vPosition.x = v601; | |
890 | 7271 v602 = pActors[v61].uActorHeight; |
7272 v603 = pActors[v61].vPosition.z; | |
924 | 7273 pSpellSprite.vPosition.y = v600; |
890 | 7274 v676 = v603 + v602; |
7275 v665 = v600; | |
924 | 7276 pSpellSprite.vPosition.z = v603 + v602; |
890 | 7277 v657 = v601; |
7278 LABEL_1087: | |
924 | 7279 pSpellSprite.uAttributes = 0; |
7280 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7281 pSpellSprite.uSpriteFrameID = 0; | |
7282 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7283 pSpellSprite.spell_target_pid = a2; | |
7284 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7285 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
7286 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
7287 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7288 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
7289 LODWORD(v727) = 1; | |
7290 break; | |
7291 } | |
890 | 7292 case SPELL_DARK_SACRIFICE: |
7293 { | |
7294 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7295 break; | |
7296 HIDWORD(v733) = 0; | |
7297 memset(&achievedAwardsIndex, 0, 4000); | |
7298 _this = 0; | |
7299 v605 = (char *)pParty->pHirelings; | |
7300 do | |
7301 { | |
7302 if ( *(int *)v605) | |
7303 { | |
7304 v606 = HIDWORD(v733)++; | |
7305 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); | |
7306 } | |
7307 _this = (ItemGen *)((char *)_this + 1); | |
7308 v605 += 76; | |
7309 } | |
7310 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7311 _this = 0; | |
7312 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7313 { | |
7314 v730 = (int)pNPCStats->pNewNPCData; | |
7315 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
889 | 7316 do |
7317 { | |
890 | 7318 if ( *(char *)(v730 + 8) & 0x80 |
7319 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7320 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7321 { | |
7322 v607 = HIDWORD(v733); | |
7323 HIDWORD(v733) += 4; | |
7324 *(int *)v607 = (int)_this + 3; | |
7325 } | |
7326 _this = (ItemGen *)((char *)_this + 1); | |
7327 v730 += 76; | |
7328 } | |
7329 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7330 } | |
924 | 7331 v608 = pCastSpell->uPlayerID_2; |
890 | 7332 if ( v608 != 4 && v608 != 5 |
7333 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7334 || v609 >= 3 ) | |
7335 { | |
7336 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7337 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7338 pCastSpell->spellnum = 0; |
890 | 7339 continue; |
7340 } | |
7341 v610 = 76 * v609; | |
7342 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7343 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7344 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7345 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7346 v612 = pParty->pPlayers; | |
7347 do | |
7348 { | |
7349 v612->sHealth = v612->GetMaxHealth(); | |
7350 v612->sMana = v612->GetMaxMana(); | |
7351 ++v612; | |
7352 } | |
7353 while ( v612 <= &pParty->pPlayers[3] ); | |
7354 v613 = &pOutdoor->ddm; | |
7355 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7356 v613 = &pIndoor->dlv; | |
7357 v613->uReputation += 15; | |
7358 if ( v613->uReputation > 10000 ) | |
7359 v613->uReputation = 10000; | |
7360 LODWORD(v727) = 1; | |
7361 break; | |
7362 } | |
7363 case SPELL_DARK_PAIN_REFLECTION: | |
7364 { | |
7365 if ( v731 <= 0 ) | |
7366 goto LABEL_1119; | |
7367 if ( v731 <= 3 ) | |
7368 { | |
7369 v614 = 300 * (v2 + 12); | |
7370 } | |
7371 else | |
7372 { | |
7373 if ( v731 != 4 ) | |
7374 goto LABEL_1119; | |
7375 v614 = 900 * (v2 + 4); | |
7376 } | |
7377 LODWORD(v733) = v614; | |
7378 LABEL_1119: | |
7379 v615 = v2 + 5; | |
7380 amount = v615; | |
7381 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7382 break; | |
7383 if ( v731 != 3 && v731 != 4 ) | |
7384 { | |
924 | 7385 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
7386 | |
7387 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 | 7388 LODWORD(v727) = 1; |
7389 break; | |
7390 } | |
7391 a2 = 0; | |
7392 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7393 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
7394 do | |
7395 { | |
924 | 7396 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 7397 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); |
7398 ++a2; | |
7399 ++v619; | |
7400 } | |
7401 while ( v619 <= &pParty->pPlayers[3] ); | |
7402 LODWORD(v727) = 1; | |
7403 break; | |
7404 } | |
7405 case SPELL_DARK_SOULDRINKER: | |
7406 { | |
7407 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7408 break; | |
7409 pGame->GetIndoorCamera(); | |
7410 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7411 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7412 v707.x = 0; | |
7413 v707.y = 0; | |
7414 v707.z = 0; | |
924 | 7415 pSpellSprite.stru_24.Reset(); |
7416 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7417 pSpellSprite.spell_level = v2; | |
7418 pSpellSprite.spell_skill = v731; | |
7419 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7420 pSpellSprite.uAttributes = 0; | |
7421 pSpellSprite.uSectorID = 0; | |
7422 pSpellSprite.uSpriteFrameID = 0; | |
7423 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
7424 pSpellSprite.uFacing = 0; | |
7425 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7426 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7427 a2 = 0; |
7428 int _v726 = 0; | |
7429 if ( SHIDWORD(v733) > 0 ) | |
7430 { | |
7431 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
889 | 7432 do |
7433 { | |
890 | 7434 v625 = dword_50BF30[a2]; |
924 | 7435 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; |
7436 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
890 | 7437 //v732 = pActors[v625].uActorHeight; |
924 | 7438 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); |
7439 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7440 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7441 v628 = a2; |
7442 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7443 a2 = v628 + 1; | |
7444 } | |
7445 while ( v628 + 1 < SHIDWORD(v733) ); | |
7446 } | |
7447 v730 = 0; | |
7448 v629 = 1; | |
7449 do | |
7450 { | |
7451 v630 = pPlayers[v629]; | |
7452 if ( !v630->pConditions[2] | |
7453 && !v630->pConditions[12] | |
7454 && !v630->pConditions[13] | |
7455 && !v630->pConditions[14] | |
7456 && !v630->pConditions[15] | |
7457 && !v630->pConditions[16] ) | |
7458 { | |
7459 v631 = v730++; | |
7460 v681[v631] = v629; | |
7461 } | |
7462 ++v629; | |
7463 } | |
7464 while ( v629 <= 4 ); | |
7465 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7466 HIDWORD(v733) = 0; | |
7467 if ( v730 > 0 ) | |
7468 { | |
7469 do | |
7470 { | |
7471 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7472 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7473 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7474 v726->sHealth += v732; | |
7475 //v726 = *(Player **)v632; | |
7476 //v634 = v726->GetMaxHealth(); | |
7477 if ( v726->sHealth > v726->GetMaxHealth()) | |
7478 v726->sHealth = v726->GetMaxHealth(); | |
7479 v635 = HIDWORD(v733); | |
7480 | |
924 | 7481 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); |
890 | 7482 HIDWORD(v733) = v635 + 1; |
7483 } | |
7484 while ( v635 + 1 < v730 ); | |
7485 } | |
7486 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
7487 LODWORD(v727) = 1; | |
7488 break; | |
7489 } | |
7490 | |
7491 case SPELL_DARK_ARMAGEDDON: | |
7492 { | |
7493 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7494 { | |
7495 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7496 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7497 pCastSpell->spellnum = 0; |
890 | 7498 continue; |
7499 } | |
7500 v640 = v731 - 2; | |
7501 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7502 amount = 3; | |
7503 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7504 { | |
7505 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7506 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7507 pCastSpell->spellnum = 0; |
890 | 7508 continue; |
7509 } | |
7510 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7511 break; | |
7512 pParty->armageddon_timer = 256; | |
7513 pParty->field_16140 = v2; | |
7514 ++pPlayer->uNumArmageddonCasts; | |
7515 if ( pParty->bTurnBasedModeOn == 1 ) | |
7516 ++pTurnEngine->field_1C; | |
7517 auto _v726 = 50; | |
7518 do | |
7519 { | |
7520 v642 = rand() % 4096 - 2048; | |
7521 v643 = rand(); | |
7522 v721 = v642 + pParty->vPosition.x; | |
7523 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7524 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7525 v644 = rand(); | |
7526 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7527 --_v726; | |
7528 } | |
7529 while ( _v726 != 0 ); | |
7530 LODWORD(v727) = 1; | |
7531 break; | |
7532 } | |
7533 | |
7534 default: | |
7535 break; | |
7536 } | |
924 | 7537 if ( pCastSpell->field_8 & 0x20 ) |
890 | 7538 { |
7539 if ( v727 != 0.0 ) | |
924 | 7540 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 7541 } |
7542 else | |
7543 { | |
7544 if ( sRecoveryTime < 0 ) | |
7545 sRecoveryTime = 0; | |
7546 if ( pParty->bTurnBasedModeOn ) | |
7547 { | |
7548 v645 = sRecoveryTime; | |
924 | 7549 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 7550 pPlayer->SetRecoveryTime(v645); |
7551 if ( !some_active_character ) | |
7552 pTurnEngine->_40471C(); | |
7553 } | |
7554 else | |
7555 { | |
7556 pPlayer->SetRecoveryTime( | |
7557 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
7558 } | |
7559 if ( v727 != 0.0 ) | |
7560 { | |
7561 pPlayer->PlaySound(SPEECH_49, 0); | |
7562 if ( v727 != 0.0 ) | |
924 | 7563 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
7564 pCastSpell->spellnum = 0; | |
890 | 7565 v2 = v723; |
7566 continue; | |
889 | 7567 } |
7568 } | |
924 | 7569 pCastSpell->spellnum = 0; |
890 | 7570 v2 = v723; |
7571 continue; | |
7572 | |
889 | 7573 //LABEL_1166: |
7574 // ++n; | |
7575 // if ( n >= 10 ) | |
7576 // return; | |
0 | 7577 } |
488 | 7578 |
889 | 7579 |
0 | 7580 } |
7581 //----- (0042EB42) -------------------------------------------------------- | |
7582 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7583 { | |
7584 unsigned int v2; // edx@1 | |
7585 signed int v3; // eax@1 | |
7586 char *v4; // ecx@2 | |
7587 | |
7588 v2 = this->uNumObjects; | |
7589 v3 = 0; | |
7590 if ( (signed int)this->uNumObjects <= 0 ) | |
7591 { | |
7592 LABEL_5: | |
7593 LOWORD(v3) = 0; | |
7594 } | |
7595 else | |
7596 { | |
7597 v4 = (char *)&this->pObjects->uObjectID; | |
7598 while ( uItemID != *(short *)v4 ) | |
7599 { | |
7600 ++v3; | |
7601 v4 += 56; | |
7602 if ( v3 >= (signed int)v2 ) | |
7603 goto LABEL_5; | |
7604 } | |
7605 } | |
7606 return v3; | |
7607 } | |
7608 | |
7609 //----- (0042EB78) -------------------------------------------------------- | |
7610 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7611 { | |
7612 return 8 * this->pIcons[uIconID].uAnimLength; | |
7613 } | |
7614 | |
437 | 7615 const wchar_t *UIMessage2String(UIMessageType msg) |
7616 { | |
7617 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7618 static wchar_t b[256]; // bad for threads | |
7619 switch (msg) | |
7620 { | |
7621 CASE(UIMSG_SelectSpell) | |
7622 CASE(UIMSG_ChangeGameState) | |
7623 CASE(UIMSG_Attack) | |
7624 CASE(UIMSG_PlayArcomage) | |
7625 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7626 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7627 CASE(UIMSG_ShowCredits) | |
7628 CASE(UIMSG_ExitToWindows) | |
7629 CASE(UIMSG_PlayerCreationChangeName) | |
7630 CASE(UIMSG_PlayerCreationClickPlus) | |
7631 CASE(UIMSG_PlayerCreationClickMinus) | |
7632 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7633 CASE(UIMSG_PlayerCreationSelectClass) | |
7634 CASE(UIMSG_PlayerCreationClickOK) | |
7635 CASE(UIMSG_PlayerCreationClickReset) | |
7636 CASE(UIMSG_AutonotesBook) | |
7637 CASE(UIMSG_PlayerCreationRemoveUpSkill) | |
7638 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7639 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7640 CASE(UIMSG_LoadGame) | |
7641 CASE(UIMSG_SaveGame) | |
7642 CASE(UIMSG_ShowStatus_DateTime) | |
7643 CASE(UIMSG_ShowStatus_ManaHP) | |
7644 CASE(UIMSG_ShowStatus_Player) | |
7645 CASE(UIMSG_Wait5Minutes) | |
7646 CASE(UIMSG_Wait1Hour) | |
7647 CASE(UIMSG_ShowStatus_Food) | |
7648 CASE(UIMSG_ShowStatus_Funds) | |
7649 CASE(UIMSG_QuickReference) | |
7650 CASE(UIMSG_GameMenuButton) | |
7651 CASE(UIMSG_AlreadyResting) | |
7652 CASE(UIMSG_SelectCharacter) | |
7653 CASE(UIMSG_ChangeSoundVolume) | |
7654 CASE(UIMSG_ChangeMusicVolume) | |
7655 CASE(UIMSG_Escape) | |
7656 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7657 CASE(UIMSG_InventoryLeftClick) | |
7658 CASE(UIMSG_SkillUp) | |
7659 CASE(UIMSG_GameMenu_ReturnToGame) | |
7660 CASE(UIMSG_StartNewGame) | |
7661 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7662 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7663 CASE(UIMSG_Game_OpenOptionsDialog) | |
7664 CASE(UIMSG_SetGraphicsMode) | |
7665 CASE(UIMSG_Quit) | |
7666 CASE(UIMSG_StartHireling1Dialogue) | |
7667 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7668 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7669 CASE(UIMSG_CastSpellFromBook) |
7670 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7671 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7672 CASE(UIMSG_StartNPCDialogue) | |
7673 CASE(UIMSG_ArrowUp) | |
7674 CASE(UIMSG_DownArrow) | |
7675 CASE(UIMSG_LoadSlot) | |
7676 CASE(UIMSG_SelectLoadSlot) | |
7677 CASE(UIMSG_Cancel) | |
7678 CASE(UIMSG_ExitRest) | |
7679 CASE(UIMSG_PlayerCreation_FacePrev) | |
7680 CASE(UIMSG_PlayerCreation_FaceNext) | |
7681 CASE(UIMSG_CycleCharacters) | |
7682 CASE(UIMSG_SetTurnSpeed) | |
7683 CASE(UIMSG_ToggleWalkSound) | |
7684 CASE(UIMSG_ChangeVoiceVolume) | |
7685 CASE(UIMSG_ToggleShowDamage) | |
7686 CASE(UIMSG_ScrollNPCPanel) | |
7687 CASE(UIMSG_ShowFinalWindow) | |
7688 CASE(UIMSG_OpenQuestBook) | |
7689 CASE(UIMSG_OpenAutonotes) | |
7690 CASE(UIMSG_OpenMapBook) | |
7691 CASE(UIMSG_OpenCalendar) | |
7692 CASE(UIMSG_OpenHistoryBook) | |
7693 CASE(UIMSG_ToggleAlwaysRun) | |
7694 CASE(UIMSG_ToggleFlipOnExit) | |
7695 CASE(UIMSG_Game_Action) | |
907 | 7696 CASE(UIMSG_RentRoom) |
437 | 7697 CASE(UIMSG_TransitionUI_Confirm) |
7698 CASE(UIMSG_OpenKeyMappingOptions) | |
7699 CASE(UIMSG_SelectKeyPage1) | |
7700 CASE(UIMSG_SelectKeyPage2) | |
7701 CASE(UIMSG_ResetKeyMapping) | |
7702 CASE(UIMSG_ChangeKeyButton) | |
7703 CASE(UIMSG_OpenVideoOptions) | |
7704 CASE(UIMSG_ToggleBloodsplats) | |
7705 CASE(UIMSG_ToggleColoredLights) | |
7706 CASE(UIMSG_ToggleTint) | |
7707 default: | |
7708 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7709 }; | |
7710 #undef CASE | |
7711 } | |
7712 | |
0 | 7713 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7714 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7715 { |
482 | 7716 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7717 if (uNumMessages < 40) |
7718 { | |
437 | 7719 files[uNumMessages] = file; |
7720 lines[uNumMessages] = line; | |
7721 | |
0 | 7722 pMessages[uNumMessages].eType = msg; |
7723 pMessages[uNumMessages].param = param; | |
7724 pMessages[uNumMessages++].field_8 = a4; | |
7725 } | |
7726 } | |
7727 | |
7728 //----- (0042EBBE) -------------------------------------------------------- | |
7729 int __fastcall sub_42EBBE(int a1, int a2) | |
7730 { | |
7731 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7732 } | |
7733 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7734 | |
7735 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7736 int stru193_math::Sin(int angle) |
0 | 7737 { |
323 | 7738 return Cos(angle - this->uIntegerHalfPi); |
0 | 7739 } |
7740 | |
7741 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7742 void _42ECB5_PlayerAttacksActor() |
0 | 7743 { |
271 | 7744 //unsigned int v0; // ebx@1 |
7745 //Player *v1; // esi@1 | |
7746 //bool result; // eax@1 | |
295 | 7747 //int v3; // edi@2 |
271 | 7748 //unsigned int v4; // eax@7 |
0 | 7749 char *v5; // eax@8 |
271 | 7750 //int v6; // ecx@9 |
7751 //signed int v7; // eax@16 | |
295 | 7752 //Actor *v8; // edi@20 |
0 | 7753 unsigned int v9; // ecx@21 |
295 | 7754 //char *v10; // eax@26 |
0 | 7755 char *v11; // eax@26 |
7756 unsigned int v12; // eax@47 | |
295 | 7757 //char *v13; // eax@47 |
7758 //char *v14; // eax@47 | |
7759 //unsigned int v15; // ebx@54 | |
7760 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7761 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7762 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7763 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7764 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7765 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7766 //int v22; // [sp-4h] [bp-40h]@24 | |
7767 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7768 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7769 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7770 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7771 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7772 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7773 //unsigned int *v28b; |
295 | 7774 //int v29; // [sp+24h] [bp-18h]@16 |
7775 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7776 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7777 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7778 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7779 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7780 |
271 | 7781 //v0 = uActiveCharacter; |
7782 //v27 = 6972 * uActiveCharacter; | |
7783 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7784 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7785 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7786 if (!player->CanAct()) | |
7787 return; | |
7788 | |
924 | 7789 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 7790 //v3 = 0; |
271 | 7791 if (pParty->Invisible()) |
7792 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7793 | |
7794 //v31 = player->pEquipment.uBow; | |
7795 int bow_idx = player->pEquipment.uBow; | |
7796 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7797 bow_idx = 0; | |
7798 | |
295 | 7799 //v32 = 0; |
7800 int wand_item_id = 0; | |
271 | 7801 //v33 = 0; |
7802 //v4 = v1->pEquipment.uMainHand; | |
7803 int laser_weapon_item_id = 0; | |
7804 | |
7805 int main_hand_idx = player->pEquipment.uMainHand; | |
7806 if (main_hand_idx) | |
0 | 7807 { |
271 | 7808 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7809 //v5 = (char *)v1 + 36 * v4; |
271 | 7810 if (!item->Broken()) |
7811 { | |
7812 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7813 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7814 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7815 { |
295 | 7816 if (item->uNumCharges <= 0) |
7817 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7818 else |
295 | 7819 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7820 } |
271 | 7821 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7822 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7823 } |
271 | 7824 } |
7825 | |
295 | 7826 //v30 = 0; |
7827 //v29 = 0; | |
7828 //v28 = 0; | |
271 | 7829 //v7 = pMouse->uPointingObjectID; |
7830 | |
7831 int target_pid = pMouse->uPointingObjectID; | |
848 | 7832 int target_type = PID_TYPE(target_pid), |
7833 target_id = PID_ID(target_pid); | |
271 | 7834 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7835 { | |
7836 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7837 target_type = PID_TYPE(target_pid); |
7838 target_id = PID_ID(target_pid); | |
271 | 7839 } |
295 | 7840 |
7841 auto actor = &pActors[target_id]; | |
7842 int actor_distance = 0; | |
271 | 7843 if (target_type == OBJECT_Actor) |
7844 { | |
295 | 7845 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7846 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7847 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7848 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7849 if (actor_distance < 0) | |
7850 actor_distance = 0; | |
7851 } | |
7852 | |
7853 bool shooting_bow = false, | |
7854 shotting_laser = false, | |
816 | 7855 shooting_wand = false, |
7856 melee_attack = false; | |
295 | 7857 if (laser_weapon_item_id) |
7858 { | |
7859 shotting_laser = true; | |
490 | 7860 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7861 } |
7862 else if (wand_item_id) | |
7863 { | |
7864 shooting_wand = true; | |
7865 | |
7866 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7867 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7868 |
7869 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7870 player->pEquipment.uMainHand = 0; | |
7871 } | |
303 | 7872 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7873 { |
816 | 7874 melee_attack = true; |
7875 | |
303 | 7876 Vec3_int_ a3; |
7877 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7878 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7879 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7880 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7881 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7882 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7883 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7884 _42FA66_do_explosive_impact( |
7885 actor->vPosition.x, | |
7886 actor->vPosition.y, | |
7887 actor->vPosition.z + actor->uActorHeight / 2, | |
7888 0, 512, uActiveCharacter); | |
303 | 7889 } |
7890 else if (bow_idx) | |
7891 { | |
7892 shooting_bow = true; | |
490 | 7893 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7894 } |
7895 else | |
7896 { | |
816 | 7897 melee_attack = true; |
303 | 7898 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7899 } | |
7900 | |
816 | 7901 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7902 { |
816 | 7903 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7904 if (recovery < 30 ) |
7905 recovery = 30; | |
816 | 7906 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7907 } |
7908 | |
7909 | |
7910 int v34 = 0; | |
7911 if (shooting_wand) | |
7912 return; | |
7913 else if (shooting_bow) | |
7914 { | |
7915 v34 = 5; | |
7916 player->PlaySound(SPEECH_50, 0); | |
7917 } | |
7918 if (shotting_laser) | |
7919 v34 = 7; | |
7920 else | |
7921 { | |
7922 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7923 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7924 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7925 pTurnEngine->_40471C(); | |
7926 } | |
7927 | |
7928 switch (v34) | |
7929 { | |
7930 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7931 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7932 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7933 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7934 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7935 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7936 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7937 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7938 } | |
0 | 7939 } |
7940 | |
7941 //----- (0042F184) -------------------------------------------------------- | |
295 | 7942 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7943 { |
7944 int v4; // edi@1 | |
7945 stru319 *v5; // esi@1 | |
7946 int v6; // eax@2 | |
7947 int v7; // eax@4 | |
7948 int result; // eax@5 | |
7949 int *v9; // edx@8 | |
7950 signed int v10; // ebx@10 | |
7951 int v11; // edi@11 | |
7952 Actor *v12; // esi@12 | |
7953 unsigned __int16 v13; // ax@12 | |
7954 int v14; // eax@22 | |
7955 char v15; // zf@30 | |
7956 int v16; // esi@32 | |
7957 int v17; // ecx@34 | |
7958 stru319 *v18; // eax@39 | |
7959 int v19; // edx@39 | |
7960 int v20; // ecx@41 | |
7961 unsigned __int16 v21; // ax@42 | |
7962 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7963 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7964 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7965 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7966 int *v26; // [sp+18h] [bp-14h]@8 | |
7967 int v27; // [sp+1Ch] [bp-10h]@10 | |
7968 int *v28; // [sp+20h] [bp-Ch]@10 | |
7969 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7970 int v30; // [sp+28h] [bp-4h]@6 | |
7971 int i; // [sp+38h] [bp+Ch]@33 | |
7972 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7973 | |
7974 v4 = 0; | |
7975 v5 = this; | |
7976 v24 = this; | |
7977 if ( pRenderer->pRenderD3D ) | |
7978 { | |
7979 v6 = a3 != 0; | |
7980 if ( a4 ) | |
7981 LOBYTE(v6) = v6 | 8; | |
295 | 7982 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7983 if ( v7 != -1 ) |
7984 return (unsigned __int16)v7; | |
295 | 7985 else return 0; |
0 | 7986 } |
7987 else | |
7988 { | |
7989 v30 = 0; | |
7990 if ( pRenderer->pActiveZBuffer ) | |
7991 { | |
692 | 7992 v29 = viewparams->uScreen_topL_X; |
7993 v23 = viewparams->uScreen_BttmR_X; | |
7994 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7995 { |
692 | 7996 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7997 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7998 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7999 do |
8000 { | |
8001 if ( (signed int)v29 < (signed int)v23 ) | |
8002 { | |
8003 v28 = v9; | |
8004 v10 = v4; | |
8005 v27 = v23 - v29; | |
8006 do | |
8007 { | |
8008 v22 = *v28; | |
8009 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8010 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 8011 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8012 v12 = &pActors[PID_ID(v11)]; |
0 | 8013 v13 = v12->uAIState; |
8014 if ( v13 != 5 ) | |
8015 { | |
8016 if ( v13 != 4 | |
8017 && v13 != 11 | |
8018 && v13 != 19 | |
8019 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8020 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 8021 { |
8022 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 8023 && v22 <= pick_depth << 16 ) |
0 | 8024 { |
8025 v14 = 0; | |
8026 if ( v10 > 0 ) | |
8027 { | |
8028 do | |
8029 { | |
8030 if ( dword_50BDA0[v14] == v11 ) | |
8031 break; | |
8032 ++v14; | |
8033 } | |
8034 while ( v14 < v30 ); | |
8035 } | |
8036 if ( v14 == v30 && v10 < 100 ) | |
8037 { | |
8038 ++v30; | |
8039 dword_50BC10[v10] = v22; | |
8040 dword_50BDA0[v10] = v11; | |
8041 ++v10; | |
8042 } | |
8043 } | |
8044 } | |
8045 } | |
8046 } | |
8047 ++v28; | |
8048 --v27; | |
8049 } | |
8050 while ( v27 ); | |
8051 v4 = v30; | |
8052 v5 = v24; | |
8053 } | |
8054 v9 = v26 + 640; | |
8055 v15 = v25-- == 1; | |
8056 v26 += 640; | |
8057 } | |
8058 while ( !v15 ); | |
8059 } | |
8060 if ( v4 > 0 ) | |
8061 { | |
8062 v32 = 1; | |
8063 v16 = (int)dword_50BC10; | |
8064 do | |
8065 { | |
8066 for ( i = v32; i < v4; ++i ) | |
8067 { | |
8068 v17 = dword_50BC10[i]; | |
8069 if ( v17 < *(int *)v16 ) | |
8070 { | |
8071 dword_50BC10[i] = *(int *)v16; | |
8072 *(int *)v16 = v17; | |
8073 } | |
8074 } | |
8075 ++v32; | |
8076 v16 += 4; | |
8077 } | |
8078 while ( v32 - 1 < v4 ); | |
8079 v5 = v24; | |
8080 if ( v4 > 0 ) | |
8081 { | |
8082 v18 = v24; | |
8083 v19 = v4; | |
8084 do | |
8085 { | |
8086 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8087 v18 += 4; | |
8088 --v19; | |
8089 } | |
8090 while ( v19 ); | |
8091 } | |
8092 } | |
8093 v20 = 0; | |
8094 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8095 { | |
8096 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8097 if ( v21 != 4 && v21 != 5 ) | |
8098 break; | |
8099 } | |
8100 if ( v20 != v4 ) | |
8101 { | |
8102 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8103 LOBYTE(result) = result | 3; | |
8104 return result; | |
8105 } | |
8106 } | |
8107 } | |
8108 return 0; | |
8109 } | |
8110 | |
8111 //----- (0042F3D6) -------------------------------------------------------- | |
8112 void InitializeTurnBasedAnimations(void *_this) | |
8113 { | |
8114 unsigned int *v1; // edi@1 | |
8115 | |
8116 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8117 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8118 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8119 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8120 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8121 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8122 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8123 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8124 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8125 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8126 v1 = pIconIDs_Turn; | |
8127 do | |
8128 { | |
8129 pIconsFrameTable->InitializeAnimation(*v1); | |
8130 ++v1; | |
8131 } | |
8132 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8133 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8134 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8135 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8136 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8137 } | |
8138 | |
8139 //----- (0042F4DA) -------------------------------------------------------- | |
8140 signed int __cdecl sub_42F4DA() | |
8141 { | |
8142 signed int v0; // edi@1 | |
82 | 8143 Actor *v1; // esi@4 |
0 | 8144 int v2; // ebx@5 |
8145 int v3; // eax@5 | |
8146 int v4; // ebx@5 | |
8147 unsigned int v5; // ecx@5 | |
8148 int v6; // edx@6 | |
8149 unsigned int v7; // edx@8 | |
8150 unsigned int v8; // edx@10 | |
8151 __int16 v9; // ax@12 | |
8152 signed int result; // eax@20 | |
8153 int v11; // [sp+Ch] [bp-10h]@5 | |
8154 int v12; // [sp+10h] [bp-Ch]@5 | |
8155 signed int v13; // [sp+14h] [bp-8h]@3 | |
8156 | |
8157 v0 = 5120; | |
8158 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8159 v0 = 2560; | |
8160 v13 = 0; | |
8161 if ( (signed int)uNumActors <= 0 ) | |
8162 { | |
8163 LABEL_20: | |
8164 result = 0; | |
8165 } | |
8166 else | |
8167 { | |
82 | 8168 v1 = pActors; |
0 | 8169 while ( 1 ) |
8170 { | |
82 | 8171 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8172 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8173 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8174 v3 = v2; |
8175 v4 = v11; | |
8176 v5 = v12; | |
8177 if ( v3 < v11 ) | |
8178 { | |
8179 v6 = v3; | |
8180 v3 = v11; | |
8181 v4 = v6; | |
8182 } | |
8183 if ( v3 < v12 ) | |
8184 { | |
8185 v7 = v3; | |
8186 v3 = v12; | |
8187 v5 = v7; | |
8188 } | |
8189 if ( v4 < (signed int)v5 ) | |
8190 { | |
8191 v8 = v5; | |
8192 v5 = v4; | |
8193 v4 = v8; | |
8194 } | |
8195 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8196 { | |
82 | 8197 v9 = v1->uAIState; |
8198 if ( v1->uAIState != 5 ) | |
0 | 8199 { |
8200 if ( v9 != 4 | |
8201 && v9 != 11 | |
8202 && v9 != 19 | |
8203 && v9 != 17 | |
82 | 8204 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8205 break; |
8206 } | |
8207 } | |
8208 ++v13; | |
82 | 8209 ++v1; |
0 | 8210 if ( v13 >= (signed int)uNumActors ) |
8211 goto LABEL_20; | |
8212 } | |
8213 result = 1; | |
8214 } | |
8215 return result; | |
8216 } | |
8217 | |
8218 //----- (0042F7EB) -------------------------------------------------------- | |
8219 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) | |
8220 { | |
8221 unsigned int v9; // edi@1 | |
8222 signed int v10; // edx@3 | |
8223 char *v11; // ecx@4 | |
8224 unsigned __int16 v12; // ax@7 | |
8225 unsigned int v13; // edx@9 | |
8226 char *v14; // ecx@10 | |
8227 int v15; // esi@17 | |
8228 int v16; // eax@18 | |
8229 int v17; // edi@20 | |
8230 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8231 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8232 int v21; // [sp+7Ch] [bp-8h]@1 |
8233 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8234 | |
8235 v9 = uSpriteID; | |
8236 v21 = x; | |
8237 v22 = uSpriteID; | |
8238 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8239 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
|
8240 //SpriteObject::SpriteObject(&a1a); |
0 | 8241 a1a.stru_24.Reset(); |
8242 | |
8243 if ( a9 ) | |
8244 { | |
8245 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8246 v9 = v22; | |
8247 } | |
8248 v10 = 0; | |
822 | 8249 a1a.spell_skill = 0; |
8250 a1a.spell_level = 0; | |
8251 a1a.spell_id = 0; | |
0 | 8252 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8253 a1a.uType = v9; |
0 | 8254 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8255 { | |
8256 LABEL_7: | |
8257 v12 = 0; | |
8258 } | |
8259 else | |
8260 { | |
8261 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8262 while ( (short)v9 != *(short *)v11 ) | |
8263 { | |
8264 ++v10; | |
8265 v11 += 56; | |
8266 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8267 goto LABEL_7; | |
8268 } | |
8269 v12 = v10; | |
8270 } | |
8271 a1a.uObjectDescID = v12; | |
8272 a1a.vPosition.z = z; | |
8273 a1a.vPosition.x = v21; | |
8274 a1a.vPosition.y = y; | |
8275 a1a.uSoundID = 0; | |
8276 a1a.uAttributes = attributes; | |
8277 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8278 a1a.uSpriteFrameID = 0; | |
822 | 8279 a1a.spell_caster_pid = 0; |
823 | 8280 a1a.spell_target_pid = 0; |
0 | 8281 if ( !(a1a.uAttributes & 0x10) ) |
8282 { | |
8283 v13 = 0; | |
222 | 8284 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8285 { |
8286 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8287 while ( *(short *)v14 != v9 ) | |
8288 { | |
8289 ++v13; | |
8290 v14 += 48; | |
222 | 8291 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8292 goto LABEL_16; |
8293 } | |
8294 a1a.stru_24.uItemID = v13; | |
8295 } | |
8296 } | |
8297 LABEL_16: | |
8298 if ( a7 ) | |
8299 { | |
8300 v15 = count; | |
8301 if ( count > 0 ) | |
8302 { | |
8303 do | |
8304 { | |
8305 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8306 v16 = rand(); | |
8307 a1a.Create( | |
8308 (signed __int16)a1a.uFacing, | |
8309 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8310 a4, | |
8311 0); | |
8312 --v15; | |
8313 } | |
8314 while ( v15 ); | |
8315 } | |
8316 } | |
8317 else | |
8318 { | |
8319 v17 = count; | |
8320 v18 = stru_5C6E00->uIntegerHalfPi; | |
8321 a1a.uFacing = 0; | |
8322 if ( count > 0 ) | |
8323 { | |
8324 do | |
8325 { | |
8326 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8327 --v17; | |
8328 } | |
8329 while ( v17 ); | |
8330 } | |
8331 } | |
8332 return 1; | |
8333 } | |
8334 | |
8335 //----- (0042F960) -------------------------------------------------------- | |
8336 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8337 { | |
8338 int v3; // ebx@1 | |
8339 int v4; // edi@1 | |
8340 signed int v5; // edx@1 | |
8341 char *v6; // ecx@2 | |
8342 unsigned __int16 v7; // ax@5 | |
8343 signed int v8; // eax@6 | |
8344 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8345 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8346 |
8347 v3 = x; | |
8348 v4 = y; | |
8349 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8350 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
|
8351 //SpriteObject::SpriteObject(&a1); |
0 | 8352 a1.stru_24.Reset(); |
8353 | |
8354 v5 = 0; | |
822 | 8355 a1.spell_skill = 0; |
8356 a1.spell_level = 0; | |
8357 a1.spell_id = 0; | |
0 | 8358 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8359 a1.uType = 800; |
0 | 8360 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8361 { | |
8362 LABEL_5: | |
8363 v7 = 0; | |
8364 } | |
8365 else | |
8366 { | |
8367 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8368 while ( *(short *)v6 != 800 ) | |
8369 { | |
8370 ++v5; | |
8371 v6 += 56; | |
8372 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8373 goto LABEL_5; | |
8374 } | |
8375 v7 = v5; | |
8376 } | |
8377 a1.uObjectDescID = v7; | |
8378 a1.vPosition.x = v3; | |
8379 a1.vPosition.y = v4; | |
8380 a1.vPosition.z = z; | |
8381 a1.uSoundID = 0; | |
8382 a1.uAttributes = 0; | |
8383 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8384 a1.uSpriteFrameID = 0; | |
822 | 8385 a1.spell_caster_pid = 0; |
823 | 8386 a1.spell_target_pid = 0; |
0 | 8387 v8 = a1.Create(0, 0, 0, 0); |
8388 if ( v8 != -1 ) | |
8389 { | |
8390 v9 = 8 * v8; | |
8391 LOBYTE(v9) = v9 | 2; | |
8392 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8393 } | |
8394 } | |
8395 | |
810 | 8396 |
0 | 8397 |
8398 //----- (0042FA66) -------------------------------------------------------- | |
8399 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8400 { | |
8401 int v6; // edi@1 | |
8402 int v7; // esi@1 | |
8403 char *v8; // ecx@2 | |
8404 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8405 //int v10; // eax@10 |
0 | 8406 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8407 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8408 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8409 int v14; // [sp+7Ch] [bp-4h]@1 |
8410 | |
8411 v6 = a1; | |
8412 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8413 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
|
8414 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8415 a1a.uType = 600; |
0 | 8416 a1a.stru_24.Reset(); |
8417 | |
822 | 8418 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8419 a1a.spell_level = 8; | |
8420 a1a.spell_skill = 3; | |
0 | 8421 v14 = 0; |
8422 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8423 { | |
8424 LABEL_5: | |
8425 v9 = 0; | |
8426 } | |
8427 else | |
8428 { | |
8429 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8430 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8431 { |
8432 ++v14; | |
8433 v8 += 56; | |
8434 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8435 goto LABEL_5; | |
8436 } | |
8437 v9 = v14; | |
8438 } | |
8439 a1a.uObjectDescID = v9; | |
8440 a1a.vPosition.x = v6; | |
8441 a1a.vPosition.y = v7; | |
8442 a1a.vPosition.z = a3; | |
8443 a1a.uAttributes = 0; | |
8444 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8445 a1a.uSpriteFrameID = 0; | |
823 | 8446 a1a.spell_target_pid = 0; |
0 | 8447 a1a.field_60_distance_related_prolly_lod = 0; |
8448 a1a.uFacing = 0; | |
8449 a1a.uSoundID = 0; | |
8450 if ( a6 >= 1 || a6 <= 4 ) | |
8451 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8452 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8453 } |
8454 else | |
8455 { | |
822 | 8456 a1a.spell_caster_pid = 0; |
0 | 8457 } |
8458 result = a1a.Create(0, 0, 0, 0); | |
8459 if ( result != -1 ) | |
8460 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8461 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8462 a5, |
8463 SLOWORD(a1a.vPosition.x), | |
8464 SLOWORD(a1a.vPosition.y), | |
8465 SLOWORD(a1a.vPosition.z), | |
8466 0, | |
8467 0); | |
8468 } | |
8469 return result; | |
8470 } | |
8471 | |
8472 //----- (0042FB5C) -------------------------------------------------------- | |
8473 bool __fastcall sub_42FB5C(signed int a1) | |
8474 { | |
8475 int v1; // ecx@3 | |
8476 int v2; // ecx@4 | |
8477 int v3; // ecx@5 | |
8478 int v4; // ecx@6 | |
8479 int v5; // ecx@7 | |
8480 int v6; // ecx@8 | |
8481 char v7; // zf@9 | |
8482 | |
8483 if ( a1 > 39 ) | |
8484 { | |
8485 if ( a1 > 77 ) | |
8486 { | |
8487 if ( a1 == 80 ) | |
8488 return 0; | |
8489 if ( a1 > 84 ) | |
8490 { | |
8491 if ( a1 <= 86 ) | |
8492 return 0; | |
8493 v7 = a1 == 95; | |
8494 goto LABEL_20; | |
8495 } | |
8496 } | |
8497 else | |
8498 { | |
8499 if ( a1 == 77 ) | |
8500 return 0; | |
8501 if ( a1 >= 46 ) | |
8502 { | |
8503 if ( a1 <= 47 || a1 == 51 ) | |
8504 return 0; | |
8505 v7 = a1 == 73; | |
8506 goto LABEL_20; | |
8507 } | |
8508 } | |
8509 return 1; | |
8510 } | |
8511 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8512 return 1; | |
8513 v2 = v1 - 3; | |
8514 if ( !v2 ) | |
8515 return 0; | |
8516 v3 = v2 - 1; | |
8517 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8518 return 1; | |
8519 v5 = v4 - 8; | |
8520 if ( !v5 ) | |
8521 return 0; | |
8522 v6 = v5 - 1; | |
8523 if ( !v6 ) | |
8524 return 1; | |
8525 v7 = v6 == 20; | |
8526 LABEL_20: | |
8527 if ( !v7 ) | |
8528 return 1; | |
8529 return 0; | |
8530 } | |
8531 | |
8532 //----- (0042FBDD) -------------------------------------------------------- | |
8533 void __cdecl sub_42FBDD() | |
8534 { | |
388 | 8535 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8536 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8537 pRenderer->Present(); | |
8538 } | |
8539 | |
8540 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8541 void __cdecl CloseWindowBackground() |
0 | 8542 { |
388 | 8543 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8544 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8545 pRenderer->Present(); | |
8546 } | |
8547 | |
8548 //----- (0042FC4E) -------------------------------------------------------- | |
8549 void __cdecl ProcessInputActions() | |
8550 { | |
8551 ActionQueue *pActionQueue; // esi@7 | |
832 | 8552 //Keyboard *v3; // ecx@8 |
0 | 8553 char v4; // al@9 |
8554 ActionQueue *v5; // ecx@19 | |
8555 Player *v6; // ecx@86 | |
8556 Player *v7; // esi@100 | |
8557 char v8; // bl@100 | |
8558 unsigned __int16 v9; // ax@102 | |
8559 int v10; // eax@103 | |
8560 unsigned int v11; // eax@127 | |
8561 signed int v12; // esi@157 | |
8562 Keyboard *v13; // ecx@158 | |
8563 char v14; // al@159 | |
8564 unsigned int v15; // eax@168 | |
8565 void *v16; // esi@177 | |
8566 int v17; // [sp-14h] [bp-1Ch]@8 | |
8567 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8568 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 | |
271 | 8569 //__int16 v20; // [sp-14h] [bp-1Ch]@60 |
0 | 8570 int v21; // [sp-14h] [bp-1Ch]@68 |
8571 int v22; // [sp-Ch] [bp-14h]@158 | |
8572 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8573 int v24; // [sp+4h] [bp-4h]@87 | |
8574 | |
8575 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8576 auto pKeyboard = pGame->pKeyboardInstance; | |
8577 if (!bAlwaysRun) | |
8578 { | |
8579 if (pKeyboard->IsShiftHeld()) | |
8580 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8581 else | |
8582 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8583 } | |
8584 else | |
8585 { | |
8586 if (pKeyboard->IsShiftHeld()) | |
8587 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8588 else | |
8589 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8590 } | |
8591 | |
140 | 8592 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
486 | 8593 //LABEL_6: |
0 | 8594 if ( !pEventTimer->bPaused ) |
8595 { | |
8596 inputAction = (InputAction)0; | |
8597 pActionQueue = pPartyActionQueue; | |
8598 while ( 1 ) | |
8599 { | |
8600 v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; | |
8601 if ( pKeyActionMap->pToggleTypes[inputAction] ) | |
832 | 8602 v4 = pKeyboard->WasKeyPressed(v17); |
0 | 8603 else |
832 | 8604 v4 = pKeyboard->IsKeyBeingHeld(v17); |
0 | 8605 if ( v4 ) |
8606 { | |
8607 switch ( inputAction ) | |
8608 { | |
8609 case INPUT_MoveForward: | |
271 | 8610 if (pCurrentScreen != SCREEN_GAME) |
0 | 8611 break; |
8612 if (!pParty->bTurnBasedModeOn) | |
163 | 8613 //goto _do_move_forward; |
0 | 8614 { |
8615 v5 = pActionQueue; | |
140 | 8616 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8617 partyAction = PARTY_RunForward; |
8618 else | |
8619 partyAction = PARTY_WalkForward; | |
163 | 8620 //goto _add_action_and_continue; |
8621 v5->Add(partyAction); | |
8622 break; | |
8623 } | |
8624 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8625 { | |
8626 pTurnEngine->uActionPointsLeft -= 26; | |
8627 //_do_move_forward: | |
8628 v5 = pActionQueue; | |
8629 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8630 partyAction = PARTY_RunForward; | |
8631 else | |
8632 partyAction = PARTY_WalkForward; | |
8633 //goto _add_action_and_continue; | |
8634 v5->Add(partyAction); | |
8635 break; | |
0 | 8636 } |
8637 break; | |
8638 case INPUT_MoveBackwards: | |
17 | 8639 //__debugbreak(); |
271 | 8640 if (pCurrentScreen != SCREEN_GAME) |
0 | 8641 break; |
8642 if (!pParty->bTurnBasedModeOn) | |
17 | 8643 //goto _do_move_backwards; |
8644 { | |
8645 v5 = pActionQueue; | |
8646 if ( pParty->uFlags2 & 2 ) | |
8647 partyAction = PARTY_RunBackward; | |
8648 else | |
8649 partyAction = PARTY_WalkBackward; | |
163 | 8650 //goto _add_action_and_continue; |
8651 v5->Add(partyAction); | |
8652 break; | |
17 | 8653 } |
0 | 8654 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8655 { | |
8656 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8657 //_do_move_backwards: |
0 | 8658 v5 = pActionQueue; |
8659 if ( pParty->uFlags2 & 2 ) | |
8660 partyAction = PARTY_RunBackward; | |
8661 else | |
8662 partyAction = PARTY_WalkBackward; | |
163 | 8663 //goto _add_action_and_continue; |
8664 v5->Add(partyAction); | |
8665 break; | |
0 | 8666 } |
8667 break; | |
8668 case INPUT_StrafeLeft: | |
17 | 8669 //__debugbreak(); |
271 | 8670 if (pCurrentScreen != SCREEN_GAME) |
0 | 8671 break; |
8672 if (!pParty->bTurnBasedModeOn) | |
17 | 8673 //goto _do_strafe_left; |
8674 { | |
8675 partyAction = PARTY_StrafeLeft; | |
163 | 8676 //goto _add_action_and_continue_; |
8677 v5 = pActionQueue; | |
8678 v5->Add(partyAction); | |
8679 break; | |
17 | 8680 } |
0 | 8681 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8682 break; | |
8683 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8684 //_do_strafe_left: |
0 | 8685 partyAction = PARTY_StrafeLeft; |
163 | 8686 //goto _add_action_and_continue_; |
8687 v5 = pActionQueue; | |
8688 v5->Add(partyAction); | |
8689 break; | |
0 | 8690 case INPUT_StrafeRight: |
17 | 8691 //__debugbreak(); |
271 | 8692 if (pCurrentScreen != SCREEN_GAME) |
0 | 8693 break; |
8694 if (!pParty->bTurnBasedModeOn) | |
17 | 8695 //goto _do_strafe_right; |
8696 { | |
8697 partyAction = PARTY_StrafeRight; | |
163 | 8698 //goto _add_action_and_continue_; |
8699 v5 = pActionQueue; | |
8700 v5->Add(partyAction); | |
8701 break; | |
17 | 8702 } |
0 | 8703 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8704 break; | |
8705 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8706 //_do_strafe_right: |
0 | 8707 partyAction = PARTY_StrafeRight; |
163 | 8708 //goto _add_action_and_continue_; |
8709 v5 = pActionQueue; | |
8710 v5->Add(partyAction); | |
8711 break; | |
0 | 8712 case INPUT_TurnLeft: |
271 | 8713 if (pCurrentScreen != SCREEN_GAME) |
0 | 8714 break; |
8715 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8716 { | |
8717 if (pParty->bTurnBasedModeOn) | |
8718 { | |
8719 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8720 break; | |
8721 pTurnEngine->uActionPointsLeft -= 26; | |
8722 } | |
8723 partyAction_ = PARTY_StrafeLeft; | |
8724 } | |
8725 else | |
8726 { | |
8727 if ( pParty->uFlags2 & 2 ) | |
8728 partyAction_ = PARTY_FastTurnLeft; | |
8729 else | |
8730 partyAction_ = PARTY_TurnLeft; | |
8731 } | |
8732 pActionQueue->Add(partyAction_); | |
8733 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8734 { | |
271 | 8735 pWeather->OnPlayerTurn(10); |
0 | 8736 } |
8737 break; | |
8738 case INPUT_TurnRight: | |
271 | 8739 if (pCurrentScreen != SCREEN_GAME) |
0 | 8740 break; |
8741 if ( GetAsyncKeyState(17) ) // strafing | |
8742 { | |
8743 if (pParty->bTurnBasedModeOn) | |
8744 { | |
8745 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8746 break; | |
8747 pTurnEngine->uActionPointsLeft -= 26; | |
8748 } | |
271 | 8749 v21 = PARTY_StrafeRight; |
0 | 8750 } |
8751 else | |
8752 { | |
8753 if ( pParty->uFlags2 & 2 ) | |
271 | 8754 v21 = PARTY_FastTurnRight; |
0 | 8755 else |
271 | 8756 v21 = PARTY_TurnRight; |
0 | 8757 } |
8758 pActionQueue->Add((PartyAction)v21); | |
8759 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8760 { | |
271 | 8761 pWeather->OnPlayerTurn(-10); |
0 | 8762 } |
8763 break; | |
8764 case INPUT_Jump: | |
17 | 8765 //__debugbreak(); |
271 | 8766 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8767 break; |
8768 partyAction = (PartyAction)12; | |
163 | 8769 //goto _add_action_and_continue_; |
8770 v5 = pActionQueue; | |
8771 v5->Add(partyAction); | |
8772 break; | |
0 | 8773 case INPUT_Yell: |
187 | 8774 if (!pCurrentScreen && uActiveCharacter) |
0 | 8775 { |
8776 pParty->Yell(); | |
187 | 8777 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8778 } |
187 | 8779 break; |
0 | 8780 case INPUT_Pass: |
17 | 8781 //__debugbreak(); |
0 | 8782 if ( pCurrentScreen ) |
8783 break; | |
8784 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8785 //goto LABEL_118; |
8786 { | |
8787 pTurnEngine->field_18 |= 8u; | |
8788 break; | |
8789 } | |
0 | 8790 if ( uActiveCharacter ) |
8791 { | |
8792 v6 = pPlayers[uActiveCharacter]; | |
8793 if ( !v6->uTimeToRecovery ) | |
8794 { | |
816 | 8795 v24 = v6->GetAttackRecoveryTime(false); |
0 | 8796 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8797 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 8798 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 8799 pTurnEngine->_40471C(); |
8800 } | |
8801 } | |
8802 break; | |
8803 case INPUT_Combat: | |
17 | 8804 //__debugbreak(); |
271 | 8805 if (pCurrentScreen == SCREEN_GAME) |
0 | 8806 { |
8807 if (pParty->bTurnBasedModeOn) | |
8808 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8809 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8810 { |
8811 pParty->bTurnBasedModeOn = 0; | |
8812 pTurnEngine->End(true); | |
8813 } | |
8814 } | |
8815 else | |
8816 { | |
8817 pTurnEngine->Start(); | |
8818 pParty->bTurnBasedModeOn = true; | |
8819 } | |
8820 } | |
8821 break; | |
8822 case INPUT_CastReady: | |
17 | 8823 //__debugbreak(); |
271 | 8824 if (pCurrentScreen != SCREEN_GAME) |
0 | 8825 break; |
8826 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8827 //goto LABEL_118; |
8828 { | |
8829 pTurnEngine->field_18 |= 8u; | |
8830 break; | |
8831 } | |
0 | 8832 if ( !uActiveCharacter ) |
8833 break; | |
8834 v7 = pPlayers[uActiveCharacter]; | |
8835 v8 = v7->uQuickSpell; | |
8836 if ( !v8 | |
8837 || bUnderwater | |
8838 || ((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)), | |
8839 v10 > v7->sMana) ) | |
8840 { | |
8841 pActionQueue = pPartyActionQueue; | |
8842 LABEL_120: | |
437 | 8843 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8844 break; | |
8845 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8846 { |
271 | 8847 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; |
163 | 8848 //goto _send_message; |
8849 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8850 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8851 ++pMessageQueue_50CBD0->uNumMessages; | |
8852 break; | |
437 | 8853 }*/ |
0 | 8854 } |
8855 else | |
8856 { | |
8857 pActionQueue = pPartyActionQueue; | |
8858 if ( dword_50C9E8 < 40 ) | |
8859 { | |
8860 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8861 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8862 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8863 ++dword_50C9E8; |
8864 } | |
8865 } | |
8866 break; | |
8867 case INPUT_Attack: | |
17 | 8868 //__debugbreak(); |
271 | 8869 if (pCurrentScreen != SCREEN_GAME) |
0 | 8870 break; |
8871 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) | |
8872 goto LABEL_120; | |
17 | 8873 //LABEL_118: |
0 | 8874 pTurnEngine->field_18 |= 8u; |
8875 break; | |
8876 case INPUT_EventTrigger: | |
271 | 8877 if (pCurrentScreen == SCREEN_GAME) |
0 | 8878 { |
437 | 8879 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8880 break; |
271 | 8881 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; |
163 | 8882 //goto _send_message; |
8883 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8884 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8885 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8886 break;*/ |
8887 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
163 | 8888 break; |
0 | 8889 } |
151 | 8890 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8891 { |
8892 v11 = pMessageQueue_50CBD0->uNumMessages; | |
8893 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8894 { | |
437 | 8895 v11 = 0; |
8896 pMessageQueue_50CBD0->uNumMessages = 0; | |
0 | 8897 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8898 { | |
8899 v11 = 1; | |
8900 pMessageQueue_50CBD0->uNumMessages = 1; | |
163 | 8901 //LABEL_132: |
271 | 8902 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8903 //_send_message: |
0 | 8904 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8905 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8906 ++pMessageQueue_50CBD0->uNumMessages; | |
8907 break; | |
8908 } | |
437 | 8909 break; |
0 | 8910 } |
437 | 8911 /*if ( (signed int)v11 < 40 ) |
163 | 8912 //goto LABEL_132; |
8913 { | |
271 | 8914 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8915 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8916 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8917 ++pMessageQueue_50CBD0->uNumMessages; | |
8918 break; | |
437 | 8919 }*/ |
8920 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 8921 } |
8922 break; | |
8923 case INPUT_CharCycle: | |
17 | 8924 //__debugbreak(); |
151 | 8925 if ( pCurrentScreen == SCREEN_SPELL_BOOK |
0 | 8926 || dword_50C9E8 >= 40 ) |
8927 break; | |
8928 dword_50C9EC[3 * dword_50C9E8] = 176; | |
163 | 8929 //goto LABEL_155; |
437 | 8930 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8931 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8932 ++dword_50C9E8; |
8933 break; | |
0 | 8934 case INPUT_LookUp: |
17 | 8935 //__debugbreak(); |
0 | 8936 if ( pEventTimer->bPaused ) |
8937 break; | |
8938 partyAction = (PartyAction)7; | |
163 | 8939 //goto _add_action_and_continue_; |
8940 v5 = pActionQueue; | |
8941 v5->Add(partyAction); | |
8942 break; | |
0 | 8943 case INPUT_CenterView: |
17 | 8944 //__debugbreak(); |
0 | 8945 if ( pEventTimer->bPaused ) |
8946 break; | |
8947 partyAction = (PartyAction)9; | |
163 | 8948 //goto _add_action_and_continue_; |
8949 v5 = pActionQueue; | |
8950 v5->Add(partyAction); | |
8951 break; | |
0 | 8952 case INPUT_LookDown: |
17 | 8953 //__debugbreak(); |
0 | 8954 if ( pEventTimer->bPaused ) |
8955 break; | |
8956 partyAction = (PartyAction)8; | |
163 | 8957 //goto _add_action_and_continue_; |
8958 v5 = pActionQueue; | |
8959 v5->Add(partyAction); | |
8960 break; | |
0 | 8961 case INPUT_FlyUp: |
17 | 8962 //__debugbreak(); |
0 | 8963 if ( pCurrentScreen |
8964 || pEventTimer->bPaused ) | |
8965 break; | |
8966 partyAction = (PartyAction)13; | |
163 | 8967 //goto _add_action_and_continue_; |
8968 v5 = pActionQueue; | |
8969 v5->Add(partyAction); | |
8970 break; | |
0 | 8971 case INPUT_Land: |
17 | 8972 //__debugbreak(); |
0 | 8973 if ( pCurrentScreen |
8974 || pEventTimer->bPaused ) | |
8975 break; | |
8976 partyAction = (PartyAction)15; | |
163 | 8977 //goto _add_action_and_continue_; |
8978 v5 = pActionQueue; | |
8979 v5->Add(partyAction); | |
8980 break; | |
0 | 8981 case INPUT_FlyDown: |
17 | 8982 //__debugbreak(); |
0 | 8983 if ( !pCurrentScreen |
8984 && !pEventTimer->bPaused ) | |
8985 { | |
8986 partyAction = (PartyAction)14; | |
163 | 8987 //_add_action_and_continue_: |
0 | 8988 v5 = pActionQueue; |
163 | 8989 //_add_action_and_continue: |
0 | 8990 v5->Add(partyAction); |
8991 } | |
8992 break; | |
8993 case INPUT_ZoomIn: | |
17 | 8994 //__debugbreak(); |
0 | 8995 if ( dword_50C9E8 >= 40 ) |
8996 break; | |
8997 dword_50C9EC[3 * dword_50C9E8] = 367; | |
163 | 8998 //goto LABEL_155; |
437 | 8999 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
9000 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 9001 ++dword_50C9E8; |
9002 break; | |
0 | 9003 case INPUT_ZoomOut: |
17 | 9004 //__debugbreak(); |
0 | 9005 if ( dword_50C9E8 < 40 ) |
9006 { | |
9007 dword_50C9EC[3 * dword_50C9E8] = 368; | |
163 | 9008 //LABEL_155: |
437 | 9009 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
9010 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 9011 ++dword_50C9E8; |
9012 } | |
9013 break; | |
9014 case INPUT_AlwaysRun: | |
9015 bAlwaysRun = bAlwaysRun == 0; | |
9016 break; | |
17 | 9017 default: |
9018 //__debugbreak(); | |
9019 break; | |
0 | 9020 } |
9021 } | |
9022 inputAction = (InputAction)((int)inputAction + 1); | |
9023 if ( (signed int)inputAction >= 30 ) | |
9024 goto LABEL_176; | |
9025 } | |
9026 } | |
9027 v12 = 0; | |
9028 do | |
9029 { | |
9030 v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; | |
9031 v13 = pGame->pKeyboardInstance; | |
9032 if ( pKeyActionMap->pToggleTypes[v12] ) | |
9033 v14 = v13->WasKeyPressed(v22); | |
9034 else | |
9035 v14 = v13->IsKeyBeingHeld(v22); | |
9036 if ( v14 && v12 == 9 ) | |
9037 { | |
9038 if ( !pCurrentScreen ) | |
9039 { | |
437 | 9040 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9041 goto LABEL_175; |
9042 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; | |
17 | 9043 //goto LABEL_174; |
9044 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9045 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9046 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9047 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
17 | 9048 goto LABEL_175; |
0 | 9049 } |
151 | 9050 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE |
9051 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
0 | 9052 { |
9053 v15 = pMessageQueue_50CBD0->uNumMessages; | |
9054 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9055 { | |
9056 v15 = 0; | |
9057 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
9058 { | |
9059 v15 = 1; | |
437 | 9060 pMessageQueue_50CBD0->uNumMessages = 0; |
17 | 9061 //goto LABEL_173; |
437 | 9062 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; |
17 | 9063 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9064 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9065 ++pMessageQueue_50CBD0->uNumMessages; | |
9066 goto LABEL_175; | |
0 | 9067 } |
9068 pMessageQueue_50CBD0->uNumMessages = 0; | |
9069 } | |
437 | 9070 /*if ( (signed int)v15 >= 40 ) |
0 | 9071 goto LABEL_175; |
17 | 9072 //LABEL_173: |
0 | 9073 pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; |
17 | 9074 //LABEL_174: |
0 | 9075 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9076 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9077 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9078 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 9079 goto LABEL_175; |
9080 } | |
9081 } | |
9082 LABEL_175: | |
9083 ++v12; | |
9084 } | |
9085 while ( v12 < 30 ); | |
9086 LABEL_176: | |
9087 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
9088 { | |
9089 AsyncKeyboard::LeaveCriticalSection(); | |
9090 v16 = pAsyncKeyboard; | |
9091 AsyncKeyboard::EnterCriticalSection(); | |
9092 memset((char *)v16 + 521, 0, 0x100u); | |
9093 AsyncKeyboard::LeaveCriticalSection(); | |
9094 } | |
9095 } |