Mercurial > mm7
annotate mm7_6.cpp @ 930:88e15900c982
m
author | Ritor1 |
---|---|
date | Wed, 01 May 2013 15:17:33 +0600 |
parents | 5c98e66aebf7 |
children | 02984766816f |
rev | line source |
---|---|
0 | 1 #include "MM7.h" |
2 | |
3 #include "MapInfo.h" | |
4 #include "Game.h" | |
5 #include "GUIWindow.h" | |
6 #include "GUIFont.h" | |
7 #include "GUIProgressBar.h" | |
8 #include "Party.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Outdoor.h" | |
11 #include "IndoorCamera.h" | |
12 #include "Overlays.h" | |
13 #include "Monsters.h" | |
14 #include "Arcomage.h" | |
15 #include "LOD.h" | |
16 #include "Actor.h" | |
17 #include "Allocator.h" | |
18 #include "Events.h" | |
19 #include "Viewport.h" | |
20 #include "FrameTableInc.h" | |
21 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
22 #include "SpriteObject.h" |
0 | 23 #include "ObjectList.h" |
24 #include "Chest.h" | |
25 #include "PaletteManager.h" | |
26 #include "DecorationList.h" | |
27 #include "SaveLoad.h" | |
28 #include "stru123.h" | |
29 #include "Time.h" | |
30 #include "IconFrameTable.h" | |
31 #include "Awards.h" | |
32 #include "Autonotes.h" | |
33 #include "stru160.h" | |
34 #include "stru279.h" | |
35 #include "TurnEngine.h" | |
924 | 36 #include "CastSpellInfo.h" |
0 | 37 #include "Weather.h" |
38 #include "stru272.h" | |
39 #include "stru298.h" | |
189 | 40 #include "texts.h" |
0 | 41 #include "StorylineTextTable.h" |
42 #include "Events2D.h" | |
370 | 43 #include "Log.h" |
0 | 44 |
45 #include "mm7_data.h" | |
46 | |
47 | |
48 | |
49 //----- (00424EE0) -------------------------------------------------------- | |
50 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
51 { | |
52 unsigned int v1; // edx@1 | |
53 double v2; // st7@1 | |
54 signed int v3; // edi@1 | |
55 char *v4; // esi@4 | |
56 char *v5; // ecx@4 | |
57 unsigned int v6; // eax@4 | |
58 char *v7; // edx@4 | |
59 double v8; // st6@10 | |
60 double v9; // st5@10 | |
61 double v10; // st6@11 | |
62 unsigned __int8 v11; // c2@15 | |
63 unsigned __int8 v12; // c3@15 | |
64 void *v13; // edi@22 | |
65 char *v14; // eax@22 | |
66 double v15; // st6@22 | |
67 char *v16; // ecx@22 | |
68 signed int result; // eax@24 | |
69 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
70 bool v19; // [sp+Ch] [bp-28h]@6 | |
71 char *v20; // [sp+10h] [bp-24h]@4 | |
72 char *v21; // [sp+14h] [bp-20h]@4 | |
73 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
74 char *v23; // [sp+1Ch] [bp-18h]@4 | |
75 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
76 char *v25; // [sp+24h] [bp-10h]@4 | |
77 char *v26; // [sp+28h] [bp-Ch]@4 | |
78 char *v27; // [sp+2Ch] [bp-8h]@4 | |
79 char *v28; // [sp+30h] [bp-4h]@4 | |
80 | |
81 v1 = uVertexID; | |
82 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
83 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
84 v3 = 0; | |
85 v22 = 0; | |
86 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
87 v3 = 1; | |
88 if ( (signed int)(uVertexID + 1) <= 1 ) | |
89 return 0; | |
90 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
91 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
92 v6 = v1; | |
93 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 94 v26 = (char *)&array_507D30[0]._rhw; |
0 | 95 v24 = array_507D30; |
96 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
97 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
98 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
99 v27 = (char *)&array_507D30[0].v; | |
100 v28 = (char *)&array_507D30[0].u; | |
101 v7 = (char *)&array_50AC10[0].v; | |
102 v18 = v6; | |
103 do | |
104 { | |
105 v19 = v2 >= *((float *)v7 + 5); | |
106 if ( v3 != v19 ) | |
107 { | |
108 if ( v19 ) | |
109 { | |
110 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
111 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
112 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
113 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
114 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
115 } | |
116 else | |
117 { | |
118 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
119 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
120 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
121 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
122 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
123 } | |
124 *(float *)v27 = v9; | |
125 *(float *)v25 = v2; | |
126 *(float *)v26 = 1.0 / v2; | |
127 if ( v3 ) | |
128 { | |
129 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
130 { | |
131 v11 = 0; | |
132 v12 = *(float *)v4 == *((float *)v7 - 5); | |
133 goto LABEL_19; | |
134 } | |
135 } | |
136 else | |
137 { | |
138 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
139 { | |
140 v11 = 0; | |
141 v12 = *(float *)v4 == *((float *)v7 + 7); | |
142 LABEL_19: | |
143 if ( v12 | v11 ) | |
144 goto LABEL_21; | |
145 goto LABEL_20; | |
146 } | |
147 } | |
148 LABEL_20: | |
149 v26 += 48; | |
150 ++v24; | |
151 v25 += 48; | |
152 v27 += 48; | |
153 v28 += 48; | |
154 v5 += 48; | |
155 v4 += 48; | |
156 ++v22; | |
157 v23 += 48; | |
158 v21 = v5; | |
159 v20 = v4; | |
160 } | |
161 LABEL_21: | |
162 if ( v19 ) | |
163 { | |
164 v13 = v24; | |
165 v14 = v26; | |
166 v21 += 48; | |
167 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
168 v20 += 48; | |
169 ++v22; | |
170 v28 += 48; | |
171 v27 += 48; | |
172 v25 += 48; | |
173 ++v24; | |
174 v26 += 48; | |
175 memcpy(v13, v7 + 8, 0x30u); | |
176 v16 = v23; | |
177 v23 += 48; | |
178 v4 = v20; | |
179 *(float *)v14 = v15; | |
180 *(int *)v16 = *((int *)v7 + 13); | |
181 v5 = v21; | |
182 } | |
183 v3 = v19; | |
184 v7 += 48; | |
185 --v18; | |
186 } | |
187 while ( v18 ); | |
188 result = v22; | |
189 if ( v22 < 3 ) | |
190 return 0; | |
191 return result; | |
192 } | |
193 | |
194 //----- (004250FE) -------------------------------------------------------- | |
195 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
196 { | |
197 unsigned int v1; // edx@1 | |
198 char *v2; // edi@5 | |
199 char *v3; // esi@5 | |
200 char *v4; // ecx@5 | |
201 int v5; // ebx@6 | |
202 double v6; // st6@11 | |
203 double v7; // st5@11 | |
204 double v8; // st6@12 | |
205 unsigned __int8 v9; // c2@16 | |
206 unsigned __int8 v10; // c3@16 | |
207 void *v11; // edi@23 | |
208 double v12; // st6@23 | |
209 char *v13; // ecx@23 | |
210 char v14; // zf@24 | |
211 signed int result; // eax@25 | |
212 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
213 bool v17; // [sp+Ch] [bp-24h]@2 | |
214 bool v18; // [sp+10h] [bp-20h]@7 | |
215 char *v19; // [sp+14h] [bp-1Ch]@5 | |
216 char *v20; // [sp+18h] [bp-18h]@5 | |
217 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
218 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
219 char *v23; // [sp+24h] [bp-Ch]@5 | |
220 char *v24; // [sp+28h] [bp-8h]@5 | |
221 char *v25; // [sp+2Ch] [bp-4h]@5 | |
222 | |
223 v1 = uVertexID; | |
224 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
225 v21 = 0; | |
226 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
227 if ( (signed int)(uVertexID + 1) <= 1 ) | |
228 return 0; | |
229 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
230 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 231 v24 = (char *)&array_507D30[0]._rhw; |
0 | 232 v22 = array_507D30; |
233 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
234 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
235 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
236 v25 = (char *)&array_507D30[0].flt_2C; | |
237 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
238 v16 = v1; | |
239 do | |
240 { | |
241 v5 = (int)(v4 + 48); | |
242 v18 = *((float *)v4 + 12) >= 8.0; | |
243 if ( v17 != v18 ) | |
244 { | |
245 if ( v18 ) | |
246 { | |
247 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
248 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
249 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
250 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
251 } | |
252 else | |
253 { | |
254 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
255 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
256 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
257 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
258 } | |
259 *(float *)v25 = v7; | |
260 *(float *)v23 = 8.0; | |
261 *(int *)v24 = 0x3E000000u; | |
262 if ( v17 ) | |
263 { | |
264 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
265 { | |
266 v9 = 0; | |
267 v10 = *(float *)v2 == *((float *)v4 + 2); | |
268 goto LABEL_20; | |
269 } | |
270 } | |
271 else | |
272 { | |
273 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
274 { | |
275 v9 = 0; | |
276 v10 = *(float *)v2 == *((float *)v4 + 14); | |
277 LABEL_20: | |
278 if ( v10 | v9 ) | |
279 goto LABEL_22; | |
280 goto LABEL_21; | |
281 } | |
282 } | |
283 LABEL_21: | |
284 ++v22; | |
285 v23 += 48; | |
286 v25 += 48; | |
287 v3 += 48; | |
288 v2 += 48; | |
289 ++v21; | |
290 v24 += 48; | |
291 v20 = v3; | |
292 v19 = v2; | |
293 } | |
294 LABEL_22: | |
295 if ( v18 ) | |
296 { | |
297 v11 = v22; | |
298 v20 += 48; | |
299 v19 += 48; | |
300 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
301 ++v21; | |
302 v25 += 48; | |
303 v23 += 48; | |
304 ++v22; | |
305 memcpy(v11, v4 + 36, 0x30u); | |
306 v13 = v24; | |
307 v24 += 48; | |
308 v3 = v20; | |
309 v2 = v19; | |
310 *(float *)v13 = v12; | |
311 } | |
312 v14 = v16-- == 1; | |
313 v17 = v18; | |
314 v4 = (char *)v5; | |
315 } | |
316 while ( !v14 ); | |
317 result = v21; | |
318 if ( v21 < 3 ) | |
319 return 0; | |
320 return result; | |
321 } | |
322 | |
323 //----- (004252E8) -------------------------------------------------------- | |
324 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
325 { | |
326 unsigned int v1; // edx@1 | |
327 double v2; // st7@1 | |
328 char *v3; // edi@5 | |
329 char *v4; // esi@5 | |
330 char *v5; // ecx@5 | |
331 int v6; // ebx@6 | |
332 double v7; // st6@11 | |
333 double v8; // st5@11 | |
334 double v9; // st6@12 | |
335 unsigned __int8 v10; // c2@16 | |
336 unsigned __int8 v11; // c3@16 | |
337 void *v12; // edi@23 | |
338 double v13; // st6@23 | |
339 char *v14; // ecx@23 | |
340 char v15; // zf@24 | |
341 signed int result; // eax@25 | |
342 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
343 bool v18; // [sp+Ch] [bp-24h]@2 | |
344 bool v19; // [sp+10h] [bp-20h]@7 | |
345 char *v20; // [sp+14h] [bp-1Ch]@5 | |
346 char *v21; // [sp+18h] [bp-18h]@5 | |
347 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
348 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
349 char *v24; // [sp+24h] [bp-Ch]@5 | |
350 char *v25; // [sp+28h] [bp-8h]@5 | |
351 char *v26; // [sp+2Ch] [bp-4h]@5 | |
352 | |
353 v1 = uVertexID; | |
354 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
355 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
356 v22 = 0; | |
357 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
358 if ( (signed int)(uVertexID + 1) <= 1 ) | |
359 return 0; | |
360 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
361 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 362 v25 = (char *)&array_507D30[0]._rhw; |
0 | 363 v23 = array_507D30; |
364 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
365 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
366 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
367 v26 = (char *)&array_507D30[0].flt_2C; | |
368 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
369 v17 = v1; | |
370 do | |
371 { | |
372 v6 = (int)(v5 + 48); | |
373 v19 = v2 >= *((float *)v5 + 12); | |
374 if ( v18 != v19 ) | |
375 { | |
376 if ( v19 ) | |
377 { | |
378 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
379 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
380 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
381 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
382 } | |
383 else | |
384 { | |
385 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
386 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
387 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
388 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
389 } | |
390 *(float *)v26 = v8; | |
391 *(float *)v24 = v2; | |
392 *(float *)v25 = 1.0 / v2; | |
393 if ( v18 ) | |
394 { | |
395 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
396 { | |
397 v10 = 0; | |
398 v11 = *(float *)v3 == *((float *)v5 + 2); | |
399 goto LABEL_20; | |
400 } | |
401 } | |
402 else | |
403 { | |
404 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
405 { | |
406 v10 = 0; | |
407 v11 = *(float *)v3 == *((float *)v5 + 14); | |
408 LABEL_20: | |
409 if ( v11 | v10 ) | |
410 goto LABEL_22; | |
411 goto LABEL_21; | |
412 } | |
413 } | |
414 LABEL_21: | |
415 ++v23; | |
416 v24 += 48; | |
417 v26 += 48; | |
418 v4 += 48; | |
419 v3 += 48; | |
420 ++v22; | |
421 v25 += 48; | |
422 v21 = v4; | |
423 v20 = v3; | |
424 } | |
425 LABEL_22: | |
426 if ( v19 ) | |
427 { | |
428 v12 = v23; | |
429 v21 += 48; | |
430 v20 += 48; | |
431 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
432 ++v22; | |
433 v26 += 48; | |
434 v24 += 48; | |
435 ++v23; | |
436 memcpy(v12, v5 + 36, 0x30u); | |
437 v14 = v25; | |
438 v25 += 48; | |
439 v4 = v21; | |
440 v3 = v20; | |
441 *(float *)v14 = v13; | |
442 } | |
443 v15 = v17-- == 1; | |
444 v18 = v19; | |
445 v5 = (char *)v6; | |
446 } | |
447 while ( !v15 ); | |
448 result = v22; | |
449 if ( v22 < 3 ) | |
450 return 0; | |
451 return result; | |
452 } | |
453 | |
454 //----- (004254D2) -------------------------------------------------------- | |
455 int __fastcall sr_4254D2(signed int a1) | |
456 { | |
457 signed int v1; // ebx@2 | |
458 int v2; // ecx@2 | |
459 int result; // eax@11 | |
460 double v4; // ST74_8@12 | |
461 bool v5; // edi@12 | |
462 char *v6; // esi@13 | |
463 char *v7; // ebx@13 | |
464 double v8; // st7@15 | |
465 double v9; // st7@16 | |
466 double v10; // st6@16 | |
467 double v11; // st7@17 | |
468 float v12; // eax@18 | |
469 double v13; // ST4C_8@19 | |
470 double v14; // ST10_8@19 | |
471 double v15; // ST28_8@20 | |
472 double v16; // ST34_8@20 | |
473 char v17; // zf@20 | |
474 double v18; // ST18_8@21 | |
475 double v19; // ST3C_8@21 | |
476 double v20; // ST44_8@22 | |
477 double v21; // ST54_8@22 | |
478 void *v22; // edi@26 | |
479 double v23; // ST54_8@29 | |
480 bool v24; // esi@29 | |
481 char *v25; // edi@30 | |
482 char *v26; // ebx@30 | |
483 bool v27; // ecx@32 | |
484 double v28; // st7@33 | |
485 double v29; // st7@34 | |
486 double v30; // st6@34 | |
487 double v31; // st7@35 | |
488 double v32; // ST44_8@37 | |
489 double v33; // ST3C_8@37 | |
490 double v34; // ST18_8@38 | |
491 double v35; // ST34_8@38 | |
492 char v36; // zf@38 | |
493 double v37; // ST28_8@39 | |
494 double v38; // ST10_8@39 | |
495 double v39; // ST20_8@40 | |
496 double v40; // ST5C_8@40 | |
497 void *v41; // edi@44 | |
498 double v42; // ST5C_8@47 | |
499 bool v43; // edi@47 | |
500 char *v44; // esi@48 | |
501 char *v45; // ebx@48 | |
502 bool v46; // ecx@49 | |
503 double v47; // st6@50 | |
504 double v48; // st6@51 | |
505 double v49; // st5@51 | |
506 double v50; // st6@52 | |
507 double v51; // ST20_8@54 | |
508 double v52; // ST54_8@54 | |
509 double v53; // ST44_8@55 | |
510 double v54; // ST3C_8@55 | |
511 char v55; // zf@55 | |
512 double v56; // ST18_8@56 | |
513 double v57; // ST34_8@56 | |
514 double v58; // ST28_8@57 | |
515 double v59; // ST10_8@57 | |
516 void *v60; // edi@61 | |
517 double v61; // ST5C_8@64 | |
518 bool v62; // edi@64 | |
519 char *v63; // esi@65 | |
520 char *v64; // ebx@65 | |
521 bool v65; // ecx@66 | |
522 double v66; // st6@67 | |
523 double v67; // st6@68 | |
524 double v68; // st5@68 | |
525 double v69; // st6@69 | |
526 double v70; // ST20_8@71 | |
527 double v71; // ST54_8@71 | |
528 double v72; // ST44_8@72 | |
529 double v73; // ST3C_8@72 | |
530 char v74; // zf@72 | |
531 double v75; // ST18_8@73 | |
532 double v76; // ST34_8@73 | |
533 double v77; // ST28_8@74 | |
534 double v78; // ST10_8@74 | |
535 void *v79; // edi@78 | |
536 int v80; // ebx@81 | |
537 char *v81; // ecx@82 | |
538 signed int v82; // esi@82 | |
539 float v83; // ST78_4@83 | |
540 double v84; // ST5C_8@83 | |
541 float v85; // eax@84 | |
542 double v86; // ST20_8@85 | |
543 double v87; // ST54_8@88 | |
544 float v88; // eax@89 | |
545 double v89; // ST44_8@90 | |
546 unsigned __int8 v90; // sf@94 | |
547 unsigned __int8 v91; // of@94 | |
548 int v92; // edx@97 | |
549 int v93; // esi@97 | |
550 int v94; // edi@97 | |
551 int v95; // eax@97 | |
552 int v96; // eax@104 | |
553 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
554 double v98; // [sp+54h] [bp-84h]@49 | |
555 double v99; // [sp+54h] [bp-84h]@66 | |
556 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
557 float v101; // [sp+60h] [bp-78h]@1 | |
558 float v102; // [sp+64h] [bp-74h]@1 | |
559 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
560 float v104; // [sp+A8h] [bp-30h]@1 | |
561 signed int v105; // [sp+A8h] [bp-30h]@96 | |
562 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
563 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
564 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
565 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
566 signed int v110; // [sp+B0h] [bp-28h]@12 | |
567 char *v111; // [sp+B8h] [bp-20h]@30 | |
568 signed int v112; // [sp+B8h] [bp-20h]@48 | |
569 signed int v113; // [sp+B8h] [bp-20h]@65 | |
570 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
571 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
572 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
573 signed int v117; // [sp+C0h] [bp-18h]@1 | |
574 char *v118; // [sp+C0h] [bp-18h]@30 | |
575 char *v119; // [sp+C0h] [bp-18h]@48 | |
576 char *v120; // [sp+C0h] [bp-18h]@65 | |
577 char *v121; // [sp+C4h] [bp-14h]@13 | |
578 char *v122; // [sp+C4h] [bp-14h]@30 | |
579 signed int v123; // [sp+C4h] [bp-14h]@47 | |
580 char *v124; // [sp+C8h] [bp-10h]@30 | |
581 char *v125; // [sp+C8h] [bp-10h]@48 | |
582 char *v126; // [sp+C8h] [bp-10h]@65 | |
583 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
584 char *v128; // [sp+CCh] [bp-Ch]@13 | |
585 char *v129; // [sp+CCh] [bp-Ch]@30 | |
586 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
587 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
588 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
589 char *v133; // [sp+D0h] [bp-8h]@30 | |
590 char *v134; // [sp+D0h] [bp-8h]@48 | |
591 char *v135; // [sp+D0h] [bp-8h]@65 | |
592 signed int v136; // [sp+D4h] [bp-4h]@1 | |
593 char *v137; // [sp+D4h] [bp-4h]@13 | |
594 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
595 char *v139; // [sp+D4h] [bp-4h]@48 | |
596 char *v140; // [sp+D4h] [bp-4h]@65 | |
597 | |
693 | 598 v101 = (double)(signed int)pViewport->uViewportTL_X; |
599 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 600 v117 = a1; |
601 v136 = 1; | |
693 | 602 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
603 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 604 if ( a1 <= 0 ) |
605 return v117; | |
606 v127 = a1; | |
607 v1 = a1; | |
608 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
609 v2 = 0; | |
610 do | |
611 { | |
612 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
613 v136 = 0; | |
614 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
615 v136 = 0; | |
616 ++v2; | |
617 --v127; | |
618 } | |
619 while ( v127 ); | |
620 if ( v136 ) | |
621 return v117; | |
622 v110 = 0; | |
623 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
624 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 625 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 626 if ( v117 < 1 ) |
627 goto LABEL_112; | |
628 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
629 v132 = array_50A2B0; | |
630 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
631 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
632 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 633 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 634 v7 = (char *)&array_50AC10[0].flt_2C; |
635 do | |
636 { | |
637 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 638 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 639 if ( !(v5 ^ v106) ) |
640 goto LABEL_25; | |
641 v8 = v101; | |
693 | 642 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 643 { |
644 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
645 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
646 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
647 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
648 } | |
649 else | |
650 { | |
651 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
652 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
653 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
654 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
655 } | |
656 *(float *)v121 = v10; | |
657 *(int *)v137 = LODWORD(v101); | |
658 LODWORD(v12) = *(int *)v6; | |
659 if ( v5 ) | |
660 { | |
661 v13 = v12 + 6.7553994e15; | |
662 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
663 if ( LODWORD(v13) == LODWORD(v14) ) | |
664 { | |
665 v15 = *(float *)v137 + 6.7553994e15; | |
666 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
667 v17 = LODWORD(v15) == LODWORD(v16); | |
668 goto LABEL_23; | |
669 } | |
670 } | |
671 else | |
672 { | |
673 v18 = v12 + 6.7553994e15; | |
674 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
675 if ( LODWORD(v18) == LODWORD(v19) ) | |
676 { | |
677 v20 = *(float *)v137 + 6.7553994e15; | |
678 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
679 v17 = LODWORD(v20) == LODWORD(v21); | |
680 LABEL_23: | |
681 if ( v17 ) | |
682 goto LABEL_25; | |
683 goto LABEL_24; | |
684 } | |
685 } | |
686 LABEL_24: | |
687 v121 += 48; | |
688 v114 += 48; | |
689 v6 += 48; | |
690 ++v110; | |
691 ++v132; | |
692 v128 = v6; | |
693 v137 += 48; | |
694 LABEL_25: | |
695 if ( v106 ) | |
696 { | |
697 v22 = v132; | |
698 v128 += 48; | |
699 ++v110; | |
700 v114 += 48; | |
701 v121 += 48; | |
702 v137 += 48; | |
703 ++v132; | |
704 memcpy(v22, v7 + 4, 0x30u); | |
705 v6 = v128; | |
706 } | |
707 v5 = v106; | |
708 v7 += 48; | |
709 --v117; | |
710 } | |
711 while ( v117 ); | |
712 if ( v110 < 3 | |
713 || (v115 = 0, | |
714 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
715 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 716 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 717 v110 < 1) ) |
718 goto LABEL_112; | |
168 | 719 v25 = (char *)&array_509950[0]._rhw; |
0 | 720 v138 = array_509950; |
721 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
722 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
723 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
724 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
725 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 726 v111 = (char *)&array_509950[0]._rhw; |
0 | 727 v26 = (char *)&array_50A2B0[0].flt_2C; |
728 while ( 2 ) | |
729 { | |
730 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 731 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
732 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 733 if ( v24 != v27 ) |
734 { | |
735 v28 = v100; | |
693 | 736 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 737 { |
738 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
739 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
740 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
741 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
742 } | |
743 else | |
744 { | |
745 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
746 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
747 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
748 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
749 } | |
750 *(float *)v124 = v30; | |
751 *(int *)v133 = LODWORD(v100); | |
752 if ( v24 ) | |
753 { | |
754 v32 = *(float *)v122 + 6.7553994e15; | |
755 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
756 if ( LODWORD(v32) == LODWORD(v33) ) | |
757 { | |
758 v34 = *(float *)v133 + 6.7553994e15; | |
759 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
760 v36 = LODWORD(v34) == LODWORD(v35); | |
761 goto LABEL_41; | |
762 } | |
763 goto LABEL_42; | |
764 } | |
765 v37 = *(float *)v118 + 6.7553994e15; | |
766 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
767 if ( LODWORD(v37) != LODWORD(v38) ) | |
768 goto LABEL_42; | |
769 v39 = *(float *)v129 + 6.7553994e15; | |
770 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
771 v36 = LODWORD(v39) == LODWORD(v40); | |
772 LABEL_41: | |
773 if ( !v36 ) | |
774 { | |
775 LABEL_42: | |
776 v129 += 48; | |
777 v118 += 48; | |
778 v133 += 48; | |
779 v122 += 48; | |
780 v124 += 48; | |
781 v111 += 48; | |
782 ++v115; | |
783 ++v138; | |
784 } | |
785 } | |
786 if ( v27 ) | |
787 { | |
788 v41 = v138; | |
789 ++v115; | |
790 v111 += 48; | |
791 v124 += 48; | |
792 v122 += 48; | |
793 v133 += 48; | |
794 v118 += 48; | |
795 v129 += 48; | |
796 ++v138; | |
797 memcpy(v41, v26 + 4, 0x30u); | |
798 } | |
799 v24 = v107; | |
800 v26 += 48; | |
801 --v110; | |
802 if ( v110 ) | |
803 { | |
804 v25 = v111; | |
805 continue; | |
806 } | |
807 break; | |
808 } | |
809 if ( v115 < 3 | |
810 || (v123 = 0, | |
811 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
812 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 813 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 814 v115 < 1) ) |
815 goto LABEL_112; | |
816 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
817 v130 = array_508FF0; | |
818 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
819 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
820 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 821 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 822 v45 = (char *)&array_509950[0].flt_2C; |
823 v112 = v115; | |
824 while ( 2 ) | |
825 { | |
826 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 827 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
828 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 829 if ( v43 != v46 ) |
830 { | |
831 v47 = v104; | |
693 | 832 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 833 { |
834 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
835 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
836 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
837 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
838 } | |
839 else | |
840 { | |
841 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
842 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
843 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
844 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
845 } | |
846 *(float *)v125 = v49; | |
847 *(float *)v139 = v104; | |
848 if ( v43 ) | |
849 { | |
850 v51 = v104 + 6.7553994e15; | |
851 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
852 if ( LODWORD(v51) == LODWORD(v52) ) | |
853 { | |
854 v53 = *(float *)v44 + 6.7553994e15; | |
855 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
856 v55 = LODWORD(v53) == LODWORD(v54); | |
857 goto LABEL_58; | |
858 } | |
859 goto LABEL_59; | |
860 } | |
861 v56 = v104 + 6.7553994e15; | |
862 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
863 if ( LODWORD(v56) != LODWORD(v57) ) | |
864 goto LABEL_59; | |
865 v58 = *(float *)v44 + 6.7553994e15; | |
866 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
867 v55 = LODWORD(v58) == LODWORD(v59); | |
868 LABEL_58: | |
869 if ( !v55 ) | |
870 { | |
871 LABEL_59: | |
872 v139 += 48; | |
873 v125 += 48; | |
874 v134 += 48; | |
875 v44 += 48; | |
876 ++v123; | |
877 ++v130; | |
878 v119 = v44; | |
879 } | |
880 } | |
881 if ( v46 ) | |
882 { | |
883 v60 = v130; | |
884 v119 += 48; | |
885 ++v123; | |
886 v134 += 48; | |
887 v125 += 48; | |
888 v139 += 48; | |
889 ++v130; | |
890 memcpy(v60, v45 + 4, 0x30u); | |
891 v44 = v119; | |
892 } | |
893 v43 = v108; | |
894 v45 += 48; | |
895 --v112; | |
896 if ( v112 ) | |
897 continue; | |
898 break; | |
899 } | |
900 if ( v123 < 3 | |
901 || (v116 = 0, | |
902 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
903 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 904 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 905 v123 < 1) ) |
906 goto LABEL_112; | |
907 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
908 v131 = array_508690; | |
909 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
910 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
911 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 912 v135 = (char *)&array_508690[0]._rhw; |
0 | 913 v64 = (char *)&array_508FF0[0].flt_2C; |
914 v113 = v123; | |
915 while ( 2 ) | |
916 { | |
917 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 918 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
919 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 920 if ( v62 != v65 ) |
921 { | |
922 v66 = v102; | |
693 | 923 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 924 { |
925 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
926 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
927 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
928 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
929 } | |
930 else | |
931 { | |
932 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
933 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
934 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
935 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
936 } | |
937 *(float *)v126 = v68; | |
938 *(float *)v140 = v102; | |
939 if ( v62 ) | |
940 { | |
941 v70 = v102 + 6.7553994e15; | |
942 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
943 if ( LODWORD(v70) == LODWORD(v71) ) | |
944 { | |
945 v72 = *(float *)v63 + 6.7553994e15; | |
946 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
947 v74 = LODWORD(v72) == LODWORD(v73); | |
948 goto LABEL_75; | |
949 } | |
950 goto LABEL_76; | |
951 } | |
952 v75 = v102 + 6.7553994e15; | |
953 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
954 if ( LODWORD(v75) != LODWORD(v76) ) | |
955 goto LABEL_76; | |
956 v77 = *(float *)v63 + 6.7553994e15; | |
957 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
958 v74 = LODWORD(v77) == LODWORD(v78); | |
959 LABEL_75: | |
960 if ( !v74 ) | |
961 { | |
962 LABEL_76: | |
963 v140 += 48; | |
964 v126 += 48; | |
965 v135 += 48; | |
966 v63 += 48; | |
967 ++v116; | |
968 ++v131; | |
969 v120 = v63; | |
970 } | |
971 } | |
972 if ( v65 ) | |
973 { | |
974 v79 = v131; | |
975 v120 += 48; | |
976 ++v116; | |
977 v135 += 48; | |
978 v126 += 48; | |
979 v140 += 48; | |
980 ++v131; | |
981 memcpy(v79, v64 + 4, 0x30u); | |
982 v63 = v120; | |
983 } | |
984 v62 = v109; | |
985 v64 += 48; | |
986 --v113; | |
987 if ( v113 ) | |
988 continue; | |
989 break; | |
990 } | |
991 if ( v116 < 3 ) | |
992 goto LABEL_112; | |
993 v80 = v116; | |
994 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
995 if ( v116 > 0 ) | |
996 { | |
997 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
998 v82 = v116; | |
999 do | |
1000 { | |
1001 LODWORD(v83) = *(int *)v81; | |
1002 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1003 v84 = v83 + 6.7553994e15; | |
693 | 1004 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1005 { |
1006 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1007 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1008 goto LABEL_88; |
1009 v85 = v101; | |
1010 } | |
1011 else | |
1012 { | |
1013 v85 = v100; | |
1014 } | |
1015 *(int *)v81 = LODWORD(v85); | |
1016 LABEL_88: | |
1017 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1018 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1019 { |
1020 v88 = v102; | |
1021 LABEL_92: | |
1022 *((int *)v81 + 1) = LODWORD(v88); | |
1023 goto LABEL_93; | |
1024 } | |
1025 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1026 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1027 { |
1028 v88 = v104; | |
1029 goto LABEL_92; | |
1030 } | |
1031 LABEL_93: | |
1032 v81 += 48; | |
1033 --v82; | |
1034 } | |
1035 while ( v82 ); | |
1036 } | |
1037 v91 = __OFSUB__(v116, 3); | |
1038 v90 = v116 - 3 < 0; | |
1039 if ( v116 > 3 ) | |
1040 { | |
1041 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1042 if ( v116 > 0 ) | |
1043 { | |
1044 v105 = 1; | |
1045 do | |
1046 { | |
1047 v92 = v105; | |
1048 v93 = v105 - 1; | |
1049 v94 = v105 + 1; | |
1050 v95 = v105 + 1; | |
1051 if ( v105 - 1 >= v80 ) | |
1052 v93 -= v80; | |
1053 if ( v105 >= v80 ) | |
1054 v92 = v105 - v80; | |
1055 if ( v94 >= v80 ) | |
1056 v95 = v94 - v80; | |
1057 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1058 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1059 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1060 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1061 { | |
1062 ++v105; | |
1063 } | |
1064 else | |
1065 { | |
1066 v96 = v105; | |
1067 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1068 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1069 --v80; | |
1070 } | |
1071 } | |
1072 while ( v105 - 1 < v80 ); | |
1073 } | |
1074 v91 = __OFSUB__(v80, 3); | |
1075 v90 = v80 - 3 < 0; | |
1076 } | |
1077 if ( v90 ^ v91 ) | |
1078 LABEL_112: | |
1079 result = 0; | |
1080 else | |
1081 result = v80; | |
1082 return result; | |
1083 } | |
1084 | |
1085 //----- (0042620A) -------------------------------------------------------- | |
1086 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1087 { | |
1088 __int16 v1; // fps@1 | |
1089 unsigned __int8 v2; // c0@2 | |
1090 char v3; // c2@2 | |
1091 unsigned __int8 v4; // c3@2 | |
1092 bool result; // eax@2 | |
1093 unsigned __int8 v6; // c0@4 | |
1094 char v7; // c2@4 | |
1095 unsigned __int8 v8; // c3@4 | |
1096 unsigned __int8 v9; // c0@6 | |
1097 char v10; // c2@6 | |
1098 unsigned __int8 v11; // c3@6 | |
1099 double v12; // st6@7 | |
1100 float v13; // ST04_4@7 | |
1101 float v14; // ST00_4@7 | |
1102 double v15; // st7@7 | |
1103 double v16; // st6@8 | |
1104 float v17; // ST04_4@8 | |
1105 float v18; // ST00_4@8 | |
1106 double v19; // st7@8 | |
1107 | |
1108 //UNDEF(v1); | |
1109 if ( p->vWorldViewPosition.x < 300.0 | |
1110 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1111 v3 = 0, | |
1112 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1113 //BYTE1(result) = HIBYTE(v1), |
0 | 1114 !(v2 | v4)) ) |
1115 { | |
1116 if ( p->vWorldViewPosition.x < 300.0 ) | |
1117 { | |
1118 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1119 v7 = 0; | |
1120 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1121 //BYTE1(result) = HIBYTE(v1); |
0 | 1122 if ( !(v6 | v8) ) |
1123 { | |
921 | 1124 //LOBYTE(result) = 0; |
1125 return false; | |
0 | 1126 } |
1127 } | |
1128 v9 = 300.0 < p->vWorldViewPosition.x; | |
1129 v10 = 0; | |
1130 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1131 //BYTE1(result) = HIBYTE(v1); |
0 | 1132 if ( v9 | v11 ) |
1133 { | |
1134 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1135 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1136 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1137 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1138 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1139 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1140 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1141 } | |
1142 else | |
1143 { | |
1144 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1145 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1146 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1147 v15 = 300.0 - p->vWorldViewPosition.x; | |
1148 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1149 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1150 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1151 } | |
1152 } | |
921 | 1153 //LOBYTE(result) = 1; |
1154 return true; | |
0 | 1155 } |
1156 | |
1157 //----- (004268E3) -------------------------------------------------------- | |
1158 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1159 { | |
1160 unsigned int v1; // eax@1 | |
1161 unsigned int v2; // edx@1 | |
1162 int v3; // eax@1 | |
1163 int v4; // edx@1 | |
1164 unsigned int v5; // ecx@1 | |
1165 | |
1166 v1 = uColor >> 9; | |
1167 v2 = uColor >> 6; | |
1168 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1169 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1170 v3 = v2 | v1; | |
1171 v4 = (unsigned __int8)uColor >> 3; | |
1172 v5 = uColor >> 16; | |
1173 LOWORD(v5) = v5 & 0x8000; | |
1174 return v5 | v4 | v3; | |
1175 } | |
1176 | |
1177 //----- (0042690D) -------------------------------------------------------- | |
1178 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1179 { | |
1180 unsigned int v1; // eax@1 | |
1181 unsigned int v2; // edx@1 | |
1182 | |
1183 v1 = a1 >> 8; | |
1184 v2 = a1 >> 5; | |
1185 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1186 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1187 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1188 } | |
1189 //----- (00426947) -------------------------------------------------------- | |
1190 void __cdecl sub_426947() | |
1191 { | |
893 | 1192 stru_50C198.field_0 = 0; |
0 | 1193 dword_50C994 = 0; |
1194 dword_50C998_turnbased_icon_1A = 0; | |
1195 } | |
1196 // 50C968: using guessed type int dword_50C968; | |
1197 // 50C994: using guessed type int dword_50C994; | |
1198 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1199 | |
1200 //----- (004269A2) -------------------------------------------------------- | |
792 | 1201 int __fastcall GivePartyExp(unsigned int a1) |
0 | 1202 { |
89 | 1203 //unsigned __int64 v1; // qax@1 |
1204 Player *v1; | |
1205 int v1b; | |
0 | 1206 signed int v2; // ecx@1 |
82 | 1207 int *v3; // esi@1 |
0 | 1208 bool v4; // edi@6 |
82 | 1209 int *v5; // edi@10 |
1210 Player *v6; // esi@10 | |
0 | 1211 int v7; // eax@13 |
1212 unsigned __int8 v8; // cf@13 | |
89 | 1213 int v10[4]; // [sp+Ch] [bp-14h]@1 |
0 | 1214 int v11; // [sp+1Ch] [bp-4h]@10 |
1215 | |
89 | 1216 //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); |
1217 v1 = pParty->pPlayers; | |
1218 v1b = a1; | |
0 | 1219 v2 = 0; |
89 | 1220 v3 = v10; |
0 | 1221 do |
1222 { | |
89 | 1223 /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) |
0 | 1224 && !*(int *)HIDWORD(v1) |
1225 && !*(_QWORD *)(HIDWORD(v1) + 8) | |
89 | 1226 && !*(_QWORD *)(HIDWORD(v1) + 16);*/ |
1227 v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) | |
1228 && !v1->pConditions[14] | |
1229 && !v1->pConditions[15] | |
1230 && !v1->pConditions[16]; | |
82 | 1231 *v3 = v4; |
89 | 1232 //HIDWORD(v1) += 6972; |
1233 ++v1; | |
0 | 1234 v2 += v4; |
82 | 1235 ++v3; |
0 | 1236 } |
89 | 1237 while ( v1 <= &pParty->pPlayers[3] ); |
0 | 1238 if ( v2 ) |
1239 { | |
89 | 1240 v1b = v1b / v2; |
1241 v5 = v10; | |
82 | 1242 v6 = pParty->pPlayers;//[0].uExperience; |
89 | 1243 v11 = v1b; |
0 | 1244 do |
1245 { | |
82 | 1246 if ( *v5 ) |
0 | 1247 { |
1248 if ( v11 ) | |
1249 { | |
82 | 1250 LOBYTE(v7) = v6->GetLearningPercent(); |
922 | 1251 v1b = v11 + v11 * (char)v7 / 100; |
89 | 1252 //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); |
1253 //need review | |
1254 LODWORD(v6->uExperience) += v1b; | |
1255 //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; | |
82 | 1256 if ( v6->uExperience > 4000000000i64 ) |
0 | 1257 { |
82 | 1258 HIDWORD(v6->uExperience) = 0; |
1259 LODWORD(v6->uExperience) = -294967296; | |
0 | 1260 } |
1261 } | |
1262 } | |
82 | 1263 ++v6; |
1264 ++v5; | |
0 | 1265 } |
82 | 1266 while ( v6 <= &pParty->pPlayers[3] ); |
0 | 1267 } |
89 | 1268 return v1b; |
0 | 1269 } |
1270 | |
1271 //----- (00426A5A) -------------------------------------------------------- | |
1272 void stru319::LootActor(Actor *pActor) | |
1273 { | |
1274 signed int v2; // edi@1 | |
1275 char v3; // zf@1 | |
1276 unsigned int v4; // eax@13 | |
1277 unsigned int v5; // esi@13 | |
1278 int v6; // eax@14 | |
1279 unsigned __int8 v7; // al@30 | |
1280 Party *v8; // esi@34 | |
1281 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1282 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1283 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1284 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1285 int v13; // [sp+30h] [bp-8h]@1 | |
1286 int v14; // [sp+34h] [bp-4h]@1 | |
1287 | |
1288 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1289 Dst.Reset(); | |
1290 v2 = 0; | |
1291 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1292 v13 = 0; | |
1293 v14 = 0; | |
1294 if ( v3 ) | |
1295 { | |
1296 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1297 goto LABEL_9; | |
1298 do | |
1299 { | |
1300 ++v2; | |
1301 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1302 } | |
1303 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1304 } | |
1305 else | |
1306 { | |
1307 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1308 goto LABEL_9; | |
377 | 1309 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1310 pActor->array_000234[3].Reset(); |
1311 } | |
1312 if ( v14 ) | |
1313 { | |
1314 party_finds_gold(v14, 0); | |
1315 viewparams->bRedrawGameUI = 1; | |
1316 } | |
1317 LABEL_9: | |
1318 if ( pActor->uCarriedItemID ) | |
1319 { | |
1320 Dst.Reset(); | |
1321 Dst.uItemID = pActor->uCarriedItemID; | |
1322 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1323 if ( v14 ) | |
721 | 1324 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1325 else |
721 | 1326 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1327 ShowStatusBarString(pTmpBuf2, 2u); |
1328 v4 = Dst.uItemID; | |
1329 v5 = Dst.uItemID; | |
1330 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1331 { | |
1332 v5 = Dst.uItemID; | |
1333 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1334 Dst.uNumCharges = v6; | |
1335 Dst.uMaxCharges = v6; | |
1336 v4 = Dst.uItemID; | |
1337 } | |
1338 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1339 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1340 pItemsTable->SetSpecialBonus(&Dst); |
1341 if ( !pParty->AddItem(&Dst) ) | |
1342 pParty->SetHoldingItem(&Dst); | |
1343 pActor->uCarriedItemID = 0; | |
1344 if ( pActor->array_000234[0].uItemID ) | |
1345 { | |
1346 if ( !pParty->AddItem(pActor->array_000234) ) | |
1347 { | |
1348 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1349 pParty->SetHoldingItem(pActor->array_000234); | |
1350 } | |
1351 pActor->array_000234[0].Reset(); | |
1352 } | |
1353 if ( pActor->array_000234[1].uItemID ) | |
1354 { | |
1355 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1356 { | |
1357 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1358 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1359 } | |
1360 pActor->array_000234[1].Reset(); | |
1361 } | |
1362 LABEL_55: | |
1363 pActor->Remove(); | |
1364 return; | |
1365 } | |
1366 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1367 { | |
1368 if ( pActor->array_000234[3].uItemID ) | |
1369 { | |
1370 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1371 pActor->array_000234[3].Reset(); | |
1372 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1373 if ( v14 ) | |
721 | 1374 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1375 else |
721 | 1376 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1377 ShowStatusBarString(pTmpBuf2, 2u); |
1378 if ( !pParty->AddItem(&Dst) ) | |
1379 pParty->SetHoldingItem(&Dst); | |
1380 v13 = 1; | |
1381 } | |
1382 goto LABEL_44; | |
1383 } | |
1384 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1385 { | |
1386 LABEL_44: | |
1387 v8 = pParty; | |
1388 goto LABEL_45; | |
1389 } | |
1390 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1391 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1392 if ( v14 ) | |
721 | 1393 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1394 else |
721 | 1395 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1396 ShowStatusBarString(pTmpBuf2, 2u); |
1397 v8 = pParty; | |
1398 if ( !pParty->AddItem(&Dst) ) | |
1399 pParty->SetHoldingItem(&Dst); | |
1400 v13 = 1; | |
1401 LABEL_45: | |
1402 if ( pActor->array_000234[0].uItemID ) | |
1403 { | |
1404 if ( !v8->AddItem(pActor->array_000234) ) | |
1405 { | |
1406 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1407 v8->SetHoldingItem(pActor->array_000234); | |
1408 v13 = 1; | |
1409 } | |
1410 pActor->array_000234[0].Reset(); | |
1411 } | |
1412 if ( pActor->array_000234[1].uItemID ) | |
1413 { | |
1414 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1415 { | |
1416 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1417 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1418 v13 = 1; | |
1419 } | |
1420 pActor->array_000234[1].Reset(); | |
1421 } | |
1422 if ( !v13 || rand() % 100 < 90 ) | |
1423 goto LABEL_55; | |
1424 } | |
1425 | |
1426 //----- (00426E10) -------------------------------------------------------- | |
1427 int stru319::which_player_would_attack(Actor *pActor) | |
1428 { | |
1429 signed int v2; // ebx@1 | |
1430 int v3; // ecx@2 | |
1431 signed int v4; // edx@3 | |
1432 char v5; // zf@3 | |
1433 unsigned int v6; // eax@3 | |
1434 int v7; // eax@6 | |
1435 int v8; // eax@7 | |
1436 int v9; // eax@8 | |
1437 int v10; // eax@9 | |
1438 int v11; // eax@10 | |
1439 int v12; // eax@11 | |
1440 int v13; // esi@35 | |
1441 signed int v14; // edi@37 | |
1442 enum CHARACTER_RACE v15; // eax@44 | |
1443 Player *v16; // ecx@47 | |
1444 unsigned __int8 v17; // sf@50 | |
1445 unsigned __int8 v18; // of@50 | |
1446 int v19; // esi@52 | |
1447 Player *v20; // ecx@53 | |
1448 int result; // eax@57 | |
1449 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1450 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1451 int v24; // [sp+138h] [bp-10h]@2 | |
1452 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1453 int v26; // [sp+140h] [bp-8h]@1 | |
1454 int v27; // [sp+144h] [bp-4h]@1 | |
1455 | |
1456 v27 = -1; | |
1457 v26 = -1; | |
1458 v25 = -1; | |
1459 v2 = 0; | |
1460 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1461 { | |
1462 v3 = 0; | |
1463 v24 = 0; | |
1464 do | |
1465 { | |
1466 v4 = 1; | |
1467 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1468 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1469 v22[v3] = v6; | |
1470 if ( !v5 ) | |
1471 { | |
1472 if ( (signed int)v6 > 128 ) | |
1473 { | |
1474 switch ( v6 ) | |
1475 { | |
1476 case 0x100u: | |
1477 v27 = 8; | |
1478 break; | |
1479 case 0x200u: | |
1480 v25 = 0; | |
1481 break; | |
1482 case 0x400u: | |
1483 v25 = 1; | |
1484 break; | |
1485 case 0x800u: | |
1486 v26 = 0; | |
1487 break; | |
1488 case 0x1000u: | |
1489 v26 = 1; | |
1490 break; | |
1491 case 0x2000u: | |
1492 v26 = 3; | |
1493 break; | |
1494 case 0x4000u: | |
1495 v26 = 2; | |
1496 break; | |
1497 } | |
1498 } | |
1499 else | |
1500 { | |
1501 if ( v6 == 128 ) | |
1502 { | |
1503 v27 = 4; | |
1504 } | |
1505 else | |
1506 { | |
1507 v7 = v6 - 1; | |
1508 if ( v7 ) | |
1509 { | |
1510 v8 = v7 - 1; | |
1511 if ( v8 ) | |
1512 { | |
1513 v9 = v8 - 2; | |
1514 if ( v9 ) | |
1515 { | |
1516 v10 = v9 - 4; | |
1517 if ( v10 ) | |
1518 { | |
1519 v11 = v10 - 8; | |
1520 if ( v11 ) | |
1521 { | |
1522 v12 = v11 - 16; | |
1523 if ( v12 ) | |
1524 { | |
1525 if ( v12 == 32 ) | |
1526 v27 = 20; | |
1527 } | |
1528 else | |
1529 { | |
1530 v27 = 32; | |
1531 } | |
1532 } | |
1533 else | |
1534 { | |
1535 v27 = 24; | |
1536 } | |
1537 } | |
1538 else | |
1539 { | |
1540 v27 = 28; | |
1541 } | |
1542 } | |
1543 else | |
1544 { | |
1545 v27 = 16; | |
1546 } | |
1547 } | |
1548 else | |
1549 { | |
1550 v27 = 12; | |
1551 } | |
1552 } | |
1553 else | |
1554 { | |
1555 v27 = 0; | |
1556 } | |
1557 } | |
1558 } | |
1559 v2 = 0; | |
1560 v13 = 0; | |
1561 while ( 1 ) | |
1562 { | |
1563 v14 = 0; | |
135 | 1564 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1565 v14 = v4; |
1566 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1567 v14 = v4; | |
1568 if ( v26 != -1 ) | |
1569 { | |
1570 v15 = pPlayers[v13 + 1]->GetRace(); | |
1571 if ( v26 == v15 ) | |
1572 v14 = 1; | |
1573 } | |
1574 if ( v14 == 1 ) | |
1575 { | |
1576 v16 = pPlayers[v13 + 1]; | |
1577 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1578 v23[v2++] = v13; | |
1579 } | |
1580 ++v13; | |
1581 if ( v13 >= 4 ) | |
1582 break; | |
1583 v4 = 1; | |
1584 } | |
1585 } | |
1586 v3 = v24 + 1; | |
1587 v18 = __OFSUB__(v24 + 1, 15); | |
1588 v17 = v24++ - 14 < 0; | |
1589 } | |
1590 while ( v17 ^ v18 ); | |
1591 if ( v2 ) | |
1592 goto LABEL_61; | |
1593 } | |
1594 v19 = 0; | |
1595 do | |
1596 { | |
1597 v20 = pPlayers[v19 + 1]; | |
1598 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1599 v23[v2++] = v19; | |
1600 ++v19; | |
1601 } | |
1602 while ( v19 < 4 ); | |
1603 if ( v2 ) | |
1604 LABEL_61: | |
1605 result = v23[rand() % v2]; | |
1606 else | |
1607 result = 0; | |
1608 return result; | |
1609 } | |
1610 | |
1611 //----- (0042704B) -------------------------------------------------------- | |
1612 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1613 { | |
1614 stru319 *v3; // edi@1 | |
1615 signed int v4; // ebx@5 | |
1616 signed int v5; // edi@5 | |
1617 | |
1618 v3 = this; | |
1619 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1620 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1621 && rand() % 100 < 5 ) | |
1622 pActor->_44FD29(a2); | |
1623 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1624 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1625 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1626 return 2; | |
1627 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1628 return 3; | |
1629 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1630 } | |
1631 | |
1632 //----- (00427102) -------------------------------------------------------- | |
1633 int stru319::_427102(Actor *pActor, signed int a2) | |
1634 { | |
1635 unsigned __int8 v3; // cf@11 | |
1636 unsigned __int8 v4; // zf@11 | |
1637 SpellBuff *v6; // ecx@46 | |
89 | 1638 Player *v7; // esi@49 |
0 | 1639 signed int v8; // edx@50 |
89 | 1640 SpellBuff *v9; // ecx@50 |
0 | 1641 |
597 | 1642 switch(a2) |
0 | 1643 { |
597 | 1644 case 77: |
1645 { | |
1646 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1647 return 0; | |
1648 return 1; | |
1649 } | |
1650 case 80: | |
1651 { | |
1652 v6 = pParty->pPartyBuffs; | |
1653 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1654 { | |
1655 ++v6; | |
1656 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1657 { | |
1658 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1659 v8 = 0; | |
1660 v9 = v7->pPlayerBuffs; | |
1661 while ( v9->uExpireTime <= 0i64 ) | |
1662 { | |
1663 ++v8; | |
1664 ++v9; | |
1665 if ( v8 >= 24 ) | |
1666 { | |
1667 ++v7; | |
1668 if ( v7 <= &pParty->pPlayers[3] ) | |
1669 { | |
1670 v8 = 0; | |
1671 v9 = v7->pPlayerBuffs; | |
1672 } | |
1673 else | |
1674 return 0; | |
1675 } | |
1676 } | |
1677 return 1; | |
1678 } | |
1679 } | |
1680 return 1; | |
1681 } | |
1682 case 85: | |
1683 { | |
1684 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1685 return 1; | |
1686 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1687 return 0; | |
1688 v3 = 0; | |
1689 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1690 break; | |
1691 } | |
1692 case 86: | |
1693 { | |
0 | 1694 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1695 return 1; |
0 | 1696 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1697 return 0; |
0 | 1698 v3 = 0; |
1699 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1700 break; |
1701 } | |
1702 case 95: | |
1703 { | |
1704 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1705 return 1; | |
0 | 1706 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1707 return 0; |
0 | 1708 v3 = 0; |
1709 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1710 break; |
1711 } | |
1712 case 73: | |
1713 { | |
1714 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1715 return 1; | |
1716 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1717 return 0; | |
1718 v3 = 0; | |
1719 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1720 break; | |
1721 } | |
1722 case 5: | |
1723 { | |
1724 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1725 return 1; | |
1726 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1727 return 0; | |
1728 v3 = 0; | |
1729 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1730 break; | |
1731 } | |
1732 case 17: | |
1733 { | |
1734 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1735 return 1; | |
1736 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1737 return 0; | |
1738 v3 = 0; | |
1739 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1740 break; | |
1741 } | |
1742 case 38: | |
89 | 1743 { |
597 | 1744 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1745 return 1; | |
1746 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1747 return 0; | |
1748 v3 = 0; | |
1749 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1750 } | |
1751 case 46: | |
1752 { | |
1753 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1754 return 1; |
597 | 1755 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1756 return 0; | |
1757 v3 = 0; | |
1758 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1759 break; | |
1760 } | |
1761 case 47: | |
1762 { | |
1763 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1764 return 1; | |
1765 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1766 return 0; | |
1767 v3 = 0; | |
1768 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1769 break; | |
1770 } | |
1771 case 51: | |
1772 { | |
1773 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1774 return 1; | |
1775 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1776 { | |
89 | 1777 v3 = 0; |
1778 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1779 } | |
1780 else | |
597 | 1781 return 0; |
1782 break; | |
1783 } | |
1784 default: | |
89 | 1785 { |
597 | 1786 return 1; |
89 | 1787 } |
0 | 1788 } |
1789 if ( !(v3 | v4) ) | |
1790 return 0; | |
1791 return 1; | |
1792 } | |
1793 | |
1794 //----- (004272F5) -------------------------------------------------------- | |
1795 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1796 { | |
1797 signed int v5; // esi@1 | |
1798 signed int v6; // edi@1 | |
1799 int v7; // esi@8 | |
1800 int v8; // eax@9 | |
1801 int v9; // edx@11 | |
1802 int v10; // edx@13 | |
1803 int v11; // esi@13 | |
1804 unsigned __int8 v12; // sf@13 | |
1805 unsigned __int8 v13; // of@13 | |
1806 int v14; // edx@14 | |
1807 int v15; // eax@14 | |
1808 signed int result; // eax@17 | |
1809 | |
1810 v5 = pActor->pMonsterInfo.uAC; | |
1811 v6 = 0; | |
1812 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1813 v5 /= 2; | |
1814 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1815 v6 = pActor->pActorBuffs[15].uPower; | |
1816 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1817 v6 = pActor->pActorBuffs[16].uPower; | |
1818 v7 = v6 + v5; | |
1819 if ( a3 ) | |
1820 v8 = pPlayer->GetRangedAttack(); | |
1821 else | |
1822 v8 = pPlayer->GetActualAttack(0); | |
1823 v9 = rand() % (v7 + 2 * v8 + 30); | |
1824 if ( a3 == 2 ) | |
1825 { | |
1826 v14 = a4 + v9; | |
1827 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1828 } | |
1829 else | |
1830 { | |
1831 if ( a3 != 3 ) | |
1832 { | |
1833 v10 = a4 + v9; | |
1834 v11 = v7 + 15; | |
1835 v13 = __OFSUB__(v10, v11); | |
1836 v12 = v10 - v11 < 0; | |
1837 goto LABEL_16; | |
1838 } | |
1839 v14 = a4 + v9; | |
1840 v15 = 2 * v7 + 30; | |
1841 } | |
1842 v13 = __OFSUB__(v14, v15); | |
1843 v12 = v14 - v15 < 0; | |
1844 LABEL_16: | |
1845 if ( v12 ^ v13 ) | |
1846 result = 0; | |
1847 else | |
1848 result = 1; | |
1849 return result; | |
1850 } | |
1851 | |
1852 //----- (004273BB) -------------------------------------------------------- | |
1853 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1854 { | |
1855 Actor *v5; // ecx@1 | |
1856 signed int v6; // ebx@1 | |
1857 signed int v7; // esi@1 | |
1858 unsigned __int8 v8; // zf@1 | |
1859 unsigned __int8 v9; // sf@1 | |
1860 int v10; // ebx@10 | |
1861 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1862 | |
1863 v5 = a2; | |
1864 v6 = a2->pMonsterInfo.uAC; | |
1865 v7 = 0; | |
1866 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1867 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1868 a2a = 0; | |
1869 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1870 v6 /= 2; | |
1871 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1872 v7 = v5->pActorBuffs[14].uPower; | |
1873 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1874 v7 = v5->pActorBuffs[16].uPower; | |
1875 v10 = v7 + v6; | |
1876 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1877 a2a = pActor->pActorBuffs[14].uPower; | |
1878 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1879 a2a = pActor->pActorBuffs[17].uPower; | |
1880 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1881 { | |
1882 a2a += pActor->pActorBuffs[11].uPower; | |
1883 pActor->pActorBuffs[11].Reset(); | |
1884 } | |
1885 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1886 } | |
1887 | |
1888 //----- (004274AD) -------------------------------------------------------- | |
1889 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1890 { | |
1891 signed int v3; // edi@1 | |
1892 signed int v4; // esi@8 | |
1893 int v5; // esi@8 | |
1894 | |
1895 v3 = 0; | |
1896 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1897 v3 = pActor->pActorBuffs[14].uPower; | |
1898 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1899 v3 = pActor->pActorBuffs[17].uPower; | |
1900 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1901 { | |
1902 v3 += pActor->pActorBuffs[11].uPower; | |
1903 pActor->pActorBuffs[11].Reset(); | |
1904 } | |
1905 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1906 v5 = rand() % v4 + 1; | |
1907 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1908 } | |
1909 | |
1910 //----- (00427546) -------------------------------------------------------- | |
1911 int stru319::_427546(int a2) | |
1912 { | |
1913 int result; // eax@2 | |
1914 | |
1915 if ( a2 >= 0 ) | |
1916 { | |
1917 if ( a2 >= 1 ) | |
1918 result = (a2 >= 2) + 2; | |
1919 else | |
1920 result = 1; | |
1921 } | |
1922 else | |
1923 { | |
1924 result = 0; | |
1925 } | |
1926 return result; | |
1927 } | |
1928 | |
1929 //----- (0042756B) -------------------------------------------------------- | |
1930 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1931 { | |
1932 int v4; // edx@1 | |
1933 int v5; // ecx@1 | |
1934 signed int v6; // eax@4 | |
1935 signed int result; // eax@17 | |
1936 signed int v8; // esi@18 | |
1937 | |
1938 v4 = 0; | |
1939 v5 = 0; | |
1940 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1941 v5 = pActor->pActorBuffs[14].uPower; | |
1942 switch ( a2 ) | |
1943 { | |
1944 case 4: | |
1945 v6 = pActor->pMonsterInfo.uResPhysical; | |
1946 break; | |
1947 case 0: | |
1948 v6 = pActor->pMonsterInfo.uResFire; | |
1949 goto LABEL_12; | |
1950 case 1: | |
1951 v6 = pActor->pMonsterInfo.uResAir; | |
1952 goto LABEL_12; | |
1953 case 2: | |
1954 v6 = pActor->pMonsterInfo.uResWater; | |
1955 goto LABEL_12; | |
1956 case 3: | |
1957 v6 = pActor->pMonsterInfo.uResEarth; | |
1958 goto LABEL_12; | |
1959 case 6: | |
1960 v6 = pActor->pMonsterInfo.uResSpirit; | |
1961 break; | |
1962 case 7: | |
1963 v6 = pActor->pMonsterInfo.uResMind; | |
1964 goto LABEL_12; | |
1965 case 8: | |
1966 v6 = pActor->pMonsterInfo.uResBody; | |
1967 LABEL_12: | |
1968 v4 = v5; | |
1969 break; | |
1970 case 9: | |
1971 v6 = pActor->pMonsterInfo.uResLight; | |
1972 break; | |
1973 case 10: | |
1974 v6 = pActor->pMonsterInfo.uResDark; | |
1975 break; | |
1976 default: | |
1977 v6 = 0; | |
1978 break; | |
1979 } | |
1980 if ( v6 < 200 ) | |
1981 { | |
1982 v8 = v4 + v6 + 30; | |
1983 if ( rand() % v8 >= 30 ) | |
1984 { | |
1985 a3 >>= 1; | |
1986 if ( rand() % v8 >= 30 ) | |
1987 { | |
1988 a3 >>= 1; | |
1989 if ( rand() % v8 >= 30 ) | |
1990 { | |
1991 a3 >>= 1; | |
1992 if ( rand() % v8 >= 30 ) | |
1993 a3 >>= 1; | |
1994 } | |
1995 } | |
1996 } | |
1997 result = a3; | |
1998 } | |
1999 else | |
2000 { | |
2001 result = 0; | |
2002 } | |
2003 return result; | |
2004 } | |
2005 | |
2006 //----- (00427662) -------------------------------------------------------- | |
2007 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
2008 { | |
2009 Actor *v3; // edi@2 | |
2010 signed int v4; // esi@2 | |
2011 bool result; // eax@13 | |
2012 | |
2013 switch ( uType ) | |
2014 { | |
2015 case 0u: | |
2016 v3 = pActor; | |
2017 v4 = pActor->pMonsterInfo.uResFire; | |
2018 goto LABEL_12; | |
2019 case 1u: | |
2020 v3 = pActor; | |
2021 v4 = pActor->pMonsterInfo.uResAir; | |
2022 goto LABEL_12; | |
2023 case 2u: | |
2024 v3 = pActor; | |
2025 v4 = pActor->pMonsterInfo.uResWater; | |
2026 goto LABEL_12; | |
2027 case 3u: | |
2028 v3 = pActor; | |
2029 v4 = pActor->pMonsterInfo.uResEarth; | |
2030 goto LABEL_12; | |
2031 case 7u: | |
2032 v3 = pActor; | |
2033 v4 = pActor->pMonsterInfo.uResMind; | |
2034 goto LABEL_12; | |
2035 case 6u: | |
2036 v3 = pActor; | |
2037 v4 = pActor->pMonsterInfo.uResSpirit; | |
2038 goto LABEL_12; | |
2039 case 8u: | |
2040 v3 = pActor; | |
2041 v4 = pActor->pMonsterInfo.uResBody; | |
2042 goto LABEL_12; | |
2043 case 9u: | |
2044 v3 = pActor; | |
2045 v4 = pActor->pMonsterInfo.uResLight; | |
2046 goto LABEL_12; | |
2047 case 0xAu: | |
2048 v3 = pActor; | |
2049 v4 = pActor->pMonsterInfo.uResDark; | |
2050 goto LABEL_12; | |
2051 case 4u: | |
2052 v3 = pActor; | |
2053 v4 = pActor->pMonsterInfo.uResPhysical; | |
2054 LABEL_12: | |
2055 if ( v4 < 200 ) | |
2056 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2057 else | |
2058 result = 0; | |
2059 break; | |
2060 default: | |
2061 result = 1; | |
2062 break; | |
2063 } | |
2064 return result; | |
2065 } | |
2066 | |
2067 //----- (00427769) -------------------------------------------------------- | |
2068 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2069 { | |
2070 bool result; // eax@2 | |
2071 | |
710 | 2072 __debugbreak(); // refactor |
0 | 2073 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2074 result = 1; | |
2075 else | |
2076 result = 0; | |
2077 return result; | |
2078 } | |
2079 | |
2080 //----- (0042777D) -------------------------------------------------------- | |
319 | 2081 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2082 { |
370 | 2083 //bool result; // eax@2 |
486 | 2084 //__int16 v6; // bx@4 |
437 | 2085 //Player *v7; // eax@4 |
486 | 2086 //char v8; // zf@12 |
0 | 2087 unsigned __int16 v9; // cx@16 |
2088 unsigned int v10; // eax@18 | |
2089 unsigned __int8 v11; // sf@18 | |
2090 unsigned __int8 v12; // of@18 | |
2091 unsigned __int16 v13; // cx@21 | |
2092 unsigned int v14; // eax@23 | |
486 | 2093 //stru277 *v15; // esi@27 |
2094 //stru277 *v16; // eax@28 | |
832 | 2095 //GUIWindow *v17; // eax@43 |
2096 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2097 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2098 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2099 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2100 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2101 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2102 //int v24; // [sp-18h] [bp-30h]@44 | |
2103 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2104 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2105 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2106 //char *v28; // [sp-8h] [bp-20h]@43 | |
2107 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2108 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2109 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2110 | |
2111 //a3a = uPlayerID; | |
2112 //a2a = a1; | |
370 | 2113 |
2114 //if ( pParty->bTurnBasedModeOn != 1 | |
2115 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2116 if (pParty->bTurnBasedModeOn) | |
0 | 2117 { |
370 | 2118 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2119 return; | |
2120 } | |
2121 | |
2122 | |
486 | 2123 //v6 = a5; |
437 | 2124 //v7 = &pParty->pPlayers[uPlayerID]; |
2125 assert(uPlayerID < 4); | |
2126 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2127 if ( !(a5 & 0x10) ) |
2128 { | |
2129 switch ( a1 ) | |
2130 { | |
486 | 2131 case SPELL_SPIRIT_FATE: |
2132 case SPELL_BODY_FIRST_AID: | |
2133 case SPELL_DARK_REANIMATE: | |
2134 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2135 a5 |= 0x0100; | |
0 | 2136 break; |
486 | 2137 |
2138 case SPELL_FIRE_FIRE_AURA: | |
2139 case SPELL_WATER_RECHARGE_ITEM: | |
2140 case SPELL_WATER_ENCHANT_ITEM: | |
2141 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2142 //LOBYTE(v6) = a5 | 0x80; | |
2143 a5 |= 0x0080; | |
0 | 2144 break; |
486 | 2145 |
2146 case SPELL_FIRE_FIRE_BOLT: | |
2147 case SPELL_FIRE_FIREBALL: | |
2148 case SPELL_FIRE_INCINERATE: | |
2149 case SPELL_AIR_LIGHNING_BOLT: | |
2150 case SPELL_AIR_IMPLOSION: | |
2151 case SPELL_WATER_POISON_SPRAY: | |
2152 case SPELL_WATER_ICE_BOLT: | |
2153 case SPELL_WATER_ACID_BURST: | |
2154 case SPELL_WATER_ICE_BLAST: | |
2155 case SPELL_EARTH_STUN: | |
2156 case SPELL_EARTH_SLOW: | |
2157 case SPELL_EARTH_DEADLY_SWARM: | |
2158 case SPELL_EARTH_BLADES: | |
2159 case SPELL_EARTH_MASS_DISTORTION: | |
2160 case SPELL_SPIRIT_SPIRIT_LASH: | |
2161 case SPELL_MIND_MIND_BLAST: | |
2162 case SPELL_MIND_CHARM: | |
2163 case SPELL_MIND_PSYCHIC_SHOCK: | |
2164 case SPELL_BODY_HARM: | |
2165 case SPELL_BODY_FLYING_FIST: | |
2166 case SPELL_LIGHT_LIGHT_BOLT: | |
2167 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2168 case SPELL_LIGHT_SUNRAY: | |
2169 case SPELL_DARK_TOXIC_CLOUD: | |
2170 case SPELL_DARK_SHRINKING_RAY: | |
2171 case SPELL_DARK_SHARPMETAL: | |
2172 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2173 if ( !a6 ) |
486 | 2174 a5 |= 0x0008; |
0 | 2175 break; |
486 | 2176 case SPELL_MIND_TELEPATHY: |
2177 case SPELL_MIND_BERSERK: | |
2178 case SPELL_MIND_ENSLAVE: | |
2179 case SPELL_LIGHT_PARALYZE: | |
2180 case SPELL_DARK_CONTROL_UNDEAD: | |
2181 //LABEL_9: | |
2182 //v6 = a5 | 8; | |
2183 a5 |= 0x0008; | |
0 | 2184 break; |
486 | 2185 |
2186 case SPELL_EARTH_TELEKINESIS: | |
2187 a5 |= 0x0040; | |
2188 break; | |
2189 | |
2190 case SPELL_SPIRIT_BLESS: | |
2191 if (a4 && ~a4 & 0x01C0) | |
2192 goto LABEL_25; | |
2193 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); | |
0 | 2194 goto LABEL_25; |
2195 break; | |
486 | 2196 |
2197 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2198 v9 = a4; |
2199 if ( !a4 ) | |
437 | 2200 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
0 | 2201 goto LABEL_18; |
486 | 2202 |
2203 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2204 v9 = a4; |
2205 if ( !a4 ) | |
437 | 2206 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
0 | 2207 LABEL_18: |
2208 v10 = SkillToMastery(v9); | |
2209 v12 = __OFSUB__(v10, 3); | |
2210 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2211 goto LABEL_24; | |
486 | 2212 |
2213 case SPELL_BODY_HAMMERHANDS: | |
0 | 2214 v13 = a4; |
2215 if ( !a4 ) | |
437 | 2216 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2217 v14 = SkillToMastery(v13); |
2218 v12 = __OFSUB__(v14, 4); | |
2219 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
2220 LABEL_24: | |
2221 if ( v11 ^ v12 ) | |
2222 goto LABEL_25; | |
2223 break; | |
486 | 2224 |
2225 case SPELL_EARTH_STONE_TO_FLESH: | |
2226 case SPELL_SPIRIT_REMOVE_CURSE: | |
2227 case SPELL_SPIRIT_RAISE_DEAD: | |
2228 case SPELL_SPIRIT_RESSURECTION: | |
2229 case SPELL_MIND_REMOVE_FEAR: | |
2230 case SPELL_MIND_CURE_PARALYSIS: | |
2231 case SPELL_MIND_CURE_INSANITY: | |
2232 case SPELL_BODY_CURE_WEAKNESS: | |
2233 case SPELL_BODY_REGENERATION: | |
2234 case SPELL_BODY_CURE_POISON: | |
2235 case SPELL_BODY_CURE_DISEASE: | |
0 | 2236 LABEL_25: |
486 | 2237 //v6 = a5 | 2; |
2238 a5 |= 0x0002; | |
0 | 2239 break; |
486 | 2240 |
2241 case SPELL_DARK_SACRIFICE: | |
2242 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2243 a5 |= 0x0200; | |
0 | 2244 break; |
2245 default: | |
2246 break; | |
2247 } | |
2248 } | |
370 | 2249 |
486 | 2250 |
2251 if (a5 & 0x3CA) | |
0 | 2252 { |
924 | 2253 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2254 for (uint i = 0; i < 10; ++i) |
924 | 2255 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2256 { |
924 | 2257 pCastSpellInfo[i].spellnum = 0; |
486 | 2258 break; |
2259 } | |
0 | 2260 } |
486 | 2261 |
924 | 2262 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
486 | 2263 for (uint i = 0; i < 10; ++i) |
0 | 2264 { |
924 | 2265 auto spell = pCastSpellInfo + i; |
486 | 2266 if (!spell->spellnum) |
2267 continue; | |
2268 | |
2269 spell->spellnum = 0; | |
2270 if (spell->field_8 & 0x3CA) | |
0 | 2271 { |
486 | 2272 pGUIWindow_Settings->Release(); |
2273 pGUIWindow_Settings = nullptr; | |
2274 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2275 GameUI_Footer_TimeLeft = 0; |
486 | 2276 unk_50C9A0 = 0; |
2277 back_to_game(); | |
0 | 2278 } |
2279 } | |
486 | 2280 |
924 | 2281 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2282 if ( result != -1 ) |
2283 { | |
486 | 2284 if ( a5 & 2 ) |
0 | 2285 { |
2286 if ( pGUIWindow_Settings ) | |
319 | 2287 return; |
924 | 2288 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2289 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); |
2290 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); | |
2291 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); | |
2292 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); | |
319 | 2293 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2294 return; | |
0 | 2295 } |
486 | 2296 if ( a5 & 8 ) |
0 | 2297 { |
2298 if ( pGUIWindow_Settings ) | |
319 | 2299 return; |
832 | 2300 |
924 | 2301 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2302 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); |
319 | 2303 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2304 return; | |
0 | 2305 } |
486 | 2306 if ( a5 & 0x40 ) |
0 | 2307 { |
2308 if ( pGUIWindow_Settings ) | |
319 | 2309 return; |
832 | 2310 |
924 | 2311 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2312 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); |
2313 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2314 return; | |
0 | 2315 } |
486 | 2316 if ( (char)a5 < 0 ) |
0 | 2317 { |
2318 if ( pGUIWindow_Settings ) | |
319 | 2319 return; |
0 | 2320 ++pIcons_LOD->uTexturePacksCount; |
2321 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2322 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2323 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2324 unk_50C9A0 = 1; |
2325 some_active_character = uActiveCharacter; | |
319 | 2326 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2327 return; | |
0 | 2328 } |
486 | 2329 if ( HIBYTE(a5) & 1 ) |
0 | 2330 { |
2331 if ( pGUIWindow_Settings ) | |
319 | 2332 return; |
924 | 2333 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2334 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); |
2335 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); | |
2336 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); | |
2337 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); | |
2338 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); | |
423 | 2339 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2340 } |
486 | 2341 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2342 { |
924 | 2343 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
832 | 2344 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2345 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2346 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
0 | 2347 1, |
2348 0, | |
832 | 2349 UIMSG_ScrollNPCPanel, 0, |
0 | 2350 0, |
2351 "", | |
832 | 2352 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2353 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2354 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2355 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
0 | 2356 1, |
2357 0, | |
832 | 2358 UIMSG_ScrollNPCPanel, 1, |
0 | 2359 0, |
2360 "", | |
832 | 2361 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
2362 pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0); | |
2363 pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0); | |
0 | 2364 } |
2365 } | |
2366 } | |
2367 | |
2368 //----- (00427D48) -------------------------------------------------------- | |
924 | 2369 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2370 { |
924 | 2371 CastSpellInfo *v2; // esi@1 |
0 | 2372 signed int v3; // ebx@1 |
2373 | |
2374 v2 = this; | |
2375 v3 = 10; | |
2376 do | |
2377 { | |
2378 if ( v2->spellnum ) | |
2379 { | |
2380 if ( v2->field_8 & 0x3CA ) | |
2381 { | |
2382 v2->spellnum = 0; | |
2383 pGUIWindow_Settings->Release(); | |
2384 pGUIWindow_Settings = 0; | |
2385 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2386 GameUI_Footer_TimeLeft = 0; |
0 | 2387 unk_50C9A0 = 0; |
2388 back_to_game(); | |
2389 } | |
2390 } | |
2391 ++v2; | |
2392 --v3; | |
2393 } | |
2394 while ( v3 ); | |
2395 } | |
2396 | |
2397 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2398 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2399 { |
2400 unsigned int result; // eax@1 | |
924 | 2401 CastSpellInfo *v7; // edx@1 |
2402 CastSpellInfo *v8; // ecx@5 | |
0 | 2403 |
2404 result = 0; | |
2405 v7 = this; | |
2406 while ( v7->spellnum ) | |
2407 { | |
2408 ++result; | |
2409 ++v7; | |
2410 if ( (signed int)result >= 10 ) | |
2411 goto LABEL_8; | |
2412 } | |
2413 v8 = &this[result]; | |
2414 v8->spellnum = a2; | |
2415 v8->uPlayerID = uPlayerID; | |
2416 if ( a5 & 0x10 ) | |
2417 v8->uPlayerID_2 = uPlayerID; | |
2418 v8->field_6 = 0; | |
488 | 2419 v8->spell_target_pid = 0; |
0 | 2420 v8->field_8 = a5; |
488 | 2421 v8->forced_spell_skill_level = skill_level; |
823 | 2422 v8->sound_id = spell_sound_id; |
0 | 2423 LABEL_8: |
2424 if ( result == 10 ) | |
2425 result = -1; | |
2426 return result; | |
2427 } | |
2428 | |
2429 //----- (00427E01) -------------------------------------------------------- | |
924 | 2430 void CastSpellInfo::_427E01_cast_spell() |
0 | 2431 { |
486 | 2432 //int v1; // esi@1 |
0 | 2433 int v2; // edi@1 |
924 | 2434 CastSpellInfo *pCastSpell; // ebx@2 |
488 | 2435 //signed int v4; // eax@8 |
2436 //__int16 v5; // ax@9 | |
0 | 2437 signed int v6; // eax@14 |
488 | 2438 //__int16 v7; // ax@23 |
2439 //__int16 v8; // ax@24 | |
2440 //char v9; // al@44 | |
2441 //int v10; // eax@45 | |
0 | 2442 unsigned __int16 v11; // cx@45 |
822 | 2443 //signed int v12; // ecx@48 |
490 | 2444 //int v13; // eax@53 |
0 | 2445 unsigned __int8 v14; // zf@53 |
488 | 2446 //unsigned int v15; // edx@53 |
2447 //signed int v16; // eax@53 | |
0 | 2448 Player *v17; // esi@70 |
822 | 2449 //int v18; // eax@72 |
823 | 2450 //int v19; // eax@74 |
888 | 2451 Player *v20; // eax@74 |
0 | 2452 signed int i; // esi@76 |
823 | 2453 //int v22; // eax@88 |
0 | 2454 __int16 v23; // ax@88 |
488 | 2455 //int v24; // ecx@93 |
2456 //int v25; // ecx@94 | |
2457 //signed __int64 v26; // qax@100 | |
2458 //char *v27; // ecx@100 | |
2459 //unsigned __int64 v28; // qax@102 | |
0 | 2460 int v29; // ecx@105 |
2461 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2462 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2463 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2464 //char *v33; // edx@113 |
823 | 2465 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2466 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2467 //int v36; // edx@125 |
823 | 2468 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2469 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2470 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2471 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2472 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2473 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2474 //int *v43; // ecx@129 |
823 | 2475 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2476 //int v45; // ecx@132 |
0 | 2477 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2478 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2479 //int v48; // eax@137 |
823 | 2480 //int v49; // eax@137 |
822 | 2481 //int v50; // eax@141 |
0 | 2482 int v51; // eax@146 |
2483 __int16 v52; // ax@153 | |
823 | 2484 //int v53; // eax@153 |
0 | 2485 signed __int64 v54; // qax@164 |
2486 int v55; // edi@164 | |
488 | 2487 //stru6 *v56; // eax@165 |
0 | 2488 int v57; // eax@169 |
2489 signed __int64 v58; // qax@177 | |
2490 int v59; // edi@177 | |
2491 unsigned __int16 v60; // ax@184 | |
2492 int v61; // ecx@184 | |
823 | 2493 //int v62; // eax@186 |
0 | 2494 int v63; // ecx@187 |
2495 int v64; // ecx@188 | |
2496 int v65; // ecx@189 | |
710 | 2497 //const char *v66; // ecx@200 |
2498 //unsigned int v67; // edx@201 | |
0 | 2499 char v68; // al@207 |
89 | 2500 ItemGen *v69; // esi@211 |
0 | 2501 int v70; // ecx@214 |
2502 int v71; // ecx@215 | |
2503 int v72; // ecx@216 | |
488 | 2504 //__int16 v73; // ST1C_2@222 |
2505 //__int16 v74; // ST18_2@222 | |
2506 //stru6 *v75; // eax@222 | |
0 | 2507 int v76; // ecx@223 |
2508 int v77; // ecx@224 | |
2509 int v78; // ecx@225 | |
2510 int v79; // eax@227 | |
488 | 2511 //int v80; // eax@232 |
2512 //__int16 v81; // ST18_2@245 | |
2513 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2514 //signed int v83; // edi@245 |
488 | 2515 //__int16 v84; // ST18_2@245 |
2516 //stru6 *v85; // eax@245 | |
2517 //__int16 v86; // ST18_2@245 | |
2518 //stru6 *v87; // eax@245 | |
2519 //__int16 v88; // ST18_2@245 | |
2520 //stru6 *v89; // eax@245 | |
0 | 2521 double v90; // st7@245 |
2522 int v91; // eax@250 | |
89 | 2523 Player *v92; // eax@255 |
488 | 2524 //__int16 v93; // ST18_2@260 |
2525 //stru6 *v94; // eax@260 | |
2526 //__int16 v95; // ST18_2@260 | |
2527 //stru6 *v96; // eax@260 | |
2528 //__int16 v97; // ST18_2@260 | |
2529 //stru6 *v98; // eax@260 | |
2530 //__int16 v99; // ST18_2@260 | |
2531 //stru6 *v100; // eax@260 | |
0 | 2532 int v101; // ecx@261 |
2533 int v102; // ecx@262 | |
2534 int v103; // ecx@263 | |
2535 int v104; // eax@265 | |
2536 int v105; // edi@271 | |
488 | 2537 //__int16 v106; // ST18_2@272 |
2538 //stru6 *v107; // eax@272 | |
0 | 2539 __int16 v108; // ST1C_2@274 |
2540 __int16 v109; // ST18_2@274 | |
2541 stru6 *v110; // eax@274 | |
2542 int v111; // eax@274 | |
2543 Actor *v112; // esi@278 | |
2544 int v113; // eax@278 | |
2545 int v114; // ebx@278 | |
2546 unsigned int v115; // ecx@278 | |
2547 int v116; // edx@279 | |
2548 int v117; // edx@281 | |
2549 int v118; // edx@283 | |
2550 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2551 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2552 //int v121; // eax@286 |
0 | 2553 signed int v122; // eax@286 |
2554 int v123; // ecx@288 | |
2555 int v124; // ecx@289 | |
2556 int v125; // ecx@290 | |
2557 int v126; // eax@292 | |
2558 int v127; // eax@296 | |
488 | 2559 //__int16 v128; // ST18_2@303 |
2560 //stru6 *v129; // eax@303 | |
2561 //__int16 v130; // ST18_2@303 | |
2562 //stru6 *v131; // eax@303 | |
2563 //__int16 v132; // ST18_2@303 | |
2564 //stru6 *v133; // eax@303 | |
2565 //__int16 v134; // ST18_2@303 | |
2566 //stru6 *v135; // eax@303 | |
2567 //unsigned __int64 v136; // qax@304 | |
2568 //char *v137; // ecx@304 | |
0 | 2569 int v138; // ecx@305 |
2570 int v139; // ecx@306 | |
2571 int v140; // eax@308 | |
488 | 2572 //__int16 v141; // ST18_2@311 |
2573 //stru6 *v142; // eax@311 | |
2574 //__int16 v143; // ST18_2@311 | |
2575 //stru6 *v144; // eax@311 | |
2576 //__int16 v145; // ST18_2@311 | |
2577 //stru6 *v146; // eax@311 | |
2578 //__int16 v147; // ST18_2@311 | |
2579 //stru6 *v148; // eax@311 | |
0 | 2580 int v149; // ecx@312 |
2581 int v150; // ecx@313 | |
2582 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2583 //signed int v152; // eax@322 |
0 | 2584 int v153; // ecx@322 |
2585 int v154; // eax@322 | |
2586 int v155; // eax@323 | |
2587 int v156; // eax@323 | |
2588 int v157; // eax@326 | |
2589 double v158; // st7@326 | |
2590 double v159; // st6@326 | |
2591 signed __int64 v160; // qtt@334 | |
823 | 2592 //int v161; // eax@339 |
0 | 2593 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2594 //int v163; // eax@340 |
0 | 2595 signed int v164; // eax@340 |
2596 signed int v165; // edi@340 | |
488 | 2597 //stru6 *v166; // eax@340 |
2598 //stru6 *v167; // eax@340 | |
0 | 2599 signed int v168; // edi@343 |
2600 int v169; // eax@344 | |
2601 int v170; // ecx@346 | |
2602 int v171; // ecx@347 | |
2603 int v172; // ecx@348 | |
2604 int v173; // edi@350 | |
2605 signed int v174; // edi@355 | |
488 | 2606 //__int16 v175; // ST18_2@357 |
2607 //stru6 *v176; // eax@357 | |
2608 //__int16 v177; // ST18_2@357 | |
2609 //stru6 *v178; // eax@357 | |
2610 //__int16 v179; // ST18_2@357 | |
2611 //stru6 *v180; // eax@357 | |
2612 //__int16 v181; // ST18_2@357 | |
2613 //stru6 *v182; // eax@357 | |
2614 //signed __int64 v183; // qax@357 | |
0 | 2615 int v184; // ecx@358 |
2616 int v185; // ecx@359 | |
2617 int v186; // ecx@360 | |
823 | 2618 //int v187; // eax@367 |
0 | 2619 int v188; // esi@369 |
2620 int v189; // edi@369 | |
710 | 2621 //const char *v190; // ecx@377 |
0 | 2622 signed int v191; // edi@379 |
2623 int v192; // ecx@382 | |
2624 int v193; // ecx@383 | |
2625 int v194; // ecx@384 | |
2626 int v195; // eax@386 | |
2627 int v196; // eax@387 | |
488 | 2628 //__int16 v197; // ST18_2@395 |
2629 //stru6 *v198; // eax@395 | |
2630 //__int16 v199; // ST18_2@395 | |
2631 //stru6 *v200; // eax@395 | |
2632 //__int16 v201; // ST18_2@395 | |
2633 //stru6 *v202; // eax@395 | |
2634 //__int16 v203; // ST18_2@395 | |
2635 //stru6 *v204; // eax@395 | |
0 | 2636 signed int v205; // edi@405 |
2637 int v206; // eax@407 | |
2638 __int16 v207; // cx@407 | |
2639 int v208; // eax@411 | |
2640 signed int v209; // ecx@412 | |
2641 int v210; // edx@412 | |
2642 signed int v211; // ecx@412 | |
2643 int v212; // eax@413 | |
2644 int v213; // eax@413 | |
2645 int v214; // eax@413 | |
2646 int v215; // eax@415 | |
2647 double v216; // st7@415 | |
2648 double v217; // st6@415 | |
2649 signed __int64 v218; // qtt@423 | |
2650 int v219; // ecx@425 | |
2651 int v220; // ecx@426 | |
2652 int v221; // edi@428 | |
890 | 2653 Player *v222; // edi@434 |
0 | 2654 char v223; // al@438 |
2655 int v224; // ecx@442 | |
2656 int v225; // ecx@443 | |
823 | 2657 //int v226; // eax@451 |
0 | 2658 int v227; // esi@453 |
2659 unsigned int v228; // edi@454 | |
2660 int v229; // edi@466 | |
488 | 2661 //__int16 v230; // ST18_2@469 |
2662 //stru6 *v231; // eax@469 | |
2663 //signed int v232; // esi@469 | |
2664 //__int16 v233; // ST18_2@469 | |
2665 //stru6 *v234; // eax@469 | |
2666 //__int16 v235; // ST18_2@469 | |
2667 //stru6 *v236; // eax@469 | |
2668 //__int16 v237; // ST18_2@469 | |
2669 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2670 //__int16 v239; // ST1C_2@469 |
0 | 2671 char *v240; // ecx@472 |
2672 double v241; // st7@478 | |
2673 signed __int64 v242; // qax@484 | |
2674 char *v243; // ecx@484 | |
2675 char *v244; // eax@488 | |
2676 int v245; // edi@492 | |
2677 int v246; // eax@492 | |
2678 char *v247; // eax@497 | |
2679 char v248; // al@497 | |
2680 char v249; // cf@500 | |
2681 float v250; // esi@507 | |
2682 char v251; // al@507 | |
2683 int v252; // edx@510 | |
2684 int m; // esi@510 | |
2685 int v254; // eax@513 | |
2686 int v255; // esi@513 | |
2687 int v256; // ecx@513 | |
2688 int v257; // edx@514 | |
2689 int v258; // ecx@514 | |
2690 char v259; // al@516 | |
2691 int v260; // eax@518 | |
2692 int v261; // esi@519 | |
2693 int v262; // edx@521 | |
2694 int v263; // ecx@521 | |
2695 int v264; // esi@521 | |
2696 int v265; // edx@521 | |
2697 int *ii; // eax@522 | |
2698 int v267; // eax@524 | |
2699 int v268; // eax@524 | |
2700 int v269; // eax@526 | |
2701 char *v270; // eax@531 | |
2702 char v271; // al@531 | |
2703 char v272; // cf@534 | |
2704 float v273; // esi@541 | |
2705 char v274; // al@541 | |
2706 int v275; // edx@544 | |
2707 int k; // esi@544 | |
2708 int v277; // edx@548 | |
2709 int v278; // ecx@548 | |
2710 char v279; // al@550 | |
2711 int v280; // eax@552 | |
2712 int v281; // esi@553 | |
2713 int v282; // edx@555 | |
2714 int v283; // ecx@555 | |
2715 int v284; // esi@555 | |
2716 int v285; // edx@555 | |
2717 int *l; // eax@556 | |
2718 int v287; // eax@558 | |
2719 int v288; // eax@558 | |
2720 ItemGen *v289; // eax@560 | |
2721 signed int v290; // eax@560 | |
2722 unsigned __int8 v291; // al@564 | |
2723 char v292; // al@573 | |
2724 int v293; // eax@575 | |
2725 ItemGen *v294; // esi@575 | |
2726 int v295; // edx@575 | |
2727 int kk; // edi@575 | |
2728 int v297; // edx@579 | |
2729 int v298; // ecx@579 | |
2730 char v299; // al@581 | |
2731 int v300; // eax@583 | |
2732 int v301; // edi@584 | |
2733 int v302; // edx@586 | |
2734 int v303; // ecx@586 | |
2735 int v304; // edi@586 | |
2736 int v305; // edx@586 | |
2737 int *jj; // eax@587 | |
2738 int v307; // eax@589 | |
2739 int v308; // eax@589 | |
2740 char *v309; // ecx@593 | |
2741 char v310; // sf@593 | |
2742 unsigned __int8 v311; // of@593 | |
2743 char v312; // cl@597 | |
488 | 2744 char v313; // al@606pGame->GetStru6() |
0 | 2745 int v314; // edx@607 |
2746 int j; // esi@607 | |
2747 unsigned int v316; // eax@613 | |
2748 const char *v317; // ecx@617 | |
2749 Player *v318; // ecx@619 | |
2750 unsigned int v319; // edi@627 | |
2751 int v320; // ecx@629 | |
2752 int v321; // ecx@630 | |
2753 int v322; // edi@632 | |
2754 int v323; // edi@635 | |
2755 char *v324; // eax@635 | |
2756 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2757 //int v326; // eax@643 |
823 | 2758 //int v327; // eax@648 |
0 | 2759 int v328; // ecx@651 |
2760 int v329; // ecx@652 | |
2761 int v330; // edi@654 | |
488 | 2762 //__int16 v331; // ST18_2@658 |
2763 //stru6 *v332; // eax@658 | |
2764 //__int16 v333; // ST18_2@658 | |
2765 //stru6 *v334; // eax@658 | |
2766 //__int16 v335; // ST18_2@658 | |
2767 //stru6 *v336; // eax@658 | |
2768 //__int16 v337; // ST18_2@658 | |
2769 //stru6 *v338; // eax@658 | |
0 | 2770 int v339; // ecx@659 |
2771 int v340; // ecx@660 | |
2772 int v341; // eax@663 | |
2773 signed int v342; // edi@668 | |
2774 signed int v343; // edi@670 | |
2775 unsigned __int64 v344; // ST08_8@670 | |
488 | 2776 //__int16 v345; // ST1C_2@671 |
2777 //__int16 v346; // ST18_2@671 | |
2778 //stru6 *v347; // eax@671 | |
0 | 2779 int v348; // ecx@672 |
2780 int v349; // ecx@673 | |
2781 int v350; // edi@676 | |
2782 Player *v351; // edi@680 | |
488 | 2783 //__int16 v352; // ST18_2@685 |
2784 //stru6 *v353; // eax@685 | |
0 | 2785 int v354; // ecx@686 |
2786 int v355; // ecx@687 | |
2787 int v356; // eax@689 | |
112 | 2788 Player *v357; // edi@694 |
488 | 2789 //unsigned __int16 v358; // ST1C_2@695 |
2790 //__int16 v359; // ST18_2@695 | |
2791 //stru6 *v360; // eax@695 | |
2792 //__int16 v361; // ST1C_2@697 | |
2793 //__int16 v362; // ST18_2@697 | |
2794 //stru6 *v363; // eax@697 | |
0 | 2795 int v364; // ecx@698 |
2796 int v365; // ecx@699 | |
2797 int v366; // eax@701 | |
488 | 2798 //stru6 *v367; // eax@704 |
823 | 2799 //int v368; // eax@704 |
0 | 2800 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2801 //int v370; // eax@706 |
0 | 2802 int v371; // ecx@709 |
2803 int v372; // ecx@710 | |
2804 int v373; // eax@715 | |
2805 int v374; // eax@717 | |
112 | 2806 Player *v375; // edi@717 |
0 | 2807 int v376; // eax@717 |
2808 Player *v377; // ecx@719 | |
2809 int v378; // ecx@721 | |
2810 int v379; // ecx@722 | |
2811 int v380; // eax@724 | |
2812 int v381; // edi@727 | |
2813 int v382; // ecx@727 | |
2814 Player *v383; // eax@728 | |
2815 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2816 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2817 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2818 //Player *v387; // edi@738 |
0 | 2819 int v388; // edi@740 |
488 | 2820 //unsigned __int16 v389; // ST1C_2@740 |
2821 //__int16 v390; // ST18_2@740 | |
2822 //stru6 *v391; // eax@740 | |
0 | 2823 int v392; // ecx@742 |
2824 int v393; // ecx@743 | |
2825 int v394; // ecx@744 | |
2826 int v395; // edi@747 | |
2827 int v396; // eax@752 | |
2828 int v397; // eax@757 | |
2829 int v398; // eax@757 | |
2830 int v399; // eax@757 | |
2831 char *v400; // esi@757 | |
488 | 2832 //Game *v401; // ecx@759 |
2833 //__int16 v402; // ST1C_2@759 | |
2834 //__int16 v403; // ST18_2@759 | |
2835 //stru6 *v404; // eax@759 | |
0 | 2836 int v405; // ecx@761 |
2837 int v406; // ecx@762 | |
2838 int v407; // edi@765 | |
488 | 2839 //__int16 v408; // ST1C_2@769 |
2840 //__int16 v409; // ST18_2@769 | |
2841 //stru6 *v410; // eax@769 | |
0 | 2842 int v411; // ecx@772 |
2843 int v412; // ecx@773 | |
2844 int v413; // edi@775 | |
488 | 2845 //__int16 v414; // ST1C_2@781 |
2846 //__int16 v415; // ST18_2@781 | |
2847 //stru6 *v416; // eax@781 | |
0 | 2848 int v417; // eax@787 |
2849 int v418; // ecx@789 | |
2850 __int16 v419; // ax@791 | |
2851 signed int v420; // eax@793 | |
2852 int v421; // edx@793 | |
2853 const char *v422; // eax@801 | |
2854 int v423; // ecx@808 | |
2855 int v424; // ecx@809 | |
2856 int v425; // eax@811 | |
2857 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2858 //signed int v427; // eax@820 |
0 | 2859 int v428; // ecx@825 |
2860 int v429; // ecx@826 | |
2861 int v430; // eax@828 | |
488 | 2862 //stru6 *v431; // eax@831 |
823 | 2863 //int v432; // eax@831 |
0 | 2864 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2865 //int v434; // eax@833 |
0 | 2866 int v435; // ecx@837 |
2867 int v436; // ecx@838 | |
488 | 2868 //__int16 v437; // ST1C_2@843 |
2869 //__int16 v438; // ST18_2@843 | |
2870 //stru6 *v439; // eax@843 | |
0 | 2871 int v440; // eax@843 |
2872 int v441; // eax@847 | |
2873 int v442; // ecx@850 | |
2874 int v443; // ecx@851 | |
2875 int v444; // eax@853 | |
2876 signed int v445; // edi@857 | |
2877 int v446; // ecx@862 | |
2878 LevelDecoration *v447; // edi@864 | |
2879 __int16 v448; // ax@864 | |
2880 char *v449; // esi@870 | |
2881 int v450; // eax@870 | |
2882 int v451; // ecx@875 | |
2883 int v452; // ecx@876 | |
2884 int v453; // edi@878 | |
488 | 2885 //__int16 v454; // ST1C_2@884 |
2886 //__int16 v455; // ST18_2@884 | |
2887 //stru6 *v456; // eax@884 | |
0 | 2888 int v457; // ecx@887 |
2889 int v458; // ecx@888 | |
2890 int v459; // eax@890 | |
2891 signed int v460; // eax@895 | |
2892 Actor *v461; // eax@897 | |
2893 unsigned __int16 v462; // cx@897 | |
2894 signed int v463; // edx@897 | |
2895 int v464; // ecx@905 | |
2896 int v465; // ecx@906 | |
2897 int v466; // edi@909 | |
488 | 2898 //__int16 v467; // ST1C_2@913 |
2899 //__int16 v468; // ST18_2@913 | |
2900 //stru6 *v469; // eax@913 | |
0 | 2901 int v470; // edi@913 |
2902 int v471; // eax@917 | |
2903 int v472; // eax@917 | |
2904 char *v473; // esi@918 | |
488 | 2905 //__int16 v474; // ST18_2@920 |
2906 //stru6 *v475; // eax@920 | |
2907 //__int16 v476; // ST18_2@920 | |
2908 //stru6 *v477; // eax@920 | |
2909 //__int16 v478; // ST18_2@920 | |
2910 //stru6 *v479; // eax@920 | |
2911 //__int16 v480; // ST18_2@920 | |
2912 //stru6 *v481; // eax@920 | |
2913 //__int16 v482; // ST18_2@923 | |
2914 //stru6 *v483; // eax@923 | |
2915 //__int16 v484; // ST18_2@923 | |
2916 //stru6 *v485; // eax@923 | |
2917 //__int16 v486; // ST18_2@923 | |
2918 //stru6 *v487; // eax@923 | |
2919 //__int16 v488; // ST18_2@923 | |
2920 //stru6 *v489; // eax@923 | |
2921 //__int16 v490; // ST1C_2@924 | |
2922 //__int16 v491; // ST18_2@924 | |
2923 //stru6 *v492; // eax@924 | |
0 | 2924 int v493; // ecx@925 |
2925 int v494; // ecx@926 | |
488 | 2926 //__int16 v495; // ST1C_2@931 |
2927 //__int16 v496; // ST18_2@931 | |
2928 //stru6 *v497; // eax@931 | |
0 | 2929 int v498; // edi@931 |
2930 int v499; // eax@935 | |
2931 int v500; // eax@935 | |
2932 Player *v501; // edi@939 | |
488 | 2933 //__int16 v502; // ST18_2@940 |
2934 //stru6 *v503; // eax@940 | |
2935 //stru6 *v504; // eax@943 | |
0 | 2936 int v505; // eax@943 |
823 | 2937 //int v506; // eax@943 |
0 | 2938 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2939 //int v508; // eax@944 |
0 | 2940 signed int v509; // eax@944 |
2941 signed int v510; // edi@944 | |
2942 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2943 //int v512; // eax@946 |
0 | 2944 SpellBuff *v513; // edi@946 |
2945 int v514; // ecx@950 | |
2946 int v515; // ecx@951 | |
2947 int v516; // eax@953 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2948 //int v517; // eax@956 |
90 | 2949 Actor *v518; // edx@957 |
0 | 2950 __int16 v519; // cx@958 |
2951 int v520; // ecx@968 | |
2952 int v521; // ecx@969 | |
2953 int v522; // eax@971 | |
488 | 2954 //__int16 v523; // ST18_2@975 |
2955 //stru6 *v524; // eax@975 | |
2956 //__int16 v525; // ST18_2@975 | |
2957 //stru6 *v526; // eax@975 | |
2958 //__int16 v527; // ST18_2@975 | |
2959 //stru6 *v528; // eax@975 | |
2960 //__int16 v529; // ST18_2@975 | |
2961 //stru6 *v530; // eax@975 | |
0 | 2962 int v531; // eax@982 |
823 | 2963 //int v532; // eax@982 |
0 | 2964 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2965 //int v534; // eax@983 |
0 | 2966 signed int v535; // eax@983 |
2967 signed int v536; // edi@983 | |
2968 stru6 *v537; // eax@984 | |
2969 int v538; // ecx@985 | |
2970 int v539; // ecx@986 | |
2971 int v540; // eax@988 | |
488 | 2972 //__int16 v541; // ST18_2@991 |
2973 //stru6 *v542; // eax@991 | |
2974 //__int16 v543; // ST18_2@991 | |
2975 //stru6 *v544; // eax@991 | |
2976 //__int16 v545; // ST18_2@991 | |
2977 //stru6 *v546; // eax@991 | |
2978 //__int16 v547; // ST18_2@991 | |
0 | 2979 stru6 *v548; // eax@991 |
2980 double v549; // st7@991 | |
2981 unsigned __int16 v550; // di@991 | |
2982 int v551; // ecx@993 | |
2983 int v552; // ecx@994 | |
89 | 2984 Player *v553; // edi@1001 |
488 | 2985 //__int16 v554; // ST18_2@1002 |
2986 //stru6 *v555; // eax@1002 | |
2987 //__int16 v556; // ST18_2@1002 | |
2988 //stru6 *v557; // eax@1002 | |
2989 //__int16 v558; // ST18_2@1002 | |
2990 //stru6 *v559; // eax@1002 | |
2991 //__int16 v560; // ST18_2@1002 | |
2992 //stru6 *v561; // eax@1002 | |
0 | 2993 unsigned __int16 v562; // di@1005 |
2994 signed int v563; // eax@1010 | |
2995 unsigned int v564; // ecx@1011 | |
2996 signed int v565; // eax@1012 | |
2997 Player **v566; // ecx@1012 | |
2998 int v567; // eax@1012 | |
488 | 2999 //unsigned __int16 v568; // ST1C_2@1012 |
3000 //__int16 v569; // ST18_2@1012 | |
3001 //stru6 *v570; // eax@1012 | |
0 | 3002 Player *v571; // eax@1013 |
3003 char *v572; // ecx@1013 | |
3004 int v573; // ecx@1017 | |
3005 int v574; // ecx@1018 | |
3006 int v575; // eax@1020 | |
3007 signed int v576; // eax@1025 | |
3008 Player *v577; // eax@1026 | |
3009 int v578; // eax@1028 | |
3010 __int16 v579; // ax@1029 | |
823 | 3011 //int v580; // eax@1031 |
0 | 3012 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3013 //int v582; // eax@1031 |
488 | 3014 //__int16 v583; // ST1C_2@1034 |
3015 //__int16 v584; // ST18_2@1034 | |
0 | 3016 char *v585; // esi@1034 |
488 | 3017 //stru6 *v586; // eax@1034 |
0 | 3018 signed int v587; // eax@1035 |
3019 int v588; // ecx@1036 | |
3020 int v589; // ecx@1037 | |
3021 int v590; // ecx@1038 | |
3022 char v591; // al@1048 | |
3023 int v592; // esi@1052 | |
3024 int v593; // ecx@1057 | |
3025 int v594; // ecx@1058 | |
823 | 3026 //int v595; // eax@1064 |
0 | 3027 int v596; // esi@1066 |
3028 unsigned int v597; // edi@1067 | |
3029 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3030 //signed int v599; // eax@1082 |
0 | 3031 int v600; // edi@1086 |
3032 int v601; // edx@1086 | |
3033 int v602; // eax@1086 | |
3034 int v603; // ecx@1086 | |
823 | 3035 //int v604; // eax@1087 |
0 | 3036 char *v605; // eax@1089 |
3037 int v606; // edx@1091 | |
3038 int v607; // ecx@1100 | |
3039 __int16 v608; // ax@1102 | |
3040 signed int v609; // eax@1104 | |
3041 int v610; // edi@1106 | |
3042 unsigned int v611; // eax@1106 | |
89 | 3043 Player *v612; // edi@1106 |
3044 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3045 int v614; // eax@1116 |
3046 int v615; // edi@1119 | |
488 | 3047 //__int16 v616; // ST1C_2@1122 |
3048 //__int16 v617; // ST18_2@1122 | |
3049 //stru6 *v618; // eax@1122 | |
112 | 3050 Player *v619; // edi@1123 |
488 | 3051 //unsigned __int16 v620; // ST1C_2@1124 |
3052 //__int16 v621; // ST18_2@1124 | |
3053 //stru6 *v622; // eax@1124 | |
0 | 3054 signed __int64 v623; // qax@1127 |
823 | 3055 //int v624; // eax@1127 |
0 | 3056 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3057 //int v626; // eax@1129 |
0 | 3058 signed int v627; // eax@1129 |
3059 signed int v628; // edi@1129 | |
3060 int v629; // ecx@1130 | |
3061 Player *v630; // eax@1131 | |
3062 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3063 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3064 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3065 //signed int v634; // eax@1140 |
0 | 3066 int v635; // edi@1142 |
488 | 3067 //unsigned __int16 v636; // ST1C_2@1142 |
3068 //__int16 v637; // ST18_2@1142 | |
3069 //stru6 *v638; // eax@1142 | |
3070 //stru6 *v639; // eax@1143 | |
0 | 3071 int v640; // ecx@1146 |
3072 int v641; // ecx@1147 | |
3073 int v642; // edi@1156 | |
3074 int v643; // eax@1156 | |
3075 int v644; // eax@1156 | |
3076 signed int v645; // eax@1158 | |
488 | 3077 //Player *v646; // ebx@1169 |
3078 //int v647; // edi@1169 | |
3079 //signed int v648; // ST1C_4@1170 | |
3080 //Player *v649; // ecx@1170 | |
3081 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3082 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3083 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3084 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3085 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3086 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3087 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3088 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3089 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3090 int v659; // [sp+0h] [bp-E84h]@123 |
3091 int v660; // [sp+0h] [bp-E84h]@146 | |
3092 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3093 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3094 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3095 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3096 int v665; // [sp+0h] [bp-E84h]@807 | |
3097 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3098 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3099 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3100 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3101 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3102 int v671; // [sp+4h] [bp-E80h]@146 |
3103 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3104 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3105 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3106 const char *v675; // [sp+4h] [bp-E80h]@800 |
3107 int v676; // [sp+4h] [bp-E80h]@807 | |
3108 int v677; // [sp+4h] [bp-E80h]@861 | |
3109 int v678; // [sp+4h] [bp-E80h]@997 | |
3110 int v679; // [sp+14h] [bp-E70h]@515 | |
3111 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3112 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3113 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3114 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3115 int v684; // [sp+D04h] [bp-180h]@416 | |
3116 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3117 int x; // [sp+D20h] [bp-164h]@327 | |
3118 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3119 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3120 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3121 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3122 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3123 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3124 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3125 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3126 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3127 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3128 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3129 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3130 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3131 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3132 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3133 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3134 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3135 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3136 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3137 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3138 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3139 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3140 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3141 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
924 | 3142 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
0 | 3143 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3144 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3145 int n; // [sp+DA0h] [bp-E4h]@1 | |
3146 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3147 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3148 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3149 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3150 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3151 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3152 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
|
3153 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3154 int v723; // [sp+E4Ch] [bp-38h]@1 |
3155 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3156 float v725; // [sp+E54h] [bp-30h]@23 | |
3157 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3158 //int v726b; |
0 | 3159 float v727; // [sp+E5Ch] [bp-28h]@1 |
3160 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3161 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3162 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3163 Player *v730b; |
3164 ItemGen *v730c; | |
0 | 3165 int v731; // [sp+E6Ch] [bp-18h]@48 |
3166 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3167 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3168 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3169 int amount; // [sp+E80h] [bp-4h]@1 | |
3170 | |
924 | 3171 //auto ecx0 = this; |
3172 | |
3173 //v711 = ecx0; | |
3174 | |
3175 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
|
3176 //SpriteObject::SpriteObject(&a1); |
0 | 3177 |
486 | 3178 //v1 = 0; |
0 | 3179 v2 = 0; |
3180 amount = 0; | |
3181 LODWORD(v733) = 0; | |
3182 v723 = 0; | |
3183 v727 = 0.0; | |
889 | 3184 //n = 0; |
3185 //while ( 1 ) | |
3186 for(n = 0; n < 10; ++n) | |
0 | 3187 { |
924 | 3188 pCastSpell = &this[n]; |
3189 HIDWORD(v733) = (int)pCastSpell; | |
3190 if ( pCastSpell->spellnum == 0 ) | |
889 | 3191 continue; |
486 | 3192 |
3193 if (pParty->Invisible()) | |
3194 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3195 | |
924 | 3196 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 3197 { |
924 | 3198 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3199 this->_427D48(1); | |
889 | 3200 continue; |
0 | 3201 } |
924 | 3202 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3203 | |
3204 a2 = pCastSpell->spell_target_pid; | |
3205 if (!pCastSpell->spell_target_pid) | |
0 | 3206 { |
924 | 3207 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3208 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3209 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 3210 v666 = 1; |
3211 else | |
3212 v666 = 0; | |
3213 | |
3214 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3215 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3216 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3217 a2 = pMouse->uPointingObjectID; |
0 | 3218 } |
488 | 3219 |
3220 | |
924 | 3221 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3222 if (pSpellSprite.uType) | |
0 | 3223 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3224 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3225 { |
924 | 3226 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3227 v2 = v723; |
3228 } | |
3229 else | |
3230 { | |
3231 v715.uYawAngle = pParty->sRotationY; | |
3232 v715.uPitchAngle = pParty->sRotationX; | |
3233 } | |
3234 } | |
488 | 3235 |
486 | 3236 LODWORD(v725) = 0; |
3237 _this = 0; | |
924 | 3238 if (pCastSpell->forced_spell_skill_level) |
488 | 3239 { |
924 | 3240 v11 = pCastSpell->forced_spell_skill_level; |
488 | 3241 v723 = v11 & 0x3F; |
3242 v2 = v723; | |
3243 } | |
3244 else | |
0 | 3245 { |
488 | 3246 //v667 = PLAYER_SKILL_STAFF; |
924 | 3247 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 3248 v667 = PLAYER_SKILL_FIRE; |
924 | 3249 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 3250 v667 = PLAYER_SKILL_AIR; |
924 | 3251 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 3252 v667 = PLAYER_SKILL_WATER; |
924 | 3253 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 3254 v667 = PLAYER_SKILL_EARTH; |
924 | 3255 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 3256 v667 = PLAYER_SKILL_SPIRIT; |
924 | 3257 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 3258 v667 = PLAYER_SKILL_MIND; |
924 | 3259 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 3260 v667 = PLAYER_SKILL_BODY; |
924 | 3261 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 3262 v667 = PLAYER_SKILL_LIGHT; |
924 | 3263 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 3264 v667 = PLAYER_SKILL_DARK; |
924 | 3265 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 3266 v667 = PLAYER_SKILL_BOW; |
3267 else assert(false && "Unknown spell"); | |
3268 | |
0 | 3269 LODWORD(v725) = v667; |
488 | 3270 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3271 v2 = v723; | |
3272 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3273 } |
488 | 3274 |
0 | 3275 if ( HIBYTE(v11) & 1 ) |
3276 { | |
3277 v731 = 4; | |
3278 } | |
3279 else | |
3280 { | |
3281 if ( (v11 & 0x80u) == 0 ) | |
3282 { | |
3283 v731 = ((v11 & 0x40) != 0) + 1; | |
3284 } | |
3285 else | |
3286 { | |
3287 v731 = 3; | |
3288 } | |
3289 } | |
488 | 3290 |
924 | 3291 if (pCastSpell->forced_spell_skill_level) |
486 | 3292 uRequiredMana = 0; |
488 | 3293 else |
924 | 3294 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3295 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3296 |
3297 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3298 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3299 uRequiredMana = 0; |
488 | 3300 |
924 | 3301 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3302 { | |
3303 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
3304 pCastSpell->spellnum = 0; | |
3305 continue; | |
3306 } | |
3307 v730 = pCastSpell->spellnum; | |
3308 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
3309 { | |
3310 if (!pParty->bTurnBasedModeOn) | |
3311 { | |
3312 //v646 = pPlayer; | |
3313 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3314 //v647 = n; | |
3315 } | |
3316 else | |
3317 { | |
3318 //v647 = n; | |
3319 //v646 = pPlayer; | |
3320 //v648 = sRecoveryTime; | |
3321 //v649 = pPlayer; | |
3322 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
3323 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3324 pTurnEngine->_40471C(); | |
3325 } | |
3326 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3327 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3328 this[n].spellnum = 0; | |
3329 pPlayer->sMana -= uRequiredMana; | |
3330 return; | |
3331 } | |
3332 | |
3333 switch ( pCastSpell->spellnum ) | |
3334 { | |
3335 case SPELL_101: | |
3336 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3337 case SPELL_BOW_ARROW: | |
3338 { | |
3339 v17 = pPlayer; | |
3340 _this = (ItemGen *)1; | |
3341 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3342 _this = (ItemGen *)2; | |
3343 sRecoveryTime = v17->GetAttackRecoveryTime(true); | |
3344 pSpellSprite.stru_24.Reset(); | |
3345 pSpellSprite.spell_level = v2; | |
3346 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3347 pSpellSprite.spell_skill = v731; | |
3348 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3349 if ( v17->WearsItem(510, 2) ) | |
3350 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3351 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3352 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3353 pSpellSprite.uAttributes = 0; | |
3354 pSpellSprite.uSpriteFrameID = 0; | |
3355 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3356 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3357 pSpellSprite.spell_target_pid = a2; | |
3358 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3359 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3360 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3361 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
3362 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | |
3363 pSpellSprite.uAttributes = 256; | |
3364 if ( pParty->bTurnBasedModeOn == 1 ) | |
3365 pSpellSprite.uAttributes = 260; | |
3366 for ( i = 0; i < (signed int)_this; ++i ) | |
3367 { | |
3368 if ( i ) | |
3369 pSpellSprite.vPosition.z += 32; | |
3370 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3371 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3372 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3373 ++pTurnEngine->field_1C; | |
3374 } | |
3375 break; | |
3376 } | |
3377 case SPELL_LASER_PROJECTILE: | |
3378 { | |
3379 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3380 pSpellSprite.stru_24.Reset(); | |
3381 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3382 pSpellSprite.spell_level = v723; | |
3383 pSpellSprite.spell_skill = v731; | |
3384 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3385 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3386 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3387 pSpellSprite.uAttributes = 0; | |
3388 pSpellSprite.uSpriteFrameID = 0; | |
3389 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3390 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3391 pSpellSprite.spell_target_pid = a2; | |
3392 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3393 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3394 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3395 memcpy(&pSpellSprite.stru_24, | |
3396 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3397 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3398 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3399 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3400 pSpellSprite.uSectorID = v23; | |
889 | 3401 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3402 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3403 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3404 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3405 ++pTurnEngine->field_1C; |
924 | 3406 break; |
3407 } | |
3408 case SPELL_FIRE_TORCH_LIGHT: | |
3409 { | |
889 | 3410 LODWORD(v733) = 3600 * v2; |
3411 | |
3412 switch (v731) | |
3413 { | |
890 | 3414 case 1: amount = 2; break; |
3415 case 2: amount = 3; break; | |
3416 case 3: | |
3417 case 4: amount = 4; break; | |
3418 default: | |
889 | 3419 assert(false); |
3420 } | |
3421 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3422 break; |
889 | 3423 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3424 LODWORD(v727) = 1; | |
890 | 3425 break; |
924 | 3426 } |
3427 case SPELL_FIRE_FIRE_SPIKE: | |
3428 { | |
890 | 3429 v29 = v731 - 2; |
3430 if ( v29 ) | |
3431 { | |
3432 v30 = v29 - 1; | |
3433 if ( v30 ) | |
3434 { | |
3435 if ( v30 == 1 ) | |
3436 amount = 9; | |
3437 else | |
3438 amount = 3; | |
889 | 3439 } |
3440 else | |
3441 { | |
890 | 3442 amount = 7; |
3443 } | |
3444 } | |
3445 else | |
3446 { | |
3447 amount = 5; | |
3448 } | |
3449 //v31 = v3->uPlayerID; | |
3450 //v32 = 8 * v31; | |
3451 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3452 | |
3453 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3454 int _v733 = 0; | |
3455 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3456 { | |
3457 auto object = pSpriteObjects + i; | |
924 | 3458 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
890 | 3459 ++_v733; |
3460 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3461 v730 = uNumSpriteObjects; | |
3462 do | |
3463 { | |
3464 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3465 ++HIDWORD(v733); | |
3466 v33 += 112; | |
3467 --v730; | |
3468 } | |
3469 while ( v730 );*/ | |
3470 } | |
3471 if (_v733 > amount) | |
3472 { | |
3473 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3474 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3475 pCastSpell->spellnum = 0; |
890 | 3476 continue; |
3477 } | |
3478 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3479 break; | |
924 | 3480 pSpellSprite.stru_24.Reset(); |
3481 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3482 pSpellSprite.spell_level = v2; | |
3483 pSpellSprite.spell_skill = v731; | |
3484 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3485 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3486 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3487 pSpellSprite.uAttributes = 0; | |
3488 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3489 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3490 pSpellSprite.uSpriteFrameID = 0; | |
3491 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3492 pSpellSprite.spell_target_pid = a2; | |
3493 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3494 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3495 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 3496 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3497 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3498 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3499 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 3500 ++pTurnEngine->field_1C; |
3501 LODWORD(v727) = 1; | |
3502 break; | |
924 | 3503 } |
3504 case SPELL_AIR_IMPLOSION: | |
3505 { | |
890 | 3506 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3507 break; | |
3508 if (!a2) | |
3509 { | |
3510 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3511 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3512 pCastSpell->spellnum = 0; |
890 | 3513 continue; |
3514 } | |
3515 if (PID_TYPE(a2) != OBJECT_Actor) | |
3516 { | |
889 | 3517 LODWORD(v727) = 1; |
890 | 3518 break; |
3519 } | |
3520 v697.x = 0; | |
3521 v697.y = 0; | |
3522 v697.z = 0; | |
924 | 3523 pSpellSprite.stru_24.Reset(); |
3524 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3525 pSpellSprite.spell_level = v2; | |
3526 pSpellSprite.spell_skill = v731; | |
3527 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3528 pSpellSprite.uAttributes = 0; | |
3529 pSpellSprite.uSectorID = 0; | |
3530 pSpellSprite.uSpriteFrameID = 0; | |
3531 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3532 pSpellSprite.uFacing = 0; | |
3533 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3534 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3535 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3536 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3537 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3538 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3539 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3540 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3541 LODWORD(v727) = 1; | |
3542 break; | |
924 | 3543 } |
3544 case SPELL_EARTH_MASS_DISTORTION: | |
3545 { | |
890 | 3546 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3547 break; | |
3548 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3549 { | |
3550 LODWORD(v727) = 1; | |
3551 break; | |
3552 } | |
3553 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3554 v704.x = 0; | |
3555 v704.y = 0; | |
3556 v704.z = 0; | |
924 | 3557 pSpellSprite.stru_24.Reset(); |
3558 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3559 pSpellSprite.spell_level = v2; | |
3560 pSpellSprite.spell_skill = v731; | |
3561 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3562 pSpellSprite.uAttributes = 0; | |
3563 pSpellSprite.uSectorID = 0; | |
3564 pSpellSprite.uSpriteFrameID = 0; | |
3565 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3566 pSpellSprite.uFacing = 0; | |
3567 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3568 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3569 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3570 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3571 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3572 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3573 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3574 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3575 LODWORD(v727) = 1; | |
3576 break; | |
924 | 3577 } |
3578 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3579 { | |
890 | 3580 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3581 break; | |
3582 //v730 = a2 >> 3; | |
3583 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3584 v691.x = 0; | |
3585 v691.y = 0; | |
3586 v691.z = 0; | |
924 | 3587 pSpellSprite.stru_24.Reset(); |
3588 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3589 pSpellSprite.spell_level = v2; | |
3590 pSpellSprite.spell_skill = v731; | |
3591 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3592 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3593 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3594 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3595 pSpellSprite.uAttributes = 0; | |
3596 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3597 pSpellSprite.uSpriteFrameID = 0; | |
3598 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3599 pSpellSprite.spell_target_pid = a2; | |
3600 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3601 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3602 pSpellSprite.uAttributes |= 0x80u; | |
3603 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3604 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 3605 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3606 { | |
3607 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3608 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3609 pCastSpell->spellnum = 0; |
890 | 3610 continue; |
3611 } | |
3612 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3613 LODWORD(v727) = 1; | |
3614 break; | |
924 | 3615 } |
3616 case SPELL_FIRE_FIRE_BOLT: | |
3617 case SPELL_FIRE_FIREBALL: | |
3618 case SPELL_FIRE_INCINERATE: | |
3619 case SPELL_AIR_LIGHNING_BOLT: | |
3620 case SPELL_WATER_ICE_BOLT: | |
3621 case SPELL_WATER_ICE_BLAST: | |
3622 case SPELL_EARTH_STUN: | |
3623 case SPELL_EARTH_DEADLY_SWARM: | |
3624 case SPELL_MIND_MIND_BLAST: | |
3625 case SPELL_MIND_PSYCHIC_SHOCK: | |
3626 case SPELL_BODY_HARM: | |
3627 case SPELL_LIGHT_LIGHT_BOLT: | |
3628 case SPELL_DARK_DRAGON_BREATH: | |
3629 { | |
889 | 3630 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3631 break; |
924 | 3632 pSpellSprite.stru_24.Reset(); |
3633 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3634 pSpellSprite.spell_level = v2; | |
3635 pSpellSprite.spell_skill = v731; | |
3636 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3637 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3638 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3639 pSpellSprite.uAttributes = 0; | |
3640 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3641 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3642 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3643 else | |
3644 pSpellSprite.uSectorID = 0; | |
3645 pSpellSprite.uSpriteFrameID = 0; | |
3646 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3647 pSpellSprite.spell_target_pid = a2; | |
3648 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3649 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3650 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3651 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3652 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3653 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3654 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3655 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3656 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3657 ++pTurnEngine->field_1C; |
3658 LODWORD(v727) = 1; | |
890 | 3659 break; |
924 | 3660 } |
3661 case SPELL_WATER_ACID_BURST: | |
3662 case SPELL_EARTH_BLADES: | |
3663 case SPELL_BODY_FLYING_FIST: | |
3664 case SPELL_DARK_TOXIC_CLOUD: | |
3665 { | |
889 | 3666 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3667 break; |
924 | 3668 pSpellSprite.stru_24.Reset(); |
3669 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3670 pSpellSprite.spell_level = v2; | |
3671 pSpellSprite.spell_skill = v731; | |
3672 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3673 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3674 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3675 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3676 v660 = pParty->vPosition.y; | |
3677 goto LABEL_153; | |
924 | 3678 } |
3679 case SPELL_LIGHT_SUNRAY: | |
3680 { | |
889 | 3681 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
890 | 3682 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3683 { | |
3684 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3685 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3686 pCastSpell->spellnum = 0; |
890 | 3687 continue; |
889 | 3688 } |
3689 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3690 { |
3691 pSpellSprite.stru_24.Reset(); | |
3692 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3693 pSpellSprite.spell_skill = v731; | |
3694 pSpellSprite.spell_level = v2; | |
3695 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3696 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3697 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3698 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3699 v660 = pParty->vPosition.y; | |
3700 goto LABEL_153; | |
3701 } | |
3702 break; | |
3703 } | |
3704 case SPELL_LIGHT_PARALYZE: | |
3705 { | |
890 | 3706 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3707 break; | |
924 | 3708 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3709 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
890 | 3710 { |
3711 LODWORD(v727) = 1; | |
3712 break; | |
3713 } | |
3714 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3715 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3716 v55 = v721; | |
3717 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3718 *(char *)(v55 + 38) |= 8u; | |
3719 *(short *)(v55 + 148) = 0; | |
3720 v672 = 0; | |
3721 *(short *)(v55 + 150) = 0; | |
3722 v661 = (Actor *)v55; | |
3723 goto LABEL_165; | |
924 | 3724 } |
3725 case SPELL_EARTH_SLOW: | |
3726 { | |
889 | 3727 if ( v731 == 2 ) |
3728 { | |
890 | 3729 v57 = 300 * v2; |
889 | 3730 } |
3731 else | |
3732 { | |
890 | 3733 if ( v731 == 3 ) |
3734 { | |
889 | 3735 amount = 4; |
3736 v57 = 300 * v2; | |
3737 goto LABEL_174; | |
890 | 3738 } |
3739 if ( v731 == 4 ) | |
3740 { | |
889 | 3741 v57 = 300 * v2; |
3742 amount = 8; | |
3743 goto LABEL_174; | |
890 | 3744 } |
3745 v57 = 180 * v2; | |
889 | 3746 } |
3747 amount = 2; | |
3748 LABEL_174: | |
3749 LODWORD(v733) = v57; | |
3750 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3751 break; |
889 | 3752 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3753 || (v721 = 836 * PID_ID(a2), |
3754 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3755 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3756 { | |
3757 LODWORD(v727) = 1; | |
3758 break; | |
889 | 3759 } |
3760 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3761 v59 = v721; | |
3762 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3763 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
890 | 3764 v731, |
3765 amount, | |
3766 0, | |
3767 0); | |
889 | 3768 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3769 v672 = 0; | |
3770 v661 = (Actor *)LODWORD(v718); | |
3771 goto LABEL_165; | |
924 | 3772 } |
3773 case SPELL_MIND_CHARM: | |
3774 { | |
890 | 3775 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3776 break; | |
3777 | |
3778 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3779 { | |
3780 LODWORD(v727) = 1; | |
3781 break; | |
3782 } | |
3783 | |
3784 uint power = 300 * v2; | |
3785 if ( v731 == 2 ) | |
3786 { | |
3787 power = 600 * v2; | |
3788 } | |
3789 else if ( v731 == 3 ) | |
3790 power = 29030400; | |
3791 | |
3792 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3793 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3794 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3795 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3796 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3797 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3798 v731, 0, 0, 0); | |
924 | 3799 pSpellSprite.stru_24.Reset(); |
3800 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3801 pSpellSprite.spell_level = v2; | |
3802 pSpellSprite.spell_skill = v731; | |
3803 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3804 v61 = PID_ID(a2); |
3805 goto LABEL_1086; | |
924 | 3806 } |
3807 case SPELL_DARK_SHRINKING_RAY: | |
3808 { | |
889 | 3809 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3810 break; |
924 | 3811 pSpellSprite.stru_24.Reset(); |
3812 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3813 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3814 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3815 pSpellSprite.uAttributes = 0; | |
3816 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3817 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3818 pParty->vPosition.x, |
3819 pParty->vPosition.y, | |
3820 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3821 pSpellSprite.uSpriteFrameID = 0; |
3822 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3823 pSpellSprite.spell_target_pid = a2; | |
3824 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3825 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3826 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3827 pSpellSprite.spell_skill = v731; | |
3828 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3829 pSpellSprite.spell_level = 300 * v2; | |
890 | 3830 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3831 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3832 | |
3833 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3834 | |
3835 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3836 ++pTurnEngine->field_1C; |
3837 LODWORD(v727) = 1; | |
890 | 3838 break; |
924 | 3839 } |
3840 case SPELL_FIRE_FIRE_AURA: | |
3841 { | |
889 | 3842 v63 = v731 - 1; |
3843 if ( !v63 ) | |
3844 { | |
890 | 3845 amount = 10; |
3846 LODWORD(v733) = 3600 * v2; | |
3847 } | |
3848 else | |
3849 { | |
889 | 3850 v64 = v63 - 1; |
3851 if ( !v64 ) | |
3852 { | |
890 | 3853 amount = 11; |
3854 LODWORD(v733) = 3600 * v2; | |
3855 } | |
3856 else | |
3857 { | |
889 | 3858 v65 = v64 - 1; |
3859 if ( !v65 ) | |
3860 { | |
890 | 3861 amount = 12; |
889 | 3862 LABEL_195: |
890 | 3863 LODWORD(v733) = 3600 * v2; |
3864 } | |
3865 else if ( v65 == 1 ) | |
3866 { | |
3867 LODWORD(v733) = 0; | |
3868 amount = 12; | |
3869 } | |
3870 } | |
889 | 3871 } |
3872 LABEL_196: | |
3873 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3874 break; |
924 | 3875 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3876 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3877 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3878 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3879 && !v730c->Broken() | |
3880 && !v730c->uSpecEnchantmentType | |
3881 && !v730c->uEnchantmentType | |
3882 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3883 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3884 { | |
3885 v69 = v730c; | |
3886 v14 = v731 == 4; | |
3887 v730c->uSpecEnchantmentType = amount; | |
3888 if ( !v14 ) | |
889 | 3889 { |
890 | 3890 v69->uExpireTime = pParty->uTimePlayed |
3891 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3892 * 0.033333335); | |
3893 v69->uAttributes |= 8u; | |
889 | 3894 } |
890 | 3895 v69->uAttributes |= 0x10u; |
3896 dword_50C9A8 = 256; | |
3897 LODWORD(v727) = 1; | |
3898 break; | |
889 | 3899 } |
3900 | |
3901 dword_50C9D0 = 113; | |
3902 dword_50C9D4 = 0; | |
3903 dword_50C9D8 = 1; | |
3904 | |
3905 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3906 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3907 pCastSpell->spellnum = 0; |
890 | 3908 continue; |
924 | 3909 } |
3910 case SPELL_BODY_REGENERATION: | |
3911 { | |
890 | 3912 v70 = v731 - 1; |
3913 LODWORD(v733) = 3600 * v2; | |
3914 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3915 { | |
3916 v72 = v71 - 1; | |
3917 if ( v72 ) | |
3918 { | |
3919 if ( v72 == 1 ) | |
3920 amount = 10; | |
889 | 3921 } |
3922 else | |
3923 { | |
890 | 3924 amount = 3; |
3925 } | |
3926 } | |
3927 else | |
3928 { | |
3929 amount = 1; | |
3930 } | |
3931 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3932 break; | |
3933 | |
924 | 3934 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3935 | |
3936 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 | 3937 LODWORD(v727) = 1; |
3938 break; | |
924 | 3939 } |
3940 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3941 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3942 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3943 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3944 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3945 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3946 { | |
3947 v76 = v731 - 1; | |
3948 LODWORD(v733) = 3600 * v2; | |
3949 if ( v76 ) | |
3950 { | |
3951 v77 = v76 - 1; | |
3952 if ( v77 ) | |
3953 { | |
3954 v78 = v77 - 1; | |
3955 if ( v78 ) | |
3956 { | |
3957 if ( v78 != 1 ) | |
3958 goto LABEL_232; | |
3959 v79 = 4 * v2; | |
3960 } | |
3961 else | |
3962 { | |
3963 v79 = 3 * v2; | |
3964 } | |
3965 } | |
3966 else | |
3967 { | |
3968 v79 = 2 * v2; | |
3969 } | |
3970 amount = v79; | |
3971 } | |
3972 else | |
3973 { | |
3974 amount = v2; | |
3975 } | |
3976 LABEL_232: | |
3977 //v80 = v3->spellnum; | |
3978 switch (pCastSpell->spellnum) | |
3979 { | |
3980 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3981 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3982 break; | |
3983 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3984 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3985 break; | |
3986 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3987 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3988 break; | |
3989 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3990 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3991 break; | |
3992 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3993 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3994 break; | |
3995 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3996 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3997 break; | |
3998 default: | |
3999 assert(false); | |
4000 continue; | |
4001 } | |
4002 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4003 break; | |
4004 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4005 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4007 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4008 v90 = (double)(signed int)v733 * 4.2666669; | |
4009 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4010 LODWORD(v727) = 1; | |
4011 break; | |
4012 } | |
4013 case SPELL_FIRE_HASTE: | |
4014 { | |
889 | 4015 if ( v731 <= 0 ) |
890 | 4016 goto LABEL_254; |
889 | 4017 if ( v731 <= 2 ) |
4018 { | |
890 | 4019 v91 = 60 * (v2 + 60); |
889 | 4020 } |
4021 else | |
4022 { | |
890 | 4023 if ( v731 == 3 ) |
4024 { | |
889 | 4025 v91 = 180 * (v2 + 20); |
890 | 4026 } |
4027 else | |
4028 { | |
889 | 4029 if ( v731 != 4 ) |
890 | 4030 goto LABEL_254; |
889 | 4031 v91 = 240 * (v2 + 15); |
890 | 4032 } |
889 | 4033 } |
4034 LODWORD(v733) = v91; | |
4035 LABEL_254: | |
4036 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4037 { | |
890 | 4038 v92 = pParty->pPlayers;//[0].pConditions[1]; |
4039 LODWORD(v727) = 1; | |
4040 do | |
4041 { | |
889 | 4042 if ( v92->pConditions ) |
890 | 4043 LODWORD(v727) = 0; |
889 | 4044 ++v92; |
890 | 4045 } |
4046 while ( v92 <= &pParty->pPlayers[3] ); | |
4047 if (LODWORD(v727)) | |
4048 { | |
889 | 4049 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4050 | |
924 | 4051 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4052 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4053 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4054 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4055 } |
4056 } | |
4057 break; | |
924 | 4058 } |
4059 case SPELL_SPIRIT_BLESS: | |
4060 { | |
889 | 4061 v101 = v731 - 1; |
4062 if ( v101 && (v102 = v101 - 1) != 0 ) | |
4063 { | |
890 | 4064 v103 = v102 - 1; |
4065 if ( v103 ) | |
4066 { | |
889 | 4067 if ( v103 != 1 ) |
890 | 4068 goto LABEL_269; |
889 | 4069 v104 = 3600 * (v2 + 1); |
890 | 4070 } |
4071 else | |
4072 { | |
889 | 4073 v104 = 900 * (v2 + 4); |
890 | 4074 } |
889 | 4075 } |
4076 else | |
4077 { | |
890 | 4078 v104 = 300 * (v2 + 12); |
889 | 4079 } |
4080 LODWORD(v733) = v104; | |
4081 LABEL_269: | |
4082 amount = v2 + 5; | |
4083 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4084 break; |
889 | 4085 if ( v731 == 1 ) |
4086 { | |
924 | 4087 v108 = pCastSpell->uPlayerID_2; |
4088 v109 = pCastSpell->spellnum; | |
890 | 4089 v110 = pGame->GetStru6(); |
4090 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 4091 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 4092 //v668 = 0; |
4093 v716 = v111; | |
4094 //v658 = v111; | |
4095 //v653 = amount; | |
4096 //v651 = 1; | |
4097 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4098 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
889 | 4099 //LABEL_103: |
4100 //HIDWORD(v650) = HIDWORD(v28); | |
4101 //LABEL_104: | |
4102 //LODWORD(v650) = v28; | |
924 | 4103 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 | 4104 LODWORD(v727) = 1; |
890 | 4105 break; |
889 | 4106 } |
4107 v105 = 0; | |
4108 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4109 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4110 do | |
4111 { | |
924 | 4112 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 4113 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4114 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4115 ++v730b; | |
4116 ++v105; | |
889 | 4117 } |
4118 while ( v730b <= &pParty->pPlayers[3] ); | |
4119 LODWORD(v727) = 1; | |
890 | 4120 break; |
4121 } | |
4122 case SPELL_SPIRIT_SPIRIT_LASH: | |
4123 { | |
889 | 4124 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4125 { | |
890 | 4126 //v730 = a2 >> 3; |
4127 v112 = &pActors[PID_ID(a2)]; | |
4128 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4129 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4130 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4131 _this = (ItemGen *)v113; | |
4132 v114 = v721; | |
4133 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4134 if ( v113 < v721 ) | |
4135 { | |
889 | 4136 v116 = v113; |
4137 v113 = v721; | |
4138 v114 = v116; | |
890 | 4139 } |
4140 if ( v113 < (signed int)v115 ) | |
4141 { | |
889 | 4142 v117 = v113; |
4143 v113 = (int)v115; | |
4144 v115 = v117; | |
890 | 4145 } |
4146 if ( v114 < (signed int)v115 ) | |
4147 { | |
889 | 4148 v118 = v115; |
4149 v115 = v114; | |
4150 v114 = v118; | |
890 | 4151 } |
4152 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4153 if ( (double)(signed int)this <= 307.2 ) | |
4154 { | |
889 | 4155 v701.x = 0; |
4156 v701.y = 0; | |
4157 v701.z = 0; | |
924 | 4158 pSpellSprite.stru_24.Reset(); |
889 | 4159 v119 = HIDWORD(v733); |
924 | 4160 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4161 pSpellSprite.spell_level = v723; | |
4162 pSpellSprite.spell_skill = v731; | |
4163 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4164 pSpellSprite.uAttributes = 0; | |
4165 pSpellSprite.uSectorID = 0; | |
4166 pSpellSprite.uSpriteFrameID = 0; | |
4167 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4168 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4169 pSpellSprite.uFacing = 0; | |
4170 pSpellSprite.uSoundID = *(short *)(v119 + 16); | |
4171 pSpellSprite.vPosition.x = v112->vPosition.x; | |
4172 pSpellSprite.vPosition.y = v112->vPosition.y; | |
4173 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4174 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
4175 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
889 | 4176 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4177 LODWORD(v727) = 1; | |
890 | 4178 } |
4179 else | |
4180 { | |
889 | 4181 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4182 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4183 *(int *)HIDWORD(v733) = 0; | |
890 | 4184 } |
924 | 4185 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 4186 } |
4187 break; | |
4188 } | |
4189 case SPELL_AIR_SHIELD: | |
4190 case SPELL_EARTH_STONESKIN: | |
4191 case SPELL_SPIRIT_HEROISM: | |
4192 { | |
889 | 4193 v123 = v731 - 1; |
4194 if ( v123 && (v124 = v123 - 1) != 0 ) | |
4195 { | |
890 | 4196 v125 = v124 - 1; |
4197 if ( v125 ) | |
4198 { | |
889 | 4199 if ( v125 != 1 ) |
890 | 4200 goto LABEL_296; |
889 | 4201 v126 = 3600 * (v2 + 1); |
890 | 4202 } |
4203 else | |
4204 { | |
889 | 4205 v126 = 900 * (v2 + 4); |
890 | 4206 } |
889 | 4207 } |
4208 else | |
4209 { | |
890 | 4210 v126 = 300 * (v2 + 12); |
889 | 4211 } |
4212 LODWORD(v733) = v126; | |
4213 LABEL_296: | |
924 | 4214 v127 = pCastSpell->spellnum; |
889 | 4215 if ( v127 == 17 ) |
4216 { | |
890 | 4217 amount = 0; |
4218 LODWORD(v725) = 14; | |
889 | 4219 } |
4220 else | |
4221 { | |
890 | 4222 if ( v127 == 38 ) |
4223 { | |
889 | 4224 LODWORD(v725) = 15; |
4225 amount = v2 + 5; | |
890 | 4226 } |
4227 else | |
4228 { | |
889 | 4229 if ( v127 != 51 ) |
890 | 4230 continue; |
889 | 4231 LODWORD(v725) = 9; |
4232 amount = v2 + 5; | |
890 | 4233 } |
889 | 4234 } |
4235 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4236 break; |
924 | 4237 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4238 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4239 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4240 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4241 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4242 //LABEL_304: | |
4243 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4244 LODWORD(v727) = 1; | |
890 | 4245 break; |
4246 } | |
4247 case SPELL_FIRE_IMMOLATION: | |
4248 { | |
889 | 4249 v138 = v731 - 2; |
4250 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) | |
890 | 4251 v140 = 600 * v2; |
889 | 4252 else |
890 | 4253 v140 = 60 * v2; |
889 | 4254 LODWORD(v733) = v140; |
4255 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4256 break; |
889 | 4257 |
924 | 4258 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4259 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4260 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4261 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4262 |
4263 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4264 LODWORD(v727) = 1; | |
890 | 4265 break; |
4266 } | |
4267 case SPELL_FIRE_METEOR_SHOWER: | |
4268 { | |
889 | 4269 v149 = v731 - 1; |
4270 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4271 { | |
890 | 4272 if ( v151 == 1 ) |
889 | 4273 _this = (ItemGen *)20; |
4274 } | |
4275 else | |
4276 { | |
890 | 4277 _this = (ItemGen *)16; |
889 | 4278 } |
4279 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4280 { | |
890 | 4281 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4282 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4283 pCastSpell->spellnum = 0; |
890 | 4284 continue; |
889 | 4285 } |
4286 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4287 break; |
889 | 4288 LODWORD(v725) = PID_TYPE(a2); |
4289 if (PID_TYPE(a2) == OBJECT_Actor) | |
4290 { | |
890 | 4291 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
4292 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4293 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4294 LODWORD(v727) = v153; | |
889 | 4295 } |
4296 else | |
4297 { | |
890 | 4298 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
4299 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4300 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4301 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4302 v154 = pParty->vPosition.z; | |
889 | 4303 } |
4304 HIDWORD(v733) = v154; | |
4305 v713 = v154 + 2500; | |
4306 v721 = 0; | |
4307 LODWORD(v718) = 0; | |
4308 if ( (signed int)_this > 0 ) | |
4309 { | |
890 | 4310 *(float *)&y = (double)SHIDWORD(v733); |
4311 *(float *)&v732 = (double)v713; | |
4312 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4313 auto _this_cpy = (int)_this; | |
4314 do | |
4315 { | |
924 | 4316 //v157 = rand(); |
889 | 4317 v158 = (double)SLODWORD(v718); |
4318 v718 = v158; | |
4319 v159 = (double)v721; | |
4320 *(float *)&v721 = v159; | |
924 | 4321 a2 = rand() % 1000; |
4322 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; | |
889 | 4323 v725 = v159 * v159; |
4324 *(float *)&_this = v158 * v158; | |
4325 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4326 { | |
890 | 4327 LODWORD(v687) = 0; |
4328 HIDWORD(v687) = 0; | |
889 | 4329 } |
4330 else | |
4331 { | |
890 | 4332 x = (signed __int64)sqrt(*(float *)&_this + v725); |
4333 v687 = __PAIR__( | |
4334 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4335 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
889 | 4336 } |
924 | 4337 pSpellSprite.stru_24.Reset(); |
4338 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4339 pSpellSprite.spell_level = v2; | |
4340 pSpellSprite.spell_skill = v731; | |
4341 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4342 pSpellSprite.uAttributes = 0; | |
4343 pSpellSprite.vPosition.x = uRequiredMana; | |
4344 pSpellSprite.vPosition.y = LODWORD(v727); | |
4345 pSpellSprite.uSectorID = 0; | |
4346 pSpellSprite.vPosition.z = a2 + v713; | |
4347 pSpellSprite.uSpriteFrameID = 0; | |
4348 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4349 pSpellSprite.spell_target_pid = v730; | |
4350 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4351 pSpellSprite.uFacing = v687; | |
4352 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 4353 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4354 pSpellSprite.uAttributes = 4; |
4355 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
890 | 4356 && pParty->bTurnBasedModeOn == 1 ) |
4357 ++pTurnEngine->field_1C; | |
889 | 4358 LODWORD(v718) = rand() % 1024 - 512; |
924 | 4359 //v160 = rand(); |
889 | 4360 v14 = _this_cpy-- == 1; |
924 | 4361 v721 = (unsigned __int64)(rand() % 1024) - 512; |
890 | 4362 } |
4363 while ( !v14 ); | |
889 | 4364 } |
4365 LODWORD(v727) = 1; | |
890 | 4366 break; |
4367 } | |
4368 case SPELL_FIRE_INFERNO: | |
4369 { | |
4370 //v67 = 2; | |
4371 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4372 { | |
4373 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4374 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4375 pCastSpell->spellnum = 0; |
890 | 4376 continue; |
4377 } | |
4378 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4379 break; | |
4380 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4381 v700.z = 0; | |
4382 v700.y = 0; | |
4383 v700.x = 0; | |
924 | 4384 pSpellSprite.stru_24.Reset(); |
4385 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4386 pSpellSprite.spell_level = v2; | |
4387 pSpellSprite.spell_skill = v731; | |
4388 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4389 pSpellSprite.uAttributes = 0; | |
4390 pSpellSprite.uSectorID = 0; | |
4391 pSpellSprite.uSpriteFrameID = 0; | |
4392 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4393 pSpellSprite.uFacing = 0; | |
4394 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4395 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4396 a2 = 0; |
4397 if ( (signed int)_v726 > 0 ) | |
4398 { | |
4399 do | |
4400 { | |
4401 v162 = dword_50BF30[a2]; | |
924 | 4402 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4403 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
4404 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4405 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4406 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 4407 v165 = a2; |
4408 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
924 | 4409 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
890 | 4410 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4411 a2 = v165 + 1; | |
4412 } | |
4413 while ( v165 + 1 < (signed int)_v726 ); | |
4414 } | |
4415 LODWORD(v727) = 1; | |
4416 break; | |
4417 } | |
4418 | |
4419 case SPELL_AIR_WIZARD_EYE: | |
4420 { | |
889 | 4421 LODWORD(v733) = 3600 * v2; |
4422 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4423 break; |
889 | 4424 v168 = 0; |
4425 do | |
4426 { | |
890 | 4427 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
4428 v716 = v169; | |
889 | 4429 } |
4430 while ( v168 < 4 ); | |
4431 | |
4432 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4433 LODWORD(v727) = 1; | |
890 | 4434 break; |
4435 } | |
4436 case SPELL_AIR_FEATHER_FALL: | |
4437 { | |
889 | 4438 v170 = v731 - 1; |
4439 if ( !v170 ) | |
4440 { | |
890 | 4441 v173 = 300 * v2; |
4442 goto LABEL_353; | |
889 | 4443 } |
4444 v171 = v170 - 1; | |
4445 if ( !v171 ) | |
4446 { | |
890 | 4447 v173 = 600 * v2; |
4448 goto LABEL_353; | |
889 | 4449 } |
4450 v172 = v171 - 1; | |
4451 if ( !v172 || v172 == 1 ) | |
4452 { | |
890 | 4453 v173 = 3600 * v2; |
889 | 4454 LABEL_353: |
890 | 4455 LODWORD(v733) = v173; |
889 | 4456 } |
4457 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4458 break; |
889 | 4459 v174 = 0; |
4460 do | |
890 | 4461 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 4462 while ( v174 < 4 ); |
924 | 4463 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4464 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4465 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4466 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 4467 |
4468 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); | |
4469 LODWORD(v727) = 1; | |
890 | 4470 break; |
4471 } | |
4472 case SPELL_AIR_SPARKS: | |
4473 { | |
4474 v184 = v731 - 1; | |
4475 if ( v184 ) | |
4476 { | |
4477 v185 = v184 - 1; | |
4478 if ( v185 ) | |
4479 { | |
4480 v186 = v185 - 1; | |
4481 if ( v186 ) | |
4482 { | |
4483 if ( v186 == 1 ) | |
4484 amount = 9; | |
4485 } | |
4486 else | |
4487 { | |
4488 amount = 7; | |
4489 } | |
889 | 4490 } |
4491 else | |
4492 { | |
890 | 4493 amount = 5; |
4494 } | |
4495 } | |
4496 else | |
4497 { | |
4498 amount = 3; | |
4499 } | |
4500 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4501 break; | |
4502 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
924 | 4503 pSpellSprite.stru_24.Reset(); |
4504 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4505 pSpellSprite.spell_level = v2; | |
4506 pSpellSprite.spell_skill = v731; | |
4507 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4508 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4509 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4510 pSpellSprite.uAttributes = 0; | |
4511 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4512 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 4513 pParty->vPosition.x, |
4514 pParty->vPosition.y, | |
4515 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 4516 pSpellSprite.uSpriteFrameID = 0; |
4517 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4518 pSpellSprite.spell_target_pid = a2; | |
4519 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4520 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4521 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4522 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4523 v188 = (signed int)_v726 / -2; |
4524 v189 = (signed int)_v726 / 2; | |
4525 while ( v188 <= v189 ) | |
4526 { | |
924 | 4527 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4528 if ( pSpellSprite.Create( | |
890 | 4529 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4530 v715.uPitchAngle, | |
924 | 4531 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4532 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4533 && pParty->bTurnBasedModeOn == 1 ) |
4534 ++pTurnEngine->field_1C; | |
4535 v188 += _v726 / (amount - 1); | |
4536 } | |
4537 LODWORD(v727) = 1; | |
4538 break; | |
4539 } | |
4540 | |
4541 case SPELL_AIR_JUMP: | |
4542 { | |
4543 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4544 { | |
4545 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4546 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4547 break; | |
889 | 4548 } |
4549 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4550 break; |
889 | 4551 v191 = 0; |
4552 do | |
890 | 4553 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 4554 while ( v191 < 4 ); |
4555 BYTE1(pParty->uFlags) |= 1u; | |
4556 pParty->uFallSpeed = 1000; | |
4557 LODWORD(v727) = 1; | |
890 | 4558 break; |
4559 } | |
4560 case SPELL_AIR_INVISIBILITY: | |
4561 { | |
889 | 4562 v192 = v731 - 1; |
4563 if ( !v192 ) | |
4564 { | |
890 | 4565 amount = v2; |
924 | 4566 //goto LABEL_391; |
4567 v195 = 600 * v2; | |
4568 goto LABEL_392; | |
889 | 4569 } |
4570 v193 = v192 - 1; | |
4571 if ( !v193 ) | |
4572 { | |
890 | 4573 v196 = 2 * v2; |
924 | 4574 //LABEL_389: |
890 | 4575 amount = v196; |
924 | 4576 //LABEL_391: |
890 | 4577 v195 = 600 * v2; |
4578 goto LABEL_392; | |
889 | 4579 } |
4580 v194 = v193 - 1; | |
4581 if ( !v194 ) | |
4582 { | |
890 | 4583 v196 = 3 * v2; |
924 | 4584 //goto LABEL_389; |
4585 amount = v196; | |
4586 v195 = 600 * v2; | |
4587 goto LABEL_392; | |
889 | 4588 } |
4589 if ( v194 != 1 ) | |
890 | 4590 goto LABEL_393; |
889 | 4591 amount = 4 * v2; |
4592 v195 = 3600 * v2; | |
4593 LABEL_392: | |
4594 LODWORD(v733) = v195; | |
4595 LABEL_393: | |
4596 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
4597 { | |
890 | 4598 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4599 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4600 pCastSpell->spellnum = 0; |
890 | 4601 continue; |
889 | 4602 } |
4603 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4604 { | |
924 | 4605 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4606 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4607 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4608 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4609 |
4610 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4611 LODWORD(v727) = 1; | |
4612 } | |
4613 break; | |
4614 } | |
4615 case SPELL_AIR_FLY: | |
4616 { | |
4617 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4618 { | |
4619 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4620 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4621 break; | |
4622 } | |
924 | 4623 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4624 { |
4625 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4626 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4627 break; | |
4628 } | |
4629 LODWORD(v733) = 3600 * v2; | |
4630 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4631 amount = 1; | |
4632 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4633 break; | |
4634 v205 = 0; | |
4635 do | |
4636 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4637 while ( v205 < 4 ); | |
4638 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
924 | 4639 v207 = pCastSpell->uPlayerID + 1; |
890 | 4640 v716 = v206; |
4641 | |
4642 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4643 LODWORD(v727) = 1; | |
4644 break; | |
4645 } | |
4646 | |
4647 case SPELL_AIR_STARBURST: | |
4648 { | |
4649 //v67 = 2; | |
4650 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4651 { | |
4652 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4653 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4654 pCastSpell->spellnum = 0; |
890 | 4655 continue; |
4656 } | |
4657 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4658 break; | |
4659 v208 = PID_TYPE(a2); | |
4660 LODWORD(v725) = PID_TYPE(a2); | |
4661 if ( v208 == 3 ) | |
4662 { | |
4663 v209 = PID_ID(a2); | |
4664 LODWORD(v718) = pActors[v209].vPosition.x; | |
4665 v210 = pActors[v209].vPosition.y; | |
4666 v211 = pActors[v209].vPosition.z; | |
4667 v713 = v210; | |
4668 } | |
4669 else | |
4670 { | |
4671 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4672 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4673 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4674 v214 = sub_42EBBE(2048, v213); | |
4675 v211 = pParty->vPosition.z; | |
4676 v713 = pParty->vPosition.y + v214; | |
4677 v208 = LODWORD(v725); | |
4678 } | |
4679 HIDWORD(v733) = 0; | |
4680 *(float *)&v732 = (double)v211; | |
4681 LODWORD(v725) = v211 + 2500; | |
4682 v721 = 0; | |
4683 *(float *)&y = (double)(v211 + 2500); | |
4684 v730 = v208 == 3 ? a2 : 0; | |
4685 a2 = 20; | |
4686 do | |
4687 { | |
4688 v215 = rand(); | |
4689 v216 = (double)v721; | |
4690 v217 = (double)SHIDWORD(v733); | |
4691 *(float *)&uRequiredMana = v217; | |
4692 _this = (ItemGen *)(v215 % 1000); | |
4693 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4694 *(float *)&v721 = v217 * v217; | |
4695 //*(float *)&v726 = v216 * v216; | |
4696 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4697 { | |
4698 LODWORD(v685) = 0; | |
4699 HIDWORD(v685) = 0; | |
889 | 4700 } |
4701 else | |
4702 { | |
890 | 4703 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4704 v685 = __PAIR__( | |
4705 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4706 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4707 } | |
924 | 4708 pSpellSprite.stru_24.Reset(); |
4709 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4710 pSpellSprite.spell_level = v2; | |
4711 pSpellSprite.spell_skill = v731; | |
4712 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4713 pSpellSprite.uAttributes = 0; | |
4714 pSpellSprite.vPosition.x = LODWORD(v718); | |
4715 pSpellSprite.vPosition.y = v713; | |
4716 pSpellSprite.uSectorID = 0; | |
4717 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4718 pSpellSprite.uSpriteFrameID = 0; | |
4719 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4720 pSpellSprite.spell_target_pid = v730; | |
921 | 4721 //__debugbreak();//çâåçäîïàä |
924 | 4722 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4723 pSpellSprite.uFacing = v685; | |
4724 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4725 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4726 pSpellSprite.uAttributes = 4; |
4727 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4728 && pParty->bTurnBasedModeOn == 1 ) | |
4729 ++pTurnEngine->field_1C; | |
890 | 4730 v721 = rand() % 1024 - 512; |
4731 v218 = rand(); | |
4732 v14 = a2-- == 1; | |
4733 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4734 } | |
4735 while ( !v14 ); | |
4736 LODWORD(v727) = 1; | |
4737 break; | |
4738 } | |
4739 | |
4740 case SPELL_WATER_AWAKEN: | |
4741 { | |
4742 v219 = v731 - 2; | |
4743 if ( v219 ) | |
4744 { | |
4745 v220 = v219 - 1; | |
4746 if ( v220 ) | |
4747 { | |
4748 if ( v220 == 1 ) | |
4749 { | |
4750 amount = 0; | |
4751 goto LABEL_433; | |
4752 } | |
4753 v221 = 180 * v2; | |
4754 } | |
4755 else | |
4756 { | |
4757 v221 = 86400 * v2; | |
4758 } | |
889 | 4759 } |
4760 else | |
4761 { | |
890 | 4762 v221 = 3600 * v2; |
4763 } | |
4764 amount = v221; | |
4765 LABEL_433: | |
889 | 4766 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4767 break; |
4768 v222 = pParty->pPlayers; | |
4769 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4770 while ( 2 ) | |
4771 { | |
4772 if ( v731 == 4 ) | |
4773 { | |
4774 if ( v222->pConditions[2] ) | |
4775 { | |
4776 //*((int *)v222 + 4) = 0; | |
4777 //*((int *)v222 + 5) = 0; | |
4778 v222->pConditions[2] = 0; | |
4779 v222->PlaySound(SPEECH_103, 0); | |
4780 } | |
4781 } | |
4782 else | |
889 | 4783 { |
890 | 4784 v223 = v222->DiscardConditionIfLastsLongerThan( |
4785 2u, | |
4786 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4787 v222 = (Player *)HIDWORD(v733); | |
4788 if ( v223 ) | |
4789 v222->PlaySound(SPEECH_103, 0); | |
4790 } | |
4791 ++v222;// += 6972; | |
4792 HIDWORD(v733) = (int)v222; | |
4793 if ( v222 >= &pParty->pPlayers[3] ) | |
4794 { | |
4795 LODWORD(v727) = 1; | |
4796 break; | |
4797 } | |
4798 } | |
4799 } | |
4800 case SPELL_WATER_POISON_SPRAY: | |
4801 { | |
4802 v224 = v731 - 2; | |
4803 if ( v224 ) | |
4804 { | |
4805 v225 = v224 - 1; | |
4806 if ( v225 ) | |
4807 { | |
4808 if ( v225 == 1 ) | |
4809 amount = 7; | |
4810 else | |
4811 amount = 1; | |
4812 } | |
4813 else | |
4814 { | |
4815 amount = 5; | |
889 | 4816 } |
890 | 4817 } |
4818 else | |
4819 { | |
4820 amount = 3; | |
4821 } | |
889 | 4822 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4823 break; |
4824 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4825 if ( amount == 1 ) | |
4826 { | |
924 | 4827 pSpellSprite.stru_24.Reset(); |
4828 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4829 pSpellSprite.spell_skill = v731; | |
4830 pSpellSprite.spell_level = v2; | |
4831 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4832 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4833 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4834 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4835 v660 = pParty->vPosition.y; | |
4836 LABEL_153: | |
924 | 4837 pSpellSprite.uAttributes = 0; |
4838 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4839 pSpellSprite.vPosition.z = v51; | |
890 | 4840 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4841 pSpellSprite.uSpriteFrameID = 0; |
4842 pSpellSprite.uSectorID = v52; | |
4843 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4844 pSpellSprite.spell_target_pid = a2; | |
4845 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4846 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4847 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4848 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4849 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4850 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4851 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4852 ++pTurnEngine->field_1C; | |
890 | 4853 } |
4854 else | |
4855 { | |
924 | 4856 pSpellSprite.stru_24.Reset(); |
4857 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4858 pSpellSprite.spell_level = v2; | |
4859 pSpellSprite.spell_skill = v731; | |
4860 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4861 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4862 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4863 pSpellSprite.uAttributes = 0; | |
4864 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4865 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4866 pSpellSprite.uSpriteFrameID = 0; | |
4867 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4868 pSpellSprite.spell_target_pid = a2; | |
4869 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4870 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4871 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4872 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 4873 v227 = SHIDWORD(v733) / -2; |
4874 y = (char *)(SHIDWORD(v733) / 2); | |
4875 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4876 { | |
4877 v228 = v715.uYawAngle; | |
4878 do | |
4879 { | |
924 | 4880 pSpellSprite.uFacing = v227 + v228; |
4881 if ( pSpellSprite.Create( | |
890 | 4882 v227 + v228, |
4883 v715.uPitchAngle, | |
924 | 4884 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4885 pCastSpell->uPlayerID + 1) != -1 | |
890 | 4886 && pParty->bTurnBasedModeOn == 1 ) |
4887 ++pTurnEngine->field_1C; | |
4888 v227 += SHIDWORD(v733) / (amount - 1); | |
4889 } | |
4890 while ( v227 <= (signed int)y ); | |
4891 } | |
889 | 4892 } |
4893 LODWORD(v727) = 1; | |
890 | 4894 break; |
4895 } | |
4896 case SPELL_WATER_WATER_WALK: | |
4897 { | |
924 | 4898 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
890 | 4899 { |
4900 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4901 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4902 break; | |
4903 } | |
4904 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4905 v229 = 600 * v2; | |
4906 else | |
4907 v229 = 3600 * v2; | |
4908 LODWORD(v733) = v229; | |
4909 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4910 break; | |
4911 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
924 | 4912 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4913 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4915 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 4916 |
4917 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4918 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4919 v731, | |
4920 amount, | |
4921 v716, | |
924 | 4922 pCastSpell->uPlayerID + 1); |
890 | 4923 if ( v731 == 4 ) |
4924 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4925 LODWORD(v727) = 1; | |
4926 break; | |
4927 } | |
4928 case SPELL_WATER_RECHARGE_ITEM: | |
4929 { | |
4930 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4931 break; | |
924 | 4932 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
890 | 4933 y = v240; |
4934 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4935 { | |
4936 dword_50C9D0 = 113; | |
4937 dword_50C9D4 = 0; | |
4938 dword_50C9D8 = 1; | |
4939 | |
4940 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4941 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4942 pCastSpell->spellnum = 0; |
890 | 4943 continue; |
4944 } | |
4945 if ( v731 == 1 || v731 == 2 ) | |
4946 { | |
4947 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4948 } | |
4949 else | |
4950 { | |
4951 if ( v731 == 3 ) | |
4952 { | |
4953 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
889 | 4954 } |
4955 else | |
4956 { | |
890 | 4957 if ( v731 != 4 ) |
4958 { | |
4959 v241 = 0.0; | |
4960 goto LABEL_484; | |
4961 } | |
4962 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4963 } | |
4964 } | |
4965 if ( v241 > 1.0 ) | |
4966 v241 = 1.0; | |
4967 LABEL_484: | |
4968 v732 = (unsigned __int8)v240[25]; | |
4969 v242 = (signed __int64)((double)v732 * v241); | |
4970 v243 = y; | |
4971 y[25] = v242; | |
4972 *((int *)v243 + 4) = (unsigned __int8)v242; | |
4973 if ( (unsigned __int8)v242 <= 0 ) | |
4974 { | |
4975 *(int *)v243 = 0; | |
4976 dword_50C9D0 = 113; | |
4977 dword_50C9D4 = 0; | |
4978 dword_50C9D8 = 1; | |
4979 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4980 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 4981 pCastSpell->spellnum = 0; |
890 | 4982 v2 = v723; |
4983 continue; | |
4984 } | |
4985 *((int *)v243 + 5) |= 0x40u; | |
4986 dword_50C9A8 = 256; | |
4987 LODWORD(v727) = 1; | |
4988 break; | |
4989 } | |
4990 case SPELL_WATER_ENCHANT_ITEM: | |
4991 { | |
4992 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4993 break; | |
4994 uRequiredMana = 0; | |
4995 HIDWORD(v733) = 10 * v2; | |
4996 v730 = 1; | |
924 | 4997 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 4998 if ( v731 == 1 ) |
4999 { | |
5000 v245 = (int)&v244[36 * a2 + 532]; | |
5001 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5002 v311 = __OFSUB__(*(int *)v245, 134); | |
5003 v14 = *(int *)v245 == 134; | |
5004 v310 = *(int *)v245 - 134 < 0; | |
5005 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5006 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5007 { | |
5008 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
5009 { | |
5010 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
5011 { | |
5012 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
889 | 5013 { |
890 | 5014 v312 = v309[28]; |
5015 if ( v312 ) | |
5016 { | |
5017 if ( v312 != 1 ) | |
5018 { | |
5019 if ( v312 != 2 ) | |
5020 { | |
5021 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5022 if ( !(v244[36 * a2 + 552] & 2) ) | |
5023 { | |
5024 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5025 { | |
5026 uRequiredMana = 1; | |
5027 v730 = 0; | |
5028 } | |
5029 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5030 uRequiredMana = 1; | |
5031 if (!uRequiredMana) | |
5032 { | |
5033 v313 = *(char *)(LODWORD(v725) + 28); | |
5034 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5035 { | |
5036 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5037 *(int *)(v245 + 4) = 0; | |
5038 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5039 + 1]; | |
5040 ; | |
5041 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5042 + 1] ) | |
5043 { | |
5044 ++*(int *)(v245 + 4); | |
5045 if ( j >= v314 ) | |
5046 break; | |
5047 } | |
5048 v254 = rand(); | |
5049 v255 = 10;//pItemsTable->field_116D8[17]; | |
5050 v256 = 10;//pItemsTable->field_116D8[16]; | |
5051 LABEL_611: | |
5052 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5053 LABEL_612: | |
5054 _this->uItemID |= 0x20u; | |
5055 | |
5056 dword_50C9A8 = 256; | |
5057 LODWORD(v727) = 1; | |
5058 break; | |
5059 } | |
924 | 5060 goto LABEL_616; |
890 | 5061 } |
5062 LABEL_613: | |
5063 v316 = _this->uItemID; | |
5064 if ( !(BYTE1(v316) & 2) ) | |
5065 { | |
5066 LOBYTE(v316) = v316 | 2; | |
5067 _this->uItemID = v316; | |
5068 } | |
5069 } | |
5070 } | |
5071 } | |
5072 } | |
5073 } | |
889 | 5074 } |
890 | 5075 } |
5076 } | |
5077 LABEL_616: | |
5078 if ( LODWORD(v727) == 0 ) | |
5079 { | |
5080 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5081 if ( v730 == 0 ) | |
5082 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5083 ShowStatusBarString(v317, 2u); | |
5084 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5085 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5086 pCastSpell->spellnum = 0; | |
890 | 5087 v318->PlaySound(SPEECH_43, 0); |
5088 } | |
5089 break; | |
5090 } | |
5091 if ( v731 != 2 ) | |
5092 { | |
5093 if ( v731 == 3 ) | |
5094 { | |
5095 v245 = (int)&v244[36 * a2 + 532]; | |
5096 v269 = *(int *)v245; | |
5097 if ( *(int *)v245 > 134 | |
5098 || *(int *)(v245 + 12) != 0 | |
5099 || *(int *)(v245 + 4) != 0 | |
5100 || *(int *)(v245 + 8) != 0 | |
5101 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
5102 goto LABEL_616; | |
5103 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5104 LODWORD(v725) = (int)v270; | |
5105 v271 = v270[28]; | |
5106 if ( v271 && v271 != 1 && v271 != 2 ) | |
5107 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5108 else | |
5109 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5110 if ( v272 ) | |
5111 { | |
5112 uRequiredMana = 1; | |
5113 v730 = 0; | |
5114 } | |
5115 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5116 uRequiredMana = 1; | |
5117 if (uRequiredMana) | |
5118 goto LABEL_613; | |
5119 v273 = v725; | |
5120 v274 = *(char *)(LODWORD(v725) + 28); | |
5121 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 ) | |
5122 { | |
5123 if ( rand() % 100 < 80 | |
5124 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5125 { | |
5126 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5127 *(int *)(v245 + 4) = 0; | |
5128 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5129 ; | |
5130 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5131 + 1] ) | |
5132 { | |
5133 ++*(int *)(v245 + 4); | |
5134 if ( k >= v275 ) | |
5135 break; | |
5136 } | |
5137 v254 = rand(); | |
5138 v255 = 10;//pItemsTable->field_116D8[19]; | |
5139 v256 = 10;//pItemsTable->field_116D8[18]; | |
5140 goto LABEL_611; | |
5141 } | |
5142 v277 = pItemsTable->pSpecialEnchantments_count; | |
5143 v278 = 0; | |
5144 v725 = 0.0; | |
5145 HIDWORD(v733) = 0; | |
5146 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5147 { | |
5148 v730 = (int)&v679; | |
5149 do | |
5150 { | |
5151 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5152 if ( !v279 || v279 == 1 ) | |
5153 { | |
5154 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5155 + 4] | |
5156 + v278 * 28); | |
5157 LODWORD(v725) += v280; | |
5158 if ( v280 ) | |
5159 { | |
5160 v281 = v730; | |
5161 v730 += 4; | |
5162 *(int *)v281 = HIDWORD(v733); | |
5163 } | |
5164 } | |
5165 ++HIDWORD(v733); | |
5166 ++v278; | |
5167 } | |
5168 while ( SHIDWORD(v733) < v277 ); | |
5169 } | |
5170 v282 = rand() % SLODWORD(v725); | |
5171 v283 = v679; | |
5172 *(int *)(v245 + 12) = v679; | |
5173 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5174 v285 = v282 + 1; | |
5175 if ( v284 < v285 ) | |
5176 { | |
5177 for ( l = &v679; ; l = (int *)v732 ) | |
5178 { | |
5179 v287 = (int)(l + 1); | |
5180 v732 = v287; | |
5181 v288 = *(int *)v287; | |
5182 *(int *)(v245 + 12) = v288; | |
5183 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5184 + 4]; | |
5185 if ( v284 >= v285 ) | |
5186 break; | |
5187 } | |
5188 } | |
924 | 5189 ++*(int *)(v245 + 12); |
5190 goto LABEL_612; | |
890 | 5191 } |
889 | 5192 } |
5193 else | |
5194 { | |
890 | 5195 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5196 if ( v731 != 4 | |
5197 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5198 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5199 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5200 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5201 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
5202 goto LABEL_616; | |
5203 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5204 LODWORD(v725) = (int)v247; | |
5205 v248 = v247[28]; | |
5206 if ( v248 && v248 != 1 && v248 != 2 ) | |
5207 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5208 else | |
5209 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5210 if ( v249 ) | |
5211 { | |
5212 uRequiredMana = 1; | |
5213 v730 = 0; | |
5214 } | |
5215 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5216 uRequiredMana = 1; | |
5217 if (uRequiredMana) | |
5218 goto LABEL_613; | |
5219 v250 = v725; | |
5220 v251 = *(char *)(LODWORD(v725) + 28); | |
5221 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 ) | |
5222 { | |
5223 if ( rand() % 100 < 80 | |
5224 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5225 { | |
5226 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5227 *(int *)(v245 + 4) = 0; | |
5228 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5229 ; | |
5230 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5231 + 1] ) | |
5232 { | |
5233 ++*(int *)(v245 + 4); | |
5234 if ( m >= v252 ) | |
5235 break; | |
5236 } | |
5237 v254 = rand(); | |
5238 v255 = 10;// pItemsTable->field_116D8[21]; | |
5239 v256 = 10;//pItemsTable->field_116D8[20]; | |
5240 goto LABEL_611; | |
5241 } | |
5242 v257 = pItemsTable->pSpecialEnchantments_count; | |
5243 v258 = 0; | |
5244 v725 = 0.0; | |
5245 HIDWORD(v733) = 0; | |
5246 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5247 { | |
5248 v730 = (int)&v679; | |
5249 do | |
5250 { | |
5251 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5252 if ( !v259 || v259 == 1 ) | |
5253 { | |
5254 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5255 + 4] | |
5256 + v258 * 28); | |
5257 LODWORD(v725) += v260; | |
5258 if ( v260 ) | |
5259 { | |
5260 v261 = v730; | |
5261 v730 += 4; | |
5262 *(int *)v261 = HIDWORD(v733); | |
5263 } | |
5264 } | |
5265 ++HIDWORD(v733); | |
5266 ++v258; | |
5267 } | |
5268 while ( SHIDWORD(v733) < v257 ); | |
5269 } | |
5270 v262 = rand() % SLODWORD(v725); | |
5271 v263 = v679; | |
5272 *(int *)(v245 + 12) = v679; | |
5273 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5274 v265 = v262 + 1; | |
5275 if ( v264 < v265 ) | |
5276 { | |
5277 for ( ii = &v679; ; ii = (int *)v732 ) | |
5278 { | |
5279 v267 = (int)(ii + 1); | |
5280 v732 = v267; | |
5281 v268 = *(int *)v267; | |
5282 *(int *)(v245 + 12) = v268; | |
5283 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5284 + 4]; | |
5285 if ( v264 >= v265 ) | |
5286 break; | |
5287 } | |
5288 } | |
5289 ++*(int *)(v245 + 12); | |
5290 goto LABEL_612; | |
5291 } | |
5292 } | |
5293 //v1 = 0; | |
5294 goto LABEL_616; | |
5295 } | |
5296 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5297 _this = v289; | |
5298 v290 = v289->uItemID; | |
5299 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5300 if ( v290 > 134 | |
5301 || _this->uSpecEnchantmentType != 0 | |
5302 || _this->uEnchantmentType != 0 | |
5303 || _this->_bonus_strength != 0 | |
5304 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5305 || v291 == 1 | |
5306 || v291 == 2 | |
5307 || _this->Broken()) | |
5308 goto LABEL_616; | |
5309 if ( _this->GetValue() < 0x1C2 ) | |
5310 uRequiredMana = 1; | |
5311 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5312 uRequiredMana = 1; | |
5313 if ( uRequiredMana != 0 ) | |
5314 { | |
5315 dword_50C9D0 = 113; | |
5316 dword_50C9D4 = 0; | |
5317 dword_50C9D8 = 1; | |
5318 | |
5319 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5320 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5321 pCastSpell->spellnum = 0; |
890 | 5322 continue; |
5323 } | |
5324 v292 = *(char *)(LODWORD(v725) + 28); | |
5325 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5326 { | |
889 | 5327 v2 = v723; |
5328 //v1 = 0; | |
890 | 5329 |
5330 dword_50C9D0 = 113; | |
5331 dword_50C9D4 = 0; | |
5332 dword_50C9D8 = 1; | |
5333 | |
5334 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5335 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5336 pCastSpell->spellnum = 0; |
890 | 5337 continue; |
5338 } | |
5339 if ( rand() % 100 >= 80 ) | |
5340 { | |
5341 v297 = pItemsTable->pSpecialEnchantments_count; | |
5342 v294 = _this; | |
5343 v298 = 0; | |
5344 v725 = 0.0; | |
5345 HIDWORD(v733) = 0; | |
5346 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5347 { | |
5348 v730 = (int)&v679; | |
5349 do | |
5350 { | |
5351 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5352 if ( !v299 || v299 == 1 ) | |
5353 { | |
5354 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5355 + v298 * 28); | |
5356 LODWORD(v725) += v300; | |
5357 if ( v300 ) | |
5358 { | |
5359 v301 = v730; | |
5360 v730 += 4; | |
5361 *(int *)v301 = HIDWORD(v733); | |
5362 } | |
5363 } | |
5364 ++HIDWORD(v733); | |
5365 ++v298; | |
5366 } | |
5367 while ( SHIDWORD(v733) < v297 ); | |
5368 } | |
5369 v302 = rand() % SLODWORD(v725); | |
5370 v303 = v679; | |
5371 v294->uSpecEnchantmentType = v679; | |
5372 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5373 v305 = v302 + 1; | |
5374 if ( v304 < v305 ) | |
5375 { | |
5376 for ( jj = &v679; ; jj = (int *)v732 ) | |
5377 { | |
5378 v307 = (int)(jj + 1); | |
5379 v732 = v307; | |
5380 v308 = *(int *)v307; | |
5381 v294->uSpecEnchantmentType = v308; | |
5382 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5383 if ( v304 >= v305 ) | |
5384 break; | |
5385 } | |
5386 } | |
5387 ++v294->uSpecEnchantmentType; | |
5388 } | |
5389 else | |
5390 { | |
5391 v293 = rand(); | |
5392 v294 = _this; | |
5393 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5394 _this->uEnchantmentType = 0; | |
5395 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5396 ; | |
5397 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5398 + 1] ) | |
5399 { | |
5400 ++v294->uEnchantmentType; | |
5401 if ( kk >= v295 ) | |
5402 break; | |
5403 } | |
5404 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5405 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5406 } | |
5407 v294->uAttributes |= 0x20u; | |
5408 dword_50C9A8 = 256; | |
5409 LODWORD(v727) = 1; | |
5410 break; | |
5411 } | |
5412 case SPELL_WATER_TOWN_PORTAL: | |
5413 { | |
5414 amount = 10 * v2; | |
5415 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5416 break; | |
5417 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5418 { | |
5419 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5420 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5421 pCastSpell->spellnum = 0; |
890 | 5422 continue; |
5423 } | |
924 | 5424 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
890 | 5425 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5426 LODWORD(v727) = 1; | |
5427 break; | |
5428 } | |
5429 case SPELL_WATER_LLOYDS_BEACON: | |
5430 { | |
5431 LODWORD(v733) = 604800 * v2; | |
5432 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5433 { | |
5434 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5435 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5436 pCastSpell->spellnum = 0; |
890 | 5437 continue; |
5438 } | |
5439 v319 = uRequiredMana; | |
5440 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5441 { | |
5442 pEventTimer->Pause(); | |
5443 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | |
5444 qword_506350 = (signed int)v733; | |
924 | 5445 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
890 | 5446 ::uRequiredMana = v319; |
5447 ::sRecoveryTime = sRecoveryTime; | |
924 | 5448 dword_50633C = pCastSpell->sound_id; |
5449 dword_506338 = pCastSpell->spellnum; | |
5450 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
890 | 5451 } |
5452 break; | |
5453 } | |
5454 case SPELL_EARTH_STONE_TO_FLESH: | |
5455 { | |
5456 v320 = v731 - 2; | |
5457 if ( !v320 ) | |
5458 goto LABEL_632; | |
5459 v321 = v320 - 1; | |
5460 if ( v321 ) | |
5461 { | |
5462 if ( v321 == 1 ) | |
5463 goto LABEL_634; | |
5464 LABEL_632: | |
5465 v322 = 3600 * v2; | |
5466 } | |
5467 else | |
5468 { | |
5469 v322 = 86400 * v2; | |
5470 } | |
5471 amount = v322; | |
5472 LABEL_634: | |
5473 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5474 break; | |
924 | 5475 v323 = pCastSpell->uPlayerID_2; |
890 | 5476 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5477 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5478 { | |
5479 LODWORD(v727) = 1; | |
5480 break; | |
5481 } | |
5482 if ( v731 == 4 ) | |
5483 { | |
5484 *(int *)v324 = 0; | |
5485 *((int *)v324 + 1) = 0; | |
5486 LODWORD(v727) = 1; | |
5487 break; | |
5488 } | |
5489 v732 = amount << 7; | |
5490 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5491 v656 = 15; | |
924 | 5492 v325 = &pParty->pPlayers[v323]; |
5493 goto LABEL_641; | |
890 | 5494 } |
5495 case SPELL_EARTH_ROCK_BLAST: | |
5496 { | |
5497 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5498 break; | |
924 | 5499 pSpellSprite.stru_24.Reset(); |
5500 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5501 pSpellSprite.spell_level = v2; | |
5502 pSpellSprite.spell_skill = v731; | |
5503 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5504 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5505 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5506 pSpellSprite.uAttributes = 0; | |
5507 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5508 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 5509 pParty->vPosition.x, |
5510 pParty->vPosition.y, | |
5511 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 5512 pSpellSprite.uSpriteFrameID = 0; |
5513 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5514 pSpellSprite.spell_target_pid = a2; | |
5515 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5516 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5517 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5518 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5519 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5520 | |
5521 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5522 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5523 ++pTurnEngine->field_1C; |
5524 LODWORD(v727) = 1; | |
5525 break; | |
5526 } | |
5527 case SPELL_EARTH_DEATH_BLOSSOM: | |
5528 { | |
5529 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5530 { | |
5531 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5532 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 5533 pCastSpell->spellnum = 0; |
890 | 5534 continue; |
5535 } | |
5536 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5537 break; | |
924 | 5538 pSpellSprite.uType = 4090; |
5539 pSpellSprite.stru_24.Reset(); | |
5540 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5541 pSpellSprite.spell_level = v2; | |
5542 pSpellSprite.spell_skill = v731; | |
5543 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5544 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
5545 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
5546 pSpellSprite.uAttributes = 0; | |
5547 pSpellSprite.uSectorID = 0; | |
5548 pSpellSprite.uSpriteFrameID = 0; | |
5549 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5550 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5551 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5552 pSpellSprite.spell_target_pid = a2; | |
5553 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
5554 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5555 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 5556 pSpellSprite.uAttributes = 4; |
5557 | |
5558 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
5559 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
890 | 5560 ++pTurnEngine->field_1C; |
5561 LODWORD(v727) = 1; | |
5562 break; | |
5563 } | |
5564 case SPELL_SPIRIT_DETECT_LIFE: | |
5565 { | |
5566 v328 = v731 - 2; | |
5567 if ( v328 ) | |
5568 { | |
5569 v329 = v328 - 1; | |
5570 if ( v329 && v329 != 1 ) | |
5571 v330 = 600 * v2; | |
5572 else | |
5573 v330 = 3600 * v2; | |
5574 } | |
5575 else | |
5576 { | |
5577 v330 = 1800 * v2; | |
5578 } | |
5579 LODWORD(v733) = v330; | |
5580 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5581 break; | |
924 | 5582 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5583 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5584 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5585 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 5586 |
5587 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); | |
5588 LODWORD(v727) = 1; | |
5589 break; | |
5590 } | |
5591 case SPELL_SPIRIT_FATE: | |
5592 { | |
5593 LODWORD(v733) = 300; | |
5594 v339 = v731 - 2; | |
5595 if ( v339 ) | |
5596 { | |
5597 v340 = v339 - 1; | |
5598 if ( v340 ) | |
5599 { | |
5600 if ( v340 != 1 ) | |
5601 { | |
5602 amount = v2; | |
5603 goto LABEL_667; | |
5604 } | |
5605 v341 = 6 * v2; | |
889 | 5606 } |
5607 else | |
5608 { | |
890 | 5609 v341 = 4 * v2; |
5610 } | |
5611 } | |
5612 else | |
5613 { | |
5614 v341 = 2 * v2; | |
5615 } | |
5616 amount = v341; | |
5617 LABEL_667: | |
5618 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5619 break; | |
924 | 5620 v342 = pCastSpell->spell_target_pid; |
890 | 5621 if ( v342 == 0 ) |
5622 { | |
924 | 5623 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5624 | |
5625 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
890 | 5626 LODWORD(v727) = 1; |
5627 break; | |
5628 } | |
5629 if (PID_TYPE(v342) == OBJECT_Actor) | |
5630 { | |
5631 v343 = PID_ID(v342); | |
5632 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5633 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5634 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5635 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5636 v672 = 0; | |
5637 v661 = &pActors[v343]; | |
5638 LABEL_165: | |
5639 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5640 } | |
5641 LODWORD(v727) = 1; | |
5642 break; | |
5643 } | |
5644 case SPELL_SPIRIT_REMOVE_CURSE: | |
5645 { | |
5646 v348 = v731 - 2; | |
5647 if ( !v348 ) | |
5648 goto LABEL_677; | |
5649 v349 = v348 - 1; | |
5650 if ( v349 ) | |
5651 { | |
5652 if ( v349 == 1 ) | |
5653 { | |
5654 amount = 0; | |
5655 goto LABEL_679; | |
5656 } | |
5657 LABEL_677: | |
5658 v350 = 3600 * v2; | |
5659 } | |
5660 else | |
5661 { | |
5662 v350 = 86400 * v2; | |
5663 } | |
5664 amount = v350; | |
5665 LABEL_679: | |
5666 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5667 break; | |
924 | 5668 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5669 if ( !v351->pConditions[0] ) |
5670 { | |
5671 LODWORD(v727) = 1; | |
5672 break; | |
5673 } | |
5674 if ( v731 == 4 ) | |
5675 { | |
5676 LODWORD(v351->pConditions[0]) = 0; | |
5677 HIDWORD(v351->pConditions[0]) = 0; | |
5678 } | |
5679 else | |
5680 { | |
5681 v732 = amount << 7; | |
5682 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
924 | 5683 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
890 | 5684 { |
5685 LODWORD(v727) = 1; | |
5686 break; | |
5687 } | |
5688 } | |
924 | 5689 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 5690 LODWORD(v727) = 1; |
5691 break; | |
5692 } | |
5693 case SPELL_SPIRIT_PRESERVATION: | |
5694 { | |
5695 v354 = v731 - 2; | |
5696 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5697 v356 = 900 * (v2 + 4); | |
5698 else | |
5699 v356 = 300 * (v2 + 12); | |
5700 LODWORD(v733) = v356; | |
5701 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5702 break; | |
5703 if ( v731 == 1 || v731 == 2 ) | |
5704 { | |
924 | 5705 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5706 | |
5707 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 | 5708 LODWORD(v727) = 1; |
5709 break; | |
5710 } | |
5711 a2 = 0; | |
5712 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5713 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5714 do | |
5715 { | |
924 | 5716 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 5717 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5718 ++a2; | |
5719 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5720 } | |
5721 while ( v357 <= &pParty->pPlayers[3] ); | |
5722 LODWORD(v727) = 1; | |
5723 break; | |
5724 } | |
5725 case SPELL_SPIRIT_TURN_UNDEAD: | |
5726 { | |
5727 v364 = v731 - 2; | |
5728 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5729 v366 = 60 * (v2 + 3); | |
5730 else | |
5731 v366 = 300 * v2 + 180; | |
5732 LODWORD(v733) = v366; | |
5733 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5734 break; | |
5735 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5736 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
924 | 5737 ++pSpellSprite.uType; |
5738 pSpellSprite.stru_24.Reset(); | |
5739 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5740 pSpellSprite.spell_level = v2; | |
5741 pSpellSprite.spell_skill = v731; | |
5742 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5743 pSpellSprite.uAttributes = 0; | |
5744 pSpellSprite.uSectorID = 0; | |
5745 pSpellSprite.uSpriteFrameID = 0; | |
5746 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5747 pSpellSprite.uFacing = 0; | |
5748 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5749 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 5750 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5751 { | |
5752 v369 = &pActors[dword_50BF30[a2]]; | |
5753 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5754 { | |
924 | 5755 pSpellSprite.vPosition.x = v369->vPosition.x; |
5756 pSpellSprite.vPosition.y = v369->vPosition.y; | |
5757 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5758 | |
5759 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5760 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 5761 v369->pActorBuffs[4].Apply( |
5762 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
889 | 5763 v731, 0, 0, 0); |
5764 } | |
890 | 5765 } |
5766 LODWORD(v727) = 1; | |
5767 } | |
5768 break; | |
5769 | |
5770 case SPELL_SPIRIT_RAISE_DEAD: | |
5771 { | |
5772 v371 = v731 - 2; | |
5773 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5774 amount = 0; | |
5775 else | |
5776 amount = 86400 * v2; | |
5777 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5778 break; | |
924 | 5779 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5780 v373 = pCastSpell->uPlayerID_2; | |
890 | 5781 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5782 { | |
5783 LODWORD(v727) = 1; | |
5784 break; | |
5785 } | |
5786 v14 = v731 == 4; | |
5787 pParty->pPlayers[v373].sHealth = 1; | |
5788 if ( v14 ) | |
5789 { | |
924 | 5790 v374 = pCastSpell->uPlayerID_2; |
890 | 5791 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5792 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
924 | 5793 v376 = pCastSpell->uPlayerID_2; |
890 | 5794 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5795 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5796 } | |
5797 else | |
5798 { | |
5799 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5800 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5801 0xEu, |
5802 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 5803 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 5804 0xDu, |
5805 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5806 } | |
924 | 5807 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 5808 goto LABEL_720; |
5809 } | |
5810 case SPELL_SPIRIT_SHARED_LIFE: | |
5811 { | |
5812 v378 = v731 - 2; | |
5813 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5814 v380 = 4 * v2; | |
5815 else | |
5816 v380 = 3 * v2; | |
5817 amount = v380; | |
5818 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5819 break; | |
5820 v381 = 0; | |
5821 HIDWORD(v733) = amount; | |
5822 v730 = 0; | |
5823 v382 = 1; | |
5824 do | |
5825 { | |
5826 v383 = pPlayers[v382]; | |
5827 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5828 v682[v381++] = v382; | |
5829 ++v382; | |
5830 } | |
5831 while ( v382 <= 4 ); | |
5832 v384 = 0; | |
5833 v730 = v381; | |
5834 if ( v381 > 0 ) | |
5835 { | |
5836 do | |
5837 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5838 while ( v384 < v381 ); | |
5839 } | |
5840 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5841 HIDWORD(v733) = 0; | |
5842 if ( v381 > 0 ) | |
5843 { | |
5844 do | |
5845 { | |
5846 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5847 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5848 v726->sHealth = v732; | |
5849 //v386 = v726->GetMaxHealth(); | |
5850 if ( v726->sHealth > v726->GetMaxHealth()) | |
5851 v726->sHealth = v726->GetMaxHealth(); | |
5852 if ( v726->sHealth > 0 ) | |
5853 { | |
5854 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5855 } | |
5856 v388 = HIDWORD(v733); | |
5857 | |
924 | 5858 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
890 | 5859 HIDWORD(v733) = v388 + 1; |
5860 } | |
5861 while ( v388 + 1 < v730 ); | |
5862 } | |
5863 LODWORD(v727) = 1; | |
5864 break; | |
5865 } | |
5866 case SPELL_SPIRIT_RESSURECTION: | |
5867 { | |
5868 v392 = v731 - 1; | |
5869 if ( !v392 ) | |
5870 { | |
5871 v395 = 180 * v2; | |
924 | 5872 amount = v395; |
5873 goto LABEL_751; | |
890 | 5874 } |
5875 v393 = v392 - 1; | |
5876 if ( !v393 ) | |
5877 { | |
5878 v395 = 10800 * v2; | |
924 | 5879 amount = v395; |
5880 goto LABEL_751; | |
890 | 5881 } |
5882 v394 = v393 - 1; | |
5883 if ( !v394 ) | |
5884 { | |
5885 v395 = 259200 * v2; | |
5886 amount = v395; | |
5887 goto LABEL_751; | |
5888 } | |
5889 if ( v394 == 1 ) | |
5890 amount = 0; | |
5891 LABEL_751: | |
5892 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5893 break; | |
924 | 5894 v396 = pCastSpell->uPlayerID_2; |
890 | 5895 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5896 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5897 { | |
5898 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5899 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5900 if ( v731 == 4 ) | |
5901 { | |
924 | 5902 v397 = pCastSpell->uPlayerID_2; |
890 | 5903 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5904 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
924 | 5905 v398 = pCastSpell->uPlayerID_2; |
890 | 5906 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5907 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
924 | 5908 v399 = pCastSpell->uPlayerID_2; |
890 | 5909 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5910 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5911 } | |
889 | 5912 else |
890 | 5913 { |
5914 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
924 | 5915 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
890 | 5916 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5917 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
890 | 5918 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
924 | 5919 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
890 | 5920 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5921 } | |
924 | 5922 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5923 | |
5924 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
5925 | |
5926 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 5927 } |
5928 LODWORD(v727) = 1; | |
5929 break; | |
5930 } | |
5931 case SPELL_MIND_CURE_PARALYSIS: | |
5932 { | |
5933 v405 = v731 - 2; | |
5934 if ( !v405 ) | |
5935 goto LABEL_766; | |
5936 v406 = v405 - 1; | |
5937 if ( v406 ) | |
5938 { | |
5939 if ( v406 == 1 ) | |
5940 { | |
5941 amount = 0; | |
5942 goto LABEL_768; | |
5943 } | |
5944 LABEL_766: | |
5945 v407 = 3600 * v2; | |
5946 } | |
5947 else | |
5948 { | |
5949 v407 = 86400 * v2; | |
5950 } | |
5951 amount = v407; | |
5952 LABEL_768: | |
5953 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5954 break; | |
5955 | |
924 | 5956 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5957 v323 = pCastSpell->uPlayerID_2; | |
890 | 5958 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5959 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5960 { | |
5961 LODWORD(v727) = 1; | |
5962 break; | |
5963 } | |
5964 if ( v731 == 4 ) | |
5965 { | |
5966 *(int *)v324 = 0; | |
5967 *((int *)v324 + 1) = 0; | |
889 | 5968 LODWORD(v727) = 1; |
890 | 5969 break; |
5970 } | |
5971 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5972 v656 = 12; | |
924 | 5973 v325 = &pParty->pPlayers[v323]; |
5974 goto LABEL_641; | |
890 | 5975 |
5976 } | |
5977 case SPELL_MIND_REMOVE_FEAR: | |
5978 { | |
5979 v411 = v731 - 2; | |
5980 if ( v411 ) | |
5981 { | |
5982 v412 = v411 - 1; | |
5983 if ( v412 ) | |
5984 { | |
5985 if ( v412 == 1 ) | |
5986 { | |
5987 amount = 0; | |
5988 goto LABEL_780; | |
5989 } | |
5990 v413 = 180 * v2; | |
889 | 5991 } |
5992 else | |
5993 { | |
890 | 5994 v413 = 86400 * v2; |
5995 } | |
5996 } | |
5997 else | |
5998 { | |
5999 v413 = 3600 * v2; | |
6000 } | |
6001 amount = v413; | |
6002 LABEL_780: | |
6003 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6004 break; | |
6005 | |
924 | 6006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6007 v323 = pCastSpell->uPlayerID_2; | |
890 | 6008 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
6009 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
6010 { | |
6011 LODWORD(v727) = 1; | |
6012 break; | |
6013 } | |
6014 if ( v731 == 4 ) | |
6015 { | |
6016 *(int *)v324 = 0; | |
6017 *((int *)v324 + 1) = 0; | |
6018 LODWORD(v727) = 1; | |
6019 break; | |
6020 } | |
6021 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6022 v656 = 3; | |
924 | 6023 v325 = &pParty->pPlayers[v323]; |
6024 goto LABEL_641; | |
890 | 6025 } |
6026 case SPELL_MIND_TELEPATHY: | |
6027 { | |
6028 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6029 break; | |
6030 if (PID_TYPE(a2) != OBJECT_Actor) | |
6031 { | |
889 | 6032 LODWORD(v727) = 1; |
890 | 6033 break; |
6034 } | |
6035 v417 = (int)&pActors[PID_ID(a2)]; | |
6036 v730 = v417; | |
6037 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6038 { | |
6039 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6040 v417 = v730; | |
6041 } | |
6042 v418 = *(int *)(v417 + 672); | |
6043 HIDWORD(v733) = 0; | |
6044 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6045 HIDWORD(v733) = *(int *)(v417 + 684); | |
6046 | |
6047 //ItemGen::ItemGen(&v683); | |
6048 v683.Reset(); | |
6049 | |
6050 v419 = *(short *)(v730 + 180); | |
6051 if (v419) | |
6052 { | |
6053 v683.uItemID = v419; | |
6054 goto LABEL_799; | |
6055 } | |
6056 v420 = 0; | |
6057 v421 = v730 + 564; | |
6058 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6059 { | |
6060 ++v420; | |
6061 v421 += 36; | |
6062 if ( v420 >= 4 ) | |
6063 goto LABEL_799; | |
6064 } | |
6065 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6066 v2 = v723; | |
6067 //v1 = 0; | |
6068 LABEL_799: | |
6069 if ( HIDWORD(v733) != 0 ) | |
6070 { | |
6071 v675 = (const char *)HIDWORD(v733); | |
6072 if (v683.uItemID) | |
6073 { | |
6074 v422 = v683.GetDisplayName(); | |
6075 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
924 | 6076 ShowStatusBarString(pTmpBuf2, 2u); |
6077 pSpellSprite.stru_24.Reset(); | |
6078 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6079 pSpellSprite.spell_level = v2; | |
6080 pSpellSprite.spell_skill = v731; | |
6081 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6082 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6083 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6084 v676 = *(short *)(v730 + 138); | |
6085 v665 = pSpellSprite.vPosition.y; | |
6086 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6087 v657 = pSpellSprite.vPosition.x; | |
6088 goto LABEL_1087; | |
890 | 6089 } |
6090 v664 = "%d gold"; | |
924 | 6091 sprintf(pTmpBuf2, v664, v675); |
6092 ShowStatusBarString(pTmpBuf2, 2u); | |
6093 pSpellSprite.stru_24.Reset(); | |
6094 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6095 pSpellSprite.spell_level = v2; | |
6096 pSpellSprite.spell_skill = v731; | |
6097 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6098 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6099 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6100 v676 = *(short *)(v730 + 138); | |
6101 v665 = pSpellSprite.vPosition.y; | |
6102 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6103 v657 = pSpellSprite.vPosition.x; | |
6104 goto LABEL_1087; | |
890 | 6105 } |
6106 if (v683.uItemID) | |
6107 { | |
6108 v675 = v683.GetDisplayName(); | |
6109 v664 = "(%s)"; | |
6110 sprintf(pTmpBuf2, v664, v675); | |
924 | 6111 ShowStatusBarString(pTmpBuf2, 2u); |
6112 pSpellSprite.stru_24.Reset(); | |
6113 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6114 pSpellSprite.spell_level = v2; | |
6115 pSpellSprite.spell_skill = v731; | |
6116 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6117 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6118 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6119 v676 = *(short *)(v730 + 138); | |
6120 v665 = pSpellSprite.vPosition.y; | |
6121 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6122 v657 = pSpellSprite.vPosition.x; | |
6123 goto LABEL_1087; | |
890 | 6124 } |
6125 strcpy(pTmpBuf2, "nothing"); | |
6126 ShowStatusBarString(pTmpBuf2, 2u); | |
924 | 6127 pSpellSprite.stru_24.Reset(); |
6128 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6129 pSpellSprite.spell_level = v2; | |
6130 pSpellSprite.spell_skill = v731; | |
6131 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6132 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6133 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
890 | 6134 v676 = *(short *)(v730 + 138); |
924 | 6135 v665 = pSpellSprite.vPosition.y; |
6136 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6137 v657 = pSpellSprite.vPosition.x; | |
890 | 6138 goto LABEL_1087; |
6139 } | |
6140 case SPELL_MIND_BERSERK: | |
6141 { | |
6142 v423 = v731 - 2; | |
6143 if ( !v423 ) | |
6144 goto LABEL_813; | |
6145 v424 = v423 - 1; | |
6146 if ( v424 ) | |
6147 { | |
6148 if ( v424 == 1 ) | |
6149 v425 = 3600 * v2; | |
6150 else | |
6151 LABEL_813: | |
6152 v425 = 300 * v2; | |
6153 } | |
6154 else | |
6155 { | |
6156 v425 = 600 * v2; | |
6157 } | |
6158 amount = v425; | |
6159 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6160 break; | |
6161 v426 = PID_ID(a2); | |
6162 if (PID_TYPE(a2) != OBJECT_Actor) | |
6163 { | |
6164 LODWORD(v727) = 1; | |
6165 break; | |
6166 } | |
6167 v730 = 836 * v426; | |
6168 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6169 { | |
6170 pActors[v426].pActorBuffs[1].Reset(); | |
6171 pActors[v426].pActorBuffs[12].Reset(); | |
6172 pActors[v426].pActorBuffs[9].Apply( | |
6173 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6174 v731, 0, 0, 0); | |
6175 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6176 } | |
924 | 6177 pSpellSprite.stru_24.Reset(); |
6178 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6179 pSpellSprite.spell_level = v2; | |
6180 pSpellSprite.spell_skill = v731; | |
6181 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6182 v61 = v426; |
6183 goto LABEL_1086; | |
6184 | |
6185 } | |
6186 case SPELL_MIND_ENSLAVE: | |
6187 { | |
6188 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6189 break; | |
6190 amount = 600 * v2; | |
6191 if (PID_TYPE(a2) != OBJECT_Actor) | |
6192 { | |
6193 LODWORD(v727) = 1; | |
6194 break; | |
6195 } | |
6196 v730 = 836 * PID_ID(a2); | |
6197 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6198 break; | |
6199 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6200 { | |
6201 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6202 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6203 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6204 v731, 0, 0, 0); | |
6205 } | |
924 | 6206 pSpellSprite.stru_24.Reset(); |
6207 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6208 pSpellSprite.spell_level = v2; | |
6209 pSpellSprite.spell_skill = v731; | |
6210 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 6211 v61 = PID_ID(a2); |
6212 goto LABEL_1086; | |
6213 } | |
6214 case SPELL_MIND_MASS_FEAR: | |
6215 { | |
6216 v428 = v731 - 2; | |
6217 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6218 v430 = 300 * v2; | |
6219 else | |
6220 v430 = 180 * v2; | |
6221 amount = v430; | |
6222 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6223 break; | |
6224 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6225 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
924 | 6226 ++pSpellSprite.uType; |
6227 pSpellSprite.stru_24.Reset(); | |
6228 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6229 pSpellSprite.spell_level = v2; | |
6230 pSpellSprite.spell_skill = v731; | |
6231 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6232 pSpellSprite.uAttributes = 0; | |
6233 pSpellSprite.uSectorID = 0; | |
6234 pSpellSprite.uSpriteFrameID = 0; | |
6235 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6236 pSpellSprite.uFacing = 0; | |
6237 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6238 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6239 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6240 { | |
6241 v433 = &pActors[dword_50BF30[a2]]; | |
6242 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6243 break; | |
924 | 6244 pSpellSprite.vPosition.x = v433->vPosition.x; |
6245 pSpellSprite.vPosition.y = v433->vPosition.y; | |
6246 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6247 | |
6248 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6249 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6250 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6251 { | |
6252 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6253 v731, 0, 0, 0); | |
6254 } | |
6255 } | |
6256 LODWORD(v727) = 1; | |
6257 break; | |
6258 } | |
6259 | |
6260 case SPELL_MIND_CURE_INSANITY: | |
6261 { | |
6262 v435 = v731 - 2; | |
6263 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6264 amount = 0; | |
6265 else | |
6266 amount = 86400 * v2; | |
6267 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6268 break; | |
6269 | |
924 | 6270 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6271 v440 = pCastSpell->uPlayerID_2; | |
890 | 6272 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6273 { | |
6274 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6275 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6276 if ( v731 == 4 ) | |
6277 { | |
924 | 6278 v441 = pCastSpell->uPlayerID_2; |
890 | 6279 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6280 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
889 | 6281 } |
6282 else | |
6283 { | |
924 | 6284 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
890 | 6285 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6286 } | |
924 | 6287 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6288 LABEL_720: |
6289 v377->SetCondition(1, 0); | |
6290 } | |
6291 LODWORD(v727) = 1; | |
6292 break; | |
6293 } | |
6294 case SPELL_EARTH_TELEKINESIS: | |
6295 { | |
6296 v442 = v731 - 2; | |
6297 if ( !v442 ) | |
6298 goto LABEL_855; | |
6299 v443 = v442 - 1; | |
6300 if ( v443 ) | |
6301 { | |
6302 if ( v443 == 1 ) | |
6303 v444 = 4 * v2; | |
6304 else | |
6305 LABEL_855: | |
6306 v444 = 2 * v2; | |
6307 } | |
6308 else | |
6309 { | |
6310 v444 = 3 * v2; | |
6311 } | |
6312 amount = v444; | |
6313 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6314 break; | |
6315 v445 = PID_ID(a2); | |
6316 if (PID_TYPE(a2) == OBJECT_Item) | |
6317 { | |
6318 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6319 v450 = *(int *)v449; | |
6320 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6321 { | |
6322 party_finds_gold(*((int *)v449 + 3), 0); | |
6323 viewparams->bRedrawGameUI = 1; | |
889 | 6324 } |
6325 else | |
6326 { | |
890 | 6327 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
6328 ShowStatusBarString(pTmpBuf2, 2u); | |
6329 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6330 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6331 } | |
6332 SpriteObject::OnInteraction(v445); | |
6333 } | |
6334 else | |
6335 { | |
6336 if (PID_TYPE(a2) == OBJECT_Actor) | |
6337 { | |
6338 stru_50C198.LootActor(&pActors[v445]); | |
6339 } | |
6340 else | |
6341 { | |
6342 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6343 { | |
6344 if (PID_TYPE(a2) != OBJECT_BModel) | |
6345 { | |
6346 LODWORD(v727) = 1; | |
6347 break; | |
6348 } | |
6349 dword_507CD8 = 1; | |
6350 v677 = 1; | |
6351 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6352 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6353 else | |
6354 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6355 | |
6356 EventProcessor(v446, a2, v677); | |
6357 LODWORD(v727) = 1; | |
6358 break; | |
6359 } | |
6360 v447 = &pLevelDecorations[v445]; | |
6361 dword_507CD8 = 1; | |
6362 v448 = v447->field_16_event_id; | |
6363 if (v448) | |
6364 { | |
6365 v677 = 1; | |
6366 v446 = v448; | |
6367 EventProcessor(v446, a2, v677); | |
6368 LODWORD(v727) = 1; | |
6369 break; | |
6370 } | |
6371 if ( v447->IsInteractive() ) | |
6372 { | |
6373 activeLevelDecoration = v447; | |
6374 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6375 activeLevelDecoration = NULL; | |
6376 } | |
6377 } | |
6378 } | |
6379 LODWORD(v727) = 1; | |
6380 break; | |
6381 } | |
6382 case SPELL_BODY_CURE_WEAKNESS: | |
6383 { | |
6384 v451 = v731 - 2; | |
6385 if ( v451 ) | |
6386 { | |
6387 v452 = v451 - 1; | |
6388 if ( v452 ) | |
6389 { | |
6390 if ( v452 == 1 ) | |
6391 { | |
6392 amount = 0; | |
6393 goto LABEL_883; | |
6394 } | |
6395 v453 = 180 * v2; | |
889 | 6396 } |
6397 else | |
6398 { | |
890 | 6399 v453 = 86400 * v2; |
6400 } | |
6401 } | |
6402 else | |
6403 { | |
6404 v453 = 3600 * v2; | |
6405 } | |
6406 amount = v453; | |
6407 LABEL_883: | |
6408 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6409 break; | |
6410 | |
924 | 6411 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6412 v323 = pCastSpell->uPlayerID_2; | |
890 | 6413 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6414 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6415 { | |
889 | 6416 LODWORD(v727) = 1; |
890 | 6417 break; |
6418 } | |
6419 if ( v731 == 4 ) | |
6420 { | |
6421 *(int *)v324 = 0; | |
6422 *((int *)v324 + 1) = 0; | |
6423 LODWORD(v727) = 1; | |
6424 break; | |
6425 } | |
6426 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6427 v656 = 1; | |
6428 v325 = &pParty->pPlayers[v323]; | |
6429 goto LABEL_641; | |
6430 } | |
6431 case SPELL_BODY_FIRST_AID: | |
6432 { | |
6433 v457 = v731 - 2; | |
6434 if ( v457 ) | |
6435 { | |
6436 v458 = v457 - 1; | |
6437 if ( v458 ) | |
6438 { | |
6439 if ( v458 == 1 ) | |
6440 v459 = 5 * v2 + 5; | |
6441 else | |
6442 v459 = 2 * v2 + 5; | |
889 | 6443 } |
6444 else | |
6445 { | |
890 | 6446 v459 = 4 * v2 + 5; |
6447 } | |
6448 } | |
6449 else | |
6450 { | |
6451 v459 = 3 * v2 + 5; | |
6452 } | |
6453 amount = v459; | |
6454 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6455 break; | |
924 | 6456 v460 = pCastSpell->spell_target_pid; |
890 | 6457 if (!v460) |
6458 { | |
924 | 6459 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6460 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 6461 } |
6462 else | |
6463 { | |
6464 if (PID_TYPE(v460) == OBJECT_Actor) | |
6465 { | |
6466 v461 = &pActors[PID_ID(v460)]; | |
6467 v462 = v461->uAIState; | |
6468 v463 = v461->pMonsterInfo.uHP; | |
6469 if ( v462 != 5 ) | |
6470 { | |
6471 if ( v462 != 4 ) | |
6472 { | |
6473 if ( v462 != 19 ) | |
6474 { | |
6475 if ( v462 != 11 ) | |
6476 { | |
6477 v461->sCurrentHP += amount; | |
6478 if ( v461->sCurrentHP > v463 ) | |
6479 v461->sCurrentHP = v463; | |
6480 } | |
6481 } | |
6482 } | |
6483 } | |
6484 } | |
6485 } | |
6486 LODWORD(v727) = 1; | |
6487 break; | |
6488 } | |
6489 case SPELL_BODY_CURE_POISON: | |
6490 { | |
6491 v464 = v731 - 2; | |
6492 if ( !v464 ) | |
6493 goto LABEL_910; | |
6494 v465 = v464 - 1; | |
6495 if ( v465 ) | |
6496 { | |
6497 if ( v465 == 1 ) | |
6498 { | |
6499 amount = 0; | |
6500 goto LABEL_912; | |
6501 } | |
6502 LABEL_910: | |
6503 v466 = 3600 * v2; | |
6504 } | |
6505 else | |
6506 { | |
6507 v466 = 86400 * v2; | |
6508 } | |
6509 amount = v466; | |
6510 LABEL_912: | |
6511 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6512 break; | |
6513 | |
924 | 6514 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6515 v470 = pCastSpell->uPlayerID_2; | |
890 | 6516 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6517 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6518 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6519 { | |
6520 LODWORD(v727) = 1; | |
6521 break; | |
6522 } | |
6523 if ( v731 == 4 ) | |
6524 { | |
6525 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6526 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
924 | 6527 v471 = pCastSpell->uPlayerID_2; |
890 | 6528 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6529 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
924 | 6530 v472 = pCastSpell->uPlayerID_2; |
890 | 6531 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6532 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6533 LODWORD(v727) = 1; | |
6534 break; | |
6535 } | |
6536 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6537 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6538 6u, | |
6539 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6540 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6541 8u, |
6542 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6543 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6544 v656 = 10; | |
6545 goto LABEL_937; | |
6546 | |
6547 } | |
6548 case SPELL_BODY_PROTECTION_FROM_MAGIC: | |
6549 { | |
6550 amount = v2; | |
6551 LODWORD(v733) = 3600 * v2; | |
6552 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6553 break; | |
6554 | |
924 | 6555 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6556 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6557 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6558 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6559 |
6560 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6561 LODWORD(v727) = 1; | |
6562 break; | |
6563 } | |
6564 case SPELL_BODY_HAMMERHANDS: | |
6565 { | |
6566 LODWORD(v733) = 3600 * v2; | |
6567 amount = v2; | |
6568 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6569 break; | |
6570 if ( v731 == 4 ) | |
6571 { | |
924 | 6572 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6573 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6574 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6575 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6576 v732 = (int)v733 << 7; |
6577 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6578 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6579 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6580 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6581 | |
6582 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6583 LODWORD(v727) = 1; | |
6584 break; | |
6585 } | |
924 | 6586 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6587 | |
6588 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 | 6589 LODWORD(v727) = 1; |
6590 break; | |
6591 } | |
6592 case SPELL_BODY_CURE_DISEASE: | |
6593 { | |
6594 v493 = v731 - 2; | |
6595 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6596 amount = 0; | |
6597 else | |
6598 amount = 86400 * v2; | |
6599 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6600 break; | |
6601 | |
924 | 6602 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6603 v498 = pCastSpell->uPlayerID_2; | |
890 | 6604 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6605 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6606 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6607 { | |
6608 LODWORD(v727) = 1; | |
6609 break; | |
6610 } | |
6611 if ( v731 == 4 ) | |
6612 { | |
6613 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6614 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
924 | 6615 v499 = pCastSpell->uPlayerID_2; |
890 | 6616 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6617 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
924 | 6618 v500 = pCastSpell->uPlayerID_2; |
890 | 6619 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6620 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6621 } | |
6622 else | |
6623 { | |
6624 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6625 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6626 7u, | |
6627 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
924 | 6628 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
890 | 6629 9u, |
6630 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6631 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6632 v656 = 11; | |
6633 LABEL_937: | |
924 | 6634 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
890 | 6635 LABEL_641: |
6636 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6637 } | |
6638 LODWORD(v727) = 1; | |
6639 break; | |
6640 } | |
6641 case SPELL_BODY_POWER_CURE: | |
6642 { | |
6643 amount = 5 * v2 + 10; | |
6644 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6645 break; | |
6646 v501 = pParty->pPlayers; | |
6647 int v1 = 0; | |
6648 do | |
6649 { | |
924 | 6650 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
890 | 6651 v501->Heal(amount); |
6652 ++v501; | |
6653 ++v1; | |
6654 } | |
6655 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6656 LODWORD(v727) = 1; | |
6657 break; | |
6658 } | |
6659 case SPELL_LIGHT_DISPEL_MAGIC: | |
6660 { | |
6661 sRecoveryTime -= v2; | |
6662 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6663 break; | |
6664 | |
6665 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6666 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6667 ++pSpellSprite.uType; |
890 | 6668 HIDWORD(v733) = v505; |
6669 v688.x = 0; | |
6670 v688.y = 0; | |
6671 v688.z = 0; | |
924 | 6672 pSpellSprite.stru_24.Reset(); |
6673 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6674 pSpellSprite.spell_level = v2; | |
6675 pSpellSprite.spell_skill = v731; | |
6676 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6677 pSpellSprite.uAttributes = 0; | |
6678 pSpellSprite.uSectorID = 0; | |
6679 pSpellSprite.uSpriteFrameID = 0; | |
6680 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6681 pSpellSprite.uFacing = 0; | |
6682 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6683 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6684 a2 = 0; |
6685 if ( SHIDWORD(v733) > 0 ) | |
6686 { | |
6687 do | |
6688 { | |
6689 v507 = dword_50BF30[a2]; | |
924 | 6690 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6691 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
6692 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6693 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6694 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6695 v510 = a2; |
6696 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6697 a2 = v510 + 1; | |
6698 } | |
6699 while ( v510 + 1 < SHIDWORD(v733) ); | |
6700 } | |
6701 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6702 { | |
6703 v511 = &pActors[dword_50BF30[a2]]; | |
924 | 6704 pSpellSprite.vPosition.x = v511->vPosition.x; |
6705 pSpellSprite.vPosition.y = v511->vPosition.y; | |
6706 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6707 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6708 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6709 v513 = v511->pActorBuffs; |
6710 for (int _v726 = 22; _v726 != 0; --_v726) | |
6711 { | |
6712 v513->Reset(); | |
6713 ++v513; | |
6714 } | |
6715 } | |
6716 LODWORD(v727) = 1; | |
6717 break; | |
6718 } | |
6719 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
6720 { | |
6721 v514 = v731 - 2; | |
6722 if ( !v514 ) | |
6723 goto LABEL_955; | |
6724 v515 = v514 - 1; | |
6725 if ( v515 ) | |
6726 { | |
6727 if ( v515 == 1 ) | |
6728 { | |
6729 v516 = 900 * v2; | |
6730 amount = 5; | |
889 | 6731 } |
6732 else | |
6733 { | |
890 | 6734 LABEL_955: |
6735 v516 = 300 * v2; | |
6736 amount = 1; | |
6737 } | |
6738 } | |
6739 else | |
6740 { | |
6741 v516 = 900 * v2; | |
6742 amount = 3; | |
6743 } | |
6744 v733 = __PAIR__(0, v516); | |
6745 | |
6746 if ( (signed int)uNumActors > 0 ) | |
6747 { | |
6748 v518 = pActors;//[0].uAIState; | |
6749 auto _v726 = uNumActors; | |
889 | 6750 do |
6751 { | |
890 | 6752 v519 = v518->uAIState; |
924 | 6753 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
890 | 6754 ++HIDWORD(v733); |
6755 ++v518; | |
6756 --_v726; | |
6757 } | |
6758 while ( _v726 != 0 ); | |
6759 } | |
6760 if ( SHIDWORD(v733) >= amount ) | |
6761 { | |
6762 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6763 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6764 pCastSpell->spellnum = 0; |
890 | 6765 continue; |
6766 } | |
6767 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6768 break; | |
924 | 6769 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
890 | 6770 LODWORD(v727) = 1; |
6771 break; | |
6772 } | |
6773 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
6774 { | |
6775 v520 = v731 - 2; | |
6776 if ( !v520 ) | |
6777 goto LABEL_973; | |
6778 v521 = v520 - 1; | |
6779 if ( v521 ) | |
6780 { | |
6781 if ( v521 == 1 ) | |
6782 { | |
6783 LODWORD(v733) = 18000 * v2; | |
6784 v522 = 5 * v2 + 10; | |
889 | 6785 } |
6786 else | |
6787 { | |
890 | 6788 LABEL_973: |
6789 LODWORD(v733) = 10800 * v2; | |
6790 v522 = 3 * v2 + 10; | |
6791 } | |
6792 } | |
6793 else | |
6794 { | |
6795 LODWORD(v733) = 14400 * v2; | |
6796 v522 = 4 * v2 + 10; | |
6797 } | |
6798 amount = v522; | |
6799 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6800 break; | |
6801 | |
924 | 6802 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6803 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6804 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6805 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6806 |
6807 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6808 LODWORD(v727) = 1; | |
6809 break; | |
6810 } | |
6811 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
6812 { | |
6813 //v67 = 2; | |
6814 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6815 { | |
6816 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6817 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6818 pCastSpell->spellnum = 0; |
890 | 6819 continue; |
6820 } | |
6821 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6822 break; | |
6823 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
924 | 6824 ++pSpellSprite.uType; |
890 | 6825 v694.x = 0; |
6826 v694.y = 0; | |
6827 v694.z = 0; | |
924 | 6828 pSpellSprite.stru_24.Reset(); |
6829 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6830 pSpellSprite.spell_level = v2; | |
6831 pSpellSprite.spell_skill = v731; | |
6832 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6833 pSpellSprite.uAttributes = 0; | |
6834 pSpellSprite.uSectorID = 0; | |
6835 pSpellSprite.uSpriteFrameID = 0; | |
6836 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6837 pSpellSprite.uFacing = 0; | |
6838 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6839 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 6840 a2 = 0; |
6841 if ( (signed int)v531 > 0 ) | |
6842 { | |
6843 do | |
6844 { | |
6845 v533 = dword_50BF30[a2]; | |
924 | 6846 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6847 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
6848 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6849 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6850 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 6851 v536 = a2; |
6852 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6853 a2 = v536 + 1; | |
6854 } | |
6855 while ( v536 + 1 < (signed int)v531 ); | |
6856 } | |
6857 v537 = pGame->GetStru6(); | |
6858 pGame->GetStru6()->_4A8BFC(); | |
889 | 6859 LODWORD(v727) = 1; |
890 | 6860 break; |
6861 } | |
6862 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6863 { | |
6864 v538 = v731 - 2; | |
6865 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6866 { | |
6867 amount = 5 * v2; | |
6868 v540 = 18000 * v2; | |
6869 } | |
6870 else | |
6871 { | |
6872 amount = 4 * v2; | |
6873 v540 = 14400 * v2; | |
6874 } | |
6875 v730 = v540; | |
6876 LODWORD(v733) = v540; | |
6877 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6878 break; | |
6879 | |
924 | 6880 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6881 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6882 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6883 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 6884 |
6885 v732 = v730 << 7; | |
6886 v549 = (double)(v730 << 7) * 0.033333335; | |
6887 *((float *)&v733 + 1) = v549; | |
6888 v712 = (signed __int64)v549; | |
6889 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6890 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6891 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6892 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6893 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6894 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6895 v550 = v2 + 5; | |
6896 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6897 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6898 v731, | |
6899 v550, 0, 0); | |
6900 | |
6901 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6902 LODWORD(v727) = 1; | |
6903 break; | |
6904 } | |
6905 | |
6906 case SPELL_LIGHT_HOUR_OF_POWER: | |
6907 { | |
6908 v551 = v731 - 2; | |
6909 if ( !v551 ) | |
6910 goto LABEL_998; | |
6911 v552 = v551 - 1; | |
6912 if ( v552 ) | |
6913 { | |
6914 if ( v552 == 1 ) | |
6915 { | |
6916 amount = 15; | |
6917 HIDWORD(v733) = 20; | |
6918 goto LABEL_1000; | |
6919 } | |
6920 LABEL_998: | |
6921 v678 = 4; | |
6922 } | |
6923 else | |
6924 { | |
6925 v678 = 12; | |
6926 } | |
6927 amount = v678; | |
6928 HIDWORD(v733) = v678; | |
6929 LABEL_1000: | |
6930 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6931 break; | |
6932 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6933 v732 = (300 * amount * v2 + 60) << 7; | |
6934 v730 = v2 + 5; | |
6935 int _v726 = 0; | |
6936 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6937 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6938 do | |
6939 { | |
924 | 6940 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6941 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
6942 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
6943 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 6944 |
890 | 6945 //((SpellBuff *)(v553 + 6056))->Apply( |
6946 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6947 if ( *(_QWORD *)v553 ) | |
6948 _v726 = 1; | |
6949 ++v553; | |
6950 } | |
6951 while ( v553 <= &pParty->pPlayers[3] ); | |
6952 v562 = v731; | |
6953 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6954 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6955 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6956 if (!_v726) | |
6957 { | |
6958 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); | |
6959 } | |
6960 LODWORD(v727) = 1; | |
6961 break; | |
6962 } | |
6963 | |
6964 | |
6965 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
6966 { | |
6967 amount = 3; | |
6968 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6969 { | |
6970 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6971 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 6972 pCastSpell->spellnum = 0; |
890 | 6973 continue; |
6974 } | |
6975 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6976 break; | |
6977 a2 = 0; | |
6978 _this = (ItemGen *)&pPlayers[1]; | |
6979 do | |
6980 { | |
6981 v563 = 0; | |
889 | 6982 do |
6983 { | |
890 | 6984 v564 = _this->uItemID; |
6985 *(int *)(v563 + _this->uItemID) = 0; | |
6986 v563 += 8; | |
6987 *(int *)(v563 + v564 - 4) = 0; | |
6988 } | |
6989 while ( v563 <= 128 ); | |
6990 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6991 v566 = (Player **)_this; | |
6992 *(int *)(_this->uItemID + 6460) = v565; | |
6993 v567 = (*v566)->GetMaxMana(); | |
6994 *(int *)(_this->uItemID + 6464) = v567; | |
924 | 6995 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 6996 ++a2; |
6997 _this = (ItemGen *)((char *)_this + 4); | |
6998 } | |
6999 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
7000 v571 = pPlayer; | |
7001 v572 = (char *)&pPlayer->sAgeModifier; | |
7002 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
7003 *(short *)v572 = 120; | |
7004 else | |
7005 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
7006 sRecoveryTime += -5 * v2; | |
7007 ++v571->uNumDivineInterventionCastsThisDay; | |
7008 LODWORD(v727) = 1; | |
7009 break; | |
7010 } | |
7011 case SPELL_DARK_REANIMATE: | |
7012 { | |
7013 v573 = v731 - 2; | |
7014 if ( v573 ) | |
7015 { | |
7016 v574 = v573 - 1; | |
7017 if ( v574 ) | |
7018 { | |
7019 if ( v574 == 1 ) | |
7020 v575 = 5 * v2; | |
889 | 7021 else |
890 | 7022 v575 = 2 * v2; |
889 | 7023 } |
7024 else | |
7025 { | |
890 | 7026 v575 = 4 * v2; |
7027 } | |
7028 } | |
7029 else | |
7030 { | |
7031 v575 = 3 * v2; | |
7032 } | |
7033 amount = v575; | |
7034 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7035 break; | |
924 | 7036 v576 = pCastSpell->spell_target_pid; |
890 | 7037 if (!v576) |
7038 { | |
924 | 7039 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7040 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
890 | 7041 if ( *((_QWORD *)v585 + 14) ) |
7042 { | |
7043 ((Player *)v585)->SetCondition(0x11u, 1); | |
7044 v587 = ((Player *)v585)->GetSexByVoice(); | |
924 | 7045 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
890 | 7046 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7047 } | |
7048 break; | |
7049 } | |
7050 v577 = (Player *)(PID_ID(v576)); | |
7051 //v726 = v577; | |
7052 if ( v577 == (Player *)-1 ) | |
7053 { | |
7054 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7055 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7056 pCastSpell->spellnum = 0; |
890 | 7057 continue; |
7058 } | |
7059 v578 = (int)&pActors[(int)v577]; | |
7060 v721 = v578; | |
7061 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7062 { | |
7063 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7064 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7065 pCastSpell->spellnum = 0; |
890 | 7066 continue; |
7067 } | |
924 | 7068 ++pSpellSprite.uType; |
7069 pSpellSprite.stru_24.Reset(); | |
7070 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7071 pSpellSprite.spell_level = v2; | |
7072 pSpellSprite.spell_skill = v731; | |
7073 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7074 pSpellSprite.uAttributes = 0; | |
7075 pSpellSprite.uSectorID = 0; | |
7076 pSpellSprite.uSpriteFrameID = 0; | |
7077 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
890 | 7078 v581 = v721; |
924 | 7079 pSpellSprite.uFacing = 0; |
7080 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7081 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7082 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
7083 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
890 | 7084 v732 = *(short *)(v721 + 138); |
924 | 7085 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7086 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7087 pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7088 if ( *(char *)(v581 + 52) > amount ) |
7089 break; | |
7090 Actor::Resurrect((unsigned int)v577); | |
7091 *(char *)(v581 + 61) = 0; | |
7092 *(char *)(v581 + 53) = 0; | |
7093 *(char *)(v581 + 54) = 0; | |
7094 *(char *)(v581 + 55) = 0; | |
7095 *(char *)(v581 + 56) = 0; | |
7096 *(char *)(v581 + 57) = 0; | |
7097 *(int *)(v581 + 712) = 9999; | |
7098 *(char *)(v581 + 38) &= 0xF7u; | |
7099 *(int *)(v581 + 708) = 0; | |
7100 ((SpellBuff *)(v581 + 356))->Reset(); | |
7101 ((SpellBuff *)(v581 + 228))->Reset(); | |
7102 ((SpellBuff *)(v581 + 404))->Reset(); | |
7103 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7104 *(short *)(v581 + 40) = 10 * amount; | |
889 | 7105 LODWORD(v727) = 1; |
890 | 7106 break; |
7107 } | |
7108 case SPELL_DARK_VAMPIRIC_WEAPON: | |
7109 { | |
7110 v588 = v731 - 1; | |
7111 amount = 16; | |
7112 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7113 { | |
7114 if ( v590 == 1 ) | |
7115 LODWORD(v733) = 0; | |
7116 } | |
7117 else | |
7118 { | |
7119 LODWORD(v733) = 3600 * v2; | |
7120 } | |
7121 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7122 break; | |
7123 __debugbreak(); | |
924 | 7124 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
890 | 7125 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7126 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7127 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7128 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7129 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7130 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7131 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7132 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7133 { | |
7134 dword_50C9D0 = 113; | |
7135 dword_50C9D4 = 0; | |
7136 dword_50C9D8 = 1; | |
7137 | |
7138 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7139 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7140 pCastSpell->spellnum = 0; |
890 | 7141 continue; |
7142 } | |
7143 v592 = HIDWORD(v733); | |
7144 v14 = v731 == 4; | |
7145 *(int *)(HIDWORD(v733) + 12) = 16; | |
7146 if ( !v14 ) | |
7147 { | |
7148 v732 = (int)v733 << 7; | |
7149 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7150 *(int *)(v592 + 20) |= 8u; | |
7151 } | |
7152 *(char *)(v592 + 20) |= 0x80u; | |
7153 dword_50C9A8 = 256; | |
7154 LODWORD(v727) = 1; | |
7155 break; | |
7156 } | |
7157 case SPELL_DARK_SHARPMETAL: | |
7158 { | |
7159 v593 = v731 - 2; | |
7160 if ( !v593 ) | |
7161 goto LABEL_1062; | |
7162 v594 = v593 - 1; | |
7163 if ( v594 ) | |
7164 { | |
7165 if ( v594 == 1 ) | |
7166 amount = 9; | |
889 | 7167 else |
890 | 7168 LABEL_1062: |
7169 amount = 5; | |
7170 } | |
7171 else | |
7172 { | |
7173 amount = 7; | |
7174 } | |
7175 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7176 break; | |
7177 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
924 | 7178 pSpellSprite.stru_24.Reset(); |
7179 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7180 pSpellSprite.spell_level = v2; | |
7181 pSpellSprite.spell_skill = v731; | |
7182 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7183 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
7184 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
7185 pSpellSprite.uAttributes = 0; | |
7186 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7187 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 7188 pParty->vPosition.x, |
7189 pParty->vPosition.y, | |
7190 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
924 | 7191 pSpellSprite.uSpriteFrameID = 0; |
7192 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7193 pSpellSprite.spell_target_pid = a2; | |
7194 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7195 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7196 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 7197 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
890 | 7198 v596 = (signed int)_v726 / -2; |
7199 y = (char *)((signed int)_v726 / 2); | |
7200 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7201 { | |
7202 v597 = v715.uYawAngle; | |
889 | 7203 do |
7204 { | |
924 | 7205 pSpellSprite.uFacing = v596 + v597; |
7206 if ( pSpellSprite.Create( | |
890 | 7207 v596 + v597, |
7208 v715.uPitchAngle, | |
924 | 7209 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7210 pCastSpell->uPlayerID + 1) != -1 | |
890 | 7211 && pParty->bTurnBasedModeOn == 1 ) |
7212 ++pTurnEngine->field_1C; | |
7213 v596 += _v726 / (amount - 1); | |
7214 } | |
7215 while ( v596 <= (signed int)y ); | |
7216 } | |
7217 LODWORD(v727) = 1; | |
7218 break; | |
7219 } | |
7220 | |
7221 case SPELL_DARK_CONTROL_UNDEAD: | |
7222 { | |
7223 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7224 break; | |
7225 if ( v731 == 1 || v731 == 2 ) | |
7226 { | |
7227 v598 = 180 * v2; | |
924 | 7228 LODWORD(v733) = v598; |
7229 goto LABEL_1082; | |
890 | 7230 } |
7231 if ( v731 == 3 ) | |
7232 { | |
7233 v598 = 300 * v2; | |
7234 LODWORD(v733) = v598; | |
7235 goto LABEL_1082; | |
7236 } | |
7237 if ( v731 == 4 ) | |
7238 LODWORD(v733) = 29030400; | |
7239 LABEL_1082: | |
7240 if (PID_TYPE(a2) != OBJECT_Actor) | |
7241 { | |
7242 LODWORD(v727) = 1; | |
7243 break; | |
7244 } | |
7245 v730 = 836 * PID_ID(a2); | |
7246 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7247 break; | |
7248 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7249 { | |
7250 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7251 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7252 pCastSpell->spellnum = 0; |
890 | 7253 continue; |
7254 } | |
7255 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7256 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7257 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7258 v731, 0, 0, 0); | |
924 | 7259 pSpellSprite.stru_24.Reset(); |
7260 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7261 pSpellSprite.spell_level = v2; | |
7262 pSpellSprite.spell_skill = v731; | |
7263 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 7264 v61 = PID_ID(a2); |
7265 LABEL_1086: | |
7266 v600 = pActors[v61].vPosition.y; | |
7267 v601 = pActors[v61].vPosition.x; | |
924 | 7268 pSpellSprite.uObjectDescID = v60; |
7269 pSpellSprite.vPosition.x = v601; | |
890 | 7270 v602 = pActors[v61].uActorHeight; |
7271 v603 = pActors[v61].vPosition.z; | |
924 | 7272 pSpellSprite.vPosition.y = v600; |
890 | 7273 v676 = v603 + v602; |
7274 v665 = v600; | |
924 | 7275 pSpellSprite.vPosition.z = v603 + v602; |
890 | 7276 v657 = v601; |
7277 LABEL_1087: | |
924 | 7278 pSpellSprite.uAttributes = 0; |
7279 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7280 pSpellSprite.uSpriteFrameID = 0; | |
7281 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7282 pSpellSprite.spell_target_pid = a2; | |
7283 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7284 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
7285 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
7286 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
7287 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
7288 LODWORD(v727) = 1; | |
7289 break; | |
7290 } | |
890 | 7291 case SPELL_DARK_SACRIFICE: |
7292 { | |
7293 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7294 break; | |
7295 HIDWORD(v733) = 0; | |
7296 memset(&achievedAwardsIndex, 0, 4000); | |
7297 _this = 0; | |
7298 v605 = (char *)pParty->pHirelings; | |
7299 do | |
7300 { | |
7301 if ( *(int *)v605) | |
7302 { | |
7303 v606 = HIDWORD(v733)++; | |
7304 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); | |
7305 } | |
7306 _this = (ItemGen *)((char *)_this + 1); | |
7307 v605 += 76; | |
7308 } | |
7309 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7310 _this = 0; | |
7311 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7312 { | |
7313 v730 = (int)pNPCStats->pNewNPCData; | |
7314 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
889 | 7315 do |
7316 { | |
890 | 7317 if ( *(char *)(v730 + 8) & 0x80 |
7318 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7319 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7320 { | |
7321 v607 = HIDWORD(v733); | |
7322 HIDWORD(v733) += 4; | |
7323 *(int *)v607 = (int)_this + 3; | |
7324 } | |
7325 _this = (ItemGen *)((char *)_this + 1); | |
7326 v730 += 76; | |
7327 } | |
7328 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7329 } | |
924 | 7330 v608 = pCastSpell->uPlayerID_2; |
890 | 7331 if ( v608 != 4 && v608 != 5 |
7332 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7333 || v609 >= 3 ) | |
7334 { | |
7335 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7336 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7337 pCastSpell->spellnum = 0; |
890 | 7338 continue; |
7339 } | |
7340 v610 = 76 * v609; | |
7341 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7342 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7343 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7344 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7345 v612 = pParty->pPlayers; | |
7346 do | |
7347 { | |
7348 v612->sHealth = v612->GetMaxHealth(); | |
7349 v612->sMana = v612->GetMaxMana(); | |
7350 ++v612; | |
7351 } | |
7352 while ( v612 <= &pParty->pPlayers[3] ); | |
7353 v613 = &pOutdoor->ddm; | |
7354 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7355 v613 = &pIndoor->dlv; | |
7356 v613->uReputation += 15; | |
7357 if ( v613->uReputation > 10000 ) | |
7358 v613->uReputation = 10000; | |
7359 LODWORD(v727) = 1; | |
7360 break; | |
7361 } | |
7362 case SPELL_DARK_PAIN_REFLECTION: | |
7363 { | |
7364 if ( v731 <= 0 ) | |
7365 goto LABEL_1119; | |
7366 if ( v731 <= 3 ) | |
7367 { | |
7368 v614 = 300 * (v2 + 12); | |
7369 } | |
7370 else | |
7371 { | |
7372 if ( v731 != 4 ) | |
7373 goto LABEL_1119; | |
7374 v614 = 900 * (v2 + 4); | |
7375 } | |
7376 LODWORD(v733) = v614; | |
7377 LABEL_1119: | |
7378 v615 = v2 + 5; | |
7379 amount = v615; | |
7380 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7381 break; | |
7382 if ( v731 != 3 && v731 != 4 ) | |
7383 { | |
924 | 7384 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
7385 | |
7386 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 | 7387 LODWORD(v727) = 1; |
7388 break; | |
7389 } | |
7390 a2 = 0; | |
7391 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7392 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
7393 do | |
7394 { | |
924 | 7395 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
890 | 7396 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); |
7397 ++a2; | |
7398 ++v619; | |
7399 } | |
7400 while ( v619 <= &pParty->pPlayers[3] ); | |
7401 LODWORD(v727) = 1; | |
7402 break; | |
7403 } | |
7404 case SPELL_DARK_SOULDRINKER: | |
7405 { | |
7406 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7407 break; | |
7408 pGame->GetIndoorCamera(); | |
7409 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7410 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7411 v707.x = 0; | |
7412 v707.y = 0; | |
7413 v707.z = 0; | |
924 | 7414 pSpellSprite.stru_24.Reset(); |
7415 pSpellSprite.spell_id = pCastSpell->spellnum; | |
7416 pSpellSprite.spell_level = v2; | |
7417 pSpellSprite.spell_skill = v731; | |
7418 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
7419 pSpellSprite.uAttributes = 0; | |
7420 pSpellSprite.uSectorID = 0; | |
7421 pSpellSprite.uSpriteFrameID = 0; | |
7422 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
7423 pSpellSprite.uFacing = 0; | |
7424 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
7425 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 7426 a2 = 0; |
7427 int _v726 = 0; | |
7428 if ( SHIDWORD(v733) > 0 ) | |
7429 { | |
7430 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
889 | 7431 do |
7432 { | |
890 | 7433 v625 = dword_50BF30[a2]; |
924 | 7434 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; |
7435 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
890 | 7436 //v732 = pActors[v625].uActorHeight; |
924 | 7437 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); |
7438 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7439 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
890 | 7440 v628 = a2; |
7441 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7442 a2 = v628 + 1; | |
7443 } | |
7444 while ( v628 + 1 < SHIDWORD(v733) ); | |
7445 } | |
7446 v730 = 0; | |
7447 v629 = 1; | |
7448 do | |
7449 { | |
7450 v630 = pPlayers[v629]; | |
7451 if ( !v630->pConditions[2] | |
7452 && !v630->pConditions[12] | |
7453 && !v630->pConditions[13] | |
7454 && !v630->pConditions[14] | |
7455 && !v630->pConditions[15] | |
7456 && !v630->pConditions[16] ) | |
7457 { | |
7458 v631 = v730++; | |
7459 v681[v631] = v629; | |
7460 } | |
7461 ++v629; | |
7462 } | |
7463 while ( v629 <= 4 ); | |
7464 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7465 HIDWORD(v733) = 0; | |
7466 if ( v730 > 0 ) | |
7467 { | |
7468 do | |
7469 { | |
7470 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7471 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7472 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7473 v726->sHealth += v732; | |
7474 //v726 = *(Player **)v632; | |
7475 //v634 = v726->GetMaxHealth(); | |
7476 if ( v726->sHealth > v726->GetMaxHealth()) | |
7477 v726->sHealth = v726->GetMaxHealth(); | |
7478 v635 = HIDWORD(v733); | |
7479 | |
924 | 7480 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); |
890 | 7481 HIDWORD(v733) = v635 + 1; |
7482 } | |
7483 while ( v635 + 1 < v730 ); | |
7484 } | |
7485 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
7486 LODWORD(v727) = 1; | |
7487 break; | |
7488 } | |
7489 | |
7490 case SPELL_DARK_ARMAGEDDON: | |
7491 { | |
7492 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7493 { | |
7494 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7495 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7496 pCastSpell->spellnum = 0; |
890 | 7497 continue; |
7498 } | |
7499 v640 = v731 - 2; | |
7500 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7501 amount = 3; | |
7502 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7503 { | |
7504 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7505 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 7506 pCastSpell->spellnum = 0; |
890 | 7507 continue; |
7508 } | |
7509 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7510 break; | |
7511 pParty->armageddon_timer = 256; | |
7512 pParty->field_16140 = v2; | |
7513 ++pPlayer->uNumArmageddonCasts; | |
7514 if ( pParty->bTurnBasedModeOn == 1 ) | |
7515 ++pTurnEngine->field_1C; | |
7516 auto _v726 = 50; | |
7517 do | |
7518 { | |
7519 v642 = rand() % 4096 - 2048; | |
7520 v643 = rand(); | |
7521 v721 = v642 + pParty->vPosition.x; | |
7522 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7523 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7524 v644 = rand(); | |
7525 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7526 --_v726; | |
7527 } | |
7528 while ( _v726 != 0 ); | |
7529 LODWORD(v727) = 1; | |
7530 break; | |
7531 } | |
7532 | |
7533 default: | |
7534 break; | |
7535 } | |
924 | 7536 if ( pCastSpell->field_8 & 0x20 ) |
890 | 7537 { |
7538 if ( v727 != 0.0 ) | |
924 | 7539 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 7540 } |
7541 else | |
7542 { | |
7543 if ( sRecoveryTime < 0 ) | |
7544 sRecoveryTime = 0; | |
7545 if ( pParty->bTurnBasedModeOn ) | |
7546 { | |
7547 v645 = sRecoveryTime; | |
924 | 7548 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 7549 pPlayer->SetRecoveryTime(v645); |
7550 if ( !some_active_character ) | |
7551 pTurnEngine->_40471C(); | |
7552 } | |
7553 else | |
7554 { | |
7555 pPlayer->SetRecoveryTime( | |
7556 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
7557 } | |
7558 if ( v727 != 0.0 ) | |
7559 { | |
7560 pPlayer->PlaySound(SPEECH_49, 0); | |
7561 if ( v727 != 0.0 ) | |
924 | 7562 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
7563 pCastSpell->spellnum = 0; | |
890 | 7564 v2 = v723; |
7565 continue; | |
889 | 7566 } |
7567 } | |
924 | 7568 pCastSpell->spellnum = 0; |
890 | 7569 v2 = v723; |
7570 continue; | |
7571 | |
889 | 7572 //LABEL_1166: |
7573 // ++n; | |
7574 // if ( n >= 10 ) | |
7575 // return; | |
0 | 7576 } |
488 | 7577 |
889 | 7578 |
0 | 7579 } |
7580 //----- (0042EB42) -------------------------------------------------------- | |
7581 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7582 { | |
7583 unsigned int v2; // edx@1 | |
7584 signed int v3; // eax@1 | |
7585 char *v4; // ecx@2 | |
7586 | |
7587 v2 = this->uNumObjects; | |
7588 v3 = 0; | |
7589 if ( (signed int)this->uNumObjects <= 0 ) | |
7590 { | |
7591 LABEL_5: | |
7592 LOWORD(v3) = 0; | |
7593 } | |
7594 else | |
7595 { | |
7596 v4 = (char *)&this->pObjects->uObjectID; | |
7597 while ( uItemID != *(short *)v4 ) | |
7598 { | |
7599 ++v3; | |
7600 v4 += 56; | |
7601 if ( v3 >= (signed int)v2 ) | |
7602 goto LABEL_5; | |
7603 } | |
7604 } | |
7605 return v3; | |
7606 } | |
7607 | |
7608 //----- (0042EB78) -------------------------------------------------------- | |
7609 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7610 { | |
7611 return 8 * this->pIcons[uIconID].uAnimLength; | |
7612 } | |
7613 | |
437 | 7614 const wchar_t *UIMessage2String(UIMessageType msg) |
7615 { | |
7616 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7617 static wchar_t b[256]; // bad for threads | |
7618 switch (msg) | |
7619 { | |
7620 CASE(UIMSG_SelectSpell) | |
7621 CASE(UIMSG_ChangeGameState) | |
7622 CASE(UIMSG_Attack) | |
7623 CASE(UIMSG_PlayArcomage) | |
7624 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7625 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7626 CASE(UIMSG_ShowCredits) | |
7627 CASE(UIMSG_ExitToWindows) | |
7628 CASE(UIMSG_PlayerCreationChangeName) | |
7629 CASE(UIMSG_PlayerCreationClickPlus) | |
7630 CASE(UIMSG_PlayerCreationClickMinus) | |
7631 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7632 CASE(UIMSG_PlayerCreationSelectClass) | |
7633 CASE(UIMSG_PlayerCreationClickOK) | |
7634 CASE(UIMSG_PlayerCreationClickReset) | |
7635 CASE(UIMSG_AutonotesBook) | |
7636 CASE(UIMSG_PlayerCreationRemoveUpSkill) | |
7637 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7638 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7639 CASE(UIMSG_LoadGame) | |
7640 CASE(UIMSG_SaveGame) | |
7641 CASE(UIMSG_ShowStatus_DateTime) | |
7642 CASE(UIMSG_ShowStatus_ManaHP) | |
7643 CASE(UIMSG_ShowStatus_Player) | |
7644 CASE(UIMSG_Wait5Minutes) | |
7645 CASE(UIMSG_Wait1Hour) | |
7646 CASE(UIMSG_ShowStatus_Food) | |
7647 CASE(UIMSG_ShowStatus_Funds) | |
7648 CASE(UIMSG_QuickReference) | |
7649 CASE(UIMSG_GameMenuButton) | |
7650 CASE(UIMSG_AlreadyResting) | |
7651 CASE(UIMSG_SelectCharacter) | |
7652 CASE(UIMSG_ChangeSoundVolume) | |
7653 CASE(UIMSG_ChangeMusicVolume) | |
7654 CASE(UIMSG_Escape) | |
7655 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7656 CASE(UIMSG_InventoryLeftClick) | |
7657 CASE(UIMSG_SkillUp) | |
7658 CASE(UIMSG_GameMenu_ReturnToGame) | |
7659 CASE(UIMSG_StartNewGame) | |
7660 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7661 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7662 CASE(UIMSG_Game_OpenOptionsDialog) | |
7663 CASE(UIMSG_SetGraphicsMode) | |
7664 CASE(UIMSG_Quit) | |
7665 CASE(UIMSG_StartHireling1Dialogue) | |
7666 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7667 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7668 CASE(UIMSG_CastSpellFromBook) |
7669 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7670 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7671 CASE(UIMSG_StartNPCDialogue) | |
7672 CASE(UIMSG_ArrowUp) | |
7673 CASE(UIMSG_DownArrow) | |
7674 CASE(UIMSG_LoadSlot) | |
7675 CASE(UIMSG_SelectLoadSlot) | |
7676 CASE(UIMSG_Cancel) | |
7677 CASE(UIMSG_ExitRest) | |
7678 CASE(UIMSG_PlayerCreation_FacePrev) | |
7679 CASE(UIMSG_PlayerCreation_FaceNext) | |
7680 CASE(UIMSG_CycleCharacters) | |
7681 CASE(UIMSG_SetTurnSpeed) | |
7682 CASE(UIMSG_ToggleWalkSound) | |
7683 CASE(UIMSG_ChangeVoiceVolume) | |
7684 CASE(UIMSG_ToggleShowDamage) | |
7685 CASE(UIMSG_ScrollNPCPanel) | |
7686 CASE(UIMSG_ShowFinalWindow) | |
7687 CASE(UIMSG_OpenQuestBook) | |
7688 CASE(UIMSG_OpenAutonotes) | |
7689 CASE(UIMSG_OpenMapBook) | |
7690 CASE(UIMSG_OpenCalendar) | |
7691 CASE(UIMSG_OpenHistoryBook) | |
7692 CASE(UIMSG_ToggleAlwaysRun) | |
7693 CASE(UIMSG_ToggleFlipOnExit) | |
7694 CASE(UIMSG_Game_Action) | |
907 | 7695 CASE(UIMSG_RentRoom) |
437 | 7696 CASE(UIMSG_TransitionUI_Confirm) |
7697 CASE(UIMSG_OpenKeyMappingOptions) | |
7698 CASE(UIMSG_SelectKeyPage1) | |
7699 CASE(UIMSG_SelectKeyPage2) | |
7700 CASE(UIMSG_ResetKeyMapping) | |
7701 CASE(UIMSG_ChangeKeyButton) | |
7702 CASE(UIMSG_OpenVideoOptions) | |
7703 CASE(UIMSG_ToggleBloodsplats) | |
7704 CASE(UIMSG_ToggleColoredLights) | |
7705 CASE(UIMSG_ToggleTint) | |
7706 default: | |
7707 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7708 }; | |
7709 #undef CASE | |
7710 } | |
7711 | |
0 | 7712 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7713 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7714 { |
482 | 7715 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7716 if (uNumMessages < 40) |
7717 { | |
437 | 7718 files[uNumMessages] = file; |
7719 lines[uNumMessages] = line; | |
7720 | |
0 | 7721 pMessages[uNumMessages].eType = msg; |
7722 pMessages[uNumMessages].param = param; | |
7723 pMessages[uNumMessages++].field_8 = a4; | |
7724 } | |
7725 } | |
7726 | |
7727 //----- (0042EBBE) -------------------------------------------------------- | |
7728 int __fastcall sub_42EBBE(int a1, int a2) | |
7729 { | |
7730 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7731 } | |
7732 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7733 | |
7734 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7735 int stru193_math::Sin(int angle) |
0 | 7736 { |
323 | 7737 return Cos(angle - this->uIntegerHalfPi); |
0 | 7738 } |
7739 | |
7740 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7741 void _42ECB5_PlayerAttacksActor() |
0 | 7742 { |
271 | 7743 //unsigned int v0; // ebx@1 |
7744 //Player *v1; // esi@1 | |
7745 //bool result; // eax@1 | |
295 | 7746 //int v3; // edi@2 |
271 | 7747 //unsigned int v4; // eax@7 |
0 | 7748 char *v5; // eax@8 |
271 | 7749 //int v6; // ecx@9 |
7750 //signed int v7; // eax@16 | |
295 | 7751 //Actor *v8; // edi@20 |
0 | 7752 unsigned int v9; // ecx@21 |
295 | 7753 //char *v10; // eax@26 |
0 | 7754 char *v11; // eax@26 |
7755 unsigned int v12; // eax@47 | |
295 | 7756 //char *v13; // eax@47 |
7757 //char *v14; // eax@47 | |
7758 //unsigned int v15; // ebx@54 | |
7759 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7760 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7761 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7762 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7763 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7764 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7765 //int v22; // [sp-4h] [bp-40h]@24 | |
7766 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7767 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7768 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7769 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7770 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7771 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7772 //unsigned int *v28b; |
295 | 7773 //int v29; // [sp+24h] [bp-18h]@16 |
7774 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7775 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7776 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7777 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7778 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7779 |
271 | 7780 //v0 = uActiveCharacter; |
7781 //v27 = 6972 * uActiveCharacter; | |
7782 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7783 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7784 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7785 if (!player->CanAct()) | |
7786 return; | |
7787 | |
924 | 7788 pCastSpellInfo->_427D48(uActiveCharacter); |
295 | 7789 //v3 = 0; |
271 | 7790 if (pParty->Invisible()) |
7791 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7792 | |
7793 //v31 = player->pEquipment.uBow; | |
7794 int bow_idx = player->pEquipment.uBow; | |
7795 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7796 bow_idx = 0; | |
7797 | |
295 | 7798 //v32 = 0; |
7799 int wand_item_id = 0; | |
271 | 7800 //v33 = 0; |
7801 //v4 = v1->pEquipment.uMainHand; | |
7802 int laser_weapon_item_id = 0; | |
7803 | |
7804 int main_hand_idx = player->pEquipment.uMainHand; | |
7805 if (main_hand_idx) | |
0 | 7806 { |
271 | 7807 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7808 //v5 = (char *)v1 + 36 * v4; |
271 | 7809 if (!item->Broken()) |
7810 { | |
7811 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7812 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7813 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7814 { |
295 | 7815 if (item->uNumCharges <= 0) |
7816 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7817 else |
295 | 7818 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7819 } |
271 | 7820 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7821 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7822 } |
271 | 7823 } |
7824 | |
295 | 7825 //v30 = 0; |
7826 //v29 = 0; | |
7827 //v28 = 0; | |
271 | 7828 //v7 = pMouse->uPointingObjectID; |
7829 | |
7830 int target_pid = pMouse->uPointingObjectID; | |
848 | 7831 int target_type = PID_TYPE(target_pid), |
7832 target_id = PID_ID(target_pid); | |
271 | 7833 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7834 { | |
7835 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7836 target_type = PID_TYPE(target_pid); |
7837 target_id = PID_ID(target_pid); | |
271 | 7838 } |
295 | 7839 |
7840 auto actor = &pActors[target_id]; | |
7841 int actor_distance = 0; | |
271 | 7842 if (target_type == OBJECT_Actor) |
7843 { | |
295 | 7844 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7845 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7846 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7847 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7848 if (actor_distance < 0) | |
7849 actor_distance = 0; | |
7850 } | |
7851 | |
7852 bool shooting_bow = false, | |
7853 shotting_laser = false, | |
816 | 7854 shooting_wand = false, |
7855 melee_attack = false; | |
295 | 7856 if (laser_weapon_item_id) |
7857 { | |
7858 shotting_laser = true; | |
490 | 7859 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7860 } |
7861 else if (wand_item_id) | |
7862 { | |
7863 shooting_wand = true; | |
7864 | |
7865 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7866 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7867 |
7868 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7869 player->pEquipment.uMainHand = 0; | |
7870 } | |
303 | 7871 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7872 { |
816 | 7873 melee_attack = true; |
7874 | |
303 | 7875 Vec3_int_ a3; |
7876 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7877 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7878 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7879 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7880 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7881 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7882 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7883 _42FA66_do_explosive_impact( |
7884 actor->vPosition.x, | |
7885 actor->vPosition.y, | |
7886 actor->vPosition.z + actor->uActorHeight / 2, | |
7887 0, 512, uActiveCharacter); | |
303 | 7888 } |
7889 else if (bow_idx) | |
7890 { | |
7891 shooting_bow = true; | |
490 | 7892 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7893 } |
7894 else | |
7895 { | |
816 | 7896 melee_attack = true; |
303 | 7897 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7898 } | |
7899 | |
816 | 7900 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7901 { |
816 | 7902 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7903 if (recovery < 30 ) |
7904 recovery = 30; | |
816 | 7905 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7906 } |
7907 | |
7908 | |
7909 int v34 = 0; | |
7910 if (shooting_wand) | |
7911 return; | |
7912 else if (shooting_bow) | |
7913 { | |
7914 v34 = 5; | |
7915 player->PlaySound(SPEECH_50, 0); | |
7916 } | |
7917 if (shotting_laser) | |
7918 v34 = 7; | |
7919 else | |
7920 { | |
7921 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7922 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7923 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7924 pTurnEngine->_40471C(); | |
7925 } | |
7926 | |
7927 switch (v34) | |
7928 { | |
7929 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7930 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7931 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7932 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7933 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7934 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7935 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7936 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7937 } | |
0 | 7938 } |
7939 | |
7940 //----- (0042F184) -------------------------------------------------------- | |
295 | 7941 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7942 { |
7943 int v4; // edi@1 | |
7944 stru319 *v5; // esi@1 | |
7945 int v6; // eax@2 | |
7946 int v7; // eax@4 | |
7947 int result; // eax@5 | |
7948 int *v9; // edx@8 | |
7949 signed int v10; // ebx@10 | |
7950 int v11; // edi@11 | |
7951 Actor *v12; // esi@12 | |
7952 unsigned __int16 v13; // ax@12 | |
7953 int v14; // eax@22 | |
7954 char v15; // zf@30 | |
7955 int v16; // esi@32 | |
7956 int v17; // ecx@34 | |
7957 stru319 *v18; // eax@39 | |
7958 int v19; // edx@39 | |
7959 int v20; // ecx@41 | |
7960 unsigned __int16 v21; // ax@42 | |
7961 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7962 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7963 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7964 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7965 int *v26; // [sp+18h] [bp-14h]@8 | |
7966 int v27; // [sp+1Ch] [bp-10h]@10 | |
7967 int *v28; // [sp+20h] [bp-Ch]@10 | |
7968 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7969 int v30; // [sp+28h] [bp-4h]@6 | |
7970 int i; // [sp+38h] [bp+Ch]@33 | |
7971 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7972 | |
7973 v4 = 0; | |
7974 v5 = this; | |
7975 v24 = this; | |
7976 if ( pRenderer->pRenderD3D ) | |
7977 { | |
7978 v6 = a3 != 0; | |
7979 if ( a4 ) | |
7980 LOBYTE(v6) = v6 | 8; | |
295 | 7981 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7982 if ( v7 != -1 ) |
7983 return (unsigned __int16)v7; | |
295 | 7984 else return 0; |
0 | 7985 } |
7986 else | |
7987 { | |
7988 v30 = 0; | |
7989 if ( pRenderer->pActiveZBuffer ) | |
7990 { | |
692 | 7991 v29 = viewparams->uScreen_topL_X; |
7992 v23 = viewparams->uScreen_BttmR_X; | |
7993 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7994 { |
692 | 7995 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7996 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7997 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7998 do |
7999 { | |
8000 if ( (signed int)v29 < (signed int)v23 ) | |
8001 { | |
8002 v28 = v9; | |
8003 v10 = v4; | |
8004 v27 = v23 - v29; | |
8005 do | |
8006 { | |
8007 v22 = *v28; | |
8008 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8009 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 8010 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8011 v12 = &pActors[PID_ID(v11)]; |
0 | 8012 v13 = v12->uAIState; |
8013 if ( v13 != 5 ) | |
8014 { | |
8015 if ( v13 != 4 | |
8016 && v13 != 11 | |
8017 && v13 != 19 | |
8018 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8019 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 8020 { |
8021 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 8022 && v22 <= pick_depth << 16 ) |
0 | 8023 { |
8024 v14 = 0; | |
8025 if ( v10 > 0 ) | |
8026 { | |
8027 do | |
8028 { | |
8029 if ( dword_50BDA0[v14] == v11 ) | |
8030 break; | |
8031 ++v14; | |
8032 } | |
8033 while ( v14 < v30 ); | |
8034 } | |
8035 if ( v14 == v30 && v10 < 100 ) | |
8036 { | |
8037 ++v30; | |
8038 dword_50BC10[v10] = v22; | |
8039 dword_50BDA0[v10] = v11; | |
8040 ++v10; | |
8041 } | |
8042 } | |
8043 } | |
8044 } | |
8045 } | |
8046 ++v28; | |
8047 --v27; | |
8048 } | |
8049 while ( v27 ); | |
8050 v4 = v30; | |
8051 v5 = v24; | |
8052 } | |
8053 v9 = v26 + 640; | |
8054 v15 = v25-- == 1; | |
8055 v26 += 640; | |
8056 } | |
8057 while ( !v15 ); | |
8058 } | |
8059 if ( v4 > 0 ) | |
8060 { | |
8061 v32 = 1; | |
8062 v16 = (int)dword_50BC10; | |
8063 do | |
8064 { | |
8065 for ( i = v32; i < v4; ++i ) | |
8066 { | |
8067 v17 = dword_50BC10[i]; | |
8068 if ( v17 < *(int *)v16 ) | |
8069 { | |
8070 dword_50BC10[i] = *(int *)v16; | |
8071 *(int *)v16 = v17; | |
8072 } | |
8073 } | |
8074 ++v32; | |
8075 v16 += 4; | |
8076 } | |
8077 while ( v32 - 1 < v4 ); | |
8078 v5 = v24; | |
8079 if ( v4 > 0 ) | |
8080 { | |
8081 v18 = v24; | |
8082 v19 = v4; | |
8083 do | |
8084 { | |
8085 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8086 v18 += 4; | |
8087 --v19; | |
8088 } | |
8089 while ( v19 ); | |
8090 } | |
8091 } | |
8092 v20 = 0; | |
8093 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8094 { | |
8095 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8096 if ( v21 != 4 && v21 != 5 ) | |
8097 break; | |
8098 } | |
8099 if ( v20 != v4 ) | |
8100 { | |
8101 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8102 LOBYTE(result) = result | 3; | |
8103 return result; | |
8104 } | |
8105 } | |
8106 } | |
8107 return 0; | |
8108 } | |
8109 | |
8110 //----- (0042F3D6) -------------------------------------------------------- | |
8111 void InitializeTurnBasedAnimations(void *_this) | |
8112 { | |
8113 unsigned int *v1; // edi@1 | |
8114 | |
8115 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8116 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8117 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8118 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8119 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8120 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8121 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8122 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8123 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8124 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8125 v1 = pIconIDs_Turn; | |
8126 do | |
8127 { | |
8128 pIconsFrameTable->InitializeAnimation(*v1); | |
8129 ++v1; | |
8130 } | |
8131 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8132 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8133 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8134 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8135 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8136 } | |
8137 | |
8138 //----- (0042F4DA) -------------------------------------------------------- | |
8139 signed int __cdecl sub_42F4DA() | |
8140 { | |
8141 signed int v0; // edi@1 | |
82 | 8142 Actor *v1; // esi@4 |
0 | 8143 int v2; // ebx@5 |
8144 int v3; // eax@5 | |
8145 int v4; // ebx@5 | |
8146 unsigned int v5; // ecx@5 | |
8147 int v6; // edx@6 | |
8148 unsigned int v7; // edx@8 | |
8149 unsigned int v8; // edx@10 | |
8150 __int16 v9; // ax@12 | |
8151 signed int result; // eax@20 | |
8152 int v11; // [sp+Ch] [bp-10h]@5 | |
8153 int v12; // [sp+10h] [bp-Ch]@5 | |
8154 signed int v13; // [sp+14h] [bp-8h]@3 | |
8155 | |
8156 v0 = 5120; | |
8157 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8158 v0 = 2560; | |
8159 v13 = 0; | |
8160 if ( (signed int)uNumActors <= 0 ) | |
8161 { | |
8162 LABEL_20: | |
8163 result = 0; | |
8164 } | |
8165 else | |
8166 { | |
82 | 8167 v1 = pActors; |
0 | 8168 while ( 1 ) |
8169 { | |
82 | 8170 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8171 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8172 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8173 v3 = v2; |
8174 v4 = v11; | |
8175 v5 = v12; | |
8176 if ( v3 < v11 ) | |
8177 { | |
8178 v6 = v3; | |
8179 v3 = v11; | |
8180 v4 = v6; | |
8181 } | |
8182 if ( v3 < v12 ) | |
8183 { | |
8184 v7 = v3; | |
8185 v3 = v12; | |
8186 v5 = v7; | |
8187 } | |
8188 if ( v4 < (signed int)v5 ) | |
8189 { | |
8190 v8 = v5; | |
8191 v5 = v4; | |
8192 v4 = v8; | |
8193 } | |
8194 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8195 { | |
82 | 8196 v9 = v1->uAIState; |
8197 if ( v1->uAIState != 5 ) | |
0 | 8198 { |
8199 if ( v9 != 4 | |
8200 && v9 != 11 | |
8201 && v9 != 19 | |
8202 && v9 != 17 | |
82 | 8203 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8204 break; |
8205 } | |
8206 } | |
8207 ++v13; | |
82 | 8208 ++v1; |
0 | 8209 if ( v13 >= (signed int)uNumActors ) |
8210 goto LABEL_20; | |
8211 } | |
8212 result = 1; | |
8213 } | |
8214 return result; | |
8215 } | |
8216 | |
8217 //----- (0042F7EB) -------------------------------------------------------- | |
8218 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) | |
8219 { | |
8220 unsigned int v9; // edi@1 | |
8221 signed int v10; // edx@3 | |
8222 char *v11; // ecx@4 | |
8223 unsigned __int16 v12; // ax@7 | |
8224 unsigned int v13; // edx@9 | |
8225 char *v14; // ecx@10 | |
8226 int v15; // esi@17 | |
8227 int v16; // eax@18 | |
8228 int v17; // edi@20 | |
8229 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8230 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8231 int v21; // [sp+7Ch] [bp-8h]@1 |
8232 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8233 | |
8234 v9 = uSpriteID; | |
8235 v21 = x; | |
8236 v22 = uSpriteID; | |
8237 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8238 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
|
8239 //SpriteObject::SpriteObject(&a1a); |
0 | 8240 a1a.stru_24.Reset(); |
8241 | |
8242 if ( a9 ) | |
8243 { | |
8244 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8245 v9 = v22; | |
8246 } | |
8247 v10 = 0; | |
822 | 8248 a1a.spell_skill = 0; |
8249 a1a.spell_level = 0; | |
8250 a1a.spell_id = 0; | |
0 | 8251 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8252 a1a.uType = v9; |
0 | 8253 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8254 { | |
8255 LABEL_7: | |
8256 v12 = 0; | |
8257 } | |
8258 else | |
8259 { | |
8260 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8261 while ( (short)v9 != *(short *)v11 ) | |
8262 { | |
8263 ++v10; | |
8264 v11 += 56; | |
8265 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8266 goto LABEL_7; | |
8267 } | |
8268 v12 = v10; | |
8269 } | |
8270 a1a.uObjectDescID = v12; | |
8271 a1a.vPosition.z = z; | |
8272 a1a.vPosition.x = v21; | |
8273 a1a.vPosition.y = y; | |
8274 a1a.uSoundID = 0; | |
8275 a1a.uAttributes = attributes; | |
8276 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8277 a1a.uSpriteFrameID = 0; | |
822 | 8278 a1a.spell_caster_pid = 0; |
823 | 8279 a1a.spell_target_pid = 0; |
0 | 8280 if ( !(a1a.uAttributes & 0x10) ) |
8281 { | |
8282 v13 = 0; | |
222 | 8283 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8284 { |
8285 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8286 while ( *(short *)v14 != v9 ) | |
8287 { | |
8288 ++v13; | |
8289 v14 += 48; | |
222 | 8290 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8291 goto LABEL_16; |
8292 } | |
8293 a1a.stru_24.uItemID = v13; | |
8294 } | |
8295 } | |
8296 LABEL_16: | |
8297 if ( a7 ) | |
8298 { | |
8299 v15 = count; | |
8300 if ( count > 0 ) | |
8301 { | |
8302 do | |
8303 { | |
8304 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8305 v16 = rand(); | |
8306 a1a.Create( | |
8307 (signed __int16)a1a.uFacing, | |
8308 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8309 a4, | |
8310 0); | |
8311 --v15; | |
8312 } | |
8313 while ( v15 ); | |
8314 } | |
8315 } | |
8316 else | |
8317 { | |
8318 v17 = count; | |
8319 v18 = stru_5C6E00->uIntegerHalfPi; | |
8320 a1a.uFacing = 0; | |
8321 if ( count > 0 ) | |
8322 { | |
8323 do | |
8324 { | |
8325 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8326 --v17; | |
8327 } | |
8328 while ( v17 ); | |
8329 } | |
8330 } | |
8331 return 1; | |
8332 } | |
8333 | |
8334 //----- (0042F960) -------------------------------------------------------- | |
8335 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8336 { | |
8337 int v3; // ebx@1 | |
8338 int v4; // edi@1 | |
8339 signed int v5; // edx@1 | |
8340 char *v6; // ecx@2 | |
8341 unsigned __int16 v7; // ax@5 | |
8342 signed int v8; // eax@6 | |
8343 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8344 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8345 |
8346 v3 = x; | |
8347 v4 = y; | |
8348 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8349 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
|
8350 //SpriteObject::SpriteObject(&a1); |
0 | 8351 a1.stru_24.Reset(); |
8352 | |
8353 v5 = 0; | |
822 | 8354 a1.spell_skill = 0; |
8355 a1.spell_level = 0; | |
8356 a1.spell_id = 0; | |
0 | 8357 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8358 a1.uType = 800; |
0 | 8359 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8360 { | |
8361 LABEL_5: | |
8362 v7 = 0; | |
8363 } | |
8364 else | |
8365 { | |
8366 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8367 while ( *(short *)v6 != 800 ) | |
8368 { | |
8369 ++v5; | |
8370 v6 += 56; | |
8371 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8372 goto LABEL_5; | |
8373 } | |
8374 v7 = v5; | |
8375 } | |
8376 a1.uObjectDescID = v7; | |
8377 a1.vPosition.x = v3; | |
8378 a1.vPosition.y = v4; | |
8379 a1.vPosition.z = z; | |
8380 a1.uSoundID = 0; | |
8381 a1.uAttributes = 0; | |
8382 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8383 a1.uSpriteFrameID = 0; | |
822 | 8384 a1.spell_caster_pid = 0; |
823 | 8385 a1.spell_target_pid = 0; |
0 | 8386 v8 = a1.Create(0, 0, 0, 0); |
8387 if ( v8 != -1 ) | |
8388 { | |
8389 v9 = 8 * v8; | |
8390 LOBYTE(v9) = v9 | 2; | |
8391 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8392 } | |
8393 } | |
8394 | |
810 | 8395 |
0 | 8396 |
8397 //----- (0042FA66) -------------------------------------------------------- | |
8398 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8399 { | |
8400 int v6; // edi@1 | |
8401 int v7; // esi@1 | |
8402 char *v8; // ecx@2 | |
8403 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8404 //int v10; // eax@10 |
0 | 8405 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8406 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8407 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8408 int v14; // [sp+7Ch] [bp-4h]@1 |
8409 | |
8410 v6 = a1; | |
8411 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8412 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
|
8413 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8414 a1a.uType = 600; |
0 | 8415 a1a.stru_24.Reset(); |
8416 | |
822 | 8417 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8418 a1a.spell_level = 8; | |
8419 a1a.spell_skill = 3; | |
0 | 8420 v14 = 0; |
8421 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8422 { | |
8423 LABEL_5: | |
8424 v9 = 0; | |
8425 } | |
8426 else | |
8427 { | |
8428 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8429 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8430 { |
8431 ++v14; | |
8432 v8 += 56; | |
8433 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8434 goto LABEL_5; | |
8435 } | |
8436 v9 = v14; | |
8437 } | |
8438 a1a.uObjectDescID = v9; | |
8439 a1a.vPosition.x = v6; | |
8440 a1a.vPosition.y = v7; | |
8441 a1a.vPosition.z = a3; | |
8442 a1a.uAttributes = 0; | |
8443 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8444 a1a.uSpriteFrameID = 0; | |
823 | 8445 a1a.spell_target_pid = 0; |
0 | 8446 a1a.field_60_distance_related_prolly_lod = 0; |
8447 a1a.uFacing = 0; | |
8448 a1a.uSoundID = 0; | |
8449 if ( a6 >= 1 || a6 <= 4 ) | |
8450 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8451 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8452 } |
8453 else | |
8454 { | |
822 | 8455 a1a.spell_caster_pid = 0; |
0 | 8456 } |
8457 result = a1a.Create(0, 0, 0, 0); | |
8458 if ( result != -1 ) | |
8459 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8460 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8461 a5, |
8462 SLOWORD(a1a.vPosition.x), | |
8463 SLOWORD(a1a.vPosition.y), | |
8464 SLOWORD(a1a.vPosition.z), | |
8465 0, | |
8466 0); | |
8467 } | |
8468 return result; | |
8469 } | |
8470 | |
8471 //----- (0042FB5C) -------------------------------------------------------- | |
8472 bool __fastcall sub_42FB5C(signed int a1) | |
8473 { | |
8474 int v1; // ecx@3 | |
8475 int v2; // ecx@4 | |
8476 int v3; // ecx@5 | |
8477 int v4; // ecx@6 | |
8478 int v5; // ecx@7 | |
8479 int v6; // ecx@8 | |
8480 char v7; // zf@9 | |
8481 | |
8482 if ( a1 > 39 ) | |
8483 { | |
8484 if ( a1 > 77 ) | |
8485 { | |
8486 if ( a1 == 80 ) | |
8487 return 0; | |
8488 if ( a1 > 84 ) | |
8489 { | |
8490 if ( a1 <= 86 ) | |
8491 return 0; | |
8492 v7 = a1 == 95; | |
8493 goto LABEL_20; | |
8494 } | |
8495 } | |
8496 else | |
8497 { | |
8498 if ( a1 == 77 ) | |
8499 return 0; | |
8500 if ( a1 >= 46 ) | |
8501 { | |
8502 if ( a1 <= 47 || a1 == 51 ) | |
8503 return 0; | |
8504 v7 = a1 == 73; | |
8505 goto LABEL_20; | |
8506 } | |
8507 } | |
8508 return 1; | |
8509 } | |
8510 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8511 return 1; | |
8512 v2 = v1 - 3; | |
8513 if ( !v2 ) | |
8514 return 0; | |
8515 v3 = v2 - 1; | |
8516 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8517 return 1; | |
8518 v5 = v4 - 8; | |
8519 if ( !v5 ) | |
8520 return 0; | |
8521 v6 = v5 - 1; | |
8522 if ( !v6 ) | |
8523 return 1; | |
8524 v7 = v6 == 20; | |
8525 LABEL_20: | |
8526 if ( !v7 ) | |
8527 return 1; | |
8528 return 0; | |
8529 } | |
8530 | |
8531 //----- (0042FBDD) -------------------------------------------------------- | |
8532 void __cdecl sub_42FBDD() | |
8533 { | |
388 | 8534 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8535 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8536 pRenderer->Present(); | |
8537 } | |
8538 | |
8539 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8540 void __cdecl CloseWindowBackground() |
0 | 8541 { |
388 | 8542 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8543 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8544 pRenderer->Present(); | |
8545 } | |
8546 | |
8547 //----- (0042FC4E) -------------------------------------------------------- | |
8548 void __cdecl ProcessInputActions() | |
8549 { | |
8550 ActionQueue *pActionQueue; // esi@7 | |
832 | 8551 //Keyboard *v3; // ecx@8 |
0 | 8552 char v4; // al@9 |
8553 ActionQueue *v5; // ecx@19 | |
8554 Player *v6; // ecx@86 | |
8555 Player *v7; // esi@100 | |
8556 char v8; // bl@100 | |
8557 unsigned __int16 v9; // ax@102 | |
8558 int v10; // eax@103 | |
8559 unsigned int v11; // eax@127 | |
8560 signed int v12; // esi@157 | |
8561 Keyboard *v13; // ecx@158 | |
8562 char v14; // al@159 | |
8563 unsigned int v15; // eax@168 | |
8564 void *v16; // esi@177 | |
8565 int v17; // [sp-14h] [bp-1Ch]@8 | |
8566 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8567 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 | |
271 | 8568 //__int16 v20; // [sp-14h] [bp-1Ch]@60 |
0 | 8569 int v21; // [sp-14h] [bp-1Ch]@68 |
8570 int v22; // [sp-Ch] [bp-14h]@158 | |
8571 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8572 int v24; // [sp+4h] [bp-4h]@87 | |
8573 | |
8574 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8575 auto pKeyboard = pGame->pKeyboardInstance; | |
8576 if (!bAlwaysRun) | |
8577 { | |
8578 if (pKeyboard->IsShiftHeld()) | |
8579 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8580 else | |
8581 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8582 } | |
8583 else | |
8584 { | |
8585 if (pKeyboard->IsShiftHeld()) | |
8586 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8587 else | |
8588 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8589 } | |
8590 | |
140 | 8591 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
486 | 8592 //LABEL_6: |
0 | 8593 if ( !pEventTimer->bPaused ) |
8594 { | |
8595 inputAction = (InputAction)0; | |
8596 pActionQueue = pPartyActionQueue; | |
8597 while ( 1 ) | |
8598 { | |
8599 v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; | |
8600 if ( pKeyActionMap->pToggleTypes[inputAction] ) | |
832 | 8601 v4 = pKeyboard->WasKeyPressed(v17); |
0 | 8602 else |
832 | 8603 v4 = pKeyboard->IsKeyBeingHeld(v17); |
0 | 8604 if ( v4 ) |
8605 { | |
8606 switch ( inputAction ) | |
8607 { | |
8608 case INPUT_MoveForward: | |
271 | 8609 if (pCurrentScreen != SCREEN_GAME) |
0 | 8610 break; |
8611 if (!pParty->bTurnBasedModeOn) | |
163 | 8612 //goto _do_move_forward; |
0 | 8613 { |
8614 v5 = pActionQueue; | |
140 | 8615 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8616 partyAction = PARTY_RunForward; |
8617 else | |
8618 partyAction = PARTY_WalkForward; | |
163 | 8619 //goto _add_action_and_continue; |
8620 v5->Add(partyAction); | |
8621 break; | |
8622 } | |
8623 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8624 { | |
8625 pTurnEngine->uActionPointsLeft -= 26; | |
8626 //_do_move_forward: | |
8627 v5 = pActionQueue; | |
8628 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8629 partyAction = PARTY_RunForward; | |
8630 else | |
8631 partyAction = PARTY_WalkForward; | |
8632 //goto _add_action_and_continue; | |
8633 v5->Add(partyAction); | |
8634 break; | |
0 | 8635 } |
8636 break; | |
8637 case INPUT_MoveBackwards: | |
17 | 8638 //__debugbreak(); |
271 | 8639 if (pCurrentScreen != SCREEN_GAME) |
0 | 8640 break; |
8641 if (!pParty->bTurnBasedModeOn) | |
17 | 8642 //goto _do_move_backwards; |
8643 { | |
8644 v5 = pActionQueue; | |
8645 if ( pParty->uFlags2 & 2 ) | |
8646 partyAction = PARTY_RunBackward; | |
8647 else | |
8648 partyAction = PARTY_WalkBackward; | |
163 | 8649 //goto _add_action_and_continue; |
8650 v5->Add(partyAction); | |
8651 break; | |
17 | 8652 } |
0 | 8653 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8654 { | |
8655 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8656 //_do_move_backwards: |
0 | 8657 v5 = pActionQueue; |
8658 if ( pParty->uFlags2 & 2 ) | |
8659 partyAction = PARTY_RunBackward; | |
8660 else | |
8661 partyAction = PARTY_WalkBackward; | |
163 | 8662 //goto _add_action_and_continue; |
8663 v5->Add(partyAction); | |
8664 break; | |
0 | 8665 } |
8666 break; | |
8667 case INPUT_StrafeLeft: | |
17 | 8668 //__debugbreak(); |
271 | 8669 if (pCurrentScreen != SCREEN_GAME) |
0 | 8670 break; |
8671 if (!pParty->bTurnBasedModeOn) | |
17 | 8672 //goto _do_strafe_left; |
8673 { | |
8674 partyAction = PARTY_StrafeLeft; | |
163 | 8675 //goto _add_action_and_continue_; |
8676 v5 = pActionQueue; | |
8677 v5->Add(partyAction); | |
8678 break; | |
17 | 8679 } |
0 | 8680 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8681 break; | |
8682 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8683 //_do_strafe_left: |
0 | 8684 partyAction = PARTY_StrafeLeft; |
163 | 8685 //goto _add_action_and_continue_; |
8686 v5 = pActionQueue; | |
8687 v5->Add(partyAction); | |
8688 break; | |
0 | 8689 case INPUT_StrafeRight: |
17 | 8690 //__debugbreak(); |
271 | 8691 if (pCurrentScreen != SCREEN_GAME) |
0 | 8692 break; |
8693 if (!pParty->bTurnBasedModeOn) | |
17 | 8694 //goto _do_strafe_right; |
8695 { | |
8696 partyAction = PARTY_StrafeRight; | |
163 | 8697 //goto _add_action_and_continue_; |
8698 v5 = pActionQueue; | |
8699 v5->Add(partyAction); | |
8700 break; | |
17 | 8701 } |
0 | 8702 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8703 break; | |
8704 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8705 //_do_strafe_right: |
0 | 8706 partyAction = PARTY_StrafeRight; |
163 | 8707 //goto _add_action_and_continue_; |
8708 v5 = pActionQueue; | |
8709 v5->Add(partyAction); | |
8710 break; | |
0 | 8711 case INPUT_TurnLeft: |
271 | 8712 if (pCurrentScreen != SCREEN_GAME) |
0 | 8713 break; |
8714 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8715 { | |
8716 if (pParty->bTurnBasedModeOn) | |
8717 { | |
8718 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8719 break; | |
8720 pTurnEngine->uActionPointsLeft -= 26; | |
8721 } | |
8722 partyAction_ = PARTY_StrafeLeft; | |
8723 } | |
8724 else | |
8725 { | |
8726 if ( pParty->uFlags2 & 2 ) | |
8727 partyAction_ = PARTY_FastTurnLeft; | |
8728 else | |
8729 partyAction_ = PARTY_TurnLeft; | |
8730 } | |
8731 pActionQueue->Add(partyAction_); | |
8732 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8733 { | |
271 | 8734 pWeather->OnPlayerTurn(10); |
0 | 8735 } |
8736 break; | |
8737 case INPUT_TurnRight: | |
271 | 8738 if (pCurrentScreen != SCREEN_GAME) |
0 | 8739 break; |
8740 if ( GetAsyncKeyState(17) ) // strafing | |
8741 { | |
8742 if (pParty->bTurnBasedModeOn) | |
8743 { | |
8744 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8745 break; | |
8746 pTurnEngine->uActionPointsLeft -= 26; | |
8747 } | |
271 | 8748 v21 = PARTY_StrafeRight; |
0 | 8749 } |
8750 else | |
8751 { | |
8752 if ( pParty->uFlags2 & 2 ) | |
271 | 8753 v21 = PARTY_FastTurnRight; |
0 | 8754 else |
271 | 8755 v21 = PARTY_TurnRight; |
0 | 8756 } |
8757 pActionQueue->Add((PartyAction)v21); | |
8758 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8759 { | |
271 | 8760 pWeather->OnPlayerTurn(-10); |
0 | 8761 } |
8762 break; | |
8763 case INPUT_Jump: | |
17 | 8764 //__debugbreak(); |
271 | 8765 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8766 break; |
8767 partyAction = (PartyAction)12; | |
163 | 8768 //goto _add_action_and_continue_; |
8769 v5 = pActionQueue; | |
8770 v5->Add(partyAction); | |
8771 break; | |
0 | 8772 case INPUT_Yell: |
187 | 8773 if (!pCurrentScreen && uActiveCharacter) |
0 | 8774 { |
8775 pParty->Yell(); | |
187 | 8776 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8777 } |
187 | 8778 break; |
0 | 8779 case INPUT_Pass: |
17 | 8780 //__debugbreak(); |
0 | 8781 if ( pCurrentScreen ) |
8782 break; | |
8783 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8784 //goto LABEL_118; |
8785 { | |
8786 pTurnEngine->field_18 |= 8u; | |
8787 break; | |
8788 } | |
0 | 8789 if ( uActiveCharacter ) |
8790 { | |
8791 v6 = pPlayers[uActiveCharacter]; | |
8792 if ( !v6->uTimeToRecovery ) | |
8793 { | |
816 | 8794 v24 = v6->GetAttackRecoveryTime(false); |
0 | 8795 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8796 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
924 | 8797 pCastSpellInfo->_427D48(uActiveCharacter); |
0 | 8798 pTurnEngine->_40471C(); |
8799 } | |
8800 } | |
8801 break; | |
8802 case INPUT_Combat: | |
17 | 8803 //__debugbreak(); |
271 | 8804 if (pCurrentScreen == SCREEN_GAME) |
0 | 8805 { |
8806 if (pParty->bTurnBasedModeOn) | |
8807 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8808 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8809 { |
8810 pParty->bTurnBasedModeOn = 0; | |
8811 pTurnEngine->End(true); | |
8812 } | |
8813 } | |
8814 else | |
8815 { | |
8816 pTurnEngine->Start(); | |
8817 pParty->bTurnBasedModeOn = true; | |
8818 } | |
8819 } | |
8820 break; | |
8821 case INPUT_CastReady: | |
17 | 8822 //__debugbreak(); |
271 | 8823 if (pCurrentScreen != SCREEN_GAME) |
0 | 8824 break; |
8825 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8826 //goto LABEL_118; |
8827 { | |
8828 pTurnEngine->field_18 |= 8u; | |
8829 break; | |
8830 } | |
0 | 8831 if ( !uActiveCharacter ) |
8832 break; | |
8833 v7 = pPlayers[uActiveCharacter]; | |
8834 v8 = v7->uQuickSpell; | |
8835 if ( !v8 | |
8836 || bUnderwater | |
8837 || ((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)), | |
8838 v10 > v7->sMana) ) | |
8839 { | |
8840 pActionQueue = pPartyActionQueue; | |
8841 LABEL_120: | |
437 | 8842 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8843 break; | |
8844 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8845 { |
271 | 8846 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; |
163 | 8847 //goto _send_message; |
8848 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8849 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8850 ++pMessageQueue_50CBD0->uNumMessages; | |
8851 break; | |
437 | 8852 }*/ |
0 | 8853 } |
8854 else | |
8855 { | |
8856 pActionQueue = pPartyActionQueue; | |
8857 if ( dword_50C9E8 < 40 ) | |
8858 { | |
8859 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8860 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8861 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8862 ++dword_50C9E8; |
8863 } | |
8864 } | |
8865 break; | |
8866 case INPUT_Attack: | |
17 | 8867 //__debugbreak(); |
271 | 8868 if (pCurrentScreen != SCREEN_GAME) |
0 | 8869 break; |
8870 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) | |
8871 goto LABEL_120; | |
17 | 8872 //LABEL_118: |
0 | 8873 pTurnEngine->field_18 |= 8u; |
8874 break; | |
8875 case INPUT_EventTrigger: | |
271 | 8876 if (pCurrentScreen == SCREEN_GAME) |
0 | 8877 { |
437 | 8878 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8879 break; |
271 | 8880 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; |
163 | 8881 //goto _send_message; |
8882 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8883 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8884 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8885 break;*/ |
8886 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
163 | 8887 break; |
0 | 8888 } |
151 | 8889 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8890 { |
8891 v11 = pMessageQueue_50CBD0->uNumMessages; | |
8892 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8893 { | |
437 | 8894 v11 = 0; |
8895 pMessageQueue_50CBD0->uNumMessages = 0; | |
0 | 8896 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8897 { | |
8898 v11 = 1; | |
8899 pMessageQueue_50CBD0->uNumMessages = 1; | |
163 | 8900 //LABEL_132: |
271 | 8901 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8902 //_send_message: |
0 | 8903 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8904 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8905 ++pMessageQueue_50CBD0->uNumMessages; | |
8906 break; | |
8907 } | |
437 | 8908 break; |
0 | 8909 } |
437 | 8910 /*if ( (signed int)v11 < 40 ) |
163 | 8911 //goto LABEL_132; |
8912 { | |
271 | 8913 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8914 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8915 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8916 ++pMessageQueue_50CBD0->uNumMessages; | |
8917 break; | |
437 | 8918 }*/ |
8919 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 8920 } |
8921 break; | |
8922 case INPUT_CharCycle: | |
17 | 8923 //__debugbreak(); |
151 | 8924 if ( pCurrentScreen == SCREEN_SPELL_BOOK |
0 | 8925 || dword_50C9E8 >= 40 ) |
8926 break; | |
8927 dword_50C9EC[3 * dword_50C9E8] = 176; | |
163 | 8928 //goto LABEL_155; |
437 | 8929 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8930 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8931 ++dword_50C9E8; |
8932 break; | |
0 | 8933 case INPUT_LookUp: |
17 | 8934 //__debugbreak(); |
0 | 8935 if ( pEventTimer->bPaused ) |
8936 break; | |
8937 partyAction = (PartyAction)7; | |
163 | 8938 //goto _add_action_and_continue_; |
8939 v5 = pActionQueue; | |
8940 v5->Add(partyAction); | |
8941 break; | |
0 | 8942 case INPUT_CenterView: |
17 | 8943 //__debugbreak(); |
0 | 8944 if ( pEventTimer->bPaused ) |
8945 break; | |
8946 partyAction = (PartyAction)9; | |
163 | 8947 //goto _add_action_and_continue_; |
8948 v5 = pActionQueue; | |
8949 v5->Add(partyAction); | |
8950 break; | |
0 | 8951 case INPUT_LookDown: |
17 | 8952 //__debugbreak(); |
0 | 8953 if ( pEventTimer->bPaused ) |
8954 break; | |
8955 partyAction = (PartyAction)8; | |
163 | 8956 //goto _add_action_and_continue_; |
8957 v5 = pActionQueue; | |
8958 v5->Add(partyAction); | |
8959 break; | |
0 | 8960 case INPUT_FlyUp: |
17 | 8961 //__debugbreak(); |
0 | 8962 if ( pCurrentScreen |
8963 || pEventTimer->bPaused ) | |
8964 break; | |
8965 partyAction = (PartyAction)13; | |
163 | 8966 //goto _add_action_and_continue_; |
8967 v5 = pActionQueue; | |
8968 v5->Add(partyAction); | |
8969 break; | |
0 | 8970 case INPUT_Land: |
17 | 8971 //__debugbreak(); |
0 | 8972 if ( pCurrentScreen |
8973 || pEventTimer->bPaused ) | |
8974 break; | |
8975 partyAction = (PartyAction)15; | |
163 | 8976 //goto _add_action_and_continue_; |
8977 v5 = pActionQueue; | |
8978 v5->Add(partyAction); | |
8979 break; | |
0 | 8980 case INPUT_FlyDown: |
17 | 8981 //__debugbreak(); |
0 | 8982 if ( !pCurrentScreen |
8983 && !pEventTimer->bPaused ) | |
8984 { | |
8985 partyAction = (PartyAction)14; | |
163 | 8986 //_add_action_and_continue_: |
0 | 8987 v5 = pActionQueue; |
163 | 8988 //_add_action_and_continue: |
0 | 8989 v5->Add(partyAction); |
8990 } | |
8991 break; | |
8992 case INPUT_ZoomIn: | |
17 | 8993 //__debugbreak(); |
0 | 8994 if ( dword_50C9E8 >= 40 ) |
8995 break; | |
8996 dword_50C9EC[3 * dword_50C9E8] = 367; | |
163 | 8997 //goto LABEL_155; |
437 | 8998 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8999 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 9000 ++dword_50C9E8; |
9001 break; | |
0 | 9002 case INPUT_ZoomOut: |
17 | 9003 //__debugbreak(); |
0 | 9004 if ( dword_50C9E8 < 40 ) |
9005 { | |
9006 dword_50C9EC[3 * dword_50C9E8] = 368; | |
163 | 9007 //LABEL_155: |
437 | 9008 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
9009 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 9010 ++dword_50C9E8; |
9011 } | |
9012 break; | |
9013 case INPUT_AlwaysRun: | |
9014 bAlwaysRun = bAlwaysRun == 0; | |
9015 break; | |
17 | 9016 default: |
9017 //__debugbreak(); | |
9018 break; | |
0 | 9019 } |
9020 } | |
9021 inputAction = (InputAction)((int)inputAction + 1); | |
9022 if ( (signed int)inputAction >= 30 ) | |
9023 goto LABEL_176; | |
9024 } | |
9025 } | |
9026 v12 = 0; | |
9027 do | |
9028 { | |
9029 v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; | |
9030 v13 = pGame->pKeyboardInstance; | |
9031 if ( pKeyActionMap->pToggleTypes[v12] ) | |
9032 v14 = v13->WasKeyPressed(v22); | |
9033 else | |
9034 v14 = v13->IsKeyBeingHeld(v22); | |
9035 if ( v14 && v12 == 9 ) | |
9036 { | |
9037 if ( !pCurrentScreen ) | |
9038 { | |
437 | 9039 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9040 goto LABEL_175; |
9041 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; | |
17 | 9042 //goto LABEL_174; |
9043 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9044 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9045 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9046 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
17 | 9047 goto LABEL_175; |
0 | 9048 } |
151 | 9049 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE |
9050 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
0 | 9051 { |
9052 v15 = pMessageQueue_50CBD0->uNumMessages; | |
9053 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9054 { | |
9055 v15 = 0; | |
9056 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
9057 { | |
9058 v15 = 1; | |
437 | 9059 pMessageQueue_50CBD0->uNumMessages = 0; |
17 | 9060 //goto LABEL_173; |
437 | 9061 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; |
17 | 9062 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9063 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9064 ++pMessageQueue_50CBD0->uNumMessages; | |
9065 goto LABEL_175; | |
0 | 9066 } |
9067 pMessageQueue_50CBD0->uNumMessages = 0; | |
9068 } | |
437 | 9069 /*if ( (signed int)v15 >= 40 ) |
0 | 9070 goto LABEL_175; |
17 | 9071 //LABEL_173: |
0 | 9072 pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; |
17 | 9073 //LABEL_174: |
0 | 9074 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9075 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9076 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9077 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 9078 goto LABEL_175; |
9079 } | |
9080 } | |
9081 LABEL_175: | |
9082 ++v12; | |
9083 } | |
9084 while ( v12 < 30 ); | |
9085 LABEL_176: | |
9086 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
9087 { | |
9088 AsyncKeyboard::LeaveCriticalSection(); | |
9089 v16 = pAsyncKeyboard; | |
9090 AsyncKeyboard::EnterCriticalSection(); | |
9091 memset((char *)v16 + 521, 0, 0x100u); | |
9092 AsyncKeyboard::LeaveCriticalSection(); | |
9093 } | |
9094 } |