Mercurial > mm7
annotate mm7_6.cpp @ 945:0d96349d8c87
Restoring inlined methods
author | Nomad |
---|---|
date | Wed, 01 May 2013 14:09:49 +0200 |
parents | ae747684f644 |
children | c0d0656aa662 5e87b0c3f939 |
rev | line source |
---|---|
0 | 1 #include "MM7.h" |
2 | |
3 #include "MapInfo.h" | |
4 #include "Game.h" | |
5 #include "GUIWindow.h" | |
6 #include "GUIFont.h" | |
7 #include "GUIProgressBar.h" | |
8 #include "Party.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Outdoor.h" | |
11 #include "IndoorCamera.h" | |
12 #include "Overlays.h" | |
13 #include "Monsters.h" | |
14 #include "Arcomage.h" | |
15 #include "LOD.h" | |
16 #include "Actor.h" | |
17 #include "Allocator.h" | |
18 #include "Events.h" | |
19 #include "Viewport.h" | |
20 #include "FrameTableInc.h" | |
21 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
22 #include "SpriteObject.h" |
0 | 23 #include "ObjectList.h" |
24 #include "Chest.h" | |
25 #include "PaletteManager.h" | |
26 #include "DecorationList.h" | |
27 #include "SaveLoad.h" | |
28 #include "stru123.h" | |
29 #include "Time.h" | |
30 #include "IconFrameTable.h" | |
31 #include "Awards.h" | |
32 #include "Autonotes.h" | |
33 #include "stru160.h" | |
34 #include "TurnEngine.h" | |
924 | 35 #include "CastSpellInfo.h" |
0 | 36 #include "Weather.h" |
37 #include "stru298.h" | |
189 | 38 #include "texts.h" |
0 | 39 #include "StorylineTextTable.h" |
40 #include "Events2D.h" | |
370 | 41 #include "Log.h" |
0 | 42 |
43 #include "mm7_data.h" | |
44 | |
45 | |
46 | |
47 //----- (00424EE0) -------------------------------------------------------- | |
48 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
49 { | |
50 unsigned int v1; // edx@1 | |
51 double v2; // st7@1 | |
52 signed int v3; // edi@1 | |
53 char *v4; // esi@4 | |
54 char *v5; // ecx@4 | |
55 unsigned int v6; // eax@4 | |
56 char *v7; // edx@4 | |
57 double v8; // st6@10 | |
58 double v9; // st5@10 | |
59 double v10; // st6@11 | |
60 unsigned __int8 v11; // c2@15 | |
61 unsigned __int8 v12; // c3@15 | |
62 void *v13; // edi@22 | |
63 char *v14; // eax@22 | |
64 double v15; // st6@22 | |
65 char *v16; // ecx@22 | |
66 signed int result; // eax@24 | |
67 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
68 bool v19; // [sp+Ch] [bp-28h]@6 | |
69 char *v20; // [sp+10h] [bp-24h]@4 | |
70 char *v21; // [sp+14h] [bp-20h]@4 | |
71 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
72 char *v23; // [sp+1Ch] [bp-18h]@4 | |
73 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
74 char *v25; // [sp+24h] [bp-10h]@4 | |
75 char *v26; // [sp+28h] [bp-Ch]@4 | |
76 char *v27; // [sp+2Ch] [bp-8h]@4 | |
77 char *v28; // [sp+30h] [bp-4h]@4 | |
78 | |
79 v1 = uVertexID; | |
80 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
81 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
82 v3 = 0; | |
83 v22 = 0; | |
84 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
85 v3 = 1; | |
86 if ( (signed int)(uVertexID + 1) <= 1 ) | |
87 return 0; | |
88 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
89 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
90 v6 = v1; | |
91 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 92 v26 = (char *)&array_507D30[0]._rhw; |
0 | 93 v24 = array_507D30; |
94 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
95 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
96 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
97 v27 = (char *)&array_507D30[0].v; | |
98 v28 = (char *)&array_507D30[0].u; | |
99 v7 = (char *)&array_50AC10[0].v; | |
100 v18 = v6; | |
101 do | |
102 { | |
103 v19 = v2 >= *((float *)v7 + 5); | |
104 if ( v3 != v19 ) | |
105 { | |
106 if ( v19 ) | |
107 { | |
108 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
109 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
110 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
111 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
112 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
113 } | |
114 else | |
115 { | |
116 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
117 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
118 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
119 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
120 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
121 } | |
122 *(float *)v27 = v9; | |
123 *(float *)v25 = v2; | |
124 *(float *)v26 = 1.0 / v2; | |
125 if ( v3 ) | |
126 { | |
127 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
128 { | |
129 v11 = 0; | |
130 v12 = *(float *)v4 == *((float *)v7 - 5); | |
131 goto LABEL_19; | |
132 } | |
133 } | |
134 else | |
135 { | |
136 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
137 { | |
138 v11 = 0; | |
139 v12 = *(float *)v4 == *((float *)v7 + 7); | |
140 LABEL_19: | |
141 if ( v12 | v11 ) | |
142 goto LABEL_21; | |
143 goto LABEL_20; | |
144 } | |
145 } | |
146 LABEL_20: | |
147 v26 += 48; | |
148 ++v24; | |
149 v25 += 48; | |
150 v27 += 48; | |
151 v28 += 48; | |
152 v5 += 48; | |
153 v4 += 48; | |
154 ++v22; | |
155 v23 += 48; | |
156 v21 = v5; | |
157 v20 = v4; | |
158 } | |
159 LABEL_21: | |
160 if ( v19 ) | |
161 { | |
162 v13 = v24; | |
163 v14 = v26; | |
164 v21 += 48; | |
165 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
166 v20 += 48; | |
167 ++v22; | |
168 v28 += 48; | |
169 v27 += 48; | |
170 v25 += 48; | |
171 ++v24; | |
172 v26 += 48; | |
173 memcpy(v13, v7 + 8, 0x30u); | |
174 v16 = v23; | |
175 v23 += 48; | |
176 v4 = v20; | |
177 *(float *)v14 = v15; | |
178 *(int *)v16 = *((int *)v7 + 13); | |
179 v5 = v21; | |
180 } | |
181 v3 = v19; | |
182 v7 += 48; | |
183 --v18; | |
184 } | |
185 while ( v18 ); | |
186 result = v22; | |
187 if ( v22 < 3 ) | |
188 return 0; | |
189 return result; | |
190 } | |
191 | |
192 //----- (004250FE) -------------------------------------------------------- | |
193 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
194 { | |
195 unsigned int v1; // edx@1 | |
196 char *v2; // edi@5 | |
197 char *v3; // esi@5 | |
198 char *v4; // ecx@5 | |
199 int v5; // ebx@6 | |
200 double v6; // st6@11 | |
201 double v7; // st5@11 | |
202 double v8; // st6@12 | |
203 unsigned __int8 v9; // c2@16 | |
204 unsigned __int8 v10; // c3@16 | |
205 void *v11; // edi@23 | |
206 double v12; // st6@23 | |
207 char *v13; // ecx@23 | |
208 char v14; // zf@24 | |
209 signed int result; // eax@25 | |
210 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
211 bool v17; // [sp+Ch] [bp-24h]@2 | |
212 bool v18; // [sp+10h] [bp-20h]@7 | |
213 char *v19; // [sp+14h] [bp-1Ch]@5 | |
214 char *v20; // [sp+18h] [bp-18h]@5 | |
215 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
216 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
217 char *v23; // [sp+24h] [bp-Ch]@5 | |
218 char *v24; // [sp+28h] [bp-8h]@5 | |
219 char *v25; // [sp+2Ch] [bp-4h]@5 | |
220 | |
221 v1 = uVertexID; | |
222 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
223 v21 = 0; | |
224 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
225 if ( (signed int)(uVertexID + 1) <= 1 ) | |
226 return 0; | |
227 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
228 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 229 v24 = (char *)&array_507D30[0]._rhw; |
0 | 230 v22 = array_507D30; |
231 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
232 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
233 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
234 v25 = (char *)&array_507D30[0].flt_2C; | |
235 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
236 v16 = v1; | |
237 do | |
238 { | |
239 v5 = (int)(v4 + 48); | |
240 v18 = *((float *)v4 + 12) >= 8.0; | |
241 if ( v17 != v18 ) | |
242 { | |
243 if ( v18 ) | |
244 { | |
245 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
246 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
247 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
248 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
249 } | |
250 else | |
251 { | |
252 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
253 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
254 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
255 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
256 } | |
257 *(float *)v25 = v7; | |
258 *(float *)v23 = 8.0; | |
259 *(int *)v24 = 0x3E000000u; | |
260 if ( v17 ) | |
261 { | |
262 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
263 { | |
264 v9 = 0; | |
265 v10 = *(float *)v2 == *((float *)v4 + 2); | |
266 goto LABEL_20; | |
267 } | |
268 } | |
269 else | |
270 { | |
271 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
272 { | |
273 v9 = 0; | |
274 v10 = *(float *)v2 == *((float *)v4 + 14); | |
275 LABEL_20: | |
276 if ( v10 | v9 ) | |
277 goto LABEL_22; | |
278 goto LABEL_21; | |
279 } | |
280 } | |
281 LABEL_21: | |
282 ++v22; | |
283 v23 += 48; | |
284 v25 += 48; | |
285 v3 += 48; | |
286 v2 += 48; | |
287 ++v21; | |
288 v24 += 48; | |
289 v20 = v3; | |
290 v19 = v2; | |
291 } | |
292 LABEL_22: | |
293 if ( v18 ) | |
294 { | |
295 v11 = v22; | |
296 v20 += 48; | |
297 v19 += 48; | |
298 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
299 ++v21; | |
300 v25 += 48; | |
301 v23 += 48; | |
302 ++v22; | |
303 memcpy(v11, v4 + 36, 0x30u); | |
304 v13 = v24; | |
305 v24 += 48; | |
306 v3 = v20; | |
307 v2 = v19; | |
308 *(float *)v13 = v12; | |
309 } | |
310 v14 = v16-- == 1; | |
311 v17 = v18; | |
312 v4 = (char *)v5; | |
313 } | |
314 while ( !v14 ); | |
315 result = v21; | |
316 if ( v21 < 3 ) | |
317 return 0; | |
318 return result; | |
319 } | |
320 | |
321 //----- (004252E8) -------------------------------------------------------- | |
322 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
323 { | |
324 unsigned int v1; // edx@1 | |
325 double v2; // st7@1 | |
326 char *v3; // edi@5 | |
327 char *v4; // esi@5 | |
328 char *v5; // ecx@5 | |
329 int v6; // ebx@6 | |
330 double v7; // st6@11 | |
331 double v8; // st5@11 | |
332 double v9; // st6@12 | |
333 unsigned __int8 v10; // c2@16 | |
334 unsigned __int8 v11; // c3@16 | |
335 void *v12; // edi@23 | |
336 double v13; // st6@23 | |
337 char *v14; // ecx@23 | |
338 char v15; // zf@24 | |
339 signed int result; // eax@25 | |
340 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
341 bool v18; // [sp+Ch] [bp-24h]@2 | |
342 bool v19; // [sp+10h] [bp-20h]@7 | |
343 char *v20; // [sp+14h] [bp-1Ch]@5 | |
344 char *v21; // [sp+18h] [bp-18h]@5 | |
345 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
346 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
347 char *v24; // [sp+24h] [bp-Ch]@5 | |
348 char *v25; // [sp+28h] [bp-8h]@5 | |
349 char *v26; // [sp+2Ch] [bp-4h]@5 | |
350 | |
351 v1 = uVertexID; | |
352 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
353 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
354 v22 = 0; | |
355 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
356 if ( (signed int)(uVertexID + 1) <= 1 ) | |
357 return 0; | |
358 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
359 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 360 v25 = (char *)&array_507D30[0]._rhw; |
0 | 361 v23 = array_507D30; |
362 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
363 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
364 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
365 v26 = (char *)&array_507D30[0].flt_2C; | |
366 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
367 v17 = v1; | |
368 do | |
369 { | |
370 v6 = (int)(v5 + 48); | |
371 v19 = v2 >= *((float *)v5 + 12); | |
372 if ( v18 != v19 ) | |
373 { | |
374 if ( v19 ) | |
375 { | |
376 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
377 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
378 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
379 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
380 } | |
381 else | |
382 { | |
383 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
384 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
385 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
386 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
387 } | |
388 *(float *)v26 = v8; | |
389 *(float *)v24 = v2; | |
390 *(float *)v25 = 1.0 / v2; | |
391 if ( v18 ) | |
392 { | |
393 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
394 { | |
395 v10 = 0; | |
396 v11 = *(float *)v3 == *((float *)v5 + 2); | |
397 goto LABEL_20; | |
398 } | |
399 } | |
400 else | |
401 { | |
402 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
403 { | |
404 v10 = 0; | |
405 v11 = *(float *)v3 == *((float *)v5 + 14); | |
406 LABEL_20: | |
407 if ( v11 | v10 ) | |
408 goto LABEL_22; | |
409 goto LABEL_21; | |
410 } | |
411 } | |
412 LABEL_21: | |
413 ++v23; | |
414 v24 += 48; | |
415 v26 += 48; | |
416 v4 += 48; | |
417 v3 += 48; | |
418 ++v22; | |
419 v25 += 48; | |
420 v21 = v4; | |
421 v20 = v3; | |
422 } | |
423 LABEL_22: | |
424 if ( v19 ) | |
425 { | |
426 v12 = v23; | |
427 v21 += 48; | |
428 v20 += 48; | |
429 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
430 ++v22; | |
431 v26 += 48; | |
432 v24 += 48; | |
433 ++v23; | |
434 memcpy(v12, v5 + 36, 0x30u); | |
435 v14 = v25; | |
436 v25 += 48; | |
437 v4 = v21; | |
438 v3 = v20; | |
439 *(float *)v14 = v13; | |
440 } | |
441 v15 = v17-- == 1; | |
442 v18 = v19; | |
443 v5 = (char *)v6; | |
444 } | |
445 while ( !v15 ); | |
446 result = v22; | |
447 if ( v22 < 3 ) | |
448 return 0; | |
449 return result; | |
450 } | |
451 | |
452 //----- (004254D2) -------------------------------------------------------- | |
453 int __fastcall sr_4254D2(signed int a1) | |
454 { | |
455 signed int v1; // ebx@2 | |
456 int v2; // ecx@2 | |
457 int result; // eax@11 | |
458 double v4; // ST74_8@12 | |
459 bool v5; // edi@12 | |
460 char *v6; // esi@13 | |
461 char *v7; // ebx@13 | |
462 double v8; // st7@15 | |
463 double v9; // st7@16 | |
464 double v10; // st6@16 | |
465 double v11; // st7@17 | |
466 float v12; // eax@18 | |
467 double v13; // ST4C_8@19 | |
468 double v14; // ST10_8@19 | |
469 double v15; // ST28_8@20 | |
470 double v16; // ST34_8@20 | |
471 char v17; // zf@20 | |
472 double v18; // ST18_8@21 | |
473 double v19; // ST3C_8@21 | |
474 double v20; // ST44_8@22 | |
475 double v21; // ST54_8@22 | |
476 void *v22; // edi@26 | |
477 double v23; // ST54_8@29 | |
478 bool v24; // esi@29 | |
479 char *v25; // edi@30 | |
480 char *v26; // ebx@30 | |
481 bool v27; // ecx@32 | |
482 double v28; // st7@33 | |
483 double v29; // st7@34 | |
484 double v30; // st6@34 | |
485 double v31; // st7@35 | |
486 double v32; // ST44_8@37 | |
487 double v33; // ST3C_8@37 | |
488 double v34; // ST18_8@38 | |
489 double v35; // ST34_8@38 | |
490 char v36; // zf@38 | |
491 double v37; // ST28_8@39 | |
492 double v38; // ST10_8@39 | |
493 double v39; // ST20_8@40 | |
494 double v40; // ST5C_8@40 | |
495 void *v41; // edi@44 | |
496 double v42; // ST5C_8@47 | |
497 bool v43; // edi@47 | |
498 char *v44; // esi@48 | |
499 char *v45; // ebx@48 | |
500 bool v46; // ecx@49 | |
501 double v47; // st6@50 | |
502 double v48; // st6@51 | |
503 double v49; // st5@51 | |
504 double v50; // st6@52 | |
505 double v51; // ST20_8@54 | |
506 double v52; // ST54_8@54 | |
507 double v53; // ST44_8@55 | |
508 double v54; // ST3C_8@55 | |
509 char v55; // zf@55 | |
510 double v56; // ST18_8@56 | |
511 double v57; // ST34_8@56 | |
512 double v58; // ST28_8@57 | |
513 double v59; // ST10_8@57 | |
514 void *v60; // edi@61 | |
515 double v61; // ST5C_8@64 | |
516 bool v62; // edi@64 | |
517 char *v63; // esi@65 | |
518 char *v64; // ebx@65 | |
519 bool v65; // ecx@66 | |
520 double v66; // st6@67 | |
521 double v67; // st6@68 | |
522 double v68; // st5@68 | |
523 double v69; // st6@69 | |
524 double v70; // ST20_8@71 | |
525 double v71; // ST54_8@71 | |
526 double v72; // ST44_8@72 | |
527 double v73; // ST3C_8@72 | |
528 char v74; // zf@72 | |
529 double v75; // ST18_8@73 | |
530 double v76; // ST34_8@73 | |
531 double v77; // ST28_8@74 | |
532 double v78; // ST10_8@74 | |
533 void *v79; // edi@78 | |
534 int v80; // ebx@81 | |
535 char *v81; // ecx@82 | |
536 signed int v82; // esi@82 | |
537 float v83; // ST78_4@83 | |
538 double v84; // ST5C_8@83 | |
539 float v85; // eax@84 | |
540 double v86; // ST20_8@85 | |
541 double v87; // ST54_8@88 | |
542 float v88; // eax@89 | |
543 double v89; // ST44_8@90 | |
544 unsigned __int8 v90; // sf@94 | |
545 unsigned __int8 v91; // of@94 | |
546 int v92; // edx@97 | |
547 int v93; // esi@97 | |
548 int v94; // edi@97 | |
549 int v95; // eax@97 | |
550 int v96; // eax@104 | |
551 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
552 double v98; // [sp+54h] [bp-84h]@49 | |
553 double v99; // [sp+54h] [bp-84h]@66 | |
554 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
555 float v101; // [sp+60h] [bp-78h]@1 | |
556 float v102; // [sp+64h] [bp-74h]@1 | |
557 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
558 float v104; // [sp+A8h] [bp-30h]@1 | |
559 signed int v105; // [sp+A8h] [bp-30h]@96 | |
560 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
561 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
562 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
563 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
564 signed int v110; // [sp+B0h] [bp-28h]@12 | |
565 char *v111; // [sp+B8h] [bp-20h]@30 | |
566 signed int v112; // [sp+B8h] [bp-20h]@48 | |
567 signed int v113; // [sp+B8h] [bp-20h]@65 | |
568 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
569 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
570 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
571 signed int v117; // [sp+C0h] [bp-18h]@1 | |
572 char *v118; // [sp+C0h] [bp-18h]@30 | |
573 char *v119; // [sp+C0h] [bp-18h]@48 | |
574 char *v120; // [sp+C0h] [bp-18h]@65 | |
575 char *v121; // [sp+C4h] [bp-14h]@13 | |
576 char *v122; // [sp+C4h] [bp-14h]@30 | |
577 signed int v123; // [sp+C4h] [bp-14h]@47 | |
578 char *v124; // [sp+C8h] [bp-10h]@30 | |
579 char *v125; // [sp+C8h] [bp-10h]@48 | |
580 char *v126; // [sp+C8h] [bp-10h]@65 | |
581 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
582 char *v128; // [sp+CCh] [bp-Ch]@13 | |
583 char *v129; // [sp+CCh] [bp-Ch]@30 | |
584 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
585 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
586 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
587 char *v133; // [sp+D0h] [bp-8h]@30 | |
588 char *v134; // [sp+D0h] [bp-8h]@48 | |
589 char *v135; // [sp+D0h] [bp-8h]@65 | |
590 signed int v136; // [sp+D4h] [bp-4h]@1 | |
591 char *v137; // [sp+D4h] [bp-4h]@13 | |
592 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
593 char *v139; // [sp+D4h] [bp-4h]@48 | |
594 char *v140; // [sp+D4h] [bp-4h]@65 | |
595 | |
693 | 596 v101 = (double)(signed int)pViewport->uViewportTL_X; |
597 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 598 v117 = a1; |
599 v136 = 1; | |
693 | 600 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
601 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 602 if ( a1 <= 0 ) |
603 return v117; | |
604 v127 = a1; | |
605 v1 = a1; | |
606 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
607 v2 = 0; | |
608 do | |
609 { | |
610 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
611 v136 = 0; | |
612 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
613 v136 = 0; | |
614 ++v2; | |
615 --v127; | |
616 } | |
617 while ( v127 ); | |
618 if ( v136 ) | |
619 return v117; | |
620 v110 = 0; | |
621 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
622 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 623 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 624 if ( v117 < 1 ) |
625 goto LABEL_112; | |
626 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
627 v132 = array_50A2B0; | |
628 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
629 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
630 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 631 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 632 v7 = (char *)&array_50AC10[0].flt_2C; |
633 do | |
634 { | |
635 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 636 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 637 if ( !(v5 ^ v106) ) |
638 goto LABEL_25; | |
639 v8 = v101; | |
693 | 640 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 641 { |
642 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
643 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
644 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
645 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
646 } | |
647 else | |
648 { | |
649 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
650 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
651 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
652 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
653 } | |
654 *(float *)v121 = v10; | |
655 *(int *)v137 = LODWORD(v101); | |
656 LODWORD(v12) = *(int *)v6; | |
657 if ( v5 ) | |
658 { | |
659 v13 = v12 + 6.7553994e15; | |
660 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
661 if ( LODWORD(v13) == LODWORD(v14) ) | |
662 { | |
663 v15 = *(float *)v137 + 6.7553994e15; | |
664 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
665 v17 = LODWORD(v15) == LODWORD(v16); | |
666 goto LABEL_23; | |
667 } | |
668 } | |
669 else | |
670 { | |
671 v18 = v12 + 6.7553994e15; | |
672 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
673 if ( LODWORD(v18) == LODWORD(v19) ) | |
674 { | |
675 v20 = *(float *)v137 + 6.7553994e15; | |
676 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
677 v17 = LODWORD(v20) == LODWORD(v21); | |
678 LABEL_23: | |
679 if ( v17 ) | |
680 goto LABEL_25; | |
681 goto LABEL_24; | |
682 } | |
683 } | |
684 LABEL_24: | |
685 v121 += 48; | |
686 v114 += 48; | |
687 v6 += 48; | |
688 ++v110; | |
689 ++v132; | |
690 v128 = v6; | |
691 v137 += 48; | |
692 LABEL_25: | |
693 if ( v106 ) | |
694 { | |
695 v22 = v132; | |
696 v128 += 48; | |
697 ++v110; | |
698 v114 += 48; | |
699 v121 += 48; | |
700 v137 += 48; | |
701 ++v132; | |
702 memcpy(v22, v7 + 4, 0x30u); | |
703 v6 = v128; | |
704 } | |
705 v5 = v106; | |
706 v7 += 48; | |
707 --v117; | |
708 } | |
709 while ( v117 ); | |
710 if ( v110 < 3 | |
711 || (v115 = 0, | |
712 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
713 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 714 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 715 v110 < 1) ) |
716 goto LABEL_112; | |
168 | 717 v25 = (char *)&array_509950[0]._rhw; |
0 | 718 v138 = array_509950; |
719 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
720 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
721 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
722 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
723 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 724 v111 = (char *)&array_509950[0]._rhw; |
0 | 725 v26 = (char *)&array_50A2B0[0].flt_2C; |
726 while ( 2 ) | |
727 { | |
728 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 729 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
730 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 731 if ( v24 != v27 ) |
732 { | |
733 v28 = v100; | |
693 | 734 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 735 { |
736 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
737 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
738 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
739 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
740 } | |
741 else | |
742 { | |
743 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
744 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
745 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
746 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
747 } | |
748 *(float *)v124 = v30; | |
749 *(int *)v133 = LODWORD(v100); | |
750 if ( v24 ) | |
751 { | |
752 v32 = *(float *)v122 + 6.7553994e15; | |
753 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
754 if ( LODWORD(v32) == LODWORD(v33) ) | |
755 { | |
756 v34 = *(float *)v133 + 6.7553994e15; | |
757 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
758 v36 = LODWORD(v34) == LODWORD(v35); | |
759 goto LABEL_41; | |
760 } | |
761 goto LABEL_42; | |
762 } | |
763 v37 = *(float *)v118 + 6.7553994e15; | |
764 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
765 if ( LODWORD(v37) != LODWORD(v38) ) | |
766 goto LABEL_42; | |
767 v39 = *(float *)v129 + 6.7553994e15; | |
768 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
769 v36 = LODWORD(v39) == LODWORD(v40); | |
770 LABEL_41: | |
771 if ( !v36 ) | |
772 { | |
773 LABEL_42: | |
774 v129 += 48; | |
775 v118 += 48; | |
776 v133 += 48; | |
777 v122 += 48; | |
778 v124 += 48; | |
779 v111 += 48; | |
780 ++v115; | |
781 ++v138; | |
782 } | |
783 } | |
784 if ( v27 ) | |
785 { | |
786 v41 = v138; | |
787 ++v115; | |
788 v111 += 48; | |
789 v124 += 48; | |
790 v122 += 48; | |
791 v133 += 48; | |
792 v118 += 48; | |
793 v129 += 48; | |
794 ++v138; | |
795 memcpy(v41, v26 + 4, 0x30u); | |
796 } | |
797 v24 = v107; | |
798 v26 += 48; | |
799 --v110; | |
800 if ( v110 ) | |
801 { | |
802 v25 = v111; | |
803 continue; | |
804 } | |
805 break; | |
806 } | |
807 if ( v115 < 3 | |
808 || (v123 = 0, | |
809 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
810 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 811 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 812 v115 < 1) ) |
813 goto LABEL_112; | |
814 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
815 v130 = array_508FF0; | |
816 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
817 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
818 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 819 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 820 v45 = (char *)&array_509950[0].flt_2C; |
821 v112 = v115; | |
822 while ( 2 ) | |
823 { | |
824 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 825 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
826 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 827 if ( v43 != v46 ) |
828 { | |
829 v47 = v104; | |
693 | 830 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 831 { |
832 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
833 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
834 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
835 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
836 } | |
837 else | |
838 { | |
839 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
840 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
841 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
842 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
843 } | |
844 *(float *)v125 = v49; | |
845 *(float *)v139 = v104; | |
846 if ( v43 ) | |
847 { | |
848 v51 = v104 + 6.7553994e15; | |
849 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
850 if ( LODWORD(v51) == LODWORD(v52) ) | |
851 { | |
852 v53 = *(float *)v44 + 6.7553994e15; | |
853 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
854 v55 = LODWORD(v53) == LODWORD(v54); | |
855 goto LABEL_58; | |
856 } | |
857 goto LABEL_59; | |
858 } | |
859 v56 = v104 + 6.7553994e15; | |
860 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
861 if ( LODWORD(v56) != LODWORD(v57) ) | |
862 goto LABEL_59; | |
863 v58 = *(float *)v44 + 6.7553994e15; | |
864 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
865 v55 = LODWORD(v58) == LODWORD(v59); | |
866 LABEL_58: | |
867 if ( !v55 ) | |
868 { | |
869 LABEL_59: | |
870 v139 += 48; | |
871 v125 += 48; | |
872 v134 += 48; | |
873 v44 += 48; | |
874 ++v123; | |
875 ++v130; | |
876 v119 = v44; | |
877 } | |
878 } | |
879 if ( v46 ) | |
880 { | |
881 v60 = v130; | |
882 v119 += 48; | |
883 ++v123; | |
884 v134 += 48; | |
885 v125 += 48; | |
886 v139 += 48; | |
887 ++v130; | |
888 memcpy(v60, v45 + 4, 0x30u); | |
889 v44 = v119; | |
890 } | |
891 v43 = v108; | |
892 v45 += 48; | |
893 --v112; | |
894 if ( v112 ) | |
895 continue; | |
896 break; | |
897 } | |
898 if ( v123 < 3 | |
899 || (v116 = 0, | |
900 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
901 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 902 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 903 v123 < 1) ) |
904 goto LABEL_112; | |
905 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
906 v131 = array_508690; | |
907 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
908 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
909 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 910 v135 = (char *)&array_508690[0]._rhw; |
0 | 911 v64 = (char *)&array_508FF0[0].flt_2C; |
912 v113 = v123; | |
913 while ( 2 ) | |
914 { | |
915 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 916 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
917 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 918 if ( v62 != v65 ) |
919 { | |
920 v66 = v102; | |
693 | 921 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 922 { |
923 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
924 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
925 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
926 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
927 } | |
928 else | |
929 { | |
930 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
931 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
932 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
933 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
934 } | |
935 *(float *)v126 = v68; | |
936 *(float *)v140 = v102; | |
937 if ( v62 ) | |
938 { | |
939 v70 = v102 + 6.7553994e15; | |
940 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
941 if ( LODWORD(v70) == LODWORD(v71) ) | |
942 { | |
943 v72 = *(float *)v63 + 6.7553994e15; | |
944 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
945 v74 = LODWORD(v72) == LODWORD(v73); | |
946 goto LABEL_75; | |
947 } | |
948 goto LABEL_76; | |
949 } | |
950 v75 = v102 + 6.7553994e15; | |
951 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
952 if ( LODWORD(v75) != LODWORD(v76) ) | |
953 goto LABEL_76; | |
954 v77 = *(float *)v63 + 6.7553994e15; | |
955 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
956 v74 = LODWORD(v77) == LODWORD(v78); | |
957 LABEL_75: | |
958 if ( !v74 ) | |
959 { | |
960 LABEL_76: | |
961 v140 += 48; | |
962 v126 += 48; | |
963 v135 += 48; | |
964 v63 += 48; | |
965 ++v116; | |
966 ++v131; | |
967 v120 = v63; | |
968 } | |
969 } | |
970 if ( v65 ) | |
971 { | |
972 v79 = v131; | |
973 v120 += 48; | |
974 ++v116; | |
975 v135 += 48; | |
976 v126 += 48; | |
977 v140 += 48; | |
978 ++v131; | |
979 memcpy(v79, v64 + 4, 0x30u); | |
980 v63 = v120; | |
981 } | |
982 v62 = v109; | |
983 v64 += 48; | |
984 --v113; | |
985 if ( v113 ) | |
986 continue; | |
987 break; | |
988 } | |
989 if ( v116 < 3 ) | |
990 goto LABEL_112; | |
991 v80 = v116; | |
992 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
993 if ( v116 > 0 ) | |
994 { | |
995 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
996 v82 = v116; | |
997 do | |
998 { | |
999 LODWORD(v83) = *(int *)v81; | |
1000 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1001 v84 = v83 + 6.7553994e15; | |
693 | 1002 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1003 { |
1004 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1005 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1006 goto LABEL_88; |
1007 v85 = v101; | |
1008 } | |
1009 else | |
1010 { | |
1011 v85 = v100; | |
1012 } | |
1013 *(int *)v81 = LODWORD(v85); | |
1014 LABEL_88: | |
1015 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1016 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1017 { |
1018 v88 = v102; | |
1019 LABEL_92: | |
1020 *((int *)v81 + 1) = LODWORD(v88); | |
1021 goto LABEL_93; | |
1022 } | |
1023 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1024 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1025 { |
1026 v88 = v104; | |
1027 goto LABEL_92; | |
1028 } | |
1029 LABEL_93: | |
1030 v81 += 48; | |
1031 --v82; | |
1032 } | |
1033 while ( v82 ); | |
1034 } | |
1035 v91 = __OFSUB__(v116, 3); | |
1036 v90 = v116 - 3 < 0; | |
1037 if ( v116 > 3 ) | |
1038 { | |
1039 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1040 if ( v116 > 0 ) | |
1041 { | |
1042 v105 = 1; | |
1043 do | |
1044 { | |
1045 v92 = v105; | |
1046 v93 = v105 - 1; | |
1047 v94 = v105 + 1; | |
1048 v95 = v105 + 1; | |
1049 if ( v105 - 1 >= v80 ) | |
1050 v93 -= v80; | |
1051 if ( v105 >= v80 ) | |
1052 v92 = v105 - v80; | |
1053 if ( v94 >= v80 ) | |
1054 v95 = v94 - v80; | |
1055 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1056 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1057 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1058 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1059 { | |
1060 ++v105; | |
1061 } | |
1062 else | |
1063 { | |
1064 v96 = v105; | |
1065 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1066 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1067 --v80; | |
1068 } | |
1069 } | |
1070 while ( v105 - 1 < v80 ); | |
1071 } | |
1072 v91 = __OFSUB__(v80, 3); | |
1073 v90 = v80 - 3 < 0; | |
1074 } | |
1075 if ( v90 ^ v91 ) | |
1076 LABEL_112: | |
1077 result = 0; | |
1078 else | |
1079 result = v80; | |
1080 return result; | |
1081 } | |
1082 | |
1083 //----- (0042620A) -------------------------------------------------------- | |
1084 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1085 { | |
1086 __int16 v1; // fps@1 | |
1087 unsigned __int8 v2; // c0@2 | |
1088 char v3; // c2@2 | |
1089 unsigned __int8 v4; // c3@2 | |
1090 bool result; // eax@2 | |
1091 unsigned __int8 v6; // c0@4 | |
1092 char v7; // c2@4 | |
1093 unsigned __int8 v8; // c3@4 | |
1094 unsigned __int8 v9; // c0@6 | |
1095 char v10; // c2@6 | |
1096 unsigned __int8 v11; // c3@6 | |
1097 double v12; // st6@7 | |
1098 float v13; // ST04_4@7 | |
1099 float v14; // ST00_4@7 | |
1100 double v15; // st7@7 | |
1101 double v16; // st6@8 | |
1102 float v17; // ST04_4@8 | |
1103 float v18; // ST00_4@8 | |
1104 double v19; // st7@8 | |
1105 | |
1106 //UNDEF(v1); | |
1107 if ( p->vWorldViewPosition.x < 300.0 | |
1108 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1109 v3 = 0, | |
1110 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1111 //BYTE1(result) = HIBYTE(v1), |
0 | 1112 !(v2 | v4)) ) |
1113 { | |
1114 if ( p->vWorldViewPosition.x < 300.0 ) | |
1115 { | |
1116 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1117 v7 = 0; | |
1118 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1119 //BYTE1(result) = HIBYTE(v1); |
0 | 1120 if ( !(v6 | v8) ) |
1121 { | |
921 | 1122 //LOBYTE(result) = 0; |
1123 return false; | |
0 | 1124 } |
1125 } | |
1126 v9 = 300.0 < p->vWorldViewPosition.x; | |
1127 v10 = 0; | |
1128 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1129 //BYTE1(result) = HIBYTE(v1); |
0 | 1130 if ( v9 | v11 ) |
1131 { | |
1132 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1133 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1134 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1135 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1136 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1137 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1138 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1139 } | |
1140 else | |
1141 { | |
1142 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1143 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1144 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1145 v15 = 300.0 - p->vWorldViewPosition.x; | |
1146 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1147 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1148 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1149 } | |
1150 } | |
921 | 1151 //LOBYTE(result) = 1; |
1152 return true; | |
0 | 1153 } |
1154 | |
1155 //----- (004268E3) -------------------------------------------------------- | |
1156 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1157 { | |
1158 unsigned int v1; // eax@1 | |
1159 unsigned int v2; // edx@1 | |
1160 int v3; // eax@1 | |
1161 int v4; // edx@1 | |
1162 unsigned int v5; // ecx@1 | |
1163 | |
1164 v1 = uColor >> 9; | |
1165 v2 = uColor >> 6; | |
1166 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1167 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1168 v3 = v2 | v1; | |
1169 v4 = (unsigned __int8)uColor >> 3; | |
1170 v5 = uColor >> 16; | |
1171 LOWORD(v5) = v5 & 0x8000; | |
1172 return v5 | v4 | v3; | |
1173 } | |
1174 | |
1175 //----- (0042690D) -------------------------------------------------------- | |
1176 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1177 { | |
1178 unsigned int v1; // eax@1 | |
1179 unsigned int v2; // edx@1 | |
1180 | |
1181 v1 = a1 >> 8; | |
1182 v2 = a1 >> 5; | |
1183 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1184 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1185 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1186 } | |
932 | 1187 |
0 | 1188 //----- (00426947) -------------------------------------------------------- |
1189 void __cdecl sub_426947() | |
1190 { | |
893 | 1191 stru_50C198.field_0 = 0; |
0 | 1192 dword_50C994 = 0; |
1193 dword_50C998_turnbased_icon_1A = 0; | |
1194 } | |
1195 // 50C968: using guessed type int dword_50C968; | |
1196 // 50C994: using guessed type int dword_50C994; | |
1197 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1198 | |
1199 //----- (004269A2) -------------------------------------------------------- | |
792 | 1200 int __fastcall GivePartyExp(unsigned int a1) |
0 | 1201 { |
89 | 1202 //unsigned __int64 v1; // qax@1 |
1203 Player *v1; | |
1204 int v1b; | |
0 | 1205 signed int v2; // ecx@1 |
82 | 1206 int *v3; // esi@1 |
0 | 1207 bool v4; // edi@6 |
82 | 1208 int *v5; // edi@10 |
1209 Player *v6; // esi@10 | |
0 | 1210 int v7; // eax@13 |
1211 unsigned __int8 v8; // cf@13 | |
89 | 1212 int v10[4]; // [sp+Ch] [bp-14h]@1 |
0 | 1213 int v11; // [sp+1Ch] [bp-4h]@10 |
1214 | |
89 | 1215 //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); |
1216 v1 = pParty->pPlayers; | |
1217 v1b = a1; | |
0 | 1218 v2 = 0; |
89 | 1219 v3 = v10; |
0 | 1220 do |
1221 { | |
89 | 1222 /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) |
0 | 1223 && !*(int *)HIDWORD(v1) |
1224 && !*(_QWORD *)(HIDWORD(v1) + 8) | |
89 | 1225 && !*(_QWORD *)(HIDWORD(v1) + 16);*/ |
1226 v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) | |
1227 && !v1->pConditions[14] | |
1228 && !v1->pConditions[15] | |
1229 && !v1->pConditions[16]; | |
82 | 1230 *v3 = v4; |
89 | 1231 //HIDWORD(v1) += 6972; |
1232 ++v1; | |
0 | 1233 v2 += v4; |
82 | 1234 ++v3; |
0 | 1235 } |
89 | 1236 while ( v1 <= &pParty->pPlayers[3] ); |
0 | 1237 if ( v2 ) |
1238 { | |
89 | 1239 v1b = v1b / v2; |
1240 v5 = v10; | |
82 | 1241 v6 = pParty->pPlayers;//[0].uExperience; |
89 | 1242 v11 = v1b; |
0 | 1243 do |
1244 { | |
82 | 1245 if ( *v5 ) |
0 | 1246 { |
1247 if ( v11 ) | |
1248 { | |
82 | 1249 LOBYTE(v7) = v6->GetLearningPercent(); |
922 | 1250 v1b = v11 + v11 * (char)v7 / 100; |
89 | 1251 //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); |
1252 //need review | |
1253 LODWORD(v6->uExperience) += v1b; | |
1254 //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; | |
82 | 1255 if ( v6->uExperience > 4000000000i64 ) |
0 | 1256 { |
82 | 1257 HIDWORD(v6->uExperience) = 0; |
1258 LODWORD(v6->uExperience) = -294967296; | |
0 | 1259 } |
1260 } | |
1261 } | |
82 | 1262 ++v6; |
1263 ++v5; | |
0 | 1264 } |
82 | 1265 while ( v6 <= &pParty->pPlayers[3] ); |
0 | 1266 } |
89 | 1267 return v1b; |
0 | 1268 } |
1269 | |
1270 //----- (00426A5A) -------------------------------------------------------- | |
1271 void stru319::LootActor(Actor *pActor) | |
1272 { | |
1273 signed int v2; // edi@1 | |
1274 char v3; // zf@1 | |
1275 unsigned int v4; // eax@13 | |
1276 unsigned int v5; // esi@13 | |
1277 int v6; // eax@14 | |
1278 unsigned __int8 v7; // al@30 | |
1279 Party *v8; // esi@34 | |
1280 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1281 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1282 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1283 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1284 int v13; // [sp+30h] [bp-8h]@1 | |
1285 int v14; // [sp+34h] [bp-4h]@1 | |
1286 | |
1287 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1288 Dst.Reset(); | |
1289 v2 = 0; | |
1290 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1291 v13 = 0; | |
1292 v14 = 0; | |
1293 if ( v3 ) | |
1294 { | |
1295 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1296 goto LABEL_9; | |
1297 do | |
1298 { | |
1299 ++v2; | |
1300 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1301 } | |
1302 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1303 } | |
1304 else | |
1305 { | |
1306 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1307 goto LABEL_9; | |
377 | 1308 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1309 pActor->array_000234[3].Reset(); |
1310 } | |
1311 if ( v14 ) | |
1312 { | |
1313 party_finds_gold(v14, 0); | |
1314 viewparams->bRedrawGameUI = 1; | |
1315 } | |
1316 LABEL_9: | |
1317 if ( pActor->uCarriedItemID ) | |
1318 { | |
1319 Dst.Reset(); | |
1320 Dst.uItemID = pActor->uCarriedItemID; | |
1321 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1322 if ( v14 ) | |
721 | 1323 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1324 else |
721 | 1325 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1326 ShowStatusBarString(pTmpBuf2, 2u); |
1327 v4 = Dst.uItemID; | |
1328 v5 = Dst.uItemID; | |
1329 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1330 { | |
1331 v5 = Dst.uItemID; | |
1332 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1333 Dst.uNumCharges = v6; | |
1334 Dst.uMaxCharges = v6; | |
1335 v4 = Dst.uItemID; | |
1336 } | |
1337 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1338 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1339 pItemsTable->SetSpecialBonus(&Dst); |
1340 if ( !pParty->AddItem(&Dst) ) | |
1341 pParty->SetHoldingItem(&Dst); | |
1342 pActor->uCarriedItemID = 0; | |
1343 if ( pActor->array_000234[0].uItemID ) | |
1344 { | |
1345 if ( !pParty->AddItem(pActor->array_000234) ) | |
1346 { | |
1347 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1348 pParty->SetHoldingItem(pActor->array_000234); | |
1349 } | |
1350 pActor->array_000234[0].Reset(); | |
1351 } | |
1352 if ( pActor->array_000234[1].uItemID ) | |
1353 { | |
1354 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1355 { | |
1356 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1357 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1358 } | |
1359 pActor->array_000234[1].Reset(); | |
1360 } | |
1361 LABEL_55: | |
1362 pActor->Remove(); | |
1363 return; | |
1364 } | |
1365 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1366 { | |
1367 if ( pActor->array_000234[3].uItemID ) | |
1368 { | |
1369 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1370 pActor->array_000234[3].Reset(); | |
1371 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1372 if ( v14 ) | |
721 | 1373 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1374 else |
721 | 1375 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1376 ShowStatusBarString(pTmpBuf2, 2u); |
1377 if ( !pParty->AddItem(&Dst) ) | |
1378 pParty->SetHoldingItem(&Dst); | |
1379 v13 = 1; | |
1380 } | |
1381 goto LABEL_44; | |
1382 } | |
1383 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1384 { | |
1385 LABEL_44: | |
1386 v8 = pParty; | |
1387 goto LABEL_45; | |
1388 } | |
1389 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1390 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1391 if ( v14 ) | |
721 | 1392 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1393 else |
721 | 1394 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1395 ShowStatusBarString(pTmpBuf2, 2u); |
1396 v8 = pParty; | |
1397 if ( !pParty->AddItem(&Dst) ) | |
1398 pParty->SetHoldingItem(&Dst); | |
1399 v13 = 1; | |
1400 LABEL_45: | |
1401 if ( pActor->array_000234[0].uItemID ) | |
1402 { | |
1403 if ( !v8->AddItem(pActor->array_000234) ) | |
1404 { | |
1405 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1406 v8->SetHoldingItem(pActor->array_000234); | |
1407 v13 = 1; | |
1408 } | |
1409 pActor->array_000234[0].Reset(); | |
1410 } | |
1411 if ( pActor->array_000234[1].uItemID ) | |
1412 { | |
1413 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1414 { | |
1415 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1416 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1417 v13 = 1; | |
1418 } | |
1419 pActor->array_000234[1].Reset(); | |
1420 } | |
1421 if ( !v13 || rand() % 100 < 90 ) | |
1422 goto LABEL_55; | |
1423 } | |
1424 | |
1425 //----- (00426E10) -------------------------------------------------------- | |
1426 int stru319::which_player_would_attack(Actor *pActor) | |
1427 { | |
1428 signed int v2; // ebx@1 | |
1429 int v3; // ecx@2 | |
1430 signed int v4; // edx@3 | |
1431 char v5; // zf@3 | |
1432 unsigned int v6; // eax@3 | |
1433 int v7; // eax@6 | |
1434 int v8; // eax@7 | |
1435 int v9; // eax@8 | |
1436 int v10; // eax@9 | |
1437 int v11; // eax@10 | |
1438 int v12; // eax@11 | |
1439 int v13; // esi@35 | |
1440 signed int v14; // edi@37 | |
1441 enum CHARACTER_RACE v15; // eax@44 | |
1442 Player *v16; // ecx@47 | |
1443 unsigned __int8 v17; // sf@50 | |
1444 unsigned __int8 v18; // of@50 | |
1445 int v19; // esi@52 | |
1446 Player *v20; // ecx@53 | |
1447 int result; // eax@57 | |
1448 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1449 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1450 int v24; // [sp+138h] [bp-10h]@2 | |
1451 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1452 int v26; // [sp+140h] [bp-8h]@1 | |
1453 int v27; // [sp+144h] [bp-4h]@1 | |
1454 | |
1455 v27 = -1; | |
1456 v26 = -1; | |
1457 v25 = -1; | |
1458 v2 = 0; | |
1459 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1460 { | |
1461 v3 = 0; | |
1462 v24 = 0; | |
1463 do | |
1464 { | |
1465 v4 = 1; | |
1466 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1467 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1468 v22[v3] = v6; | |
1469 if ( !v5 ) | |
1470 { | |
1471 if ( (signed int)v6 > 128 ) | |
1472 { | |
1473 switch ( v6 ) | |
1474 { | |
1475 case 0x100u: | |
1476 v27 = 8; | |
1477 break; | |
1478 case 0x200u: | |
1479 v25 = 0; | |
1480 break; | |
1481 case 0x400u: | |
1482 v25 = 1; | |
1483 break; | |
1484 case 0x800u: | |
1485 v26 = 0; | |
1486 break; | |
1487 case 0x1000u: | |
1488 v26 = 1; | |
1489 break; | |
1490 case 0x2000u: | |
1491 v26 = 3; | |
1492 break; | |
1493 case 0x4000u: | |
1494 v26 = 2; | |
1495 break; | |
1496 } | |
1497 } | |
1498 else | |
1499 { | |
1500 if ( v6 == 128 ) | |
1501 { | |
1502 v27 = 4; | |
1503 } | |
1504 else | |
1505 { | |
1506 v7 = v6 - 1; | |
1507 if ( v7 ) | |
1508 { | |
1509 v8 = v7 - 1; | |
1510 if ( v8 ) | |
1511 { | |
1512 v9 = v8 - 2; | |
1513 if ( v9 ) | |
1514 { | |
1515 v10 = v9 - 4; | |
1516 if ( v10 ) | |
1517 { | |
1518 v11 = v10 - 8; | |
1519 if ( v11 ) | |
1520 { | |
1521 v12 = v11 - 16; | |
1522 if ( v12 ) | |
1523 { | |
1524 if ( v12 == 32 ) | |
1525 v27 = 20; | |
1526 } | |
1527 else | |
1528 { | |
1529 v27 = 32; | |
1530 } | |
1531 } | |
1532 else | |
1533 { | |
1534 v27 = 24; | |
1535 } | |
1536 } | |
1537 else | |
1538 { | |
1539 v27 = 28; | |
1540 } | |
1541 } | |
1542 else | |
1543 { | |
1544 v27 = 16; | |
1545 } | |
1546 } | |
1547 else | |
1548 { | |
1549 v27 = 12; | |
1550 } | |
1551 } | |
1552 else | |
1553 { | |
1554 v27 = 0; | |
1555 } | |
1556 } | |
1557 } | |
1558 v2 = 0; | |
1559 v13 = 0; | |
1560 while ( 1 ) | |
1561 { | |
1562 v14 = 0; | |
135 | 1563 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1564 v14 = v4; |
1565 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1566 v14 = v4; | |
1567 if ( v26 != -1 ) | |
1568 { | |
1569 v15 = pPlayers[v13 + 1]->GetRace(); | |
1570 if ( v26 == v15 ) | |
1571 v14 = 1; | |
1572 } | |
1573 if ( v14 == 1 ) | |
1574 { | |
1575 v16 = pPlayers[v13 + 1]; | |
1576 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1577 v23[v2++] = v13; | |
1578 } | |
1579 ++v13; | |
1580 if ( v13 >= 4 ) | |
1581 break; | |
1582 v4 = 1; | |
1583 } | |
1584 } | |
1585 v3 = v24 + 1; | |
1586 v18 = __OFSUB__(v24 + 1, 15); | |
1587 v17 = v24++ - 14 < 0; | |
1588 } | |
1589 while ( v17 ^ v18 ); | |
1590 if ( v2 ) | |
1591 goto LABEL_61; | |
1592 } | |
1593 v19 = 0; | |
1594 do | |
1595 { | |
1596 v20 = pPlayers[v19 + 1]; | |
1597 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1598 v23[v2++] = v19; | |
1599 ++v19; | |
1600 } | |
1601 while ( v19 < 4 ); | |
1602 if ( v2 ) | |
1603 LABEL_61: | |
1604 result = v23[rand() % v2]; | |
1605 else | |
1606 result = 0; | |
1607 return result; | |
1608 } | |
1609 | |
1610 //----- (0042704B) -------------------------------------------------------- | |
1611 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1612 { | |
1613 stru319 *v3; // edi@1 | |
1614 signed int v4; // ebx@5 | |
1615 signed int v5; // edi@5 | |
1616 | |
1617 v3 = this; | |
1618 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1619 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1620 && rand() % 100 < 5 ) | |
1621 pActor->_44FD29(a2); | |
1622 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1623 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1624 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1625 return 2; | |
1626 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1627 return 3; | |
1628 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1629 } | |
1630 | |
1631 //----- (00427102) -------------------------------------------------------- | |
1632 int stru319::_427102(Actor *pActor, signed int a2) | |
1633 { | |
1634 unsigned __int8 v3; // cf@11 | |
1635 unsigned __int8 v4; // zf@11 | |
1636 SpellBuff *v6; // ecx@46 | |
89 | 1637 Player *v7; // esi@49 |
0 | 1638 signed int v8; // edx@50 |
89 | 1639 SpellBuff *v9; // ecx@50 |
0 | 1640 |
597 | 1641 switch(a2) |
0 | 1642 { |
597 | 1643 case 77: |
1644 { | |
1645 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1646 return 0; | |
1647 return 1; | |
1648 } | |
1649 case 80: | |
1650 { | |
1651 v6 = pParty->pPartyBuffs; | |
1652 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1653 { | |
1654 ++v6; | |
1655 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1656 { | |
1657 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1658 v8 = 0; | |
1659 v9 = v7->pPlayerBuffs; | |
1660 while ( v9->uExpireTime <= 0i64 ) | |
1661 { | |
1662 ++v8; | |
1663 ++v9; | |
1664 if ( v8 >= 24 ) | |
1665 { | |
1666 ++v7; | |
1667 if ( v7 <= &pParty->pPlayers[3] ) | |
1668 { | |
1669 v8 = 0; | |
1670 v9 = v7->pPlayerBuffs; | |
1671 } | |
1672 else | |
1673 return 0; | |
1674 } | |
1675 } | |
1676 return 1; | |
1677 } | |
1678 } | |
1679 return 1; | |
1680 } | |
1681 case 85: | |
1682 { | |
1683 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1684 return 1; | |
1685 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1686 return 0; | |
1687 v3 = 0; | |
1688 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1689 break; | |
1690 } | |
1691 case 86: | |
1692 { | |
0 | 1693 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1694 return 1; |
0 | 1695 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1696 return 0; |
0 | 1697 v3 = 0; |
1698 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1699 break; |
1700 } | |
1701 case 95: | |
1702 { | |
1703 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1704 return 1; | |
0 | 1705 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1706 return 0; |
0 | 1707 v3 = 0; |
1708 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1709 break; |
1710 } | |
1711 case 73: | |
1712 { | |
1713 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1714 return 1; | |
1715 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1716 return 0; | |
1717 v3 = 0; | |
1718 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1719 break; | |
1720 } | |
1721 case 5: | |
1722 { | |
1723 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1724 return 1; | |
1725 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1726 return 0; | |
1727 v3 = 0; | |
1728 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1729 break; | |
1730 } | |
1731 case 17: | |
1732 { | |
1733 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1734 return 1; | |
1735 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1736 return 0; | |
1737 v3 = 0; | |
1738 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1739 break; | |
1740 } | |
1741 case 38: | |
89 | 1742 { |
597 | 1743 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1744 return 1; | |
1745 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1746 return 0; | |
1747 v3 = 0; | |
1748 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1749 } | |
1750 case 46: | |
1751 { | |
1752 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1753 return 1; |
597 | 1754 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1755 return 0; | |
1756 v3 = 0; | |
1757 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1758 break; | |
1759 } | |
1760 case 47: | |
1761 { | |
1762 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1763 return 1; | |
1764 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1765 return 0; | |
1766 v3 = 0; | |
1767 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1768 break; | |
1769 } | |
1770 case 51: | |
1771 { | |
1772 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1773 return 1; | |
1774 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1775 { | |
89 | 1776 v3 = 0; |
1777 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1778 } | |
1779 else | |
597 | 1780 return 0; |
1781 break; | |
1782 } | |
1783 default: | |
89 | 1784 { |
597 | 1785 return 1; |
89 | 1786 } |
0 | 1787 } |
1788 if ( !(v3 | v4) ) | |
1789 return 0; | |
1790 return 1; | |
1791 } | |
1792 | |
1793 //----- (004272F5) -------------------------------------------------------- | |
1794 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1795 { | |
1796 signed int v5; // esi@1 | |
1797 signed int v6; // edi@1 | |
1798 int v7; // esi@8 | |
1799 int v8; // eax@9 | |
1800 int v9; // edx@11 | |
1801 int v10; // edx@13 | |
1802 int v11; // esi@13 | |
1803 unsigned __int8 v12; // sf@13 | |
1804 unsigned __int8 v13; // of@13 | |
1805 int v14; // edx@14 | |
1806 int v15; // eax@14 | |
1807 signed int result; // eax@17 | |
1808 | |
1809 v5 = pActor->pMonsterInfo.uAC; | |
1810 v6 = 0; | |
1811 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1812 v5 /= 2; | |
1813 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1814 v6 = pActor->pActorBuffs[15].uPower; | |
1815 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1816 v6 = pActor->pActorBuffs[16].uPower; | |
1817 v7 = v6 + v5; | |
1818 if ( a3 ) | |
1819 v8 = pPlayer->GetRangedAttack(); | |
1820 else | |
1821 v8 = pPlayer->GetActualAttack(0); | |
1822 v9 = rand() % (v7 + 2 * v8 + 30); | |
1823 if ( a3 == 2 ) | |
1824 { | |
1825 v14 = a4 + v9; | |
1826 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1827 } | |
1828 else | |
1829 { | |
1830 if ( a3 != 3 ) | |
1831 { | |
1832 v10 = a4 + v9; | |
1833 v11 = v7 + 15; | |
1834 v13 = __OFSUB__(v10, v11); | |
1835 v12 = v10 - v11 < 0; | |
1836 goto LABEL_16; | |
1837 } | |
1838 v14 = a4 + v9; | |
1839 v15 = 2 * v7 + 30; | |
1840 } | |
1841 v13 = __OFSUB__(v14, v15); | |
1842 v12 = v14 - v15 < 0; | |
1843 LABEL_16: | |
1844 if ( v12 ^ v13 ) | |
1845 result = 0; | |
1846 else | |
1847 result = 1; | |
1848 return result; | |
1849 } | |
1850 | |
1851 //----- (004273BB) -------------------------------------------------------- | |
1852 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1853 { | |
1854 Actor *v5; // ecx@1 | |
1855 signed int v6; // ebx@1 | |
1856 signed int v7; // esi@1 | |
1857 unsigned __int8 v8; // zf@1 | |
1858 unsigned __int8 v9; // sf@1 | |
1859 int v10; // ebx@10 | |
1860 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1861 | |
1862 v5 = a2; | |
1863 v6 = a2->pMonsterInfo.uAC; | |
1864 v7 = 0; | |
1865 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1866 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1867 a2a = 0; | |
1868 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1869 v6 /= 2; | |
1870 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1871 v7 = v5->pActorBuffs[14].uPower; | |
1872 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1873 v7 = v5->pActorBuffs[16].uPower; | |
1874 v10 = v7 + v6; | |
1875 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1876 a2a = pActor->pActorBuffs[14].uPower; | |
1877 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1878 a2a = pActor->pActorBuffs[17].uPower; | |
1879 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1880 { | |
1881 a2a += pActor->pActorBuffs[11].uPower; | |
1882 pActor->pActorBuffs[11].Reset(); | |
1883 } | |
1884 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1885 } | |
1886 | |
1887 //----- (004274AD) -------------------------------------------------------- | |
1888 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1889 { | |
1890 signed int v3; // edi@1 | |
1891 signed int v4; // esi@8 | |
1892 int v5; // esi@8 | |
1893 | |
1894 v3 = 0; | |
1895 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1896 v3 = pActor->pActorBuffs[14].uPower; | |
1897 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1898 v3 = pActor->pActorBuffs[17].uPower; | |
1899 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1900 { | |
1901 v3 += pActor->pActorBuffs[11].uPower; | |
1902 pActor->pActorBuffs[11].Reset(); | |
1903 } | |
1904 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1905 v5 = rand() % v4 + 1; | |
1906 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1907 } | |
1908 | |
1909 //----- (00427546) -------------------------------------------------------- | |
1910 int stru319::_427546(int a2) | |
1911 { | |
1912 int result; // eax@2 | |
1913 | |
1914 if ( a2 >= 0 ) | |
1915 { | |
1916 if ( a2 >= 1 ) | |
1917 result = (a2 >= 2) + 2; | |
1918 else | |
1919 result = 1; | |
1920 } | |
1921 else | |
1922 { | |
1923 result = 0; | |
1924 } | |
1925 return result; | |
1926 } | |
1927 | |
1928 //----- (0042756B) -------------------------------------------------------- | |
1929 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1930 { | |
1931 int v4; // edx@1 | |
1932 int v5; // ecx@1 | |
1933 signed int v6; // eax@4 | |
1934 signed int result; // eax@17 | |
1935 signed int v8; // esi@18 | |
1936 | |
1937 v4 = 0; | |
1938 v5 = 0; | |
1939 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1940 v5 = pActor->pActorBuffs[14].uPower; | |
1941 switch ( a2 ) | |
1942 { | |
1943 case 4: | |
1944 v6 = pActor->pMonsterInfo.uResPhysical; | |
1945 break; | |
1946 case 0: | |
1947 v6 = pActor->pMonsterInfo.uResFire; | |
1948 goto LABEL_12; | |
1949 case 1: | |
1950 v6 = pActor->pMonsterInfo.uResAir; | |
1951 goto LABEL_12; | |
1952 case 2: | |
1953 v6 = pActor->pMonsterInfo.uResWater; | |
1954 goto LABEL_12; | |
1955 case 3: | |
1956 v6 = pActor->pMonsterInfo.uResEarth; | |
1957 goto LABEL_12; | |
1958 case 6: | |
1959 v6 = pActor->pMonsterInfo.uResSpirit; | |
1960 break; | |
1961 case 7: | |
1962 v6 = pActor->pMonsterInfo.uResMind; | |
1963 goto LABEL_12; | |
1964 case 8: | |
1965 v6 = pActor->pMonsterInfo.uResBody; | |
1966 LABEL_12: | |
1967 v4 = v5; | |
1968 break; | |
1969 case 9: | |
1970 v6 = pActor->pMonsterInfo.uResLight; | |
1971 break; | |
1972 case 10: | |
1973 v6 = pActor->pMonsterInfo.uResDark; | |
1974 break; | |
1975 default: | |
1976 v6 = 0; | |
1977 break; | |
1978 } | |
1979 if ( v6 < 200 ) | |
1980 { | |
1981 v8 = v4 + v6 + 30; | |
1982 if ( rand() % v8 >= 30 ) | |
1983 { | |
1984 a3 >>= 1; | |
1985 if ( rand() % v8 >= 30 ) | |
1986 { | |
1987 a3 >>= 1; | |
1988 if ( rand() % v8 >= 30 ) | |
1989 { | |
1990 a3 >>= 1; | |
1991 if ( rand() % v8 >= 30 ) | |
1992 a3 >>= 1; | |
1993 } | |
1994 } | |
1995 } | |
1996 result = a3; | |
1997 } | |
1998 else | |
1999 { | |
2000 result = 0; | |
2001 } | |
2002 return result; | |
2003 } | |
2004 | |
2005 //----- (00427662) -------------------------------------------------------- | |
2006 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
2007 { | |
2008 Actor *v3; // edi@2 | |
2009 signed int v4; // esi@2 | |
2010 bool result; // eax@13 | |
2011 | |
2012 switch ( uType ) | |
2013 { | |
2014 case 0u: | |
2015 v3 = pActor; | |
2016 v4 = pActor->pMonsterInfo.uResFire; | |
2017 goto LABEL_12; | |
2018 case 1u: | |
2019 v3 = pActor; | |
2020 v4 = pActor->pMonsterInfo.uResAir; | |
2021 goto LABEL_12; | |
2022 case 2u: | |
2023 v3 = pActor; | |
2024 v4 = pActor->pMonsterInfo.uResWater; | |
2025 goto LABEL_12; | |
2026 case 3u: | |
2027 v3 = pActor; | |
2028 v4 = pActor->pMonsterInfo.uResEarth; | |
2029 goto LABEL_12; | |
2030 case 7u: | |
2031 v3 = pActor; | |
2032 v4 = pActor->pMonsterInfo.uResMind; | |
2033 goto LABEL_12; | |
2034 case 6u: | |
2035 v3 = pActor; | |
2036 v4 = pActor->pMonsterInfo.uResSpirit; | |
2037 goto LABEL_12; | |
2038 case 8u: | |
2039 v3 = pActor; | |
2040 v4 = pActor->pMonsterInfo.uResBody; | |
2041 goto LABEL_12; | |
2042 case 9u: | |
2043 v3 = pActor; | |
2044 v4 = pActor->pMonsterInfo.uResLight; | |
2045 goto LABEL_12; | |
2046 case 0xAu: | |
2047 v3 = pActor; | |
2048 v4 = pActor->pMonsterInfo.uResDark; | |
2049 goto LABEL_12; | |
2050 case 4u: | |
2051 v3 = pActor; | |
2052 v4 = pActor->pMonsterInfo.uResPhysical; | |
2053 LABEL_12: | |
2054 if ( v4 < 200 ) | |
2055 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2056 else | |
2057 result = 0; | |
2058 break; | |
2059 default: | |
2060 result = 1; | |
2061 break; | |
2062 } | |
2063 return result; | |
2064 } | |
2065 | |
2066 //----- (00427769) -------------------------------------------------------- | |
2067 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2068 { | |
2069 bool result; // eax@2 | |
2070 | |
710 | 2071 __debugbreak(); // refactor |
0 | 2072 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2073 result = 1; | |
2074 else | |
2075 result = 0; | |
2076 return result; | |
2077 } | |
2078 | |
2079 //----- (0042777D) -------------------------------------------------------- | |
319 | 2080 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2081 { |
370 | 2082 //bool result; // eax@2 |
486 | 2083 //__int16 v6; // bx@4 |
437 | 2084 //Player *v7; // eax@4 |
486 | 2085 //char v8; // zf@12 |
0 | 2086 unsigned __int16 v9; // cx@16 |
2087 unsigned int v10; // eax@18 | |
2088 unsigned __int8 v11; // sf@18 | |
2089 unsigned __int8 v12; // of@18 | |
2090 unsigned __int16 v13; // cx@21 | |
2091 unsigned int v14; // eax@23 | |
486 | 2092 //stru277 *v15; // esi@27 |
2093 //stru277 *v16; // eax@28 | |
832 | 2094 //GUIWindow *v17; // eax@43 |
2095 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2096 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2097 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2098 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2099 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2100 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2101 //int v24; // [sp-18h] [bp-30h]@44 | |
2102 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2103 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2104 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2105 //char *v28; // [sp-8h] [bp-20h]@43 | |
2106 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2107 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2108 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2109 | |
2110 //a3a = uPlayerID; | |
2111 //a2a = a1; | |
370 | 2112 |
2113 //if ( pParty->bTurnBasedModeOn != 1 | |
2114 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2115 if (pParty->bTurnBasedModeOn) | |
0 | 2116 { |
370 | 2117 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2118 return; | |
2119 } | |
2120 | |
2121 | |
486 | 2122 //v6 = a5; |
437 | 2123 //v7 = &pParty->pPlayers[uPlayerID]; |
2124 assert(uPlayerID < 4); | |
2125 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2126 if ( !(a5 & 0x10) ) |
2127 { | |
2128 switch ( a1 ) | |
2129 { | |
486 | 2130 case SPELL_SPIRIT_FATE: |
2131 case SPELL_BODY_FIRST_AID: | |
2132 case SPELL_DARK_REANIMATE: | |
2133 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2134 a5 |= 0x0100; | |
0 | 2135 break; |
486 | 2136 |
2137 case SPELL_FIRE_FIRE_AURA: | |
2138 case SPELL_WATER_RECHARGE_ITEM: | |
2139 case SPELL_WATER_ENCHANT_ITEM: | |
2140 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2141 //LOBYTE(v6) = a5 | 0x80; | |
2142 a5 |= 0x0080; | |
0 | 2143 break; |
486 | 2144 |
2145 case SPELL_FIRE_FIRE_BOLT: | |
2146 case SPELL_FIRE_FIREBALL: | |
2147 case SPELL_FIRE_INCINERATE: | |
2148 case SPELL_AIR_LIGHNING_BOLT: | |
2149 case SPELL_AIR_IMPLOSION: | |
2150 case SPELL_WATER_POISON_SPRAY: | |
2151 case SPELL_WATER_ICE_BOLT: | |
2152 case SPELL_WATER_ACID_BURST: | |
2153 case SPELL_WATER_ICE_BLAST: | |
2154 case SPELL_EARTH_STUN: | |
2155 case SPELL_EARTH_SLOW: | |
2156 case SPELL_EARTH_DEADLY_SWARM: | |
2157 case SPELL_EARTH_BLADES: | |
2158 case SPELL_EARTH_MASS_DISTORTION: | |
2159 case SPELL_SPIRIT_SPIRIT_LASH: | |
2160 case SPELL_MIND_MIND_BLAST: | |
2161 case SPELL_MIND_CHARM: | |
2162 case SPELL_MIND_PSYCHIC_SHOCK: | |
2163 case SPELL_BODY_HARM: | |
2164 case SPELL_BODY_FLYING_FIST: | |
2165 case SPELL_LIGHT_LIGHT_BOLT: | |
2166 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2167 case SPELL_LIGHT_SUNRAY: | |
2168 case SPELL_DARK_TOXIC_CLOUD: | |
2169 case SPELL_DARK_SHRINKING_RAY: | |
2170 case SPELL_DARK_SHARPMETAL: | |
2171 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2172 if ( !a6 ) |
486 | 2173 a5 |= 0x0008; |
0 | 2174 break; |
486 | 2175 case SPELL_MIND_TELEPATHY: |
2176 case SPELL_MIND_BERSERK: | |
2177 case SPELL_MIND_ENSLAVE: | |
2178 case SPELL_LIGHT_PARALYZE: | |
2179 case SPELL_DARK_CONTROL_UNDEAD: | |
2180 //LABEL_9: | |
2181 //v6 = a5 | 8; | |
2182 a5 |= 0x0008; | |
0 | 2183 break; |
486 | 2184 |
2185 case SPELL_EARTH_TELEKINESIS: | |
2186 a5 |= 0x0040; | |
2187 break; | |
2188 | |
2189 case SPELL_SPIRIT_BLESS: | |
2190 if (a4 && ~a4 & 0x01C0) | |
2191 goto LABEL_25; | |
2192 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); | |
0 | 2193 goto LABEL_25; |
2194 break; | |
486 | 2195 |
2196 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2197 v9 = a4; |
2198 if ( !a4 ) | |
437 | 2199 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
0 | 2200 goto LABEL_18; |
486 | 2201 |
2202 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2203 v9 = a4; |
2204 if ( !a4 ) | |
437 | 2205 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
0 | 2206 LABEL_18: |
2207 v10 = SkillToMastery(v9); | |
2208 v12 = __OFSUB__(v10, 3); | |
2209 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2210 goto LABEL_24; | |
486 | 2211 |
2212 case SPELL_BODY_HAMMERHANDS: | |
0 | 2213 v13 = a4; |
2214 if ( !a4 ) | |
437 | 2215 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2216 v14 = SkillToMastery(v13); |
2217 v12 = __OFSUB__(v14, 4); | |
2218 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
2219 LABEL_24: | |
2220 if ( v11 ^ v12 ) | |
2221 goto LABEL_25; | |
2222 break; | |
486 | 2223 |
2224 case SPELL_EARTH_STONE_TO_FLESH: | |
2225 case SPELL_SPIRIT_REMOVE_CURSE: | |
2226 case SPELL_SPIRIT_RAISE_DEAD: | |
2227 case SPELL_SPIRIT_RESSURECTION: | |
2228 case SPELL_MIND_REMOVE_FEAR: | |
2229 case SPELL_MIND_CURE_PARALYSIS: | |
2230 case SPELL_MIND_CURE_INSANITY: | |
2231 case SPELL_BODY_CURE_WEAKNESS: | |
2232 case SPELL_BODY_REGENERATION: | |
2233 case SPELL_BODY_CURE_POISON: | |
2234 case SPELL_BODY_CURE_DISEASE: | |
0 | 2235 LABEL_25: |
486 | 2236 //v6 = a5 | 2; |
2237 a5 |= 0x0002; | |
0 | 2238 break; |
486 | 2239 |
2240 case SPELL_DARK_SACRIFICE: | |
2241 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2242 a5 |= 0x0200; | |
0 | 2243 break; |
2244 default: | |
2245 break; | |
2246 } | |
2247 } | |
370 | 2248 |
486 | 2249 |
2250 if (a5 & 0x3CA) | |
0 | 2251 { |
924 | 2252 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2253 for (uint i = 0; i < 10; ++i) |
924 | 2254 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2255 { |
924 | 2256 pCastSpellInfo[i].spellnum = 0; |
486 | 2257 break; |
2258 } | |
0 | 2259 } |
486 | 2260 |
924 | 2261 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2262 for (uint i = 0; i < 10; ++i) |
0 | 2263 { |
924 | 2264 auto spell = pCastSpellInfo + i; |
486 | 2265 if (!spell->spellnum) |
2266 continue; | |
2267 | |
2268 spell->spellnum = 0; | |
2269 if (spell->field_8 & 0x3CA) | |
0 | 2270 { |
486 | 2271 pGUIWindow_Settings->Release(); |
2272 pGUIWindow_Settings = nullptr; | |
2273 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2274 GameUI_Footer_TimeLeft = 0; |
486 | 2275 unk_50C9A0 = 0; |
2276 back_to_game(); | |
0 | 2277 } |
2278 } | |
486 | 2279 |
924 | 2280 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2281 if ( result != -1 ) |
2282 { | |
486 | 2283 if ( a5 & 2 ) |
0 | 2284 { |
2285 if ( pGUIWindow_Settings ) | |
319 | 2286 return; |
924 | 2287 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2288 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); |
2289 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); | |
2290 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); | |
2291 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); | |
319 | 2292 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2293 return; | |
0 | 2294 } |
486 | 2295 if ( a5 & 8 ) |
0 | 2296 { |
2297 if ( pGUIWindow_Settings ) | |
319 | 2298 return; |
832 | 2299 |
924 | 2300 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2301 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); |
319 | 2302 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2303 return; | |
0 | 2304 } |
486 | 2305 if ( a5 & 0x40 ) |
0 | 2306 { |
2307 if ( pGUIWindow_Settings ) | |
319 | 2308 return; |
832 | 2309 |
924 | 2310 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2311 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); |
2312 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2313 return; | |
0 | 2314 } |
486 | 2315 if ( (char)a5 < 0 ) |
0 | 2316 { |
2317 if ( pGUIWindow_Settings ) | |
319 | 2318 return; |
0 | 2319 ++pIcons_LOD->uTexturePacksCount; |
2320 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2321 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2322 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2323 unk_50C9A0 = 1; |
2324 some_active_character = uActiveCharacter; | |
319 | 2325 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2326 return; | |
0 | 2327 } |
486 | 2328 if ( HIBYTE(a5) & 1 ) |
0 | 2329 { |
2330 if ( pGUIWindow_Settings ) | |
319 | 2331 return; |
924 | 2332 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2333 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); |
2334 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); | |
2335 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); | |
2336 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); | |
2337 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); | |
423 | 2338 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2339 } |
486 | 2340 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2341 { |
924 | 2342 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2343 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2344 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2345 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
0 | 2346 1, |
2347 0, | |
832 | 2348 UIMSG_ScrollNPCPanel, 0, |
0 | 2349 0, |
2350 "", | |
832 | 2351 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2352 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2353 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2354 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
0 | 2355 1, |
2356 0, | |
832 | 2357 UIMSG_ScrollNPCPanel, 1, |
0 | 2358 0, |
2359 "", | |
832 | 2360 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
2361 pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0); | |
2362 pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0); | |
0 | 2363 } |
2364 } | |
2365 } | |
2366 | |
2367 //----- (00427D48) -------------------------------------------------------- | |
924 | 2368 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2369 { |
924 | 2370 CastSpellInfo *v2; // esi@1 |
0 | 2371 signed int v3; // ebx@1 |
2372 | |
2373 v2 = this; | |
2374 v3 = 10; | |
2375 do | |
2376 { | |
2377 if ( v2->spellnum ) | |
2378 { | |
2379 if ( v2->field_8 & 0x3CA ) | |
2380 { | |
2381 v2->spellnum = 0; | |
2382 pGUIWindow_Settings->Release(); | |
2383 pGUIWindow_Settings = 0; | |
2384 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2385 GameUI_Footer_TimeLeft = 0; |
0 | 2386 unk_50C9A0 = 0; |
2387 back_to_game(); | |
2388 } | |
2389 } | |
2390 ++v2; | |
2391 --v3; | |
2392 } | |
2393 while ( v3 ); | |
2394 } | |
2395 | |
2396 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2397 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2398 { |
2399 unsigned int result; // eax@1 | |
924 | 2400 CastSpellInfo *v7; // edx@1 |
2401 CastSpellInfo *v8; // ecx@5 | |
0 | 2402 |
2403 result = 0; | |
2404 v7 = this; | |
2405 while ( v7->spellnum ) | |
2406 { | |
2407 ++result; | |
2408 ++v7; | |
2409 if ( (signed int)result >= 10 ) | |
2410 goto LABEL_8; | |
2411 } | |
2412 v8 = &this[result]; | |
2413 v8->spellnum = a2; | |
2414 v8->uPlayerID = uPlayerID; | |
2415 if ( a5 & 0x10 ) | |
2416 v8->uPlayerID_2 = uPlayerID; | |
2417 v8->field_6 = 0; | |
488 | 2418 v8->spell_target_pid = 0; |
0 | 2419 v8->field_8 = a5; |
488 | 2420 v8->forced_spell_skill_level = skill_level; |
823 | 2421 v8->sound_id = spell_sound_id; |
0 | 2422 LABEL_8: |
2423 if ( result == 10 ) | |
2424 result = -1; | |
2425 return result; | |
2426 } | |
2427 | |
2428 //----- (00427E01) -------------------------------------------------------- | |
924 | 2429 void CastSpellInfo::_427E01_cast_spell() |
0 | 2430 { |
486 | 2431 //int v1; // esi@1 |
0 | 2432 int v2; // edi@1 |
924 | 2433 CastSpellInfo *pCastSpell; // ebx@2 |
488 | 2434 //signed int v4; // eax@8 |
2435 //__int16 v5; // ax@9 | |
0 | 2436 signed int v6; // eax@14 |
488 | 2437 //__int16 v7; // ax@23 |
2438 //__int16 v8; // ax@24 | |
2439 //char v9; // al@44 | |
2440 //int v10; // eax@45 | |
0 | 2441 unsigned __int16 v11; // cx@45 |
822 | 2442 //signed int v12; // ecx@48 |
490 | 2443 //int v13; // eax@53 |
0 | 2444 unsigned __int8 v14; // zf@53 |
488 | 2445 //unsigned int v15; // edx@53 |
2446 //signed int v16; // eax@53 | |
0 | 2447 Player *v17; // esi@70 |
822 | 2448 //int v18; // eax@72 |
823 | 2449 //int v19; // eax@74 |
888 | 2450 Player *v20; // eax@74 |
0 | 2451 signed int i; // esi@76 |
823 | 2452 //int v22; // eax@88 |
0 | 2453 __int16 v23; // ax@88 |
488 | 2454 //int v24; // ecx@93 |
2455 //int v25; // ecx@94 | |
2456 //signed __int64 v26; // qax@100 | |
2457 //char *v27; // ecx@100 | |
2458 //unsigned __int64 v28; // qax@102 | |
0 | 2459 int v29; // ecx@105 |
2460 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2461 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2462 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2463 //char *v33; // edx@113 |
823 | 2464 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2465 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2466 //int v36; // edx@125 |
823 | 2467 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2468 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2469 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2470 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2471 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2472 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2473 //int *v43; // ecx@129 |
823 | 2474 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2475 //int v45; // ecx@132 |
0 | 2476 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2477 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2478 //int v48; // eax@137 |
823 | 2479 //int v49; // eax@137 |
822 | 2480 //int v50; // eax@141 |
0 | 2481 int v51; // eax@146 |
2482 __int16 v52; // ax@153 | |
823 | 2483 //int v53; // eax@153 |
0 | 2484 signed __int64 v54; // qax@164 |
2485 int v55; // edi@164 | |
488 | 2486 //stru6 *v56; // eax@165 |
0 | 2487 int v57; // eax@169 |
2488 signed __int64 v58; // qax@177 | |
2489 int v59; // edi@177 | |
2490 unsigned __int16 v60; // ax@184 | |
2491 int v61; // ecx@184 | |
823 | 2492 //int v62; // eax@186 |
0 | 2493 int v63; // ecx@187 |
2494 int v64; // ecx@188 | |
2495 int v65; // ecx@189 | |
710 | 2496 //const char *v66; // ecx@200 |
2497 //unsigned int v67; // edx@201 | |
0 | 2498 char v68; // al@207 |
89 | 2499 ItemGen *v69; // esi@211 |
0 | 2500 int v70; // ecx@214 |
2501 int v71; // ecx@215 | |
2502 int v72; // ecx@216 | |
488 | 2503 //__int16 v73; // ST1C_2@222 |
2504 //__int16 v74; // ST18_2@222 | |
2505 //stru6 *v75; // eax@222 | |
0 | 2506 int v76; // ecx@223 |
2507 int v77; // ecx@224 | |
2508 int v78; // ecx@225 | |
2509 int v79; // eax@227 | |
488 | 2510 //int v80; // eax@232 |
2511 //__int16 v81; // ST18_2@245 | |
2512 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2513 //signed int v83; // edi@245 |
488 | 2514 //__int16 v84; // ST18_2@245 |
2515 //stru6 *v85; // eax@245 | |
2516 //__int16 v86; // ST18_2@245 | |
2517 //stru6 *v87; // eax@245 | |
2518 //__int16 v88; // ST18_2@245 | |
2519 //stru6 *v89; // eax@245 | |
0 | 2520 double v90; // st7@245 |
2521 int v91; // eax@250 | |
89 | 2522 Player *v92; // eax@255 |
488 | 2523 //__int16 v93; // ST18_2@260 |
2524 //stru6 *v94; // eax@260 | |
2525 //__int16 v95; // ST18_2@260 | |
2526 //stru6 *v96; // eax@260 | |
2527 //__int16 v97; // ST18_2@260 | |
2528 //stru6 *v98; // eax@260 | |
2529 //__int16 v99; // ST18_2@260 | |
2530 //stru6 *v100; // eax@260 | |
0 | 2531 int v101; // ecx@261 |
2532 int v102; // ecx@262 | |
2533 int v103; // ecx@263 | |
2534 int v104; // eax@265 | |
2535 int v105; // edi@271 | |
488 | 2536 //__int16 v106; // ST18_2@272 |
2537 //stru6 *v107; // eax@272 | |
0 | 2538 __int16 v108; // ST1C_2@274 |
2539 __int16 v109; // ST18_2@274 | |
2540 stru6 *v110; // eax@274 | |
2541 int v111; // eax@274 | |
2542 Actor *v112; // esi@278 | |
2543 int v113; // eax@278 | |
2544 int v114; // ebx@278 | |
2545 unsigned int v115; // ecx@278 | |
2546 int v116; // edx@279 | |
2547 int v117; // edx@281 | |
2548 int v118; // edx@283 | |
2549 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2550 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2551 //int v121; // eax@286 |
0 | 2552 signed int v122; // eax@286 |
2553 int v123; // ecx@288 | |
2554 int v124; // ecx@289 | |
2555 int v125; // ecx@290 | |
2556 int v126; // eax@292 | |
2557 int v127; // eax@296 | |
488 | 2558 //__int16 v128; // ST18_2@303 |
2559 //stru6 *v129; // eax@303 | |
2560 //__int16 v130; // ST18_2@303 | |
2561 //stru6 *v131; // eax@303 | |
2562 //__int16 v132; // ST18_2@303 | |
2563 //stru6 *v133; // eax@303 | |
2564 //__int16 v134; // ST18_2@303 | |
2565 //stru6 *v135; // eax@303 | |
2566 //unsigned __int64 v136; // qax@304 | |
2567 //char *v137; // ecx@304 | |
0 | 2568 int v138; // ecx@305 |
2569 int v139; // ecx@306 | |
2570 int v140; // eax@308 | |
488 | 2571 //__int16 v141; // ST18_2@311 |
2572 //stru6 *v142; // eax@311 | |
2573 //__int16 v143; // ST18_2@311 | |
2574 //stru6 *v144; // eax@311 | |
2575 //__int16 v145; // ST18_2@311 | |
2576 //stru6 *v146; // eax@311 | |
2577 //__int16 v147; // ST18_2@311 | |
2578 //stru6 *v148; // eax@311 | |
0 | 2579 int v149; // ecx@312 |
2580 int v150; // ecx@313 | |
2581 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2582 //signed int v152; // eax@322 |
0 | 2583 int v153; // ecx@322 |
2584 int v154; // eax@322 | |
2585 int v155; // eax@323 | |
2586 int v156; // eax@323 | |
2587 int v157; // eax@326 | |
2588 double v158; // st7@326 | |
2589 double v159; // st6@326 | |
2590 signed __int64 v160; // qtt@334 | |
823 | 2591 //int v161; // eax@339 |
0 | 2592 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2593 //int v163; // eax@340 |
0 | 2594 signed int v164; // eax@340 |
2595 signed int v165; // edi@340 | |
488 | 2596 //stru6 *v166; // eax@340 |
2597 //stru6 *v167; // eax@340 | |
0 | 2598 signed int v168; // edi@343 |
2599 int v169; // eax@344 | |
2600 int v170; // ecx@346 | |
2601 int v171; // ecx@347 | |
2602 int v172; // ecx@348 | |
2603 int v173; // edi@350 | |
2604 signed int v174; // edi@355 | |
488 | 2605 //__int16 v175; // ST18_2@357 |
2606 //stru6 *v176; // eax@357 | |
2607 //__int16 v177; // ST18_2@357 | |
2608 //stru6 *v178; // eax@357 | |
2609 //__int16 v179; // ST18_2@357 | |
2610 //stru6 *v180; // eax@357 | |
2611 //__int16 v181; // ST18_2@357 | |
2612 //stru6 *v182; // eax@357 | |
2613 //signed __int64 v183; // qax@357 | |
0 | 2614 int v184; // ecx@358 |
2615 int v185; // ecx@359 | |
2616 int v186; // ecx@360 | |
823 | 2617 //int v187; // eax@367 |
0 | 2618 int v188; // esi@369 |
2619 int v189; // edi@369 | |
710 | 2620 //const char *v190; // ecx@377 |
0 | 2621 signed int v191; // edi@379 |
2622 int v192; // ecx@382 | |
2623 int v193; // ecx@383 | |
2624 int v194; // ecx@384 | |
2625 int v195; // eax@386 | |
2626 int v196; // eax@387 | |
488 | 2627 //__int16 v197; // ST18_2@395 |
2628 //stru6 *v198; // eax@395 | |
2629 //__int16 v199; // ST18_2@395 | |
2630 //stru6 *v200; // eax@395 | |
2631 //__int16 v201; // ST18_2@395 | |
2632 //stru6 *v202; // eax@395 | |
2633 //__int16 v203; // ST18_2@395 | |
2634 //stru6 *v204; // eax@395 | |
0 | 2635 signed int v205; // edi@405 |
2636 int v206; // eax@407 | |
2637 __int16 v207; // cx@407 | |
2638 int v208; // eax@411 | |
2639 signed int v209; // ecx@412 | |
2640 int v210; // edx@412 | |
2641 signed int v211; // ecx@412 | |
2642 int v212; // eax@413 | |
2643 int v213; // eax@413 | |
2644 int v214; // eax@413 | |
2645 int v215; // eax@415 | |
2646 double v216; // st7@415 | |
2647 double v217; // st6@415 | |
2648 signed __int64 v218; // qtt@423 | |
2649 int v219; // ecx@425 | |
2650 int v220; // ecx@426 | |
2651 int v221; // edi@428 | |
890 | 2652 Player *v222; // edi@434 |
0 | 2653 char v223; // al@438 |
2654 int v224; // ecx@442 | |
2655 int v225; // ecx@443 | |
823 | 2656 //int v226; // eax@451 |
0 | 2657 int v227; // esi@453 |
2658 unsigned int v228; // edi@454 | |
2659 int v229; // edi@466 | |
488 | 2660 //__int16 v230; // ST18_2@469 |
2661 //stru6 *v231; // eax@469 | |
2662 //signed int v232; // esi@469 | |
2663 //__int16 v233; // ST18_2@469 | |
2664 //stru6 *v234; // eax@469 | |
2665 //__int16 v235; // ST18_2@469 | |
2666 //stru6 *v236; // eax@469 | |
2667 //__int16 v237; // ST18_2@469 | |
2668 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2669 //__int16 v239; // ST1C_2@469 |
0 | 2670 char *v240; // ecx@472 |
2671 double v241; // st7@478 | |
2672 signed __int64 v242; // qax@484 | |
2673 char *v243; // ecx@484 | |
2674 char *v244; // eax@488 | |
2675 int v245; // edi@492 | |
2676 int v246; // eax@492 | |
2677 char *v247; // eax@497 | |
2678 char v248; // al@497 | |
2679 char v249; // cf@500 | |
2680 float v250; // esi@507 | |
2681 char v251; // al@507 | |
2682 int v252; // edx@510 | |
2683 int m; // esi@510 | |
2684 int v254; // eax@513 | |
2685 int v255; // esi@513 | |
2686 int v256; // ecx@513 | |
2687 int v257; // edx@514 | |
2688 int v258; // ecx@514 | |
2689 char v259; // al@516 | |
2690 int v260; // eax@518 | |
2691 int v261; // esi@519 | |
2692 int v262; // edx@521 | |
2693 int v263; // ecx@521 | |
2694 int v264; // esi@521 | |
2695 int v265; // edx@521 | |
2696 int *ii; // eax@522 | |
2697 int v267; // eax@524 | |
2698 int v268; // eax@524 | |
2699 int v269; // eax@526 | |
2700 char *v270; // eax@531 | |
2701 char v271; // al@531 | |
2702 char v272; // cf@534 | |
2703 float v273; // esi@541 | |
2704 char v274; // al@541 | |
2705 int v275; // edx@544 | |
2706 int k; // esi@544 | |
2707 int v277; // edx@548 | |
2708 int v278; // ecx@548 | |
2709 char v279; // al@550 | |
2710 int v280; // eax@552 | |
2711 int v281; // esi@553 | |
2712 int v282; // edx@555 | |
2713 int v283; // ecx@555 | |
2714 int v284; // esi@555 | |
2715 int v285; // edx@555 | |
2716 int *l; // eax@556 | |
2717 int v287; // eax@558 | |
2718 int v288; // eax@558 | |
2719 ItemGen *v289; // eax@560 | |
2720 signed int v290; // eax@560 | |
2721 unsigned __int8 v291; // al@564 | |
2722 char v292; // al@573 | |
2723 int v293; // eax@575 | |
2724 ItemGen *v294; // esi@575 | |
2725 int v295; // edx@575 | |
2726 int kk; // edi@575 | |
2727 int v297; // edx@579 | |
2728 int v298; // ecx@579 | |
2729 char v299; // al@581 | |
2730 int v300; // eax@583 | |
2731 int v301; // edi@584 | |
2732 int v302; // edx@586 | |
2733 int v303; // ecx@586 | |
2734 int v304; // edi@586 | |
2735 int v305; // edx@586 | |
2736 int *jj; // eax@587 | |
2737 int v307; // eax@589 | |
2738 int v308; // eax@589 | |
2739 char *v309; // ecx@593 | |
2740 char v310; // sf@593 | |
2741 unsigned __int8 v311; // of@593 | |
2742 char v312; // cl@597 | |
488 | 2743 char v313; // al@606pGame->GetStru6() |
0 | 2744 int v314; // edx@607 |
2745 int j; // esi@607 | |
2746 unsigned int v316; // eax@613 | |
2747 const char *v317; // ecx@617 | |
2748 Player *v318; // ecx@619 | |
2749 unsigned int v319; // edi@627 | |
2750 int v320; // ecx@629 | |
2751 int v321; // ecx@630 | |
2752 int v322; // edi@632 | |
2753 int v323; // edi@635 | |
2754 char *v324; // eax@635 | |
2755 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2756 //int v326; // eax@643 |
823 | 2757 //int v327; // eax@648 |
0 | 2758 int v328; // ecx@651 |
2759 int v329; // ecx@652 | |
2760 int v330; // edi@654 | |
488 | 2761 //__int16 v331; // ST18_2@658 |
2762 //stru6 *v332; // eax@658 | |
2763 //__int16 v333; // ST18_2@658 | |
2764 //stru6 *v334; // eax@658 | |
2765 //__int16 v335; // ST18_2@658 | |
2766 //stru6 *v336; // eax@658 | |
2767 //__int16 v337; // ST18_2@658 | |
2768 //stru6 *v338; // eax@658 | |
0 | 2769 int v339; // ecx@659 |
2770 int v340; // ecx@660 | |
2771 int v341; // eax@663 | |
2772 signed int v342; // edi@668 | |
2773 signed int v343; // edi@670 | |
2774 unsigned __int64 v344; // ST08_8@670 | |
488 | 2775 //__int16 v345; // ST1C_2@671 |
2776 //__int16 v346; // ST18_2@671 | |
2777 //stru6 *v347; // eax@671 | |
0 | 2778 int v348; // ecx@672 |
2779 int v349; // ecx@673 | |
2780 int v350; // edi@676 | |
2781 Player *v351; // edi@680 | |
488 | 2782 //__int16 v352; // ST18_2@685 |
2783 //stru6 *v353; // eax@685 | |
0 | 2784 int v354; // ecx@686 |
2785 int v355; // ecx@687 | |
2786 int v356; // eax@689 | |
112 | 2787 Player *v357; // edi@694 |
488 | 2788 //unsigned __int16 v358; // ST1C_2@695 |
2789 //__int16 v359; // ST18_2@695 | |
2790 //stru6 *v360; // eax@695 | |
2791 //__int16 v361; // ST1C_2@697 | |
2792 //__int16 v362; // ST18_2@697 | |
2793 //stru6 *v363; // eax@697 | |
0 | 2794 int v364; // ecx@698 |
2795 int v365; // ecx@699 | |
2796 int v366; // eax@701 | |
488 | 2797 //stru6 *v367; // eax@704 |
823 | 2798 //int v368; // eax@704 |
0 | 2799 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2800 //int v370; // eax@706 |
0 | 2801 int v371; // ecx@709 |
2802 int v372; // ecx@710 | |
2803 int v373; // eax@715 | |
2804 int v374; // eax@717 | |
112 | 2805 Player *v375; // edi@717 |
0 | 2806 int v376; // eax@717 |
2807 Player *v377; // ecx@719 | |
2808 int v378; // ecx@721 | |
2809 int v379; // ecx@722 | |
2810 int v380; // eax@724 | |
2811 int v381; // edi@727 | |
2812 int v382; // ecx@727 | |
2813 Player *v383; // eax@728 | |
2814 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2815 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2816 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2817 //Player *v387; // edi@738 |
0 | 2818 int v388; // edi@740 |
488 | 2819 //unsigned __int16 v389; // ST1C_2@740 |
2820 //__int16 v390; // ST18_2@740 | |
2821 //stru6 *v391; // eax@740 | |
0 | 2822 int v392; // ecx@742 |
2823 int v393; // ecx@743 | |
2824 int v394; // ecx@744 | |
2825 int v395; // edi@747 | |
2826 int v396; // eax@752 | |
2827 int v397; // eax@757 | |
2828 int v398; // eax@757 | |
2829 int v399; // eax@757 | |
2830 char *v400; // esi@757 | |
488 | 2831 //Game *v401; // ecx@759 |
2832 //__int16 v402; // ST1C_2@759 | |
2833 //__int16 v403; // ST18_2@759 | |
2834 //stru6 *v404; // eax@759 | |
0 | 2835 int v405; // ecx@761 |
2836 int v406; // ecx@762 | |
2837 int v407; // edi@765 | |
488 | 2838 //__int16 v408; // ST1C_2@769 |
2839 //__int16 v409; // ST18_2@769 | |
2840 //stru6 *v410; // eax@769 | |
0 | 2841 int v411; // ecx@772 |
2842 int v412; // ecx@773 | |
2843 int v413; // edi@775 | |
488 | 2844 //__int16 v414; // ST1C_2@781 |
2845 //__int16 v415; // ST18_2@781 | |
2846 //stru6 *v416; // eax@781 | |
0 | 2847 int v417; // eax@787 |
2848 int v418; // ecx@789 | |
2849 __int16 v419; // ax@791 | |
2850 signed int v420; // eax@793 | |
2851 int v421; // edx@793 | |
2852 const char *v422; // eax@801 | |
2853 int v423; // ecx@808 | |
2854 int v424; // ecx@809 | |
2855 int v425; // eax@811 | |
2856 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2857 //signed int v427; // eax@820 |
0 | 2858 int v428; // ecx@825 |
2859 int v429; // ecx@826 | |
2860 int v430; // eax@828 | |
488 | 2861 //stru6 *v431; // eax@831 |
823 | 2862 //int v432; // eax@831 |
0 | 2863 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2864 //int v434; // eax@833 |
0 | 2865 int v435; // ecx@837 |
2866 int v436; // ecx@838 | |
488 | 2867 //__int16 v437; // ST1C_2@843 |
2868 //__int16 v438; // ST18_2@843 | |
2869 //stru6 *v439; // eax@843 | |
0 | 2870 int v440; // eax@843 |
2871 int v441; // eax@847 | |
2872 int v442; // ecx@850 | |
2873 int v443; // ecx@851 | |
2874 int v444; // eax@853 | |
2875 signed int v445; // edi@857 | |
2876 int v446; // ecx@862 | |
2877 LevelDecoration *v447; // edi@864 | |
2878 __int16 v448; // ax@864 | |
2879 char *v449; // esi@870 | |
2880 int v450; // eax@870 | |
2881 int v451; // ecx@875 | |
2882 int v452; // ecx@876 | |
2883 int v453; // edi@878 | |
488 | 2884 //__int16 v454; // ST1C_2@884 |
2885 //__int16 v455; // ST18_2@884 | |
2886 //stru6 *v456; // eax@884 | |
0 | 2887 int v457; // ecx@887 |
2888 int v458; // ecx@888 | |
2889 int v459; // eax@890 | |
2890 signed int v460; // eax@895 | |
2891 Actor *v461; // eax@897 | |
2892 unsigned __int16 v462; // cx@897 | |
2893 signed int v463; // edx@897 | |
2894 int v464; // ecx@905 | |
2895 int v465; // ecx@906 | |
2896 int v466; // edi@909 | |
488 | 2897 //__int16 v467; // ST1C_2@913 |
2898 //__int16 v468; // ST18_2@913 | |
2899 //stru6 *v469; // eax@913 | |
0 | 2900 int v470; // edi@913 |
2901 int v471; // eax@917 | |
2902 int v472; // eax@917 | |
2903 char *v473; // esi@918 | |
488 | 2904 //__int16 v474; // ST18_2@920 |
2905 //stru6 *v475; // eax@920 | |
2906 //__int16 v476; // ST18_2@920 | |
2907 //stru6 *v477; // eax@920 | |
2908 //__int16 v478; // ST18_2@920 | |
2909 //stru6 *v479; // eax@920 | |
2910 //__int16 v480; // ST18_2@920 | |
2911 //stru6 *v481; // eax@920 | |
2912 //__int16 v482; // ST18_2@923 | |
2913 //stru6 *v483; // eax@923 | |
2914 //__int16 v484; // ST18_2@923 | |
2915 //stru6 *v485; // eax@923 | |
2916 //__int16 v486; // ST18_2@923 | |
2917 //stru6 *v487; // eax@923 | |
2918 //__int16 v488; // ST18_2@923 | |
2919 //stru6 *v489; // eax@923 | |
2920 //__int16 v490; // ST1C_2@924 | |
2921 //__int16 v491; // ST18_2@924 | |
2922 //stru6 *v492; // eax@924 | |
0 | 2923 int v493; // ecx@925 |
2924 int v494; // ecx@926 | |
488 | 2925 //__int16 v495; // ST1C_2@931 |
2926 //__int16 v496; // ST18_2@931 | |
2927 //stru6 *v497; // eax@931 | |
0 | 2928 int v498; // edi@931 |
2929 int v499; // eax@935 | |
2930 int v500; // eax@935 | |
2931 Player *v501; // edi@939 | |
488 | 2932 //__int16 v502; // ST18_2@940 |
2933 //stru6 *v503; // eax@940 | |
2934 //stru6 *v504; // eax@943 | |
0 | 2935 int v505; // eax@943 |
823 | 2936 //int v506; // eax@943 |
0 | 2937 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2938 //int v508; // eax@944 |
0 | 2939 signed int v509; // eax@944 |
2940 signed int v510; // edi@944 | |
2941 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2942 //int v512; // eax@946 |
0 | 2943 SpellBuff *v513; // edi@946 |
2944 int v514; // ecx@950 | |
2945 int v515; // ecx@951 | |
2946 int v516; // eax@953 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2947 //int v517; // eax@956 |
90 | 2948 Actor *v518; // edx@957 |
0 | 2949 __int16 v519; // cx@958 |
2950 int v520; // ecx@968 | |
2951 int v521; // ecx@969 | |
2952 int v522; // eax@971 | |
488 | 2953 //__int16 v523; // ST18_2@975 |
2954 //stru6 *v524; // eax@975 | |
2955 //__int16 v525; // ST18_2@975 | |
2956 //stru6 *v526; // eax@975 | |
2957 //__int16 v527; // ST18_2@975 | |
2958 //stru6 *v528; // eax@975 | |
2959 //__int16 v529; // ST18_2@975 | |
2960 //stru6 *v530; // eax@975 | |
0 | 2961 int v531; // eax@982 |
823 | 2962 //int v532; // eax@982 |
0 | 2963 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2964 //int v534; // eax@983 |
0 | 2965 signed int v535; // eax@983 |
2966 signed int v536; // edi@983 | |
2967 stru6 *v537; // eax@984 | |
2968 int v538; // ecx@985 | |
2969 int v539; // ecx@986 | |
2970 int v540; // eax@988 | |
488 | 2971 //__int16 v541; // ST18_2@991 |
2972 //stru6 *v542; // eax@991 | |
2973 //__int16 v543; // ST18_2@991 | |
2974 //stru6 *v544; // eax@991 | |
2975 //__int16 v545; // ST18_2@991 | |
2976 //stru6 *v546; // eax@991 | |
2977 //__int16 v547; // ST18_2@991 | |
0 | 2978 stru6 *v548; // eax@991 |
2979 double v549; // st7@991 | |
2980 unsigned __int16 v550; // di@991 | |
2981 int v551; // ecx@993 | |
2982 int v552; // ecx@994 | |
89 | 2983 Player *v553; // edi@1001 |
488 | 2984 //__int16 v554; // ST18_2@1002 |
2985 //stru6 *v555; // eax@1002 | |
2986 //__int16 v556; // ST18_2@1002 | |
2987 //stru6 *v557; // eax@1002 | |
2988 //__int16 v558; // ST18_2@1002 | |
2989 //stru6 *v559; // eax@1002 | |
2990 //__int16 v560; // ST18_2@1002 | |
2991 //stru6 *v561; // eax@1002 | |
0 | 2992 unsigned __int16 v562; // di@1005 |
2993 signed int v563; // eax@1010 | |
2994 unsigned int v564; // ecx@1011 | |
2995 signed int v565; // eax@1012 | |
2996 Player **v566; // ecx@1012 | |
2997 int v567; // eax@1012 | |
488 | 2998 //unsigned __int16 v568; // ST1C_2@1012 |
2999 //__int16 v569; // ST18_2@1012 | |
3000 //stru6 *v570; // eax@1012 | |
0 | 3001 Player *v571; // eax@1013 |
3002 char *v572; // ecx@1013 | |
3003 int v573; // ecx@1017 | |
3004 int v574; // ecx@1018 | |
3005 int v575; // eax@1020 | |
3006 signed int v576; // eax@1025 | |
3007 Player *v577; // eax@1026 | |
3008 int v578; // eax@1028 | |
3009 __int16 v579; // ax@1029 | |
823 | 3010 //int v580; // eax@1031 |
0 | 3011 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3012 //int v582; // eax@1031 |
488 | 3013 //__int16 v583; // ST1C_2@1034 |
3014 //__int16 v584; // ST18_2@1034 | |
0 | 3015 char *v585; // esi@1034 |
488 | 3016 //stru6 *v586; // eax@1034 |
0 | 3017 signed int v587; // eax@1035 |
3018 int v588; // ecx@1036 | |
3019 int v589; // ecx@1037 | |
3020 int v590; // ecx@1038 | |
3021 char v591; // al@1048 | |
3022 int v592; // esi@1052 | |
3023 int v593; // ecx@1057 | |
3024 int v594; // ecx@1058 | |
823 | 3025 //int v595; // eax@1064 |
0 | 3026 int v596; // esi@1066 |
3027 unsigned int v597; // edi@1067 | |
3028 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3029 //signed int v599; // eax@1082 |
0 | 3030 int v600; // edi@1086 |
3031 int v601; // edx@1086 | |
3032 int v602; // eax@1086 | |
3033 int v603; // ecx@1086 | |
823 | 3034 //int v604; // eax@1087 |
0 | 3035 char *v605; // eax@1089 |
3036 int v606; // edx@1091 | |
3037 int v607; // ecx@1100 | |
3038 __int16 v608; // ax@1102 | |
3039 signed int v609; // eax@1104 | |
3040 int v610; // edi@1106 | |
3041 unsigned int v611; // eax@1106 | |
89 | 3042 Player *v612; // edi@1106 |
3043 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3044 int v614; // eax@1116 |
3045 int v615; // edi@1119 | |
488 | 3046 //__int16 v616; // ST1C_2@1122 |
3047 //__int16 v617; // ST18_2@1122 | |
3048 //stru6 *v618; // eax@1122 | |
112 | 3049 Player *v619; // edi@1123 |
488 | 3050 //unsigned __int16 v620; // ST1C_2@1124 |
3051 //__int16 v621; // ST18_2@1124 | |
3052 //stru6 *v622; // eax@1124 | |
0 | 3053 signed __int64 v623; // qax@1127 |
823 | 3054 //int v624; // eax@1127 |
0 | 3055 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3056 //int v626; // eax@1129 |
0 | 3057 signed int v627; // eax@1129 |
3058 signed int v628; // edi@1129 | |
3059 int v629; // ecx@1130 | |
3060 Player *v630; // eax@1131 | |
3061 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3062 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3063 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3064 //signed int v634; // eax@1140 |
0 | 3065 int v635; // edi@1142 |
488 | 3066 //unsigned __int16 v636; // ST1C_2@1142 |
3067 //__int16 v637; // ST18_2@1142 | |
3068 //stru6 *v638; // eax@1142 | |
3069 //stru6 *v639; // eax@1143 | |
0 | 3070 int v640; // ecx@1146 |
3071 int v641; // ecx@1147 | |
3072 int v642; // edi@1156 | |
3073 int v643; // eax@1156 | |
3074 int v644; // eax@1156 | |
3075 signed int v645; // eax@1158 | |
488 | 3076 //Player *v646; // ebx@1169 |
3077 //int v647; // edi@1169 | |
3078 //signed int v648; // ST1C_4@1170 | |
3079 //Player *v649; // ecx@1170 | |
3080 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3081 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3082 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3083 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3084 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3085 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3086 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3087 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3088 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3089 int v659; // [sp+0h] [bp-E84h]@123 |
3090 int v660; // [sp+0h] [bp-E84h]@146 | |
3091 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3092 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3093 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3094 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3095 int v665; // [sp+0h] [bp-E84h]@807 | |
3096 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3097 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3098 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3099 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3100 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3101 int v671; // [sp+4h] [bp-E80h]@146 |
3102 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3103 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3104 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3105 const char *v675; // [sp+4h] [bp-E80h]@800 |
3106 int v676; // [sp+4h] [bp-E80h]@807 | |
3107 int v677; // [sp+4h] [bp-E80h]@861 | |
3108 int v678; // [sp+4h] [bp-E80h]@997 | |
3109 int v679; // [sp+14h] [bp-E70h]@515 | |
3110 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3111 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3112 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3113 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3114 int v684; // [sp+D04h] [bp-180h]@416 | |
3115 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3116 int x; // [sp+D20h] [bp-164h]@327 | |
3117 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3118 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3119 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3120 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3121 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3122 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3123 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3124 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3125 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3126 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3127 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3128 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3129 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3130 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3131 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3132 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3133 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3134 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3135 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3136 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3137 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3138 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3139 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3140 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
924 | 3141 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
0 | 3142 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3143 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3144 int n; // [sp+DA0h] [bp-E4h]@1 | |
3145 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3146 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3147 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3148 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3149 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3150 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3151 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
|
3152 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3153 int v723; // [sp+E4Ch] [bp-38h]@1 |
3154 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3155 float v725; // [sp+E54h] [bp-30h]@23 | |
3156 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3157 //int v726b; |
0 | 3158 float v727; // [sp+E5Ch] [bp-28h]@1 |
3159 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3160 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3161 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3162 Player *v730b; |
3163 ItemGen *v730c; | |
0 | 3164 int v731; // [sp+E6Ch] [bp-18h]@48 |
3165 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3166 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3167 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3168 int amount; // [sp+E80h] [bp-4h]@1 | |
3169 | |
924 | 3170 //auto ecx0 = this; |
3171 | |
3172 //v711 = ecx0; | |
3173 | |
3174 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
|
3175 //SpriteObject::SpriteObject(&a1); |
0 | 3176 |
486 | 3177 //v1 = 0; |
0 | 3178 v2 = 0; |
3179 amount = 0; | |
3180 LODWORD(v733) = 0; | |
3181 v723 = 0; | |
3182 v727 = 0.0; | |
889 | 3183 //n = 0; |
3184 //while ( 1 ) | |
3185 for(n = 0; n < 10; ++n) | |
0 | 3186 { |
924 | 3187 pCastSpell = &this[n]; |
3188 HIDWORD(v733) = (int)pCastSpell; | |
3189 if ( pCastSpell->spellnum == 0 ) | |
889 | 3190 continue; |
486 | 3191 |
3192 if (pParty->Invisible()) | |
3193 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3194 | |
924 | 3195 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 3196 { |
924 | 3197 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3198 this->_427D48(1); | |
889 | 3199 continue; |
0 | 3200 } |
924 | 3201 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3202 | |
3203 a2 = pCastSpell->spell_target_pid; | |
3204 if (!pCastSpell->spell_target_pid) | |
0 | 3205 { |
924 | 3206 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3207 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3208 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 3209 v666 = 1; |
3210 else | |
3211 v666 = 0; | |
3212 | |
3213 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3214 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3215 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3216 a2 = pMouse->uPointingObjectID; |
0 | 3217 } |
488 | 3218 |
3219 | |
924 | 3220 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3221 if (pSpellSprite.uType) | |
0 | 3222 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3223 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3224 { |
924 | 3225 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3226 v2 = v723; |
3227 } | |
3228 else | |
3229 { | |
3230 v715.uYawAngle = pParty->sRotationY; | |
3231 v715.uPitchAngle = pParty->sRotationX; | |
3232 } | |
3233 } | |
488 | 3234 |
486 | 3235 LODWORD(v725) = 0; |
3236 _this = 0; | |
924 | 3237 if (pCastSpell->forced_spell_skill_level) |
488 | 3238 { |
924 | 3239 v11 = pCastSpell->forced_spell_skill_level; |
488 | 3240 v723 = v11 & 0x3F; |
3241 v2 = v723; | |
3242 } | |
3243 else | |
0 | 3244 { |
488 | 3245 //v667 = PLAYER_SKILL_STAFF; |
924 | 3246 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 3247 v667 = PLAYER_SKILL_FIRE; |
924 | 3248 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 3249 v667 = PLAYER_SKILL_AIR; |
924 | 3250 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 3251 v667 = PLAYER_SKILL_WATER; |
924 | 3252 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 3253 v667 = PLAYER_SKILL_EARTH; |
924 | 3254 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 3255 v667 = PLAYER_SKILL_SPIRIT; |
924 | 3256 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 3257 v667 = PLAYER_SKILL_MIND; |
924 | 3258 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 3259 v667 = PLAYER_SKILL_BODY; |
924 | 3260 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 3261 v667 = PLAYER_SKILL_LIGHT; |
924 | 3262 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 3263 v667 = PLAYER_SKILL_DARK; |
924 | 3264 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 3265 v667 = PLAYER_SKILL_BOW; |
3266 else assert(false && "Unknown spell"); | |
3267 | |
0 | 3268 LODWORD(v725) = v667; |
488 | 3269 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3270 v2 = v723; | |
3271 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3272 } |
488 | 3273 |
0 | 3274 if ( HIBYTE(v11) & 1 ) |
3275 { | |
3276 v731 = 4; | |
3277 } | |
3278 else | |
3279 { | |
3280 if ( (v11 & 0x80u) == 0 ) | |
3281 { | |
3282 v731 = ((v11 & 0x40) != 0) + 1; | |
3283 } | |
3284 else | |
3285 { | |
3286 v731 = 3; | |
3287 } | |
3288 } | |
488 | 3289 |
924 | 3290 if (pCastSpell->forced_spell_skill_level) |
486 | 3291 uRequiredMana = 0; |
488 | 3292 else |
924 | 3293 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3294 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3295 |
3296 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3297 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3298 uRequiredMana = 0; |
488 | 3299 |
924 | 3300 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3301 { | |
3302 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
3303 pCastSpell->spellnum = 0; | |
3304 continue; | |
3305 } | |
3306 v730 = pCastSpell->spellnum; | |
3307 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
3308 { | |
3309 if (!pParty->bTurnBasedModeOn) | |
3310 { | |
3311 //v646 = pPlayer; | |
3312 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3313 //v647 = n; | |
3314 } | |
3315 else | |
3316 { | |
3317 //v647 = n; | |
3318 //v646 = pPlayer; | |
3319 //v648 = sRecoveryTime; | |
3320 //v649 = pPlayer; | |
3321 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
3322 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3323 pTurnEngine->_40471C(); | |
3324 } | |
3325 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3326 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3327 this[n].spellnum = 0; | |
3328 pPlayer->sMana -= uRequiredMana; | |
3329 return; | |
3330 } | |
3331 | |
3332 switch ( pCastSpell->spellnum ) | |
3333 { | |
3334 case SPELL_101: | |
3335 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3336 case SPELL_BOW_ARROW: | |
3337 { | |
3338 v17 = pPlayer; | |
3339 _this = (ItemGen *)1; | |
3340 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3341 _this = (ItemGen *)2; | |
3342 sRecoveryTime = v17->GetAttackRecoveryTime(true); | |
3343 pSpellSprite.stru_24.Reset(); | |
3344 pSpellSprite.spell_level = v2; | |
3345 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3346 pSpellSprite.spell_skill = v731; | |
3347 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3348 if ( v17->WearsItem(510, 2) ) | |
3349 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3350 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3351 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3352 pSpellSprite.uAttributes = 0; | |
3353 pSpellSprite.uSpriteFrameID = 0; | |
3354 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3355 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3356 pSpellSprite.spell_target_pid = a2; | |
3357 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3358 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3359 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3360 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
3361 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
3362 pSpellSprite.uAttributes = 256; | |
3363 if ( pParty->bTurnBasedModeOn == 1 ) | |
3364 pSpellSprite.uAttributes = 260; | |
3365 for ( i = 0; i < (signed int)_this; ++i ) | |
3366 { | |
3367 if ( i ) | |
3368 pSpellSprite.vPosition.z += 32; | |
3369 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3370 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3371 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3372 ++pTurnEngine->field_1C; | |
3373 } | |
3374 break; | |
3375 } | |
3376 case SPELL_LASER_PROJECTILE: | |
3377 { | |
3378 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3379 pSpellSprite.stru_24.Reset(); | |
3380 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3381 pSpellSprite.spell_level = v723; | |
3382 pSpellSprite.spell_skill = v731; | |
3383 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3384 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3385 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3386 pSpellSprite.uAttributes = 0; | |
3387 pSpellSprite.uSpriteFrameID = 0; | |
3388 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3389 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3390 pSpellSprite.spell_target_pid = a2; | |
3391 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3392 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3393 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3394 memcpy(&pSpellSprite.stru_24, | |
3395 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3396 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3397 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3398 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3399 pSpellSprite.uSectorID = v23; | |
889 | 3400 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3401 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3402 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3403 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3404 ++pTurnEngine->field_1C; |
924 | 3405 break; |
3406 } | |
3407 case SPELL_FIRE_TORCH_LIGHT: | |
3408 { | |
889 | 3409 LODWORD(v733) = 3600 * v2; |
3410 | |
3411 switch (v731) | |
3412 { | |
890 | 3413 case 1: amount = 2; break; |
3414 case 2: amount = 3; break; | |
3415 case 3: | |
3416 case 4: amount = 4; break; | |
3417 default: | |
889 | 3418 assert(false); |
3419 } | |
3420 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3421 break; |
889 | 3422 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3423 LODWORD(v727) = 1; | |
890 | 3424 break; |
924 | 3425 } |
3426 case SPELL_FIRE_FIRE_SPIKE: | |
3427 { | |
890 | 3428 v29 = v731 - 2; |
3429 if ( v29 ) | |
3430 { | |
3431 v30 = v29 - 1; | |
3432 if ( v30 ) | |
3433 { | |
3434 if ( v30 == 1 ) | |
3435 amount = 9; | |
3436 else | |
3437 amount = 3; | |
889 | 3438 } |
3439 else | |
3440 { | |
890 | 3441 amount = 7; |
3442 } | |
3443 } | |
3444 else | |
3445 { | |
3446 amount = 5; | |
3447 } | |
3448 //v31 = v3->uPlayerID; | |
3449 //v32 = 8 * v31; | |
3450 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3451 | |
3452 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3453 int _v733 = 0; | |
3454 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3455 { | |
3456 auto object = pSpriteObjects + i; | |
924 | 3457 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
890 | 3458 ++_v733; |
3459 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3460 v730 = uNumSpriteObjects; | |
3461 do | |
3462 { | |
3463 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3464 ++HIDWORD(v733); | |
3465 v33 += 112; | |
3466 --v730; | |
3467 } | |
3468 while ( v730 );*/ | |
3469 } | |
3470 if (_v733 > amount) | |
3471 { | |
3472 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3473 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3474 pCastSpell->spellnum = 0; |
890 | 3475 continue; |
3476 } | |
3477 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3478 break; | |
924 | 3479 pSpellSprite.stru_24.Reset(); |
3480 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3481 pSpellSprite.spell_level = v2; | |
3482 pSpellSprite.spell_skill = v731; | |
3483 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3484 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3485 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3486 pSpellSprite.uAttributes = 0; | |
3487 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3488 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3489 pSpellSprite.uSpriteFrameID = 0; | |
3490 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3491 pSpellSprite.spell_target_pid = a2; | |
3492 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3493 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3494 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 3495 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3496 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3497 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3498 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 3499 ++pTurnEngine->field_1C; |
3500 LODWORD(v727) = 1; | |
3501 break; | |
924 | 3502 } |
3503 case SPELL_AIR_IMPLOSION: | |
3504 { | |
890 | 3505 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3506 break; | |
3507 if (!a2) | |
3508 { | |
3509 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3510 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3511 pCastSpell->spellnum = 0; |
890 | 3512 continue; |
3513 } | |
3514 if (PID_TYPE(a2) != OBJECT_Actor) | |
3515 { | |
889 | 3516 LODWORD(v727) = 1; |
890 | 3517 break; |
3518 } | |
3519 v697.x = 0; | |
3520 v697.y = 0; | |
3521 v697.z = 0; | |
924 | 3522 pSpellSprite.stru_24.Reset(); |
3523 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3524 pSpellSprite.spell_level = v2; | |
3525 pSpellSprite.spell_skill = v731; | |
3526 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3527 pSpellSprite.uAttributes = 0; | |
3528 pSpellSprite.uSectorID = 0; | |
3529 pSpellSprite.uSpriteFrameID = 0; | |
3530 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3531 pSpellSprite.uFacing = 0; | |
3532 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3533 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3534 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3535 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3536 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3537 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3538 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3539 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3540 LODWORD(v727) = 1; | |
3541 break; | |
924 | 3542 } |
3543 case SPELL_EARTH_MASS_DISTORTION: | |
3544 { | |
890 | 3545 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3546 break; | |
3547 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3548 { | |
3549 LODWORD(v727) = 1; | |
3550 break; | |
3551 } | |
3552 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3553 v704.x = 0; | |
3554 v704.y = 0; | |
3555 v704.z = 0; | |
924 | 3556 pSpellSprite.stru_24.Reset(); |
3557 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3558 pSpellSprite.spell_level = v2; | |
3559 pSpellSprite.spell_skill = v731; | |
3560 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3561 pSpellSprite.uAttributes = 0; | |
3562 pSpellSprite.uSectorID = 0; | |
3563 pSpellSprite.uSpriteFrameID = 0; | |
3564 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3565 pSpellSprite.uFacing = 0; | |
3566 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3567 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3568 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3569 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3570 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3571 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3572 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3573 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3574 LODWORD(v727) = 1; | |
3575 break; | |
924 | 3576 } |
3577 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3578 { | |
890 | 3579 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3580 break; | |
3581 //v730 = a2 >> 3; | |
3582 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3583 v691.x = 0; | |
3584 v691.y = 0; | |
3585 v691.z = 0; | |
924 | 3586 pSpellSprite.stru_24.Reset(); |
3587 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3588 pSpellSprite.spell_level = v2; | |
3589 pSpellSprite.spell_skill = v731; | |
3590 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3591 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3592 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3593 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3594 pSpellSprite.uAttributes = 0; | |
3595 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3596 pSpellSprite.uSpriteFrameID = 0; | |
3597 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3598 pSpellSprite.spell_target_pid = a2; | |
3599 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3600 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3601 pSpellSprite.uAttributes |= 0x80u; | |
3602 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3603 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3604 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3605 { | |
3606 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3607 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3608 pCastSpell->spellnum = 0; |
890 | 3609 continue; |
3610 } | |
3611 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3612 LODWORD(v727) = 1; | |
3613 break; | |
924 | 3614 } |
3615 case SPELL_FIRE_FIRE_BOLT: | |
3616 case SPELL_FIRE_FIREBALL: | |
3617 case SPELL_FIRE_INCINERATE: | |
3618 case SPELL_AIR_LIGHNING_BOLT: | |
3619 case SPELL_WATER_ICE_BOLT: | |
3620 case SPELL_WATER_ICE_BLAST: | |
3621 case SPELL_EARTH_STUN: | |
3622 case SPELL_EARTH_DEADLY_SWARM: | |
3623 case SPELL_MIND_MIND_BLAST: | |
3624 case SPELL_MIND_PSYCHIC_SHOCK: | |
3625 case SPELL_BODY_HARM: | |
3626 case SPELL_LIGHT_LIGHT_BOLT: | |
3627 case SPELL_DARK_DRAGON_BREATH: | |
3628 { | |
889 | 3629 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3630 break; |
924 | 3631 pSpellSprite.stru_24.Reset(); |
3632 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3633 pSpellSprite.spell_level = v2; | |
3634 pSpellSprite.spell_skill = v731; | |
3635 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3636 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3637 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3638 pSpellSprite.uAttributes = 0; | |
3639 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3640 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3641 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3642 else | |
3643 pSpellSprite.uSectorID = 0; | |
3644 pSpellSprite.uSpriteFrameID = 0; | |
3645 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3646 pSpellSprite.spell_target_pid = a2; | |
3647 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3648 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3649 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3650 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3651 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3652 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3653 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3654 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3655 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3656 ++pTurnEngine->field_1C; |
3657 LODWORD(v727) = 1; | |
890 | 3658 break; |
924 | 3659 } |
3660 case SPELL_WATER_ACID_BURST: | |
3661 case SPELL_EARTH_BLADES: | |
3662 case SPELL_BODY_FLYING_FIST: | |
3663 case SPELL_DARK_TOXIC_CLOUD: | |
3664 { | |
889 | 3665 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3666 break; |
924 | 3667 pSpellSprite.stru_24.Reset(); |
3668 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3669 pSpellSprite.spell_level = v2; | |
3670 pSpellSprite.spell_skill = v731; | |
3671 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3672 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3673 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3674 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3675 v660 = pParty->vPosition.y; | |
3676 goto LABEL_153; | |
924 | 3677 } |
3678 case SPELL_LIGHT_SUNRAY: | |
3679 { | |
889 | 3680 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
890 | 3681 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3682 { | |
3683 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3684 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3685 pCastSpell->spellnum = 0; |
890 | 3686 continue; |
889 | 3687 } |
3688 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3689 { |
3690 pSpellSprite.stru_24.Reset(); | |
3691 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3692 pSpellSprite.spell_skill = v731; | |
3693 pSpellSprite.spell_level = v2; | |
3694 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3695 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3696 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3697 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3698 v660 = pParty->vPosition.y; | |
3699 goto LABEL_153; | |
3700 } | |
3701 break; | |
3702 } | |
3703 case SPELL_LIGHT_PARALYZE: | |
3704 { | |
890 | 3705 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3706 break; | |
924 | 3707 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3708 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
890 | 3709 { |
3710 LODWORD(v727) = 1; | |
3711 break; | |
3712 } | |
3713 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3714 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3715 v55 = v721; | |
3716 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3717 *(char *)(v55 + 38) |= 8u; | |
3718 *(short *)(v55 + 148) = 0; | |
3719 v672 = 0; | |
3720 *(short *)(v55 + 150) = 0; | |
3721 v661 = (Actor *)v55; | |
3722 goto LABEL_165; | |
924 | 3723 } |
3724 case SPELL_EARTH_SLOW: | |
3725 { | |
889 | 3726 if ( v731 == 2 ) |
3727 { | |
890 | 3728 v57 = 300 * v2; |
889 | 3729 } |
3730 else | |
3731 { | |
890 | 3732 if ( v731 == 3 ) |
3733 { | |
889 | 3734 amount = 4; |
3735 v57 = 300 * v2; | |
3736 goto LABEL_174; | |
890 | 3737 } |
3738 if ( v731 == 4 ) | |
3739 { | |
889 | 3740 v57 = 300 * v2; |
3741 amount = 8; | |
3742 goto LABEL_174; | |
890 | 3743 } |
3744 v57 = 180 * v2; | |
889 | 3745 } |
3746 amount = 2; | |
3747 LABEL_174: | |
3748 LODWORD(v733) = v57; | |
3749 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3750 break; |
889 | 3751 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3752 || (v721 = 836 * PID_ID(a2), |
3753 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3754 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3755 { | |
3756 LODWORD(v727) = 1; | |
3757 break; | |
889 | 3758 } |
3759 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3760 v59 = v721; | |
3761 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3762 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
890 | 3763 v731, |
3764 amount, | |
3765 0, | |
3766 0); | |
889 | 3767 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3768 v672 = 0; | |
3769 v661 = (Actor *)LODWORD(v718); | |
3770 goto LABEL_165; | |
924 | 3771 } |
3772 case SPELL_MIND_CHARM: | |
3773 { | |
890 | 3774 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3775 break; | |
3776 | |
3777 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3778 { | |
3779 LODWORD(v727) = 1; | |
3780 break; | |
3781 } | |
3782 | |
3783 uint power = 300 * v2; | |
3784 if ( v731 == 2 ) | |
3785 { | |
3786 power = 600 * v2; | |
3787 } | |
3788 else if ( v731 == 3 ) | |
3789 power = 29030400; | |
3790 | |
3791 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3792 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3793 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3794 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3795 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3796 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3797 v731, 0, 0, 0); | |
924 | 3798 pSpellSprite.stru_24.Reset(); |
3799 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3800 pSpellSprite.spell_level = v2; | |
3801 pSpellSprite.spell_skill = v731; | |
3802 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3803 v61 = PID_ID(a2); |
3804 goto LABEL_1086; | |
924 | 3805 } |
3806 case SPELL_DARK_SHRINKING_RAY: | |
3807 { | |
889 | 3808 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3809 break; |
924 | 3810 pSpellSprite.stru_24.Reset(); |
3811 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3812 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3813 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3814 pSpellSprite.uAttributes = 0; | |
3815 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3816 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3817 pParty->vPosition.x, |
3818 pParty->vPosition.y, | |
3819 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3820 pSpellSprite.uSpriteFrameID = 0; |
3821 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3822 pSpellSprite.spell_target_pid = a2; | |
3823 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3824 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3825 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3826 pSpellSprite.spell_skill = v731; | |
3827 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3828 pSpellSprite.spell_level = 300 * v2; | |
890 | 3829 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3830 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3831 | |
3832 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3833 | |
3834 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3835 ++pTurnEngine->field_1C; |
3836 LODWORD(v727) = 1; | |
890 | 3837 break; |
924 | 3838 } |
3839 case SPELL_FIRE_FIRE_AURA: | |
3840 { | |
889 | 3841 v63 = v731 - 1; |
3842 if ( !v63 ) | |
3843 { | |
890 | 3844 amount = 10; |
3845 LODWORD(v733) = 3600 * v2; | |
3846 } | |
3847 else | |
3848 { | |
889 | 3849 v64 = v63 - 1; |
3850 if ( !v64 ) | |
3851 { | |
890 | 3852 amount = 11; |
3853 LODWORD(v733) = 3600 * v2; | |
3854 } | |
3855 else | |
3856 { | |
889 | 3857 v65 = v64 - 1; |
3858 if ( !v65 ) | |
3859 { | |
890 | 3860 amount = 12; |
889 | 3861 LABEL_195: |
890 | 3862 LODWORD(v733) = 3600 * v2; |
3863 } | |
3864 else if ( v65 == 1 ) | |
3865 { | |
3866 LODWORD(v733) = 0; | |
3867 amount = 12; | |
3868 } | |
3869 } | |
889 | 3870 } |
3871 LABEL_196: | |
3872 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3873 break; |
924 | 3874 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3875 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3876 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3877 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3878 && !v730c->Broken() | |
3879 && !v730c->uSpecEnchantmentType | |
3880 && !v730c->uEnchantmentType | |
3881 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3882 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3883 { | |
3884 v69 = v730c; | |
3885 v14 = v731 == 4; | |
3886 v730c->uSpecEnchantmentType = amount; | |
3887 if ( !v14 ) | |
889 | 3888 { |
890 | 3889 v69->uExpireTime = pParty->uTimePlayed |
3890 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3891 * 0.033333335); | |
3892 v69->uAttributes |= 8u; | |
889 | 3893 } |
890 | 3894 v69->uAttributes |= 0x10u; |
3895 dword_50C9A8 = 256; | |
3896 LODWORD(v727) = 1; | |
3897 break; | |
889 | 3898 } |
3899 | |
3900 dword_50C9D0 = 113; | |
3901 dword_50C9D4 = 0; | |
3902 dword_50C9D8 = 1; | |
3903 | |
3904 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3905 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3906 pCastSpell->spellnum = 0; |
890 | 3907 continue; |
924 | 3908 } |
3909 case SPELL_BODY_REGENERATION: | |
3910 { | |
890 | 3911 v70 = v731 - 1; |
3912 LODWORD(v733) = 3600 * v2; | |
3913 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3914 { | |
3915 v72 = v71 - 1; | |
3916 if ( v72 ) | |
3917 { | |
3918 if ( v72 == 1 ) | |
3919 amount = 10; | |
889 | 3920 } |
3921 else | |
3922 { | |
890 | 3923 amount = 3; |
3924 } | |
3925 } | |
3926 else | |
3927 { | |
3928 amount = 1; | |
3929 } | |
3930 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3931 break; | |
3932 | |
924 | 3933 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3934 | |
3935 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 | 3936 LODWORD(v727) = 1; |
3937 break; | |
924 | 3938 } |
3939 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3940 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3941 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3942 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3943 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3944 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3945 { | |
3946 v76 = v731 - 1; | |
3947 LODWORD(v733) = 3600 * v2; | |
3948 if ( v76 ) | |
3949 { | |
3950 v77 = v76 - 1; | |
3951 if ( v77 ) | |
3952 { | |
3953 v78 = v77 - 1; | |
3954 if ( v78 ) | |
3955 { | |
3956 if ( v78 != 1 ) | |
3957 goto LABEL_232; | |
3958 v79 = 4 * v2; | |
3959 } | |
3960 else | |
3961 { | |
3962 v79 = 3 * v2; | |
3963 } | |
3964 } | |
3965 else | |
3966 { | |
3967 v79 = 2 * v2; | |
3968 } | |
3969 amount = v79; | |
3970 } | |
3971 else | |
3972 { | |
3973 amount = v2; | |
3974 } | |
3975 LABEL_232: | |
3976 //v80 = v3->spellnum; | |
3977 switch (pCastSpell->spellnum) | |
3978 { | |
3979 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3980 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3981 break; | |
3982 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3983 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3984 break; | |
3985 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3986 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3987 break; | |
3988 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3989 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3990 break; | |
3991 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3992 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3993 break; | |
3994 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3995 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3996 break; | |
3997 default: | |
3998 assert(false); | |
3999 continue; | |
4000 } | |
4001 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4002 break; | |
4003 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4004 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4005 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4007 v90 = (double)(signed int)v733 * 4.2666669; | |
4008 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4009 LODWORD(v727) = 1; | |
4010 break; | |
4011 } | |
4012 case SPELL_FIRE_HASTE: | |
4013 { | |
889 | 4014 if ( v731 <= 0 ) |
890 | 4015 goto LABEL_254; |
889 | 4016 if ( v731 <= 2 ) |
4017 { | |
890 | 4018 v91 = 60 * (v2 + 60); |
889 | 4019 } |
4020 else | |
4021 { | |
890 | 4022 if ( v731 == 3 ) |
4023 { | |
889 | 4024 v91 = 180 * (v2 + 20); |
890 | 4025 } |
4026 else | |
4027 { | |
889 | 4028 if ( v731 != 4 ) |
890 | 4029 goto LABEL_254; |
889 | 4030 v91 = 240 * (v2 + 15); |
890 | 4031 } |
889 | 4032 } |
4033 LODWORD(v733) = v91; | |
4034 LABEL_254: | |
4035 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4036 { | |
890 | 4037 v92 = pParty->pPlayers;//[0].pConditions[1]; |
4038 LODWORD(v727) = 1; | |
4039 do | |
4040 { | |
889 | 4041 if ( v92->pConditions ) |
890 | 4042 LODWORD(v727) = 0; |
889 | 4043 ++v92; |
890 | 4044 } |
4045 while ( v92 <= &pParty->pPlayers[3] ); | |
4046 if (LODWORD(v727)) | |
4047 { | |
889 | 4048 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4049 | |
924 | 4050 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4051 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4052 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4053 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4054 } |
4055 } | |
4056 break; | |
924 | 4057 } |
4058 case SPELL_SPIRIT_BLESS: | |
4059 { | |
889 | 4060 v101 = v731 - 1; |
4061 if ( v101 && (v102 = v101 - 1) != 0 ) | |
4062 { | |
890 | 4063 v103 = v102 - 1; |
4064 if ( v103 ) | |
4065 { | |
889 | 4066 if ( v103 != 1 ) |
890 | 4067 goto LABEL_269; |
889 | 4068 v104 = 3600 * (v2 + 1); |
890 | 4069 } |
4070 else | |
4071 { | |
889 | 4072 v104 = 900 * (v2 + 4); |
890 | 4073 } |
889 | 4074 } |
4075 else | |
4076 { | |
890 | 4077 v104 = 300 * (v2 + 12); |
889 | 4078 } |
4079 LODWORD(v733) = v104; | |
4080 LABEL_269: | |
4081 amount = v2 + 5; | |
4082 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4083 break; |
889 | 4084 if ( v731 == 1 ) |
4085 { | |
924 | 4086 v108 = pCastSpell->uPlayerID_2; |
4087 v109 = pCastSpell->spellnum; | |
890 | 4088 v110 = pGame->GetStru6(); |
4089 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 4090 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 4091 //v668 = 0; |
4092 v716 = v111; | |
4093 //v658 = v111; | |
4094 //v653 = amount; | |
4095 //v651 = 1; | |
4096 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4097 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
889 | 4098 //LABEL_103: |
4099 //HIDWORD(v650) = HIDWORD(v28); | |
4100 //LABEL_104: | |
4101 //LODWORD(v650) = v28; | |
924 | 4102 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 | 4103 LODWORD(v727) = 1; |
890 | 4104 break; |
889 | 4105 } |
4106 v105 = 0; | |
4107 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4108 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4109 do | |
4110 { | |
924 | 4111 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 4112 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4113 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4114 ++v730b; | |
4115 ++v105; | |
889 | 4116 } |
4117 while ( v730b <= &pParty->pPlayers[3] ); | |
4118 LODWORD(v727) = 1; | |
890 | 4119 break; |
4120 } | |
4121 case SPELL_SPIRIT_SPIRIT_LASH: | |
4122 { | |
889 | 4123 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4124 { | |
890 | 4125 //v730 = a2 >> 3; |
4126 v112 = &pActors[PID_ID(a2)]; | |
4127 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4128 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4129 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4130 _this = (ItemGen *)v113; | |
4131 v114 = v721; | |
4132 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4133 if ( v113 < v721 ) | |
4134 { | |
889 | 4135 v116 = v113; |
4136 v113 = v721; | |
4137 v114 = v116; | |
890 | 4138 } |
4139 if ( v113 < (signed int)v115 ) | |
4140 { | |
889 | 4141 v117 = v113; |
4142 v113 = (int)v115; | |
4143 v115 = v117; | |
890 | 4144 } |
4145 if ( v114 < (signed int)v115 ) | |
4146 { | |
889 | 4147 v118 = v115; |
4148 v115 = v114; | |
4149 v114 = v118; | |
890 | 4150 } |
4151 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4152 if ( (double)(signed int)this <= 307.2 ) | |
4153 { | |
889 | 4154 v701.x = 0; |
4155 v701.y = 0; | |
4156 v701.z = 0; | |
924 | 4157 pSpellSprite.stru_24.Reset(); |
889 | 4158 v119 = HIDWORD(v733); |
924 | 4159 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4160 pSpellSprite.spell_level = v723; | |
4161 pSpellSprite.spell_skill = v731; | |
4162 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4163 pSpellSprite.uAttributes = 0; | |
4164 pSpellSprite.uSectorID = 0; | |
4165 pSpellSprite.uSpriteFrameID = 0; | |
4166 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4167 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4168 pSpellSprite.uFacing = 0; | |
4169 pSpellSprite.uSoundID = *(short *)(v119 + 16); | |
4170 pSpellSprite.vPosition.x = v112->vPosition.x; | |
4171 pSpellSprite.vPosition.y = v112->vPosition.y; | |
4172 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4173 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
4174 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
889 | 4175 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4176 LODWORD(v727) = 1; | |
890 | 4177 } |
4178 else | |
4179 { | |
889 | 4180 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4181 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4182 *(int *)HIDWORD(v733) = 0; | |
890 | 4183 } |
924 | 4184 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 4185 } |
4186 break; | |
4187 } | |
4188 case SPELL_AIR_SHIELD: | |
4189 case SPELL_EARTH_STONESKIN: | |
4190 case SPELL_SPIRIT_HEROISM: | |
4191 { | |
889 | 4192 v123 = v731 - 1; |
4193 if ( v123 && (v124 = v123 - 1) != 0 ) | |
4194 { | |
890 | 4195 v125 = v124 - 1; |
4196 if ( v125 ) | |
4197 { | |
889 | 4198 if ( v125 != 1 ) |
890 | 4199 goto LABEL_296; |
889 | 4200 v126 = 3600 * (v2 + 1); |
890 | 4201 } |
4202 else | |
4203 { | |
889 | 4204 v126 = 900 * (v2 + 4); |
890 | 4205 } |
889 | 4206 } |
4207 else | |
4208 { | |
890 | 4209 v126 = 300 * (v2 + 12); |
889 | 4210 } |
4211 LODWORD(v733) = v126; | |
4212 LABEL_296: | |
924 | 4213 v127 = pCastSpell->spellnum; |
889 | 4214 if ( v127 == 17 ) |
4215 { | |
890 | 4216 amount = 0; |
4217 LODWORD(v725) = 14; | |
889 | 4218 } |
4219 else | |
4220 { | |
890 | 4221 if ( v127 == 38 ) |
4222 { | |
889 | 4223 LODWORD(v725) = 15; |
4224 amount = v2 + 5; | |
890 | 4225 } |
4226 else | |
4227 { | |
889 | 4228 if ( v127 != 51 ) |
890 | 4229 continue; |
889 | 4230 LODWORD(v725) = 9; |
4231 amount = v2 + 5; | |
890 | 4232 } |
889 | 4233 } |
4234 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4235 break; |
924 | 4236 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4237 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4238 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4239 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4240 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4241 //LABEL_304: | |
4242 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4243 LODWORD(v727) = 1; | |
890 | 4244 break; |
4245 } | |
4246 case SPELL_FIRE_IMMOLATION: | |
4247 { | |
889 | 4248 v138 = v731 - 2; |
4249 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) | |
890 | 4250 v140 = 600 * v2; |
889 | 4251 else |
890 | 4252 v140 = 60 * v2; |
889 | 4253 LODWORD(v733) = v140; |
4254 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4255 break; |
889 | 4256 |
924 | 4257 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4258 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4259 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4260 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4261 |
4262 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4263 LODWORD(v727) = 1; | |
890 | 4264 break; |
4265 } | |
4266 case SPELL_FIRE_METEOR_SHOWER: | |
4267 { | |
889 | 4268 v149 = v731 - 1; |
4269 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4270 { | |
890 | 4271 if ( v151 == 1 ) |
889 | 4272 _this = (ItemGen *)20; |
4273 } | |
4274 else | |
4275 { | |
890 | 4276 _this = (ItemGen *)16; |
889 | 4277 } |
4278 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4279 { | |
890 | 4280 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4281 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4282 pCastSpell->spellnum = 0; |
890 | 4283 continue; |
889 | 4284 } |
4285 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4286 break; |
889 | 4287 LODWORD(v725) = PID_TYPE(a2); |
4288 if (PID_TYPE(a2) == OBJECT_Actor) | |
4289 { | |
890 | 4290 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
4291 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4292 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4293 LODWORD(v727) = v153; | |
889 | 4294 } |
4295 else | |
4296 { | |
890 | 4297 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
4298 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4299 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4300 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4301 v154 = pParty->vPosition.z; | |
889 | 4302 } |
4303 HIDWORD(v733) = v154; | |
4304 v713 = v154 + 2500; | |
4305 v721 = 0; | |
4306 LODWORD(v718) = 0; | |
4307 if ( (signed int)_this > 0 ) | |
4308 { | |
890 | 4309 *(float *)&y = (double)SHIDWORD(v733); |
4310 *(float *)&v732 = (double)v713; | |
4311 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4312 auto _this_cpy = (int)_this; | |
4313 do | |
4314 { | |
924 | 4315 //v157 = rand(); |
889 | 4316 v158 = (double)SLODWORD(v718); |
4317 v718 = v158; | |
4318 v159 = (double)v721; | |
4319 *(float *)&v721 = v159; | |
924 | 4320 a2 = rand() % 1000; |
4321 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; | |
889 | 4322 v725 = v159 * v159; |
4323 *(float *)&_this = v158 * v158; | |
4324 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4325 { | |
890 | 4326 LODWORD(v687) = 0; |
4327 HIDWORD(v687) = 0; | |
889 | 4328 } |
4329 else | |
4330 { | |
890 | 4331 x = (signed __int64)sqrt(*(float *)&_this + v725); |
4332 v687 = __PAIR__( | |
4333 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4334 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
889 | 4335 } |
924 | 4336 pSpellSprite.stru_24.Reset(); |
4337 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4338 pSpellSprite.spell_level = v2; | |
4339 pSpellSprite.spell_skill = v731; | |
4340 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4341 pSpellSprite.uAttributes = 0; | |
4342 pSpellSprite.vPosition.x = uRequiredMana; | |
4343 pSpellSprite.vPosition.y = LODWORD(v727); | |
4344 pSpellSprite.uSectorID = 0; | |
4345 pSpellSprite.vPosition.z = a2 + v713; | |
4346 pSpellSprite.uSpriteFrameID = 0; | |
4347 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4348 pSpellSprite.spell_target_pid = v730; | |
4349 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4350 pSpellSprite.uFacing = v687; | |
4351 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 4352 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4353 pSpellSprite.uAttributes = 4; |
4354 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
890 | 4355 && pParty->bTurnBasedModeOn == 1 ) |
4356 ++pTurnEngine->field_1C; | |
889 | 4357 LODWORD(v718) = rand() % 1024 - 512; |
924 | 4358 //v160 = rand(); |
889 | 4359 v14 = _this_cpy-- == 1; |
924 | 4360 v721 = (unsigned __int64)(rand() % 1024) - 512; |
890 | 4361 } |
4362 while ( !v14 ); | |
889 | 4363 } |
4364 LODWORD(v727) = 1; | |
890 | 4365 break; |
4366 } | |
4367 case SPELL_FIRE_INFERNO: | |
4368 { | |
4369 //v67 = 2; | |
4370 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4371 { | |
4372 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4373 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4374 pCastSpell->spellnum = 0; |
890 | 4375 continue; |
4376 } | |
4377 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4378 break; | |
4379 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4380 v700.z = 0; | |
4381 v700.y = 0; | |
4382 v700.x = 0; | |
924 | 4383 pSpellSprite.stru_24.Reset(); |
4384 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4385 pSpellSprite.spell_level = v2; | |
4386 pSpellSprite.spell_skill = v731; | |
4387 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4388 pSpellSprite.uAttributes = 0; | |
4389 pSpellSprite.uSectorID = 0; | |
4390 pSpellSprite.uSpriteFrameID = 0; | |
4391 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4392 pSpellSprite.uFacing = 0; | |
4393 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4394 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4395 a2 = 0; |
4396 if ( (signed int)_v726 > 0 ) | |
4397 { | |
4398 do | |
4399 { | |
4400 v162 = dword_50BF30[a2]; | |
924 | 4401 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4402 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
4403 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4404 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4405 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 4406 v165 = a2; |
4407 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
924 | 4408 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
890 | 4409 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4410 a2 = v165 + 1; | |
4411 } | |
4412 while ( v165 + 1 < (signed int)_v726 ); | |
4413 } | |
4414 LODWORD(v727) = 1; | |
4415 break; | |
4416 } | |
4417 | |
4418 case SPELL_AIR_WIZARD_EYE: | |
4419 { | |
889 | 4420 LODWORD(v733) = 3600 * v2; |
4421 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4422 break; |
889 | 4423 v168 = 0; |
4424 do | |
4425 { | |
890 | 4426 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
4427 v716 = v169; | |
889 | 4428 } |
4429 while ( v168 < 4 ); | |
4430 | |
4431 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4432 LODWORD(v727) = 1; | |
890 | 4433 break; |
4434 } | |
4435 case SPELL_AIR_FEATHER_FALL: | |
4436 { | |
889 | 4437 v170 = v731 - 1; |
4438 if ( !v170 ) | |
4439 { | |
890 | 4440 v173 = 300 * v2; |
4441 goto LABEL_353; | |
889 | 4442 } |
4443 v171 = v170 - 1; | |
4444 if ( !v171 ) | |
4445 { | |
890 | 4446 v173 = 600 * v2; |
4447 goto LABEL_353; | |
889 | 4448 } |
4449 v172 = v171 - 1; | |
4450 if ( !v172 || v172 == 1 ) | |
4451 { | |
890 | 4452 v173 = 3600 * v2; |
889 | 4453 LABEL_353: |
890 | 4454 LODWORD(v733) = v173; |
889 | 4455 } |
4456 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4457 break; |
889 | 4458 v174 = 0; |
4459 do | |
890 | 4460 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 4461 while ( v174 < 4 ); |
924 | 4462 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4463 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4464 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4465 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4466 |
4467 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); | |
4468 LODWORD(v727) = 1; | |
890 | 4469 break; |
4470 } | |
4471 case SPELL_AIR_SPARKS: | |
4472 { | |
4473 v184 = v731 - 1; | |
4474 if ( v184 ) | |
4475 { | |
4476 v185 = v184 - 1; | |
4477 if ( v185 ) | |
4478 { | |
4479 v186 = v185 - 1; | |
4480 if ( v186 ) | |
4481 { | |
4482 if ( v186 == 1 ) | |
4483 amount = 9; | |
4484 } | |
4485 else | |
4486 { | |
4487 amount = 7; | |
4488 } | |
889 | 4489 } |
4490 else | |
4491 { | |
890 | 4492 amount = 5; |
4493 } | |
4494 } | |
4495 else | |
4496 { | |
4497 amount = 3; | |
4498 } | |
4499 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4500 break; | |
4501 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
924 | 4502 pSpellSprite.stru_24.Reset(); |
4503 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4504 pSpellSprite.spell_level = v2; | |
4505 pSpellSprite.spell_skill = v731; | |
4506 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4507 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4508 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4509 pSpellSprite.uAttributes = 0; | |
4510 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4511 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 4512 pParty->vPosition.x, |
4513 pParty->vPosition.y, | |
4514 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 4515 pSpellSprite.uSpriteFrameID = 0; |
4516 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4517 pSpellSprite.spell_target_pid = a2; | |
4518 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4519 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4520 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4521 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4522 v188 = (signed int)_v726 / -2; |
4523 v189 = (signed int)_v726 / 2; | |
4524 while ( v188 <= v189 ) | |
4525 { | |
924 | 4526 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4527 if ( pSpellSprite.Create( | |
890 | 4528 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4529 v715.uPitchAngle, | |
924 | 4530 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4531 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4532 && pParty->bTurnBasedModeOn == 1 ) |
4533 ++pTurnEngine->field_1C; | |
4534 v188 += _v726 / (amount - 1); | |
4535 } | |
4536 LODWORD(v727) = 1; | |
4537 break; | |
4538 } | |
4539 | |
4540 case SPELL_AIR_JUMP: | |
4541 { | |
4542 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4543 { | |
4544 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4545 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4546 break; | |
889 | 4547 } |
4548 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4549 break; |
889 | 4550 v191 = 0; |
4551 do | |
890 | 4552 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 4553 while ( v191 < 4 ); |
4554 BYTE1(pParty->uFlags) |= 1u; | |
4555 pParty->uFallSpeed = 1000; | |
4556 LODWORD(v727) = 1; | |
890 | 4557 break; |
4558 } | |
4559 case SPELL_AIR_INVISIBILITY: | |
4560 { | |
889 | 4561 v192 = v731 - 1; |
4562 if ( !v192 ) | |
4563 { | |
890 | 4564 amount = v2; |
924 | 4565 //goto LABEL_391; |
4566 v195 = 600 * v2; | |
4567 goto LABEL_392; | |
889 | 4568 } |
4569 v193 = v192 - 1; | |
4570 if ( !v193 ) | |
4571 { | |
890 | 4572 v196 = 2 * v2; |
924 | 4573 //LABEL_389: |
890 | 4574 amount = v196; |
924 | 4575 //LABEL_391: |
890 | 4576 v195 = 600 * v2; |
4577 goto LABEL_392; | |
889 | 4578 } |
4579 v194 = v193 - 1; | |
4580 if ( !v194 ) | |
4581 { | |
890 | 4582 v196 = 3 * v2; |
924 | 4583 //goto LABEL_389; |
4584 amount = v196; | |
4585 v195 = 600 * v2; | |
4586 goto LABEL_392; | |
889 | 4587 } |
4588 if ( v194 != 1 ) | |
890 | 4589 goto LABEL_393; |
889 | 4590 amount = 4 * v2; |
4591 v195 = 3600 * v2; | |
4592 LABEL_392: | |
4593 LODWORD(v733) = v195; | |
4594 LABEL_393: | |
4595 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
4596 { | |
890 | 4597 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4598 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4599 pCastSpell->spellnum = 0; |
890 | 4600 continue; |
889 | 4601 } |
4602 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4603 { | |
924 | 4604 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4605 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4606 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4607 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4608 |
4609 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4610 LODWORD(v727) = 1; | |
4611 } | |
4612 break; | |
4613 } | |
4614 case SPELL_AIR_FLY: | |
4615 { | |
4616 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4617 { | |
4618 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4619 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4620 break; | |
4621 } | |
924 | 4622 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4623 { |
4624 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4625 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4626 break; | |
4627 } | |
4628 LODWORD(v733) = 3600 * v2; | |
4629 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4630 amount = 1; | |
4631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4632 break; | |
4633 v205 = 0; | |
4634 do | |
4635 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4636 while ( v205 < 4 ); | |
4637 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
924 | 4638 v207 = pCastSpell->uPlayerID + 1; |
890 | 4639 v716 = v206; |
4640 | |
4641 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4642 LODWORD(v727) = 1; | |
4643 break; | |
4644 } | |
4645 | |
4646 case SPELL_AIR_STARBURST: | |
4647 { | |
4648 //v67 = 2; | |
4649 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4650 { | |
4651 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4652 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4653 pCastSpell->spellnum = 0; |
890 | 4654 continue; |
4655 } | |
4656 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4657 break; | |
4658 v208 = PID_TYPE(a2); | |
4659 LODWORD(v725) = PID_TYPE(a2); | |
4660 if ( v208 == 3 ) | |
4661 { | |
4662 v209 = PID_ID(a2); | |
4663 LODWORD(v718) = pActors[v209].vPosition.x; | |
4664 v210 = pActors[v209].vPosition.y; | |
4665 v211 = pActors[v209].vPosition.z; | |
4666 v713 = v210; | |
4667 } | |
4668 else | |
4669 { | |
4670 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4671 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4672 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4673 v214 = sub_42EBBE(2048, v213); | |
4674 v211 = pParty->vPosition.z; | |
4675 v713 = pParty->vPosition.y + v214; | |
4676 v208 = LODWORD(v725); | |
4677 } | |
4678 HIDWORD(v733) = 0; | |
4679 *(float *)&v732 = (double)v211; | |
4680 LODWORD(v725) = v211 + 2500; | |
4681 v721 = 0; | |
4682 *(float *)&y = (double)(v211 + 2500); | |
4683 v730 = v208 == 3 ? a2 : 0; | |
4684 a2 = 20; | |
4685 do | |
4686 { | |
4687 v215 = rand(); | |
4688 v216 = (double)v721; | |
4689 v217 = (double)SHIDWORD(v733); | |
4690 *(float *)&uRequiredMana = v217; | |
4691 _this = (ItemGen *)(v215 % 1000); | |
4692 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4693 *(float *)&v721 = v217 * v217; | |
4694 //*(float *)&v726 = v216 * v216; | |
4695 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4696 { | |
4697 LODWORD(v685) = 0; | |
4698 HIDWORD(v685) = 0; | |
889 | 4699 } |
4700 else | |
4701 { | |
890 | 4702 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4703 v685 = __PAIR__( | |
4704 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4705 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4706 } | |
924 | 4707 pSpellSprite.stru_24.Reset(); |
4708 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4709 pSpellSprite.spell_level = v2; | |
4710 pSpellSprite.spell_skill = v731; | |
4711 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4712 pSpellSprite.uAttributes = 0; | |
4713 pSpellSprite.vPosition.x = LODWORD(v718); | |
4714 pSpellSprite.vPosition.y = v713; | |
4715 pSpellSprite.uSectorID = 0; | |
4716 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4717 pSpellSprite.uSpriteFrameID = 0; | |
4718 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4719 pSpellSprite.spell_target_pid = v730; | |
921 | 4720 //__debugbreak();//çâåçäîïàä |
924 | 4721 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4722 pSpellSprite.uFacing = v685; | |
4723 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4724 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4725 pSpellSprite.uAttributes = 4; |
4726 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4727 && pParty->bTurnBasedModeOn == 1 ) | |
4728 ++pTurnEngine->field_1C; | |
890 | 4729 v721 = rand() % 1024 - 512; |
4730 v218 = rand(); | |
4731 v14 = a2-- == 1; | |
4732 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4733 } | |
4734 while ( !v14 ); | |
4735 LODWORD(v727) = 1; | |
4736 break; | |
4737 } | |
4738 | |
4739 case SPELL_WATER_AWAKEN: | |
4740 { | |
4741 v219 = v731 - 2; | |
4742 if ( v219 ) | |
4743 { | |
4744 v220 = v219 - 1; | |
4745 if ( v220 ) | |
4746 { | |
4747 if ( v220 == 1 ) | |
4748 { | |
4749 amount = 0; | |
4750 goto LABEL_433; | |
4751 } | |
4752 v221 = 180 * v2; | |
4753 } | |
4754 else | |
4755 { | |
4756 v221 = 86400 * v2; | |
4757 } | |
889 | 4758 } |
4759 else | |
4760 { | |
890 | 4761 v221 = 3600 * v2; |
4762 } | |
4763 amount = v221; | |
4764 LABEL_433: | |
889 | 4765 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4766 break; |
4767 v222 = pParty->pPlayers; | |
4768 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4769 while ( 2 ) | |
4770 { | |
4771 if ( v731 == 4 ) | |
4772 { | |
4773 if ( v222->pConditions[2] ) | |
4774 { | |
4775 //*((int *)v222 + 4) = 0; | |
4776 //*((int *)v222 + 5) = 0; | |
4777 v222->pConditions[2] = 0; | |
4778 v222->PlaySound(SPEECH_103, 0); | |
4779 } | |
4780 } | |
4781 else | |
889 | 4782 { |
890 | 4783 v223 = v222->DiscardConditionIfLastsLongerThan( |
4784 2u, | |
4785 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4786 v222 = (Player *)HIDWORD(v733); | |
4787 if ( v223 ) | |
4788 v222->PlaySound(SPEECH_103, 0); | |
4789 } | |
4790 ++v222;// += 6972; | |
4791 HIDWORD(v733) = (int)v222; | |
4792 if ( v222 >= &pParty->pPlayers[3] ) | |
4793 { | |
4794 LODWORD(v727) = 1; | |
4795 break; | |
4796 } | |
4797 } | |
4798 } | |
4799 case SPELL_WATER_POISON_SPRAY: | |
4800 { | |
4801 v224 = v731 - 2; | |
4802 if ( v224 ) | |
4803 { | |
4804 v225 = v224 - 1; | |
4805 if ( v225 ) | |
4806 { | |
4807 if ( v225 == 1 ) | |
4808 amount = 7; | |
4809 else | |
4810 amount = 1; | |
4811 } | |
4812 else | |
4813 { | |
4814 amount = 5; | |
889 | 4815 } |
890 | 4816 } |
4817 else | |
4818 { | |
4819 amount = 3; | |
4820 } | |
889 | 4821 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4822 break; |
4823 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4824 if ( amount == 1 ) | |
4825 { | |
924 | 4826 pSpellSprite.stru_24.Reset(); |
4827 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4828 pSpellSprite.spell_skill = v731; | |
4829 pSpellSprite.spell_level = v2; | |
4830 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4831 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4832 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4833 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4834 v660 = pParty->vPosition.y; | |
4835 LABEL_153: | |
924 | 4836 pSpellSprite.uAttributes = 0; |
4837 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4838 pSpellSprite.vPosition.z = v51; | |
890 | 4839 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4840 pSpellSprite.uSpriteFrameID = 0; |
4841 pSpellSprite.uSectorID = v52; | |
4842 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4843 pSpellSprite.spell_target_pid = a2; | |
4844 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4845 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4846 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4847 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4848 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4849 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4850 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4851 ++pTurnEngine->field_1C; | |
890 | 4852 } |
4853 else | |
4854 { | |
924 | 4855 pSpellSprite.stru_24.Reset(); |
4856 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4857 pSpellSprite.spell_level = v2; | |
4858 pSpellSprite.spell_skill = v731; | |
4859 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4860 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4861 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4862 pSpellSprite.uAttributes = 0; | |
4863 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4864 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4865 pSpellSprite.uSpriteFrameID = 0; | |
4866 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4867 pSpellSprite.spell_target_pid = a2; | |
4868 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4869 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4870 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4871 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4872 v227 = SHIDWORD(v733) / -2; |
4873 y = (char *)(SHIDWORD(v733) / 2); | |
4874 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4875 { | |
4876 v228 = v715.uYawAngle; | |
4877 do | |
4878 { | |
924 | 4879 pSpellSprite.uFacing = v227 + v228; |
4880 if ( pSpellSprite.Create( | |
890 | 4881 v227 + v228, |
4882 v715.uPitchAngle, | |
924 | 4883 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4884 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4885 && pParty->bTurnBasedModeOn == 1 ) |
4886 ++pTurnEngine->field_1C; | |
4887 v227 += SHIDWORD(v733) / (amount - 1); | |
4888 } | |
4889 while ( v227 <= (signed int)y ); | |
4890 } | |
889 | 4891 } |
4892 LODWORD(v727) = 1; | |
890 | 4893 break; |
4894 } | |
4895 case SPELL_WATER_WATER_WALK: | |
4896 { | |
924 | 4897 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4898 { |
4899 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4900 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4901 break; | |
4902 } | |
4903 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4904 v229 = 600 * v2; | |
4905 else | |
4906 v229 = 3600 * v2; | |
4907 LODWORD(v733) = v229; | |
4908 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4909 break; | |
4910 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
924 | 4911 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4912 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4913 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4915 |
4916 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4917 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4918 v731, | |
4919 amount, | |
4920 v716, | |
924 | 4921 pCastSpell->uPlayerID + 1); |
890 | 4922 if ( v731 == 4 ) |
4923 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4924 LODWORD(v727) = 1; | |
4925 break; | |
4926 } | |
4927 case SPELL_WATER_RECHARGE_ITEM: | |
4928 { | |
4929 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4930 break; | |
924 | 4931 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
890 | 4932 y = v240; |
4933 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4934 { | |
4935 dword_50C9D0 = 113; | |
4936 dword_50C9D4 = 0; | |
4937 dword_50C9D8 = 1; | |
4938 | |
4939 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4940 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4941 pCastSpell->spellnum = 0; |
890 | 4942 continue; |
4943 } | |
4944 if ( v731 == 1 || v731 == 2 ) | |
4945 { | |
4946 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4947 } | |
4948 else | |
4949 { | |
4950 if ( v731 == 3 ) | |
4951 { | |
4952 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
889 | 4953 } |
4954 else | |
4955 { | |
890 | 4956 if ( v731 != 4 ) |
4957 { | |
4958 v241 = 0.0; | |
4959 goto LABEL_484; | |
4960 } | |
4961 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4962 } | |
4963 } | |
4964 if ( v241 > 1.0 ) | |
4965 v241 = 1.0; | |
4966 LABEL_484: | |
4967 v732 = (unsigned __int8)v240[25]; | |
4968 v242 = (signed __int64)((double)v732 * v241); | |
4969 v243 = y; | |
4970 y[25] = v242; | |
4971 *((int *)v243 + 4) = (unsigned __int8)v242; | |
4972 if ( (unsigned __int8)v242 <= 0 ) | |
4973 { | |
4974 *(int *)v243 = 0; | |
4975 dword_50C9D0 = 113; | |
4976 dword_50C9D4 = 0; | |
4977 dword_50C9D8 = 1; | |
4978 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4979 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4980 pCastSpell->spellnum = 0; |
890 | 4981 v2 = v723; |
4982 continue; | |
4983 } | |
4984 *((int *)v243 + 5) |= 0x40u; | |
4985 dword_50C9A8 = 256; | |
4986 LODWORD(v727) = 1; | |
4987 break; | |
4988 } | |
4989 case SPELL_WATER_ENCHANT_ITEM: | |
4990 { | |
4991 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4992 break; | |
4993 uRequiredMana = 0; | |
4994 HIDWORD(v733) = 10 * v2; | |
4995 v730 = 1; | |
924 | 4996 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 4997 if ( v731 == 1 ) |
4998 { | |
4999 v245 = (int)&v244[36 * a2 + 532]; | |
5000 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5001 v311 = __OFSUB__(*(int *)v245, 134); | |
5002 v14 = *(int *)v245 == 134; | |
5003 v310 = *(int *)v245 - 134 < 0; | |
5004 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5005 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5006 { | |
5007 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
5008 { | |
5009 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
5010 { | |
5011 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
889 | 5012 { |
890 | 5013 v312 = v309[28]; |
5014 if ( v312 ) | |
5015 { | |
5016 if ( v312 != 1 ) | |
5017 { | |
5018 if ( v312 != 2 ) | |
5019 { | |
5020 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5021 if ( !(v244[36 * a2 + 552] & 2) ) | |
5022 { | |
5023 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5024 { | |
5025 uRequiredMana = 1; | |
5026 v730 = 0; | |
5027 } | |
5028 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5029 uRequiredMana = 1; | |
5030 if (!uRequiredMana) | |
5031 { | |
5032 v313 = *(char *)(LODWORD(v725) + 28); | |
5033 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5034 { | |
5035 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5036 *(int *)(v245 + 4) = 0; | |
5037 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5038 + 1]; | |
5039 ; | |
5040 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5041 + 1] ) | |
5042 { | |
5043 ++*(int *)(v245 + 4); | |
5044 if ( j >= v314 ) | |
5045 break; | |
5046 } | |
5047 v254 = rand(); | |
5048 v255 = 10;//pItemsTable->field_116D8[17]; | |
5049 v256 = 10;//pItemsTable->field_116D8[16]; | |
5050 LABEL_611: | |
5051 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5052 LABEL_612: | |
5053 _this->uItemID |= 0x20u; | |
5054 | |
5055 dword_50C9A8 = 256; | |
5056 LODWORD(v727) = 1; | |
5057 break; | |
5058 } | |
924 | 5059 goto LABEL_616; |
890 | 5060 } |
5061 LABEL_613: | |
5062 v316 = _this->uItemID; | |
5063 if ( !(BYTE1(v316) & 2) ) | |
5064 { | |
5065 LOBYTE(v316) = v316 | 2; | |
5066 _this->uItemID = v316; | |
5067 } | |
5068 } | |
5069 } | |
5070 } | |
5071 } | |
5072 } | |
889 | 5073 } |
890 | 5074 } |
5075 } | |
5076 LABEL_616: | |
5077 if ( LODWORD(v727) == 0 ) | |
5078 { | |
5079 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5080 if ( v730 == 0 ) | |
5081 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5082 ShowStatusBarString(v317, 2u); | |
5083 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5084 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5085 pCastSpell->spellnum = 0; | |
890 | 5086 v318->PlaySound(SPEECH_43, 0); |
5087 } | |
5088 break; | |
5089 } | |
5090 if ( v731 != 2 ) | |
5091 { | |
5092 if ( v731 == 3 ) | |
5093 { | |
5094 v245 = (int)&v244[36 * a2 + 532]; | |
5095 v269 = *(int *)v245; | |
5096 if ( *(int *)v245 > 134 | |
5097 || *(int *)(v245 + 12) != 0 | |
5098 || *(int *)(v245 + 4) != 0 | |
5099 || *(int *)(v245 + 8) != 0 | |
5100 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
5101 goto LABEL_616; | |
5102 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5103 LODWORD(v725) = (int)v270; | |
5104 v271 = v270[28]; | |
5105 if ( v271 && v271 != 1 && v271 != 2 ) | |
5106 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5107 else | |
5108 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5109 if ( v272 ) | |
5110 { | |
5111 uRequiredMana = 1; | |
5112 v730 = 0; | |
5113 } | |
5114 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5115 uRequiredMana = 1; | |
5116 if (uRequiredMana) | |
5117 goto LABEL_613; | |
5118 v273 = v725; | |
5119 v274 = *(char *)(LODWORD(v725) + 28); | |
5120 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 ) | |
5121 { | |
5122 if ( rand() % 100 < 80 | |
5123 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5124 { | |
5125 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5126 *(int *)(v245 + 4) = 0; | |
5127 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5128 ; | |
5129 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5130 + 1] ) | |
5131 { | |
5132 ++*(int *)(v245 + 4); | |
5133 if ( k >= v275 ) | |
5134 break; | |
5135 } | |
5136 v254 = rand(); | |
5137 v255 = 10;//pItemsTable->field_116D8[19]; | |
5138 v256 = 10;//pItemsTable->field_116D8[18]; | |
5139 goto LABEL_611; | |
5140 } | |
5141 v277 = pItemsTable->pSpecialEnchantments_count; | |
5142 v278 = 0; | |
5143 v725 = 0.0; | |
5144 HIDWORD(v733) = 0; | |
5145 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5146 { | |
5147 v730 = (int)&v679; | |
5148 do | |
5149 { | |
5150 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5151 if ( !v279 || v279 == 1 ) | |
5152 { | |
5153 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5154 + 4] | |
5155 + v278 * 28); | |
5156 LODWORD(v725) += v280; | |
5157 if ( v280 ) | |
5158 { | |
5159 v281 = v730; | |
5160 v730 += 4; | |
5161 *(int *)v281 = HIDWORD(v733); | |
5162 } | |
5163 } | |
5164 ++HIDWORD(v733); | |
5165 ++v278; | |
5166 } | |
5167 while ( SHIDWORD(v733) < v277 ); | |
5168 } | |
5169 v282 = rand() % SLODWORD(v725); | |
5170 v283 = v679; | |
5171 *(int *)(v245 + 12) = v679; | |
5172 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5173 v285 = v282 + 1; | |
5174 if ( v284 < v285 ) | |
5175 { | |
5176 for ( l = &v679; ; l = (int *)v732 ) | |
5177 { | |
5178 v287 = (int)(l + 1); | |
5179 v732 = v287; | |
5180 v288 = *(int *)v287; | |
5181 *(int *)(v245 + 12) = v288; | |
5182 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5183 + 4]; | |
5184 if ( v284 >= v285 ) | |
5185 break; | |
5186 } | |
5187 } | |
924 | 5188 ++*(int *)(v245 + 12); |
5189 goto LABEL_612; | |
890 | 5190 } |
889 | 5191 } |
5192 else | |
5193 { | |
890 | 5194 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5195 if ( v731 != 4 | |
5196 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5197 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5198 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5199 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5200 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
5201 goto LABEL_616; | |
5202 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5203 LODWORD(v725) = (int)v247; | |
5204 v248 = v247[28]; | |
5205 if ( v248 && v248 != 1 && v248 != 2 ) | |
5206 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5207 else | |
5208 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5209 if ( v249 ) | |
5210 { | |
5211 uRequiredMana = 1; | |
5212 v730 = 0; | |
5213 } | |
5214 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5215 uRequiredMana = 1; | |
5216 if (uRequiredMana) | |
5217 goto LABEL_613; | |
5218 v250 = v725; | |
5219 v251 = *(char *)(LODWORD(v725) + 28); | |
5220 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 ) | |
5221 { | |
5222 if ( rand() % 100 < 80 | |
5223 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5224 { | |
5225 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5226 *(int *)(v245 + 4) = 0; | |
5227 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5228 ; | |
5229 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5230 + 1] ) | |
5231 { | |
5232 ++*(int *)(v245 + 4); | |
5233 if ( m >= v252 ) | |
5234 break; | |
5235 } | |
5236 v254 = rand(); | |
5237 v255 = 10;// pItemsTable->field_116D8[21]; | |
5238 v256 = 10;//pItemsTable->field_116D8[20]; | |
5239 goto LABEL_611; | |
5240 } | |
5241 v257 = pItemsTable->pSpecialEnchantments_count; | |
5242 v258 = 0; | |
5243 v725 = 0.0; | |
5244 HIDWORD(v733) = 0; | |
5245 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5246 { | |
5247 v730 = (int)&v679; | |
5248 do | |
5249 { | |
5250 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5251 if ( !v259 || v259 == 1 ) | |
5252 { | |
5253 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5254 + 4] | |
5255 + v258 * 28); | |
5256 LODWORD(v725) += v260; | |
5257 if ( v260 ) | |
5258 { | |
5259 v261 = v730; | |
5260 v730 += 4; | |
5261 *(int *)v261 = HIDWORD(v733); | |
5262 } | |
5263 } | |
5264 ++HIDWORD(v733); | |
5265 ++v258; | |
5266 } | |
5267 while ( SHIDWORD(v733) < v257 ); | |
5268 } | |
5269 v262 = rand() % SLODWORD(v725); | |
5270 v263 = v679; | |
5271 *(int *)(v245 + 12) = v679; | |
5272 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5273 v265 = v262 + 1; | |
5274 if ( v264 < v265 ) | |
5275 { | |
5276 for ( ii = &v679; ; ii = (int *)v732 ) | |
5277 { | |
5278 v267 = (int)(ii + 1); | |
5279 v732 = v267; | |
5280 v268 = *(int *)v267; | |
5281 *(int *)(v245 + 12) = v268; | |
5282 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5283 + 4]; | |
5284 if ( v264 >= v265 ) | |
5285 break; | |
5286 } | |
5287 } | |
5288 ++*(int *)(v245 + 12); | |
5289 goto LABEL_612; | |
5290 } | |
5291 } | |
5292 //v1 = 0; | |
5293 goto LABEL_616; | |
5294 } | |
5295 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5296 _this = v289; | |
5297 v290 = v289->uItemID; | |
5298 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5299 if ( v290 > 134 | |
5300 || _this->uSpecEnchantmentType != 0 | |
5301 || _this->uEnchantmentType != 0 | |
5302 || _this->_bonus_strength != 0 | |
5303 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5304 || v291 == 1 | |
5305 || v291 == 2 | |
5306 || _this->Broken()) | |
5307 goto LABEL_616; | |
5308 if ( _this->GetValue() < 0x1C2 ) | |
5309 uRequiredMana = 1; | |
5310 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5311 uRequiredMana = 1; | |
5312 if ( uRequiredMana != 0 ) | |
5313 { | |
5314 dword_50C9D0 = 113; | |
5315 dword_50C9D4 = 0; | |
5316 dword_50C9D8 = 1; | |
5317 | |
5318 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5319 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5320 pCastSpell->spellnum = 0; |
890 | 5321 continue; |
5322 } | |
5323 v292 = *(char *)(LODWORD(v725) + 28); | |
5324 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5325 { | |
889 | 5326 v2 = v723; |
5327 //v1 = 0; | |
890 | 5328 |
5329 dword_50C9D0 = 113; | |
5330 dword_50C9D4 = 0; | |
5331 dword_50C9D8 = 1; | |
5332 | |
5333 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5334 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5335 pCastSpell->spellnum = 0; |
890 | 5336 continue; |
5337 } | |
5338 if ( rand() % 100 >= 80 ) | |
5339 { | |
5340 v297 = pItemsTable->pSpecialEnchantments_count; | |
5341 v294 = _this; | |
5342 v298 = 0; | |
5343 v725 = 0.0; | |
5344 HIDWORD(v733) = 0; | |
5345 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5346 { | |
5347 v730 = (int)&v679; | |
5348 do | |
5349 { | |
5350 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5351 if ( !v299 || v299 == 1 ) | |
5352 { | |
5353 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5354 + v298 * 28); | |
5355 LODWORD(v725) += v300; | |
5356 if ( v300 ) | |
5357 { | |
5358 v301 = v730; | |
5359 v730 += 4; | |
5360 *(int *)v301 = HIDWORD(v733); | |
5361 } | |
5362 } | |
5363 ++HIDWORD(v733); | |
5364 ++v298; | |
5365 } | |
5366 while ( SHIDWORD(v733) < v297 ); | |
5367 } | |
5368 v302 = rand() % SLODWORD(v725); | |
5369 v303 = v679; | |
5370 v294->uSpecEnchantmentType = v679; | |
5371 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5372 v305 = v302 + 1; | |
5373 if ( v304 < v305 ) | |
5374 { | |
5375 for ( jj = &v679; ; jj = (int *)v732 ) | |
5376 { | |
5377 v307 = (int)(jj + 1); | |
5378 v732 = v307; | |
5379 v308 = *(int *)v307; | |
5380 v294->uSpecEnchantmentType = v308; | |
5381 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5382 if ( v304 >= v305 ) | |
5383 break; | |
5384 } | |
5385 } | |
5386 ++v294->uSpecEnchantmentType; | |
5387 } | |
5388 else | |
5389 { | |
5390 v293 = rand(); | |
5391 v294 = _this; | |
5392 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5393 _this->uEnchantmentType = 0; | |
5394 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5395 ; | |
5396 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5397 + 1] ) | |
5398 { | |
5399 ++v294->uEnchantmentType; | |
5400 if ( kk >= v295 ) | |
5401 break; | |
5402 } | |
5403 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5404 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5405 } | |
5406 v294->uAttributes |= 0x20u; | |
5407 dword_50C9A8 = 256; | |
5408 LODWORD(v727) = 1; | |
5409 break; | |
5410 } | |
5411 case SPELL_WATER_TOWN_PORTAL: | |
5412 { | |
5413 amount = 10 * v2; | |
5414 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5415 break; | |
5416 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5417 { | |
5418 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5419 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5420 pCastSpell->spellnum = 0; |
890 | 5421 continue; |
5422 } | |
924 | 5423 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
890 | 5424 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5425 LODWORD(v727) = 1; | |
5426 break; | |
5427 } | |
5428 case SPELL_WATER_LLOYDS_BEACON: | |
5429 { | |
5430 LODWORD(v733) = 604800 * v2; | |
5431 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5432 { | |
5433 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5434 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5435 pCastSpell->spellnum = 0; |
890 | 5436 continue; |
5437 } | |
5438 v319 = uRequiredMana; | |
5439 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5440 { | |
5441 pEventTimer->Pause(); | |
5442 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | |
5443 qword_506350 = (signed int)v733; | |
924 | 5444 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
890 | 5445 ::uRequiredMana = v319; |
5446 ::sRecoveryTime = sRecoveryTime; | |
924 | 5447 dword_50633C = pCastSpell->sound_id; |
5448 dword_506338 = pCastSpell->spellnum; | |
5449 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
890 | 5450 } |
5451 break; | |
5452 } | |
5453 case SPELL_EARTH_STONE_TO_FLESH: | |
5454 { | |
5455 v320 = v731 - 2; | |
5456 if ( !v320 ) | |
5457 goto LABEL_632; | |
5458 v321 = v320 - 1; | |
5459 if ( v321 ) | |
5460 { | |
5461 if ( v321 == 1 ) | |
5462 goto LABEL_634; | |
5463 LABEL_632: | |
5464 v322 = 3600 * v2; | |
5465 } | |
5466 else | |
5467 { | |
5468 v322 = 86400 * v2; | |
5469 } | |
5470 amount = v322; | |
5471 LABEL_634: | |
5472 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5473 break; | |
924 | 5474 v323 = pCastSpell->uPlayerID_2; |
890 | 5475 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5476 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5477 { | |
5478 LODWORD(v727) = 1; | |
5479 break; | |
5480 } | |
5481 if ( v731 == 4 ) | |
5482 { | |
5483 *(int *)v324 = 0; | |
5484 *((int *)v324 + 1) = 0; | |
5485 LODWORD(v727) = 1; | |
5486 break; | |
5487 } | |
5488 v732 = amount << 7; | |
5489 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5490 v656 = 15; | |
924 | 5491 v325 = &pParty->pPlayers[v323]; |
5492 goto LABEL_641; | |
890 | 5493 } |
5494 case SPELL_EARTH_ROCK_BLAST: | |
5495 { | |
5496 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5497 break; | |
924 | 5498 pSpellSprite.stru_24.Reset(); |
5499 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5500 pSpellSprite.spell_level = v2; | |
5501 pSpellSprite.spell_skill = v731; | |
5502 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5503 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5504 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5505 pSpellSprite.uAttributes = 0; | |
5506 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5507 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 5508 pParty->vPosition.x, |
5509 pParty->vPosition.y, | |
5510 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 5511 pSpellSprite.uSpriteFrameID = 0; |
5512 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5513 pSpellSprite.spell_target_pid = a2; | |
5514 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5515 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5516 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5517 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5518 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5519 | |
5520 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5521 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5522 ++pTurnEngine->field_1C; |
5523 LODWORD(v727) = 1; | |
5524 break; | |
5525 } | |
5526 case SPELL_EARTH_DEATH_BLOSSOM: | |
5527 { | |
5528 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5529 { | |
5530 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5531 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5532 pCastSpell->spellnum = 0; |
890 | 5533 continue; |
5534 } | |
5535 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5536 break; | |
924 | 5537 pSpellSprite.uType = 4090; |
5538 pSpellSprite.stru_24.Reset(); | |
5539 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5540 pSpellSprite.spell_level = v2; | |
5541 pSpellSprite.spell_skill = v731; | |
5542 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5543 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5544 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5545 pSpellSprite.uAttributes = 0; | |
5546 pSpellSprite.uSectorID = 0; | |
5547 pSpellSprite.uSpriteFrameID = 0; | |
5548 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5549 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5550 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5551 pSpellSprite.spell_target_pid = a2; | |
5552 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5553 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5554 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5555 pSpellSprite.uAttributes = 4; |
5556 | |
5557 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5558 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5559 ++pTurnEngine->field_1C; |
5560 LODWORD(v727) = 1; | |
5561 break; | |
5562 } | |
5563 case SPELL_SPIRIT_DETECT_LIFE: | |
5564 { | |
5565 v328 = v731 - 2; | |
5566 if ( v328 ) | |
5567 { | |
5568 v329 = v328 - 1; | |
5569 if ( v329 && v329 != 1 ) | |
5570 v330 = 600 * v2; | |
5571 else | |
5572 v330 = 3600 * v2; | |
5573 } | |
5574 else | |
5575 { | |
5576 v330 = 1800 * v2; | |
5577 } | |
5578 LODWORD(v733) = v330; | |
5579 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5580 break; | |
924 | 5581 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5582 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5583 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5584 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 5585 |
5586 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); | |
5587 LODWORD(v727) = 1; | |
5588 break; | |
5589 } | |
5590 case SPELL_SPIRIT_FATE: | |
5591 { | |
5592 LODWORD(v733) = 300; | |
5593 v339 = v731 - 2; | |
5594 if ( v339 ) | |
5595 { | |
5596 v340 = v339 - 1; | |
5597 if ( v340 ) | |
5598 { | |
5599 if ( v340 != 1 ) | |
5600 { | |
5601 amount = v2; | |
5602 goto LABEL_667; | |
5603 } | |
5604 v341 = 6 * v2; | |
889 | 5605 } |
5606 else | |
5607 { | |
890 | 5608 v341 = 4 * v2; |
5609 } | |
5610 } | |
5611 else | |
5612 { | |
5613 v341 = 2 * v2; | |
5614 } | |
5615 amount = v341; | |
5616 LABEL_667: | |
5617 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5618 break; | |
924 | 5619 v342 = pCastSpell->spell_target_pid; |
890 | 5620 if ( v342 == 0 ) |
5621 { | |
924 | 5622 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5623 | |
5624 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
890 | 5625 LODWORD(v727) = 1; |
5626 break; | |
5627 } | |
5628 if (PID_TYPE(v342) == OBJECT_Actor) | |
5629 { | |
5630 v343 = PID_ID(v342); | |
5631 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5632 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5633 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5634 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5635 v672 = 0; | |
5636 v661 = &pActors[v343]; | |
5637 LABEL_165: | |
5638 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5639 } | |
5640 LODWORD(v727) = 1; | |
5641 break; | |
5642 } | |
5643 case SPELL_SPIRIT_REMOVE_CURSE: | |
5644 { | |
5645 v348 = v731 - 2; | |
5646 if ( !v348 ) | |
5647 goto LABEL_677; | |
5648 v349 = v348 - 1; | |
5649 if ( v349 ) | |
5650 { | |
5651 if ( v349 == 1 ) | |
5652 { | |
5653 amount = 0; | |
5654 goto LABEL_679; | |
5655 } | |
5656 LABEL_677: | |
5657 v350 = 3600 * v2; | |
5658 } | |
5659 else | |
5660 { | |
5661 v350 = 86400 * v2; | |
5662 } | |
5663 amount = v350; | |
5664 LABEL_679: | |
5665 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5666 break; | |
924 | 5667 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5668 if ( !v351->pConditions[0] ) |
5669 { | |
5670 LODWORD(v727) = 1; | |
5671 break; | |
5672 } | |
5673 if ( v731 == 4 ) | |
5674 { | |
5675 LODWORD(v351->pConditions[0]) = 0; | |
5676 HIDWORD(v351->pConditions[0]) = 0; | |
5677 } | |
5678 else | |
5679 { | |
5680 v732 = amount << 7; | |
5681 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
924 | 5682 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
890 | 5683 { |
5684 LODWORD(v727) = 1; | |
5685 break; | |
5686 } | |
5687 } | |
924 | 5688 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 5689 LODWORD(v727) = 1; |
5690 break; | |
5691 } | |
5692 case SPELL_SPIRIT_PRESERVATION: | |
5693 { | |
5694 v354 = v731 - 2; | |
5695 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5696 v356 = 900 * (v2 + 4); | |
5697 else | |
5698 v356 = 300 * (v2 + 12); | |
5699 LODWORD(v733) = v356; | |
5700 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5701 break; | |
5702 if ( v731 == 1 || v731 == 2 ) | |
5703 { | |
924 | 5704 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5705 | |
5706 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 | 5707 LODWORD(v727) = 1; |
5708 break; | |
5709 } | |
5710 a2 = 0; | |
5711 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5712 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5713 do | |
5714 { | |
924 | 5715 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 5716 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5717 ++a2; | |
5718 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5719 } | |
5720 while ( v357 <= &pParty->pPlayers[3] ); | |
5721 LODWORD(v727) = 1; | |
5722 break; | |
5723 } | |
5724 case SPELL_SPIRIT_TURN_UNDEAD: | |
5725 { | |
5726 v364 = v731 - 2; | |
5727 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5728 v366 = 60 * (v2 + 3); | |
5729 else | |
5730 v366 = 300 * v2 + 180; | |
5731 LODWORD(v733) = v366; | |
5732 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5733 break; | |
5734 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5735 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
924 | 5736 ++pSpellSprite.uType; |
5737 pSpellSprite.stru_24.Reset(); | |
5738 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5739 pSpellSprite.spell_level = v2; | |
5740 pSpellSprite.spell_skill = v731; | |
5741 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5742 pSpellSprite.uAttributes = 0; | |
5743 pSpellSprite.uSectorID = 0; | |
5744 pSpellSprite.uSpriteFrameID = 0; | |
5745 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5746 pSpellSprite.uFacing = 0; | |
5747 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5748 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5749 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5750 { | |
5751 v369 = &pActors[dword_50BF30[a2]]; | |
5752 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5753 { | |
924 | 5754 pSpellSprite.vPosition.x = v369->vPosition.x; |
5755 pSpellSprite.vPosition.y = v369->vPosition.y; | |
5756 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5757 | |
5758 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5759 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 5760 v369->pActorBuffs[4].Apply( |
5761 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
889 | 5762 v731, 0, 0, 0); |
5763 } | |
890 | 5764 } |
5765 LODWORD(v727) = 1; | |
5766 } | |
5767 break; | |
5768 | |
5769 case SPELL_SPIRIT_RAISE_DEAD: | |
5770 { | |
5771 v371 = v731 - 2; | |
5772 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5773 amount = 0; | |
5774 else | |
5775 amount = 86400 * v2; | |
5776 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5777 break; | |
924 | 5778 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5779 v373 = pCastSpell->uPlayerID_2; | |
890 | 5780 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5781 { | |
5782 LODWORD(v727) = 1; | |
5783 break; | |
5784 } | |
5785 v14 = v731 == 4; | |
5786 pParty->pPlayers[v373].sHealth = 1; | |
5787 if ( v14 ) | |
5788 { | |
924 | 5789 v374 = pCastSpell->uPlayerID_2; |
890 | 5790 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5791 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
924 | 5792 v376 = pCastSpell->uPlayerID_2; |
890 | 5793 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5794 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5795 } | |
5796 else | |
5797 { | |
5798 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5799 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5800 0xEu, |
5801 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 5802 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5803 0xDu, |
5804 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5805 } | |
924 | 5806 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5807 goto LABEL_720; |
5808 } | |
5809 case SPELL_SPIRIT_SHARED_LIFE: | |
5810 { | |
5811 v378 = v731 - 2; | |
5812 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5813 v380 = 4 * v2; | |
5814 else | |
5815 v380 = 3 * v2; | |
5816 amount = v380; | |
5817 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5818 break; | |
5819 v381 = 0; | |
5820 HIDWORD(v733) = amount; | |
5821 v730 = 0; | |
5822 v382 = 1; | |
5823 do | |
5824 { | |
5825 v383 = pPlayers[v382]; | |
5826 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5827 v682[v381++] = v382; | |
5828 ++v382; | |
5829 } | |
5830 while ( v382 <= 4 ); | |
5831 v384 = 0; | |
5832 v730 = v381; | |
5833 if ( v381 > 0 ) | |
5834 { | |
5835 do | |
5836 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5837 while ( v384 < v381 ); | |
5838 } | |
5839 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5840 HIDWORD(v733) = 0; | |
5841 if ( v381 > 0 ) | |
5842 { | |
5843 do | |
5844 { | |
5845 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5846 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5847 v726->sHealth = v732; | |
5848 //v386 = v726->GetMaxHealth(); | |
5849 if ( v726->sHealth > v726->GetMaxHealth()) | |
5850 v726->sHealth = v726->GetMaxHealth(); | |
5851 if ( v726->sHealth > 0 ) | |
5852 { | |
5853 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5854 } | |
5855 v388 = HIDWORD(v733); | |
5856 | |
924 | 5857 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
890 | 5858 HIDWORD(v733) = v388 + 1; |
5859 } | |
5860 while ( v388 + 1 < v730 ); | |
5861 } | |
5862 LODWORD(v727) = 1; | |
5863 break; | |
5864 } | |
5865 case SPELL_SPIRIT_RESSURECTION: | |
5866 { | |
5867 v392 = v731 - 1; | |
5868 if ( !v392 ) | |
5869 { | |
5870 v395 = 180 * v2; | |
924 | 5871 amount = v395; |
5872 goto LABEL_751; | |
890 | 5873 } |
5874 v393 = v392 - 1; | |
5875 if ( !v393 ) | |
5876 { | |
5877 v395 = 10800 * v2; | |
924 | 5878 amount = v395; |
5879 goto LABEL_751; | |
890 | 5880 } |
5881 v394 = v393 - 1; | |
5882 if ( !v394 ) | |
5883 { | |
5884 v395 = 259200 * v2; | |
5885 amount = v395; | |
5886 goto LABEL_751; | |
5887 } | |
5888 if ( v394 == 1 ) | |
5889 amount = 0; | |
5890 LABEL_751: | |
5891 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5892 break; | |
924 | 5893 v396 = pCastSpell->uPlayerID_2; |
890 | 5894 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5895 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5896 { | |
5897 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5898 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5899 if ( v731 == 4 ) | |
5900 { | |
924 | 5901 v397 = pCastSpell->uPlayerID_2; |
890 | 5902 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5903 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
924 | 5904 v398 = pCastSpell->uPlayerID_2; |
890 | 5905 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5906 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
924 | 5907 v399 = pCastSpell->uPlayerID_2; |
890 | 5908 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5909 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5910 } | |
889 | 5911 else |
890 | 5912 { |
5913 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5914 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
890 | 5915 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5916 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
890 | 5917 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5918 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
890 | 5919 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5920 } | |
924 | 5921 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5922 | |
5923 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
5924 | |
5925 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 5926 } |
5927 LODWORD(v727) = 1; | |
5928 break; | |
5929 } | |
5930 case SPELL_MIND_CURE_PARALYSIS: | |
5931 { | |
5932 v405 = v731 - 2; | |
5933 if ( !v405 ) | |
5934 goto LABEL_766; | |
5935 v406 = v405 - 1; | |
5936 if ( v406 ) | |
5937 { | |
5938 if ( v406 == 1 ) | |
5939 { | |
5940 amount = 0; | |
5941 goto LABEL_768; | |
5942 } | |
5943 LABEL_766: | |
5944 v407 = 3600 * v2; | |
5945 } | |
5946 else | |
5947 { | |
5948 v407 = 86400 * v2; | |
5949 } | |
5950 amount = v407; | |
5951 LABEL_768: | |
5952 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5953 break; | |
5954 | |
924 | 5955 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5956 v323 = pCastSpell->uPlayerID_2; | |
890 | 5957 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5958 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5959 { | |
5960 LODWORD(v727) = 1; | |
5961 break; | |
5962 } | |
5963 if ( v731 == 4 ) | |
5964 { | |
5965 *(int *)v324 = 0; | |
5966 *((int *)v324 + 1) = 0; | |
889 | 5967 LODWORD(v727) = 1; |
890 | 5968 break; |
5969 } | |
5970 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5971 v656 = 12; | |
924 | 5972 v325 = &pParty->pPlayers[v323]; |
5973 goto LABEL_641; | |
890 | 5974 |
5975 } | |
5976 case SPELL_MIND_REMOVE_FEAR: | |
5977 { | |
5978 v411 = v731 - 2; | |
5979 if ( v411 ) | |
5980 { | |
5981 v412 = v411 - 1; | |
5982 if ( v412 ) | |
5983 { | |
5984 if ( v412 == 1 ) | |
5985 { | |
5986 amount = 0; | |
5987 goto LABEL_780; | |
5988 } | |
5989 v413 = 180 * v2; | |
889 | 5990 } |
5991 else | |
5992 { | |
890 | 5993 v413 = 86400 * v2; |
5994 } | |
5995 } | |
5996 else | |
5997 { | |
5998 v413 = 3600 * v2; | |
5999 } | |
6000 amount = v413; | |
6001 LABEL_780: | |
6002 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6003 break; | |
6004 | |
924 | 6005 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6006 v323 = pCastSpell->uPlayerID_2; | |
890 | 6007 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
6008 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
6009 { | |
6010 LODWORD(v727) = 1; | |
6011 break; | |
6012 } | |
6013 if ( v731 == 4 ) | |
6014 { | |
6015 *(int *)v324 = 0; | |
6016 *((int *)v324 + 1) = 0; | |
6017 LODWORD(v727) = 1; | |
6018 break; | |
6019 } | |
6020 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6021 v656 = 3; | |
924 | 6022 v325 = &pParty->pPlayers[v323]; |
6023 goto LABEL_641; | |
890 | 6024 } |
6025 case SPELL_MIND_TELEPATHY: | |
6026 { | |
6027 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6028 break; | |
6029 if (PID_TYPE(a2) != OBJECT_Actor) | |
6030 { | |
889 | 6031 LODWORD(v727) = 1; |
890 | 6032 break; |
6033 } | |
6034 v417 = (int)&pActors[PID_ID(a2)]; | |
6035 v730 = v417; | |
6036 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6037 { | |
6038 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6039 v417 = v730; | |
6040 } | |
6041 v418 = *(int *)(v417 + 672); | |
6042 HIDWORD(v733) = 0; | |
6043 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6044 HIDWORD(v733) = *(int *)(v417 + 684); | |
6045 | |
6046 //ItemGen::ItemGen(&v683); | |
6047 v683.Reset(); | |
6048 | |
6049 v419 = *(short *)(v730 + 180); | |
6050 if (v419) | |
6051 { | |
6052 v683.uItemID = v419; | |
6053 goto LABEL_799; | |
6054 } | |
6055 v420 = 0; | |
6056 v421 = v730 + 564; | |
6057 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6058 { | |
6059 ++v420; | |
6060 v421 += 36; | |
6061 if ( v420 >= 4 ) | |
6062 goto LABEL_799; | |
6063 } | |
6064 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6065 v2 = v723; | |
6066 //v1 = 0; | |
6067 LABEL_799: | |
6068 if ( HIDWORD(v733) != 0 ) | |
6069 { | |
6070 v675 = (const char *)HIDWORD(v733); | |
6071 if (v683.uItemID) | |
6072 { | |
6073 v422 = v683.GetDisplayName(); | |
6074 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
924 | 6075 ShowStatusBarString(pTmpBuf2, 2u); |
6076 pSpellSprite.stru_24.Reset(); | |
6077 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6078 pSpellSprite.spell_level = v2; | |
6079 pSpellSprite.spell_skill = v731; | |
6080 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6081 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6082 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6083 v676 = *(short *)(v730 + 138); | |
6084 v665 = pSpellSprite.vPosition.y; | |
6085 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6086 v657 = pSpellSprite.vPosition.x; | |
6087 goto LABEL_1087; | |
890 | 6088 } |
6089 v664 = "%d gold"; | |
924 | 6090 sprintf(pTmpBuf2, v664, v675); |
6091 ShowStatusBarString(pTmpBuf2, 2u); | |
6092 pSpellSprite.stru_24.Reset(); | |
6093 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6094 pSpellSprite.spell_level = v2; | |
6095 pSpellSprite.spell_skill = v731; | |
6096 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6097 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6098 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6099 v676 = *(short *)(v730 + 138); | |
6100 v665 = pSpellSprite.vPosition.y; | |
6101 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6102 v657 = pSpellSprite.vPosition.x; | |
6103 goto LABEL_1087; | |
890 | 6104 } |
6105 if (v683.uItemID) | |
6106 { | |
6107 v675 = v683.GetDisplayName(); | |
6108 v664 = "(%s)"; | |
6109 sprintf(pTmpBuf2, v664, v675); | |
924 | 6110 ShowStatusBarString(pTmpBuf2, 2u); |
6111 pSpellSprite.stru_24.Reset(); | |
6112 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6113 pSpellSprite.spell_level = v2; | |
6114 pSpellSprite.spell_skill = v731; | |
6115 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6116 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6117 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6118 v676 = *(short *)(v730 + 138); | |
6119 v665 = pSpellSprite.vPosition.y; | |
6120 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6121 v657 = pSpellSprite.vPosition.x; | |
6122 goto LABEL_1087; | |
890 | 6123 } |
6124 strcpy(pTmpBuf2, "nothing"); | |
6125 ShowStatusBarString(pTmpBuf2, 2u); | |
924 | 6126 pSpellSprite.stru_24.Reset(); |
6127 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6128 pSpellSprite.spell_level = v2; | |
6129 pSpellSprite.spell_skill = v731; | |
6130 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6131 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6132 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
890 | 6133 v676 = *(short *)(v730 + 138); |
924 | 6134 v665 = pSpellSprite.vPosition.y; |
6135 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6136 v657 = pSpellSprite.vPosition.x; | |
890 | 6137 goto LABEL_1087; |
6138 } | |
6139 case SPELL_MIND_BERSERK: | |
6140 { | |
6141 v423 = v731 - 2; | |
6142 if ( !v423 ) | |
6143 goto LABEL_813; | |
6144 v424 = v423 - 1; | |
6145 if ( v424 ) | |
6146 { | |
6147 if ( v424 == 1 ) | |
6148 v425 = 3600 * v2; | |
6149 else | |
6150 LABEL_813: | |
6151 v425 = 300 * v2; | |
6152 } | |
6153 else | |
6154 { | |
6155 v425 = 600 * v2; | |
6156 } | |
6157 amount = v425; | |
6158 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6159 break; | |
6160 v426 = PID_ID(a2); | |
6161 if (PID_TYPE(a2) != OBJECT_Actor) | |
6162 { | |
6163 LODWORD(v727) = 1; | |
6164 break; | |
6165 } | |
6166 v730 = 836 * v426; | |
6167 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6168 { | |
6169 pActors[v426].pActorBuffs[1].Reset(); | |
6170 pActors[v426].pActorBuffs[12].Reset(); | |
6171 pActors[v426].pActorBuffs[9].Apply( | |
6172 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6173 v731, 0, 0, 0); | |
6174 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6175 } | |
924 | 6176 pSpellSprite.stru_24.Reset(); |
6177 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6178 pSpellSprite.spell_level = v2; | |
6179 pSpellSprite.spell_skill = v731; | |
6180 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6181 v61 = v426; |
6182 goto LABEL_1086; | |
6183 | |
6184 } | |
6185 case SPELL_MIND_ENSLAVE: | |
6186 { | |
6187 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6188 break; | |
6189 amount = 600 * v2; | |
6190 if (PID_TYPE(a2) != OBJECT_Actor) | |
6191 { | |
6192 LODWORD(v727) = 1; | |
6193 break; | |
6194 } | |
6195 v730 = 836 * PID_ID(a2); | |
6196 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6197 break; | |
6198 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6199 { | |
6200 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6201 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6202 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6203 v731, 0, 0, 0); | |
6204 } | |
924 | 6205 pSpellSprite.stru_24.Reset(); |
6206 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6207 pSpellSprite.spell_level = v2; | |
6208 pSpellSprite.spell_skill = v731; | |
6209 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6210 v61 = PID_ID(a2); |
6211 goto LABEL_1086; | |
6212 } | |
6213 case SPELL_MIND_MASS_FEAR: | |
6214 { | |
6215 v428 = v731 - 2; | |
6216 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6217 v430 = 300 * v2; | |
6218 else | |
6219 v430 = 180 * v2; | |
6220 amount = v430; | |
6221 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6222 break; | |
6223 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6224 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
924 | 6225 ++pSpellSprite.uType; |
6226 pSpellSprite.stru_24.Reset(); | |
6227 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6228 pSpellSprite.spell_level = v2; | |
6229 pSpellSprite.spell_skill = v731; | |
6230 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6231 pSpellSprite.uAttributes = 0; | |
6232 pSpellSprite.uSectorID = 0; | |
6233 pSpellSprite.uSpriteFrameID = 0; | |
6234 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6235 pSpellSprite.uFacing = 0; | |
6236 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6237 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6238 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6239 { | |
6240 v433 = &pActors[dword_50BF30[a2]]; | |
6241 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6242 break; | |
924 | 6243 pSpellSprite.vPosition.x = v433->vPosition.x; |
6244 pSpellSprite.vPosition.y = v433->vPosition.y; | |
6245 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6246 | |
6247 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6248 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6249 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6250 { | |
6251 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6252 v731, 0, 0, 0); | |
6253 } | |
6254 } | |
6255 LODWORD(v727) = 1; | |
6256 break; | |
6257 } | |
6258 | |
6259 case SPELL_MIND_CURE_INSANITY: | |
6260 { | |
6261 v435 = v731 - 2; | |
6262 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6263 amount = 0; | |
6264 else | |
6265 amount = 86400 * v2; | |
6266 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6267 break; | |
6268 | |
924 | 6269 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6270 v440 = pCastSpell->uPlayerID_2; | |
890 | 6271 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6272 { | |
6273 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6274 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6275 if ( v731 == 4 ) | |
6276 { | |
924 | 6277 v441 = pCastSpell->uPlayerID_2; |
890 | 6278 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6279 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
889 | 6280 } |
6281 else | |
6282 { | |
924 | 6283 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
890 | 6284 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6285 } | |
924 | 6286 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6287 LABEL_720: |
6288 v377->SetCondition(1, 0); | |
6289 } | |
6290 LODWORD(v727) = 1; | |
6291 break; | |
6292 } | |
6293 case SPELL_EARTH_TELEKINESIS: | |
6294 { | |
6295 v442 = v731 - 2; | |
6296 if ( !v442 ) | |
6297 goto LABEL_855; | |
6298 v443 = v442 - 1; | |
6299 if ( v443 ) | |
6300 { | |
6301 if ( v443 == 1 ) | |
6302 v444 = 4 * v2; | |
6303 else | |
6304 LABEL_855: | |
6305 v444 = 2 * v2; | |
6306 } | |
6307 else | |
6308 { | |
6309 v444 = 3 * v2; | |
6310 } | |
6311 amount = v444; | |
6312 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6313 break; | |
6314 v445 = PID_ID(a2); | |
6315 if (PID_TYPE(a2) == OBJECT_Item) | |
6316 { | |
6317 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6318 v450 = *(int *)v449; | |
6319 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6320 { | |
6321 party_finds_gold(*((int *)v449 + 3), 0); | |
6322 viewparams->bRedrawGameUI = 1; | |
889 | 6323 } |
6324 else | |
6325 { | |
890 | 6326 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
6327 ShowStatusBarString(pTmpBuf2, 2u); | |
6328 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6329 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6330 } | |
6331 SpriteObject::OnInteraction(v445); | |
6332 } | |
6333 else | |
6334 { | |
6335 if (PID_TYPE(a2) == OBJECT_Actor) | |
6336 { | |
6337 stru_50C198.LootActor(&pActors[v445]); | |
6338 } | |
6339 else | |
6340 { | |
6341 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6342 { | |
6343 if (PID_TYPE(a2) != OBJECT_BModel) | |
6344 { | |
6345 LODWORD(v727) = 1; | |
6346 break; | |
6347 } | |
6348 dword_507CD8 = 1; | |
6349 v677 = 1; | |
6350 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6351 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6352 else | |
6353 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6354 | |
6355 EventProcessor(v446, a2, v677); | |
6356 LODWORD(v727) = 1; | |
6357 break; | |
6358 } | |
6359 v447 = &pLevelDecorations[v445]; | |
6360 dword_507CD8 = 1; | |
6361 v448 = v447->field_16_event_id; | |
6362 if (v448) | |
6363 { | |
6364 v677 = 1; | |
6365 v446 = v448; | |
6366 EventProcessor(v446, a2, v677); | |
6367 LODWORD(v727) = 1; | |
6368 break; | |
6369 } | |
6370 if ( v447->IsInteractive() ) | |
6371 { | |
6372 activeLevelDecoration = v447; | |
6373 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6374 activeLevelDecoration = NULL; | |
6375 } | |
6376 } | |
6377 } | |
6378 LODWORD(v727) = 1; | |
6379 break; | |
6380 } | |
6381 case SPELL_BODY_CURE_WEAKNESS: | |
6382 { | |
6383 v451 = v731 - 2; | |
6384 if ( v451 ) | |
6385 { | |
6386 v452 = v451 - 1; | |
6387 if ( v452 ) | |
6388 { | |
6389 if ( v452 == 1 ) | |
6390 { | |
6391 amount = 0; | |
6392 goto LABEL_883; | |
6393 } | |
6394 v453 = 180 * v2; | |
889 | 6395 } |
6396 else | |
6397 { | |
890 | 6398 v453 = 86400 * v2; |
6399 } | |
6400 } | |
6401 else | |
6402 { | |
6403 v453 = 3600 * v2; | |
6404 } | |
6405 amount = v453; | |
6406 LABEL_883: | |
6407 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6408 break; | |
6409 | |
924 | 6410 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6411 v323 = pCastSpell->uPlayerID_2; | |
890 | 6412 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6413 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6414 { | |
889 | 6415 LODWORD(v727) = 1; |
890 | 6416 break; |
6417 } | |
6418 if ( v731 == 4 ) | |
6419 { | |
6420 *(int *)v324 = 0; | |
6421 *((int *)v324 + 1) = 0; | |
6422 LODWORD(v727) = 1; | |
6423 break; | |
6424 } | |
6425 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6426 v656 = 1; | |
6427 v325 = &pParty->pPlayers[v323]; | |
6428 goto LABEL_641; | |
6429 } | |
6430 case SPELL_BODY_FIRST_AID: | |
6431 { | |
6432 v457 = v731 - 2; | |
6433 if ( v457 ) | |
6434 { | |
6435 v458 = v457 - 1; | |
6436 if ( v458 ) | |
6437 { | |
6438 if ( v458 == 1 ) | |
6439 v459 = 5 * v2 + 5; | |
6440 else | |
6441 v459 = 2 * v2 + 5; | |
889 | 6442 } |
6443 else | |
6444 { | |
890 | 6445 v459 = 4 * v2 + 5; |
6446 } | |
6447 } | |
6448 else | |
6449 { | |
6450 v459 = 3 * v2 + 5; | |
6451 } | |
6452 amount = v459; | |
6453 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6454 break; | |
924 | 6455 v460 = pCastSpell->spell_target_pid; |
890 | 6456 if (!v460) |
6457 { | |
924 | 6458 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6459 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 6460 } |
6461 else | |
6462 { | |
6463 if (PID_TYPE(v460) == OBJECT_Actor) | |
6464 { | |
6465 v461 = &pActors[PID_ID(v460)]; | |
6466 v462 = v461->uAIState; | |
6467 v463 = v461->pMonsterInfo.uHP; | |
6468 if ( v462 != 5 ) | |
6469 { | |
6470 if ( v462 != 4 ) | |
6471 { | |
6472 if ( v462 != 19 ) | |
6473 { | |
6474 if ( v462 != 11 ) | |
6475 { | |
6476 v461->sCurrentHP += amount; | |
6477 if ( v461->sCurrentHP > v463 ) | |
6478 v461->sCurrentHP = v463; | |
6479 } | |
6480 } | |
6481 } | |
6482 } | |
6483 } | |
6484 } | |
6485 LODWORD(v727) = 1; | |
6486 break; | |
6487 } | |
6488 case SPELL_BODY_CURE_POISON: | |
6489 { | |
6490 v464 = v731 - 2; | |
6491 if ( !v464 ) | |
6492 goto LABEL_910; | |
6493 v465 = v464 - 1; | |
6494 if ( v465 ) | |
6495 { | |
6496 if ( v465 == 1 ) | |
6497 { | |
6498 amount = 0; | |
6499 goto LABEL_912; | |
6500 } | |
6501 LABEL_910: | |
6502 v466 = 3600 * v2; | |
6503 } | |
6504 else | |
6505 { | |
6506 v466 = 86400 * v2; | |
6507 } | |
6508 amount = v466; | |
6509 LABEL_912: | |
6510 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6511 break; | |
6512 | |
924 | 6513 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6514 v470 = pCastSpell->uPlayerID_2; | |
890 | 6515 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6516 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6517 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6518 { | |
6519 LODWORD(v727) = 1; | |
6520 break; | |
6521 } | |
6522 if ( v731 == 4 ) | |
6523 { | |
6524 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6525 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
924 | 6526 v471 = pCastSpell->uPlayerID_2; |
890 | 6527 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6528 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
924 | 6529 v472 = pCastSpell->uPlayerID_2; |
890 | 6530 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6531 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6532 LODWORD(v727) = 1; | |
6533 break; | |
6534 } | |
6535 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6536 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6537 6u, | |
6538 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6539 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6540 8u, |
6541 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6542 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6543 v656 = 10; | |
6544 goto LABEL_937; | |
6545 | |
6546 } | |
6547 case SPELL_BODY_PROTECTION_FROM_MAGIC: | |
6548 { | |
6549 amount = v2; | |
6550 LODWORD(v733) = 3600 * v2; | |
6551 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6552 break; | |
6553 | |
924 | 6554 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6555 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6556 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6557 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6558 |
6559 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6560 LODWORD(v727) = 1; | |
6561 break; | |
6562 } | |
6563 case SPELL_BODY_HAMMERHANDS: | |
6564 { | |
6565 LODWORD(v733) = 3600 * v2; | |
6566 amount = v2; | |
6567 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6568 break; | |
6569 if ( v731 == 4 ) | |
6570 { | |
924 | 6571 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6572 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6573 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6574 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6575 v732 = (int)v733 << 7; |
6576 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6577 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6578 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6579 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6580 | |
6581 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6582 LODWORD(v727) = 1; | |
6583 break; | |
6584 } | |
924 | 6585 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6586 | |
6587 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 | 6588 LODWORD(v727) = 1; |
6589 break; | |
6590 } | |
6591 case SPELL_BODY_CURE_DISEASE: | |
6592 { | |
6593 v493 = v731 - 2; | |
6594 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6595 amount = 0; | |
6596 else | |
6597 amount = 86400 * v2; | |
6598 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6599 break; | |
6600 | |
924 | 6601 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6602 v498 = pCastSpell->uPlayerID_2; | |
890 | 6603 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6604 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6605 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6606 { | |
6607 LODWORD(v727) = 1; | |
6608 break; | |
6609 } | |
6610 if ( v731 == 4 ) | |
6611 { | |
6612 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6613 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
924 | 6614 v499 = pCastSpell->uPlayerID_2; |
890 | 6615 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6616 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
924 | 6617 v500 = pCastSpell->uPlayerID_2; |
890 | 6618 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6619 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6620 } | |
6621 else | |
6622 { | |
6623 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6624 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6625 7u, | |
6626 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6627 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6628 9u, |
6629 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6630 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6631 v656 = 11; | |
6632 LABEL_937: | |
924 | 6633 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6634 LABEL_641: |
6635 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6636 } | |
6637 LODWORD(v727) = 1; | |
6638 break; | |
6639 } | |
6640 case SPELL_BODY_POWER_CURE: | |
6641 { | |
6642 amount = 5 * v2 + 10; | |
6643 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6644 break; | |
6645 v501 = pParty->pPlayers; | |
6646 int v1 = 0; | |
6647 do | |
6648 { | |
924 | 6649 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
890 | 6650 v501->Heal(amount); |
6651 ++v501; | |
6652 ++v1; | |
6653 } | |
6654 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6655 LODWORD(v727) = 1; | |
6656 break; | |
6657 } | |
6658 case SPELL_LIGHT_DISPEL_MAGIC: | |
6659 { | |
6660 sRecoveryTime -= v2; | |
6661 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6662 break; | |
6663 | |
6664 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6665 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6666 ++pSpellSprite.uType; |
890 | 6667 HIDWORD(v733) = v505; |
6668 v688.x = 0; | |
6669 v688.y = 0; | |
6670 v688.z = 0; | |
924 | 6671 pSpellSprite.stru_24.Reset(); |
6672 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6673 pSpellSprite.spell_level = v2; | |
6674 pSpellSprite.spell_skill = v731; | |
6675 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6676 pSpellSprite.uAttributes = 0; | |
6677 pSpellSprite.uSectorID = 0; | |
6678 pSpellSprite.uSpriteFrameID = 0; | |
6679 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6680 pSpellSprite.uFacing = 0; | |
6681 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6682 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6683 a2 = 0; |
6684 if ( SHIDWORD(v733) > 0 ) | |
6685 { | |
6686 do | |
6687 { | |
6688 v507 = dword_50BF30[a2]; | |
924 | 6689 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6690 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
6691 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6692 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6693 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6694 v510 = a2; |
6695 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6696 a2 = v510 + 1; | |
6697 } | |
6698 while ( v510 + 1 < SHIDWORD(v733) ); | |
6699 } | |
6700 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6701 { | |
6702 v511 = &pActors[dword_50BF30[a2]]; | |
924 | 6703 pSpellSprite.vPosition.x = v511->vPosition.x; |
6704 pSpellSprite.vPosition.y = v511->vPosition.y; | |
6705 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6706 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6707 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6708 v513 = v511->pActorBuffs; |
6709 for (int _v726 = 22; _v726 != 0; --_v726) | |
6710 { | |
6711 v513->Reset(); | |
6712 ++v513; | |
6713 } | |
6714 } | |
6715 LODWORD(v727) = 1; | |
6716 break; | |
6717 } | |
6718 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
6719 { | |
6720 v514 = v731 - 2; | |
6721 if ( !v514 ) | |
6722 goto LABEL_955; | |
6723 v515 = v514 - 1; | |
6724 if ( v515 ) | |
6725 { | |
6726 if ( v515 == 1 ) | |
6727 { | |
6728 v516 = 900 * v2; | |
6729 amount = 5; | |
889 | 6730 } |
6731 else | |
6732 { | |
890 | 6733 LABEL_955: |
6734 v516 = 300 * v2; | |
6735 amount = 1; | |
6736 } | |
6737 } | |
6738 else | |
6739 { | |
6740 v516 = 900 * v2; | |
6741 amount = 3; | |
6742 } | |
6743 v733 = __PAIR__(0, v516); | |
6744 | |
6745 if ( (signed int)uNumActors > 0 ) | |
6746 { | |
6747 v518 = pActors;//[0].uAIState; | |
6748 auto _v726 = uNumActors; | |
889 | 6749 do |
6750 { | |
890 | 6751 v519 = v518->uAIState; |
924 | 6752 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
890 | 6753 ++HIDWORD(v733); |
6754 ++v518; | |
6755 --_v726; | |
6756 } | |
6757 while ( _v726 != 0 ); | |
6758 } | |
6759 if ( SHIDWORD(v733) >= amount ) | |
6760 { | |
6761 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6762 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6763 pCastSpell->spellnum = 0; |
890 | 6764 continue; |
6765 } | |
6766 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6767 break; | |
924 | 6768 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
890 | 6769 LODWORD(v727) = 1; |
6770 break; | |
6771 } | |
6772 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
6773 { | |
6774 v520 = v731 - 2; | |
6775 if ( !v520 ) | |
6776 goto LABEL_973; | |
6777 v521 = v520 - 1; | |
6778 if ( v521 ) | |
6779 { | |
6780 if ( v521 == 1 ) | |
6781 { | |
6782 LODWORD(v733) = 18000 * v2; | |
6783 v522 = 5 * v2 + 10; | |
889 | 6784 } |
6785 else | |
6786 { | |
890 | 6787 LABEL_973: |
6788 LODWORD(v733) = 10800 * v2; | |
6789 v522 = 3 * v2 + 10; | |
6790 } | |
6791 } | |
6792 else | |
6793 { | |
6794 LODWORD(v733) = 14400 * v2; | |
6795 v522 = 4 * v2 + 10; | |
6796 } | |
6797 amount = v522; | |
6798 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6799 break; | |
6800 | |
924 | 6801 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6802 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6803 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6804 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6805 |
6806 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6807 LODWORD(v727) = 1; | |
6808 break; | |
6809 } | |
6810 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
6811 { | |
6812 //v67 = 2; | |
6813 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6814 { | |
6815 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6816 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6817 pCastSpell->spellnum = 0; |
890 | 6818 continue; |
6819 } | |
6820 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6821 break; | |
6822 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6823 ++pSpellSprite.uType; |
890 | 6824 v694.x = 0; |
6825 v694.y = 0; | |
6826 v694.z = 0; | |
924 | 6827 pSpellSprite.stru_24.Reset(); |
6828 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6829 pSpellSprite.spell_level = v2; | |
6830 pSpellSprite.spell_skill = v731; | |
6831 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6832 pSpellSprite.uAttributes = 0; | |
6833 pSpellSprite.uSectorID = 0; | |
6834 pSpellSprite.uSpriteFrameID = 0; | |
6835 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6836 pSpellSprite.uFacing = 0; | |
6837 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6838 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6839 a2 = 0; |
6840 if ( (signed int)v531 > 0 ) | |
6841 { | |
6842 do | |
6843 { | |
6844 v533 = dword_50BF30[a2]; | |
924 | 6845 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6846 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
6847 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6848 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6849 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6850 v536 = a2; |
6851 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6852 a2 = v536 + 1; | |
6853 } | |
6854 while ( v536 + 1 < (signed int)v531 ); | |
6855 } | |
6856 v537 = pGame->GetStru6(); | |
6857 pGame->GetStru6()->_4A8BFC(); | |
889 | 6858 LODWORD(v727) = 1; |
890 | 6859 break; |
6860 } | |
6861 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6862 { | |
6863 v538 = v731 - 2; | |
6864 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6865 { | |
6866 amount = 5 * v2; | |
6867 v540 = 18000 * v2; | |
6868 } | |
6869 else | |
6870 { | |
6871 amount = 4 * v2; | |
6872 v540 = 14400 * v2; | |
6873 } | |
6874 v730 = v540; | |
6875 LODWORD(v733) = v540; | |
6876 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6877 break; | |
6878 | |
924 | 6879 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6880 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6881 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6882 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6883 |
6884 v732 = v730 << 7; | |
6885 v549 = (double)(v730 << 7) * 0.033333335; | |
6886 *((float *)&v733 + 1) = v549; | |
6887 v712 = (signed __int64)v549; | |
6888 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6889 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6890 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6891 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6892 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6893 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6894 v550 = v2 + 5; | |
6895 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6896 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6897 v731, | |
6898 v550, 0, 0); | |
6899 | |
6900 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6901 LODWORD(v727) = 1; | |
6902 break; | |
6903 } | |
6904 | |
6905 case SPELL_LIGHT_HOUR_OF_POWER: | |
6906 { | |
6907 v551 = v731 - 2; | |
6908 if ( !v551 ) | |
6909 goto LABEL_998; | |
6910 v552 = v551 - 1; | |
6911 if ( v552 ) | |
6912 { | |
6913 if ( v552 == 1 ) | |
6914 { | |
6915 amount = 15; | |
6916 HIDWORD(v733) = 20; | |
6917 goto LABEL_1000; | |
6918 } | |
6919 LABEL_998: | |
6920 v678 = 4; | |
6921 } | |
6922 else | |
6923 { | |
6924 v678 = 12; | |
6925 } | |
6926 amount = v678; | |
6927 HIDWORD(v733) = v678; | |
6928 LABEL_1000: | |
6929 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6930 break; | |
6931 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6932 v732 = (300 * amount * v2 + 60) << 7; | |
6933 v730 = v2 + 5; | |
6934 int _v726 = 0; | |
6935 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6936 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6937 do | |
6938 { | |
924 | 6939 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6940 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6941 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6942 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 6943 |
890 | 6944 //((SpellBuff *)(v553 + 6056))->Apply( |
6945 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6946 if ( *(_QWORD *)v553 ) | |
6947 _v726 = 1; | |
6948 ++v553; | |
6949 } | |
6950 while ( v553 <= &pParty->pPlayers[3] ); | |
6951 v562 = v731; | |
6952 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6953 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6954 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6955 if (!_v726) | |
6956 { | |
6957 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); | |
6958 } | |
6959 LODWORD(v727) = 1; | |
6960 break; | |
6961 } | |
6962 | |
6963 | |
6964 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
6965 { | |
6966 amount = 3; | |
6967 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6968 { | |
6969 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6970 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6971 pCastSpell->spellnum = 0; |
890 | 6972 continue; |
6973 } | |
6974 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6975 break; | |
6976 a2 = 0; | |
6977 _this = (ItemGen *)&pPlayers[1]; | |
6978 do | |
6979 { | |
6980 v563 = 0; | |
889 | 6981 do |
6982 { | |
890 | 6983 v564 = _this->uItemID; |
6984 *(int *)(v563 + _this->uItemID) = 0; | |
6985 v563 += 8; | |
6986 *(int *)(v563 + v564 - 4) = 0; | |
6987 } | |
6988 while ( v563 <= 128 ); | |
6989 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6990 v566 = (Player **)_this; | |
6991 *(int *)(_this->uItemID + 6460) = v565; | |
6992 v567 = (*v566)->GetMaxMana(); | |
6993 *(int *)(_this->uItemID + 6464) = v567; | |
924 | 6994 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 6995 ++a2; |
6996 _this = (ItemGen *)((char *)_this + 4); | |
6997 } | |
6998 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6999 v571 = pPlayer; | |
7000 v572 = (char *)&pPlayer->sAgeModifier; | |
7001 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
7002 *(short *)v572 = 120; | |
7003 else | |
7004 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
7005 sRecoveryTime += -5 * v2; | |
7006 ++v571->uNumDivineInterventionCastsThisDay; | |
7007 LODWORD(v727) = 1; | |
7008 break; | |
7009 } | |
7010 case SPELL_DARK_REANIMATE: | |
7011 { | |
7012 v573 = v731 - 2; | |
7013 if ( v573 ) | |
7014 { | |
7015 v574 = v573 - 1; | |
7016 if ( v574 ) | |
7017 { | |
7018 if ( v574 == 1 ) | |
7019 v575 = 5 * v2; | |
889 | 7020 else |
890 | 7021 v575 = 2 * v2; |
889 | 7022 } |
7023 else | |
7024 { | |
890 | 7025 v575 = 4 * v2; |
7026 } | |
7027 } | |
7028 else | |
7029 { | |
7030 v575 = 3 * v2; | |
7031 } | |
7032 amount = v575; | |
7033 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7034 break; | |
924 | 7035 v576 = pCastSpell->spell_target_pid; |
890 | 7036 if (!v576) |
7037 { | |
924 | 7038 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7039 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 7040 if ( *((_QWORD *)v585 + 14) ) |
7041 { | |
7042 ((Player *)v585)->SetCondition(0x11u, 1); | |
7043 v587 = ((Player *)v585)->GetSexByVoice(); | |
924 | 7044 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
890 | 7045 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7046 } | |
7047 break; | |
7048 } | |
7049 v577 = (Player *)(PID_ID(v576)); | |
7050 //v726 = v577; | |
7051 if ( v577 == (Player *)-1 ) | |
7052 { | |
7053 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7054 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7055 pCastSpell->spellnum = 0; |
890 | 7056 continue; |
7057 } | |
7058 v578 = (int)&pActors[(int)v577]; | |
7059 v721 = v578; | |
7060 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7061 { | |
7062 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7063 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7064 pCastSpell->spellnum = 0; |
890 | 7065 continue; |
7066 } | |
924 | 7067 ++pSpellSprite.uType; |
7068 pSpellSprite.stru_24.Reset(); | |
7069 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7070 pSpellSprite.spell_level = v2; | |
7071 pSpellSprite.spell_skill = v731; | |
7072 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7073 pSpellSprite.uAttributes = 0; | |
7074 pSpellSprite.uSectorID = 0; | |
7075 pSpellSprite.uSpriteFrameID = 0; | |
7076 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
890 | 7077 v581 = v721; |
924 | 7078 pSpellSprite.uFacing = 0; |
7079 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7080 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7081 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
7082 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
890 | 7083 v732 = *(short *)(v721 + 138); |
924 | 7084 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7085 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7086 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7087 if ( *(char *)(v581 + 52) > amount ) |
7088 break; | |
7089 Actor::Resurrect((unsigned int)v577); | |
7090 *(char *)(v581 + 61) = 0; | |
7091 *(char *)(v581 + 53) = 0; | |
7092 *(char *)(v581 + 54) = 0; | |
7093 *(char *)(v581 + 55) = 0; | |
7094 *(char *)(v581 + 56) = 0; | |
7095 *(char *)(v581 + 57) = 0; | |
7096 *(int *)(v581 + 712) = 9999; | |
7097 *(char *)(v581 + 38) &= 0xF7u; | |
7098 *(int *)(v581 + 708) = 0; | |
7099 ((SpellBuff *)(v581 + 356))->Reset(); | |
7100 ((SpellBuff *)(v581 + 228))->Reset(); | |
7101 ((SpellBuff *)(v581 + 404))->Reset(); | |
7102 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7103 *(short *)(v581 + 40) = 10 * amount; | |
889 | 7104 LODWORD(v727) = 1; |
890 | 7105 break; |
7106 } | |
7107 case SPELL_DARK_VAMPIRIC_WEAPON: | |
7108 { | |
7109 v588 = v731 - 1; | |
7110 amount = 16; | |
7111 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7112 { | |
7113 if ( v590 == 1 ) | |
7114 LODWORD(v733) = 0; | |
7115 } | |
7116 else | |
7117 { | |
7118 LODWORD(v733) = 3600 * v2; | |
7119 } | |
7120 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7121 break; | |
7122 __debugbreak(); | |
924 | 7123 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
890 | 7124 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7125 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7126 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7127 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7128 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7129 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7130 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7131 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7132 { | |
7133 dword_50C9D0 = 113; | |
7134 dword_50C9D4 = 0; | |
7135 dword_50C9D8 = 1; | |
7136 | |
7137 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7138 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7139 pCastSpell->spellnum = 0; |
890 | 7140 continue; |
7141 } | |
7142 v592 = HIDWORD(v733); | |
7143 v14 = v731 == 4; | |
7144 *(int *)(HIDWORD(v733) + 12) = 16; | |
7145 if ( !v14 ) | |
7146 { | |
7147 v732 = (int)v733 << 7; | |
7148 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7149 *(int *)(v592 + 20) |= 8u; | |
7150 } | |
7151 *(char *)(v592 + 20) |= 0x80u; | |
7152 dword_50C9A8 = 256; | |
7153 LODWORD(v727) = 1; | |
7154 break; | |
7155 } | |
7156 case SPELL_DARK_SHARPMETAL: | |
7157 { | |
7158 v593 = v731 - 2; | |
7159 if ( !v593 ) | |
7160 goto LABEL_1062; | |
7161 v594 = v593 - 1; | |
7162 if ( v594 ) | |
7163 { | |
7164 if ( v594 == 1 ) | |
7165 amount = 9; | |
889 | 7166 else |
890 | 7167 LABEL_1062: |
7168 amount = 5; | |
7169 } | |
7170 else | |
7171 { | |
7172 amount = 7; | |
7173 } | |
7174 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7175 break; | |
7176 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
924 | 7177 pSpellSprite.stru_24.Reset(); |
7178 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7179 pSpellSprite.spell_level = v2; | |
7180 pSpellSprite.spell_skill = v731; | |
7181 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7182 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
7183 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
7184 pSpellSprite.uAttributes = 0; | |
7185 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7186 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 7187 pParty->vPosition.x, |
7188 pParty->vPosition.y, | |
7189 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
924 | 7190 pSpellSprite.uSpriteFrameID = 0; |
7191 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7192 pSpellSprite.spell_target_pid = a2; | |
7193 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7194 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7195 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 7196 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 7197 v596 = (signed int)_v726 / -2; |
7198 y = (char *)((signed int)_v726 / 2); | |
7199 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7200 { | |
7201 v597 = v715.uYawAngle; | |
889 | 7202 do |
7203 { | |
924 | 7204 pSpellSprite.uFacing = v596 + v597; |
7205 if ( pSpellSprite.Create( | |
890 | 7206 v596 + v597, |
7207 v715.uPitchAngle, | |
924 | 7208 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7209 pCastSpell->uPlayerID + 1) != -1 | |
890 | 7210 && pParty->bTurnBasedModeOn == 1 ) |
7211 ++pTurnEngine->field_1C; | |
7212 v596 += _v726 / (amount - 1); | |
7213 } | |
7214 while ( v596 <= (signed int)y ); | |
7215 } | |
7216 LODWORD(v727) = 1; | |
7217 break; | |
7218 } | |
7219 | |
7220 case SPELL_DARK_CONTROL_UNDEAD: | |
7221 { | |
7222 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7223 break; | |
7224 if ( v731 == 1 || v731 == 2 ) | |
7225 { | |
7226 v598 = 180 * v2; | |
924 | 7227 LODWORD(v733) = v598; |
7228 goto LABEL_1082; | |
890 | 7229 } |
7230 if ( v731 == 3 ) | |
7231 { | |
7232 v598 = 300 * v2; | |
7233 LODWORD(v733) = v598; | |
7234 goto LABEL_1082; | |
7235 } | |
7236 if ( v731 == 4 ) | |
7237 LODWORD(v733) = 29030400; | |
7238 LABEL_1082: | |
7239 if (PID_TYPE(a2) != OBJECT_Actor) | |
7240 { | |
7241 LODWORD(v727) = 1; | |
7242 break; | |
7243 } | |
7244 v730 = 836 * PID_ID(a2); | |
7245 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7246 break; | |
7247 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7248 { | |
7249 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7250 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7251 pCastSpell->spellnum = 0; |
890 | 7252 continue; |
7253 } | |
7254 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7255 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7256 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7257 v731, 0, 0, 0); | |
924 | 7258 pSpellSprite.stru_24.Reset(); |
7259 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7260 pSpellSprite.spell_level = v2; | |
7261 pSpellSprite.spell_skill = v731; | |
7262 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 7263 v61 = PID_ID(a2); |
7264 LABEL_1086: | |
7265 v600 = pActors[v61].vPosition.y; | |
7266 v601 = pActors[v61].vPosition.x; | |
924 | 7267 pSpellSprite.uObjectDescID = v60; |
7268 pSpellSprite.vPosition.x = v601; | |
890 | 7269 v602 = pActors[v61].uActorHeight; |
7270 v603 = pActors[v61].vPosition.z; | |
924 | 7271 pSpellSprite.vPosition.y = v600; |
890 | 7272 v676 = v603 + v602; |
7273 v665 = v600; | |
924 | 7274 pSpellSprite.vPosition.z = v603 + v602; |
890 | 7275 v657 = v601; |
7276 LABEL_1087: | |
924 | 7277 pSpellSprite.uAttributes = 0; |
7278 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7279 pSpellSprite.uSpriteFrameID = 0; | |
7280 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7281 pSpellSprite.spell_target_pid = a2; | |
7282 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7283 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
7284 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
7285 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7286 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
7287 LODWORD(v727) = 1; | |
7288 break; | |
7289 } | |
890 | 7290 case SPELL_DARK_SACRIFICE: |
7291 { | |
7292 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7293 break; | |
7294 HIDWORD(v733) = 0; | |
7295 memset(&achievedAwardsIndex, 0, 4000); | |
7296 _this = 0; | |
7297 v605 = (char *)pParty->pHirelings; | |
7298 do | |
7299 { | |
7300 if ( *(int *)v605) | |
7301 { | |
7302 v606 = HIDWORD(v733)++; | |
7303 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); | |
7304 } | |
7305 _this = (ItemGen *)((char *)_this + 1); | |
7306 v605 += 76; | |
7307 } | |
7308 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7309 _this = 0; | |
7310 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7311 { | |
7312 v730 = (int)pNPCStats->pNewNPCData; | |
7313 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
889 | 7314 do |
7315 { | |
890 | 7316 if ( *(char *)(v730 + 8) & 0x80 |
7317 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7318 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7319 { | |
7320 v607 = HIDWORD(v733); | |
7321 HIDWORD(v733) += 4; | |
7322 *(int *)v607 = (int)_this + 3; | |
7323 } | |
7324 _this = (ItemGen *)((char *)_this + 1); | |
7325 v730 += 76; | |
7326 } | |
7327 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7328 } | |
924 | 7329 v608 = pCastSpell->uPlayerID_2; |
890 | 7330 if ( v608 != 4 && v608 != 5 |
7331 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7332 || v609 >= 3 ) | |
7333 { | |
7334 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7335 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7336 pCastSpell->spellnum = 0; |
890 | 7337 continue; |
7338 } | |
7339 v610 = 76 * v609; | |
7340 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7341 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7342 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7343 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7344 v612 = pParty->pPlayers; | |
7345 do | |
7346 { | |
7347 v612->sHealth = v612->GetMaxHealth(); | |
7348 v612->sMana = v612->GetMaxMana(); | |
7349 ++v612; | |
7350 } | |
7351 while ( v612 <= &pParty->pPlayers[3] ); | |
7352 v613 = &pOutdoor->ddm; | |
7353 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7354 v613 = &pIndoor->dlv; | |
7355 v613->uReputation += 15; | |
7356 if ( v613->uReputation > 10000 ) | |
7357 v613->uReputation = 10000; | |
7358 LODWORD(v727) = 1; | |
7359 break; | |
7360 } | |
7361 case SPELL_DARK_PAIN_REFLECTION: | |
7362 { | |
7363 if ( v731 <= 0 ) | |
7364 goto LABEL_1119; | |
7365 if ( v731 <= 3 ) | |
7366 { | |
7367 v614 = 300 * (v2 + 12); | |
7368 } | |
7369 else | |
7370 { | |
7371 if ( v731 != 4 ) | |
7372 goto LABEL_1119; | |
7373 v614 = 900 * (v2 + 4); | |
7374 } | |
7375 LODWORD(v733) = v614; | |
7376 LABEL_1119: | |
7377 v615 = v2 + 5; | |
7378 amount = v615; | |
7379 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7380 break; | |
7381 if ( v731 != 3 && v731 != 4 ) | |
7382 { | |
924 | 7383 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
7384 | |
7385 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 | 7386 LODWORD(v727) = 1; |
7387 break; | |
7388 } | |
7389 a2 = 0; | |
7390 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7391 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
7392 do | |
7393 { | |
924 | 7394 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 7395 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); |
7396 ++a2; | |
7397 ++v619; | |
7398 } | |
7399 while ( v619 <= &pParty->pPlayers[3] ); | |
7400 LODWORD(v727) = 1; | |
7401 break; | |
7402 } | |
7403 case SPELL_DARK_SOULDRINKER: | |
7404 { | |
7405 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7406 break; | |
7407 pGame->GetIndoorCamera(); | |
7408 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7409 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7410 v707.x = 0; | |
7411 v707.y = 0; | |
7412 v707.z = 0; | |
924 | 7413 pSpellSprite.stru_24.Reset(); |
7414 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7415 pSpellSprite.spell_level = v2; | |
7416 pSpellSprite.spell_skill = v731; | |
7417 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7418 pSpellSprite.uAttributes = 0; | |
7419 pSpellSprite.uSectorID = 0; | |
7420 pSpellSprite.uSpriteFrameID = 0; | |
7421 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
7422 pSpellSprite.uFacing = 0; | |
7423 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7424 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7425 a2 = 0; |
7426 int _v726 = 0; | |
7427 if ( SHIDWORD(v733) > 0 ) | |
7428 { | |
7429 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
889 | 7430 do |
7431 { | |
890 | 7432 v625 = dword_50BF30[a2]; |
924 | 7433 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; |
7434 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
890 | 7435 //v732 = pActors[v625].uActorHeight; |
924 | 7436 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); |
7437 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7438 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7439 v628 = a2; |
7440 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7441 a2 = v628 + 1; | |
7442 } | |
7443 while ( v628 + 1 < SHIDWORD(v733) ); | |
7444 } | |
7445 v730 = 0; | |
7446 v629 = 1; | |
7447 do | |
7448 { | |
7449 v630 = pPlayers[v629]; | |
7450 if ( !v630->pConditions[2] | |
7451 && !v630->pConditions[12] | |
7452 && !v630->pConditions[13] | |
7453 && !v630->pConditions[14] | |
7454 && !v630->pConditions[15] | |
7455 && !v630->pConditions[16] ) | |
7456 { | |
7457 v631 = v730++; | |
7458 v681[v631] = v629; | |
7459 } | |
7460 ++v629; | |
7461 } | |
7462 while ( v629 <= 4 ); | |
7463 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7464 HIDWORD(v733) = 0; | |
7465 if ( v730 > 0 ) | |
7466 { | |
7467 do | |
7468 { | |
7469 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7470 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7471 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7472 v726->sHealth += v732; | |
7473 //v726 = *(Player **)v632; | |
7474 //v634 = v726->GetMaxHealth(); | |
7475 if ( v726->sHealth > v726->GetMaxHealth()) | |
7476 v726->sHealth = v726->GetMaxHealth(); | |
7477 v635 = HIDWORD(v733); | |
7478 | |
924 | 7479 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); |
890 | 7480 HIDWORD(v733) = v635 + 1; |
7481 } | |
7482 while ( v635 + 1 < v730 ); | |
7483 } | |
7484 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
7485 LODWORD(v727) = 1; | |
7486 break; | |
7487 } | |
7488 | |
7489 case SPELL_DARK_ARMAGEDDON: | |
7490 { | |
7491 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7492 { | |
7493 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7494 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7495 pCastSpell->spellnum = 0; |
890 | 7496 continue; |
7497 } | |
7498 v640 = v731 - 2; | |
7499 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7500 amount = 3; | |
7501 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7502 { | |
7503 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7504 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7505 pCastSpell->spellnum = 0; |
890 | 7506 continue; |
7507 } | |
7508 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7509 break; | |
7510 pParty->armageddon_timer = 256; | |
7511 pParty->field_16140 = v2; | |
7512 ++pPlayer->uNumArmageddonCasts; | |
7513 if ( pParty->bTurnBasedModeOn == 1 ) | |
7514 ++pTurnEngine->field_1C; | |
7515 auto _v726 = 50; | |
7516 do | |
7517 { | |
7518 v642 = rand() % 4096 - 2048; | |
7519 v643 = rand(); | |
7520 v721 = v642 + pParty->vPosition.x; | |
7521 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7522 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7523 v644 = rand(); | |
7524 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7525 --_v726; | |
7526 } | |
7527 while ( _v726 != 0 ); | |
7528 LODWORD(v727) = 1; | |
7529 break; | |
7530 } | |
7531 | |
7532 default: | |
7533 break; | |
7534 } | |
924 | 7535 if ( pCastSpell->field_8 & 0x20 ) |
890 | 7536 { |
7537 if ( v727 != 0.0 ) | |
924 | 7538 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 7539 } |
7540 else | |
7541 { | |
7542 if ( sRecoveryTime < 0 ) | |
7543 sRecoveryTime = 0; | |
7544 if ( pParty->bTurnBasedModeOn ) | |
7545 { | |
7546 v645 = sRecoveryTime; | |
924 | 7547 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 7548 pPlayer->SetRecoveryTime(v645); |
7549 if ( !some_active_character ) | |
7550 pTurnEngine->_40471C(); | |
7551 } | |
7552 else | |
7553 { | |
7554 pPlayer->SetRecoveryTime( | |
7555 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
7556 } | |
7557 if ( v727 != 0.0 ) | |
7558 { | |
7559 pPlayer->PlaySound(SPEECH_49, 0); | |
7560 if ( v727 != 0.0 ) | |
924 | 7561 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
7562 pCastSpell->spellnum = 0; | |
890 | 7563 v2 = v723; |
7564 continue; | |
889 | 7565 } |
7566 } | |
924 | 7567 pCastSpell->spellnum = 0; |
890 | 7568 v2 = v723; |
7569 continue; | |
7570 | |
889 | 7571 //LABEL_1166: |
7572 // ++n; | |
7573 // if ( n >= 10 ) | |
7574 // return; | |
0 | 7575 } |
488 | 7576 |
889 | 7577 |
0 | 7578 } |
7579 //----- (0042EB42) -------------------------------------------------------- | |
7580 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7581 { | |
7582 unsigned int v2; // edx@1 | |
7583 signed int v3; // eax@1 | |
7584 char *v4; // ecx@2 | |
7585 | |
7586 v2 = this->uNumObjects; | |
7587 v3 = 0; | |
7588 if ( (signed int)this->uNumObjects <= 0 ) | |
7589 { | |
7590 LABEL_5: | |
7591 LOWORD(v3) = 0; | |
7592 } | |
7593 else | |
7594 { | |
7595 v4 = (char *)&this->pObjects->uObjectID; | |
7596 while ( uItemID != *(short *)v4 ) | |
7597 { | |
7598 ++v3; | |
7599 v4 += 56; | |
7600 if ( v3 >= (signed int)v2 ) | |
7601 goto LABEL_5; | |
7602 } | |
7603 } | |
7604 return v3; | |
7605 } | |
7606 | |
7607 //----- (0042EB78) -------------------------------------------------------- | |
7608 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7609 { | |
7610 return 8 * this->pIcons[uIconID].uAnimLength; | |
7611 } | |
7612 | |
437 | 7613 const wchar_t *UIMessage2String(UIMessageType msg) |
7614 { | |
7615 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7616 static wchar_t b[256]; // bad for threads | |
7617 switch (msg) | |
7618 { | |
7619 CASE(UIMSG_SelectSpell) | |
7620 CASE(UIMSG_ChangeGameState) | |
7621 CASE(UIMSG_Attack) | |
7622 CASE(UIMSG_PlayArcomage) | |
7623 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7624 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7625 CASE(UIMSG_ShowCredits) | |
7626 CASE(UIMSG_ExitToWindows) | |
7627 CASE(UIMSG_PlayerCreationChangeName) | |
7628 CASE(UIMSG_PlayerCreationClickPlus) | |
7629 CASE(UIMSG_PlayerCreationClickMinus) | |
7630 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7631 CASE(UIMSG_PlayerCreationSelectClass) | |
7632 CASE(UIMSG_PlayerCreationClickOK) | |
7633 CASE(UIMSG_PlayerCreationClickReset) | |
7634 CASE(UIMSG_AutonotesBook) | |
7635 CASE(UIMSG_PlayerCreationRemoveUpSkill) | |
7636 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7637 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7638 CASE(UIMSG_LoadGame) | |
7639 CASE(UIMSG_SaveGame) | |
7640 CASE(UIMSG_ShowStatus_DateTime) | |
7641 CASE(UIMSG_ShowStatus_ManaHP) | |
7642 CASE(UIMSG_ShowStatus_Player) | |
7643 CASE(UIMSG_Wait5Minutes) | |
7644 CASE(UIMSG_Wait1Hour) | |
7645 CASE(UIMSG_ShowStatus_Food) | |
7646 CASE(UIMSG_ShowStatus_Funds) | |
7647 CASE(UIMSG_QuickReference) | |
7648 CASE(UIMSG_GameMenuButton) | |
7649 CASE(UIMSG_AlreadyResting) | |
7650 CASE(UIMSG_SelectCharacter) | |
7651 CASE(UIMSG_ChangeSoundVolume) | |
7652 CASE(UIMSG_ChangeMusicVolume) | |
7653 CASE(UIMSG_Escape) | |
7654 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7655 CASE(UIMSG_InventoryLeftClick) | |
7656 CASE(UIMSG_SkillUp) | |
7657 CASE(UIMSG_GameMenu_ReturnToGame) | |
7658 CASE(UIMSG_StartNewGame) | |
7659 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7660 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7661 CASE(UIMSG_Game_OpenOptionsDialog) | |
7662 CASE(UIMSG_SetGraphicsMode) | |
7663 CASE(UIMSG_Quit) | |
7664 CASE(UIMSG_StartHireling1Dialogue) | |
7665 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7666 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7667 CASE(UIMSG_CastSpellFromBook) |
7668 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7669 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7670 CASE(UIMSG_StartNPCDialogue) | |
7671 CASE(UIMSG_ArrowUp) | |
7672 CASE(UIMSG_DownArrow) | |
7673 CASE(UIMSG_LoadSlot) | |
7674 CASE(UIMSG_SelectLoadSlot) | |
7675 CASE(UIMSG_Cancel) | |
7676 CASE(UIMSG_ExitRest) | |
7677 CASE(UIMSG_PlayerCreation_FacePrev) | |
7678 CASE(UIMSG_PlayerCreation_FaceNext) | |
7679 CASE(UIMSG_CycleCharacters) | |
7680 CASE(UIMSG_SetTurnSpeed) | |
7681 CASE(UIMSG_ToggleWalkSound) | |
7682 CASE(UIMSG_ChangeVoiceVolume) | |
7683 CASE(UIMSG_ToggleShowDamage) | |
7684 CASE(UIMSG_ScrollNPCPanel) | |
7685 CASE(UIMSG_ShowFinalWindow) | |
7686 CASE(UIMSG_OpenQuestBook) | |
7687 CASE(UIMSG_OpenAutonotes) | |
7688 CASE(UIMSG_OpenMapBook) | |
7689 CASE(UIMSG_OpenCalendar) | |
7690 CASE(UIMSG_OpenHistoryBook) | |
7691 CASE(UIMSG_ToggleAlwaysRun) | |
7692 CASE(UIMSG_ToggleFlipOnExit) | |
7693 CASE(UIMSG_Game_Action) | |
907 | 7694 CASE(UIMSG_RentRoom) |
437 | 7695 CASE(UIMSG_TransitionUI_Confirm) |
7696 CASE(UIMSG_OpenKeyMappingOptions) | |
7697 CASE(UIMSG_SelectKeyPage1) | |
7698 CASE(UIMSG_SelectKeyPage2) | |
7699 CASE(UIMSG_ResetKeyMapping) | |
7700 CASE(UIMSG_ChangeKeyButton) | |
7701 CASE(UIMSG_OpenVideoOptions) | |
7702 CASE(UIMSG_ToggleBloodsplats) | |
7703 CASE(UIMSG_ToggleColoredLights) | |
7704 CASE(UIMSG_ToggleTint) | |
7705 default: | |
7706 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7707 }; | |
7708 #undef CASE | |
7709 } | |
7710 | |
0 | 7711 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7712 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7713 { |
482 | 7714 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7715 if (uNumMessages < 40) |
7716 { | |
437 | 7717 files[uNumMessages] = file; |
7718 lines[uNumMessages] = line; | |
7719 | |
0 | 7720 pMessages[uNumMessages].eType = msg; |
7721 pMessages[uNumMessages].param = param; | |
7722 pMessages[uNumMessages++].field_8 = a4; | |
7723 } | |
7724 } | |
7725 | |
7726 //----- (0042EBBE) -------------------------------------------------------- | |
7727 int __fastcall sub_42EBBE(int a1, int a2) | |
7728 { | |
7729 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7730 } | |
7731 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7732 | |
7733 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7734 int stru193_math::Sin(int angle) |
0 | 7735 { |
323 | 7736 return Cos(angle - this->uIntegerHalfPi); |
0 | 7737 } |
7738 | |
7739 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7740 void _42ECB5_PlayerAttacksActor() |
0 | 7741 { |
271 | 7742 //unsigned int v0; // ebx@1 |
7743 //Player *v1; // esi@1 | |
7744 //bool result; // eax@1 | |
295 | 7745 //int v3; // edi@2 |
271 | 7746 //unsigned int v4; // eax@7 |
0 | 7747 char *v5; // eax@8 |
271 | 7748 //int v6; // ecx@9 |
7749 //signed int v7; // eax@16 | |
295 | 7750 //Actor *v8; // edi@20 |
0 | 7751 unsigned int v9; // ecx@21 |
295 | 7752 //char *v10; // eax@26 |
0 | 7753 char *v11; // eax@26 |
7754 unsigned int v12; // eax@47 | |
295 | 7755 //char *v13; // eax@47 |
7756 //char *v14; // eax@47 | |
7757 //unsigned int v15; // ebx@54 | |
7758 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7759 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7760 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7761 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7762 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7763 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7764 //int v22; // [sp-4h] [bp-40h]@24 | |
7765 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7766 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7767 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7768 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7769 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7770 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7771 //unsigned int *v28b; |
295 | 7772 //int v29; // [sp+24h] [bp-18h]@16 |
7773 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7774 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7775 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7776 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7777 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7778 |
271 | 7779 //v0 = uActiveCharacter; |
7780 //v27 = 6972 * uActiveCharacter; | |
7781 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7782 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7783 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7784 if (!player->CanAct()) | |
7785 return; | |
7786 | |
924 | 7787 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 7788 //v3 = 0; |
271 | 7789 if (pParty->Invisible()) |
7790 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7791 | |
7792 //v31 = player->pEquipment.uBow; | |
7793 int bow_idx = player->pEquipment.uBow; | |
7794 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7795 bow_idx = 0; | |
7796 | |
295 | 7797 //v32 = 0; |
7798 int wand_item_id = 0; | |
271 | 7799 //v33 = 0; |
7800 //v4 = v1->pEquipment.uMainHand; | |
7801 int laser_weapon_item_id = 0; | |
7802 | |
7803 int main_hand_idx = player->pEquipment.uMainHand; | |
7804 if (main_hand_idx) | |
0 | 7805 { |
271 | 7806 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7807 //v5 = (char *)v1 + 36 * v4; |
271 | 7808 if (!item->Broken()) |
7809 { | |
7810 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7811 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7812 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7813 { |
295 | 7814 if (item->uNumCharges <= 0) |
7815 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7816 else |
295 | 7817 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7818 } |
271 | 7819 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7820 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7821 } |
271 | 7822 } |
7823 | |
295 | 7824 //v30 = 0; |
7825 //v29 = 0; | |
7826 //v28 = 0; | |
271 | 7827 //v7 = pMouse->uPointingObjectID; |
7828 | |
7829 int target_pid = pMouse->uPointingObjectID; | |
848 | 7830 int target_type = PID_TYPE(target_pid), |
7831 target_id = PID_ID(target_pid); | |
271 | 7832 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7833 { | |
7834 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7835 target_type = PID_TYPE(target_pid); |
7836 target_id = PID_ID(target_pid); | |
271 | 7837 } |
295 | 7838 |
7839 auto actor = &pActors[target_id]; | |
7840 int actor_distance = 0; | |
271 | 7841 if (target_type == OBJECT_Actor) |
7842 { | |
295 | 7843 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7844 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7845 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7846 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7847 if (actor_distance < 0) | |
7848 actor_distance = 0; | |
7849 } | |
7850 | |
7851 bool shooting_bow = false, | |
7852 shotting_laser = false, | |
816 | 7853 shooting_wand = false, |
7854 melee_attack = false; | |
295 | 7855 if (laser_weapon_item_id) |
7856 { | |
7857 shotting_laser = true; | |
490 | 7858 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7859 } |
7860 else if (wand_item_id) | |
7861 { | |
7862 shooting_wand = true; | |
7863 | |
7864 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7865 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7866 |
7867 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7868 player->pEquipment.uMainHand = 0; | |
7869 } | |
303 | 7870 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7871 { |
816 | 7872 melee_attack = true; |
7873 | |
303 | 7874 Vec3_int_ a3; |
7875 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7876 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7877 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7878 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7879 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7880 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7881 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7882 _42FA66_do_explosive_impact( |
7883 actor->vPosition.x, | |
7884 actor->vPosition.y, | |
7885 actor->vPosition.z + actor->uActorHeight / 2, | |
7886 0, 512, uActiveCharacter); | |
303 | 7887 } |
7888 else if (bow_idx) | |
7889 { | |
7890 shooting_bow = true; | |
490 | 7891 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7892 } |
7893 else | |
7894 { | |
816 | 7895 melee_attack = true; |
303 | 7896 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7897 } | |
7898 | |
816 | 7899 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7900 { |
816 | 7901 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7902 if (recovery < 30 ) |
7903 recovery = 30; | |
816 | 7904 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7905 } |
7906 | |
7907 | |
7908 int v34 = 0; | |
7909 if (shooting_wand) | |
7910 return; | |
7911 else if (shooting_bow) | |
7912 { | |
7913 v34 = 5; | |
7914 player->PlaySound(SPEECH_50, 0); | |
7915 } | |
7916 if (shotting_laser) | |
7917 v34 = 7; | |
7918 else | |
7919 { | |
7920 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7921 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7922 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7923 pTurnEngine->_40471C(); | |
7924 } | |
7925 | |
7926 switch (v34) | |
7927 { | |
7928 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7929 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7930 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7931 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7932 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7933 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7934 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7935 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7936 } | |
0 | 7937 } |
7938 | |
7939 //----- (0042F184) -------------------------------------------------------- | |
295 | 7940 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7941 { |
7942 int v4; // edi@1 | |
7943 stru319 *v5; // esi@1 | |
7944 int v6; // eax@2 | |
7945 int v7; // eax@4 | |
7946 int result; // eax@5 | |
7947 int *v9; // edx@8 | |
7948 signed int v10; // ebx@10 | |
7949 int v11; // edi@11 | |
7950 Actor *v12; // esi@12 | |
7951 unsigned __int16 v13; // ax@12 | |
7952 int v14; // eax@22 | |
7953 char v15; // zf@30 | |
7954 int v16; // esi@32 | |
7955 int v17; // ecx@34 | |
7956 stru319 *v18; // eax@39 | |
7957 int v19; // edx@39 | |
7958 int v20; // ecx@41 | |
7959 unsigned __int16 v21; // ax@42 | |
7960 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7961 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7962 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7963 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7964 int *v26; // [sp+18h] [bp-14h]@8 | |
7965 int v27; // [sp+1Ch] [bp-10h]@10 | |
7966 int *v28; // [sp+20h] [bp-Ch]@10 | |
7967 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7968 int v30; // [sp+28h] [bp-4h]@6 | |
7969 int i; // [sp+38h] [bp+Ch]@33 | |
7970 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7971 | |
7972 v4 = 0; | |
7973 v5 = this; | |
7974 v24 = this; | |
7975 if ( pRenderer->pRenderD3D ) | |
7976 { | |
7977 v6 = a3 != 0; | |
7978 if ( a4 ) | |
7979 LOBYTE(v6) = v6 | 8; | |
295 | 7980 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7981 if ( v7 != -1 ) |
7982 return (unsigned __int16)v7; | |
295 | 7983 else return 0; |
0 | 7984 } |
7985 else | |
7986 { | |
7987 v30 = 0; | |
7988 if ( pRenderer->pActiveZBuffer ) | |
7989 { | |
692 | 7990 v29 = viewparams->uScreen_topL_X; |
7991 v23 = viewparams->uScreen_BttmR_X; | |
7992 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7993 { |
692 | 7994 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7995 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7996 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7997 do |
7998 { | |
7999 if ( (signed int)v29 < (signed int)v23 ) | |
8000 { | |
8001 v28 = v9; | |
8002 v10 = v4; | |
8003 v27 = v23 - v29; | |
8004 do | |
8005 { | |
8006 v22 = *v28; | |
8007 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8008 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 8009 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8010 v12 = &pActors[PID_ID(v11)]; |
0 | 8011 v13 = v12->uAIState; |
8012 if ( v13 != 5 ) | |
8013 { | |
8014 if ( v13 != 4 | |
8015 && v13 != 11 | |
8016 && v13 != 19 | |
8017 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8018 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 8019 { |
8020 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 8021 && v22 <= pick_depth << 16 ) |
0 | 8022 { |
8023 v14 = 0; | |
8024 if ( v10 > 0 ) | |
8025 { | |
8026 do | |
8027 { | |
8028 if ( dword_50BDA0[v14] == v11 ) | |
8029 break; | |
8030 ++v14; | |
8031 } | |
8032 while ( v14 < v30 ); | |
8033 } | |
8034 if ( v14 == v30 && v10 < 100 ) | |
8035 { | |
8036 ++v30; | |
8037 dword_50BC10[v10] = v22; | |
8038 dword_50BDA0[v10] = v11; | |
8039 ++v10; | |
8040 } | |
8041 } | |
8042 } | |
8043 } | |
8044 } | |
8045 ++v28; | |
8046 --v27; | |
8047 } | |
8048 while ( v27 ); | |
8049 v4 = v30; | |
8050 v5 = v24; | |
8051 } | |
8052 v9 = v26 + 640; | |
8053 v15 = v25-- == 1; | |
8054 v26 += 640; | |
8055 } | |
8056 while ( !v15 ); | |
8057 } | |
8058 if ( v4 > 0 ) | |
8059 { | |
8060 v32 = 1; | |
8061 v16 = (int)dword_50BC10; | |
8062 do | |
8063 { | |
8064 for ( i = v32; i < v4; ++i ) | |
8065 { | |
8066 v17 = dword_50BC10[i]; | |
8067 if ( v17 < *(int *)v16 ) | |
8068 { | |
8069 dword_50BC10[i] = *(int *)v16; | |
8070 *(int *)v16 = v17; | |
8071 } | |
8072 } | |
8073 ++v32; | |
8074 v16 += 4; | |
8075 } | |
8076 while ( v32 - 1 < v4 ); | |
8077 v5 = v24; | |
8078 if ( v4 > 0 ) | |
8079 { | |
8080 v18 = v24; | |
8081 v19 = v4; | |
8082 do | |
8083 { | |
8084 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8085 v18 += 4; | |
8086 --v19; | |
8087 } | |
8088 while ( v19 ); | |
8089 } | |
8090 } | |
8091 v20 = 0; | |
8092 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8093 { | |
8094 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8095 if ( v21 != 4 && v21 != 5 ) | |
8096 break; | |
8097 } | |
8098 if ( v20 != v4 ) | |
8099 { | |
8100 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8101 LOBYTE(result) = result | 3; | |
8102 return result; | |
8103 } | |
8104 } | |
8105 } | |
8106 return 0; | |
8107 } | |
8108 | |
8109 //----- (0042F3D6) -------------------------------------------------------- | |
8110 void InitializeTurnBasedAnimations(void *_this) | |
8111 { | |
8112 unsigned int *v1; // edi@1 | |
8113 | |
8114 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8115 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8116 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8117 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8118 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8119 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8120 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8121 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8122 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8123 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8124 v1 = pIconIDs_Turn; | |
8125 do | |
8126 { | |
8127 pIconsFrameTable->InitializeAnimation(*v1); | |
8128 ++v1; | |
8129 } | |
8130 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8131 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8132 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8133 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8134 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8135 } | |
8136 | |
8137 //----- (0042F4DA) -------------------------------------------------------- | |
8138 signed int __cdecl sub_42F4DA() | |
8139 { | |
8140 signed int v0; // edi@1 | |
82 | 8141 Actor *v1; // esi@4 |
0 | 8142 int v2; // ebx@5 |
8143 int v3; // eax@5 | |
8144 int v4; // ebx@5 | |
8145 unsigned int v5; // ecx@5 | |
8146 int v6; // edx@6 | |
8147 unsigned int v7; // edx@8 | |
8148 unsigned int v8; // edx@10 | |
8149 __int16 v9; // ax@12 | |
8150 signed int result; // eax@20 | |
8151 int v11; // [sp+Ch] [bp-10h]@5 | |
8152 int v12; // [sp+10h] [bp-Ch]@5 | |
8153 signed int v13; // [sp+14h] [bp-8h]@3 | |
8154 | |
8155 v0 = 5120; | |
8156 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8157 v0 = 2560; | |
8158 v13 = 0; | |
8159 if ( (signed int)uNumActors <= 0 ) | |
8160 { | |
8161 LABEL_20: | |
8162 result = 0; | |
8163 } | |
8164 else | |
8165 { | |
82 | 8166 v1 = pActors; |
0 | 8167 while ( 1 ) |
8168 { | |
82 | 8169 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8170 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8171 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8172 v3 = v2; |
8173 v4 = v11; | |
8174 v5 = v12; | |
8175 if ( v3 < v11 ) | |
8176 { | |
8177 v6 = v3; | |
8178 v3 = v11; | |
8179 v4 = v6; | |
8180 } | |
8181 if ( v3 < v12 ) | |
8182 { | |
8183 v7 = v3; | |
8184 v3 = v12; | |
8185 v5 = v7; | |
8186 } | |
8187 if ( v4 < (signed int)v5 ) | |
8188 { | |
8189 v8 = v5; | |
8190 v5 = v4; | |
8191 v4 = v8; | |
8192 } | |
8193 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8194 { | |
82 | 8195 v9 = v1->uAIState; |
8196 if ( v1->uAIState != 5 ) | |
0 | 8197 { |
8198 if ( v9 != 4 | |
8199 && v9 != 11 | |
8200 && v9 != 19 | |
8201 && v9 != 17 | |
82 | 8202 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8203 break; |
8204 } | |
8205 } | |
8206 ++v13; | |
82 | 8207 ++v1; |
0 | 8208 if ( v13 >= (signed int)uNumActors ) |
8209 goto LABEL_20; | |
8210 } | |
8211 result = 1; | |
8212 } | |
8213 return result; | |
8214 } | |
8215 | |
8216 //----- (0042F7EB) -------------------------------------------------------- | |
8217 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) | |
8218 { | |
8219 unsigned int v9; // edi@1 | |
8220 signed int v10; // edx@3 | |
8221 char *v11; // ecx@4 | |
8222 unsigned __int16 v12; // ax@7 | |
8223 unsigned int v13; // edx@9 | |
8224 char *v14; // ecx@10 | |
8225 int v15; // esi@17 | |
8226 int v16; // eax@18 | |
8227 int v17; // edi@20 | |
8228 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8229 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8230 int v21; // [sp+7Ch] [bp-8h]@1 |
8231 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8232 | |
8233 v9 = uSpriteID; | |
8234 v21 = x; | |
8235 v22 = uSpriteID; | |
8236 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8237 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
|
8238 //SpriteObject::SpriteObject(&a1a); |
0 | 8239 a1a.stru_24.Reset(); |
8240 | |
8241 if ( a9 ) | |
8242 { | |
8243 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8244 v9 = v22; | |
8245 } | |
8246 v10 = 0; | |
822 | 8247 a1a.spell_skill = 0; |
8248 a1a.spell_level = 0; | |
8249 a1a.spell_id = 0; | |
0 | 8250 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8251 a1a.uType = v9; |
0 | 8252 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8253 { | |
8254 LABEL_7: | |
8255 v12 = 0; | |
8256 } | |
8257 else | |
8258 { | |
8259 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8260 while ( (short)v9 != *(short *)v11 ) | |
8261 { | |
8262 ++v10; | |
8263 v11 += 56; | |
8264 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8265 goto LABEL_7; | |
8266 } | |
8267 v12 = v10; | |
8268 } | |
8269 a1a.uObjectDescID = v12; | |
8270 a1a.vPosition.z = z; | |
8271 a1a.vPosition.x = v21; | |
8272 a1a.vPosition.y = y; | |
8273 a1a.uSoundID = 0; | |
8274 a1a.uAttributes = attributes; | |
8275 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8276 a1a.uSpriteFrameID = 0; | |
822 | 8277 a1a.spell_caster_pid = 0; |
823 | 8278 a1a.spell_target_pid = 0; |
0 | 8279 if ( !(a1a.uAttributes & 0x10) ) |
8280 { | |
8281 v13 = 0; | |
222 | 8282 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8283 { |
8284 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8285 while ( *(short *)v14 != v9 ) | |
8286 { | |
8287 ++v13; | |
8288 v14 += 48; | |
222 | 8289 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8290 goto LABEL_16; |
8291 } | |
8292 a1a.stru_24.uItemID = v13; | |
8293 } | |
8294 } | |
8295 LABEL_16: | |
8296 if ( a7 ) | |
8297 { | |
8298 v15 = count; | |
8299 if ( count > 0 ) | |
8300 { | |
8301 do | |
8302 { | |
8303 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8304 v16 = rand(); | |
8305 a1a.Create( | |
8306 (signed __int16)a1a.uFacing, | |
8307 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8308 a4, | |
8309 0); | |
8310 --v15; | |
8311 } | |
8312 while ( v15 ); | |
8313 } | |
8314 } | |
8315 else | |
8316 { | |
8317 v17 = count; | |
8318 v18 = stru_5C6E00->uIntegerHalfPi; | |
8319 a1a.uFacing = 0; | |
8320 if ( count > 0 ) | |
8321 { | |
8322 do | |
8323 { | |
8324 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8325 --v17; | |
8326 } | |
8327 while ( v17 ); | |
8328 } | |
8329 } | |
8330 return 1; | |
8331 } | |
8332 | |
8333 //----- (0042F960) -------------------------------------------------------- | |
8334 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8335 { | |
8336 int v3; // ebx@1 | |
8337 int v4; // edi@1 | |
8338 signed int v5; // edx@1 | |
8339 char *v6; // ecx@2 | |
8340 unsigned __int16 v7; // ax@5 | |
8341 signed int v8; // eax@6 | |
8342 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8343 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8344 |
8345 v3 = x; | |
8346 v4 = y; | |
8347 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8348 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
|
8349 //SpriteObject::SpriteObject(&a1); |
0 | 8350 a1.stru_24.Reset(); |
8351 | |
8352 v5 = 0; | |
822 | 8353 a1.spell_skill = 0; |
8354 a1.spell_level = 0; | |
8355 a1.spell_id = 0; | |
0 | 8356 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8357 a1.uType = 800; |
0 | 8358 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8359 { | |
8360 LABEL_5: | |
8361 v7 = 0; | |
8362 } | |
8363 else | |
8364 { | |
8365 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8366 while ( *(short *)v6 != 800 ) | |
8367 { | |
8368 ++v5; | |
8369 v6 += 56; | |
8370 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8371 goto LABEL_5; | |
8372 } | |
8373 v7 = v5; | |
8374 } | |
8375 a1.uObjectDescID = v7; | |
8376 a1.vPosition.x = v3; | |
8377 a1.vPosition.y = v4; | |
8378 a1.vPosition.z = z; | |
8379 a1.uSoundID = 0; | |
8380 a1.uAttributes = 0; | |
8381 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8382 a1.uSpriteFrameID = 0; | |
822 | 8383 a1.spell_caster_pid = 0; |
823 | 8384 a1.spell_target_pid = 0; |
0 | 8385 v8 = a1.Create(0, 0, 0, 0); |
8386 if ( v8 != -1 ) | |
8387 { | |
8388 v9 = 8 * v8; | |
8389 LOBYTE(v9) = v9 | 2; | |
8390 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8391 } | |
8392 } | |
8393 | |
810 | 8394 |
0 | 8395 |
8396 //----- (0042FA66) -------------------------------------------------------- | |
8397 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8398 { | |
8399 int v6; // edi@1 | |
8400 int v7; // esi@1 | |
8401 char *v8; // ecx@2 | |
8402 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8403 //int v10; // eax@10 |
0 | 8404 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8405 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8406 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8407 int v14; // [sp+7Ch] [bp-4h]@1 |
8408 | |
8409 v6 = a1; | |
8410 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8411 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
|
8412 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8413 a1a.uType = 600; |
0 | 8414 a1a.stru_24.Reset(); |
8415 | |
822 | 8416 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8417 a1a.spell_level = 8; | |
8418 a1a.spell_skill = 3; | |
0 | 8419 v14 = 0; |
8420 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8421 { | |
8422 LABEL_5: | |
8423 v9 = 0; | |
8424 } | |
8425 else | |
8426 { | |
8427 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8428 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8429 { |
8430 ++v14; | |
8431 v8 += 56; | |
8432 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8433 goto LABEL_5; | |
8434 } | |
8435 v9 = v14; | |
8436 } | |
8437 a1a.uObjectDescID = v9; | |
8438 a1a.vPosition.x = v6; | |
8439 a1a.vPosition.y = v7; | |
8440 a1a.vPosition.z = a3; | |
8441 a1a.uAttributes = 0; | |
8442 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8443 a1a.uSpriteFrameID = 0; | |
823 | 8444 a1a.spell_target_pid = 0; |
0 | 8445 a1a.field_60_distance_related_prolly_lod = 0; |
8446 a1a.uFacing = 0; | |
8447 a1a.uSoundID = 0; | |
8448 if ( a6 >= 1 || a6 <= 4 ) | |
8449 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8450 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8451 } |
8452 else | |
8453 { | |
822 | 8454 a1a.spell_caster_pid = 0; |
0 | 8455 } |
8456 result = a1a.Create(0, 0, 0, 0); | |
8457 if ( result != -1 ) | |
8458 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8459 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8460 a5, |
8461 SLOWORD(a1a.vPosition.x), | |
8462 SLOWORD(a1a.vPosition.y), | |
8463 SLOWORD(a1a.vPosition.z), | |
8464 0, | |
8465 0); | |
8466 } | |
8467 return result; | |
8468 } | |
8469 | |
8470 //----- (0042FB5C) -------------------------------------------------------- | |
8471 bool __fastcall sub_42FB5C(signed int a1) | |
8472 { | |
8473 int v1; // ecx@3 | |
8474 int v2; // ecx@4 | |
8475 int v3; // ecx@5 | |
8476 int v4; // ecx@6 | |
8477 int v5; // ecx@7 | |
8478 int v6; // ecx@8 | |
8479 char v7; // zf@9 | |
8480 | |
8481 if ( a1 > 39 ) | |
8482 { | |
8483 if ( a1 > 77 ) | |
8484 { | |
8485 if ( a1 == 80 ) | |
8486 return 0; | |
8487 if ( a1 > 84 ) | |
8488 { | |
8489 if ( a1 <= 86 ) | |
8490 return 0; | |
8491 v7 = a1 == 95; | |
8492 goto LABEL_20; | |
8493 } | |
8494 } | |
8495 else | |
8496 { | |
8497 if ( a1 == 77 ) | |
8498 return 0; | |
8499 if ( a1 >= 46 ) | |
8500 { | |
8501 if ( a1 <= 47 || a1 == 51 ) | |
8502 return 0; | |
8503 v7 = a1 == 73; | |
8504 goto LABEL_20; | |
8505 } | |
8506 } | |
8507 return 1; | |
8508 } | |
8509 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8510 return 1; | |
8511 v2 = v1 - 3; | |
8512 if ( !v2 ) | |
8513 return 0; | |
8514 v3 = v2 - 1; | |
8515 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8516 return 1; | |
8517 v5 = v4 - 8; | |
8518 if ( !v5 ) | |
8519 return 0; | |
8520 v6 = v5 - 1; | |
8521 if ( !v6 ) | |
8522 return 1; | |
8523 v7 = v6 == 20; | |
8524 LABEL_20: | |
8525 if ( !v7 ) | |
8526 return 1; | |
8527 return 0; | |
8528 } | |
8529 | |
8530 //----- (0042FBDD) -------------------------------------------------------- | |
8531 void __cdecl sub_42FBDD() | |
8532 { | |
388 | 8533 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8534 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8535 pRenderer->Present(); | |
8536 } | |
8537 | |
8538 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8539 void __cdecl CloseWindowBackground() |
0 | 8540 { |
388 | 8541 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8542 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8543 pRenderer->Present(); | |
8544 } | |
8545 | |
8546 //----- (0042FC4E) -------------------------------------------------------- | |
8547 void __cdecl ProcessInputActions() | |
8548 { | |
8549 ActionQueue *pActionQueue; // esi@7 | |
832 | 8550 //Keyboard *v3; // ecx@8 |
0 | 8551 char v4; // al@9 |
8552 ActionQueue *v5; // ecx@19 | |
8553 Player *v6; // ecx@86 | |
8554 Player *v7; // esi@100 | |
8555 char v8; // bl@100 | |
8556 unsigned __int16 v9; // ax@102 | |
8557 int v10; // eax@103 | |
8558 unsigned int v11; // eax@127 | |
8559 signed int v12; // esi@157 | |
8560 Keyboard *v13; // ecx@158 | |
8561 char v14; // al@159 | |
8562 unsigned int v15; // eax@168 | |
8563 void *v16; // esi@177 | |
8564 int v17; // [sp-14h] [bp-1Ch]@8 | |
8565 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8566 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 | |
271 | 8567 //__int16 v20; // [sp-14h] [bp-1Ch]@60 |
0 | 8568 int v21; // [sp-14h] [bp-1Ch]@68 |
8569 int v22; // [sp-Ch] [bp-14h]@158 | |
8570 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8571 int v24; // [sp+4h] [bp-4h]@87 | |
8572 | |
8573 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8574 auto pKeyboard = pGame->pKeyboardInstance; | |
8575 if (!bAlwaysRun) | |
8576 { | |
8577 if (pKeyboard->IsShiftHeld()) | |
8578 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8579 else | |
8580 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8581 } | |
8582 else | |
8583 { | |
8584 if (pKeyboard->IsShiftHeld()) | |
8585 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8586 else | |
8587 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8588 } | |
8589 | |
140 | 8590 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
486 | 8591 //LABEL_6: |
0 | 8592 if ( !pEventTimer->bPaused ) |
8593 { | |
8594 inputAction = (InputAction)0; | |
8595 pActionQueue = pPartyActionQueue; | |
8596 while ( 1 ) | |
8597 { | |
8598 v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; | |
8599 if ( pKeyActionMap->pToggleTypes[inputAction] ) | |
832 | 8600 v4 = pKeyboard->WasKeyPressed(v17); |
0 | 8601 else |
832 | 8602 v4 = pKeyboard->IsKeyBeingHeld(v17); |
0 | 8603 if ( v4 ) |
8604 { | |
8605 switch ( inputAction ) | |
8606 { | |
8607 case INPUT_MoveForward: | |
271 | 8608 if (pCurrentScreen != SCREEN_GAME) |
0 | 8609 break; |
8610 if (!pParty->bTurnBasedModeOn) | |
163 | 8611 //goto _do_move_forward; |
0 | 8612 { |
8613 v5 = pActionQueue; | |
140 | 8614 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8615 partyAction = PARTY_RunForward; |
8616 else | |
8617 partyAction = PARTY_WalkForward; | |
163 | 8618 //goto _add_action_and_continue; |
8619 v5->Add(partyAction); | |
8620 break; | |
8621 } | |
8622 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8623 { | |
8624 pTurnEngine->uActionPointsLeft -= 26; | |
8625 //_do_move_forward: | |
8626 v5 = pActionQueue; | |
8627 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8628 partyAction = PARTY_RunForward; | |
8629 else | |
8630 partyAction = PARTY_WalkForward; | |
8631 //goto _add_action_and_continue; | |
8632 v5->Add(partyAction); | |
8633 break; | |
0 | 8634 } |
8635 break; | |
8636 case INPUT_MoveBackwards: | |
17 | 8637 //__debugbreak(); |
271 | 8638 if (pCurrentScreen != SCREEN_GAME) |
0 | 8639 break; |
8640 if (!pParty->bTurnBasedModeOn) | |
17 | 8641 //goto _do_move_backwards; |
8642 { | |
8643 v5 = pActionQueue; | |
8644 if ( pParty->uFlags2 & 2 ) | |
8645 partyAction = PARTY_RunBackward; | |
8646 else | |
8647 partyAction = PARTY_WalkBackward; | |
163 | 8648 //goto _add_action_and_continue; |
8649 v5->Add(partyAction); | |
8650 break; | |
17 | 8651 } |
0 | 8652 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8653 { | |
8654 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8655 //_do_move_backwards: |
0 | 8656 v5 = pActionQueue; |
8657 if ( pParty->uFlags2 & 2 ) | |
8658 partyAction = PARTY_RunBackward; | |
8659 else | |
8660 partyAction = PARTY_WalkBackward; | |
163 | 8661 //goto _add_action_and_continue; |
8662 v5->Add(partyAction); | |
8663 break; | |
0 | 8664 } |
8665 break; | |
8666 case INPUT_StrafeLeft: | |
17 | 8667 //__debugbreak(); |
271 | 8668 if (pCurrentScreen != SCREEN_GAME) |
0 | 8669 break; |
8670 if (!pParty->bTurnBasedModeOn) | |
17 | 8671 //goto _do_strafe_left; |
8672 { | |
8673 partyAction = PARTY_StrafeLeft; | |
163 | 8674 //goto _add_action_and_continue_; |
8675 v5 = pActionQueue; | |
8676 v5->Add(partyAction); | |
8677 break; | |
17 | 8678 } |
0 | 8679 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8680 break; | |
8681 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8682 //_do_strafe_left: |
0 | 8683 partyAction = PARTY_StrafeLeft; |
163 | 8684 //goto _add_action_and_continue_; |
8685 v5 = pActionQueue; | |
8686 v5->Add(partyAction); | |
8687 break; | |
0 | 8688 case INPUT_StrafeRight: |
17 | 8689 //__debugbreak(); |
271 | 8690 if (pCurrentScreen != SCREEN_GAME) |
0 | 8691 break; |
8692 if (!pParty->bTurnBasedModeOn) | |
17 | 8693 //goto _do_strafe_right; |
8694 { | |
8695 partyAction = PARTY_StrafeRight; | |
163 | 8696 //goto _add_action_and_continue_; |
8697 v5 = pActionQueue; | |
8698 v5->Add(partyAction); | |
8699 break; | |
17 | 8700 } |
0 | 8701 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8702 break; | |
8703 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8704 //_do_strafe_right: |
0 | 8705 partyAction = PARTY_StrafeRight; |
163 | 8706 //goto _add_action_and_continue_; |
8707 v5 = pActionQueue; | |
8708 v5->Add(partyAction); | |
8709 break; | |
0 | 8710 case INPUT_TurnLeft: |
271 | 8711 if (pCurrentScreen != SCREEN_GAME) |
0 | 8712 break; |
8713 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8714 { | |
8715 if (pParty->bTurnBasedModeOn) | |
8716 { | |
8717 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8718 break; | |
8719 pTurnEngine->uActionPointsLeft -= 26; | |
8720 } | |
8721 partyAction_ = PARTY_StrafeLeft; | |
8722 } | |
8723 else | |
8724 { | |
8725 if ( pParty->uFlags2 & 2 ) | |
8726 partyAction_ = PARTY_FastTurnLeft; | |
8727 else | |
8728 partyAction_ = PARTY_TurnLeft; | |
8729 } | |
8730 pActionQueue->Add(partyAction_); | |
8731 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8732 { | |
271 | 8733 pWeather->OnPlayerTurn(10); |
0 | 8734 } |
8735 break; | |
8736 case INPUT_TurnRight: | |
271 | 8737 if (pCurrentScreen != SCREEN_GAME) |
0 | 8738 break; |
8739 if ( GetAsyncKeyState(17) ) // strafing | |
8740 { | |
8741 if (pParty->bTurnBasedModeOn) | |
8742 { | |
8743 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8744 break; | |
8745 pTurnEngine->uActionPointsLeft -= 26; | |
8746 } | |
271 | 8747 v21 = PARTY_StrafeRight; |
0 | 8748 } |
8749 else | |
8750 { | |
8751 if ( pParty->uFlags2 & 2 ) | |
271 | 8752 v21 = PARTY_FastTurnRight; |
0 | 8753 else |
271 | 8754 v21 = PARTY_TurnRight; |
0 | 8755 } |
8756 pActionQueue->Add((PartyAction)v21); | |
8757 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8758 { | |
271 | 8759 pWeather->OnPlayerTurn(-10); |
0 | 8760 } |
8761 break; | |
8762 case INPUT_Jump: | |
17 | 8763 //__debugbreak(); |
271 | 8764 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8765 break; |
8766 partyAction = (PartyAction)12; | |
163 | 8767 //goto _add_action_and_continue_; |
8768 v5 = pActionQueue; | |
8769 v5->Add(partyAction); | |
8770 break; | |
0 | 8771 case INPUT_Yell: |
187 | 8772 if (!pCurrentScreen && uActiveCharacter) |
0 | 8773 { |
8774 pParty->Yell(); | |
187 | 8775 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8776 } |
187 | 8777 break; |
0 | 8778 case INPUT_Pass: |
17 | 8779 //__debugbreak(); |
0 | 8780 if ( pCurrentScreen ) |
8781 break; | |
8782 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8783 //goto LABEL_118; |
8784 { | |
8785 pTurnEngine->field_18 |= 8u; | |
8786 break; | |
8787 } | |
0 | 8788 if ( uActiveCharacter ) |
8789 { | |
8790 v6 = pPlayers[uActiveCharacter]; | |
8791 if ( !v6->uTimeToRecovery ) | |
8792 { | |
816 | 8793 v24 = v6->GetAttackRecoveryTime(false); |
0 | 8794 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8795 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 8796 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 8797 pTurnEngine->_40471C(); |
8798 } | |
8799 } | |
8800 break; | |
8801 case INPUT_Combat: | |
17 | 8802 //__debugbreak(); |
271 | 8803 if (pCurrentScreen == SCREEN_GAME) |
0 | 8804 { |
8805 if (pParty->bTurnBasedModeOn) | |
8806 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8807 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8808 { |
8809 pParty->bTurnBasedModeOn = 0; | |
8810 pTurnEngine->End(true); | |
8811 } | |
8812 } | |
8813 else | |
8814 { | |
8815 pTurnEngine->Start(); | |
8816 pParty->bTurnBasedModeOn = true; | |
8817 } | |
8818 } | |
8819 break; | |
8820 case INPUT_CastReady: | |
17 | 8821 //__debugbreak(); |
271 | 8822 if (pCurrentScreen != SCREEN_GAME) |
0 | 8823 break; |
8824 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8825 //goto LABEL_118; |
8826 { | |
8827 pTurnEngine->field_18 |= 8u; | |
8828 break; | |
8829 } | |
0 | 8830 if ( !uActiveCharacter ) |
8831 break; | |
8832 v7 = pPlayers[uActiveCharacter]; | |
8833 v8 = v7->uQuickSpell; | |
8834 if ( !v8 | |
8835 || bUnderwater | |
8836 || ((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)), | |
8837 v10 > v7->sMana) ) | |
8838 { | |
8839 pActionQueue = pPartyActionQueue; | |
8840 LABEL_120: | |
437 | 8841 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8842 break; | |
8843 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8844 { |
271 | 8845 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; |
163 | 8846 //goto _send_message; |
8847 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8848 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8849 ++pMessageQueue_50CBD0->uNumMessages; | |
8850 break; | |
437 | 8851 }*/ |
0 | 8852 } |
8853 else | |
8854 { | |
8855 pActionQueue = pPartyActionQueue; | |
8856 if ( dword_50C9E8 < 40 ) | |
8857 { | |
8858 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8859 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8860 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8861 ++dword_50C9E8; |
8862 } | |
8863 } | |
8864 break; | |
8865 case INPUT_Attack: | |
17 | 8866 //__debugbreak(); |
271 | 8867 if (pCurrentScreen != SCREEN_GAME) |
0 | 8868 break; |
8869 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) | |
8870 goto LABEL_120; | |
17 | 8871 //LABEL_118: |
0 | 8872 pTurnEngine->field_18 |= 8u; |
8873 break; | |
8874 case INPUT_EventTrigger: | |
271 | 8875 if (pCurrentScreen == SCREEN_GAME) |
0 | 8876 { |
437 | 8877 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8878 break; |
271 | 8879 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; |
163 | 8880 //goto _send_message; |
8881 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8882 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8883 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8884 break;*/ |
8885 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
163 | 8886 break; |
0 | 8887 } |
151 | 8888 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8889 { |
8890 v11 = pMessageQueue_50CBD0->uNumMessages; | |
8891 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8892 { | |
437 | 8893 v11 = 0; |
8894 pMessageQueue_50CBD0->uNumMessages = 0; | |
0 | 8895 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8896 { | |
8897 v11 = 1; | |
8898 pMessageQueue_50CBD0->uNumMessages = 1; | |
163 | 8899 //LABEL_132: |
271 | 8900 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8901 //_send_message: |
0 | 8902 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8903 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8904 ++pMessageQueue_50CBD0->uNumMessages; | |
8905 break; | |
8906 } | |
437 | 8907 break; |
0 | 8908 } |
437 | 8909 /*if ( (signed int)v11 < 40 ) |
163 | 8910 //goto LABEL_132; |
8911 { | |
271 | 8912 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8913 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8914 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8915 ++pMessageQueue_50CBD0->uNumMessages; | |
8916 break; | |
437 | 8917 }*/ |
8918 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 8919 } |
8920 break; | |
8921 case INPUT_CharCycle: | |
17 | 8922 //__debugbreak(); |
151 | 8923 if ( pCurrentScreen == SCREEN_SPELL_BOOK |
0 | 8924 || dword_50C9E8 >= 40 ) |
8925 break; | |
8926 dword_50C9EC[3 * dword_50C9E8] = 176; | |
163 | 8927 //goto LABEL_155; |
437 | 8928 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8929 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8930 ++dword_50C9E8; |
8931 break; | |
0 | 8932 case INPUT_LookUp: |
17 | 8933 //__debugbreak(); |
0 | 8934 if ( pEventTimer->bPaused ) |
8935 break; | |
8936 partyAction = (PartyAction)7; | |
163 | 8937 //goto _add_action_and_continue_; |
8938 v5 = pActionQueue; | |
8939 v5->Add(partyAction); | |
8940 break; | |
0 | 8941 case INPUT_CenterView: |
17 | 8942 //__debugbreak(); |
0 | 8943 if ( pEventTimer->bPaused ) |
8944 break; | |
8945 partyAction = (PartyAction)9; | |
163 | 8946 //goto _add_action_and_continue_; |
8947 v5 = pActionQueue; | |
8948 v5->Add(partyAction); | |
8949 break; | |
0 | 8950 case INPUT_LookDown: |
17 | 8951 //__debugbreak(); |
0 | 8952 if ( pEventTimer->bPaused ) |
8953 break; | |
8954 partyAction = (PartyAction)8; | |
163 | 8955 //goto _add_action_and_continue_; |
8956 v5 = pActionQueue; | |
8957 v5->Add(partyAction); | |
8958 break; | |
0 | 8959 case INPUT_FlyUp: |
17 | 8960 //__debugbreak(); |
0 | 8961 if ( pCurrentScreen |
8962 || pEventTimer->bPaused ) | |
8963 break; | |
8964 partyAction = (PartyAction)13; | |
163 | 8965 //goto _add_action_and_continue_; |
8966 v5 = pActionQueue; | |
8967 v5->Add(partyAction); | |
8968 break; | |
0 | 8969 case INPUT_Land: |
17 | 8970 //__debugbreak(); |
0 | 8971 if ( pCurrentScreen |
8972 || pEventTimer->bPaused ) | |
8973 break; | |
8974 partyAction = (PartyAction)15; | |
163 | 8975 //goto _add_action_and_continue_; |
8976 v5 = pActionQueue; | |
8977 v5->Add(partyAction); | |
8978 break; | |
0 | 8979 case INPUT_FlyDown: |
17 | 8980 //__debugbreak(); |
0 | 8981 if ( !pCurrentScreen |
8982 && !pEventTimer->bPaused ) | |
8983 { | |
8984 partyAction = (PartyAction)14; | |
163 | 8985 //_add_action_and_continue_: |
0 | 8986 v5 = pActionQueue; |
163 | 8987 //_add_action_and_continue: |
0 | 8988 v5->Add(partyAction); |
8989 } | |
8990 break; | |
8991 case INPUT_ZoomIn: | |
17 | 8992 //__debugbreak(); |
0 | 8993 if ( dword_50C9E8 >= 40 ) |
8994 break; | |
8995 dword_50C9EC[3 * dword_50C9E8] = 367; | |
163 | 8996 //goto LABEL_155; |
437 | 8997 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8998 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8999 ++dword_50C9E8; |
9000 break; | |
0 | 9001 case INPUT_ZoomOut: |
17 | 9002 //__debugbreak(); |
0 | 9003 if ( dword_50C9E8 < 40 ) |
9004 { | |
9005 dword_50C9EC[3 * dword_50C9E8] = 368; | |
163 | 9006 //LABEL_155: |
437 | 9007 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
9008 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 9009 ++dword_50C9E8; |
9010 } | |
9011 break; | |
9012 case INPUT_AlwaysRun: | |
9013 bAlwaysRun = bAlwaysRun == 0; | |
9014 break; | |
17 | 9015 default: |
9016 //__debugbreak(); | |
9017 break; | |
0 | 9018 } |
9019 } | |
9020 inputAction = (InputAction)((int)inputAction + 1); | |
9021 if ( (signed int)inputAction >= 30 ) | |
9022 goto LABEL_176; | |
9023 } | |
9024 } | |
9025 v12 = 0; | |
9026 do | |
9027 { | |
9028 v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; | |
9029 v13 = pGame->pKeyboardInstance; | |
9030 if ( pKeyActionMap->pToggleTypes[v12] ) | |
9031 v14 = v13->WasKeyPressed(v22); | |
9032 else | |
9033 v14 = v13->IsKeyBeingHeld(v22); | |
9034 if ( v14 && v12 == 9 ) | |
9035 { | |
9036 if ( !pCurrentScreen ) | |
9037 { | |
437 | 9038 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9039 goto LABEL_175; |
9040 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; | |
17 | 9041 //goto LABEL_174; |
9042 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9043 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9044 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9045 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
17 | 9046 goto LABEL_175; |
0 | 9047 } |
151 | 9048 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE |
9049 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
0 | 9050 { |
9051 v15 = pMessageQueue_50CBD0->uNumMessages; | |
9052 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9053 { | |
9054 v15 = 0; | |
9055 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
9056 { | |
9057 v15 = 1; | |
437 | 9058 pMessageQueue_50CBD0->uNumMessages = 0; |
17 | 9059 //goto LABEL_173; |
437 | 9060 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; |
17 | 9061 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9062 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9063 ++pMessageQueue_50CBD0->uNumMessages; | |
9064 goto LABEL_175; | |
0 | 9065 } |
9066 pMessageQueue_50CBD0->uNumMessages = 0; | |
9067 } | |
437 | 9068 /*if ( (signed int)v15 >= 40 ) |
0 | 9069 goto LABEL_175; |
17 | 9070 //LABEL_173: |
0 | 9071 pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; |
17 | 9072 //LABEL_174: |
0 | 9073 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9074 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9075 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9076 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 9077 goto LABEL_175; |
9078 } | |
9079 } | |
9080 LABEL_175: | |
9081 ++v12; | |
9082 } | |
9083 while ( v12 < 30 ); | |
9084 LABEL_176: | |
9085 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
9086 { | |
9087 AsyncKeyboard::LeaveCriticalSection(); | |
9088 v16 = pAsyncKeyboard; | |
9089 AsyncKeyboard::EnterCriticalSection(); | |
9090 memset((char *)v16 + 521, 0, 0x100u); | |
9091 AsyncKeyboard::LeaveCriticalSection(); | |
9092 } | |
9093 } |