Mercurial > mm7
annotate mm7_6.cpp @ 830:08d90b633131
some BLV floor collisions
author | Nomad |
---|---|
date | Wed, 27 Mar 2013 11:59:37 +0200 |
parents | 0f56abdcce94 |
children | dfd683c4f538 |
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 "GUIButton.h" | |
8 #include "GUIProgressBar.h" | |
9 #include "Party.h" | |
10 #include "AudioPlayer.h" | |
11 #include "Outdoor.h" | |
12 #include "IndoorCamera.h" | |
13 #include "Overlays.h" | |
14 #include "Monsters.h" | |
15 #include "Arcomage.h" | |
16 #include "LOD.h" | |
17 #include "Actor.h" | |
18 #include "Allocator.h" | |
19 #include "Events.h" | |
20 #include "Viewport.h" | |
21 #include "FrameTableInc.h" | |
22 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
23 #include "SpriteObject.h" |
0 | 24 #include "ObjectList.h" |
25 #include "Chest.h" | |
26 #include "PaletteManager.h" | |
27 #include "DecorationList.h" | |
28 #include "SaveLoad.h" | |
29 #include "stru123.h" | |
30 #include "Time.h" | |
31 #include "IconFrameTable.h" | |
32 #include "Awards.h" | |
33 #include "Autonotes.h" | |
34 #include "stru160.h" | |
35 #include "stru279.h" | |
36 #include "TurnEngine.h" | |
37 #include "stru277.h" | |
38 #include "Weather.h" | |
39 #include "stru272.h" | |
40 #include "stru298.h" | |
189 | 41 #include "texts.h" |
0 | 42 #include "StorylineTextTable.h" |
43 #include "Events2D.h" | |
370 | 44 #include "Log.h" |
0 | 45 |
46 #include "mm7_data.h" | |
47 | |
48 | |
49 | |
50 //----- (00424EE0) -------------------------------------------------------- | |
51 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
52 { | |
53 unsigned int v1; // edx@1 | |
54 double v2; // st7@1 | |
55 signed int v3; // edi@1 | |
56 char *v4; // esi@4 | |
57 char *v5; // ecx@4 | |
58 unsigned int v6; // eax@4 | |
59 char *v7; // edx@4 | |
60 double v8; // st6@10 | |
61 double v9; // st5@10 | |
62 double v10; // st6@11 | |
63 unsigned __int8 v11; // c2@15 | |
64 unsigned __int8 v12; // c3@15 | |
65 void *v13; // edi@22 | |
66 char *v14; // eax@22 | |
67 double v15; // st6@22 | |
68 char *v16; // ecx@22 | |
69 signed int result; // eax@24 | |
70 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
71 bool v19; // [sp+Ch] [bp-28h]@6 | |
72 char *v20; // [sp+10h] [bp-24h]@4 | |
73 char *v21; // [sp+14h] [bp-20h]@4 | |
74 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
75 char *v23; // [sp+1Ch] [bp-18h]@4 | |
76 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
77 char *v25; // [sp+24h] [bp-10h]@4 | |
78 char *v26; // [sp+28h] [bp-Ch]@4 | |
79 char *v27; // [sp+2Ch] [bp-8h]@4 | |
80 char *v28; // [sp+30h] [bp-4h]@4 | |
81 | |
82 v1 = uVertexID; | |
83 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
84 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
85 v3 = 0; | |
86 v22 = 0; | |
87 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
88 v3 = 1; | |
89 if ( (signed int)(uVertexID + 1) <= 1 ) | |
90 return 0; | |
91 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
92 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
93 v6 = v1; | |
94 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 95 v26 = (char *)&array_507D30[0]._rhw; |
0 | 96 v24 = array_507D30; |
97 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
98 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
99 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
100 v27 = (char *)&array_507D30[0].v; | |
101 v28 = (char *)&array_507D30[0].u; | |
102 v7 = (char *)&array_50AC10[0].v; | |
103 v18 = v6; | |
104 do | |
105 { | |
106 v19 = v2 >= *((float *)v7 + 5); | |
107 if ( v3 != v19 ) | |
108 { | |
109 if ( v19 ) | |
110 { | |
111 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
112 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
113 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
114 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
115 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
116 } | |
117 else | |
118 { | |
119 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
120 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
121 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
122 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
123 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
124 } | |
125 *(float *)v27 = v9; | |
126 *(float *)v25 = v2; | |
127 *(float *)v26 = 1.0 / v2; | |
128 if ( v3 ) | |
129 { | |
130 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
131 { | |
132 v11 = 0; | |
133 v12 = *(float *)v4 == *((float *)v7 - 5); | |
134 goto LABEL_19; | |
135 } | |
136 } | |
137 else | |
138 { | |
139 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
140 { | |
141 v11 = 0; | |
142 v12 = *(float *)v4 == *((float *)v7 + 7); | |
143 LABEL_19: | |
144 if ( v12 | v11 ) | |
145 goto LABEL_21; | |
146 goto LABEL_20; | |
147 } | |
148 } | |
149 LABEL_20: | |
150 v26 += 48; | |
151 ++v24; | |
152 v25 += 48; | |
153 v27 += 48; | |
154 v28 += 48; | |
155 v5 += 48; | |
156 v4 += 48; | |
157 ++v22; | |
158 v23 += 48; | |
159 v21 = v5; | |
160 v20 = v4; | |
161 } | |
162 LABEL_21: | |
163 if ( v19 ) | |
164 { | |
165 v13 = v24; | |
166 v14 = v26; | |
167 v21 += 48; | |
168 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
169 v20 += 48; | |
170 ++v22; | |
171 v28 += 48; | |
172 v27 += 48; | |
173 v25 += 48; | |
174 ++v24; | |
175 v26 += 48; | |
176 memcpy(v13, v7 + 8, 0x30u); | |
177 v16 = v23; | |
178 v23 += 48; | |
179 v4 = v20; | |
180 *(float *)v14 = v15; | |
181 *(int *)v16 = *((int *)v7 + 13); | |
182 v5 = v21; | |
183 } | |
184 v3 = v19; | |
185 v7 += 48; | |
186 --v18; | |
187 } | |
188 while ( v18 ); | |
189 result = v22; | |
190 if ( v22 < 3 ) | |
191 return 0; | |
192 return result; | |
193 } | |
194 | |
195 //----- (004250FE) -------------------------------------------------------- | |
196 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
197 { | |
198 unsigned int v1; // edx@1 | |
199 char *v2; // edi@5 | |
200 char *v3; // esi@5 | |
201 char *v4; // ecx@5 | |
202 int v5; // ebx@6 | |
203 double v6; // st6@11 | |
204 double v7; // st5@11 | |
205 double v8; // st6@12 | |
206 unsigned __int8 v9; // c2@16 | |
207 unsigned __int8 v10; // c3@16 | |
208 void *v11; // edi@23 | |
209 double v12; // st6@23 | |
210 char *v13; // ecx@23 | |
211 char v14; // zf@24 | |
212 signed int result; // eax@25 | |
213 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
214 bool v17; // [sp+Ch] [bp-24h]@2 | |
215 bool v18; // [sp+10h] [bp-20h]@7 | |
216 char *v19; // [sp+14h] [bp-1Ch]@5 | |
217 char *v20; // [sp+18h] [bp-18h]@5 | |
218 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
219 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
220 char *v23; // [sp+24h] [bp-Ch]@5 | |
221 char *v24; // [sp+28h] [bp-8h]@5 | |
222 char *v25; // [sp+2Ch] [bp-4h]@5 | |
223 | |
224 v1 = uVertexID; | |
225 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
226 v21 = 0; | |
227 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
228 if ( (signed int)(uVertexID + 1) <= 1 ) | |
229 return 0; | |
230 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
231 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 232 v24 = (char *)&array_507D30[0]._rhw; |
0 | 233 v22 = array_507D30; |
234 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
235 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
236 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
237 v25 = (char *)&array_507D30[0].flt_2C; | |
238 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
239 v16 = v1; | |
240 do | |
241 { | |
242 v5 = (int)(v4 + 48); | |
243 v18 = *((float *)v4 + 12) >= 8.0; | |
244 if ( v17 != v18 ) | |
245 { | |
246 if ( v18 ) | |
247 { | |
248 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
249 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
250 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
251 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
252 } | |
253 else | |
254 { | |
255 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
256 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
257 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
258 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
259 } | |
260 *(float *)v25 = v7; | |
261 *(float *)v23 = 8.0; | |
262 *(int *)v24 = 0x3E000000u; | |
263 if ( v17 ) | |
264 { | |
265 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
266 { | |
267 v9 = 0; | |
268 v10 = *(float *)v2 == *((float *)v4 + 2); | |
269 goto LABEL_20; | |
270 } | |
271 } | |
272 else | |
273 { | |
274 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
275 { | |
276 v9 = 0; | |
277 v10 = *(float *)v2 == *((float *)v4 + 14); | |
278 LABEL_20: | |
279 if ( v10 | v9 ) | |
280 goto LABEL_22; | |
281 goto LABEL_21; | |
282 } | |
283 } | |
284 LABEL_21: | |
285 ++v22; | |
286 v23 += 48; | |
287 v25 += 48; | |
288 v3 += 48; | |
289 v2 += 48; | |
290 ++v21; | |
291 v24 += 48; | |
292 v20 = v3; | |
293 v19 = v2; | |
294 } | |
295 LABEL_22: | |
296 if ( v18 ) | |
297 { | |
298 v11 = v22; | |
299 v20 += 48; | |
300 v19 += 48; | |
301 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
302 ++v21; | |
303 v25 += 48; | |
304 v23 += 48; | |
305 ++v22; | |
306 memcpy(v11, v4 + 36, 0x30u); | |
307 v13 = v24; | |
308 v24 += 48; | |
309 v3 = v20; | |
310 v2 = v19; | |
311 *(float *)v13 = v12; | |
312 } | |
313 v14 = v16-- == 1; | |
314 v17 = v18; | |
315 v4 = (char *)v5; | |
316 } | |
317 while ( !v14 ); | |
318 result = v21; | |
319 if ( v21 < 3 ) | |
320 return 0; | |
321 return result; | |
322 } | |
323 | |
324 //----- (004252E8) -------------------------------------------------------- | |
325 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
326 { | |
327 unsigned int v1; // edx@1 | |
328 double v2; // st7@1 | |
329 char *v3; // edi@5 | |
330 char *v4; // esi@5 | |
331 char *v5; // ecx@5 | |
332 int v6; // ebx@6 | |
333 double v7; // st6@11 | |
334 double v8; // st5@11 | |
335 double v9; // st6@12 | |
336 unsigned __int8 v10; // c2@16 | |
337 unsigned __int8 v11; // c3@16 | |
338 void *v12; // edi@23 | |
339 double v13; // st6@23 | |
340 char *v14; // ecx@23 | |
341 char v15; // zf@24 | |
342 signed int result; // eax@25 | |
343 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
344 bool v18; // [sp+Ch] [bp-24h]@2 | |
345 bool v19; // [sp+10h] [bp-20h]@7 | |
346 char *v20; // [sp+14h] [bp-1Ch]@5 | |
347 char *v21; // [sp+18h] [bp-18h]@5 | |
348 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
349 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
350 char *v24; // [sp+24h] [bp-Ch]@5 | |
351 char *v25; // [sp+28h] [bp-8h]@5 | |
352 char *v26; // [sp+2Ch] [bp-4h]@5 | |
353 | |
354 v1 = uVertexID; | |
355 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
356 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
357 v22 = 0; | |
358 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
359 if ( (signed int)(uVertexID + 1) <= 1 ) | |
360 return 0; | |
361 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
362 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 363 v25 = (char *)&array_507D30[0]._rhw; |
0 | 364 v23 = array_507D30; |
365 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
366 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
367 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
368 v26 = (char *)&array_507D30[0].flt_2C; | |
369 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
370 v17 = v1; | |
371 do | |
372 { | |
373 v6 = (int)(v5 + 48); | |
374 v19 = v2 >= *((float *)v5 + 12); | |
375 if ( v18 != v19 ) | |
376 { | |
377 if ( v19 ) | |
378 { | |
379 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
380 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
381 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
382 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
383 } | |
384 else | |
385 { | |
386 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
387 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
388 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
389 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
390 } | |
391 *(float *)v26 = v8; | |
392 *(float *)v24 = v2; | |
393 *(float *)v25 = 1.0 / v2; | |
394 if ( v18 ) | |
395 { | |
396 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
397 { | |
398 v10 = 0; | |
399 v11 = *(float *)v3 == *((float *)v5 + 2); | |
400 goto LABEL_20; | |
401 } | |
402 } | |
403 else | |
404 { | |
405 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
406 { | |
407 v10 = 0; | |
408 v11 = *(float *)v3 == *((float *)v5 + 14); | |
409 LABEL_20: | |
410 if ( v11 | v10 ) | |
411 goto LABEL_22; | |
412 goto LABEL_21; | |
413 } | |
414 } | |
415 LABEL_21: | |
416 ++v23; | |
417 v24 += 48; | |
418 v26 += 48; | |
419 v4 += 48; | |
420 v3 += 48; | |
421 ++v22; | |
422 v25 += 48; | |
423 v21 = v4; | |
424 v20 = v3; | |
425 } | |
426 LABEL_22: | |
427 if ( v19 ) | |
428 { | |
429 v12 = v23; | |
430 v21 += 48; | |
431 v20 += 48; | |
432 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
433 ++v22; | |
434 v26 += 48; | |
435 v24 += 48; | |
436 ++v23; | |
437 memcpy(v12, v5 + 36, 0x30u); | |
438 v14 = v25; | |
439 v25 += 48; | |
440 v4 = v21; | |
441 v3 = v20; | |
442 *(float *)v14 = v13; | |
443 } | |
444 v15 = v17-- == 1; | |
445 v18 = v19; | |
446 v5 = (char *)v6; | |
447 } | |
448 while ( !v15 ); | |
449 result = v22; | |
450 if ( v22 < 3 ) | |
451 return 0; | |
452 return result; | |
453 } | |
454 | |
455 //----- (004254D2) -------------------------------------------------------- | |
456 int __fastcall sr_4254D2(signed int a1) | |
457 { | |
458 signed int v1; // ebx@2 | |
459 int v2; // ecx@2 | |
460 int result; // eax@11 | |
461 double v4; // ST74_8@12 | |
462 bool v5; // edi@12 | |
463 char *v6; // esi@13 | |
464 char *v7; // ebx@13 | |
465 double v8; // st7@15 | |
466 double v9; // st7@16 | |
467 double v10; // st6@16 | |
468 double v11; // st7@17 | |
469 float v12; // eax@18 | |
470 double v13; // ST4C_8@19 | |
471 double v14; // ST10_8@19 | |
472 double v15; // ST28_8@20 | |
473 double v16; // ST34_8@20 | |
474 char v17; // zf@20 | |
475 double v18; // ST18_8@21 | |
476 double v19; // ST3C_8@21 | |
477 double v20; // ST44_8@22 | |
478 double v21; // ST54_8@22 | |
479 void *v22; // edi@26 | |
480 double v23; // ST54_8@29 | |
481 bool v24; // esi@29 | |
482 char *v25; // edi@30 | |
483 char *v26; // ebx@30 | |
484 bool v27; // ecx@32 | |
485 double v28; // st7@33 | |
486 double v29; // st7@34 | |
487 double v30; // st6@34 | |
488 double v31; // st7@35 | |
489 double v32; // ST44_8@37 | |
490 double v33; // ST3C_8@37 | |
491 double v34; // ST18_8@38 | |
492 double v35; // ST34_8@38 | |
493 char v36; // zf@38 | |
494 double v37; // ST28_8@39 | |
495 double v38; // ST10_8@39 | |
496 double v39; // ST20_8@40 | |
497 double v40; // ST5C_8@40 | |
498 void *v41; // edi@44 | |
499 double v42; // ST5C_8@47 | |
500 bool v43; // edi@47 | |
501 char *v44; // esi@48 | |
502 char *v45; // ebx@48 | |
503 bool v46; // ecx@49 | |
504 double v47; // st6@50 | |
505 double v48; // st6@51 | |
506 double v49; // st5@51 | |
507 double v50; // st6@52 | |
508 double v51; // ST20_8@54 | |
509 double v52; // ST54_8@54 | |
510 double v53; // ST44_8@55 | |
511 double v54; // ST3C_8@55 | |
512 char v55; // zf@55 | |
513 double v56; // ST18_8@56 | |
514 double v57; // ST34_8@56 | |
515 double v58; // ST28_8@57 | |
516 double v59; // ST10_8@57 | |
517 void *v60; // edi@61 | |
518 double v61; // ST5C_8@64 | |
519 bool v62; // edi@64 | |
520 char *v63; // esi@65 | |
521 char *v64; // ebx@65 | |
522 bool v65; // ecx@66 | |
523 double v66; // st6@67 | |
524 double v67; // st6@68 | |
525 double v68; // st5@68 | |
526 double v69; // st6@69 | |
527 double v70; // ST20_8@71 | |
528 double v71; // ST54_8@71 | |
529 double v72; // ST44_8@72 | |
530 double v73; // ST3C_8@72 | |
531 char v74; // zf@72 | |
532 double v75; // ST18_8@73 | |
533 double v76; // ST34_8@73 | |
534 double v77; // ST28_8@74 | |
535 double v78; // ST10_8@74 | |
536 void *v79; // edi@78 | |
537 int v80; // ebx@81 | |
538 char *v81; // ecx@82 | |
539 signed int v82; // esi@82 | |
540 float v83; // ST78_4@83 | |
541 double v84; // ST5C_8@83 | |
542 float v85; // eax@84 | |
543 double v86; // ST20_8@85 | |
544 double v87; // ST54_8@88 | |
545 float v88; // eax@89 | |
546 double v89; // ST44_8@90 | |
547 unsigned __int8 v90; // sf@94 | |
548 unsigned __int8 v91; // of@94 | |
549 int v92; // edx@97 | |
550 int v93; // esi@97 | |
551 int v94; // edi@97 | |
552 int v95; // eax@97 | |
553 int v96; // eax@104 | |
554 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
555 double v98; // [sp+54h] [bp-84h]@49 | |
556 double v99; // [sp+54h] [bp-84h]@66 | |
557 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
558 float v101; // [sp+60h] [bp-78h]@1 | |
559 float v102; // [sp+64h] [bp-74h]@1 | |
560 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
561 float v104; // [sp+A8h] [bp-30h]@1 | |
562 signed int v105; // [sp+A8h] [bp-30h]@96 | |
563 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
564 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
565 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
566 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
567 signed int v110; // [sp+B0h] [bp-28h]@12 | |
568 char *v111; // [sp+B8h] [bp-20h]@30 | |
569 signed int v112; // [sp+B8h] [bp-20h]@48 | |
570 signed int v113; // [sp+B8h] [bp-20h]@65 | |
571 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
572 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
573 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
574 signed int v117; // [sp+C0h] [bp-18h]@1 | |
575 char *v118; // [sp+C0h] [bp-18h]@30 | |
576 char *v119; // [sp+C0h] [bp-18h]@48 | |
577 char *v120; // [sp+C0h] [bp-18h]@65 | |
578 char *v121; // [sp+C4h] [bp-14h]@13 | |
579 char *v122; // [sp+C4h] [bp-14h]@30 | |
580 signed int v123; // [sp+C4h] [bp-14h]@47 | |
581 char *v124; // [sp+C8h] [bp-10h]@30 | |
582 char *v125; // [sp+C8h] [bp-10h]@48 | |
583 char *v126; // [sp+C8h] [bp-10h]@65 | |
584 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
585 char *v128; // [sp+CCh] [bp-Ch]@13 | |
586 char *v129; // [sp+CCh] [bp-Ch]@30 | |
587 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
588 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
589 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
590 char *v133; // [sp+D0h] [bp-8h]@30 | |
591 char *v134; // [sp+D0h] [bp-8h]@48 | |
592 char *v135; // [sp+D0h] [bp-8h]@65 | |
593 signed int v136; // [sp+D4h] [bp-4h]@1 | |
594 char *v137; // [sp+D4h] [bp-4h]@13 | |
595 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
596 char *v139; // [sp+D4h] [bp-4h]@48 | |
597 char *v140; // [sp+D4h] [bp-4h]@65 | |
598 | |
693 | 599 v101 = (double)(signed int)pViewport->uViewportTL_X; |
600 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 601 v117 = a1; |
602 v136 = 1; | |
693 | 603 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
604 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 605 if ( a1 <= 0 ) |
606 return v117; | |
607 v127 = a1; | |
608 v1 = a1; | |
609 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
610 v2 = 0; | |
611 do | |
612 { | |
613 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
614 v136 = 0; | |
615 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
616 v136 = 0; | |
617 ++v2; | |
618 --v127; | |
619 } | |
620 while ( v127 ); | |
621 if ( v136 ) | |
622 return v117; | |
623 v110 = 0; | |
624 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
625 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 626 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 627 if ( v117 < 1 ) |
628 goto LABEL_112; | |
629 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
630 v132 = array_50A2B0; | |
631 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
632 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
633 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 634 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 635 v7 = (char *)&array_50AC10[0].flt_2C; |
636 do | |
637 { | |
638 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 639 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 640 if ( !(v5 ^ v106) ) |
641 goto LABEL_25; | |
642 v8 = v101; | |
693 | 643 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 644 { |
645 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
646 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
647 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
648 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
649 } | |
650 else | |
651 { | |
652 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
653 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
654 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
655 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
656 } | |
657 *(float *)v121 = v10; | |
658 *(int *)v137 = LODWORD(v101); | |
659 LODWORD(v12) = *(int *)v6; | |
660 if ( v5 ) | |
661 { | |
662 v13 = v12 + 6.7553994e15; | |
663 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
664 if ( LODWORD(v13) == LODWORD(v14) ) | |
665 { | |
666 v15 = *(float *)v137 + 6.7553994e15; | |
667 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
668 v17 = LODWORD(v15) == LODWORD(v16); | |
669 goto LABEL_23; | |
670 } | |
671 } | |
672 else | |
673 { | |
674 v18 = v12 + 6.7553994e15; | |
675 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
676 if ( LODWORD(v18) == LODWORD(v19) ) | |
677 { | |
678 v20 = *(float *)v137 + 6.7553994e15; | |
679 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
680 v17 = LODWORD(v20) == LODWORD(v21); | |
681 LABEL_23: | |
682 if ( v17 ) | |
683 goto LABEL_25; | |
684 goto LABEL_24; | |
685 } | |
686 } | |
687 LABEL_24: | |
688 v121 += 48; | |
689 v114 += 48; | |
690 v6 += 48; | |
691 ++v110; | |
692 ++v132; | |
693 v128 = v6; | |
694 v137 += 48; | |
695 LABEL_25: | |
696 if ( v106 ) | |
697 { | |
698 v22 = v132; | |
699 v128 += 48; | |
700 ++v110; | |
701 v114 += 48; | |
702 v121 += 48; | |
703 v137 += 48; | |
704 ++v132; | |
705 memcpy(v22, v7 + 4, 0x30u); | |
706 v6 = v128; | |
707 } | |
708 v5 = v106; | |
709 v7 += 48; | |
710 --v117; | |
711 } | |
712 while ( v117 ); | |
713 if ( v110 < 3 | |
714 || (v115 = 0, | |
715 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
716 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 717 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 718 v110 < 1) ) |
719 goto LABEL_112; | |
168 | 720 v25 = (char *)&array_509950[0]._rhw; |
0 | 721 v138 = array_509950; |
722 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
723 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
724 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
725 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
726 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 727 v111 = (char *)&array_509950[0]._rhw; |
0 | 728 v26 = (char *)&array_50A2B0[0].flt_2C; |
729 while ( 2 ) | |
730 { | |
731 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 732 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
733 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 734 if ( v24 != v27 ) |
735 { | |
736 v28 = v100; | |
693 | 737 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 738 { |
739 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
740 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
741 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
742 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
743 } | |
744 else | |
745 { | |
746 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
747 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
748 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
749 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
750 } | |
751 *(float *)v124 = v30; | |
752 *(int *)v133 = LODWORD(v100); | |
753 if ( v24 ) | |
754 { | |
755 v32 = *(float *)v122 + 6.7553994e15; | |
756 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
757 if ( LODWORD(v32) == LODWORD(v33) ) | |
758 { | |
759 v34 = *(float *)v133 + 6.7553994e15; | |
760 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
761 v36 = LODWORD(v34) == LODWORD(v35); | |
762 goto LABEL_41; | |
763 } | |
764 goto LABEL_42; | |
765 } | |
766 v37 = *(float *)v118 + 6.7553994e15; | |
767 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
768 if ( LODWORD(v37) != LODWORD(v38) ) | |
769 goto LABEL_42; | |
770 v39 = *(float *)v129 + 6.7553994e15; | |
771 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
772 v36 = LODWORD(v39) == LODWORD(v40); | |
773 LABEL_41: | |
774 if ( !v36 ) | |
775 { | |
776 LABEL_42: | |
777 v129 += 48; | |
778 v118 += 48; | |
779 v133 += 48; | |
780 v122 += 48; | |
781 v124 += 48; | |
782 v111 += 48; | |
783 ++v115; | |
784 ++v138; | |
785 } | |
786 } | |
787 if ( v27 ) | |
788 { | |
789 v41 = v138; | |
790 ++v115; | |
791 v111 += 48; | |
792 v124 += 48; | |
793 v122 += 48; | |
794 v133 += 48; | |
795 v118 += 48; | |
796 v129 += 48; | |
797 ++v138; | |
798 memcpy(v41, v26 + 4, 0x30u); | |
799 } | |
800 v24 = v107; | |
801 v26 += 48; | |
802 --v110; | |
803 if ( v110 ) | |
804 { | |
805 v25 = v111; | |
806 continue; | |
807 } | |
808 break; | |
809 } | |
810 if ( v115 < 3 | |
811 || (v123 = 0, | |
812 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
813 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 814 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 815 v115 < 1) ) |
816 goto LABEL_112; | |
817 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
818 v130 = array_508FF0; | |
819 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
820 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
821 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 822 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 823 v45 = (char *)&array_509950[0].flt_2C; |
824 v112 = v115; | |
825 while ( 2 ) | |
826 { | |
827 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 828 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
829 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 830 if ( v43 != v46 ) |
831 { | |
832 v47 = v104; | |
693 | 833 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 834 { |
835 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
836 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
837 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
838 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
839 } | |
840 else | |
841 { | |
842 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
843 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
844 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
845 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
846 } | |
847 *(float *)v125 = v49; | |
848 *(float *)v139 = v104; | |
849 if ( v43 ) | |
850 { | |
851 v51 = v104 + 6.7553994e15; | |
852 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
853 if ( LODWORD(v51) == LODWORD(v52) ) | |
854 { | |
855 v53 = *(float *)v44 + 6.7553994e15; | |
856 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
857 v55 = LODWORD(v53) == LODWORD(v54); | |
858 goto LABEL_58; | |
859 } | |
860 goto LABEL_59; | |
861 } | |
862 v56 = v104 + 6.7553994e15; | |
863 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
864 if ( LODWORD(v56) != LODWORD(v57) ) | |
865 goto LABEL_59; | |
866 v58 = *(float *)v44 + 6.7553994e15; | |
867 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
868 v55 = LODWORD(v58) == LODWORD(v59); | |
869 LABEL_58: | |
870 if ( !v55 ) | |
871 { | |
872 LABEL_59: | |
873 v139 += 48; | |
874 v125 += 48; | |
875 v134 += 48; | |
876 v44 += 48; | |
877 ++v123; | |
878 ++v130; | |
879 v119 = v44; | |
880 } | |
881 } | |
882 if ( v46 ) | |
883 { | |
884 v60 = v130; | |
885 v119 += 48; | |
886 ++v123; | |
887 v134 += 48; | |
888 v125 += 48; | |
889 v139 += 48; | |
890 ++v130; | |
891 memcpy(v60, v45 + 4, 0x30u); | |
892 v44 = v119; | |
893 } | |
894 v43 = v108; | |
895 v45 += 48; | |
896 --v112; | |
897 if ( v112 ) | |
898 continue; | |
899 break; | |
900 } | |
901 if ( v123 < 3 | |
902 || (v116 = 0, | |
903 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
904 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 905 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 906 v123 < 1) ) |
907 goto LABEL_112; | |
908 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
909 v131 = array_508690; | |
910 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
911 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
912 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 913 v135 = (char *)&array_508690[0]._rhw; |
0 | 914 v64 = (char *)&array_508FF0[0].flt_2C; |
915 v113 = v123; | |
916 while ( 2 ) | |
917 { | |
918 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 919 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
920 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 921 if ( v62 != v65 ) |
922 { | |
923 v66 = v102; | |
693 | 924 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 925 { |
926 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
927 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
928 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
929 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
930 } | |
931 else | |
932 { | |
933 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
934 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
935 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
936 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
937 } | |
938 *(float *)v126 = v68; | |
939 *(float *)v140 = v102; | |
940 if ( v62 ) | |
941 { | |
942 v70 = v102 + 6.7553994e15; | |
943 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
944 if ( LODWORD(v70) == LODWORD(v71) ) | |
945 { | |
946 v72 = *(float *)v63 + 6.7553994e15; | |
947 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
948 v74 = LODWORD(v72) == LODWORD(v73); | |
949 goto LABEL_75; | |
950 } | |
951 goto LABEL_76; | |
952 } | |
953 v75 = v102 + 6.7553994e15; | |
954 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
955 if ( LODWORD(v75) != LODWORD(v76) ) | |
956 goto LABEL_76; | |
957 v77 = *(float *)v63 + 6.7553994e15; | |
958 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
959 v74 = LODWORD(v77) == LODWORD(v78); | |
960 LABEL_75: | |
961 if ( !v74 ) | |
962 { | |
963 LABEL_76: | |
964 v140 += 48; | |
965 v126 += 48; | |
966 v135 += 48; | |
967 v63 += 48; | |
968 ++v116; | |
969 ++v131; | |
970 v120 = v63; | |
971 } | |
972 } | |
973 if ( v65 ) | |
974 { | |
975 v79 = v131; | |
976 v120 += 48; | |
977 ++v116; | |
978 v135 += 48; | |
979 v126 += 48; | |
980 v140 += 48; | |
981 ++v131; | |
982 memcpy(v79, v64 + 4, 0x30u); | |
983 v63 = v120; | |
984 } | |
985 v62 = v109; | |
986 v64 += 48; | |
987 --v113; | |
988 if ( v113 ) | |
989 continue; | |
990 break; | |
991 } | |
992 if ( v116 < 3 ) | |
993 goto LABEL_112; | |
994 v80 = v116; | |
995 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
996 if ( v116 > 0 ) | |
997 { | |
998 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
999 v82 = v116; | |
1000 do | |
1001 { | |
1002 LODWORD(v83) = *(int *)v81; | |
1003 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1004 v84 = v83 + 6.7553994e15; | |
693 | 1005 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1006 { |
1007 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1008 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1009 goto LABEL_88; |
1010 v85 = v101; | |
1011 } | |
1012 else | |
1013 { | |
1014 v85 = v100; | |
1015 } | |
1016 *(int *)v81 = LODWORD(v85); | |
1017 LABEL_88: | |
1018 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1019 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1020 { |
1021 v88 = v102; | |
1022 LABEL_92: | |
1023 *((int *)v81 + 1) = LODWORD(v88); | |
1024 goto LABEL_93; | |
1025 } | |
1026 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1027 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1028 { |
1029 v88 = v104; | |
1030 goto LABEL_92; | |
1031 } | |
1032 LABEL_93: | |
1033 v81 += 48; | |
1034 --v82; | |
1035 } | |
1036 while ( v82 ); | |
1037 } | |
1038 v91 = __OFSUB__(v116, 3); | |
1039 v90 = v116 - 3 < 0; | |
1040 if ( v116 > 3 ) | |
1041 { | |
1042 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1043 if ( v116 > 0 ) | |
1044 { | |
1045 v105 = 1; | |
1046 do | |
1047 { | |
1048 v92 = v105; | |
1049 v93 = v105 - 1; | |
1050 v94 = v105 + 1; | |
1051 v95 = v105 + 1; | |
1052 if ( v105 - 1 >= v80 ) | |
1053 v93 -= v80; | |
1054 if ( v105 >= v80 ) | |
1055 v92 = v105 - v80; | |
1056 if ( v94 >= v80 ) | |
1057 v95 = v94 - v80; | |
1058 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1059 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1060 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1061 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1062 { | |
1063 ++v105; | |
1064 } | |
1065 else | |
1066 { | |
1067 v96 = v105; | |
1068 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1069 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1070 --v80; | |
1071 } | |
1072 } | |
1073 while ( v105 - 1 < v80 ); | |
1074 } | |
1075 v91 = __OFSUB__(v80, 3); | |
1076 v90 = v80 - 3 < 0; | |
1077 } | |
1078 if ( v90 ^ v91 ) | |
1079 LABEL_112: | |
1080 result = 0; | |
1081 else | |
1082 result = v80; | |
1083 return result; | |
1084 } | |
1085 | |
1086 //----- (0042620A) -------------------------------------------------------- | |
1087 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1088 { | |
1089 __int16 v1; // fps@1 | |
1090 unsigned __int8 v2; // c0@2 | |
1091 char v3; // c2@2 | |
1092 unsigned __int8 v4; // c3@2 | |
1093 bool result; // eax@2 | |
1094 unsigned __int8 v6; // c0@4 | |
1095 char v7; // c2@4 | |
1096 unsigned __int8 v8; // c3@4 | |
1097 unsigned __int8 v9; // c0@6 | |
1098 char v10; // c2@6 | |
1099 unsigned __int8 v11; // c3@6 | |
1100 double v12; // st6@7 | |
1101 float v13; // ST04_4@7 | |
1102 float v14; // ST00_4@7 | |
1103 double v15; // st7@7 | |
1104 double v16; // st6@8 | |
1105 float v17; // ST04_4@8 | |
1106 float v18; // ST00_4@8 | |
1107 double v19; // st7@8 | |
1108 | |
1109 //UNDEF(v1); | |
1110 if ( p->vWorldViewPosition.x < 300.0 | |
1111 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1112 v3 = 0, | |
1113 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
1114 BYTE1(result) = HIBYTE(v1), | |
1115 !(v2 | v4)) ) | |
1116 { | |
1117 if ( p->vWorldViewPosition.x < 300.0 ) | |
1118 { | |
1119 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1120 v7 = 0; | |
1121 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
1122 BYTE1(result) = HIBYTE(v1); | |
1123 if ( !(v6 | v8) ) | |
1124 { | |
1125 LOBYTE(result) = 0; | |
1126 return result; | |
1127 } | |
1128 } | |
1129 v9 = 300.0 < p->vWorldViewPosition.x; | |
1130 v10 = 0; | |
1131 v11 = 300.0 == p->vWorldViewPosition.x; | |
1132 BYTE1(result) = HIBYTE(v1); | |
1133 if ( v9 | v11 ) | |
1134 { | |
1135 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1136 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1137 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1138 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1139 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1140 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1141 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1142 } | |
1143 else | |
1144 { | |
1145 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1146 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1147 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1148 v15 = 300.0 - p->vWorldViewPosition.x; | |
1149 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1150 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1151 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1152 } | |
1153 } | |
1154 LOBYTE(result) = 1; | |
1155 return result; | |
1156 } | |
1157 | |
1158 //----- (004268E3) -------------------------------------------------------- | |
1159 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1160 { | |
1161 unsigned int v1; // eax@1 | |
1162 unsigned int v2; // edx@1 | |
1163 int v3; // eax@1 | |
1164 int v4; // edx@1 | |
1165 unsigned int v5; // ecx@1 | |
1166 | |
1167 v1 = uColor >> 9; | |
1168 v2 = uColor >> 6; | |
1169 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1170 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1171 v3 = v2 | v1; | |
1172 v4 = (unsigned __int8)uColor >> 3; | |
1173 v5 = uColor >> 16; | |
1174 LOWORD(v5) = v5 & 0x8000; | |
1175 return v5 | v4 | v3; | |
1176 } | |
1177 | |
1178 //----- (0042690D) -------------------------------------------------------- | |
1179 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1180 { | |
1181 unsigned int v1; // eax@1 | |
1182 unsigned int v2; // edx@1 | |
1183 | |
1184 v1 = a1 >> 8; | |
1185 v2 = a1 >> 5; | |
1186 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1187 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1188 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1189 } | |
1190 | |
1191 //----- (00426947) -------------------------------------------------------- | |
1192 void __cdecl sub_426947() | |
1193 { | |
1194 dword_50C968 = 0; | |
1195 dword_50C994 = 0; | |
1196 dword_50C998_turnbased_icon_1A = 0; | |
1197 } | |
1198 // 50C968: using guessed type int dword_50C968; | |
1199 // 50C994: using guessed type int dword_50C994; | |
1200 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1201 | |
1202 //----- (004269A2) -------------------------------------------------------- | |
792 | 1203 int __fastcall GivePartyExp(unsigned int a1) |
0 | 1204 { |
89 | 1205 //unsigned __int64 v1; // qax@1 |
1206 Player *v1; | |
1207 int v1b; | |
0 | 1208 signed int v2; // ecx@1 |
82 | 1209 int *v3; // esi@1 |
0 | 1210 bool v4; // edi@6 |
82 | 1211 int *v5; // edi@10 |
1212 Player *v6; // esi@10 | |
0 | 1213 int v7; // eax@13 |
1214 unsigned __int8 v8; // cf@13 | |
89 | 1215 int v10[4]; // [sp+Ch] [bp-14h]@1 |
0 | 1216 int v11; // [sp+1Ch] [bp-4h]@10 |
1217 | |
89 | 1218 //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); |
1219 v1 = pParty->pPlayers; | |
1220 v1b = a1; | |
0 | 1221 v2 = 0; |
89 | 1222 v3 = v10; |
0 | 1223 do |
1224 { | |
89 | 1225 /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) |
0 | 1226 && !*(int *)HIDWORD(v1) |
1227 && !*(_QWORD *)(HIDWORD(v1) + 8) | |
89 | 1228 && !*(_QWORD *)(HIDWORD(v1) + 16);*/ |
1229 v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) | |
1230 && !v1->pConditions[14] | |
1231 && !v1->pConditions[15] | |
1232 && !v1->pConditions[16]; | |
82 | 1233 *v3 = v4; |
89 | 1234 //HIDWORD(v1) += 6972; |
1235 ++v1; | |
0 | 1236 v2 += v4; |
82 | 1237 ++v3; |
0 | 1238 } |
89 | 1239 while ( v1 <= &pParty->pPlayers[3] ); |
0 | 1240 if ( v2 ) |
1241 { | |
89 | 1242 v1b = v1b / v2; |
1243 v5 = v10; | |
82 | 1244 v6 = pParty->pPlayers;//[0].uExperience; |
89 | 1245 v11 = v1b; |
0 | 1246 do |
1247 { | |
82 | 1248 if ( *v5 ) |
0 | 1249 { |
1250 if ( v11 ) | |
1251 { | |
82 | 1252 LOBYTE(v7) = v6->GetLearningPercent(); |
89 | 1253 v1b = v11 + v11 * v7 / 100; |
1254 //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); | |
1255 //need review | |
1256 LODWORD(v6->uExperience) += v1b; | |
1257 //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; | |
82 | 1258 if ( v6->uExperience > 4000000000i64 ) |
0 | 1259 { |
82 | 1260 HIDWORD(v6->uExperience) = 0; |
1261 LODWORD(v6->uExperience) = -294967296; | |
0 | 1262 } |
1263 } | |
1264 } | |
82 | 1265 ++v6; |
1266 ++v5; | |
0 | 1267 } |
82 | 1268 while ( v6 <= &pParty->pPlayers[3] ); |
0 | 1269 } |
89 | 1270 return v1b; |
0 | 1271 } |
1272 | |
1273 //----- (00426A5A) -------------------------------------------------------- | |
1274 void stru319::LootActor(Actor *pActor) | |
1275 { | |
1276 signed int v2; // edi@1 | |
1277 char v3; // zf@1 | |
1278 unsigned int v4; // eax@13 | |
1279 unsigned int v5; // esi@13 | |
1280 int v6; // eax@14 | |
1281 unsigned __int8 v7; // al@30 | |
1282 Party *v8; // esi@34 | |
1283 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1284 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1285 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1286 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1287 int v13; // [sp+30h] [bp-8h]@1 | |
1288 int v14; // [sp+34h] [bp-4h]@1 | |
1289 | |
1290 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1291 Dst.Reset(); | |
1292 v2 = 0; | |
1293 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1294 v13 = 0; | |
1295 v14 = 0; | |
1296 if ( v3 ) | |
1297 { | |
1298 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1299 goto LABEL_9; | |
1300 do | |
1301 { | |
1302 ++v2; | |
1303 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1304 } | |
1305 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1306 } | |
1307 else | |
1308 { | |
1309 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1310 goto LABEL_9; | |
377 | 1311 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1312 pActor->array_000234[3].Reset(); |
1313 } | |
1314 if ( v14 ) | |
1315 { | |
1316 party_finds_gold(v14, 0); | |
1317 viewparams->bRedrawGameUI = 1; | |
1318 } | |
1319 LABEL_9: | |
1320 if ( pActor->uCarriedItemID ) | |
1321 { | |
1322 Dst.Reset(); | |
1323 Dst.uItemID = pActor->uCarriedItemID; | |
1324 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1325 if ( v14 ) | |
721 | 1326 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1327 else |
721 | 1328 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1329 ShowStatusBarString(pTmpBuf2, 2u); |
1330 v4 = Dst.uItemID; | |
1331 v5 = Dst.uItemID; | |
1332 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1333 { | |
1334 v5 = Dst.uItemID; | |
1335 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1336 Dst.uNumCharges = v6; | |
1337 Dst.uMaxCharges = v6; | |
1338 v4 = Dst.uItemID; | |
1339 } | |
1340 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1341 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1342 pItemsTable->SetSpecialBonus(&Dst); |
1343 if ( !pParty->AddItem(&Dst) ) | |
1344 pParty->SetHoldingItem(&Dst); | |
1345 pActor->uCarriedItemID = 0; | |
1346 if ( pActor->array_000234[0].uItemID ) | |
1347 { | |
1348 if ( !pParty->AddItem(pActor->array_000234) ) | |
1349 { | |
1350 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1351 pParty->SetHoldingItem(pActor->array_000234); | |
1352 } | |
1353 pActor->array_000234[0].Reset(); | |
1354 } | |
1355 if ( pActor->array_000234[1].uItemID ) | |
1356 { | |
1357 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1358 { | |
1359 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1360 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1361 } | |
1362 pActor->array_000234[1].Reset(); | |
1363 } | |
1364 LABEL_55: | |
1365 pActor->Remove(); | |
1366 return; | |
1367 } | |
1368 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1369 { | |
1370 if ( pActor->array_000234[3].uItemID ) | |
1371 { | |
1372 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1373 pActor->array_000234[3].Reset(); | |
1374 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1375 if ( v14 ) | |
721 | 1376 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1377 else |
721 | 1378 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1379 ShowStatusBarString(pTmpBuf2, 2u); |
1380 if ( !pParty->AddItem(&Dst) ) | |
1381 pParty->SetHoldingItem(&Dst); | |
1382 v13 = 1; | |
1383 } | |
1384 goto LABEL_44; | |
1385 } | |
1386 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1387 { | |
1388 LABEL_44: | |
1389 v8 = pParty; | |
1390 goto LABEL_45; | |
1391 } | |
1392 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1393 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1394 if ( v14 ) | |
721 | 1395 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1396 else |
721 | 1397 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1398 ShowStatusBarString(pTmpBuf2, 2u); |
1399 v8 = pParty; | |
1400 if ( !pParty->AddItem(&Dst) ) | |
1401 pParty->SetHoldingItem(&Dst); | |
1402 v13 = 1; | |
1403 LABEL_45: | |
1404 if ( pActor->array_000234[0].uItemID ) | |
1405 { | |
1406 if ( !v8->AddItem(pActor->array_000234) ) | |
1407 { | |
1408 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1409 v8->SetHoldingItem(pActor->array_000234); | |
1410 v13 = 1; | |
1411 } | |
1412 pActor->array_000234[0].Reset(); | |
1413 } | |
1414 if ( pActor->array_000234[1].uItemID ) | |
1415 { | |
1416 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1417 { | |
1418 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1419 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1420 v13 = 1; | |
1421 } | |
1422 pActor->array_000234[1].Reset(); | |
1423 } | |
1424 if ( !v13 || rand() % 100 < 90 ) | |
1425 goto LABEL_55; | |
1426 } | |
1427 | |
1428 //----- (00426E10) -------------------------------------------------------- | |
1429 int stru319::which_player_would_attack(Actor *pActor) | |
1430 { | |
1431 signed int v2; // ebx@1 | |
1432 int v3; // ecx@2 | |
1433 signed int v4; // edx@3 | |
1434 char v5; // zf@3 | |
1435 unsigned int v6; // eax@3 | |
1436 int v7; // eax@6 | |
1437 int v8; // eax@7 | |
1438 int v9; // eax@8 | |
1439 int v10; // eax@9 | |
1440 int v11; // eax@10 | |
1441 int v12; // eax@11 | |
1442 int v13; // esi@35 | |
1443 signed int v14; // edi@37 | |
1444 enum CHARACTER_RACE v15; // eax@44 | |
1445 Player *v16; // ecx@47 | |
1446 unsigned __int8 v17; // sf@50 | |
1447 unsigned __int8 v18; // of@50 | |
1448 int v19; // esi@52 | |
1449 Player *v20; // ecx@53 | |
1450 int result; // eax@57 | |
1451 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1452 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1453 int v24; // [sp+138h] [bp-10h]@2 | |
1454 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1455 int v26; // [sp+140h] [bp-8h]@1 | |
1456 int v27; // [sp+144h] [bp-4h]@1 | |
1457 | |
1458 v27 = -1; | |
1459 v26 = -1; | |
1460 v25 = -1; | |
1461 v2 = 0; | |
1462 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1463 { | |
1464 v3 = 0; | |
1465 v24 = 0; | |
1466 do | |
1467 { | |
1468 v4 = 1; | |
1469 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1470 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1471 v22[v3] = v6; | |
1472 if ( !v5 ) | |
1473 { | |
1474 if ( (signed int)v6 > 128 ) | |
1475 { | |
1476 switch ( v6 ) | |
1477 { | |
1478 case 0x100u: | |
1479 v27 = 8; | |
1480 break; | |
1481 case 0x200u: | |
1482 v25 = 0; | |
1483 break; | |
1484 case 0x400u: | |
1485 v25 = 1; | |
1486 break; | |
1487 case 0x800u: | |
1488 v26 = 0; | |
1489 break; | |
1490 case 0x1000u: | |
1491 v26 = 1; | |
1492 break; | |
1493 case 0x2000u: | |
1494 v26 = 3; | |
1495 break; | |
1496 case 0x4000u: | |
1497 v26 = 2; | |
1498 break; | |
1499 } | |
1500 } | |
1501 else | |
1502 { | |
1503 if ( v6 == 128 ) | |
1504 { | |
1505 v27 = 4; | |
1506 } | |
1507 else | |
1508 { | |
1509 v7 = v6 - 1; | |
1510 if ( v7 ) | |
1511 { | |
1512 v8 = v7 - 1; | |
1513 if ( v8 ) | |
1514 { | |
1515 v9 = v8 - 2; | |
1516 if ( v9 ) | |
1517 { | |
1518 v10 = v9 - 4; | |
1519 if ( v10 ) | |
1520 { | |
1521 v11 = v10 - 8; | |
1522 if ( v11 ) | |
1523 { | |
1524 v12 = v11 - 16; | |
1525 if ( v12 ) | |
1526 { | |
1527 if ( v12 == 32 ) | |
1528 v27 = 20; | |
1529 } | |
1530 else | |
1531 { | |
1532 v27 = 32; | |
1533 } | |
1534 } | |
1535 else | |
1536 { | |
1537 v27 = 24; | |
1538 } | |
1539 } | |
1540 else | |
1541 { | |
1542 v27 = 28; | |
1543 } | |
1544 } | |
1545 else | |
1546 { | |
1547 v27 = 16; | |
1548 } | |
1549 } | |
1550 else | |
1551 { | |
1552 v27 = 12; | |
1553 } | |
1554 } | |
1555 else | |
1556 { | |
1557 v27 = 0; | |
1558 } | |
1559 } | |
1560 } | |
1561 v2 = 0; | |
1562 v13 = 0; | |
1563 while ( 1 ) | |
1564 { | |
1565 v14 = 0; | |
135 | 1566 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1567 v14 = v4; |
1568 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1569 v14 = v4; | |
1570 if ( v26 != -1 ) | |
1571 { | |
1572 v15 = pPlayers[v13 + 1]->GetRace(); | |
1573 if ( v26 == v15 ) | |
1574 v14 = 1; | |
1575 } | |
1576 if ( v14 == 1 ) | |
1577 { | |
1578 v16 = pPlayers[v13 + 1]; | |
1579 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1580 v23[v2++] = v13; | |
1581 } | |
1582 ++v13; | |
1583 if ( v13 >= 4 ) | |
1584 break; | |
1585 v4 = 1; | |
1586 } | |
1587 } | |
1588 v3 = v24 + 1; | |
1589 v18 = __OFSUB__(v24 + 1, 15); | |
1590 v17 = v24++ - 14 < 0; | |
1591 } | |
1592 while ( v17 ^ v18 ); | |
1593 if ( v2 ) | |
1594 goto LABEL_61; | |
1595 } | |
1596 v19 = 0; | |
1597 do | |
1598 { | |
1599 v20 = pPlayers[v19 + 1]; | |
1600 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1601 v23[v2++] = v19; | |
1602 ++v19; | |
1603 } | |
1604 while ( v19 < 4 ); | |
1605 if ( v2 ) | |
1606 LABEL_61: | |
1607 result = v23[rand() % v2]; | |
1608 else | |
1609 result = 0; | |
1610 return result; | |
1611 } | |
1612 | |
1613 //----- (0042704B) -------------------------------------------------------- | |
1614 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1615 { | |
1616 stru319 *v3; // edi@1 | |
1617 signed int v4; // ebx@5 | |
1618 signed int v5; // edi@5 | |
1619 | |
1620 v3 = this; | |
1621 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1622 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1623 && rand() % 100 < 5 ) | |
1624 pActor->_44FD29(a2); | |
1625 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1626 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1627 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1628 return 2; | |
1629 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1630 return 3; | |
1631 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1632 } | |
1633 | |
1634 //----- (00427102) -------------------------------------------------------- | |
1635 int stru319::_427102(Actor *pActor, signed int a2) | |
1636 { | |
1637 unsigned __int8 v3; // cf@11 | |
1638 unsigned __int8 v4; // zf@11 | |
1639 SpellBuff *v6; // ecx@46 | |
89 | 1640 Player *v7; // esi@49 |
0 | 1641 signed int v8; // edx@50 |
89 | 1642 SpellBuff *v9; // ecx@50 |
0 | 1643 |
597 | 1644 switch(a2) |
0 | 1645 { |
597 | 1646 case 77: |
1647 { | |
1648 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1649 return 0; | |
1650 return 1; | |
1651 } | |
1652 case 80: | |
1653 { | |
1654 v6 = pParty->pPartyBuffs; | |
1655 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1656 { | |
1657 ++v6; | |
1658 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1659 { | |
1660 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1661 v8 = 0; | |
1662 v9 = v7->pPlayerBuffs; | |
1663 while ( v9->uExpireTime <= 0i64 ) | |
1664 { | |
1665 ++v8; | |
1666 ++v9; | |
1667 if ( v8 >= 24 ) | |
1668 { | |
1669 ++v7; | |
1670 if ( v7 <= &pParty->pPlayers[3] ) | |
1671 { | |
1672 v8 = 0; | |
1673 v9 = v7->pPlayerBuffs; | |
1674 } | |
1675 else | |
1676 return 0; | |
1677 } | |
1678 } | |
1679 return 1; | |
1680 } | |
1681 } | |
1682 return 1; | |
1683 } | |
1684 case 85: | |
1685 { | |
1686 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1687 return 1; | |
1688 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1689 return 0; | |
1690 v3 = 0; | |
1691 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1692 break; | |
1693 } | |
1694 case 86: | |
1695 { | |
0 | 1696 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1697 return 1; |
0 | 1698 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1699 return 0; |
0 | 1700 v3 = 0; |
1701 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1702 break; |
1703 } | |
1704 case 95: | |
1705 { | |
1706 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1707 return 1; | |
0 | 1708 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1709 return 0; |
0 | 1710 v3 = 0; |
1711 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1712 break; |
1713 } | |
1714 case 73: | |
1715 { | |
1716 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1717 return 1; | |
1718 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1719 return 0; | |
1720 v3 = 0; | |
1721 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1722 break; | |
1723 } | |
1724 case 5: | |
1725 { | |
1726 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1727 return 1; | |
1728 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1729 return 0; | |
1730 v3 = 0; | |
1731 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1732 break; | |
1733 } | |
1734 case 17: | |
1735 { | |
1736 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1737 return 1; | |
1738 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1739 return 0; | |
1740 v3 = 0; | |
1741 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1742 break; | |
1743 } | |
1744 case 38: | |
89 | 1745 { |
597 | 1746 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1747 return 1; | |
1748 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1749 return 0; | |
1750 v3 = 0; | |
1751 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1752 } | |
1753 case 46: | |
1754 { | |
1755 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1756 return 1; |
597 | 1757 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1758 return 0; | |
1759 v3 = 0; | |
1760 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1761 break; | |
1762 } | |
1763 case 47: | |
1764 { | |
1765 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1766 return 1; | |
1767 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1768 return 0; | |
1769 v3 = 0; | |
1770 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1771 break; | |
1772 } | |
1773 case 51: | |
1774 { | |
1775 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1776 return 1; | |
1777 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1778 { | |
89 | 1779 v3 = 0; |
1780 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1781 } | |
1782 else | |
597 | 1783 return 0; |
1784 break; | |
1785 } | |
1786 default: | |
89 | 1787 { |
597 | 1788 return 1; |
89 | 1789 } |
0 | 1790 } |
1791 if ( !(v3 | v4) ) | |
1792 return 0; | |
1793 return 1; | |
1794 } | |
1795 | |
1796 //----- (004272F5) -------------------------------------------------------- | |
1797 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1798 { | |
1799 signed int v5; // esi@1 | |
1800 signed int v6; // edi@1 | |
1801 int v7; // esi@8 | |
1802 int v8; // eax@9 | |
1803 int v9; // edx@11 | |
1804 int v10; // edx@13 | |
1805 int v11; // esi@13 | |
1806 unsigned __int8 v12; // sf@13 | |
1807 unsigned __int8 v13; // of@13 | |
1808 int v14; // edx@14 | |
1809 int v15; // eax@14 | |
1810 signed int result; // eax@17 | |
1811 | |
1812 v5 = pActor->pMonsterInfo.uAC; | |
1813 v6 = 0; | |
1814 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1815 v5 /= 2; | |
1816 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1817 v6 = pActor->pActorBuffs[15].uPower; | |
1818 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1819 v6 = pActor->pActorBuffs[16].uPower; | |
1820 v7 = v6 + v5; | |
1821 if ( a3 ) | |
1822 v8 = pPlayer->GetRangedAttack(); | |
1823 else | |
1824 v8 = pPlayer->GetActualAttack(0); | |
1825 v9 = rand() % (v7 + 2 * v8 + 30); | |
1826 if ( a3 == 2 ) | |
1827 { | |
1828 v14 = a4 + v9; | |
1829 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1830 } | |
1831 else | |
1832 { | |
1833 if ( a3 != 3 ) | |
1834 { | |
1835 v10 = a4 + v9; | |
1836 v11 = v7 + 15; | |
1837 v13 = __OFSUB__(v10, v11); | |
1838 v12 = v10 - v11 < 0; | |
1839 goto LABEL_16; | |
1840 } | |
1841 v14 = a4 + v9; | |
1842 v15 = 2 * v7 + 30; | |
1843 } | |
1844 v13 = __OFSUB__(v14, v15); | |
1845 v12 = v14 - v15 < 0; | |
1846 LABEL_16: | |
1847 if ( v12 ^ v13 ) | |
1848 result = 0; | |
1849 else | |
1850 result = 1; | |
1851 return result; | |
1852 } | |
1853 | |
1854 //----- (004273BB) -------------------------------------------------------- | |
1855 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1856 { | |
1857 Actor *v5; // ecx@1 | |
1858 signed int v6; // ebx@1 | |
1859 signed int v7; // esi@1 | |
1860 unsigned __int8 v8; // zf@1 | |
1861 unsigned __int8 v9; // sf@1 | |
1862 int v10; // ebx@10 | |
1863 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1864 | |
1865 v5 = a2; | |
1866 v6 = a2->pMonsterInfo.uAC; | |
1867 v7 = 0; | |
1868 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1869 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1870 a2a = 0; | |
1871 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1872 v6 /= 2; | |
1873 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1874 v7 = v5->pActorBuffs[14].uPower; | |
1875 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1876 v7 = v5->pActorBuffs[16].uPower; | |
1877 v10 = v7 + v6; | |
1878 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1879 a2a = pActor->pActorBuffs[14].uPower; | |
1880 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1881 a2a = pActor->pActorBuffs[17].uPower; | |
1882 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1883 { | |
1884 a2a += pActor->pActorBuffs[11].uPower; | |
1885 pActor->pActorBuffs[11].Reset(); | |
1886 } | |
1887 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1888 } | |
1889 | |
1890 //----- (004274AD) -------------------------------------------------------- | |
1891 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1892 { | |
1893 signed int v3; // edi@1 | |
1894 signed int v4; // esi@8 | |
1895 int v5; // esi@8 | |
1896 | |
1897 v3 = 0; | |
1898 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1899 v3 = pActor->pActorBuffs[14].uPower; | |
1900 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1901 v3 = pActor->pActorBuffs[17].uPower; | |
1902 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1903 { | |
1904 v3 += pActor->pActorBuffs[11].uPower; | |
1905 pActor->pActorBuffs[11].Reset(); | |
1906 } | |
1907 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1908 v5 = rand() % v4 + 1; | |
1909 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1910 } | |
1911 | |
1912 //----- (00427546) -------------------------------------------------------- | |
1913 int stru319::_427546(int a2) | |
1914 { | |
1915 int result; // eax@2 | |
1916 | |
1917 if ( a2 >= 0 ) | |
1918 { | |
1919 if ( a2 >= 1 ) | |
1920 result = (a2 >= 2) + 2; | |
1921 else | |
1922 result = 1; | |
1923 } | |
1924 else | |
1925 { | |
1926 result = 0; | |
1927 } | |
1928 return result; | |
1929 } | |
1930 | |
1931 //----- (0042756B) -------------------------------------------------------- | |
1932 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1933 { | |
1934 int v4; // edx@1 | |
1935 int v5; // ecx@1 | |
1936 signed int v6; // eax@4 | |
1937 signed int result; // eax@17 | |
1938 signed int v8; // esi@18 | |
1939 | |
1940 v4 = 0; | |
1941 v5 = 0; | |
1942 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1943 v5 = pActor->pActorBuffs[14].uPower; | |
1944 switch ( a2 ) | |
1945 { | |
1946 case 4: | |
1947 v6 = pActor->pMonsterInfo.uResPhysical; | |
1948 break; | |
1949 case 0: | |
1950 v6 = pActor->pMonsterInfo.uResFire; | |
1951 goto LABEL_12; | |
1952 case 1: | |
1953 v6 = pActor->pMonsterInfo.uResAir; | |
1954 goto LABEL_12; | |
1955 case 2: | |
1956 v6 = pActor->pMonsterInfo.uResWater; | |
1957 goto LABEL_12; | |
1958 case 3: | |
1959 v6 = pActor->pMonsterInfo.uResEarth; | |
1960 goto LABEL_12; | |
1961 case 6: | |
1962 v6 = pActor->pMonsterInfo.uResSpirit; | |
1963 break; | |
1964 case 7: | |
1965 v6 = pActor->pMonsterInfo.uResMind; | |
1966 goto LABEL_12; | |
1967 case 8: | |
1968 v6 = pActor->pMonsterInfo.uResBody; | |
1969 LABEL_12: | |
1970 v4 = v5; | |
1971 break; | |
1972 case 9: | |
1973 v6 = pActor->pMonsterInfo.uResLight; | |
1974 break; | |
1975 case 10: | |
1976 v6 = pActor->pMonsterInfo.uResDark; | |
1977 break; | |
1978 default: | |
1979 v6 = 0; | |
1980 break; | |
1981 } | |
1982 if ( v6 < 200 ) | |
1983 { | |
1984 v8 = v4 + v6 + 30; | |
1985 if ( rand() % v8 >= 30 ) | |
1986 { | |
1987 a3 >>= 1; | |
1988 if ( rand() % v8 >= 30 ) | |
1989 { | |
1990 a3 >>= 1; | |
1991 if ( rand() % v8 >= 30 ) | |
1992 { | |
1993 a3 >>= 1; | |
1994 if ( rand() % v8 >= 30 ) | |
1995 a3 >>= 1; | |
1996 } | |
1997 } | |
1998 } | |
1999 result = a3; | |
2000 } | |
2001 else | |
2002 { | |
2003 result = 0; | |
2004 } | |
2005 return result; | |
2006 } | |
2007 | |
2008 //----- (00427662) -------------------------------------------------------- | |
2009 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
2010 { | |
2011 Actor *v3; // edi@2 | |
2012 signed int v4; // esi@2 | |
2013 bool result; // eax@13 | |
2014 | |
2015 switch ( uType ) | |
2016 { | |
2017 case 0u: | |
2018 v3 = pActor; | |
2019 v4 = pActor->pMonsterInfo.uResFire; | |
2020 goto LABEL_12; | |
2021 case 1u: | |
2022 v3 = pActor; | |
2023 v4 = pActor->pMonsterInfo.uResAir; | |
2024 goto LABEL_12; | |
2025 case 2u: | |
2026 v3 = pActor; | |
2027 v4 = pActor->pMonsterInfo.uResWater; | |
2028 goto LABEL_12; | |
2029 case 3u: | |
2030 v3 = pActor; | |
2031 v4 = pActor->pMonsterInfo.uResEarth; | |
2032 goto LABEL_12; | |
2033 case 7u: | |
2034 v3 = pActor; | |
2035 v4 = pActor->pMonsterInfo.uResMind; | |
2036 goto LABEL_12; | |
2037 case 6u: | |
2038 v3 = pActor; | |
2039 v4 = pActor->pMonsterInfo.uResSpirit; | |
2040 goto LABEL_12; | |
2041 case 8u: | |
2042 v3 = pActor; | |
2043 v4 = pActor->pMonsterInfo.uResBody; | |
2044 goto LABEL_12; | |
2045 case 9u: | |
2046 v3 = pActor; | |
2047 v4 = pActor->pMonsterInfo.uResLight; | |
2048 goto LABEL_12; | |
2049 case 0xAu: | |
2050 v3 = pActor; | |
2051 v4 = pActor->pMonsterInfo.uResDark; | |
2052 goto LABEL_12; | |
2053 case 4u: | |
2054 v3 = pActor; | |
2055 v4 = pActor->pMonsterInfo.uResPhysical; | |
2056 LABEL_12: | |
2057 if ( v4 < 200 ) | |
2058 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2059 else | |
2060 result = 0; | |
2061 break; | |
2062 default: | |
2063 result = 1; | |
2064 break; | |
2065 } | |
2066 return result; | |
2067 } | |
2068 | |
2069 //----- (00427769) -------------------------------------------------------- | |
2070 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2071 { | |
2072 bool result; // eax@2 | |
2073 | |
710 | 2074 __debugbreak(); // refactor |
0 | 2075 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2076 result = 1; | |
2077 else | |
2078 result = 0; | |
2079 return result; | |
2080 } | |
2081 | |
2082 //----- (0042777D) -------------------------------------------------------- | |
319 | 2083 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2084 { |
370 | 2085 //bool result; // eax@2 |
486 | 2086 //__int16 v6; // bx@4 |
437 | 2087 //Player *v7; // eax@4 |
486 | 2088 //char v8; // zf@12 |
0 | 2089 unsigned __int16 v9; // cx@16 |
2090 unsigned int v10; // eax@18 | |
2091 unsigned __int8 v11; // sf@18 | |
2092 unsigned __int8 v12; // of@18 | |
2093 unsigned __int16 v13; // cx@21 | |
2094 unsigned int v14; // eax@23 | |
486 | 2095 //stru277 *v15; // esi@27 |
2096 //stru277 *v16; // eax@28 | |
0 | 2097 GUIWindow *v17; // eax@43 |
2098 GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2099 unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2100 unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2101 unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2102 unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2103 int v23; // [sp-1Ch] [bp-34h]@44 | |
2104 int v24; // [sp-18h] [bp-30h]@44 | |
2105 unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2106 unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2107 unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2108 char *v28; // [sp-8h] [bp-20h]@43 | |
2109 Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2110 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2111 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2112 | |
2113 //a3a = uPlayerID; | |
2114 //a2a = a1; | |
370 | 2115 |
2116 //if ( pParty->bTurnBasedModeOn != 1 | |
2117 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2118 if (pParty->bTurnBasedModeOn) | |
0 | 2119 { |
370 | 2120 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2121 return; | |
2122 } | |
2123 | |
2124 | |
486 | 2125 //v6 = a5; |
437 | 2126 //v7 = &pParty->pPlayers[uPlayerID]; |
2127 assert(uPlayerID < 4); | |
2128 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2129 if ( !(a5 & 0x10) ) |
2130 { | |
2131 switch ( a1 ) | |
2132 { | |
486 | 2133 case SPELL_SPIRIT_FATE: |
2134 case SPELL_BODY_FIRST_AID: | |
2135 case SPELL_DARK_REANIMATE: | |
2136 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2137 a5 |= 0x0100; | |
0 | 2138 break; |
486 | 2139 |
2140 case SPELL_FIRE_FIRE_AURA: | |
2141 case SPELL_WATER_RECHARGE_ITEM: | |
2142 case SPELL_WATER_ENCHANT_ITEM: | |
2143 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2144 //LOBYTE(v6) = a5 | 0x80; | |
2145 a5 |= 0x0080; | |
0 | 2146 break; |
486 | 2147 |
2148 case SPELL_FIRE_FIRE_BOLT: | |
2149 case SPELL_FIRE_FIREBALL: | |
2150 case SPELL_FIRE_INCINERATE: | |
2151 case SPELL_AIR_LIGHNING_BOLT: | |
2152 case SPELL_AIR_IMPLOSION: | |
2153 case SPELL_WATER_POISON_SPRAY: | |
2154 case SPELL_WATER_ICE_BOLT: | |
2155 case SPELL_WATER_ACID_BURST: | |
2156 case SPELL_WATER_ICE_BLAST: | |
2157 case SPELL_EARTH_STUN: | |
2158 case SPELL_EARTH_SLOW: | |
2159 case SPELL_EARTH_DEADLY_SWARM: | |
2160 case SPELL_EARTH_BLADES: | |
2161 case SPELL_EARTH_MASS_DISTORTION: | |
2162 case SPELL_SPIRIT_SPIRIT_LASH: | |
2163 case SPELL_MIND_MIND_BLAST: | |
2164 case SPELL_MIND_CHARM: | |
2165 case SPELL_MIND_PSYCHIC_SHOCK: | |
2166 case SPELL_BODY_HARM: | |
2167 case SPELL_BODY_FLYING_FIST: | |
2168 case SPELL_LIGHT_LIGHT_BOLT: | |
2169 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2170 case SPELL_LIGHT_SUNRAY: | |
2171 case SPELL_DARK_TOXIC_CLOUD: | |
2172 case SPELL_DARK_SHRINKING_RAY: | |
2173 case SPELL_DARK_SHARPMETAL: | |
2174 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2175 if ( !a6 ) |
486 | 2176 a5 |= 0x0008; |
0 | 2177 break; |
486 | 2178 case SPELL_MIND_TELEPATHY: |
2179 case SPELL_MIND_BERSERK: | |
2180 case SPELL_MIND_ENSLAVE: | |
2181 case SPELL_LIGHT_PARALYZE: | |
2182 case SPELL_DARK_CONTROL_UNDEAD: | |
2183 //LABEL_9: | |
2184 //v6 = a5 | 8; | |
2185 a5 |= 0x0008; | |
0 | 2186 break; |
486 | 2187 |
2188 case SPELL_EARTH_TELEKINESIS: | |
2189 a5 |= 0x0040; | |
2190 break; | |
2191 | |
2192 case SPELL_SPIRIT_BLESS: | |
2193 if (a4 && ~a4 & 0x01C0) | |
2194 goto LABEL_25; | |
2195 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); | |
0 | 2196 goto LABEL_25; |
2197 break; | |
486 | 2198 |
2199 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2200 v9 = a4; |
2201 if ( !a4 ) | |
437 | 2202 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
0 | 2203 goto LABEL_18; |
486 | 2204 |
2205 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2206 v9 = a4; |
2207 if ( !a4 ) | |
437 | 2208 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
0 | 2209 LABEL_18: |
2210 v10 = SkillToMastery(v9); | |
2211 v12 = __OFSUB__(v10, 3); | |
2212 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2213 goto LABEL_24; | |
486 | 2214 |
2215 case SPELL_BODY_HAMMERHANDS: | |
0 | 2216 v13 = a4; |
2217 if ( !a4 ) | |
437 | 2218 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2219 v14 = SkillToMastery(v13); |
2220 v12 = __OFSUB__(v14, 4); | |
2221 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
2222 LABEL_24: | |
2223 if ( v11 ^ v12 ) | |
2224 goto LABEL_25; | |
2225 break; | |
486 | 2226 |
2227 case SPELL_EARTH_STONE_TO_FLESH: | |
2228 case SPELL_SPIRIT_REMOVE_CURSE: | |
2229 case SPELL_SPIRIT_RAISE_DEAD: | |
2230 case SPELL_SPIRIT_RESSURECTION: | |
2231 case SPELL_MIND_REMOVE_FEAR: | |
2232 case SPELL_MIND_CURE_PARALYSIS: | |
2233 case SPELL_MIND_CURE_INSANITY: | |
2234 case SPELL_BODY_CURE_WEAKNESS: | |
2235 case SPELL_BODY_REGENERATION: | |
2236 case SPELL_BODY_CURE_POISON: | |
2237 case SPELL_BODY_CURE_DISEASE: | |
0 | 2238 LABEL_25: |
486 | 2239 //v6 = a5 | 2; |
2240 a5 |= 0x0002; | |
0 | 2241 break; |
486 | 2242 |
2243 case SPELL_DARK_SACRIFICE: | |
2244 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2245 a5 |= 0x0200; | |
0 | 2246 break; |
2247 default: | |
2248 break; | |
2249 } | |
2250 } | |
370 | 2251 |
486 | 2252 |
2253 if (a5 & 0x3CA) | |
0 | 2254 { |
486 | 2255 assert(sizeof(pStru277) / sizeof(*pStru277) == 10); |
2256 for (uint i = 0; i < 10; ++i) | |
2257 if (pStru277[i].field_8 & 0x3CA) | |
2258 { | |
2259 pStru277[i].spellnum = 0; | |
2260 break; | |
2261 } | |
0 | 2262 } |
486 | 2263 |
2264 assert(sizeof(pStru277) / sizeof(*pStru277) == 10); | |
2265 for (uint i = 0; i < 10; ++i) | |
0 | 2266 { |
486 | 2267 auto spell = pStru277 + i; |
2268 if (!spell->spellnum) | |
2269 continue; | |
2270 | |
2271 spell->spellnum = 0; | |
2272 if (spell->field_8 & 0x3CA) | |
0 | 2273 { |
486 | 2274 pGUIWindow_Settings->Release(); |
2275 pGUIWindow_Settings = nullptr; | |
2276 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2277 GameUI_Footer_TimeLeft = 0; |
486 | 2278 unk_50C9A0 = 0; |
2279 back_to_game(); | |
0 | 2280 } |
2281 } | |
486 | 2282 |
2283 int result = pStru277->PushStru277(a1, uPlayerID, a4, a5, a6); | |
0 | 2284 if ( result != -1 ) |
2285 { | |
486 | 2286 if ( a5 & 2 ) |
0 | 2287 { |
2288 if ( pGUIWindow_Settings ) | |
319 | 2289 return; |
0 | 2290 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); |
2291 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 0, 0x31u, "", 0); | |
2292 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 1u, 0x32u, "", 0); | |
2293 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 2u, 0x33u, "", 0); | |
2294 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 3u, 0x34u, "", 0); | |
319 | 2295 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2296 return; | |
0 | 2297 } |
486 | 2298 if ( a5 & 8 ) |
0 | 2299 { |
2300 if ( pGUIWindow_Settings ) | |
319 | 2301 return; |
0 | 2302 v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); |
2303 v29 = 0; | |
2304 v28 = ""; | |
2305 v27 = 0; | |
2306 v26 = 0; | |
2307 v25 = 70; | |
2308 LABEL_44: | |
2309 v24 = 0; | |
2310 v23 = 1; | |
2311 v22 = 344; | |
819 | 2312 v21 = game_viewport_width; |
0 | 2313 v20 = 8; |
2314 v19 = 8; | |
2315 pGUIWindow_Settings = v17; | |
2316 v18 = v17; | |
2317 LABEL_56: | |
2318 v18->CreateButton(v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29); | |
319 | 2319 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2320 return; | |
0 | 2321 } |
486 | 2322 if ( a5 & 0x40 ) |
0 | 2323 { |
2324 if ( pGUIWindow_Settings ) | |
319 | 2325 return; |
0 | 2326 v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); |
2327 v29 = 0; | |
2328 v28 = ""; | |
2329 v27 = 0; | |
2330 v26 = 0; | |
2331 v25 = 190; | |
2332 goto LABEL_44; | |
2333 } | |
486 | 2334 if ( (char)a5 < 0 ) |
0 | 2335 { |
2336 if ( pGUIWindow_Settings ) | |
319 | 2337 return; |
0 | 2338 ++pIcons_LOD->uTexturePacksCount; |
2339 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2340 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
2341 pGUIWindow_Settings = pStru277[result].sub_4219BE(); | |
2342 unk_50C9A0 = 1; | |
2343 some_active_character = uActiveCharacter; | |
319 | 2344 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2345 return; | |
0 | 2346 } |
486 | 2347 if ( HIBYTE(a5) & 1 ) |
0 | 2348 { |
2349 if ( pGUIWindow_Settings ) | |
319 | 2350 return; |
2351 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | |
0 | 2352 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 0, 0x31u, "", 0); |
2353 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 1u, 0x32u, "", 0); | |
2354 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 2u, 0x33u, "", 0); | |
2355 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 3u, 0x34u, "", 0); | |
819 | 2356 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, 344, 1, 0, 140, 0, 0, "", NULL); |
423 | 2357 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2358 } |
486 | 2359 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2360 { |
319 | 2361 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); |
0 | 2362 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton( |
2363 0x1D5u, | |
2364 0xB2u, | |
319 | 2365 (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24), |
2366 (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26), | |
0 | 2367 1, |
2368 0, | |
2369 0xBCu, | |
2370 0, | |
2371 0, | |
2372 "", | |
319 | 2373 (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), |
0 | 2374 0); |
2375 pBtn_NPCRight = pGUIWindow_Settings->CreateButton( | |
2376 0x272u, | |
2377 0xB2u, | |
319 | 2378 (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24), |
2379 (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26), | |
0 | 2380 1, |
2381 0, | |
2382 0xBCu, | |
2383 1u, | |
2384 0, | |
2385 "", | |
319 | 2386 (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), |
0 | 2387 0); |
2388 pGUIWindow_Settings->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 4u, 0x35u, "", 0); | |
319 | 2389 pGUIWindow_Settings->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 5u, 0x36u, "", 0); |
0 | 2390 } |
2391 } | |
2392 } | |
2393 | |
2394 //----- (00427D48) -------------------------------------------------------- | |
2395 void stru277::_427D48(unsigned int uPlayerID) | |
2396 { | |
2397 stru277 *v2; // esi@1 | |
2398 signed int v3; // ebx@1 | |
2399 | |
2400 v2 = this; | |
2401 v3 = 10; | |
2402 do | |
2403 { | |
2404 if ( v2->spellnum ) | |
2405 { | |
2406 if ( v2->field_8 & 0x3CA ) | |
2407 { | |
2408 v2->spellnum = 0; | |
2409 pGUIWindow_Settings->Release(); | |
2410 pGUIWindow_Settings = 0; | |
2411 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2412 GameUI_Footer_TimeLeft = 0; |
0 | 2413 unk_50C9A0 = 0; |
2414 back_to_game(); | |
2415 } | |
2416 } | |
2417 ++v2; | |
2418 --v3; | |
2419 } | |
2420 while ( v3 ); | |
2421 } | |
2422 | |
2423 //----- (00427DA0) -------------------------------------------------------- | |
823 | 2424 unsigned int stru277::PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2425 { |
2426 unsigned int result; // eax@1 | |
2427 stru277 *v7; // edx@1 | |
2428 stru277 *v8; // ecx@5 | |
2429 | |
2430 result = 0; | |
2431 v7 = this; | |
2432 while ( v7->spellnum ) | |
2433 { | |
2434 ++result; | |
2435 ++v7; | |
2436 if ( (signed int)result >= 10 ) | |
2437 goto LABEL_8; | |
2438 } | |
2439 v8 = &this[result]; | |
2440 v8->spellnum = a2; | |
2441 v8->uPlayerID = uPlayerID; | |
2442 if ( a5 & 0x10 ) | |
2443 v8->uPlayerID_2 = uPlayerID; | |
2444 v8->field_6 = 0; | |
488 | 2445 v8->spell_target_pid = 0; |
0 | 2446 v8->field_8 = a5; |
488 | 2447 v8->forced_spell_skill_level = skill_level; |
823 | 2448 v8->sound_id = spell_sound_id; |
0 | 2449 LABEL_8: |
2450 if ( result == 10 ) | |
2451 result = -1; | |
2452 return result; | |
2453 } | |
2454 | |
2455 //----- (00427E01) -------------------------------------------------------- | |
2456 void stru277::_427E01_cast_spell() | |
2457 { | |
486 | 2458 //int v1; // esi@1 |
0 | 2459 int v2; // edi@1 |
2460 stru277 *v3; // ebx@2 | |
488 | 2461 //signed int v4; // eax@8 |
2462 //__int16 v5; // ax@9 | |
0 | 2463 signed int v6; // eax@14 |
488 | 2464 //__int16 v7; // ax@23 |
2465 //__int16 v8; // ax@24 | |
2466 //char v9; // al@44 | |
2467 //int v10; // eax@45 | |
0 | 2468 unsigned __int16 v11; // cx@45 |
822 | 2469 //signed int v12; // ecx@48 |
490 | 2470 //int v13; // eax@53 |
0 | 2471 unsigned __int8 v14; // zf@53 |
488 | 2472 //unsigned int v15; // edx@53 |
2473 //signed int v16; // eax@53 | |
0 | 2474 Player *v17; // esi@70 |
822 | 2475 //int v18; // eax@72 |
823 | 2476 //int v19; // eax@74 |
0 | 2477 char *v20; // eax@74 |
2478 signed int i; // esi@76 | |
823 | 2479 //int v22; // eax@88 |
0 | 2480 __int16 v23; // ax@88 |
488 | 2481 //int v24; // ecx@93 |
2482 //int v25; // ecx@94 | |
2483 //signed __int64 v26; // qax@100 | |
2484 //char *v27; // ecx@100 | |
2485 //unsigned __int64 v28; // qax@102 | |
0 | 2486 int v29; // ecx@105 |
2487 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2488 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2489 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2490 //char *v33; // edx@113 |
823 | 2491 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2492 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2493 //int v36; // edx@125 |
823 | 2494 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2495 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2496 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2497 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2498 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2499 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2500 //int *v43; // ecx@129 |
823 | 2501 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2502 //int v45; // ecx@132 |
0 | 2503 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2504 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2505 //int v48; // eax@137 |
823 | 2506 //int v49; // eax@137 |
822 | 2507 //int v50; // eax@141 |
0 | 2508 int v51; // eax@146 |
2509 __int16 v52; // ax@153 | |
823 | 2510 //int v53; // eax@153 |
0 | 2511 signed __int64 v54; // qax@164 |
2512 int v55; // edi@164 | |
488 | 2513 //stru6 *v56; // eax@165 |
0 | 2514 int v57; // eax@169 |
2515 signed __int64 v58; // qax@177 | |
2516 int v59; // edi@177 | |
2517 unsigned __int16 v60; // ax@184 | |
2518 int v61; // ecx@184 | |
823 | 2519 //int v62; // eax@186 |
0 | 2520 int v63; // ecx@187 |
2521 int v64; // ecx@188 | |
2522 int v65; // ecx@189 | |
710 | 2523 //const char *v66; // ecx@200 |
2524 //unsigned int v67; // edx@201 | |
0 | 2525 char v68; // al@207 |
89 | 2526 ItemGen *v69; // esi@211 |
0 | 2527 int v70; // ecx@214 |
2528 int v71; // ecx@215 | |
2529 int v72; // ecx@216 | |
488 | 2530 //__int16 v73; // ST1C_2@222 |
2531 //__int16 v74; // ST18_2@222 | |
2532 //stru6 *v75; // eax@222 | |
0 | 2533 int v76; // ecx@223 |
2534 int v77; // ecx@224 | |
2535 int v78; // ecx@225 | |
2536 int v79; // eax@227 | |
488 | 2537 //int v80; // eax@232 |
2538 //__int16 v81; // ST18_2@245 | |
2539 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2540 //signed int v83; // edi@245 |
488 | 2541 //__int16 v84; // ST18_2@245 |
2542 //stru6 *v85; // eax@245 | |
2543 //__int16 v86; // ST18_2@245 | |
2544 //stru6 *v87; // eax@245 | |
2545 //__int16 v88; // ST18_2@245 | |
2546 //stru6 *v89; // eax@245 | |
0 | 2547 double v90; // st7@245 |
2548 int v91; // eax@250 | |
89 | 2549 Player *v92; // eax@255 |
488 | 2550 //__int16 v93; // ST18_2@260 |
2551 //stru6 *v94; // eax@260 | |
2552 //__int16 v95; // ST18_2@260 | |
2553 //stru6 *v96; // eax@260 | |
2554 //__int16 v97; // ST18_2@260 | |
2555 //stru6 *v98; // eax@260 | |
2556 //__int16 v99; // ST18_2@260 | |
2557 //stru6 *v100; // eax@260 | |
0 | 2558 int v101; // ecx@261 |
2559 int v102; // ecx@262 | |
2560 int v103; // ecx@263 | |
2561 int v104; // eax@265 | |
2562 int v105; // edi@271 | |
488 | 2563 //__int16 v106; // ST18_2@272 |
2564 //stru6 *v107; // eax@272 | |
0 | 2565 __int16 v108; // ST1C_2@274 |
2566 __int16 v109; // ST18_2@274 | |
2567 stru6 *v110; // eax@274 | |
2568 int v111; // eax@274 | |
2569 Actor *v112; // esi@278 | |
2570 int v113; // eax@278 | |
2571 int v114; // ebx@278 | |
2572 unsigned int v115; // ecx@278 | |
2573 int v116; // edx@279 | |
2574 int v117; // edx@281 | |
2575 int v118; // edx@283 | |
2576 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2577 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2578 //int v121; // eax@286 |
0 | 2579 signed int v122; // eax@286 |
2580 int v123; // ecx@288 | |
2581 int v124; // ecx@289 | |
2582 int v125; // ecx@290 | |
2583 int v126; // eax@292 | |
2584 int v127; // eax@296 | |
488 | 2585 //__int16 v128; // ST18_2@303 |
2586 //stru6 *v129; // eax@303 | |
2587 //__int16 v130; // ST18_2@303 | |
2588 //stru6 *v131; // eax@303 | |
2589 //__int16 v132; // ST18_2@303 | |
2590 //stru6 *v133; // eax@303 | |
2591 //__int16 v134; // ST18_2@303 | |
2592 //stru6 *v135; // eax@303 | |
2593 //unsigned __int64 v136; // qax@304 | |
2594 //char *v137; // ecx@304 | |
0 | 2595 int v138; // ecx@305 |
2596 int v139; // ecx@306 | |
2597 int v140; // eax@308 | |
488 | 2598 //__int16 v141; // ST18_2@311 |
2599 //stru6 *v142; // eax@311 | |
2600 //__int16 v143; // ST18_2@311 | |
2601 //stru6 *v144; // eax@311 | |
2602 //__int16 v145; // ST18_2@311 | |
2603 //stru6 *v146; // eax@311 | |
2604 //__int16 v147; // ST18_2@311 | |
2605 //stru6 *v148; // eax@311 | |
0 | 2606 int v149; // ecx@312 |
2607 int v150; // ecx@313 | |
2608 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2609 //signed int v152; // eax@322 |
0 | 2610 int v153; // ecx@322 |
2611 int v154; // eax@322 | |
2612 int v155; // eax@323 | |
2613 int v156; // eax@323 | |
2614 int v157; // eax@326 | |
2615 double v158; // st7@326 | |
2616 double v159; // st6@326 | |
2617 signed __int64 v160; // qtt@334 | |
823 | 2618 //int v161; // eax@339 |
0 | 2619 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2620 //int v163; // eax@340 |
0 | 2621 signed int v164; // eax@340 |
2622 signed int v165; // edi@340 | |
488 | 2623 //stru6 *v166; // eax@340 |
2624 //stru6 *v167; // eax@340 | |
0 | 2625 signed int v168; // edi@343 |
2626 int v169; // eax@344 | |
2627 int v170; // ecx@346 | |
2628 int v171; // ecx@347 | |
2629 int v172; // ecx@348 | |
2630 int v173; // edi@350 | |
2631 signed int v174; // edi@355 | |
488 | 2632 //__int16 v175; // ST18_2@357 |
2633 //stru6 *v176; // eax@357 | |
2634 //__int16 v177; // ST18_2@357 | |
2635 //stru6 *v178; // eax@357 | |
2636 //__int16 v179; // ST18_2@357 | |
2637 //stru6 *v180; // eax@357 | |
2638 //__int16 v181; // ST18_2@357 | |
2639 //stru6 *v182; // eax@357 | |
2640 //signed __int64 v183; // qax@357 | |
0 | 2641 int v184; // ecx@358 |
2642 int v185; // ecx@359 | |
2643 int v186; // ecx@360 | |
823 | 2644 //int v187; // eax@367 |
0 | 2645 int v188; // esi@369 |
2646 int v189; // edi@369 | |
710 | 2647 //const char *v190; // ecx@377 |
0 | 2648 signed int v191; // edi@379 |
2649 int v192; // ecx@382 | |
2650 int v193; // ecx@383 | |
2651 int v194; // ecx@384 | |
2652 int v195; // eax@386 | |
2653 int v196; // eax@387 | |
488 | 2654 //__int16 v197; // ST18_2@395 |
2655 //stru6 *v198; // eax@395 | |
2656 //__int16 v199; // ST18_2@395 | |
2657 //stru6 *v200; // eax@395 | |
2658 //__int16 v201; // ST18_2@395 | |
2659 //stru6 *v202; // eax@395 | |
2660 //__int16 v203; // ST18_2@395 | |
2661 //stru6 *v204; // eax@395 | |
0 | 2662 signed int v205; // edi@405 |
2663 int v206; // eax@407 | |
2664 __int16 v207; // cx@407 | |
2665 int v208; // eax@411 | |
2666 signed int v209; // ecx@412 | |
2667 int v210; // edx@412 | |
2668 signed int v211; // ecx@412 | |
2669 int v212; // eax@413 | |
2670 int v213; // eax@413 | |
2671 int v214; // eax@413 | |
2672 int v215; // eax@415 | |
2673 double v216; // st7@415 | |
2674 double v217; // st6@415 | |
2675 signed __int64 v218; // qtt@423 | |
2676 int v219; // ecx@425 | |
2677 int v220; // ecx@426 | |
2678 int v221; // edi@428 | |
2679 char *v222; // edi@434 | |
2680 char v223; // al@438 | |
2681 int v224; // ecx@442 | |
2682 int v225; // ecx@443 | |
823 | 2683 //int v226; // eax@451 |
0 | 2684 int v227; // esi@453 |
2685 unsigned int v228; // edi@454 | |
2686 int v229; // edi@466 | |
488 | 2687 //__int16 v230; // ST18_2@469 |
2688 //stru6 *v231; // eax@469 | |
2689 //signed int v232; // esi@469 | |
2690 //__int16 v233; // ST18_2@469 | |
2691 //stru6 *v234; // eax@469 | |
2692 //__int16 v235; // ST18_2@469 | |
2693 //stru6 *v236; // eax@469 | |
2694 //__int16 v237; // ST18_2@469 | |
2695 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2696 //__int16 v239; // ST1C_2@469 |
0 | 2697 char *v240; // ecx@472 |
2698 double v241; // st7@478 | |
2699 signed __int64 v242; // qax@484 | |
2700 char *v243; // ecx@484 | |
2701 char *v244; // eax@488 | |
2702 int v245; // edi@492 | |
2703 int v246; // eax@492 | |
2704 char *v247; // eax@497 | |
2705 char v248; // al@497 | |
2706 char v249; // cf@500 | |
2707 float v250; // esi@507 | |
2708 char v251; // al@507 | |
2709 int v252; // edx@510 | |
2710 int m; // esi@510 | |
2711 int v254; // eax@513 | |
2712 int v255; // esi@513 | |
2713 int v256; // ecx@513 | |
2714 int v257; // edx@514 | |
2715 int v258; // ecx@514 | |
2716 char v259; // al@516 | |
2717 int v260; // eax@518 | |
2718 int v261; // esi@519 | |
2719 int v262; // edx@521 | |
2720 int v263; // ecx@521 | |
2721 int v264; // esi@521 | |
2722 int v265; // edx@521 | |
2723 int *ii; // eax@522 | |
2724 int v267; // eax@524 | |
2725 int v268; // eax@524 | |
2726 int v269; // eax@526 | |
2727 char *v270; // eax@531 | |
2728 char v271; // al@531 | |
2729 char v272; // cf@534 | |
2730 float v273; // esi@541 | |
2731 char v274; // al@541 | |
2732 int v275; // edx@544 | |
2733 int k; // esi@544 | |
2734 int v277; // edx@548 | |
2735 int v278; // ecx@548 | |
2736 char v279; // al@550 | |
2737 int v280; // eax@552 | |
2738 int v281; // esi@553 | |
2739 int v282; // edx@555 | |
2740 int v283; // ecx@555 | |
2741 int v284; // esi@555 | |
2742 int v285; // edx@555 | |
2743 int *l; // eax@556 | |
2744 int v287; // eax@558 | |
2745 int v288; // eax@558 | |
2746 ItemGen *v289; // eax@560 | |
2747 signed int v290; // eax@560 | |
2748 unsigned __int8 v291; // al@564 | |
2749 char v292; // al@573 | |
2750 int v293; // eax@575 | |
2751 ItemGen *v294; // esi@575 | |
2752 int v295; // edx@575 | |
2753 int kk; // edi@575 | |
2754 int v297; // edx@579 | |
2755 int v298; // ecx@579 | |
2756 char v299; // al@581 | |
2757 int v300; // eax@583 | |
2758 int v301; // edi@584 | |
2759 int v302; // edx@586 | |
2760 int v303; // ecx@586 | |
2761 int v304; // edi@586 | |
2762 int v305; // edx@586 | |
2763 int *jj; // eax@587 | |
2764 int v307; // eax@589 | |
2765 int v308; // eax@589 | |
2766 char *v309; // ecx@593 | |
2767 char v310; // sf@593 | |
2768 unsigned __int8 v311; // of@593 | |
2769 char v312; // cl@597 | |
488 | 2770 char v313; // al@606pGame->GetStru6() |
0 | 2771 int v314; // edx@607 |
2772 int j; // esi@607 | |
2773 unsigned int v316; // eax@613 | |
2774 const char *v317; // ecx@617 | |
2775 Player *v318; // ecx@619 | |
2776 unsigned int v319; // edi@627 | |
2777 int v320; // ecx@629 | |
2778 int v321; // ecx@630 | |
2779 int v322; // edi@632 | |
2780 int v323; // edi@635 | |
2781 char *v324; // eax@635 | |
2782 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2783 //int v326; // eax@643 |
823 | 2784 //int v327; // eax@648 |
0 | 2785 int v328; // ecx@651 |
2786 int v329; // ecx@652 | |
2787 int v330; // edi@654 | |
488 | 2788 //__int16 v331; // ST18_2@658 |
2789 //stru6 *v332; // eax@658 | |
2790 //__int16 v333; // ST18_2@658 | |
2791 //stru6 *v334; // eax@658 | |
2792 //__int16 v335; // ST18_2@658 | |
2793 //stru6 *v336; // eax@658 | |
2794 //__int16 v337; // ST18_2@658 | |
2795 //stru6 *v338; // eax@658 | |
0 | 2796 int v339; // ecx@659 |
2797 int v340; // ecx@660 | |
2798 int v341; // eax@663 | |
2799 signed int v342; // edi@668 | |
2800 signed int v343; // edi@670 | |
2801 unsigned __int64 v344; // ST08_8@670 | |
488 | 2802 //__int16 v345; // ST1C_2@671 |
2803 //__int16 v346; // ST18_2@671 | |
2804 //stru6 *v347; // eax@671 | |
0 | 2805 int v348; // ecx@672 |
2806 int v349; // ecx@673 | |
2807 int v350; // edi@676 | |
2808 Player *v351; // edi@680 | |
488 | 2809 //__int16 v352; // ST18_2@685 |
2810 //stru6 *v353; // eax@685 | |
0 | 2811 int v354; // ecx@686 |
2812 int v355; // ecx@687 | |
2813 int v356; // eax@689 | |
112 | 2814 Player *v357; // edi@694 |
488 | 2815 //unsigned __int16 v358; // ST1C_2@695 |
2816 //__int16 v359; // ST18_2@695 | |
2817 //stru6 *v360; // eax@695 | |
2818 //__int16 v361; // ST1C_2@697 | |
2819 //__int16 v362; // ST18_2@697 | |
2820 //stru6 *v363; // eax@697 | |
0 | 2821 int v364; // ecx@698 |
2822 int v365; // ecx@699 | |
2823 int v366; // eax@701 | |
488 | 2824 //stru6 *v367; // eax@704 |
823 | 2825 //int v368; // eax@704 |
0 | 2826 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2827 //int v370; // eax@706 |
0 | 2828 int v371; // ecx@709 |
2829 int v372; // ecx@710 | |
2830 int v373; // eax@715 | |
2831 int v374; // eax@717 | |
112 | 2832 Player *v375; // edi@717 |
0 | 2833 int v376; // eax@717 |
2834 Player *v377; // ecx@719 | |
2835 int v378; // ecx@721 | |
2836 int v379; // ecx@722 | |
2837 int v380; // eax@724 | |
2838 int v381; // edi@727 | |
2839 int v382; // ecx@727 | |
2840 Player *v383; // eax@728 | |
2841 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2842 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2843 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2844 //Player *v387; // edi@738 |
0 | 2845 int v388; // edi@740 |
488 | 2846 //unsigned __int16 v389; // ST1C_2@740 |
2847 //__int16 v390; // ST18_2@740 | |
2848 //stru6 *v391; // eax@740 | |
0 | 2849 int v392; // ecx@742 |
2850 int v393; // ecx@743 | |
2851 int v394; // ecx@744 | |
2852 int v395; // edi@747 | |
2853 int v396; // eax@752 | |
2854 int v397; // eax@757 | |
2855 int v398; // eax@757 | |
2856 int v399; // eax@757 | |
2857 char *v400; // esi@757 | |
488 | 2858 //Game *v401; // ecx@759 |
2859 //__int16 v402; // ST1C_2@759 | |
2860 //__int16 v403; // ST18_2@759 | |
2861 //stru6 *v404; // eax@759 | |
0 | 2862 int v405; // ecx@761 |
2863 int v406; // ecx@762 | |
2864 int v407; // edi@765 | |
488 | 2865 //__int16 v408; // ST1C_2@769 |
2866 //__int16 v409; // ST18_2@769 | |
2867 //stru6 *v410; // eax@769 | |
0 | 2868 int v411; // ecx@772 |
2869 int v412; // ecx@773 | |
2870 int v413; // edi@775 | |
488 | 2871 //__int16 v414; // ST1C_2@781 |
2872 //__int16 v415; // ST18_2@781 | |
2873 //stru6 *v416; // eax@781 | |
0 | 2874 int v417; // eax@787 |
2875 int v418; // ecx@789 | |
2876 __int16 v419; // ax@791 | |
2877 signed int v420; // eax@793 | |
2878 int v421; // edx@793 | |
2879 const char *v422; // eax@801 | |
2880 int v423; // ecx@808 | |
2881 int v424; // ecx@809 | |
2882 int v425; // eax@811 | |
2883 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2884 //signed int v427; // eax@820 |
0 | 2885 int v428; // ecx@825 |
2886 int v429; // ecx@826 | |
2887 int v430; // eax@828 | |
488 | 2888 //stru6 *v431; // eax@831 |
823 | 2889 //int v432; // eax@831 |
0 | 2890 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2891 //int v434; // eax@833 |
0 | 2892 int v435; // ecx@837 |
2893 int v436; // ecx@838 | |
488 | 2894 //__int16 v437; // ST1C_2@843 |
2895 //__int16 v438; // ST18_2@843 | |
2896 //stru6 *v439; // eax@843 | |
0 | 2897 int v440; // eax@843 |
2898 int v441; // eax@847 | |
2899 int v442; // ecx@850 | |
2900 int v443; // ecx@851 | |
2901 int v444; // eax@853 | |
2902 signed int v445; // edi@857 | |
2903 int v446; // ecx@862 | |
2904 LevelDecoration *v447; // edi@864 | |
2905 __int16 v448; // ax@864 | |
2906 char *v449; // esi@870 | |
2907 int v450; // eax@870 | |
2908 int v451; // ecx@875 | |
2909 int v452; // ecx@876 | |
2910 int v453; // edi@878 | |
488 | 2911 //__int16 v454; // ST1C_2@884 |
2912 //__int16 v455; // ST18_2@884 | |
2913 //stru6 *v456; // eax@884 | |
0 | 2914 int v457; // ecx@887 |
2915 int v458; // ecx@888 | |
2916 int v459; // eax@890 | |
2917 signed int v460; // eax@895 | |
2918 Actor *v461; // eax@897 | |
2919 unsigned __int16 v462; // cx@897 | |
2920 signed int v463; // edx@897 | |
2921 int v464; // ecx@905 | |
2922 int v465; // ecx@906 | |
2923 int v466; // edi@909 | |
488 | 2924 //__int16 v467; // ST1C_2@913 |
2925 //__int16 v468; // ST18_2@913 | |
2926 //stru6 *v469; // eax@913 | |
0 | 2927 int v470; // edi@913 |
2928 int v471; // eax@917 | |
2929 int v472; // eax@917 | |
2930 char *v473; // esi@918 | |
488 | 2931 //__int16 v474; // ST18_2@920 |
2932 //stru6 *v475; // eax@920 | |
2933 //__int16 v476; // ST18_2@920 | |
2934 //stru6 *v477; // eax@920 | |
2935 //__int16 v478; // ST18_2@920 | |
2936 //stru6 *v479; // eax@920 | |
2937 //__int16 v480; // ST18_2@920 | |
2938 //stru6 *v481; // eax@920 | |
2939 //__int16 v482; // ST18_2@923 | |
2940 //stru6 *v483; // eax@923 | |
2941 //__int16 v484; // ST18_2@923 | |
2942 //stru6 *v485; // eax@923 | |
2943 //__int16 v486; // ST18_2@923 | |
2944 //stru6 *v487; // eax@923 | |
2945 //__int16 v488; // ST18_2@923 | |
2946 //stru6 *v489; // eax@923 | |
2947 //__int16 v490; // ST1C_2@924 | |
2948 //__int16 v491; // ST18_2@924 | |
2949 //stru6 *v492; // eax@924 | |
0 | 2950 int v493; // ecx@925 |
2951 int v494; // ecx@926 | |
488 | 2952 //__int16 v495; // ST1C_2@931 |
2953 //__int16 v496; // ST18_2@931 | |
2954 //stru6 *v497; // eax@931 | |
0 | 2955 int v498; // edi@931 |
2956 int v499; // eax@935 | |
2957 int v500; // eax@935 | |
2958 Player *v501; // edi@939 | |
488 | 2959 //__int16 v502; // ST18_2@940 |
2960 //stru6 *v503; // eax@940 | |
2961 //stru6 *v504; // eax@943 | |
0 | 2962 int v505; // eax@943 |
823 | 2963 //int v506; // eax@943 |
0 | 2964 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2965 //int v508; // eax@944 |
0 | 2966 signed int v509; // eax@944 |
2967 signed int v510; // edi@944 | |
2968 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2969 //int v512; // eax@946 |
0 | 2970 SpellBuff *v513; // edi@946 |
2971 int v514; // ecx@950 | |
2972 int v515; // ecx@951 | |
2973 int v516; // eax@953 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2974 //int v517; // eax@956 |
90 | 2975 Actor *v518; // edx@957 |
0 | 2976 __int16 v519; // cx@958 |
2977 int v520; // ecx@968 | |
2978 int v521; // ecx@969 | |
2979 int v522; // eax@971 | |
488 | 2980 //__int16 v523; // ST18_2@975 |
2981 //stru6 *v524; // eax@975 | |
2982 //__int16 v525; // ST18_2@975 | |
2983 //stru6 *v526; // eax@975 | |
2984 //__int16 v527; // ST18_2@975 | |
2985 //stru6 *v528; // eax@975 | |
2986 //__int16 v529; // ST18_2@975 | |
2987 //stru6 *v530; // eax@975 | |
0 | 2988 int v531; // eax@982 |
823 | 2989 //int v532; // eax@982 |
0 | 2990 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2991 //int v534; // eax@983 |
0 | 2992 signed int v535; // eax@983 |
2993 signed int v536; // edi@983 | |
2994 stru6 *v537; // eax@984 | |
2995 int v538; // ecx@985 | |
2996 int v539; // ecx@986 | |
2997 int v540; // eax@988 | |
488 | 2998 //__int16 v541; // ST18_2@991 |
2999 //stru6 *v542; // eax@991 | |
3000 //__int16 v543; // ST18_2@991 | |
3001 //stru6 *v544; // eax@991 | |
3002 //__int16 v545; // ST18_2@991 | |
3003 //stru6 *v546; // eax@991 | |
3004 //__int16 v547; // ST18_2@991 | |
0 | 3005 stru6 *v548; // eax@991 |
3006 double v549; // st7@991 | |
3007 unsigned __int16 v550; // di@991 | |
3008 int v551; // ecx@993 | |
3009 int v552; // ecx@994 | |
89 | 3010 Player *v553; // edi@1001 |
488 | 3011 //__int16 v554; // ST18_2@1002 |
3012 //stru6 *v555; // eax@1002 | |
3013 //__int16 v556; // ST18_2@1002 | |
3014 //stru6 *v557; // eax@1002 | |
3015 //__int16 v558; // ST18_2@1002 | |
3016 //stru6 *v559; // eax@1002 | |
3017 //__int16 v560; // ST18_2@1002 | |
3018 //stru6 *v561; // eax@1002 | |
0 | 3019 unsigned __int16 v562; // di@1005 |
3020 signed int v563; // eax@1010 | |
3021 unsigned int v564; // ecx@1011 | |
3022 signed int v565; // eax@1012 | |
3023 Player **v566; // ecx@1012 | |
3024 int v567; // eax@1012 | |
488 | 3025 //unsigned __int16 v568; // ST1C_2@1012 |
3026 //__int16 v569; // ST18_2@1012 | |
3027 //stru6 *v570; // eax@1012 | |
0 | 3028 Player *v571; // eax@1013 |
3029 char *v572; // ecx@1013 | |
3030 int v573; // ecx@1017 | |
3031 int v574; // ecx@1018 | |
3032 int v575; // eax@1020 | |
3033 signed int v576; // eax@1025 | |
3034 Player *v577; // eax@1026 | |
3035 int v578; // eax@1028 | |
3036 __int16 v579; // ax@1029 | |
823 | 3037 //int v580; // eax@1031 |
0 | 3038 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3039 //int v582; // eax@1031 |
488 | 3040 //__int16 v583; // ST1C_2@1034 |
3041 //__int16 v584; // ST18_2@1034 | |
0 | 3042 char *v585; // esi@1034 |
488 | 3043 //stru6 *v586; // eax@1034 |
0 | 3044 signed int v587; // eax@1035 |
3045 int v588; // ecx@1036 | |
3046 int v589; // ecx@1037 | |
3047 int v590; // ecx@1038 | |
3048 char v591; // al@1048 | |
3049 int v592; // esi@1052 | |
3050 int v593; // ecx@1057 | |
3051 int v594; // ecx@1058 | |
823 | 3052 //int v595; // eax@1064 |
0 | 3053 int v596; // esi@1066 |
3054 unsigned int v597; // edi@1067 | |
3055 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3056 //signed int v599; // eax@1082 |
0 | 3057 int v600; // edi@1086 |
3058 int v601; // edx@1086 | |
3059 int v602; // eax@1086 | |
3060 int v603; // ecx@1086 | |
823 | 3061 //int v604; // eax@1087 |
0 | 3062 char *v605; // eax@1089 |
3063 int v606; // edx@1091 | |
3064 int v607; // ecx@1100 | |
3065 __int16 v608; // ax@1102 | |
3066 signed int v609; // eax@1104 | |
3067 int v610; // edi@1106 | |
3068 unsigned int v611; // eax@1106 | |
89 | 3069 Player *v612; // edi@1106 |
3070 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3071 int v614; // eax@1116 |
3072 int v615; // edi@1119 | |
488 | 3073 //__int16 v616; // ST1C_2@1122 |
3074 //__int16 v617; // ST18_2@1122 | |
3075 //stru6 *v618; // eax@1122 | |
112 | 3076 Player *v619; // edi@1123 |
488 | 3077 //unsigned __int16 v620; // ST1C_2@1124 |
3078 //__int16 v621; // ST18_2@1124 | |
3079 //stru6 *v622; // eax@1124 | |
0 | 3080 signed __int64 v623; // qax@1127 |
823 | 3081 //int v624; // eax@1127 |
0 | 3082 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3083 //int v626; // eax@1129 |
0 | 3084 signed int v627; // eax@1129 |
3085 signed int v628; // edi@1129 | |
3086 int v629; // ecx@1130 | |
3087 Player *v630; // eax@1131 | |
3088 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3089 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3090 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3091 //signed int v634; // eax@1140 |
0 | 3092 int v635; // edi@1142 |
488 | 3093 //unsigned __int16 v636; // ST1C_2@1142 |
3094 //__int16 v637; // ST18_2@1142 | |
3095 //stru6 *v638; // eax@1142 | |
3096 //stru6 *v639; // eax@1143 | |
0 | 3097 int v640; // ecx@1146 |
3098 int v641; // ecx@1147 | |
3099 int v642; // edi@1156 | |
3100 int v643; // eax@1156 | |
3101 int v644; // eax@1156 | |
3102 signed int v645; // eax@1158 | |
488 | 3103 //Player *v646; // ebx@1169 |
3104 //int v647; // edi@1169 | |
3105 //signed int v648; // ST1C_4@1170 | |
3106 //Player *v649; // ecx@1170 | |
3107 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3108 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3109 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3110 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3111 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3112 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3113 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3114 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3115 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3116 int v659; // [sp+0h] [bp-E84h]@123 |
3117 int v660; // [sp+0h] [bp-E84h]@146 | |
3118 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3119 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3120 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3121 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3122 int v665; // [sp+0h] [bp-E84h]@807 | |
3123 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3124 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3125 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3126 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3127 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3128 int v671; // [sp+4h] [bp-E80h]@146 |
3129 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3130 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3131 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3132 const char *v675; // [sp+4h] [bp-E80h]@800 |
3133 int v676; // [sp+4h] [bp-E80h]@807 | |
3134 int v677; // [sp+4h] [bp-E80h]@861 | |
3135 int v678; // [sp+4h] [bp-E80h]@997 | |
3136 int v679; // [sp+14h] [bp-E70h]@515 | |
3137 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3138 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3139 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3140 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3141 int v684; // [sp+D04h] [bp-180h]@416 | |
3142 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3143 int x; // [sp+D20h] [bp-164h]@327 | |
3144 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3145 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3146 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3147 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3148 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3149 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3150 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3151 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3152 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3153 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3154 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3155 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3156 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3157 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3158 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3159 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3160 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3161 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3162 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3163 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3164 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3165 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3166 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3167 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
3168 stru277 *v711; // [sp+D90h] [bp-F4h]@1 | |
3169 __int64 v712; // [sp+D94h] [bp-F0h]@991 | |
3170 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3171 int n; // [sp+DA0h] [bp-E4h]@1 | |
3172 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3173 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3174 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3175 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3176 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3177 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3178 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
|
3179 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3180 int v723; // [sp+E4Ch] [bp-38h]@1 |
3181 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3182 float v725; // [sp+E54h] [bp-30h]@23 | |
3183 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3184 //int v726b; |
0 | 3185 float v727; // [sp+E5Ch] [bp-28h]@1 |
3186 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3187 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3188 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3189 Player *v730b; |
3190 ItemGen *v730c; | |
0 | 3191 int v731; // [sp+E6Ch] [bp-18h]@48 |
3192 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3193 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3194 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3195 int amount; // [sp+E80h] [bp-4h]@1 | |
3196 | |
3197 auto ecx0 = this; | |
3198 | |
3199 v711 = ecx0; | |
3200 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3201 SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3202 //SpriteObject::SpriteObject(&a1); |
0 | 3203 |
486 | 3204 //v1 = 0; |
0 | 3205 v2 = 0; |
3206 amount = 0; | |
3207 LODWORD(v733) = 0; | |
3208 v723 = 0; | |
3209 v727 = 0.0; | |
3210 n = 0; | |
3211 while ( 1 ) | |
3212 { | |
3213 v3 = &v711[n]; | |
3214 HIDWORD(v733) = (int)v3; | |
486 | 3215 if ( v3->spellnum == 0 ) |
0 | 3216 goto LABEL_1166; |
486 | 3217 |
3218 if (pParty->Invisible()) | |
3219 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3220 | |
0 | 3221 if ( v3->field_8 & 0x3CA ) |
3222 { | |
3223 if ( !pParty->pPlayers[v3->uPlayerID].CanAct() ) | |
3224 v711->_427D48(1u); | |
3225 goto LABEL_1166; | |
3226 } | |
3227 pPlayer = &pParty->pPlayers[v3->uPlayerID]; | |
488 | 3228 |
3229 a2 = v3->spell_target_pid; | |
3230 if (!a2) | |
0 | 3231 { |
488 | 3232 if (v3->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3233 v3->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3234 v3->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
3235 v666 = 1; | |
3236 else | |
3237 v666 = 0; | |
3238 | |
3239 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3240 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3241 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3242 a2 = pMouse->uPointingObjectID; |
0 | 3243 } |
488 | 3244 |
3245 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3246 a1.uType = stru_4E3ACC[v3->spellnum].field_0; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3247 if (a1.uType) |
0 | 3248 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3249 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3250 { |
830 | 3251 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, v3->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3252 v2 = v723; |
3253 } | |
3254 else | |
3255 { | |
3256 v715.uYawAngle = pParty->sRotationY; | |
3257 v715.uPitchAngle = pParty->sRotationX; | |
3258 } | |
3259 } | |
488 | 3260 |
486 | 3261 LODWORD(v725) = 0; |
3262 _this = 0; | |
488 | 3263 if (v3->forced_spell_skill_level) |
3264 { | |
3265 v11 = v3->forced_spell_skill_level; | |
3266 v723 = v11 & 0x3F; | |
3267 v2 = v723; | |
3268 } | |
3269 else | |
0 | 3270 { |
488 | 3271 //v667 = PLAYER_SKILL_STAFF; |
3272 if (v3->spellnum < SPELL_AIR_WIZARD_EYE) | |
3273 v667 = PLAYER_SKILL_FIRE; | |
3274 else if (v3->spellnum < SPELL_WATER_AWAKEN) | |
3275 v667 = PLAYER_SKILL_AIR; | |
3276 else if (v3->spellnum < SPELL_EARTH_STUN) | |
3277 v667 = PLAYER_SKILL_WATER; | |
3278 else if (v3->spellnum < SPELL_SPIRIT_DETECT_LIFE) | |
3279 v667 = PLAYER_SKILL_EARTH; | |
3280 else if (v3->spellnum < SPELL_MIND_REMOVE_FEAR) | |
3281 v667 = PLAYER_SKILL_SPIRIT; | |
3282 else if (v3->spellnum < SPELL_BODY_CURE_WEAKNESS) | |
3283 v667 = PLAYER_SKILL_MIND; | |
3284 else if (v3->spellnum < SPELL_LIGHT_LIGHT_BOLT) | |
3285 v667 = PLAYER_SKILL_BODY; | |
3286 else if (v3->spellnum < SPELL_DARK_REANIMATE) | |
3287 v667 = PLAYER_SKILL_LIGHT; | |
3288 else if (v3->spellnum < SPELL_BOW_ARROW) | |
3289 v667 = PLAYER_SKILL_DARK; | |
3290 else if (v3->spellnum == SPELL_BOW_ARROW) | |
3291 v667 = PLAYER_SKILL_BOW; | |
3292 else assert(false && "Unknown spell"); | |
3293 | |
0 | 3294 LODWORD(v725) = v667; |
488 | 3295 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3296 v2 = v723; | |
3297 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3298 } |
488 | 3299 |
0 | 3300 if ( HIBYTE(v11) & 1 ) |
3301 { | |
3302 v731 = 4; | |
3303 } | |
3304 else | |
3305 { | |
3306 if ( (v11 & 0x80u) == 0 ) | |
3307 { | |
3308 v731 = ((v11 & 0x40) != 0) + 1; | |
3309 } | |
3310 else | |
3311 { | |
3312 v731 = 3; | |
3313 } | |
3314 } | |
488 | 3315 |
3316 if (v3->forced_spell_skill_level) | |
486 | 3317 uRequiredMana = 0; |
488 | 3318 else |
822 | 3319 uRequiredMana = pSpellDatas[v3->spellnum].mana_per_skill[v731 - 1]; |
3320 sRecoveryTime = pSpellDatas[v3->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3321 |
3322 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3323 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3324 uRequiredMana = 0; |
488 | 3325 |
3326 if (v3->spellnum >= PLAYER_SKILL_BOW || pPlayer->sMana >= uRequiredMana) | |
0 | 3327 break; |
488 | 3328 |
3329 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
486 | 3330 v3->spellnum = 0; |
0 | 3331 LABEL_1166: |
3332 ++n; | |
3333 if ( n >= 10 ) | |
3334 return; | |
3335 } | |
488 | 3336 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3337 v730 = v3->spellnum; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3338 if (pPlayer->Cursed() && v3->spellnum < SPELL_BOW_ARROW) |
488 | 3339 if (rand() % 100 < 50) |
3340 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3341 if (!pParty->bTurnBasedModeOn) |
488 | 3342 { |
3343 //v646 = pPlayer; | |
3344 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3345 //v647 = n; | |
3346 } | |
3347 else | |
3348 { | |
3349 //v647 = n; | |
3350 //v646 = pPlayer; | |
3351 //v648 = sRecoveryTime; | |
3352 //v649 = pPlayer; | |
3353 pParty->pTurnBasedPlayerRecoveryTimes[v711[n].uPlayerID] = 100; | |
3354 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3355 pTurnEngine->_40471C(); | |
3356 } | |
3357 | |
3358 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3359 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3360 v711[n].spellnum = 0; | |
3361 pPlayer->sMana -= uRequiredMana; | |
3362 return; | |
3363 } | |
3364 | |
0 | 3365 switch ( v3->spellnum ) |
3366 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3367 case SPELL_101: |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3368 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); |
488 | 3369 case SPELL_BOW_ARROW: |
0 | 3370 v17 = pPlayer; |
3371 _this = (ItemGen *)1; | |
488 | 3372 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) |
0 | 3373 _this = (ItemGen *)2; |
816 | 3374 sRecoveryTime = v17->GetAttackRecoveryTime(true); |
0 | 3375 a1.stru_24.Reset(); |
822 | 3376 a1.spell_level = v2; |
3377 a1.spell_id = v3->spellnum; | |
3378 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3379 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3380 if ( v17->WearsItem(510, 2) ) |
3381 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3382 a1.vPosition.x = pParty->vPosition.x; | |
3383 a1.vPosition.y = pParty->vPosition.y; | |
3384 a1.uAttributes = 0; | |
3385 a1.uSpriteFrameID = 0; | |
3386 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
823 | 3387 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3388 a1.spell_target_pid = a2; | |
0 | 3389 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3390 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3391 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3392 v20 = (char *)&pParty->pPlayers[v3->uPlayerID]; |
3393 memcpy(&a1.stru_24, &v20[36 * *((int *)v20 + 1620) + 496], sizeof(a1.stru_24)); | |
3394 a1.uAttributes = 256; | |
3395 if ( pParty->bTurnBasedModeOn == 1 ) | |
3396 a1.uAttributes = 260; | |
3397 for ( i = 0; i < (signed int)this; ++i ) | |
3398 { | |
3399 if ( i ) | |
3400 a1.vPosition.z += 32; | |
3401 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3402 if ( a1.Create( | |
3403 v715.uYawAngle, | |
3404 v715.uPitchAngle, | |
3405 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3406 v3->uPlayerID + 1) != -1 | |
3407 && pParty->bTurnBasedModeOn == 1 ) | |
3408 ++pTurnEngine->field_1C; | |
3409 } | |
488 | 3410 goto play_sound_and_continue; |
3411 | |
490 | 3412 case SPELL_LASER_PROJECTILE: |
0 | 3413 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); |
3414 a1.stru_24.Reset(); | |
822 | 3415 a1.spell_id = v3->spellnum; |
3416 a1.spell_level = v723; | |
3417 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3418 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3419 a1.vPosition.x = pParty->vPosition.x; |
3420 a1.vPosition.y = pParty->vPosition.y; | |
3421 a1.uAttributes = 0; | |
3422 a1.uSpriteFrameID = 0; | |
3423 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
823 | 3424 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3425 a1.spell_target_pid = a2; | |
0 | 3426 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3427 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3428 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3429 memcpy( |
3430 &a1.stru_24, | |
3431 &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3432 * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand | |
3433 + 5], | |
3434 sizeof(a1.stru_24)); | |
3435 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); | |
3436 HIBYTE(a1.uAttributes) |= 1u; | |
3437 a1.uSectorID = v23; | |
3438 if ( pParty->bTurnBasedModeOn == 1 ) | |
3439 LOBYTE(a1.uAttributes) |= 4u; | |
3440 if ( a1.Create( | |
3441 v715.uYawAngle, | |
3442 v715.uPitchAngle, | |
3443 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3444 v3->uPlayerID + 1) != -1 | |
3445 && pParty->bTurnBasedModeOn == 1 ) | |
3446 ++pTurnEngine->field_1C; | |
488 | 3447 goto play_sound_and_continue; |
3448 | |
3449 case SPELL_FIRE_TORCH_LIGHT: | |
0 | 3450 LODWORD(v733) = 3600 * v2; |
488 | 3451 |
822 | 3452 switch (v731) |
488 | 3453 { |
3454 case 1: amount = 2; break; | |
3455 case 2: amount = 3; break; | |
3456 case 3: | |
3457 case 4: amount = 4; break; | |
3458 default: | |
3459 assert(false); | |
3460 } | |
3461 | |
0 | 3462 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3463 goto play_sound_and_continue; |
3464 | |
3465 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3466 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3467 goto play_sound_and_continue; |
488 | 3468 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3469 case SPELL_FIRE_FIRE_SPIKE: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3470 { |
822 | 3471 v29 = v731 - 2; |
0 | 3472 if ( v29 ) |
3473 { | |
3474 v30 = v29 - 1; | |
3475 if ( v30 ) | |
3476 { | |
3477 if ( v30 == 1 ) | |
3478 amount = 9; | |
3479 else | |
3480 amount = 3; | |
3481 } | |
3482 else | |
3483 { | |
3484 amount = 7; | |
3485 } | |
3486 } | |
3487 else | |
3488 { | |
3489 amount = 5; | |
3490 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3491 //v31 = v3->uPlayerID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3492 //v32 = 8 * v31; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3493 //LOBYTE(v32) = v32 | OBJECT_Player; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3494 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3495 //if ( (signed int)uNumSpriteObjects > 0 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3496 int _v733 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3497 for (uint i = 0; i < uNumSpriteObjects; ++i) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3498 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3499 auto object = pSpriteObjects + i; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3500 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, v3->uPlayerID)) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3501 ++_v733; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3502 /*v33 = (char *)&pSpriteObjects[0].field_48; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3503 v730 = uNumSpriteObjects; |
0 | 3504 do |
3505 { | |
486 | 3506 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) |
0 | 3507 ++HIDWORD(v733); |
3508 v33 += 112; | |
3509 --v730; | |
3510 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3511 while ( v730 );*/ |
0 | 3512 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3513 if (_v733 > amount) |
710 | 3514 { |
3515 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3516 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3517 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3518 goto LABEL_1166; |
710 | 3519 } |
0 | 3520 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3521 goto play_sound_and_continue; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3522 |
0 | 3523 a1.stru_24.Reset(); |
822 | 3524 a1.spell_id = v3->spellnum; |
3525 a1.spell_level = v2; | |
3526 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3527 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3528 a1.vPosition.y = pParty->vPosition.y; |
3529 a1.vPosition.x = pParty->vPosition.x; | |
486 | 3530 a1.uAttributes = 0; |
0 | 3531 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3532 a1.uSectorID = pIndoor->GetSector( | |
3533 pParty->vPosition.x, | |
3534 pParty->vPosition.y, | |
3535 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 3536 a1.uSpriteFrameID = 0; |
823 | 3537 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3538 a1.spell_target_pid = a2; | |
0 | 3539 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3540 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3541 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3542 if ( pParty->bTurnBasedModeOn == 1 ) |
3543 LOBYTE(a1.uAttributes) |= 4u; | |
3544 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3545 if ( a1.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3546 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3547 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3548 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3549 } |
710 | 3550 |
0 | 3551 case 20: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3552 { |
0 | 3553 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3554 goto play_sound_and_continue; |
486 | 3555 if (!a2) |
710 | 3556 { |
3557 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3558 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3559 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3560 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3561 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3562 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3563 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3564 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3565 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3566 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3567 v697.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3568 v697.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3569 v697.z = 0; |
0 | 3570 a1.stru_24.Reset(); |
822 | 3571 a1.spell_id = v3->spellnum; |
3572 a1.spell_level = v2; | |
3573 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3574 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 3575 a1.uAttributes = 0; |
3576 a1.uSectorID = 0; | |
3577 a1.uSpriteFrameID = 0; | |
0 | 3578 a1.field_60_distance_related_prolly_lod = 0; |
486 | 3579 a1.uFacing = 0; |
823 | 3580 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3581 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3582 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3583 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3584 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3585 a1.spell_target_pid = PID(OBJECT_Actor, a2 >> 3); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3586 auto obj_id = a1.Create(0, 0, 0, 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3587 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3588 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3589 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3590 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3591 |
0 | 3592 case 44: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3593 { |
0 | 3594 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3595 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3596 |
90 | 3597 if ( !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u) ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3598 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3599 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3600 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3601 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3602 pActors[a2 >> 3].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3603 v704.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3604 v704.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3605 v704.z = 0; |
0 | 3606 a1.stru_24.Reset(); |
822 | 3607 a1.spell_id = v3->spellnum; |
3608 a1.spell_level = v2; | |
3609 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3610 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 3611 a1.uAttributes = 0; |
3612 a1.uSectorID = 0; | |
3613 a1.uSpriteFrameID = 0; | |
0 | 3614 a1.field_60_distance_related_prolly_lod = 0; |
486 | 3615 a1.uFacing = 0; |
823 | 3616 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3617 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3618 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3619 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3620 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
823 | 3621 a1.spell_target_pid = PID(OBJECT_Actor, (int)v726); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3622 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3623 auto obj_id = a1.Create(0, 0, 0, 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3624 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3625 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3626 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3627 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3628 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3629 |
0 | 3630 case 79: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3631 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3632 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3633 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3634 //v730 = a2 >> 3; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3635 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3636 v691.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3637 v691.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3638 v691.z = 0; |
0 | 3639 a1.stru_24.Reset(); |
822 | 3640 a1.spell_id = v3->spellnum; |
3641 a1.spell_level = v2; | |
3642 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3643 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3644 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3645 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3646 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
486 | 3647 a1.uAttributes = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3648 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); |
486 | 3649 a1.uSpriteFrameID = 0; |
823 | 3650 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3651 a1.spell_target_pid = a2; | |
0 | 3652 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3653 a1.uFacing = LOWORD(v715.uYawAngle); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3654 a1.uAttributes |= 0x80u; |
823 | 3655 a1.uSoundID = LOWORD(v3->sound_id); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3656 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3657 auto obj_id = a1.Create(0, 0, 0, 0); |
0 | 3658 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
710 | 3659 { |
3660 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3661 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3662 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3663 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3664 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3665 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3666 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3667 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3668 } |
822 | 3669 |
3670 | |
573 | 3671 case SPELL_FIRE_FIRE_BOLT: |
822 | 3672 case SPELL_FIRE_FIREBALL: |
3673 case SPELL_FIRE_INCINERATE: | |
3674 case SPELL_AIR_LIGHNING_BOLT: | |
3675 case SPELL_WATER_ICE_BOLT: | |
3676 case SPELL_WATER_ICE_BLAST: | |
3677 case SPELL_EARTH_STUN: | |
3678 case SPELL_EARTH_DEADLY_SWARM: | |
3679 case SPELL_MIND_MIND_BLAST: | |
3680 case SPELL_MIND_PSYCHIC_SHOCK: | |
3681 case SPELL_BODY_HARM: | |
3682 case SPELL_LIGHT_LIGHT_BOLT: | |
3683 case SPELL_DARK_DRAGON_BREATH: | |
0 | 3684 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3685 goto play_sound_and_continue; |
0 | 3686 a1.stru_24.Reset(); |
822 | 3687 a1.spell_id = v3->spellnum; |
3688 a1.spell_level = v2; | |
3689 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3690 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3691 a1.vPosition.y = pParty->vPosition.y; |
3692 a1.vPosition.x = pParty->vPosition.x; | |
486 | 3693 a1.uAttributes = 0; |
0 | 3694 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
822 | 3695 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3696 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, | |
3697 pParty->vPosition.y, | |
3698 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3699 else a1.uSectorID = 0; | |
3700 | |
486 | 3701 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3702 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 3703 a1.spell_target_pid = a2; |
0 | 3704 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3705 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3706 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3707 if ( pParty->bTurnBasedModeOn == 1 ) |
3708 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3709 if ( v3->spellnum == SPELL_AIR_LIGHNING_BOLT ) |
0 | 3710 LOBYTE(a1.uAttributes) |= 0x40u; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3711 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3712 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3713 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3714 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3715 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3716 goto play_sound_and_continue; |
822 | 3717 |
3718 | |
3719 | |
0 | 3720 case 29: |
3721 case 39: | |
3722 case 76: | |
3723 case 90: | |
3724 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3725 goto play_sound_and_continue; |
0 | 3726 a1.stru_24.Reset(); |
822 | 3727 a1.spell_id = v3->spellnum; |
3728 a1.spell_level = v2; | |
3729 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3730 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3731 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3732 a1.vPosition.y = pParty->vPosition.y; | |
3733 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3734 v660 = pParty->vPosition.y; | |
3735 goto LABEL_153; | |
3736 case 87: | |
3737 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | |
3738 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) | |
710 | 3739 { |
3740 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3741 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3742 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3743 goto LABEL_1166; |
710 | 3744 } |
0 | 3745 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
3746 goto LABEL_152; | |
488 | 3747 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3748 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3749 |
0 | 3750 case 81: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3751 { |
0 | 3752 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3753 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3754 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3755 if (PID_TYPE(a2) != OBJECT_Actor || |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3756 (v730 = PID_ID(a2), |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3757 v721 = (int)&pActors[PID_ID(a2)], |
0 | 3758 !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 9u)) ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3759 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3760 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3761 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3762 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3763 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); |
0 | 3764 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); |
3765 v55 = v721; | |
486 | 3766 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); |
0 | 3767 *(char *)(v55 + 38) |= 8u; |
486 | 3768 *(short *)(v55 + 148) = 0; |
3769 v672 = 0; | |
3770 *(short *)(v55 + 150) = 0; | |
0 | 3771 v661 = (Actor *)v55; |
3772 goto LABEL_165; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3773 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3774 |
0 | 3775 case 35: |
822 | 3776 if ( v731 == 2 ) |
0 | 3777 { |
3778 v57 = 300 * v2; | |
3779 } | |
3780 else | |
3781 { | |
822 | 3782 if ( v731 == 3 ) |
0 | 3783 { |
3784 amount = 4; | |
3785 v57 = 300 * v2; | |
3786 goto LABEL_174; | |
3787 } | |
822 | 3788 if ( v731 == 4 ) |
0 | 3789 { |
3790 v57 = 300 * v2; | |
3791 amount = 8; | |
3792 goto LABEL_174; | |
3793 } | |
3794 v57 = 180 * v2; | |
3795 } | |
3796 amount = 2; | |
3797 LABEL_174: | |
3798 LODWORD(v733) = v57; | |
3799 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3800 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3801 if (PID_TYPE(a2) != OBJECT_Actor |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3802 || (v721 = 836 * PID_ID(a2), |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3803 LODWORD(v718) = (int)&pActors[PID_ID(a2)], |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3804 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3805 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3806 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3807 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3808 } |
0 | 3809 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); |
3810 v59 = v721; | |
112 | 3811 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3812 pActors[a2 >> 3].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, |
0 | 3813 v731, |
3814 amount, | |
486 | 3815 0, |
3816 0); | |
0 | 3817 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
486 | 3818 v672 = 0; |
0 | 3819 v661 = (Actor *)LODWORD(v718); |
3820 goto LABEL_165; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3821 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3822 |
0 | 3823 case 60: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3824 { |
0 | 3825 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3826 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3827 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3828 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3829 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3830 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3831 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3832 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3833 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3834 uint power = 300 * v2; |
0 | 3835 if ( v731 == 2 ) |
3836 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3837 power = 600 * v2; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3838 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3839 else if ( v731 == 3 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3840 power = 29030400; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3841 |
112 | 3842 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3843 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
112 | 3844 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3845 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); |
112 | 3846 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3847 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), |
486 | 3848 v731, 0, 0, 0); |
0 | 3849 a1.stru_24.Reset(); |
822 | 3850 a1.spell_id = v3->spellnum; |
3851 a1.spell_level = v2; | |
3852 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3853 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
90 | 3854 v61 = a2 >> 3; |
0 | 3855 goto LABEL_1086; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3856 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3857 |
0 | 3858 case 92: |
3859 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3860 goto play_sound_and_continue; |
0 | 3861 a1.stru_24.Reset(); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3862 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3863 a1.vPosition.x = pParty->vPosition.x; |
3864 a1.vPosition.y = pParty->vPosition.y; | |
486 | 3865 a1.uAttributes = 0; |
0 | 3866 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3867 a1.uSectorID = pIndoor->GetSector( | |
3868 pParty->vPosition.x, | |
3869 pParty->vPosition.y, | |
3870 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 3871 a1.uSpriteFrameID = 0; |
823 | 3872 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3873 a1.spell_target_pid = a2; | |
0 | 3874 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3875 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3876 a1.uSoundID = LOWORD(v3->sound_id); |
822 | 3877 a1.spell_skill = v731; |
3878 a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3879 a1.spell_level = 300 * v2; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3880 if ( pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3881 LOBYTE(a1.uAttributes) |= 4u; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3882 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3883 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3884 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3885 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3886 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3887 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3888 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3889 |
0 | 3890 case 4: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3891 { |
822 | 3892 v63 = v731 - 1; |
0 | 3893 if ( !v63 ) |
3894 { | |
3895 amount = 10; | |
3896 goto LABEL_195; | |
3897 } | |
3898 v64 = v63 - 1; | |
3899 if ( !v64 ) | |
3900 { | |
3901 amount = 11; | |
3902 goto LABEL_195; | |
3903 } | |
3904 v65 = v64 - 1; | |
3905 if ( !v65 ) | |
3906 { | |
3907 amount = 12; | |
3908 LABEL_195: | |
3909 LODWORD(v733) = 3600 * v2; | |
3910 goto LABEL_196; | |
3911 } | |
3912 if ( v65 == 1 ) | |
3913 { | |
486 | 3914 LODWORD(v733) = 0; |
0 | 3915 amount = 12; |
3916 } | |
3917 LABEL_196: | |
3918 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3919 goto play_sound_and_continue; |
89 | 3920 v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3921 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
89 | 3922 v730c->UpdateTempBonus(pParty->uTimePlayed); |
3923 if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) | |
3924 { | |
315 | 3925 if (!v730c->Broken()) |
0 | 3926 { |
486 | 3927 if (!v730c->uSpecEnchantmentType) |
0 | 3928 { |
570 | 3929 if (!v730c->uEnchantmentType) |
0 | 3930 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3931 v68 = _itm->uEquipType; |
0 | 3932 if ( !v68 || v68 == 1 || v68 == 2 ) |
3933 { | |
377 | 3934 if ( !pItemsTable->IsMaterialNonCommon(v730c) ) |
0 | 3935 { |
89 | 3936 v69 = v730c; |
0 | 3937 v14 = v731 == 4; |
3938 *(int *)(v730 + 12) = amount; | |
3939 if ( !v14 ) | |
3940 { | |
3941 *(_QWORD *)(v69 + 28) = pParty->uTimePlayed | |
3942 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3943 * 0.033333335); | |
3944 *(int *)(v69 + 20) |= 8u; | |
3945 } | |
3946 *(int *)(v69 + 20) |= 0x10u; | |
3947 dword_50C9A8 = 256; | |
3948 LODWORD(v727) = 1; | |
488 | 3949 play_sound_and_continue: |
0 | 3950 if ( v3->field_8 & 0x20 ) |
3951 { | |
3952 if ( v727 != 0.0 ) | |
3953 pAudioPlayer->PlaySound( | |
3954 (SoundID)word_4EE088_sound_ids[v3->spellnum], | |
3955 0, | |
3956 0, | |
3957 -1, | |
3958 0, | |
823 | 3959 v3->sound_id, |
0 | 3960 0, |
3961 0); | |
3962 } | |
3963 else | |
3964 { | |
3965 if ( sRecoveryTime < 0 ) | |
3966 sRecoveryTime = 0; | |
3967 if ( pParty->bTurnBasedModeOn ) | |
3968 { | |
3969 v645 = sRecoveryTime; | |
3970 pParty->pTurnBasedPlayerRecoveryTimes[v3->uPlayerID] = sRecoveryTime; | |
3971 pPlayer->SetRecoveryTime(v645); | |
3972 if ( !some_active_character ) | |
3973 pTurnEngine->_40471C(); | |
3974 } | |
3975 else | |
3976 { | |
3977 pPlayer->SetRecoveryTime( | |
3978 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
3979 } | |
3980 if ( v727 != 0.0 ) | |
3981 { | |
187 | 3982 pPlayer->PlaySound(SPEECH_49, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3983 if ( v727 != 0.0 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3984 pAudioPlayer->PlaySound( |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3985 (SoundID)word_4EE088_sound_ids[v3->spellnum], |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3986 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3987 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3988 -1, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3989 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3990 v3->sound_id, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3991 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3992 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3993 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3994 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3995 v2 = v723; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3996 goto LABEL_1166; |
0 | 3997 } |
3998 } | |
3999 v3->spellnum = 0; | |
4000 v2 = v723; | |
4001 goto LABEL_1166; | |
4002 } | |
4003 } | |
4004 } | |
4005 } | |
4006 } | |
4007 } | |
710 | 4008 |
0 | 4009 dword_50C9D0 = 113; |
486 | 4010 dword_50C9D4 = 0; |
0 | 4011 dword_50C9D8 = 1; |
710 | 4012 |
4013 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
486 | 4014 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4015 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4016 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4017 } |
488 | 4018 |
4019 case SPELL_BODY_REGENERATION: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4020 { |
822 | 4021 v70 = v731 - 1; |
0 | 4022 LODWORD(v733) = 3600 * v2; |
4023 if ( v70 && (v71 = v70 - 1) != 0 ) | |
4024 { | |
4025 v72 = v71 - 1; | |
4026 if ( v72 ) | |
4027 { | |
4028 if ( v72 == 1 ) | |
4029 amount = 10; | |
4030 } | |
4031 else | |
4032 { | |
4033 amount = 3; | |
4034 } | |
4035 } | |
4036 else | |
4037 { | |
4038 amount = 1; | |
4039 } | |
4040 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4041 goto play_sound_and_continue; |
4042 | |
4043 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
4044 | |
4045 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4046 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4047 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4048 } |
488 | 4049 |
4050 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4051 case SPELL_AIR_PROTECTION_FROM_AIR: | |
4052 case SPELL_WATER_PROTECTION_FROM_WATER: | |
4053 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4054 case SPELL_MIND_PROTECTION_FROM_MIND: | |
4055 case SPELL_BODY_PROTECTION_FROM_BODY: | |
822 | 4056 v76 = v731 - 1; |
0 | 4057 LODWORD(v733) = 3600 * v2; |
4058 if ( v76 ) | |
4059 { | |
4060 v77 = v76 - 1; | |
4061 if ( v77 ) | |
4062 { | |
4063 v78 = v77 - 1; | |
4064 if ( v78 ) | |
4065 { | |
4066 if ( v78 != 1 ) | |
4067 goto LABEL_232; | |
4068 v79 = 4 * v2; | |
4069 } | |
4070 else | |
4071 { | |
4072 v79 = 3 * v2; | |
4073 } | |
4074 } | |
4075 else | |
4076 { | |
4077 v79 = 2 * v2; | |
4078 } | |
4079 amount = v79; | |
4080 } | |
4081 else | |
4082 { | |
4083 amount = v2; | |
4084 } | |
4085 LABEL_232: | |
488 | 4086 //v80 = v3->spellnum; |
4087 switch (v3->spellnum) | |
4088 { | |
4089 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4090 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
0 | 4091 break; |
488 | 4092 case SPELL_AIR_PROTECTION_FROM_AIR: |
4093 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
0 | 4094 break; |
488 | 4095 case SPELL_WATER_PROTECTION_FROM_WATER: |
4096 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
4097 break; | |
4098 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4099 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
0 | 4100 break; |
488 | 4101 case SPELL_MIND_PROTECTION_FROM_MIND: |
4102 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
0 | 4103 break; |
488 | 4104 case SPELL_BODY_PROTECTION_FROM_BODY: |
4105 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
0 | 4106 break; |
4107 default: | |
488 | 4108 assert(false); |
4109 goto LABEL_1166; | |
0 | 4110 } |
4111 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4112 goto play_sound_and_continue; |
4113 | |
4114 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4115 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4116 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4117 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4118 | |
0 | 4119 v90 = (double)(signed int)v733 * 4.2666669; |
488 | 4120 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4121 LODWORD(v727) = 1; |
488 | 4122 goto play_sound_and_continue; |
4123 | |
4124 case SPELL_FIRE_HASTE: | |
822 | 4125 if ( v731 <= 0 ) |
0 | 4126 goto LABEL_254; |
822 | 4127 if ( v731 <= 2 ) |
0 | 4128 { |
4129 v91 = 60 * (v2 + 60); | |
4130 } | |
4131 else | |
4132 { | |
822 | 4133 if ( v731 == 3 ) |
0 | 4134 { |
4135 v91 = 180 * (v2 + 20); | |
4136 } | |
4137 else | |
4138 { | |
822 | 4139 if ( v731 != 4 ) |
0 | 4140 goto LABEL_254; |
4141 v91 = 240 * (v2 + 15); | |
4142 } | |
4143 } | |
4144 LODWORD(v733) = v91; | |
4145 LABEL_254: | |
4146 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4147 { | |
89 | 4148 v92 = pParty->pPlayers;//[0].pConditions[1]; |
0 | 4149 LODWORD(v727) = 1; |
4150 do | |
4151 { | |
89 | 4152 if ( v92->pConditions ) |
486 | 4153 LODWORD(v727) = 0; |
89 | 4154 ++v92; |
0 | 4155 } |
89 | 4156 while ( v92 <= &pParty->pPlayers[3] ); |
486 | 4157 if (LODWORD(v727)) |
0 | 4158 { |
488 | 4159 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4160 | |
4161 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4162 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4163 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4164 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
0 | 4165 } |
4166 } | |
488 | 4167 goto play_sound_and_continue; |
4168 | |
4169 case SPELL_SPIRIT_BLESS: | |
822 | 4170 v101 = v731 - 1; |
0 | 4171 if ( v101 && (v102 = v101 - 1) != 0 ) |
4172 { | |
4173 v103 = v102 - 1; | |
4174 if ( v103 ) | |
4175 { | |
4176 if ( v103 != 1 ) | |
4177 goto LABEL_269; | |
4178 v104 = 3600 * (v2 + 1); | |
4179 } | |
4180 else | |
4181 { | |
4182 v104 = 900 * (v2 + 4); | |
4183 } | |
4184 } | |
4185 else | |
4186 { | |
4187 v104 = 300 * (v2 + 12); | |
4188 } | |
4189 LODWORD(v733) = v104; | |
4190 LABEL_269: | |
4191 amount = v2 + 5; | |
4192 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4193 goto play_sound_and_continue; |
0 | 4194 if ( v731 == 1 ) |
4195 { | |
4196 v108 = v3->uPlayerID_2; | |
4197 v109 = v3->spellnum; | |
4198 v110 = pGame->GetStru6(); | |
4199 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
486 | 4200 v111 = pOtherOverlayList->_4418B1(10000, v3->uPlayerID_2 + 310, 0, 65536); |
488 | 4201 //v668 = 0; |
0 | 4202 v716 = v111; |
488 | 4203 //v658 = v111; |
4204 //v653 = amount; | |
4205 //v651 = 1; | |
4206 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4207 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
4208 //LABEL_103: | |
4209 //HIDWORD(v650) = HIDWORD(v28); | |
4210 //LABEL_104: | |
4211 //LODWORD(v650) = v28; | |
4212 pParty->pPlayers[v3->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); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4213 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4214 goto play_sound_and_continue; |
0 | 4215 } |
4216 v105 = 0; | |
4217 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
89 | 4218 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; |
0 | 4219 do |
4220 { | |
488 | 4221 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v105); |
486 | 4222 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4223 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
89 | 4224 ++v730b; |
0 | 4225 ++v105; |
4226 } | |
89 | 4227 while ( v730b <= &pParty->pPlayers[3] ); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4228 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4229 goto play_sound_and_continue; |
488 | 4230 |
0 | 4231 case 52: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4232 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4233 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4234 //v730 = a2 >> 3; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4235 v112 = &pActors[PID_ID(a2)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4236 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); |
0 | 4237 v721 = abs(v112->vPosition.y - pParty->vPosition.y); |
4238 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4239 _this = (ItemGen *)v113; | |
4240 v114 = v721; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4241 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); |
0 | 4242 if ( v113 < v721 ) |
4243 { | |
4244 v116 = v113; | |
4245 v113 = v721; | |
4246 v114 = v116; | |
4247 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4248 if ( v113 < (signed int)v115 ) |
0 | 4249 { |
4250 v117 = v113; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4251 v113 = (int)v115; |
0 | 4252 v115 = v117; |
4253 } | |
4254 if ( v114 < (signed int)v115 ) | |
4255 { | |
4256 v118 = v115; | |
4257 v115 = v114; | |
4258 v114 = v118; | |
4259 } | |
4260 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4261 if ( (double)(signed int)this <= 307.2 ) | |
4262 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4263 v701.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4264 v701.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4265 v701.z = 0; |
0 | 4266 a1.stru_24.Reset(); |
4267 v119 = HIDWORD(v733); | |
822 | 4268 a1.spell_id = *(int *)HIDWORD(v733); |
4269 a1.spell_level = v723; | |
4270 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4271 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4272 a1.uAttributes = 0; |
4273 a1.uSectorID = 0; | |
4274 a1.uSpriteFrameID = 0; | |
4275 a1.field_60_distance_related_prolly_lod = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4276 a1.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); |
0 | 4277 a1.uFacing = 0; |
4278 a1.uSoundID = *(short *)(v119 + 16); | |
4279 a1.vPosition.x = v112->vPosition.x; | |
4280 a1.vPosition.y = v112->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4281 a1.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4282 a1.spell_target_pid = PID(OBJECT_Actor, a2); |
0 | 4283 v122 = a1.Create(0, 0, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4284 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
0 | 4285 LODWORD(v727) = 1; |
4286 } | |
4287 else | |
4288 { | |
4289 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4290 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4291 *(int *)HIDWORD(v733) = 0; | |
4292 } | |
4293 v3 = (stru277 *)HIDWORD(v733); | |
4294 } | |
488 | 4295 goto play_sound_and_continue; |
4296 | |
4297 case SPELL_AIR_SHIELD: | |
4298 case SPELL_EARTH_STONESKIN: | |
4299 case SPELL_SPIRIT_HEROISM: | |
822 | 4300 v123 = v731 - 1; |
0 | 4301 if ( v123 && (v124 = v123 - 1) != 0 ) |
4302 { | |
4303 v125 = v124 - 1; | |
4304 if ( v125 ) | |
4305 { | |
4306 if ( v125 != 1 ) | |
4307 goto LABEL_296; | |
4308 v126 = 3600 * (v2 + 1); | |
4309 } | |
4310 else | |
4311 { | |
4312 v126 = 900 * (v2 + 4); | |
4313 } | |
4314 } | |
4315 else | |
4316 { | |
4317 v126 = 300 * (v2 + 12); | |
4318 } | |
4319 LODWORD(v733) = v126; | |
4320 LABEL_296: | |
4321 v127 = v3->spellnum; | |
4322 if ( v127 == 17 ) | |
4323 { | |
486 | 4324 amount = 0; |
0 | 4325 LODWORD(v725) = 14; |
4326 } | |
4327 else | |
4328 { | |
4329 if ( v127 == 38 ) | |
4330 { | |
4331 LODWORD(v725) = 15; | |
4332 amount = v2 + 5; | |
4333 } | |
4334 else | |
4335 { | |
4336 if ( v127 != 51 ) | |
4337 goto LABEL_1166; | |
4338 LODWORD(v725) = 9; | |
4339 amount = v2 + 5; | |
4340 } | |
4341 } | |
4342 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4343 goto play_sound_and_continue; |
4344 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4345 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4346 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4347 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
0 | 4348 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
488 | 4349 //LABEL_304: |
4350 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4351 LODWORD(v727) = 1; |
488 | 4352 goto play_sound_and_continue; |
4353 | |
4354 case SPELL_FIRE_IMMOLATION: | |
822 | 4355 v138 = v731 - 2; |
0 | 4356 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) |
4357 v140 = 600 * v2; | |
4358 else | |
4359 v140 = 60 * v2; | |
4360 LODWORD(v733) = v140; | |
4361 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4362 goto play_sound_and_continue; |
4363 | |
4364 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4365 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4366 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4367 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4368 | |
4369 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4370 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4371 goto play_sound_and_continue; |
488 | 4372 |
0 | 4373 case 9: |
822 | 4374 v149 = v731 - 1; |
0 | 4375 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) |
4376 { | |
4377 if ( v151 == 1 ) | |
4378 _this = (ItemGen *)20; | |
4379 } | |
4380 else | |
4381 { | |
4382 _this = (ItemGen *)16; | |
4383 } | |
4384 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4385 { | |
710 | 4386 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4387 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4388 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4389 goto LABEL_1166; |
0 | 4390 } |
4391 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4392 goto play_sound_and_continue; |
0 | 4393 LODWORD(v725) = a2 & 7; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4394 if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4395 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4396 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4397 v153 = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4398 v154 = pActors[PID_ID(a2)].vPosition.z; |
0 | 4399 LODWORD(v727) = v153; |
4400 } | |
4401 else | |
4402 { | |
323 | 4403 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
0 | 4404 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); |
323 | 4405 v156 = stru_5C6E00->Sin(pParty->sRotationY); |
0 | 4406 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); |
4407 v154 = pParty->vPosition.z; | |
4408 } | |
4409 HIDWORD(v733) = v154; | |
4410 v713 = v154 + 2500; | |
486 | 4411 v721 = 0; |
4412 LODWORD(v718) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4413 if ( (signed int)_this > 0 ) |
0 | 4414 { |
4415 *(float *)&y = (double)SHIDWORD(v733); | |
4416 *(float *)&v732 = (double)v713; | |
4417 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4418 auto _this_cpy = (int)_this; |
0 | 4419 do |
4420 { | |
4421 v157 = rand(); | |
4422 v158 = (double)SLODWORD(v718); | |
4423 v718 = v158; | |
4424 v159 = (double)v721; | |
4425 *(float *)&v721 = v159; | |
4426 a2 = v157 % 1000; | |
4427 *((float *)&v733 + 1) = (double)(v157 % 1000) + *(float *)&y - *(float *)&v732; | |
4428 v725 = v159 * v159; | |
4429 *(float *)&_this = v158 * v158; | |
4430 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4431 { | |
486 | 4432 LODWORD(v687) = 0; |
4433 HIDWORD(v687) = 0; | |
0 | 4434 } |
4435 else | |
4436 { | |
4437 x = (signed __int64)sqrt(*(float *)&_this + v725); | |
4438 v687 = __PAIR__( | |
4439 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4440 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
4441 } | |
4442 a1.stru_24.Reset(); | |
822 | 4443 a1.spell_id = v3->spellnum; |
4444 a1.spell_level = v2; | |
4445 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4446 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 4447 a1.uAttributes = 0; |
0 | 4448 a1.vPosition.x = uRequiredMana; |
4449 a1.vPosition.y = LODWORD(v727); | |
486 | 4450 a1.uSectorID = 0; |
0 | 4451 a1.vPosition.z = a2 + v713; |
486 | 4452 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4453 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 4454 a1.spell_target_pid = v730; |
0 | 4455 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); |
4456 a1.uFacing = v687; | |
823 | 4457 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4458 if ( pParty->bTurnBasedModeOn == 1 ) |
4459 a1.uAttributes = 4; | |
4460 if ( a1.Create( | |
4461 v687, | |
4462 SHIDWORD(v687), | |
4463 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
486 | 4464 0) != -1 |
0 | 4465 && pParty->bTurnBasedModeOn == 1 ) |
4466 ++pTurnEngine->field_1C; | |
4467 LODWORD(v718) = rand() % 1024 - 512; | |
4468 v160 = rand(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4469 v14 = _this_cpy-- == 1; |
0 | 4470 v721 = (unsigned __int64)(v160 % 1024) - 512; |
4471 } | |
4472 while ( !v14 ); | |
4473 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4474 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4475 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4476 |
0 | 4477 case 10: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4478 { |
710 | 4479 //v67 = 2; |
0 | 4480 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
4481 { | |
710 | 4482 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! |
4483 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4484 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4485 goto LABEL_1166; |
0 | 4486 } |
4487 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4488 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4489 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
486 | 4490 v700.z = 0; |
4491 v700.y = 0; | |
4492 v700.x = 0; | |
0 | 4493 a1.stru_24.Reset(); |
822 | 4494 a1.spell_id = v3->spellnum; |
4495 a1.spell_level = v2; | |
4496 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4497 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 4498 a1.uAttributes = 0; |
4499 a1.uSectorID = 0; | |
4500 a1.uSpriteFrameID = 0; | |
0 | 4501 a1.field_60_distance_related_prolly_lod = 0; |
486 | 4502 a1.uFacing = 0; |
823 | 4503 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4504 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 4505 a2 = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4506 if ( (signed int)_v726 > 0 ) |
0 | 4507 { |
4508 do | |
4509 { | |
4510 v162 = dword_50BF30[a2]; | |
4511 a1.vPosition.x = pActors[v162].vPosition.x; | |
4512 a1.vPosition.y = pActors[v162].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4513 a1.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4514 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 4515 v164 = a1.Create(0, 0, 0, 0); |
0 | 4516 v165 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4517 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); |
488 | 4518 pGame->GetStru6()->_4A81CA(&a1); |
4519 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
0 | 4520 a2 = v165 + 1; |
4521 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4522 while ( v165 + 1 < (signed int)_v726 ); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4523 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4524 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4525 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4526 } |
488 | 4527 |
4528 case SPELL_AIR_WIZARD_EYE: | |
0 | 4529 LODWORD(v733) = 3600 * v2; |
4530 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4531 goto play_sound_and_continue; |
0 | 4532 v168 = 0; |
4533 do | |
4534 { | |
486 | 4535 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
0 | 4536 v716 = v169; |
4537 } | |
4538 while ( v168 < 4 ); | |
488 | 4539 |
4540 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4541 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4542 goto play_sound_and_continue; |
488 | 4543 |
4544 case SPELL_AIR_FEATHER_FALL: | |
822 | 4545 v170 = v731 - 1; |
0 | 4546 if ( !v170 ) |
4547 { | |
4548 v173 = 300 * v2; | |
4549 goto LABEL_353; | |
4550 } | |
4551 v171 = v170 - 1; | |
4552 if ( !v171 ) | |
4553 { | |
4554 v173 = 600 * v2; | |
4555 goto LABEL_353; | |
4556 } | |
4557 v172 = v171 - 1; | |
4558 if ( !v172 || v172 == 1 ) | |
4559 { | |
4560 v173 = 3600 * v2; | |
4561 LABEL_353: | |
4562 LODWORD(v733) = v173; | |
4563 } | |
4564 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4565 goto play_sound_and_continue; |
0 | 4566 v174 = 0; |
4567 do | |
486 | 4568 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
0 | 4569 while ( v174 < 4 ); |
488 | 4570 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
4571 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4572 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4573 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4574 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4575 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); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4576 LODWORD(v727) = 1; |
488 | 4577 goto play_sound_and_continue; |
4578 | |
4579 case SPELL_AIR_SPARKS: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4580 { |
822 | 4581 v184 = v731 - 1; |
0 | 4582 if ( v184 ) |
4583 { | |
4584 v185 = v184 - 1; | |
4585 if ( v185 ) | |
4586 { | |
4587 v186 = v185 - 1; | |
4588 if ( v186 ) | |
4589 { | |
4590 if ( v186 == 1 ) | |
4591 amount = 9; | |
4592 } | |
4593 else | |
4594 { | |
4595 amount = 7; | |
4596 } | |
4597 } | |
4598 else | |
4599 { | |
4600 amount = 5; | |
4601 } | |
4602 } | |
4603 else | |
4604 { | |
4605 amount = 3; | |
4606 } | |
4607 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4608 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4609 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
0 | 4610 a1.stru_24.Reset(); |
822 | 4611 a1.spell_id = v3->spellnum; |
4612 a1.spell_level = v2; | |
4613 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4614 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4615 a1.vPosition.y = pParty->vPosition.y; |
4616 a1.vPosition.x = pParty->vPosition.x; | |
486 | 4617 a1.uAttributes = 0; |
0 | 4618 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4619 a1.uSectorID = pIndoor->GetSector( | |
4620 pParty->vPosition.x, | |
4621 pParty->vPosition.y, | |
4622 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 4623 a1.uSpriteFrameID = 0; |
823 | 4624 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4625 a1.spell_target_pid = a2; | |
0 | 4626 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
823 | 4627 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4628 if ( pParty->bTurnBasedModeOn == 1 ) |
4629 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4630 v188 = (signed int)_v726 / -2; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4631 v189 = (signed int)_v726 / 2; |
0 | 4632 while ( v188 <= v189 ) |
4633 { | |
4634 a1.uFacing = v188 + LOWORD(v715.uYawAngle); | |
4635 if ( a1.Create( | |
4636 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
4637 v715.uPitchAngle, | |
4638 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4639 v3->uPlayerID + 1) != -1 | |
4640 && pParty->bTurnBasedModeOn == 1 ) | |
4641 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4642 v188 += _v726 / (amount - 1); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4643 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4644 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4645 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4646 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4647 |
0 | 4648 case 16: |
569 | 4649 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) |
4650 { | |
710 | 4651 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! |
4652 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4653 goto play_sound_and_continue; | |
0 | 4654 } |
4655 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4656 goto play_sound_and_continue; |
0 | 4657 v191 = 0; |
4658 do | |
486 | 4659 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
0 | 4660 while ( v191 < 4 ); |
4661 BYTE1(pParty->uFlags) |= 1u; | |
4662 pParty->uFallSpeed = 1000; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4663 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4664 goto play_sound_and_continue; |
488 | 4665 |
4666 case SPELL_AIR_INVISIBILITY: | |
822 | 4667 v192 = v731 - 1; |
0 | 4668 if ( !v192 ) |
4669 { | |
4670 amount = v2; | |
4671 goto LABEL_391; | |
4672 } | |
4673 v193 = v192 - 1; | |
4674 if ( !v193 ) | |
4675 { | |
4676 v196 = 2 * v2; | |
4677 LABEL_389: | |
4678 amount = v196; | |
4679 LABEL_391: | |
4680 v195 = 600 * v2; | |
4681 goto LABEL_392; | |
4682 } | |
4683 v194 = v193 - 1; | |
4684 if ( !v194 ) | |
4685 { | |
4686 v196 = 3 * v2; | |
4687 goto LABEL_389; | |
4688 } | |
4689 if ( v194 != 1 ) | |
4690 goto LABEL_393; | |
4691 amount = 4 * v2; | |
4692 v195 = 3600 * v2; | |
4693 LABEL_392: | |
4694 LODWORD(v733) = v195; | |
4695 LABEL_393: | |
710 | 4696 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
4697 { | |
4698 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | |
4699 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4700 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4701 goto LABEL_1166; |
0 | 4702 } |
4703 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4704 { | |
488 | 4705 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
4706 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4707 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4708 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4709 | |
4710 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4711 LODWORD(v727) = 1; |
0 | 4712 } |
488 | 4713 goto play_sound_and_continue; |
710 | 4714 |
0 | 4715 case 21: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4716 { |
0 | 4717 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4718 { | |
710 | 4719 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! |
486 | 4720 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
488 | 4721 goto play_sound_and_continue; |
0 | 4722 } |
4723 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
4724 { | |
710 | 4725 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
4726 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4727 goto play_sound_and_continue; | |
0 | 4728 } |
4729 LODWORD(v733) = 3600 * v2; | |
486 | 4730 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) |
0 | 4731 amount = 1; |
4732 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4733 goto play_sound_and_continue; |
0 | 4734 v205 = 0; |
4735 do | |
486 | 4736 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); |
0 | 4737 while ( v205 < 4 ); |
486 | 4738 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); |
0 | 4739 v207 = v3->uPlayerID + 1; |
4740 v716 = v206; | |
488 | 4741 |
4742 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4743 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4744 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4745 } |
488 | 4746 |
0 | 4747 case 22: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4748 { |
710 | 4749 //v67 = 2; |
0 | 4750 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4751 { | |
710 | 4752 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! |
4753 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4754 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4755 goto LABEL_1166; |
0 | 4756 } |
4757 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4758 goto play_sound_and_continue; |
0 | 4759 v208 = a2 & 7; |
4760 LODWORD(v725) = a2 & 7; | |
4761 if ( v208 == 3 ) | |
4762 { | |
4763 v209 = a2 >> 3; | |
4764 LODWORD(v718) = pActors[v209].vPosition.x; | |
4765 v210 = pActors[v209].vPosition.y; | |
4766 v211 = pActors[v209].vPosition.z; | |
4767 v713 = v210; | |
4768 } | |
4769 else | |
4770 { | |
323 | 4771 v212 = stru_5C6E00->Cos(pParty->sRotationY); |
0 | 4772 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); |
323 | 4773 v213 = stru_5C6E00->Sin(pParty->sRotationY); |
0 | 4774 v214 = sub_42EBBE(2048, v213); |
4775 v211 = pParty->vPosition.z; | |
4776 v713 = pParty->vPosition.y + v214; | |
4777 v208 = LODWORD(v725); | |
4778 } | |
486 | 4779 HIDWORD(v733) = 0; |
0 | 4780 *(float *)&v732 = (double)v211; |
4781 LODWORD(v725) = v211 + 2500; | |
486 | 4782 v721 = 0; |
0 | 4783 *(float *)&y = (double)(v211 + 2500); |
4784 v730 = v208 == 3 ? a2 : 0; | |
4785 a2 = 20; | |
4786 do | |
4787 { | |
4788 v215 = rand(); | |
4789 v216 = (double)v721; | |
4790 v217 = (double)SHIDWORD(v733); | |
4791 *(float *)&uRequiredMana = v217; | |
4792 _this = (ItemGen *)(v215 % 1000); | |
4793 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4794 *(float *)&v721 = v217 * v217; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4795 //*(float *)&v726 = v216 * v216; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4796 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) |
0 | 4797 { |
486 | 4798 LODWORD(v685) = 0; |
4799 HIDWORD(v685) = 0; | |
0 | 4800 } |
4801 else | |
4802 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4803 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
0 | 4804 v685 = __PAIR__( |
4805 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4806 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); |
0 | 4807 } |
4808 a1.stru_24.Reset(); | |
822 | 4809 a1.spell_id = v3->spellnum; |
4810 a1.spell_level = v2; | |
4811 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4812 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 4813 a1.uAttributes = 0; |
0 | 4814 a1.vPosition.x = LODWORD(v718); |
4815 a1.vPosition.y = v713; | |
486 | 4816 a1.uSectorID = 0; |
0 | 4817 a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); |
486 | 4818 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4819 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 4820 a1.spell_target_pid = v730; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4821 __debugbreak(); |
0 | 4822 a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4823 a1.uFacing = v685; | |
823 | 4824 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4825 if ( pParty->bTurnBasedModeOn == 1 ) |
4826 a1.uAttributes = 4; | |
4827 if ( a1.Create( | |
4828 v685, | |
4829 SHIDWORD(v685), | |
4830 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
486 | 4831 0) != -1 |
0 | 4832 && pParty->bTurnBasedModeOn == 1 ) |
4833 ++pTurnEngine->field_1C; | |
4834 v721 = rand() % 1024 - 512; | |
4835 v218 = rand(); | |
4836 v14 = a2-- == 1; | |
4837 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4838 } | |
4839 while ( !v14 ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4840 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4841 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4842 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4843 |
0 | 4844 case 23: |
822 | 4845 v219 = v731 - 2; |
0 | 4846 if ( v219 ) |
4847 { | |
4848 v220 = v219 - 1; | |
4849 if ( v220 ) | |
4850 { | |
4851 if ( v220 == 1 ) | |
4852 { | |
486 | 4853 amount = 0; |
0 | 4854 goto LABEL_433; |
4855 } | |
4856 v221 = 180 * v2; | |
4857 } | |
4858 else | |
4859 { | |
4860 v221 = 86400 * v2; | |
4861 } | |
4862 } | |
4863 else | |
4864 { | |
4865 v221 = 3600 * v2; | |
4866 } | |
4867 amount = v221; | |
4868 LABEL_433: | |
4869 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4870 goto play_sound_and_continue; |
0 | 4871 v222 = (char *)pParty->pPlayers; |
4872 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4873 break; | |
4874 case 24: | |
822 | 4875 v224 = v731 - 2; |
0 | 4876 if ( v224 ) |
4877 { | |
4878 v225 = v224 - 1; | |
4879 if ( v225 ) | |
4880 { | |
4881 if ( v225 == 1 ) | |
4882 amount = 7; | |
4883 else | |
4884 amount = 1; | |
4885 } | |
4886 else | |
4887 { | |
4888 amount = 5; | |
4889 } | |
4890 } | |
4891 else | |
4892 { | |
4893 amount = 3; | |
4894 } | |
4895 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4896 goto play_sound_and_continue; |
0 | 4897 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
4898 if ( amount == 1 ) | |
4899 { | |
4900 LABEL_152: | |
4901 a1.stru_24.Reset(); | |
822 | 4902 a1.spell_id = v3->spellnum; |
4903 a1.spell_skill = v731; | |
4904 a1.spell_level = v2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4905 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4906 a1.vPosition.y = pParty->vPosition.y; |
4907 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4908 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4909 v660 = pParty->vPosition.y; | |
4910 LABEL_153: | |
486 | 4911 a1.uAttributes = 0; |
0 | 4912 a1.vPosition.x = pParty->vPosition.x; |
4913 a1.vPosition.z = v51; | |
4914 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
486 | 4915 a1.uSpriteFrameID = 0; |
0 | 4916 a1.uSectorID = v52; |
823 | 4917 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4918 a1.spell_target_pid = a2; | |
0 | 4919 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
4920 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 4921 a1.uSoundID = LOWORD(v3->sound_id); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4922 |
0 | 4923 if ( pParty->bTurnBasedModeOn == 1 ) |
4924 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4925 |
0 | 4926 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4927 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4928 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0 | 4929 ++pTurnEngine->field_1C; |
4930 } | |
4931 else | |
4932 { | |
4933 a1.stru_24.Reset(); | |
822 | 4934 a1.spell_id = v3->spellnum; |
4935 a1.spell_level = v2; | |
4936 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4937 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4938 a1.vPosition.y = pParty->vPosition.y; |
4939 a1.vPosition.x = pParty->vPosition.x; | |
486 | 4940 a1.uAttributes = 0; |
0 | 4941 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4942 a1.uSectorID = pIndoor->GetSector( | |
4943 pParty->vPosition.x, | |
4944 pParty->vPosition.y, | |
4945 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 4946 a1.uSpriteFrameID = 0; |
823 | 4947 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4948 a1.spell_target_pid = a2; | |
0 | 4949 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
823 | 4950 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4951 if ( pParty->bTurnBasedModeOn == 1 ) |
4952 LOBYTE(a1.uAttributes) |= 4u; | |
4953 v227 = SHIDWORD(v733) / -2; | |
4954 y = (char *)(SHIDWORD(v733) / 2); | |
4955 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4956 { | |
4957 v228 = v715.uYawAngle; | |
4958 do | |
4959 { | |
4960 a1.uFacing = v227 + v228; | |
4961 if ( a1.Create( | |
4962 v227 + v228, | |
4963 v715.uPitchAngle, | |
4964 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4965 v3->uPlayerID + 1) != -1 | |
4966 && pParty->bTurnBasedModeOn == 1 ) | |
4967 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4968 v227 += SHIDWORD(v733) / (amount - 1); |
0 | 4969 } |
4970 while ( v227 <= (signed int)y ); | |
4971 } | |
4972 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4973 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4974 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4975 |
0 | 4976 case 27: |
4977 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
710 | 4978 { |
4979 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4980 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4981 goto play_sound_and_continue; | |
4982 } | |
0 | 4983 if ( v731 == 2 || v731 != 3 && v731 != 4 ) |
4984 v229 = 600 * v2; | |
4985 else | |
4986 v229 = 3600 * v2; | |
4987 LODWORD(v733) = v229; | |
4988 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4989 goto play_sound_and_continue; |
486 | 4990 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); |
488 | 4991 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
4992 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4993 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4994 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4995 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4996 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( |
0 | 4997 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), |
4998 v731, | |
4999 amount, | |
5000 v716, | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5001 v3->uPlayerID + 1); |
0 | 5002 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5003 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; |
488 | 5004 LODWORD(v727) = 1; |
5005 goto play_sound_and_continue; | |
710 | 5006 |
0 | 5007 case 28: |
5008 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5009 goto play_sound_and_continue; |
0 | 5010 v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; |
5011 y = v240; | |
5012 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
710 | 5013 { |
5014 dword_50C9D0 = 113; | |
5015 dword_50C9D4 = 0; | |
5016 dword_50C9D8 = 1; | |
5017 | |
5018 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5019 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5020 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5021 goto LABEL_1166; |
710 | 5022 } |
0 | 5023 if ( v731 == 1 || v731 == 2 ) |
5024 { | |
5025 v241 = (double)v723 * 0.0099999998 + 0.5; | |
5026 } | |
5027 else | |
5028 { | |
5029 if ( v731 == 3 ) | |
5030 { | |
5031 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
5032 } | |
5033 else | |
5034 { | |
5035 if ( v731 != 4 ) | |
5036 { | |
5037 v241 = 0.0; | |
5038 goto LABEL_484; | |
5039 } | |
5040 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
5041 } | |
5042 } | |
5043 if ( v241 > 1.0 ) | |
5044 v241 = 1.0; | |
5045 LABEL_484: | |
5046 v732 = (unsigned __int8)v240[25]; | |
5047 v242 = (signed __int64)((double)v732 * v241); | |
5048 v243 = y; | |
5049 y[25] = v242; | |
5050 *((int *)v243 + 4) = (unsigned __int8)v242; | |
486 | 5051 if ( (unsigned __int8)v242 <= 0 ) |
5052 { | |
5053 *(int *)v243 = 0; | |
0 | 5054 dword_50C9D0 = 113; |
486 | 5055 dword_50C9D4 = 0; |
0 | 5056 dword_50C9D8 = 1; |
5057 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
486 | 5058 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5059 v3->spellnum = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5060 v2 = v723; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5061 goto LABEL_1166; |
0 | 5062 } |
5063 *((int *)v243 + 5) |= 0x40u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5064 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5065 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5066 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5067 |
0 | 5068 case 30: |
5069 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5070 goto play_sound_and_continue; |
486 | 5071 uRequiredMana = 0; |
0 | 5072 HIDWORD(v733) = 10 * v2; |
5073 v730 = 1; | |
5074 v244 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
5075 if ( v731 == 1 ) | |
5076 { | |
5077 v245 = (int)&v244[36 * a2 + 532]; | |
5078 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5079 v311 = __OFSUB__(*(int *)v245, 134); | |
5080 v14 = *(int *)v245 == 134; | |
5081 v310 = *(int *)v245 - 134 < 0; | |
5082 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5083 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5084 { | |
486 | 5085 if ( *(int *)&v244[36 * a2 + 544] == 0 ) |
0 | 5086 { |
486 | 5087 if ( *(int *)&v244[36 * a2 + 536] == 0 ) |
0 | 5088 { |
486 | 5089 if ( *(int *)&v244[36 * a2 + 540] == 0 ) |
0 | 5090 { |
5091 v312 = v309[28]; | |
5092 if ( v312 ) | |
5093 { | |
5094 if ( v312 != 1 ) | |
5095 { | |
5096 if ( v312 != 2 ) | |
5097 { | |
5098 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5099 if ( !(v244[36 * a2 + 552] & 2) ) | |
5100 { | |
5101 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5102 { | |
5103 uRequiredMana = 1; | |
486 | 5104 v730 = 0; |
0 | 5105 } |
5106 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5107 uRequiredMana = 1; | |
486 | 5108 if (!uRequiredMana) |
0 | 5109 { |
5110 v313 = *(char *)(LODWORD(v725) + 28); | |
5111 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5112 { | |
224 | 5113 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
0 | 5114 *(int *)(v245 + 4) = 0; |
222 | 5115 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5116 + 1]; |
5117 ; | |
222 | 5118 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5119 + 1] ) |
5120 { | |
5121 ++*(int *)(v245 + 4); | |
5122 if ( j >= v314 ) | |
5123 break; | |
5124 } | |
5125 v254 = rand(); | |
224 | 5126 v255 = 10;//pItemsTable->field_116D8[17]; |
5127 v256 = 10;//pItemsTable->field_116D8[16]; | |
0 | 5128 LABEL_611: |
5129 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5130 LABEL_612: | |
5131 _this->uItemID |= 0x20u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5133 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5134 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5135 goto play_sound_and_continue; |
0 | 5136 } |
5137 goto LABEL_615; | |
5138 } | |
5139 LABEL_613: | |
5140 v316 = _this->uItemID; | |
5141 if ( !(BYTE1(v316) & 2) ) | |
5142 { | |
5143 LOBYTE(v316) = v316 | 2; | |
5144 _this->uItemID = v316; | |
5145 } | |
5146 } | |
5147 } | |
5148 } | |
5149 } | |
5150 } | |
5151 } | |
5152 } | |
5153 } | |
5154 LABEL_616: | |
486 | 5155 if ( LODWORD(v727) == 0 ) |
0 | 5156 { |
5157 v317 = pGlobalTXT_LocalizationStrings[428]; | |
486 | 5158 if ( v730 == 0 ) |
0 | 5159 v317 = pGlobalTXT_LocalizationStrings[585]; |
5160 ShowStatusBarString(v317, 2u); | |
486 | 5161 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5162 __debugbreak(); // decompilation error; most probably v318 is the caster, filled in case 54 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5163 //v318 = v726; |
486 | 5164 v3->spellnum = 0; |
5165 v318->PlaySound(SPEECH_43, 0); | |
0 | 5166 } |
488 | 5167 goto play_sound_and_continue; |
0 | 5168 } |
5169 if ( v731 != 2 ) | |
5170 { | |
5171 if ( v731 == 3 ) | |
5172 { | |
5173 v245 = (int)&v244[36 * a2 + 532]; | |
5174 v269 = *(int *)v245; | |
5175 if ( *(int *)v245 > 134 | |
486 | 5176 || *(int *)(v245 + 12) != 0 |
5177 || *(int *)(v245 + 4) != 0 | |
5178 || *(int *)(v245 + 8) != 0 | |
0 | 5179 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) |
5180 goto LABEL_616; | |
5181 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5182 LODWORD(v725) = (int)v270; | |
5183 v271 = v270[28]; | |
5184 if ( v271 && v271 != 1 && v271 != 2 ) | |
5185 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5186 else | |
5187 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5188 if ( v272 ) | |
5189 { | |
5190 uRequiredMana = 1; | |
486 | 5191 v730 = 0; |
0 | 5192 } |
5193 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5194 uRequiredMana = 1; | |
486 | 5195 if (uRequiredMana) |
0 | 5196 goto LABEL_613; |
5197 v273 = v725; | |
5198 v274 = *(char *)(LODWORD(v725) + 28); | |
5199 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 ) | |
5200 { | |
5201 if ( rand() % 100 < 80 | |
5202 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5203 { | |
224 | 5204 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
0 | 5205 *(int *)(v245 + 4) = 0; |
222 | 5206 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; |
0 | 5207 ; |
222 | 5208 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5209 + 1] ) |
5210 { | |
5211 ++*(int *)(v245 + 4); | |
5212 if ( k >= v275 ) | |
5213 break; | |
5214 } | |
5215 v254 = rand(); | |
224 | 5216 v255 = 10;//pItemsTable->field_116D8[19]; |
5217 v256 = 10;//pItemsTable->field_116D8[18]; | |
0 | 5218 goto LABEL_611; |
5219 } | |
222 | 5220 v277 = pItemsTable->pSpecialEnchantments_count; |
0 | 5221 v278 = 0; |
5222 v725 = 0.0; | |
5223 HIDWORD(v733) = 0; | |
222 | 5224 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
0 | 5225 { |
5226 v730 = (int)&v679; | |
5227 do | |
5228 { | |
222 | 5229 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); |
0 | 5230 if ( !v279 || v279 == 1 ) |
5231 { | |
222 | 5232 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5233 + 4] |
5234 + v278 * 28); | |
5235 LODWORD(v725) += v280; | |
5236 if ( v280 ) | |
5237 { | |
5238 v281 = v730; | |
5239 v730 += 4; | |
5240 *(int *)v281 = HIDWORD(v733); | |
5241 } | |
5242 } | |
5243 ++HIDWORD(v733); | |
5244 ++v278; | |
5245 } | |
5246 while ( SHIDWORD(v733) < v277 ); | |
5247 } | |
5248 v282 = rand() % SLODWORD(v725); | |
5249 v283 = v679; | |
5250 *(int *)(v245 + 12) = v679; | |
222 | 5251 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; |
0 | 5252 v285 = v282 + 1; |
5253 if ( v284 < v285 ) | |
5254 { | |
5255 for ( l = &v679; ; l = (int *)v732 ) | |
5256 { | |
5257 v287 = (int)(l + 1); | |
5258 v732 = v287; | |
5259 v288 = *(int *)v287; | |
5260 *(int *)(v245 + 12) = v288; | |
222 | 5261 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5262 + 4]; |
5263 if ( v284 >= v285 ) | |
5264 break; | |
5265 } | |
5266 } | |
5267 goto LABEL_525; | |
5268 } | |
5269 } | |
5270 else | |
5271 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5272 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
0 | 5273 if ( v731 != 4 |
5274 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
486 | 5275 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 |
570 | 5276 || v726->pInventoryItems[a2].uEnchantmentType != 0 |
486 | 5277 || v726->pInventoryItems[a2]._bonus_strength != 0 |
315 | 5278 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) |
0 | 5279 goto LABEL_616; |
5280 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5281 LODWORD(v725) = (int)v247; | |
5282 v248 = v247[28]; | |
5283 if ( v248 && v248 != 1 && v248 != 2 ) | |
5284 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5285 else | |
5286 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5287 if ( v249 ) | |
5288 { | |
5289 uRequiredMana = 1; | |
486 | 5290 v730 = 0; |
0 | 5291 } |
5292 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5293 uRequiredMana = 1; | |
486 | 5294 if (uRequiredMana) |
0 | 5295 goto LABEL_613; |
5296 v250 = v725; | |
5297 v251 = *(char *)(LODWORD(v725) + 28); | |
5298 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 ) | |
5299 { | |
5300 if ( rand() % 100 < 80 | |
5301 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5302 { | |
224 | 5303 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
0 | 5304 *(int *)(v245 + 4) = 0; |
222 | 5305 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; |
0 | 5306 ; |
222 | 5307 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5308 + 1] ) |
5309 { | |
5310 ++*(int *)(v245 + 4); | |
5311 if ( m >= v252 ) | |
5312 break; | |
5313 } | |
5314 v254 = rand(); | |
224 | 5315 v255 = 10;// pItemsTable->field_116D8[21]; |
5316 v256 = 10;//pItemsTable->field_116D8[20]; | |
0 | 5317 goto LABEL_611; |
5318 } | |
222 | 5319 v257 = pItemsTable->pSpecialEnchantments_count; |
0 | 5320 v258 = 0; |
5321 v725 = 0.0; | |
5322 HIDWORD(v733) = 0; | |
222 | 5323 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
0 | 5324 { |
5325 v730 = (int)&v679; | |
5326 do | |
5327 { | |
222 | 5328 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); |
0 | 5329 if ( !v259 || v259 == 1 ) |
5330 { | |
222 | 5331 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5332 + 4] |
5333 + v258 * 28); | |
5334 LODWORD(v725) += v260; | |
5335 if ( v260 ) | |
5336 { | |
5337 v261 = v730; | |
5338 v730 += 4; | |
5339 *(int *)v261 = HIDWORD(v733); | |
5340 } | |
5341 } | |
5342 ++HIDWORD(v733); | |
5343 ++v258; | |
5344 } | |
5345 while ( SHIDWORD(v733) < v257 ); | |
5346 } | |
5347 v262 = rand() % SLODWORD(v725); | |
5348 v263 = v679; | |
5349 *(int *)(v245 + 12) = v679; | |
222 | 5350 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; |
0 | 5351 v265 = v262 + 1; |
5352 if ( v264 < v265 ) | |
5353 { | |
5354 for ( ii = &v679; ; ii = (int *)v732 ) | |
5355 { | |
5356 v267 = (int)(ii + 1); | |
5357 v732 = v267; | |
5358 v268 = *(int *)v267; | |
5359 *(int *)(v245 + 12) = v268; | |
222 | 5360 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5361 + 4]; |
5362 if ( v264 >= v265 ) | |
5363 break; | |
5364 } | |
5365 } | |
5366 LABEL_525: | |
5367 ++*(int *)(v245 + 12); | |
5368 goto LABEL_612; | |
5369 } | |
5370 } | |
5371 LABEL_615: | |
486 | 5372 //v1 = 0; |
0 | 5373 goto LABEL_616; |
5374 } | |
5375 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5376 _this = v289; | |
5377 v290 = v289->uItemID; | |
5378 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5379 if ( v290 > 134 | |
486 | 5380 || _this->uSpecEnchantmentType != 0 |
570 | 5381 || _this->uEnchantmentType != 0 |
486 | 5382 || _this->_bonus_strength != 0 |
0 | 5383 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 |
5384 || v291 == 1 | |
5385 || v291 == 2 | |
315 | 5386 || _this->Broken()) |
0 | 5387 goto LABEL_616; |
5388 if ( _this->GetValue() < 0x1C2 ) | |
5389 uRequiredMana = 1; | |
5390 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5391 uRequiredMana = 1; | |
486 | 5392 if ( uRequiredMana != 0 ) |
710 | 5393 { |
5394 dword_50C9D0 = 113; | |
5395 dword_50C9D4 = 0; | |
5396 dword_50C9D8 = 1; | |
5397 | |
5398 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5399 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5400 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5401 goto LABEL_1166; |
710 | 5402 } |
0 | 5403 v292 = *(char *)(LODWORD(v725) + 28); |
5404 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5405 { | |
5406 v2 = v723; | |
486 | 5407 //v1 = 0; |
710 | 5408 |
5409 dword_50C9D0 = 113; | |
5410 dword_50C9D4 = 0; | |
5411 dword_50C9D8 = 1; | |
5412 | |
5413 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5414 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5415 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5416 goto LABEL_1166; |
0 | 5417 } |
5418 if ( rand() % 100 >= 80 ) | |
5419 { | |
222 | 5420 v297 = pItemsTable->pSpecialEnchantments_count; |
0 | 5421 v294 = _this; |
5422 v298 = 0; | |
5423 v725 = 0.0; | |
5424 HIDWORD(v733) = 0; | |
222 | 5425 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
0 | 5426 { |
5427 v730 = (int)&v679; | |
5428 do | |
5429 { | |
222 | 5430 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); |
0 | 5431 if ( !v299 || v299 == 1 ) |
5432 { | |
222 | 5433 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] |
0 | 5434 + v298 * 28); |
5435 LODWORD(v725) += v300; | |
5436 if ( v300 ) | |
5437 { | |
5438 v301 = v730; | |
5439 v730 += 4; | |
5440 *(int *)v301 = HIDWORD(v733); | |
5441 } | |
5442 } | |
5443 ++HIDWORD(v733); | |
5444 ++v298; | |
5445 } | |
5446 while ( SHIDWORD(v733) < v297 ); | |
5447 } | |
5448 v302 = rand() % SLODWORD(v725); | |
5449 v303 = v679; | |
377 | 5450 v294->uSpecEnchantmentType = v679; |
222 | 5451 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; |
0 | 5452 v305 = v302 + 1; |
5453 if ( v304 < v305 ) | |
5454 { | |
5455 for ( jj = &v679; ; jj = (int *)v732 ) | |
5456 { | |
5457 v307 = (int)(jj + 1); | |
5458 v732 = v307; | |
5459 v308 = *(int *)v307; | |
377 | 5460 v294->uSpecEnchantmentType = v308; |
222 | 5461 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; |
0 | 5462 if ( v304 >= v305 ) |
5463 break; | |
5464 } | |
5465 } | |
377 | 5466 ++v294->uSpecEnchantmentType; |
0 | 5467 } |
5468 else | |
5469 { | |
5470 v293 = rand(); | |
5471 v294 = _this; | |
224 | 5472 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; |
570 | 5473 _this->uEnchantmentType = 0; |
222 | 5474 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; |
0 | 5475 ; |
570 | 5476 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType |
0 | 5477 + 1] ) |
5478 { | |
570 | 5479 ++v294->uEnchantmentType; |
0 | 5480 if ( kk >= v295 ) |
5481 break; | |
5482 } | |
224 | 5483 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] |
5484 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
0 | 5485 } |
5486 v294->uAttributes |= 0x20u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5487 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5488 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5489 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5490 |
710 | 5491 case SPELL_WATER_TOWN_PORTAL: |
0 | 5492 amount = 10 * v2; |
5493 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
488 | 5494 goto play_sound_and_continue; |
822 | 5495 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) |
710 | 5496 { |
5497 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5498 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5499 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5500 goto LABEL_1166; |
710 | 5501 } |
5502 town_portal_caster_id = LOBYTE(v3->uPlayerID); | |
5503 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5504 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5505 goto play_sound_and_continue; |
0 | 5506 case 33: |
5507 LODWORD(v733) = 604800 * v2; | |
5508 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
710 | 5509 { |
5510 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5511 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5512 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5513 goto LABEL_1166; |
710 | 5514 } |
0 | 5515 v319 = uRequiredMana; |
5516 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5517 { | |
5518 pEventTimer->Pause(); | |
486 | 5519 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); |
0 | 5520 qword_506350 = (signed int)v733; |
5521 _506348_current_lloyd_playerid = v3->uPlayerID; | |
5522 ::uRequiredMana = v319; | |
5523 ::sRecoveryTime = sRecoveryTime; | |
823 | 5524 dword_50633C = v3->sound_id; |
0 | 5525 dword_506338 = v3->spellnum; |
5526 LOBYTE(v3->field_8) |= 0x20u; | |
5527 } | |
488 | 5528 goto play_sound_and_continue; |
0 | 5529 case 40: |
822 | 5530 v320 = v731 - 2; |
0 | 5531 if ( !v320 ) |
5532 goto LABEL_632; | |
5533 v321 = v320 - 1; | |
5534 if ( v321 ) | |
5535 { | |
5536 if ( v321 == 1 ) | |
5537 goto LABEL_634; | |
5538 LABEL_632: | |
5539 v322 = 3600 * v2; | |
5540 } | |
5541 else | |
5542 { | |
5543 v322 = 86400 * v2; | |
5544 } | |
5545 amount = v322; | |
5546 LABEL_634: | |
5547 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5548 goto play_sound_and_continue; |
0 | 5549 v323 = v3->uPlayerID_2; |
5550 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
5551 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5552 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5553 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5554 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5555 } |
0 | 5556 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5557 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5558 *(int *)v324 = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5559 *((int *)v324 + 1) = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5560 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5561 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5562 } |
0 | 5563 v732 = amount << 7; |
5564 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5565 v656 = 15; | |
5566 goto LABEL_640; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5567 |
0 | 5568 case 41: |
5569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5570 goto play_sound_and_continue; |
0 | 5571 a1.stru_24.Reset(); |
822 | 5572 a1.spell_id = v3->spellnum; |
5573 a1.spell_level = v2; | |
5574 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5575 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 5576 a1.vPosition.y = pParty->vPosition.y; |
5577 a1.vPosition.x = pParty->vPosition.x; | |
486 | 5578 a1.uAttributes = 0; |
0 | 5579 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
5580 a1.uSectorID = pIndoor->GetSector( | |
5581 pParty->vPosition.x, | |
5582 pParty->vPosition.y, | |
5583 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 5584 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5585 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 5586 a1.spell_target_pid = a2; |
0 | 5587 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
5588 a1.uFacing = LOWORD(pParty->sRotationY); | |
823 | 5589 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 5590 if ( pParty->bTurnBasedModeOn == 1 ) |
5591 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5592 |
0 | 5593 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5594 if ( a1.Create(pParty->sRotationY, pParty->sRotationX, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5595 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5596 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5597 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5598 |
0 | 5599 case 43: |
5600 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
710 | 5601 { |
5602 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5603 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5604 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5605 goto LABEL_1166; |
710 | 5606 } |
0 | 5607 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 5608 goto play_sound_and_continue; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5609 a1.uType = 4090; |
0 | 5610 a1.stru_24.Reset(); |
822 | 5611 a1.spell_id = v3->spellnum; |
5612 a1.spell_level = v2; | |
5613 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5614 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 5615 a1.vPosition.x = pParty->vPosition.x; |
5616 a1.vPosition.y = pParty->vPosition.y; | |
486 | 5617 a1.uAttributes = 0; |
5618 a1.uSectorID = 0; | |
5619 a1.uSpriteFrameID = 0; | |
0 | 5620 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
5621 a1.field_60_distance_related_prolly_lod = 0; | |
823 | 5622 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
5623 a1.spell_target_pid = a2; | |
0 | 5624 a1.uFacing = LOWORD(pParty->sRotationY); |
823 | 5625 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 5626 if ( pParty->bTurnBasedModeOn == 1 ) |
5627 a1.uAttributes = 4; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5628 |
0 | 5629 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5630 if ( a1.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5631 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5632 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5633 goto play_sound_and_continue; |
488 | 5634 |
5635 case SPELL_SPIRIT_DETECT_LIFE: | |
822 | 5636 v328 = v731 - 2; |
0 | 5637 if ( v328 ) |
5638 { | |
5639 v329 = v328 - 1; | |
5640 if ( v329 && v329 != 1 ) | |
5641 v330 = 600 * v2; | |
5642 else | |
5643 v330 = 3600 * v2; | |
5644 } | |
5645 else | |
5646 { | |
5647 v330 = 1800 * v2; | |
5648 } | |
5649 LODWORD(v733) = v330; | |
5650 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5651 goto play_sound_and_continue; |
5652 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
5653 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
5654 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
5655 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
5656 | |
5657 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); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5658 LODWORD(v727) = 1; |
488 | 5659 goto play_sound_and_continue; |
5660 | |
5661 case SPELL_SPIRIT_FATE: | |
0 | 5662 LODWORD(v733) = 300; |
822 | 5663 v339 = v731 - 2; |
0 | 5664 if ( v339 ) |
5665 { | |
5666 v340 = v339 - 1; | |
5667 if ( v340 ) | |
5668 { | |
5669 if ( v340 != 1 ) | |
5670 { | |
5671 amount = v2; | |
5672 goto LABEL_667; | |
5673 } | |
5674 v341 = 6 * v2; | |
5675 } | |
5676 else | |
5677 { | |
5678 v341 = 4 * v2; | |
5679 } | |
5680 } | |
5681 else | |
5682 { | |
5683 v341 = 2 * v2; | |
5684 } | |
5685 amount = v341; | |
5686 LABEL_667: | |
5687 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5688 goto play_sound_and_continue; |
5689 v342 = v3->spell_target_pid; | |
486 | 5690 if ( v342 == 0 ) |
0 | 5691 { |
488 | 5692 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
5693 | |
5694 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5695 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5696 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5697 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5698 if (PID_TYPE(v342) == OBJECT_Actor) |
0 | 5699 { |
5700 v343 = v342 >> 3; | |
486 | 5701 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); |
0 | 5702 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; |
486 | 5703 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); |
0 | 5704 BYTE2(pActors[v343].uAttributes) |= 8u; |
486 | 5705 v672 = 0; |
0 | 5706 v661 = &pActors[v343]; |
5707 LABEL_165: | |
5708 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5709 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5710 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5711 goto play_sound_and_continue; |
488 | 5712 |
0 | 5713 case 49: |
822 | 5714 v348 = v731 - 2; |
0 | 5715 if ( !v348 ) |
5716 goto LABEL_677; | |
5717 v349 = v348 - 1; | |
5718 if ( v349 ) | |
5719 { | |
5720 if ( v349 == 1 ) | |
5721 { | |
486 | 5722 amount = 0; |
0 | 5723 goto LABEL_679; |
5724 } | |
5725 LABEL_677: | |
5726 v350 = 3600 * v2; | |
5727 } | |
5728 else | |
5729 { | |
5730 v350 = 86400 * v2; | |
5731 } | |
5732 amount = v350; | |
5733 LABEL_679: | |
5734 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5735 goto play_sound_and_continue; |
0 | 5736 v351 = &pParty->pPlayers[v3->uPlayerID_2]; |
5737 if ( !v351->pConditions[0] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5738 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5739 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5740 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5741 } |
0 | 5742 if ( v731 == 4 ) |
5743 { | |
486 | 5744 LODWORD(v351->pConditions[0]) = 0; |
5745 HIDWORD(v351->pConditions[0]) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5746 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5747 else |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5748 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5749 v732 = amount << 7; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5750 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5751 if ( HIDWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5752 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5753 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5754 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5755 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5756 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5757 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5758 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5759 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5760 |
488 | 5761 case SPELL_SPIRIT_PRESERVATION: |
822 | 5762 v354 = v731 - 2; |
0 | 5763 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) |
5764 v356 = 900 * (v2 + 4); | |
5765 else | |
5766 v356 = 300 * (v2 + 12); | |
5767 LODWORD(v733) = v356; | |
5768 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5769 goto play_sound_and_continue; |
0 | 5770 if ( v731 == 1 || v731 == 2 ) |
5771 { | |
488 | 5772 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
5773 | |
5774 pParty->pPlayers[v3->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); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5775 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5776 goto play_sound_and_continue; |
0 | 5777 } |
486 | 5778 a2 = 0; |
0 | 5779 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
112 | 5780 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; |
0 | 5781 do |
5782 { | |
488 | 5783 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); |
5784 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
0 | 5785 ++a2; |
112 | 5786 ++v357;// = (SpellBuff *)((char *)v357 + 6972); |
5787 } | |
5788 while ( v357 <= &pParty->pPlayers[3] ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5789 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5790 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5791 |
0 | 5792 case 48: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5793 { |
822 | 5794 v364 = v731 - 2; |
0 | 5795 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) |
5796 v366 = 60 * (v2 + 3); | |
5797 else | |
5798 v366 = 300 * v2 + 180; | |
5799 LODWORD(v733) = v366; | |
5800 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5801 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5802 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
0 | 5803 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5804 ++a1.uType; |
0 | 5805 a1.stru_24.Reset(); |
822 | 5806 a1.spell_id = v3->spellnum; |
5807 a1.spell_level = v2; | |
5808 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5809 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 5810 a1.uAttributes = 0; |
5811 a1.uSectorID = 0; | |
5812 a1.uSpriteFrameID = 0; | |
0 | 5813 a1.field_60_distance_related_prolly_lod = 0; |
486 | 5814 a1.uFacing = 0; |
823 | 5815 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
5816 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5817 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
0 | 5818 { |
5819 v369 = &pActors[dword_50BF30[a2]]; | |
5820 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5821 { | |
5822 a1.vPosition.x = v369->vPosition.x; | |
5823 a1.vPosition.y = v369->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5824 a1.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5825 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5826 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 5827 a1.Create(0, 0, 0, 0); |
0 | 5828 v369->pActorBuffs[4].Apply( |
5829 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
486 | 5830 v731, 0, 0, 0); |
0 | 5831 } |
5832 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5833 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5834 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5835 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5836 |
0 | 5837 case 53: |
822 | 5838 v371 = v731 - 2; |
0 | 5839 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) |
486 | 5840 amount = 0; |
0 | 5841 else |
5842 amount = 86400 * v2; | |
5843 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5844 goto play_sound_and_continue; |
486 | 5845 pOtherOverlayList->_4418B1(5080, v3->uPlayerID_2 + 100, 0, 65536); |
0 | 5846 v373 = v3->uPlayerID_2; |
5847 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5848 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5849 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5850 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5851 } |
0 | 5852 v14 = v731 == 4; |
5853 pParty->pPlayers[v373].sHealth = 1; | |
5854 if ( v14 ) | |
5855 { | |
5856 v374 = v3->uPlayerID_2; | |
486 | 5857 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5858 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
0 | 5859 v376 = v3->uPlayerID_2; |
486 | 5860 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5861 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
0 | 5862 } |
5863 else | |
5864 { | |
5865 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5866 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5867 0xEu, | |
5868 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5869 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5870 0xDu, | |
5871 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5872 } | |
112 | 5873 v377 = &pParty->pPlayers[v3->uPlayerID_2]; |
0 | 5874 goto LABEL_720; |
5875 case 54: | |
822 | 5876 v378 = v731 - 2; |
0 | 5877 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) |
5878 v380 = 4 * v2; | |
5879 else | |
5880 v380 = 3 * v2; | |
5881 amount = v380; | |
5882 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5883 goto play_sound_and_continue; |
0 | 5884 v381 = 0; |
5885 HIDWORD(v733) = amount; | |
5886 v730 = 0; | |
5887 v382 = 1; | |
5888 do | |
5889 { | |
5890 v383 = pPlayers[v382]; | |
5891 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5892 v682[v381++] = v382; | |
5893 ++v382; | |
5894 } | |
5895 while ( v382 <= 4 ); | |
5896 v384 = 0; | |
5897 v730 = v381; | |
486 | 5898 if ( v381 > 0 ) |
0 | 5899 { |
5900 do | |
5901 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5902 while ( v384 < v381 ); | |
5903 } | |
5904 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
486 | 5905 HIDWORD(v733) = 0; |
5906 if ( v381 > 0 ) | |
0 | 5907 { |
5908 do | |
5909 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5910 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5911 v726 = pPlayers[v682[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5912 v726->sHealth = v732; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5913 //v386 = v726->GetMaxHealth(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5914 if ( v726->sHealth > v726->GetMaxHealth()) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5915 v726->sHealth = v726->GetMaxHealth(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5916 if ( v726->sHealth > 0 ) |
0 | 5917 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5918 v726->pConditions[Player::Condition_Unconcious] = 0; |
0 | 5919 } |
5920 v388 = HIDWORD(v733); | |
488 | 5921 |
5922 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); | |
0 | 5923 HIDWORD(v733) = v388 + 1; |
5924 } | |
5925 while ( v388 + 1 < v730 ); | |
5926 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5927 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5928 goto play_sound_and_continue; |
488 | 5929 |
0 | 5930 case 55: |
822 | 5931 v392 = v731 - 1; |
0 | 5932 if ( !v392 ) |
5933 { | |
5934 v395 = 180 * v2; | |
5935 goto LABEL_750; | |
5936 } | |
5937 v393 = v392 - 1; | |
5938 if ( !v393 ) | |
5939 { | |
5940 v395 = 10800 * v2; | |
5941 goto LABEL_750; | |
5942 } | |
5943 v394 = v393 - 1; | |
5944 if ( !v394 ) | |
5945 { | |
5946 v395 = 259200 * v2; | |
5947 LABEL_750: | |
5948 amount = v395; | |
5949 goto LABEL_751; | |
5950 } | |
5951 if ( v394 == 1 ) | |
486 | 5952 amount = 0; |
0 | 5953 LABEL_751: |
5954 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5955 goto play_sound_and_continue; |
0 | 5956 v396 = v3->uPlayerID_2; |
5957 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
5958 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5959 { | |
5960 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
486 | 5961 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); |
0 | 5962 if ( v731 == 4 ) |
5963 { | |
5964 v397 = v3->uPlayerID_2; | |
486 | 5965 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5966 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
0 | 5967 v398 = v3->uPlayerID_2; |
486 | 5968 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5969 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
0 | 5970 v399 = v3->uPlayerID_2; |
486 | 5971 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5972 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
0 | 5973 } |
5974 else | |
5975 { | |
5976 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5977 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
0 | 5978 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5979 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
0 | 5980 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5981 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
0 | 5982 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5983 } | |
112 | 5984 pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1); |
488 | 5985 |
0 | 5986 pParty->pPlayers[v3->uPlayerID_2].sHealth = 1; |
488 | 5987 |
5988 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 5989 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5990 LODWORD(v727) = 1; |
488 | 5991 goto play_sound_and_continue; |
5992 | |
0 | 5993 case 61: |
822 | 5994 v405 = v731 - 2; |
0 | 5995 if ( !v405 ) |
5996 goto LABEL_766; | |
5997 v406 = v405 - 1; | |
5998 if ( v406 ) | |
5999 { | |
6000 if ( v406 == 1 ) | |
6001 { | |
486 | 6002 amount = 0; |
0 | 6003 goto LABEL_768; |
6004 } | |
6005 LABEL_766: | |
6006 v407 = 3600 * v2; | |
6007 } | |
6008 else | |
6009 { | |
6010 v407 = 86400 * v2; | |
6011 } | |
6012 amount = v407; | |
6013 LABEL_768: | |
6014 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6015 goto play_sound_and_continue; |
6016 | |
6017 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6018 v323 = v3->uPlayerID_2; |
6019 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
6020 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6021 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6022 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6023 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6024 } |
0 | 6025 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6026 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6027 *(int *)v324 = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6028 *((int *)v324 + 1) = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6029 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6030 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6031 } |
0 | 6032 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6033 v656 = 12; | |
6034 goto LABEL_640; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6035 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6036 |
0 | 6037 case 56: |
822 | 6038 v411 = v731 - 2; |
0 | 6039 if ( v411 ) |
6040 { | |
6041 v412 = v411 - 1; | |
6042 if ( v412 ) | |
6043 { | |
6044 if ( v412 == 1 ) | |
6045 { | |
486 | 6046 amount = 0; |
0 | 6047 goto LABEL_780; |
6048 } | |
6049 v413 = 180 * v2; | |
6050 } | |
6051 else | |
6052 { | |
6053 v413 = 86400 * v2; | |
6054 } | |
6055 } | |
6056 else | |
6057 { | |
6058 v413 = 3600 * v2; | |
6059 } | |
6060 amount = v413; | |
6061 LABEL_780: | |
6062 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6063 goto play_sound_and_continue; |
6064 | |
6065 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6066 v323 = v3->uPlayerID_2; |
6067 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
6068 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6069 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6070 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6071 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6072 } |
0 | 6073 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6074 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6075 *(int *)v324 = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6076 *((int *)v324 + 1) = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6077 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6078 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6079 } |
0 | 6080 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6081 v656 = 3; | |
6082 goto LABEL_640; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6083 |
0 | 6084 case 59: |
6085 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6086 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6087 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6088 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6089 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6090 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6091 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6092 v417 = (int)&pActors[PID_ID(a2)]; |
0 | 6093 v730 = v417; |
6094 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6095 { | |
6096 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6097 v417 = v730; | |
6098 } | |
6099 v418 = *(int *)(v417 + 672); | |
486 | 6100 HIDWORD(v733) = 0; |
0 | 6101 if ( pItemsTable->pItems[v418].uEquipType == 18 ) |
6102 HIDWORD(v733) = *(int *)(v417 + 684); | |
6103 | |
6104 //ItemGen::ItemGen(&v683); | |
6105 v683.Reset(); | |
6106 | |
6107 v419 = *(short *)(v730 + 180); | |
486 | 6108 if (v419) |
0 | 6109 { |
6110 v683.uItemID = v419; | |
6111 goto LABEL_799; | |
6112 } | |
6113 v420 = 0; | |
6114 v421 = v730 + 564; | |
486 | 6115 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) |
0 | 6116 { |
6117 ++v420; | |
6118 v421 += 36; | |
6119 if ( v420 >= 4 ) | |
6120 goto LABEL_799; | |
6121 } | |
6122 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6123 v2 = v723; | |
486 | 6124 //v1 = 0; |
0 | 6125 LABEL_799: |
486 | 6126 if ( HIDWORD(v733) != 0 ) |
0 | 6127 { |
6128 v675 = (const char *)HIDWORD(v733); | |
486 | 6129 if (v683.uItemID) |
0 | 6130 { |
6131 v422 = v683.GetDisplayName(); | |
6132 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
6133 goto LABEL_807; | |
6134 } | |
6135 v664 = "%d gold"; | |
6136 goto LABEL_803; | |
6137 } | |
486 | 6138 if (v683.uItemID) |
0 | 6139 { |
6140 v675 = v683.GetDisplayName(); | |
6141 v664 = "(%s)"; | |
6142 LABEL_803: | |
6143 sprintf(pTmpBuf2, v664, v675); | |
6144 goto LABEL_807; | |
6145 } | |
6146 strcpy(pTmpBuf2, "nothing"); | |
6147 LABEL_807: | |
6148 ShowStatusBarString(pTmpBuf2, 2u); | |
6149 a1.stru_24.Reset(); | |
822 | 6150 a1.spell_id = v3->spellnum; |
6151 a1.spell_level = v2; | |
6152 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6153 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 6154 a1.vPosition.x = *(short *)(v730 + 142); |
6155 a1.vPosition.y = *(short *)(v730 + 144); | |
6156 v676 = *(short *)(v730 + 138); | |
6157 v665 = a1.vPosition.y; | |
6158 a1.vPosition.z = *(short *)(v730 + 138); | |
6159 v657 = a1.vPosition.x; | |
6160 goto LABEL_1087; | |
6161 case 62: | |
822 | 6162 v423 = v731 - 2; |
0 | 6163 if ( !v423 ) |
6164 goto LABEL_813; | |
6165 v424 = v423 - 1; | |
6166 if ( v424 ) | |
6167 { | |
6168 if ( v424 == 1 ) | |
6169 v425 = 3600 * v2; | |
6170 else | |
6171 LABEL_813: | |
6172 v425 = 300 * v2; | |
6173 } | |
6174 else | |
6175 { | |
6176 v425 = 600 * v2; | |
6177 } | |
6178 amount = v425; | |
6179 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6180 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6181 v426 = PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6182 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6183 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6184 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6185 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6186 } |
0 | 6187 v730 = 836 * v426; |
6188 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6189 { | |
90 | 6190 pActors[v426].pActorBuffs[1].Reset(); |
6191 pActors[v426].pActorBuffs[12].Reset(); | |
6192 pActors[v426].pActorBuffs[9].Apply( | |
0 | 6193 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
486 | 6194 v731, 0, 0, 0); |
90 | 6195 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
0 | 6196 } |
6197 a1.stru_24.Reset(); | |
822 | 6198 a1.spell_id = v3->spellnum; |
6199 a1.spell_level = v2; | |
6200 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6201 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
90 | 6202 v61 = v426; |
0 | 6203 goto LABEL_1086; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6204 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6205 |
0 | 6206 case 66: |
6207 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6208 goto play_sound_and_continue; |
0 | 6209 amount = 600 * v2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6210 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6211 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6212 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6213 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6214 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6215 v730 = 836 * PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6216 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6217 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6218 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6219 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6220 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6221 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6222 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
486 | 6223 v731, 0, 0, 0); |
0 | 6224 } |
6225 a1.stru_24.Reset(); | |
822 | 6226 a1.spell_id = v3->spellnum; |
6227 a1.spell_level = v2; | |
6228 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6229 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6230 v61 = PID_ID(a2); |
0 | 6231 goto LABEL_1086; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6232 |
0 | 6233 case 63: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6234 { |
822 | 6235 v428 = v731 - 2; |
0 | 6236 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) |
6237 v430 = 300 * v2; | |
6238 else | |
6239 v430 = 180 * v2; | |
6240 amount = v430; | |
6241 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6242 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6243 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
0 | 6244 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6245 ++a1.uType; |
0 | 6246 a1.stru_24.Reset(); |
822 | 6247 a1.spell_id = v3->spellnum; |
6248 a1.spell_level = v2; | |
6249 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6250 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 6251 a1.uAttributes = 0; |
6252 a1.uSectorID = 0; | |
6253 a1.uSpriteFrameID = 0; | |
0 | 6254 a1.field_60_distance_related_prolly_lod = 0; |
486 | 6255 a1.uFacing = 0; |
823 | 6256 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
6257 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6258 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
0 | 6259 { |
6260 v433 = &pActors[dword_50BF30[a2]]; | |
6261 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6262 break; | |
6263 a1.vPosition.x = v433->vPosition.x; | |
6264 a1.vPosition.y = v433->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6265 a1.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6266 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6267 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6268 a1.Create(0, 0, 0, 0); |
0 | 6269 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6270 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6271 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
486 | 6272 v731, 0, 0, 0); |
0 | 6273 } |
6274 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6275 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6276 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6277 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6278 |
0 | 6279 case 64: |
822 | 6280 v435 = v731 - 2; |
0 | 6281 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) |
486 | 6282 amount = 0; |
0 | 6283 else |
6284 amount = 86400 * v2; | |
6285 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6286 goto play_sound_and_continue; |
6287 | |
6288 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6289 v440 = v3->uPlayerID_2; |
6290 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
6291 { | |
6292 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
486 | 6293 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); |
0 | 6294 if ( v731 == 4 ) |
6295 { | |
6296 v441 = v3->uPlayerID_2; | |
486 | 6297 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6298 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
0 | 6299 } |
6300 else | |
6301 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6302 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
0 | 6303 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6304 } | |
6305 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | |
6306 LABEL_720: | |
486 | 6307 v377->SetCondition(1, 0); |
0 | 6308 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6309 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6310 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6311 |
0 | 6312 case 42: |
822 | 6313 v442 = v731 - 2; |
0 | 6314 if ( !v442 ) |
6315 goto LABEL_855; | |
6316 v443 = v442 - 1; | |
6317 if ( v443 ) | |
6318 { | |
6319 if ( v443 == 1 ) | |
6320 v444 = 4 * v2; | |
6321 else | |
6322 LABEL_855: | |
6323 v444 = 2 * v2; | |
6324 } | |
6325 else | |
6326 { | |
6327 v444 = 3 * v2; | |
6328 } | |
6329 amount = v444; | |
6330 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6331 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6332 v445 = PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6333 if (PID_TYPE(a2) == OBJECT_Item) |
0 | 6334 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6335 v449 = (char *)&pSpriteObjects[v445].stru_24; |
0 | 6336 v450 = *(int *)v449; |
6337 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6338 { | |
6339 party_finds_gold(*((int *)v449 + 3), 0); | |
6340 viewparams->bRedrawGameUI = 1; | |
6341 } | |
6342 else | |
6343 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6344 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
0 | 6345 ShowStatusBarString(pTmpBuf2, 2u); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6346 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6347 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); |
0 | 6348 } |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6349 SpriteObject::OnInteraction(v445); |
0 | 6350 } |
6351 else | |
6352 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6353 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 6354 { |
6355 stru_50C198.LootActor(&pActors[v445]); | |
6356 } | |
6357 else | |
6358 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6359 if (PID_TYPE(a2) != OBJECT_Decoration) |
0 | 6360 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6361 if (PID_TYPE(a2) != OBJECT_BModel) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6362 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6363 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6364 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6365 } |
0 | 6366 dword_507CD8 = 1; |
6367 v677 = 1; | |
6368 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6369 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6370 else | |
6371 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6372 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6373 EventProcessor(v446, a2, v677); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6374 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6375 goto play_sound_and_continue; |
0 | 6376 } |
6377 v447 = &pLevelDecorations[v445]; | |
6378 dword_507CD8 = 1; | |
6379 v448 = v447->field_16_event_id; | |
486 | 6380 if (v448) |
0 | 6381 { |
6382 v677 = 1; | |
6383 v446 = v448; | |
6384 EventProcessor(v446, a2, v677); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6385 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6386 goto play_sound_and_continue; |
0 | 6387 } |
6388 if ( v447->IsInteractive() ) | |
6389 { | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
6390 activeLevelDecoration = v447; |
0 | 6391 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
6392 activeLevelDecoration = NULL; |
0 | 6393 } |
6394 } | |
6395 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6396 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6397 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6398 |
0 | 6399 case 67: |
822 | 6400 v451 = v731 - 2; |
0 | 6401 if ( v451 ) |
6402 { | |
6403 v452 = v451 - 1; | |
6404 if ( v452 ) | |
6405 { | |
6406 if ( v452 == 1 ) | |
6407 { | |
486 | 6408 amount = 0; |
0 | 6409 goto LABEL_883; |
6410 } | |
6411 v453 = 180 * v2; | |
6412 } | |
6413 else | |
6414 { | |
6415 v453 = 86400 * v2; | |
6416 } | |
6417 } | |
6418 else | |
6419 { | |
6420 v453 = 3600 * v2; | |
6421 } | |
6422 amount = v453; | |
6423 LABEL_883: | |
6424 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6425 goto play_sound_and_continue; |
6426 | |
6427 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6428 v323 = v3->uPlayerID_2; |
6429 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
6430 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6431 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6432 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6433 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6434 } |
0 | 6435 if ( v731 == 4 ) |
6436 { | |
486 | 6437 *(int *)v324 = 0; |
6438 *((int *)v324 + 1) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6439 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6440 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6441 } |
0 | 6442 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6443 v656 = 1; | |
6444 LABEL_640: | |
6445 v325 = &pParty->pPlayers[v323]; | |
6446 goto LABEL_641; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6447 |
0 | 6448 case 68: |
822 | 6449 v457 = v731 - 2; |
0 | 6450 if ( v457 ) |
6451 { | |
6452 v458 = v457 - 1; | |
6453 if ( v458 ) | |
6454 { | |
6455 if ( v458 == 1 ) | |
6456 v459 = 5 * v2 + 5; | |
6457 else | |
6458 v459 = 2 * v2 + 5; | |
6459 } | |
6460 else | |
6461 { | |
6462 v459 = 4 * v2 + 5; | |
6463 } | |
6464 } | |
6465 else | |
6466 { | |
6467 v459 = 3 * v2 + 5; | |
6468 } | |
6469 amount = v459; | |
6470 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6471 goto play_sound_and_continue; |
6472 v460 = v3->spell_target_pid; | |
486 | 6473 if (!v460) |
0 | 6474 { |
6475 pParty->pPlayers[v3->uPlayerID_2].Heal(amount); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6476 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
0 | 6477 } |
6478 else | |
6479 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6480 if (PID_TYPE(v460) == OBJECT_Actor) |
0 | 6481 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6482 v461 = &pActors[PID_ID(v460)]; |
0 | 6483 v462 = v461->uAIState; |
6484 v463 = v461->pMonsterInfo.uHP; | |
6485 if ( v462 != 5 ) | |
6486 { | |
6487 if ( v462 != 4 ) | |
6488 { | |
6489 if ( v462 != 19 ) | |
6490 { | |
6491 if ( v462 != 11 ) | |
6492 { | |
6493 v461->sCurrentHP += amount; | |
6494 if ( v461->sCurrentHP > v463 ) | |
6495 v461->sCurrentHP = v463; | |
6496 } | |
6497 } | |
6498 } | |
6499 } | |
6500 } | |
6501 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6502 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6503 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6504 |
0 | 6505 case 72: |
822 | 6506 v464 = v731 - 2; |
0 | 6507 if ( !v464 ) |
6508 goto LABEL_910; | |
6509 v465 = v464 - 1; | |
6510 if ( v465 ) | |
6511 { | |
6512 if ( v465 == 1 ) | |
6513 { | |
486 | 6514 amount = 0; |
0 | 6515 goto LABEL_912; |
6516 } | |
6517 LABEL_910: | |
6518 v466 = 3600 * v2; | |
6519 } | |
6520 else | |
6521 { | |
6522 v466 = 86400 * v2; | |
6523 } | |
6524 amount = v466; | |
6525 LABEL_912: | |
6526 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6527 goto play_sound_and_continue; |
6528 | |
6529 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6530 v470 = v3->uPlayerID_2; |
6531 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
6532 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6533 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6534 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6535 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6536 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6537 } |
0 | 6538 if ( v731 == 4 ) |
6539 { | |
486 | 6540 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; |
6541 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
0 | 6542 v471 = v3->uPlayerID_2; |
486 | 6543 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6544 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
0 | 6545 v472 = v3->uPlayerID_2; |
486 | 6546 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6547 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6548 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6549 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6550 } |
0 | 6551 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
6552 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6553 6u, | |
6554 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6555 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6556 8u, | |
6557 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6558 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6559 v656 = 10; | |
6560 goto LABEL_937; | |
488 | 6561 |
6562 | |
0 | 6563 case 75: |
6564 amount = v2; | |
6565 LODWORD(v733) = 3600 * v2; | |
6566 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6567 goto play_sound_and_continue; |
6568 | |
6569 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6570 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6571 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6572 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6573 | |
6574 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6575 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6576 goto play_sound_and_continue; |
488 | 6577 |
0 | 6578 case 73: |
6579 LODWORD(v733) = 3600 * v2; | |
6580 amount = v2; | |
6581 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6582 goto play_sound_and_continue; |
0 | 6583 if ( v731 == 4 ) |
6584 { | |
488 | 6585 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
6586 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6587 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6588 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
0 | 6589 v732 = (int)v733 << 7; |
6590 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
488 | 6591 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); |
6592 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6593 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6594 | |
6595 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6596 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6597 goto play_sound_and_continue; |
488 | 6598 } |
6599 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6600 | |
6601 pParty->pPlayers[v3->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); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6602 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6603 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6604 |
0 | 6605 case 74: |
822 | 6606 v493 = v731 - 2; |
0 | 6607 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) |
486 | 6608 amount = 0; |
0 | 6609 else |
6610 amount = 86400 * v2; | |
6611 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6612 goto play_sound_and_continue; |
6613 | |
6614 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6615 v498 = v3->uPlayerID_2; |
6616 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
6617 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6618 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6619 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6620 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6621 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6622 } |
0 | 6623 if ( v731 == 4 ) |
6624 { | |
486 | 6625 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; |
6626 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
0 | 6627 v499 = v3->uPlayerID_2; |
486 | 6628 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6629 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
0 | 6630 v500 = v3->uPlayerID_2; |
486 | 6631 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6632 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
0 | 6633 } |
6634 else | |
6635 { | |
6636 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6637 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6638 7u, | |
6639 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6640 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6641 9u, | |
6642 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6643 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6644 v656 = 11; | |
6645 LABEL_937: | |
112 | 6646 v325 = &pParty->pPlayers[v3->uPlayerID_2]; |
0 | 6647 LABEL_641: |
6648 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6649 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6650 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6651 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6652 |
0 | 6653 case 77: |
486 | 6654 { |
0 | 6655 amount = 5 * v2 + 10; |
6656 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6657 goto play_sound_and_continue; |
0 | 6658 v501 = pParty->pPlayers; |
486 | 6659 int v1 = 0; |
0 | 6660 do |
6661 { | |
488 | 6662 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); |
0 | 6663 v501->Heal(amount); |
6664 ++v501; | |
6665 ++v1; | |
6666 } | |
6667 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6668 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6669 goto play_sound_and_continue; |
486 | 6670 } |
0 | 6671 case 80: |
6672 sRecoveryTime -= v2; | |
6673 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6674 goto play_sound_and_continue; |
6675 | |
0 | 6676 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); |
6677 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6678 ++a1.uType; |
0 | 6679 HIDWORD(v733) = v505; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6680 v688.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6681 v688.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6682 v688.z = 0; |
0 | 6683 a1.stru_24.Reset(); |
822 | 6684 a1.spell_id = v3->spellnum; |
6685 a1.spell_level = v2; | |
6686 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6687 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 6688 a1.uAttributes = 0; |
6689 a1.uSectorID = 0; | |
6690 a1.uSpriteFrameID = 0; | |
0 | 6691 a1.field_60_distance_related_prolly_lod = 0; |
486 | 6692 a1.uFacing = 0; |
823 | 6693 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
6694 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 6695 a2 = 0; |
6696 if ( SHIDWORD(v733) > 0 ) | |
0 | 6697 { |
6698 do | |
6699 { | |
6700 v507 = dword_50BF30[a2]; | |
6701 a1.vPosition.x = pActors[v507].vPosition.x; | |
6702 a1.vPosition.y = pActors[v507].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6703 a1.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6704 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6705 v509 = a1.Create(0, 0, 0, 0); |
0 | 6706 v510 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6707 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); |
0 | 6708 a2 = v510 + 1; |
6709 } | |
6710 while ( v510 + 1 < SHIDWORD(v733) ); | |
6711 } | |
486 | 6712 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) |
0 | 6713 { |
6714 v511 = &pActors[dword_50BF30[a2]]; | |
6715 a1.vPosition.x = v511->vPosition.x; | |
6716 a1.vPosition.y = v511->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6717 a1.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6718 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6719 a1.Create(0, 0, 0, 0); |
0 | 6720 v513 = v511->pActorBuffs; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6721 for (int _v726 = 22; _v726 != 0; --_v726) |
0 | 6722 { |
6723 v513->Reset(); | |
6724 ++v513; | |
6725 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6726 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6727 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6728 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6729 |
0 | 6730 case 82: |
822 | 6731 v514 = v731 - 2; |
0 | 6732 if ( !v514 ) |
6733 goto LABEL_955; | |
6734 v515 = v514 - 1; | |
6735 if ( v515 ) | |
6736 { | |
6737 if ( v515 == 1 ) | |
6738 { | |
6739 v516 = 900 * v2; | |
6740 amount = 5; | |
6741 } | |
6742 else | |
6743 { | |
6744 LABEL_955: | |
6745 v516 = 300 * v2; | |
6746 amount = 1; | |
6747 } | |
6748 } | |
6749 else | |
6750 { | |
6751 v516 = 900 * v2; | |
6752 amount = 3; | |
6753 } | |
486 | 6754 v733 = __PAIR__(0, v516); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6755 |
486 | 6756 if ( (signed int)uNumActors > 0 ) |
0 | 6757 { |
90 | 6758 v518 = pActors;//[0].uAIState; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6759 auto _v726 = uNumActors; |
0 | 6760 do |
6761 { | |
90 | 6762 v519 = v518->uAIState; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6763 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, v3->uPlayerID) == v518->uSummonerID ) |
0 | 6764 ++HIDWORD(v733); |
90 | 6765 ++v518; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6766 --_v726; |
0 | 6767 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6768 while ( _v726 != 0 ); |
0 | 6769 } |
6770 if ( SHIDWORD(v733) >= amount ) | |
6771 { | |
710 | 6772 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! |
6773 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6774 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6775 goto LABEL_1166; |
0 | 6776 } |
6777 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6778 goto play_sound_and_continue; |
0 | 6779 sub_44FA4C_spawn_light_elemental(v3->uPlayerID, v731, v733); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6780 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6781 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6782 |
0 | 6783 case 83: |
822 | 6784 v520 = v731 - 2; |
0 | 6785 if ( !v520 ) |
6786 goto LABEL_973; | |
6787 v521 = v520 - 1; | |
6788 if ( v521 ) | |
6789 { | |
6790 if ( v521 == 1 ) | |
6791 { | |
6792 LODWORD(v733) = 18000 * v2; | |
6793 v522 = 5 * v2 + 10; | |
6794 } | |
6795 else | |
6796 { | |
6797 LABEL_973: | |
6798 LODWORD(v733) = 10800 * v2; | |
6799 v522 = 3 * v2 + 10; | |
6800 } | |
6801 } | |
6802 else | |
6803 { | |
6804 LODWORD(v733) = 14400 * v2; | |
6805 v522 = 4 * v2 + 10; | |
6806 } | |
6807 amount = v522; | |
6808 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6809 goto play_sound_and_continue; |
6810 | |
6811 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6812 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6813 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6814 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6815 | |
6816 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6817 LODWORD(v727) = 1; |
488 | 6818 goto play_sound_and_continue; |
6819 | |
0 | 6820 case 84: |
710 | 6821 //v67 = 2; |
0 | 6822 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
6823 { | |
710 | 6824 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! |
6825 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6826 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6827 goto LABEL_1166; |
0 | 6828 } |
6829 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6830 goto play_sound_and_continue; |
0 | 6831 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6832 ++a1.uType; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6833 v694.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6834 v694.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6835 v694.z = 0; |
0 | 6836 a1.stru_24.Reset(); |
822 | 6837 a1.spell_id = v3->spellnum; |
6838 a1.spell_level = v2; | |
6839 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6840 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 6841 a1.uAttributes = 0; |
6842 a1.uSectorID = 0; | |
6843 a1.uSpriteFrameID = 0; | |
0 | 6844 a1.field_60_distance_related_prolly_lod = 0; |
486 | 6845 a1.uFacing = 0; |
823 | 6846 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
6847 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 6848 a2 = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6849 if ( (signed int)v531 > 0 ) |
0 | 6850 { |
6851 do | |
6852 { | |
6853 v533 = dword_50BF30[a2]; | |
6854 a1.vPosition.x = pActors[v533].vPosition.x; | |
6855 a1.vPosition.y = pActors[v533].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6856 a1.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6857 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6858 v535 = a1.Create(0, 0, 0, 0); |
0 | 6859 v536 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6860 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); |
0 | 6861 a2 = v536 + 1; |
6862 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6863 while ( v536 + 1 < (signed int)v531 ); |
0 | 6864 } |
6865 v537 = pGame->GetStru6(); | |
6866 pGame->GetStru6()->_4A8BFC(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6867 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6868 goto play_sound_and_continue; |
488 | 6869 |
6870 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6871 { |
822 | 6872 v538 = v731 - 2; |
0 | 6873 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) |
6874 { | |
6875 amount = 5 * v2; | |
6876 v540 = 18000 * v2; | |
6877 } | |
6878 else | |
6879 { | |
6880 amount = 4 * v2; | |
6881 v540 = 14400 * v2; | |
6882 } | |
6883 v730 = v540; | |
6884 LODWORD(v733) = v540; | |
6885 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6886 goto play_sound_and_continue; |
6887 | |
6888 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6889 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6890 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6891 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6892 | |
0 | 6893 v732 = v730 << 7; |
6894 v549 = (double)(v730 << 7) * 0.033333335; | |
6895 *((float *)&v733 + 1) = v549; | |
6896 v712 = (signed __int64)v549; | |
488 | 6897 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); |
6898 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6899 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6900 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6901 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6902 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
0 | 6903 v550 = v2 + 5; |
488 | 6904 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( |
0 | 6905 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), |
6906 v731, | |
486 | 6907 v550, 0, 0); |
488 | 6908 |
6909 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6910 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6911 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6912 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6913 |
0 | 6914 case 86: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6915 { |
822 | 6916 v551 = v731 - 2; |
0 | 6917 if ( !v551 ) |
6918 goto LABEL_998; | |
6919 v552 = v551 - 1; | |
6920 if ( v552 ) | |
6921 { | |
6922 if ( v552 == 1 ) | |
6923 { | |
6924 amount = 15; | |
6925 HIDWORD(v733) = 20; | |
6926 goto LABEL_1000; | |
6927 } | |
6928 LABEL_998: | |
6929 v678 = 4; | |
6930 } | |
6931 else | |
6932 { | |
6933 v678 = 12; | |
6934 } | |
6935 amount = v678; | |
6936 HIDWORD(v733) = v678; | |
6937 LABEL_1000: | |
6938 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6939 goto play_sound_and_continue; |
0 | 6940 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); |
6941 v732 = (300 * amount * v2 + 60) << 7; | |
6942 v730 = v2 + 5; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6943 int _v726 = 0; |
89 | 6944 v553 = pParty->pPlayers;//[0].pConditions[1]; |
0 | 6945 *((float *)&v733 + 1) = (double)v732 * 0.033333335; |
6946 do | |
6947 { | |
488 | 6948 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
6949 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6950 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6951 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6952 | |
89 | 6953 //((SpellBuff *)(v553 + 6056))->Apply( |
488 | 6954 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); |
0 | 6955 if ( *(_QWORD *)v553 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6956 _v726 = 1; |
89 | 6957 ++v553; |
6958 } | |
6959 while ( v553 <= &pParty->pPlayers[3] ); | |
0 | 6960 v562 = v731; |
488 | 6961 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); |
6962 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6963 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6964 if (!_v726) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6965 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6966 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); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6967 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6968 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6969 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6970 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6971 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6972 |
0 | 6973 case 88: |
6974 amount = 3; | |
6975 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
710 | 6976 { |
6977 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6978 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6979 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6980 goto LABEL_1166; |
710 | 6981 } |
0 | 6982 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 6983 goto play_sound_and_continue; |
486 | 6984 a2 = 0; |
0 | 6985 _this = (ItemGen *)&pPlayers[1]; |
6986 do | |
6987 { | |
6988 v563 = 0; | |
6989 do | |
6990 { | |
6991 v564 = _this->uItemID; | |
486 | 6992 *(int *)(v563 + _this->uItemID) = 0; |
0 | 6993 v563 += 8; |
486 | 6994 *(int *)(v563 + v564 - 4) = 0; |
0 | 6995 } |
6996 while ( v563 <= 128 ); | |
6997 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6998 v566 = (Player **)_this; | |
6999 *(int *)(_this->uItemID + 6460) = v565; | |
7000 v567 = (*v566)->GetMaxMana(); | |
7001 *(int *)(_this->uItemID + 6464) = v567; | |
488 | 7002 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); |
0 | 7003 ++a2; |
7004 _this = (ItemGen *)((char *)_this + 4); | |
7005 } | |
7006 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
7007 v571 = pPlayer; | |
7008 v572 = (char *)&pPlayer->sAgeModifier; | |
7009 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
7010 *(short *)v572 = 120; | |
7011 else | |
7012 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
7013 sRecoveryTime += -5 * v2; | |
7014 ++v571->uNumDivineInterventionCastsThisDay; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7015 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7016 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7017 |
0 | 7018 case 89: |
822 | 7019 v573 = v731 - 2; |
0 | 7020 if ( v573 ) |
7021 { | |
7022 v574 = v573 - 1; | |
7023 if ( v574 ) | |
7024 { | |
7025 if ( v574 == 1 ) | |
7026 v575 = 5 * v2; | |
7027 else | |
7028 v575 = 2 * v2; | |
7029 } | |
7030 else | |
7031 { | |
7032 v575 = 4 * v2; | |
7033 } | |
7034 } | |
7035 else | |
7036 { | |
7037 v575 = 3 * v2; | |
7038 } | |
7039 amount = v575; | |
7040 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7041 goto play_sound_and_continue; |
7042 v576 = v3->spell_target_pid; | |
486 | 7043 if (!v576) |
0 | 7044 { |
7045 v585 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
488 | 7046 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
0 | 7047 if ( *((_QWORD *)v585 + 14) ) |
7048 { | |
7049 ((Player *)v585)->SetCondition(0x11u, 1); | |
7050 v587 = ((Player *)v585)->GetSexByVoice(); | |
7051 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); | |
7052 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
7053 } | |
488 | 7054 goto play_sound_and_continue; |
0 | 7055 } |
7056 v577 = (Player *)(v576 >> 3); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7057 //v726 = v577; |
0 | 7058 if ( v577 == (Player *)-1 ) |
7059 { | |
710 | 7060 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! |
7061 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7062 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7063 goto LABEL_1166; |
0 | 7064 } |
7065 v578 = (int)&pActors[(int)v577]; | |
7066 v721 = v578; | |
486 | 7067 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) |
710 | 7068 { |
7069 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7070 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7071 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7072 goto LABEL_1166; |
710 | 7073 } |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7074 ++a1.uType; |
0 | 7075 a1.stru_24.Reset(); |
822 | 7076 a1.spell_id = v3->spellnum; |
7077 a1.spell_level = v2; | |
7078 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7079 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 7080 a1.uAttributes = 0; |
7081 a1.uSectorID = 0; | |
7082 a1.uSpriteFrameID = 0; | |
0 | 7083 a1.field_60_distance_related_prolly_lod = 0; |
7084 v581 = v721; | |
486 | 7085 a1.uFacing = 0; |
823 | 7086 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7087 a1.uSoundID = LOWORD(v3->sound_id); | |
0 | 7088 a1.vPosition.x = *(short *)(v721 + 142); |
7089 a1.vPosition.y = *(short *)(v721 + 144); | |
7090 v732 = *(short *)(v721 + 138); | |
7091 a1.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7092 a1.spell_target_pid = PID(OBJECT_Actor, (int)v577); |
486 | 7093 a1.Create(0, 0, 0, 0); |
0 | 7094 if ( *(char *)(v581 + 52) > amount ) |
488 | 7095 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7096 Actor::Resurrect((unsigned int)v577); |
0 | 7097 *(char *)(v581 + 61) = 0; |
7098 *(char *)(v581 + 53) = 0; | |
7099 *(char *)(v581 + 54) = 0; | |
7100 *(char *)(v581 + 55) = 0; | |
7101 *(char *)(v581 + 56) = 0; | |
7102 *(char *)(v581 + 57) = 0; | |
7103 *(int *)(v581 + 712) = 9999; | |
7104 *(char *)(v581 + 38) &= 0xF7u; | |
486 | 7105 *(int *)(v581 + 708) = 0; |
0 | 7106 ((SpellBuff *)(v581 + 356))->Reset(); |
7107 ((SpellBuff *)(v581 + 228))->Reset(); | |
7108 ((SpellBuff *)(v581 + 404))->Reset(); | |
7109 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7110 *(short *)(v581 + 40) = 10 * amount; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7111 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7112 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7113 |
0 | 7114 case 91: |
822 | 7115 v588 = v731 - 1; |
0 | 7116 amount = 16; |
7117 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7118 { | |
7119 if ( v590 == 1 ) | |
486 | 7120 LODWORD(v733) = 0; |
0 | 7121 } |
7122 else | |
7123 { | |
7124 LODWORD(v733) = 3600 * v2; | |
7125 } | |
7126 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7127 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7128 __debugbreak(); |
0 | 7129 HIDWORD(v733) = (int)(char *)&pParty + 6972 * v3->uPlayerID_2 + 36 * a2 + 3040; |
7130 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; | |
7131 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7132 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7133 || *(char *)(HIDWORD(v733) + 20) & 2 | |
486 | 7134 || *(int *)(HIDWORD(v733) + 12) != 0 |
7135 || *(int *)(HIDWORD(v733) + 4) != 0 | |
0 | 7136 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 |
377 | 7137 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) |
710 | 7138 { |
7139 dword_50C9D0 = 113; | |
7140 dword_50C9D4 = 0; | |
7141 dword_50C9D8 = 1; | |
7142 | |
7143 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7144 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7145 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7146 goto LABEL_1166; |
710 | 7147 } |
0 | 7148 v592 = HIDWORD(v733); |
7149 v14 = v731 == 4; | |
7150 *(int *)(HIDWORD(v733) + 12) = 16; | |
7151 if ( !v14 ) | |
7152 { | |
7153 v732 = (int)v733 << 7; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7154 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
0 | 7155 *(int *)(v592 + 20) |= 8u; |
7156 } | |
7157 *(char *)(v592 + 20) |= 0x80u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7158 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7159 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7160 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7161 |
0 | 7162 case 93: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7163 { |
822 | 7164 v593 = v731 - 2; |
0 | 7165 if ( !v593 ) |
7166 goto LABEL_1062; | |
7167 v594 = v593 - 1; | |
7168 if ( v594 ) | |
7169 { | |
7170 if ( v594 == 1 ) | |
7171 amount = 9; | |
7172 else | |
7173 LABEL_1062: | |
7174 amount = 5; | |
7175 } | |
7176 else | |
7177 { | |
7178 amount = 7; | |
7179 } | |
7180 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7181 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7182 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); |
0 | 7183 a1.stru_24.Reset(); |
822 | 7184 a1.spell_id = v3->spellnum; |
7185 a1.spell_level = v2; | |
7186 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7187 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 7188 a1.vPosition.x = pParty->vPosition.x; |
7189 a1.vPosition.y = pParty->vPosition.y; | |
486 | 7190 a1.uAttributes = 0; |
0 | 7191 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
7192 a1.uSectorID = pIndoor->GetSector( | |
7193 pParty->vPosition.x, | |
7194 pParty->vPosition.y, | |
7195 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
486 | 7196 a1.uSpriteFrameID = 0; |
823 | 7197 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7198 a1.spell_target_pid = a2; | |
0 | 7199 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
823 | 7200 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 7201 if ( pParty->bTurnBasedModeOn == 1 ) |
7202 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7203 v596 = (signed int)_v726 / -2; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7204 y = (char *)((signed int)_v726 / 2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7205 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) |
0 | 7206 { |
7207 v597 = v715.uYawAngle; | |
7208 do | |
7209 { | |
7210 a1.uFacing = v596 + v597; | |
7211 if ( a1.Create( | |
7212 v596 + v597, | |
7213 v715.uPitchAngle, | |
7214 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
7215 v3->uPlayerID + 1) != -1 | |
7216 && pParty->bTurnBasedModeOn == 1 ) | |
7217 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7218 v596 += _v726 / (amount - 1); |
0 | 7219 } |
7220 while ( v596 <= (signed int)y ); | |
7221 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7222 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7223 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7224 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7225 |
0 | 7226 case 94: |
7227 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7228 goto play_sound_and_continue; |
0 | 7229 if ( v731 == 1 || v731 == 2 ) |
7230 { | |
7231 v598 = 180 * v2; | |
7232 goto LABEL_1081; | |
7233 } | |
7234 if ( v731 == 3 ) | |
7235 { | |
7236 v598 = 300 * v2; | |
7237 LABEL_1081: | |
7238 LODWORD(v733) = v598; | |
7239 goto LABEL_1082; | |
7240 } | |
7241 if ( v731 == 4 ) | |
7242 LODWORD(v733) = 29030400; | |
7243 LABEL_1082: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7244 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7245 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7246 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7247 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7248 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7249 v730 = 836 * PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7250 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7251 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7252 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) |
710 | 7253 { |
7254 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7255 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7256 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7257 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7258 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7259 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7260 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7261 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), |
486 | 7262 v731, 0, 0, 0); |
0 | 7263 a1.stru_24.Reset(); |
822 | 7264 a1.spell_id = v3->spellnum; |
7265 a1.spell_level = v2; | |
7266 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7267 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7268 v61 = PID_ID(a2); |
0 | 7269 LABEL_1086: |
90 | 7270 v600 = pActors[v61].vPosition.y; |
7271 v601 = pActors[v61].vPosition.x; | |
0 | 7272 a1.uObjectDescID = v60; |
7273 a1.vPosition.x = v601; | |
90 | 7274 v602 = pActors[v61].uActorHeight; |
7275 v603 = pActors[v61].vPosition.z; | |
0 | 7276 a1.vPosition.y = v600; |
7277 v676 = v603 + v602; | |
7278 v665 = v600; | |
7279 a1.vPosition.z = v603 + v602; | |
7280 v657 = v601; | |
7281 LABEL_1087: | |
486 | 7282 a1.uAttributes = 0; |
0 | 7283 a1.uSectorID = pIndoor->GetSector(v657, v665, v676); |
486 | 7284 a1.uSpriteFrameID = 0; |
823 | 7285 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7286 a1.spell_target_pid = a2; | |
0 | 7287 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
7288 a1.uFacing = LOWORD(v715.uYawAngle); | |
7289 LOBYTE(a1.uAttributes) |= 0x80u; | |
823 | 7290 a1.uSoundID = LOWORD(v3->sound_id); |
486 | 7291 a1.Create(0, 0, 0, v3->uPlayerID + 1); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7292 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7293 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7294 |
0 | 7295 case 96: |
7296 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7297 goto play_sound_and_continue; |
486 | 7298 HIDWORD(v733) = 0; |
521 | 7299 memset(&achievedAwardsIndex, 0, 4000); |
486 | 7300 _this = 0; |
0 | 7301 v605 = (char *)pParty->pHirelings; |
7302 do | |
7303 { | |
486 | 7304 if ( *(int *)v605) |
0 | 7305 { |
7306 v606 = HIDWORD(v733)++; | |
521 | 7307 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); |
0 | 7308 } |
7309 _this = (ItemGen *)((char *)_this + 1); | |
7310 v605 += 76; | |
7311 } | |
7312 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
486 | 7313 _this = 0; |
7314 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
0 | 7315 { |
7316 v730 = (int)pNPCStats->pNewNPCData; | |
7317 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
7318 do | |
7319 { | |
7320 if ( *(char *)(v730 + 8) & 0x80 | |
486 | 7321 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) |
7322 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
0 | 7323 { |
7324 v607 = HIDWORD(v733); | |
7325 HIDWORD(v733) += 4; | |
7326 *(int *)v607 = (int)_this + 3; | |
7327 } | |
7328 _this = (ItemGen *)((char *)_this + 1); | |
7329 v730 += 76; | |
7330 } | |
7331 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7332 } | |
7333 v608 = v3->uPlayerID_2; | |
7334 if ( v608 != 4 && v608 != 5 | |
486 | 7335 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) |
0 | 7336 || v609 >= 3 ) |
710 | 7337 { |
7338 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7339 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7340 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7341 goto LABEL_1166; |
710 | 7342 } |
0 | 7343 v610 = 76 * v609; |
486 | 7344 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; |
0 | 7345 v611 = pIconsFrameTable->FindIcon("spell96"); |
488 | 7346 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); |
0 | 7347 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; |
89 | 7348 v612 = pParty->pPlayers; |
0 | 7349 do |
7350 { | |
89 | 7351 v612->sHealth = v612->GetMaxHealth(); |
7352 v612->sMana = v612->GetMaxMana(); | |
7353 ++v612; | |
7354 } | |
7355 while ( v612 <= &pParty->pPlayers[3] ); | |
7356 v613 = &pOutdoor->ddm; | |
0 | 7357 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) |
89 | 7358 v613 = &pIndoor->dlv; |
7359 v613->uReputation += 15; | |
7360 if ( v613->uReputation > 10000 ) | |
7361 v613->uReputation = 10000; | |
488 | 7362 LODWORD(v727) = 1; |
7363 goto play_sound_and_continue; | |
0 | 7364 case 95: |
822 | 7365 if ( v731 <= 0 ) |
0 | 7366 goto LABEL_1119; |
822 | 7367 if ( v731 <= 3 ) |
0 | 7368 { |
7369 v614 = 300 * (v2 + 12); | |
7370 } | |
7371 else | |
7372 { | |
822 | 7373 if ( v731 != 4 ) |
0 | 7374 goto LABEL_1119; |
7375 v614 = 900 * (v2 + 4); | |
7376 } | |
7377 LODWORD(v733) = v614; | |
7378 LABEL_1119: | |
7379 v615 = v2 + 5; | |
7380 amount = v615; | |
7381 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7382 goto play_sound_and_continue; |
0 | 7383 if ( v731 != 3 && v731 != 4 ) |
7384 { | |
488 | 7385 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
7386 | |
7387 pParty->pPlayers[v3->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); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7388 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7389 goto play_sound_and_continue; |
0 | 7390 } |
486 | 7391 a2 = 0; |
0 | 7392 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
112 | 7393 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; |
0 | 7394 do |
7395 { | |
488 | 7396 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); |
7397 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
0 | 7398 ++a2; |
112 | 7399 ++v619; |
7400 } | |
7401 while ( v619 <= &pParty->pPlayers[3] ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7402 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7403 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7404 |
0 | 7405 case 99: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7406 { |
0 | 7407 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 7408 goto play_sound_and_continue; |
0 | 7409 pGame->GetIndoorCamera(); |
7410 v623 = (signed __int64)GetPickDepth(); | |
7411 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7412 v707.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7413 v707.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7414 v707.z = 0; |
0 | 7415 a1.stru_24.Reset(); |
822 | 7416 a1.spell_id = v3->spellnum; |
7417 a1.spell_level = v2; | |
7418 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7419 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 7420 a1.uAttributes = 0; |
7421 a1.uSectorID = 0; | |
7422 a1.uSpriteFrameID = 0; | |
0 | 7423 a1.field_60_distance_related_prolly_lod = 0; |
486 | 7424 a1.uFacing = 0; |
823 | 7425 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7426 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 7427 a2 = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7428 int _v726 = 0; |
486 | 7429 if ( SHIDWORD(v733) > 0 ) |
0 | 7430 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7431 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); |
0 | 7432 do |
7433 { | |
7434 v625 = dword_50BF30[a2]; | |
7435 a1.vPosition.x = pActors[v625].vPosition.x; | |
7436 a1.vPosition.y = pActors[v625].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7437 //v732 = pActors[v625].uActorHeight; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7438 a1.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7439 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 7440 v627 = a1.Create(0, 0, 0, 0); |
0 | 7441 v628 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7442 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); |
0 | 7443 a2 = v628 + 1; |
7444 } | |
7445 while ( v628 + 1 < SHIDWORD(v733) ); | |
7446 } | |
486 | 7447 v730 = 0; |
0 | 7448 v629 = 1; |
7449 do | |
7450 { | |
7451 v630 = pPlayers[v629]; | |
7452 if ( !v630->pConditions[2] | |
7453 && !v630->pConditions[12] | |
7454 && !v630->pConditions[13] | |
7455 && !v630->pConditions[14] | |
7456 && !v630->pConditions[15] | |
7457 && !v630->pConditions[16] ) | |
7458 { | |
7459 v631 = v730++; | |
7460 v681[v631] = v629; | |
7461 } | |
7462 ++v629; | |
7463 } | |
7464 while ( v629 <= 4 ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7465 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); |
486 | 7466 HIDWORD(v733) = 0; |
7467 if ( v730 > 0 ) | |
0 | 7468 { |
7469 do | |
7470 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7471 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7472 v726 = pPlayers[v681[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7473 //v633 = pPlayers[v681[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7474 v726->sHealth += v732; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7475 //v726 = *(Player **)v632; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7476 //v634 = v726->GetMaxHealth(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7477 if ( v726->sHealth > v726->GetMaxHealth()) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7478 v726->sHealth = v726->GetMaxHealth(); |
0 | 7479 v635 = HIDWORD(v733); |
488 | 7480 |
7481 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, WORD2(v733)); | |
0 | 7482 HIDWORD(v733) = v635 + 1; |
7483 } | |
7484 while ( v635 + 1 < v730 ); | |
7485 } | |
486 | 7486 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7487 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7488 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7489 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7490 |
0 | 7491 case 98: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7492 { |
0 | 7493 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
7494 { | |
710 | 7495 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! |
7496 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7497 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7498 goto LABEL_1166; |
0 | 7499 } |
822 | 7500 v640 = v731 - 2; |
0 | 7501 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) |
7502 amount = 3; | |
486 | 7503 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) |
710 | 7504 { |
7505 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7506 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7507 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7508 goto LABEL_1166; |
710 | 7509 } |
0 | 7510 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 7511 goto play_sound_and_continue; |
349 | 7512 pParty->armageddon_timer = 256; |
0 | 7513 pParty->field_16140 = v2; |
7514 ++pPlayer->uNumArmageddonCasts; | |
7515 if ( pParty->bTurnBasedModeOn == 1 ) | |
7516 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7517 auto _v726 = 50; |
0 | 7518 do |
7519 { | |
7520 v642 = rand() % 4096 - 2048; | |
7521 v643 = rand(); | |
7522 v721 = v642 + pParty->vPosition.x; | |
7523 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
486 | 7524 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); |
0 | 7525 v644 = rand(); |
486 | 7526 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7527 --_v726; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7528 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7529 while ( _v726 != 0 ); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7530 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7531 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7532 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7533 |
0 | 7534 default: |
488 | 7535 goto play_sound_and_continue; |
0 | 7536 } |
7537 while ( 2 ) | |
7538 { | |
7539 if ( v731 == 4 ) | |
7540 { | |
7541 if ( *((_QWORD *)v222 + 2) ) | |
7542 { | |
486 | 7543 *((int *)v222 + 4) = 0; |
7544 *((int *)v222 + 5) = 0; | |
0 | 7545 goto LABEL_439; |
7546 } | |
7547 } | |
7548 else | |
7549 { | |
7550 v223 = ((Player *)v222)->DiscardConditionIfLastsLongerThan( | |
7551 2u, | |
7552 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
7553 v222 = (char *)HIDWORD(v733); | |
7554 if ( v223 ) | |
7555 LABEL_439: | |
486 | 7556 ((Player *)v222)->PlaySound(SPEECH_103, 0); |
0 | 7557 } |
7558 v222 += 6972; | |
7559 HIDWORD(v733) = (int)v222; | |
7560 if ( (signed int)v222 >= (signed int)pParty->pHirelings ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7561 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7562 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7563 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7564 } |
0 | 7565 continue; |
7566 } | |
7567 } | |
7568 //----- (0042EB42) -------------------------------------------------------- | |
7569 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7570 { | |
7571 unsigned int v2; // edx@1 | |
7572 signed int v3; // eax@1 | |
7573 char *v4; // ecx@2 | |
7574 | |
7575 v2 = this->uNumObjects; | |
7576 v3 = 0; | |
7577 if ( (signed int)this->uNumObjects <= 0 ) | |
7578 { | |
7579 LABEL_5: | |
7580 LOWORD(v3) = 0; | |
7581 } | |
7582 else | |
7583 { | |
7584 v4 = (char *)&this->pObjects->uObjectID; | |
7585 while ( uItemID != *(short *)v4 ) | |
7586 { | |
7587 ++v3; | |
7588 v4 += 56; | |
7589 if ( v3 >= (signed int)v2 ) | |
7590 goto LABEL_5; | |
7591 } | |
7592 } | |
7593 return v3; | |
7594 } | |
7595 | |
7596 //----- (0042EB78) -------------------------------------------------------- | |
7597 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7598 { | |
7599 return 8 * this->pIcons[uIconID].uAnimLength; | |
7600 } | |
7601 | |
437 | 7602 const wchar_t *UIMessage2String(UIMessageType msg) |
7603 { | |
7604 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7605 static wchar_t b[256]; // bad for threads | |
7606 switch (msg) | |
7607 { | |
7608 CASE(UIMSG_SelectSpell) | |
7609 CASE(UIMSG_ChangeGameState) | |
7610 CASE(UIMSG_Attack) | |
7611 CASE(UIMSG_PlayArcomage) | |
7612 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7613 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7614 CASE(UIMSG_ShowCredits) | |
7615 CASE(UIMSG_ExitToWindows) | |
7616 CASE(UIMSG_PlayerCreationChangeName) | |
7617 CASE(UIMSG_PlayerCreationClickPlus) | |
7618 CASE(UIMSG_PlayerCreationClickMinus) | |
7619 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7620 CASE(UIMSG_PlayerCreationSelectClass) | |
7621 CASE(UIMSG_PlayerCreationClickOK) | |
7622 CASE(UIMSG_PlayerCreationClickReset) | |
7623 CASE(UIMSG_AutonotesBook) | |
7624 CASE(UIMSG_PlayerCreationRemoveUpSkill) | |
7625 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7626 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7627 CASE(UIMSG_LoadGame) | |
7628 CASE(UIMSG_SaveGame) | |
7629 CASE(UIMSG_ShowStatus_DateTime) | |
7630 CASE(UIMSG_ShowStatus_ManaHP) | |
7631 CASE(UIMSG_ShowStatus_Player) | |
7632 CASE(UIMSG_Wait5Minutes) | |
7633 CASE(UIMSG_Wait1Hour) | |
7634 CASE(UIMSG_ShowStatus_Food) | |
7635 CASE(UIMSG_ShowStatus_Funds) | |
7636 CASE(UIMSG_QuickReference) | |
7637 CASE(UIMSG_GameMenuButton) | |
7638 CASE(UIMSG_AlreadyResting) | |
7639 CASE(UIMSG_SelectCharacter) | |
7640 CASE(UIMSG_ChangeSoundVolume) | |
7641 CASE(UIMSG_ChangeMusicVolume) | |
7642 CASE(UIMSG_Escape) | |
7643 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7644 CASE(UIMSG_InventoryLeftClick) | |
7645 CASE(UIMSG_SkillUp) | |
7646 CASE(UIMSG_GameMenu_ReturnToGame) | |
7647 CASE(UIMSG_StartNewGame) | |
7648 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7649 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7650 CASE(UIMSG_Game_OpenOptionsDialog) | |
7651 CASE(UIMSG_SetGraphicsMode) | |
7652 CASE(UIMSG_Quit) | |
7653 CASE(UIMSG_StartHireling1Dialogue) | |
7654 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7655 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7656 CASE(UIMSG_CastSpellFromBook) |
7657 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7658 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7659 CASE(UIMSG_StartNPCDialogue) | |
7660 CASE(UIMSG_ArrowUp) | |
7661 CASE(UIMSG_DownArrow) | |
7662 CASE(UIMSG_LoadSlot) | |
7663 CASE(UIMSG_SelectLoadSlot) | |
7664 CASE(UIMSG_Cancel) | |
7665 CASE(UIMSG_ExitRest) | |
7666 CASE(UIMSG_PlayerCreation_FacePrev) | |
7667 CASE(UIMSG_PlayerCreation_FaceNext) | |
7668 CASE(UIMSG_CycleCharacters) | |
7669 CASE(UIMSG_SetTurnSpeed) | |
7670 CASE(UIMSG_ToggleWalkSound) | |
7671 CASE(UIMSG_ChangeVoiceVolume) | |
7672 CASE(UIMSG_ToggleShowDamage) | |
7673 CASE(UIMSG_ScrollNPCPanel) | |
7674 CASE(UIMSG_ShowFinalWindow) | |
7675 CASE(UIMSG_OpenQuestBook) | |
7676 CASE(UIMSG_OpenAutonotes) | |
7677 CASE(UIMSG_OpenMapBook) | |
7678 CASE(UIMSG_OpenCalendar) | |
7679 CASE(UIMSG_OpenHistoryBook) | |
7680 CASE(UIMSG_ToggleAlwaysRun) | |
7681 CASE(UIMSG_ToggleFlipOnExit) | |
7682 CASE(UIMSG_Game_Action) | |
7683 CASE(UIMSG_OpenRestUI) | |
7684 CASE(UIMSG_TransitionUI_Confirm) | |
7685 CASE(UIMSG_OpenKeyMappingOptions) | |
7686 CASE(UIMSG_SelectKeyPage1) | |
7687 CASE(UIMSG_SelectKeyPage2) | |
7688 CASE(UIMSG_ResetKeyMapping) | |
7689 CASE(UIMSG_ChangeKeyButton) | |
7690 CASE(UIMSG_OpenVideoOptions) | |
7691 CASE(UIMSG_ToggleBloodsplats) | |
7692 CASE(UIMSG_ToggleColoredLights) | |
7693 CASE(UIMSG_ToggleTint) | |
7694 default: | |
7695 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7696 }; | |
7697 #undef CASE | |
7698 } | |
7699 | |
0 | 7700 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7701 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7702 { |
482 | 7703 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7704 if (uNumMessages < 40) |
7705 { | |
437 | 7706 files[uNumMessages] = file; |
7707 lines[uNumMessages] = line; | |
7708 | |
0 | 7709 pMessages[uNumMessages].eType = msg; |
7710 pMessages[uNumMessages].param = param; | |
7711 pMessages[uNumMessages++].field_8 = a4; | |
7712 } | |
7713 } | |
7714 | |
7715 //----- (0042EBBE) -------------------------------------------------------- | |
7716 int __fastcall sub_42EBBE(int a1, int a2) | |
7717 { | |
7718 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7719 } | |
7720 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7721 | |
7722 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7723 int stru193_math::Sin(int angle) |
0 | 7724 { |
323 | 7725 return Cos(angle - this->uIntegerHalfPi); |
0 | 7726 } |
7727 | |
7728 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7729 void _42ECB5_PlayerAttacksActor() |
0 | 7730 { |
271 | 7731 //unsigned int v0; // ebx@1 |
7732 //Player *v1; // esi@1 | |
7733 //bool result; // eax@1 | |
295 | 7734 //int v3; // edi@2 |
271 | 7735 //unsigned int v4; // eax@7 |
0 | 7736 char *v5; // eax@8 |
271 | 7737 //int v6; // ecx@9 |
7738 //signed int v7; // eax@16 | |
295 | 7739 //Actor *v8; // edi@20 |
0 | 7740 unsigned int v9; // ecx@21 |
295 | 7741 //char *v10; // eax@26 |
0 | 7742 char *v11; // eax@26 |
7743 unsigned int v12; // eax@47 | |
295 | 7744 //char *v13; // eax@47 |
7745 //char *v14; // eax@47 | |
7746 //unsigned int v15; // ebx@54 | |
7747 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7748 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7749 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7750 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7751 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7752 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7753 //int v22; // [sp-4h] [bp-40h]@24 | |
7754 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7755 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7756 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7757 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7758 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7759 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7760 //unsigned int *v28b; |
295 | 7761 //int v29; // [sp+24h] [bp-18h]@16 |
7762 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7763 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7764 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7765 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7766 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7767 |
271 | 7768 //v0 = uActiveCharacter; |
7769 //v27 = 6972 * uActiveCharacter; | |
7770 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7771 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7772 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7773 if (!player->CanAct()) | |
7774 return; | |
7775 | |
7776 pStru277->_427D48(uActiveCharacter); | |
295 | 7777 //v3 = 0; |
271 | 7778 if (pParty->Invisible()) |
7779 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7780 | |
7781 //v31 = player->pEquipment.uBow; | |
7782 int bow_idx = player->pEquipment.uBow; | |
7783 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7784 bow_idx = 0; | |
7785 | |
295 | 7786 //v32 = 0; |
7787 int wand_item_id = 0; | |
271 | 7788 //v33 = 0; |
7789 //v4 = v1->pEquipment.uMainHand; | |
7790 int laser_weapon_item_id = 0; | |
7791 | |
7792 int main_hand_idx = player->pEquipment.uMainHand; | |
7793 if (main_hand_idx) | |
0 | 7794 { |
271 | 7795 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7796 //v5 = (char *)v1 + 36 * v4; |
271 | 7797 if (!item->Broken()) |
7798 { | |
7799 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7800 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7801 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7802 { |
295 | 7803 if (item->uNumCharges <= 0) |
7804 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7805 else |
295 | 7806 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7807 } |
271 | 7808 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7809 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7810 } |
271 | 7811 } |
7812 | |
295 | 7813 //v30 = 0; |
7814 //v29 = 0; | |
7815 //v28 = 0; | |
271 | 7816 //v7 = pMouse->uPointingObjectID; |
7817 | |
7818 int target_pid = pMouse->uPointingObjectID; | |
7819 int target_type = target_pid & 7, | |
7820 target_id = target_pid >> 3; | |
7821 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) | |
7822 { | |
7823 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
7824 target_type = target_pid & 7; | |
7825 target_id = target_pid >> 3; | |
7826 } | |
295 | 7827 |
7828 auto actor = &pActors[target_id]; | |
7829 int actor_distance = 0; | |
271 | 7830 if (target_type == OBJECT_Actor) |
7831 { | |
295 | 7832 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7833 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7834 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7835 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7836 if (actor_distance < 0) | |
7837 actor_distance = 0; | |
7838 } | |
7839 | |
7840 bool shooting_bow = false, | |
7841 shotting_laser = false, | |
816 | 7842 shooting_wand = false, |
7843 melee_attack = false; | |
295 | 7844 if (laser_weapon_item_id) |
7845 { | |
7846 shotting_laser = true; | |
490 | 7847 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7848 } |
7849 else if (wand_item_id) | |
7850 { | |
7851 shooting_wand = true; | |
7852 | |
7853 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7854 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7855 |
7856 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7857 player->pEquipment.uMainHand = 0; | |
7858 } | |
303 | 7859 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7860 { |
816 | 7861 melee_attack = true; |
7862 | |
303 | 7863 Vec3_int_ a3; |
7864 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7865 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7866 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7867 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7868 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7869 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7870 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7871 _42FA66_do_explosive_impact( |
7872 actor->vPosition.x, | |
7873 actor->vPosition.y, | |
7874 actor->vPosition.z + actor->uActorHeight / 2, | |
7875 0, 512, uActiveCharacter); | |
303 | 7876 } |
7877 else if (bow_idx) | |
7878 { | |
7879 shooting_bow = true; | |
490 | 7880 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7881 } |
7882 else | |
7883 { | |
816 | 7884 melee_attack = true; |
303 | 7885 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7886 } | |
7887 | |
816 | 7888 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7889 { |
816 | 7890 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7891 if (recovery < 30 ) |
7892 recovery = 30; | |
816 | 7893 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7894 } |
7895 | |
7896 | |
7897 int v34 = 0; | |
7898 if (shooting_wand) | |
7899 return; | |
7900 else if (shooting_bow) | |
7901 { | |
7902 v34 = 5; | |
7903 player->PlaySound(SPEECH_50, 0); | |
7904 } | |
7905 if (shotting_laser) | |
7906 v34 = 7; | |
7907 else | |
7908 { | |
7909 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7910 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7911 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7912 pTurnEngine->_40471C(); | |
7913 } | |
7914 | |
7915 switch (v34) | |
7916 { | |
7917 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7918 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7919 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7920 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7921 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7922 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7923 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7924 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7925 } | |
0 | 7926 } |
7927 | |
7928 //----- (0042F184) -------------------------------------------------------- | |
295 | 7929 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7930 { |
7931 int v4; // edi@1 | |
7932 stru319 *v5; // esi@1 | |
7933 int v6; // eax@2 | |
7934 int v7; // eax@4 | |
7935 int result; // eax@5 | |
7936 int *v9; // edx@8 | |
7937 signed int v10; // ebx@10 | |
7938 int v11; // edi@11 | |
7939 Actor *v12; // esi@12 | |
7940 unsigned __int16 v13; // ax@12 | |
7941 int v14; // eax@22 | |
7942 char v15; // zf@30 | |
7943 int v16; // esi@32 | |
7944 int v17; // ecx@34 | |
7945 stru319 *v18; // eax@39 | |
7946 int v19; // edx@39 | |
7947 int v20; // ecx@41 | |
7948 unsigned __int16 v21; // ax@42 | |
7949 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7950 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7951 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7952 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7953 int *v26; // [sp+18h] [bp-14h]@8 | |
7954 int v27; // [sp+1Ch] [bp-10h]@10 | |
7955 int *v28; // [sp+20h] [bp-Ch]@10 | |
7956 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7957 int v30; // [sp+28h] [bp-4h]@6 | |
7958 int i; // [sp+38h] [bp+Ch]@33 | |
7959 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7960 | |
7961 v4 = 0; | |
7962 v5 = this; | |
7963 v24 = this; | |
7964 if ( pRenderer->pRenderD3D ) | |
7965 { | |
7966 v6 = a3 != 0; | |
7967 if ( a4 ) | |
7968 LOBYTE(v6) = v6 | 8; | |
295 | 7969 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7970 if ( v7 != -1 ) |
7971 return (unsigned __int16)v7; | |
295 | 7972 else return 0; |
0 | 7973 } |
7974 else | |
7975 { | |
7976 v30 = 0; | |
7977 if ( pRenderer->pActiveZBuffer ) | |
7978 { | |
692 | 7979 v29 = viewparams->uScreen_topL_X; |
7980 v23 = viewparams->uScreen_BttmR_X; | |
7981 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7982 { |
692 | 7983 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7984 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7985 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7986 do |
7987 { | |
7988 if ( (signed int)v29 < (signed int)v23 ) | |
7989 { | |
7990 v28 = v9; | |
7991 v10 = v4; | |
7992 v27 = v23 - v29; | |
7993 do | |
7994 { | |
7995 v22 = *v28; | |
7996 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7997 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 7998 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7999 v12 = &pActors[PID_ID(v11)]; |
0 | 8000 v13 = v12->uAIState; |
8001 if ( v13 != 5 ) | |
8002 { | |
8003 if ( v13 != 4 | |
8004 && v13 != 11 | |
8005 && v13 != 19 | |
8006 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8007 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 8008 { |
8009 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 8010 && v22 <= pick_depth << 16 ) |
0 | 8011 { |
8012 v14 = 0; | |
8013 if ( v10 > 0 ) | |
8014 { | |
8015 do | |
8016 { | |
8017 if ( dword_50BDA0[v14] == v11 ) | |
8018 break; | |
8019 ++v14; | |
8020 } | |
8021 while ( v14 < v30 ); | |
8022 } | |
8023 if ( v14 == v30 && v10 < 100 ) | |
8024 { | |
8025 ++v30; | |
8026 dword_50BC10[v10] = v22; | |
8027 dword_50BDA0[v10] = v11; | |
8028 ++v10; | |
8029 } | |
8030 } | |
8031 } | |
8032 } | |
8033 } | |
8034 ++v28; | |
8035 --v27; | |
8036 } | |
8037 while ( v27 ); | |
8038 v4 = v30; | |
8039 v5 = v24; | |
8040 } | |
8041 v9 = v26 + 640; | |
8042 v15 = v25-- == 1; | |
8043 v26 += 640; | |
8044 } | |
8045 while ( !v15 ); | |
8046 } | |
8047 if ( v4 > 0 ) | |
8048 { | |
8049 v32 = 1; | |
8050 v16 = (int)dword_50BC10; | |
8051 do | |
8052 { | |
8053 for ( i = v32; i < v4; ++i ) | |
8054 { | |
8055 v17 = dword_50BC10[i]; | |
8056 if ( v17 < *(int *)v16 ) | |
8057 { | |
8058 dword_50BC10[i] = *(int *)v16; | |
8059 *(int *)v16 = v17; | |
8060 } | |
8061 } | |
8062 ++v32; | |
8063 v16 += 4; | |
8064 } | |
8065 while ( v32 - 1 < v4 ); | |
8066 v5 = v24; | |
8067 if ( v4 > 0 ) | |
8068 { | |
8069 v18 = v24; | |
8070 v19 = v4; | |
8071 do | |
8072 { | |
8073 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8074 v18 += 4; | |
8075 --v19; | |
8076 } | |
8077 while ( v19 ); | |
8078 } | |
8079 } | |
8080 v20 = 0; | |
8081 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8082 { | |
8083 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8084 if ( v21 != 4 && v21 != 5 ) | |
8085 break; | |
8086 } | |
8087 if ( v20 != v4 ) | |
8088 { | |
8089 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8090 LOBYTE(result) = result | 3; | |
8091 return result; | |
8092 } | |
8093 } | |
8094 } | |
8095 return 0; | |
8096 } | |
8097 | |
8098 //----- (0042F3D6) -------------------------------------------------------- | |
8099 void InitializeTurnBasedAnimations(void *_this) | |
8100 { | |
8101 unsigned int *v1; // edi@1 | |
8102 | |
8103 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8104 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8105 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8106 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8107 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8108 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8109 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8110 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8111 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8112 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8113 v1 = pIconIDs_Turn; | |
8114 do | |
8115 { | |
8116 pIconsFrameTable->InitializeAnimation(*v1); | |
8117 ++v1; | |
8118 } | |
8119 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8120 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8121 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8122 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8123 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8124 } | |
8125 | |
8126 //----- (0042F4DA) -------------------------------------------------------- | |
8127 signed int __cdecl sub_42F4DA() | |
8128 { | |
8129 signed int v0; // edi@1 | |
82 | 8130 Actor *v1; // esi@4 |
0 | 8131 int v2; // ebx@5 |
8132 int v3; // eax@5 | |
8133 int v4; // ebx@5 | |
8134 unsigned int v5; // ecx@5 | |
8135 int v6; // edx@6 | |
8136 unsigned int v7; // edx@8 | |
8137 unsigned int v8; // edx@10 | |
8138 __int16 v9; // ax@12 | |
8139 signed int result; // eax@20 | |
8140 int v11; // [sp+Ch] [bp-10h]@5 | |
8141 int v12; // [sp+10h] [bp-Ch]@5 | |
8142 signed int v13; // [sp+14h] [bp-8h]@3 | |
8143 | |
8144 v0 = 5120; | |
8145 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8146 v0 = 2560; | |
8147 v13 = 0; | |
8148 if ( (signed int)uNumActors <= 0 ) | |
8149 { | |
8150 LABEL_20: | |
8151 result = 0; | |
8152 } | |
8153 else | |
8154 { | |
82 | 8155 v1 = pActors; |
0 | 8156 while ( 1 ) |
8157 { | |
82 | 8158 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8159 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8160 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8161 v3 = v2; |
8162 v4 = v11; | |
8163 v5 = v12; | |
8164 if ( v3 < v11 ) | |
8165 { | |
8166 v6 = v3; | |
8167 v3 = v11; | |
8168 v4 = v6; | |
8169 } | |
8170 if ( v3 < v12 ) | |
8171 { | |
8172 v7 = v3; | |
8173 v3 = v12; | |
8174 v5 = v7; | |
8175 } | |
8176 if ( v4 < (signed int)v5 ) | |
8177 { | |
8178 v8 = v5; | |
8179 v5 = v4; | |
8180 v4 = v8; | |
8181 } | |
8182 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8183 { | |
82 | 8184 v9 = v1->uAIState; |
8185 if ( v1->uAIState != 5 ) | |
0 | 8186 { |
8187 if ( v9 != 4 | |
8188 && v9 != 11 | |
8189 && v9 != 19 | |
8190 && v9 != 17 | |
82 | 8191 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8192 break; |
8193 } | |
8194 } | |
8195 ++v13; | |
82 | 8196 ++v1; |
0 | 8197 if ( v13 >= (signed int)uNumActors ) |
8198 goto LABEL_20; | |
8199 } | |
8200 result = 1; | |
8201 } | |
8202 return result; | |
8203 } | |
8204 | |
8205 //----- (0042F7EB) -------------------------------------------------------- | |
8206 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) | |
8207 { | |
8208 unsigned int v9; // edi@1 | |
8209 signed int v10; // edx@3 | |
8210 char *v11; // ecx@4 | |
8211 unsigned __int16 v12; // ax@7 | |
8212 unsigned int v13; // edx@9 | |
8213 char *v14; // ecx@10 | |
8214 int v15; // esi@17 | |
8215 int v16; // eax@18 | |
8216 int v17; // edi@20 | |
8217 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8218 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8219 int v21; // [sp+7Ch] [bp-8h]@1 |
8220 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8221 | |
8222 v9 = uSpriteID; | |
8223 v21 = x; | |
8224 v22 = uSpriteID; | |
8225 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8226 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
|
8227 //SpriteObject::SpriteObject(&a1a); |
0 | 8228 a1a.stru_24.Reset(); |
8229 | |
8230 if ( a9 ) | |
8231 { | |
8232 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8233 v9 = v22; | |
8234 } | |
8235 v10 = 0; | |
822 | 8236 a1a.spell_skill = 0; |
8237 a1a.spell_level = 0; | |
8238 a1a.spell_id = 0; | |
0 | 8239 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8240 a1a.uType = v9; |
0 | 8241 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8242 { | |
8243 LABEL_7: | |
8244 v12 = 0; | |
8245 } | |
8246 else | |
8247 { | |
8248 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8249 while ( (short)v9 != *(short *)v11 ) | |
8250 { | |
8251 ++v10; | |
8252 v11 += 56; | |
8253 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8254 goto LABEL_7; | |
8255 } | |
8256 v12 = v10; | |
8257 } | |
8258 a1a.uObjectDescID = v12; | |
8259 a1a.vPosition.z = z; | |
8260 a1a.vPosition.x = v21; | |
8261 a1a.vPosition.y = y; | |
8262 a1a.uSoundID = 0; | |
8263 a1a.uAttributes = attributes; | |
8264 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8265 a1a.uSpriteFrameID = 0; | |
822 | 8266 a1a.spell_caster_pid = 0; |
823 | 8267 a1a.spell_target_pid = 0; |
0 | 8268 if ( !(a1a.uAttributes & 0x10) ) |
8269 { | |
8270 v13 = 0; | |
222 | 8271 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8272 { |
8273 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8274 while ( *(short *)v14 != v9 ) | |
8275 { | |
8276 ++v13; | |
8277 v14 += 48; | |
222 | 8278 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8279 goto LABEL_16; |
8280 } | |
8281 a1a.stru_24.uItemID = v13; | |
8282 } | |
8283 } | |
8284 LABEL_16: | |
8285 if ( a7 ) | |
8286 { | |
8287 v15 = count; | |
8288 if ( count > 0 ) | |
8289 { | |
8290 do | |
8291 { | |
8292 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8293 v16 = rand(); | |
8294 a1a.Create( | |
8295 (signed __int16)a1a.uFacing, | |
8296 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8297 a4, | |
8298 0); | |
8299 --v15; | |
8300 } | |
8301 while ( v15 ); | |
8302 } | |
8303 } | |
8304 else | |
8305 { | |
8306 v17 = count; | |
8307 v18 = stru_5C6E00->uIntegerHalfPi; | |
8308 a1a.uFacing = 0; | |
8309 if ( count > 0 ) | |
8310 { | |
8311 do | |
8312 { | |
8313 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8314 --v17; | |
8315 } | |
8316 while ( v17 ); | |
8317 } | |
8318 } | |
8319 return 1; | |
8320 } | |
8321 | |
8322 //----- (0042F960) -------------------------------------------------------- | |
8323 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8324 { | |
8325 int v3; // ebx@1 | |
8326 int v4; // edi@1 | |
8327 signed int v5; // edx@1 | |
8328 char *v6; // ecx@2 | |
8329 unsigned __int16 v7; // ax@5 | |
8330 signed int v8; // eax@6 | |
8331 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8332 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8333 |
8334 v3 = x; | |
8335 v4 = y; | |
8336 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8337 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
|
8338 //SpriteObject::SpriteObject(&a1); |
0 | 8339 a1.stru_24.Reset(); |
8340 | |
8341 v5 = 0; | |
822 | 8342 a1.spell_skill = 0; |
8343 a1.spell_level = 0; | |
8344 a1.spell_id = 0; | |
0 | 8345 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8346 a1.uType = 800; |
0 | 8347 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8348 { | |
8349 LABEL_5: | |
8350 v7 = 0; | |
8351 } | |
8352 else | |
8353 { | |
8354 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8355 while ( *(short *)v6 != 800 ) | |
8356 { | |
8357 ++v5; | |
8358 v6 += 56; | |
8359 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8360 goto LABEL_5; | |
8361 } | |
8362 v7 = v5; | |
8363 } | |
8364 a1.uObjectDescID = v7; | |
8365 a1.vPosition.x = v3; | |
8366 a1.vPosition.y = v4; | |
8367 a1.vPosition.z = z; | |
8368 a1.uSoundID = 0; | |
8369 a1.uAttributes = 0; | |
8370 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8371 a1.uSpriteFrameID = 0; | |
822 | 8372 a1.spell_caster_pid = 0; |
823 | 8373 a1.spell_target_pid = 0; |
0 | 8374 v8 = a1.Create(0, 0, 0, 0); |
8375 if ( v8 != -1 ) | |
8376 { | |
8377 v9 = 8 * v8; | |
8378 LOBYTE(v9) = v9 | 2; | |
8379 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8380 } | |
8381 } | |
8382 | |
810 | 8383 |
0 | 8384 |
8385 //----- (0042FA66) -------------------------------------------------------- | |
8386 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8387 { | |
8388 int v6; // edi@1 | |
8389 int v7; // esi@1 | |
8390 char *v8; // ecx@2 | |
8391 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8392 //int v10; // eax@10 |
0 | 8393 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8394 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8395 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8396 int v14; // [sp+7Ch] [bp-4h]@1 |
8397 | |
8398 v6 = a1; | |
8399 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8400 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
|
8401 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8402 a1a.uType = 600; |
0 | 8403 a1a.stru_24.Reset(); |
8404 | |
822 | 8405 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8406 a1a.spell_level = 8; | |
8407 a1a.spell_skill = 3; | |
0 | 8408 v14 = 0; |
8409 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8410 { | |
8411 LABEL_5: | |
8412 v9 = 0; | |
8413 } | |
8414 else | |
8415 { | |
8416 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8417 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8418 { |
8419 ++v14; | |
8420 v8 += 56; | |
8421 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8422 goto LABEL_5; | |
8423 } | |
8424 v9 = v14; | |
8425 } | |
8426 a1a.uObjectDescID = v9; | |
8427 a1a.vPosition.x = v6; | |
8428 a1a.vPosition.y = v7; | |
8429 a1a.vPosition.z = a3; | |
8430 a1a.uAttributes = 0; | |
8431 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8432 a1a.uSpriteFrameID = 0; | |
823 | 8433 a1a.spell_target_pid = 0; |
0 | 8434 a1a.field_60_distance_related_prolly_lod = 0; |
8435 a1a.uFacing = 0; | |
8436 a1a.uSoundID = 0; | |
8437 if ( a6 >= 1 || a6 <= 4 ) | |
8438 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8439 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8440 } |
8441 else | |
8442 { | |
822 | 8443 a1a.spell_caster_pid = 0; |
0 | 8444 } |
8445 result = a1a.Create(0, 0, 0, 0); | |
8446 if ( result != -1 ) | |
8447 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8448 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8449 a5, |
8450 SLOWORD(a1a.vPosition.x), | |
8451 SLOWORD(a1a.vPosition.y), | |
8452 SLOWORD(a1a.vPosition.z), | |
8453 0, | |
8454 0); | |
8455 } | |
8456 return result; | |
8457 } | |
8458 | |
8459 //----- (0042FB5C) -------------------------------------------------------- | |
8460 bool __fastcall sub_42FB5C(signed int a1) | |
8461 { | |
8462 int v1; // ecx@3 | |
8463 int v2; // ecx@4 | |
8464 int v3; // ecx@5 | |
8465 int v4; // ecx@6 | |
8466 int v5; // ecx@7 | |
8467 int v6; // ecx@8 | |
8468 char v7; // zf@9 | |
8469 | |
8470 if ( a1 > 39 ) | |
8471 { | |
8472 if ( a1 > 77 ) | |
8473 { | |
8474 if ( a1 == 80 ) | |
8475 return 0; | |
8476 if ( a1 > 84 ) | |
8477 { | |
8478 if ( a1 <= 86 ) | |
8479 return 0; | |
8480 v7 = a1 == 95; | |
8481 goto LABEL_20; | |
8482 } | |
8483 } | |
8484 else | |
8485 { | |
8486 if ( a1 == 77 ) | |
8487 return 0; | |
8488 if ( a1 >= 46 ) | |
8489 { | |
8490 if ( a1 <= 47 || a1 == 51 ) | |
8491 return 0; | |
8492 v7 = a1 == 73; | |
8493 goto LABEL_20; | |
8494 } | |
8495 } | |
8496 return 1; | |
8497 } | |
8498 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8499 return 1; | |
8500 v2 = v1 - 3; | |
8501 if ( !v2 ) | |
8502 return 0; | |
8503 v3 = v2 - 1; | |
8504 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8505 return 1; | |
8506 v5 = v4 - 8; | |
8507 if ( !v5 ) | |
8508 return 0; | |
8509 v6 = v5 - 1; | |
8510 if ( !v6 ) | |
8511 return 1; | |
8512 v7 = v6 == 20; | |
8513 LABEL_20: | |
8514 if ( !v7 ) | |
8515 return 1; | |
8516 return 0; | |
8517 } | |
8518 | |
8519 //----- (0042FBDD) -------------------------------------------------------- | |
8520 void __cdecl sub_42FBDD() | |
8521 { | |
388 | 8522 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8523 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8524 pRenderer->Present(); | |
8525 } | |
8526 | |
8527 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8528 void __cdecl CloseWindowBackground() |
0 | 8529 { |
388 | 8530 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8531 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8532 pRenderer->Present(); | |
8533 } | |
8534 | |
8535 //----- (0042FC4E) -------------------------------------------------------- | |
8536 void __cdecl ProcessInputActions() | |
8537 { | |
8538 ActionQueue *pActionQueue; // esi@7 | |
8539 Keyboard *v3; // ecx@8 | |
8540 char v4; // al@9 | |
8541 ActionQueue *v5; // ecx@19 | |
8542 Player *v6; // ecx@86 | |
8543 Player *v7; // esi@100 | |
8544 char v8; // bl@100 | |
8545 unsigned __int16 v9; // ax@102 | |
8546 int v10; // eax@103 | |
8547 unsigned int v11; // eax@127 | |
8548 signed int v12; // esi@157 | |
8549 Keyboard *v13; // ecx@158 | |
8550 char v14; // al@159 | |
8551 unsigned int v15; // eax@168 | |
8552 void *v16; // esi@177 | |
8553 int v17; // [sp-14h] [bp-1Ch]@8 | |
8554 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8555 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 | |
271 | 8556 //__int16 v20; // [sp-14h] [bp-1Ch]@60 |
0 | 8557 int v21; // [sp-14h] [bp-1Ch]@68 |
8558 int v22; // [sp-Ch] [bp-14h]@158 | |
8559 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8560 int v24; // [sp+4h] [bp-4h]@87 | |
8561 | |
8562 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8563 auto pKeyboard = pGame->pKeyboardInstance; | |
8564 if (!bAlwaysRun) | |
8565 { | |
8566 if (pKeyboard->IsShiftHeld()) | |
8567 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8568 else | |
8569 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8570 } | |
8571 else | |
8572 { | |
8573 if (pKeyboard->IsShiftHeld()) | |
8574 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8575 else | |
8576 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8577 } | |
8578 | |
140 | 8579 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
486 | 8580 //LABEL_6: |
0 | 8581 if ( !pEventTimer->bPaused ) |
8582 { | |
8583 inputAction = (InputAction)0; | |
8584 pActionQueue = pPartyActionQueue; | |
8585 while ( 1 ) | |
8586 { | |
8587 v3 = pGame->pKeyboardInstance; | |
8588 v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; | |
8589 if ( pKeyActionMap->pToggleTypes[inputAction] ) | |
8590 v4 = v3->WasKeyPressed(v17); | |
8591 else | |
8592 v4 = v3->IsKeyBeingHeld(v17); | |
8593 if ( v4 ) | |
8594 { | |
8595 switch ( inputAction ) | |
8596 { | |
8597 case INPUT_MoveForward: | |
271 | 8598 if (pCurrentScreen != SCREEN_GAME) |
0 | 8599 break; |
8600 if (!pParty->bTurnBasedModeOn) | |
163 | 8601 //goto _do_move_forward; |
0 | 8602 { |
8603 v5 = pActionQueue; | |
140 | 8604 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8605 partyAction = PARTY_RunForward; |
8606 else | |
8607 partyAction = PARTY_WalkForward; | |
163 | 8608 //goto _add_action_and_continue; |
8609 v5->Add(partyAction); | |
8610 break; | |
8611 } | |
8612 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8613 { | |
8614 pTurnEngine->uActionPointsLeft -= 26; | |
8615 //_do_move_forward: | |
8616 v5 = pActionQueue; | |
8617 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8618 partyAction = PARTY_RunForward; | |
8619 else | |
8620 partyAction = PARTY_WalkForward; | |
8621 //goto _add_action_and_continue; | |
8622 v5->Add(partyAction); | |
8623 break; | |
0 | 8624 } |
8625 break; | |
8626 case INPUT_MoveBackwards: | |
17 | 8627 //__debugbreak(); |
271 | 8628 if (pCurrentScreen != SCREEN_GAME) |
0 | 8629 break; |
8630 if (!pParty->bTurnBasedModeOn) | |
17 | 8631 //goto _do_move_backwards; |
8632 { | |
8633 v5 = pActionQueue; | |
8634 if ( pParty->uFlags2 & 2 ) | |
8635 partyAction = PARTY_RunBackward; | |
8636 else | |
8637 partyAction = PARTY_WalkBackward; | |
163 | 8638 //goto _add_action_and_continue; |
8639 v5->Add(partyAction); | |
8640 break; | |
17 | 8641 } |
0 | 8642 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8643 { | |
8644 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8645 //_do_move_backwards: |
0 | 8646 v5 = pActionQueue; |
8647 if ( pParty->uFlags2 & 2 ) | |
8648 partyAction = PARTY_RunBackward; | |
8649 else | |
8650 partyAction = PARTY_WalkBackward; | |
163 | 8651 //goto _add_action_and_continue; |
8652 v5->Add(partyAction); | |
8653 break; | |
0 | 8654 } |
8655 break; | |
8656 case INPUT_StrafeLeft: | |
17 | 8657 //__debugbreak(); |
271 | 8658 if (pCurrentScreen != SCREEN_GAME) |
0 | 8659 break; |
8660 if (!pParty->bTurnBasedModeOn) | |
17 | 8661 //goto _do_strafe_left; |
8662 { | |
8663 partyAction = PARTY_StrafeLeft; | |
163 | 8664 //goto _add_action_and_continue_; |
8665 v5 = pActionQueue; | |
8666 v5->Add(partyAction); | |
8667 break; | |
17 | 8668 } |
0 | 8669 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8670 break; | |
8671 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8672 //_do_strafe_left: |
0 | 8673 partyAction = PARTY_StrafeLeft; |
163 | 8674 //goto _add_action_and_continue_; |
8675 v5 = pActionQueue; | |
8676 v5->Add(partyAction); | |
8677 break; | |
0 | 8678 case INPUT_StrafeRight: |
17 | 8679 //__debugbreak(); |
271 | 8680 if (pCurrentScreen != SCREEN_GAME) |
0 | 8681 break; |
8682 if (!pParty->bTurnBasedModeOn) | |
17 | 8683 //goto _do_strafe_right; |
8684 { | |
8685 partyAction = PARTY_StrafeRight; | |
163 | 8686 //goto _add_action_and_continue_; |
8687 v5 = pActionQueue; | |
8688 v5->Add(partyAction); | |
8689 break; | |
17 | 8690 } |
0 | 8691 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8692 break; | |
8693 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8694 //_do_strafe_right: |
0 | 8695 partyAction = PARTY_StrafeRight; |
163 | 8696 //goto _add_action_and_continue_; |
8697 v5 = pActionQueue; | |
8698 v5->Add(partyAction); | |
8699 break; | |
0 | 8700 case INPUT_TurnLeft: |
271 | 8701 if (pCurrentScreen != SCREEN_GAME) |
0 | 8702 break; |
8703 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8704 { | |
8705 if (pParty->bTurnBasedModeOn) | |
8706 { | |
8707 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8708 break; | |
8709 pTurnEngine->uActionPointsLeft -= 26; | |
8710 } | |
8711 partyAction_ = PARTY_StrafeLeft; | |
8712 } | |
8713 else | |
8714 { | |
8715 if ( pParty->uFlags2 & 2 ) | |
8716 partyAction_ = PARTY_FastTurnLeft; | |
8717 else | |
8718 partyAction_ = PARTY_TurnLeft; | |
8719 } | |
8720 pActionQueue->Add(partyAction_); | |
8721 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8722 { | |
271 | 8723 pWeather->OnPlayerTurn(10); |
0 | 8724 } |
8725 break; | |
8726 case INPUT_TurnRight: | |
271 | 8727 if (pCurrentScreen != SCREEN_GAME) |
0 | 8728 break; |
8729 if ( GetAsyncKeyState(17) ) // strafing | |
8730 { | |
8731 if (pParty->bTurnBasedModeOn) | |
8732 { | |
8733 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8734 break; | |
8735 pTurnEngine->uActionPointsLeft -= 26; | |
8736 } | |
271 | 8737 v21 = PARTY_StrafeRight; |
0 | 8738 } |
8739 else | |
8740 { | |
8741 if ( pParty->uFlags2 & 2 ) | |
271 | 8742 v21 = PARTY_FastTurnRight; |
0 | 8743 else |
271 | 8744 v21 = PARTY_TurnRight; |
0 | 8745 } |
8746 pActionQueue->Add((PartyAction)v21); | |
8747 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8748 { | |
271 | 8749 pWeather->OnPlayerTurn(-10); |
0 | 8750 } |
8751 break; | |
8752 case INPUT_Jump: | |
17 | 8753 //__debugbreak(); |
271 | 8754 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8755 break; |
8756 partyAction = (PartyAction)12; | |
163 | 8757 //goto _add_action_and_continue_; |
8758 v5 = pActionQueue; | |
8759 v5->Add(partyAction); | |
8760 break; | |
0 | 8761 case INPUT_Yell: |
187 | 8762 if (!pCurrentScreen && uActiveCharacter) |
0 | 8763 { |
8764 pParty->Yell(); | |
187 | 8765 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8766 } |
187 | 8767 break; |
0 | 8768 case INPUT_Pass: |
17 | 8769 //__debugbreak(); |
0 | 8770 if ( pCurrentScreen ) |
8771 break; | |
8772 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8773 //goto LABEL_118; |
8774 { | |
8775 pTurnEngine->field_18 |= 8u; | |
8776 break; | |
8777 } | |
0 | 8778 if ( uActiveCharacter ) |
8779 { | |
8780 v6 = pPlayers[uActiveCharacter]; | |
8781 if ( !v6->uTimeToRecovery ) | |
8782 { | |
816 | 8783 v24 = v6->GetAttackRecoveryTime(false); |
0 | 8784 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8785 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
0 | 8786 pStru277->_427D48(uActiveCharacter); |
8787 pTurnEngine->_40471C(); | |
8788 } | |
8789 } | |
8790 break; | |
8791 case INPUT_Combat: | |
17 | 8792 //__debugbreak(); |
271 | 8793 if (pCurrentScreen == SCREEN_GAME) |
0 | 8794 { |
8795 if (pParty->bTurnBasedModeOn) | |
8796 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8797 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8798 { |
8799 pParty->bTurnBasedModeOn = 0; | |
8800 pTurnEngine->End(true); | |
8801 } | |
8802 } | |
8803 else | |
8804 { | |
8805 pTurnEngine->Start(); | |
8806 pParty->bTurnBasedModeOn = true; | |
8807 } | |
8808 } | |
8809 break; | |
8810 case INPUT_CastReady: | |
17 | 8811 //__debugbreak(); |
271 | 8812 if (pCurrentScreen != SCREEN_GAME) |
0 | 8813 break; |
8814 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8815 //goto LABEL_118; |
8816 { | |
8817 pTurnEngine->field_18 |= 8u; | |
8818 break; | |
8819 } | |
0 | 8820 if ( !uActiveCharacter ) |
8821 break; | |
8822 v7 = pPlayers[uActiveCharacter]; | |
8823 v8 = v7->uQuickSpell; | |
8824 if ( !v8 | |
8825 || bUnderwater | |
8826 || ((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)), | |
8827 v10 > v7->sMana) ) | |
8828 { | |
8829 pActionQueue = pPartyActionQueue; | |
8830 LABEL_120: | |
437 | 8831 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8832 break; | |
8833 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8834 { |
271 | 8835 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; |
163 | 8836 //goto _send_message; |
8837 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8838 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8839 ++pMessageQueue_50CBD0->uNumMessages; | |
8840 break; | |
437 | 8841 }*/ |
0 | 8842 } |
8843 else | |
8844 { | |
8845 pActionQueue = pPartyActionQueue; | |
8846 if ( dword_50C9E8 < 40 ) | |
8847 { | |
8848 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8849 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8850 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8851 ++dword_50C9E8; |
8852 } | |
8853 } | |
8854 break; | |
8855 case INPUT_Attack: | |
17 | 8856 //__debugbreak(); |
271 | 8857 if (pCurrentScreen != SCREEN_GAME) |
0 | 8858 break; |
8859 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) | |
8860 goto LABEL_120; | |
17 | 8861 //LABEL_118: |
0 | 8862 pTurnEngine->field_18 |= 8u; |
8863 break; | |
8864 case INPUT_EventTrigger: | |
271 | 8865 if (pCurrentScreen == SCREEN_GAME) |
0 | 8866 { |
437 | 8867 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8868 break; |
271 | 8869 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; |
163 | 8870 //goto _send_message; |
8871 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8872 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8873 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8874 break;*/ |
8875 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
163 | 8876 break; |
0 | 8877 } |
151 | 8878 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8879 { |
8880 v11 = pMessageQueue_50CBD0->uNumMessages; | |
8881 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8882 { | |
437 | 8883 v11 = 0; |
8884 pMessageQueue_50CBD0->uNumMessages = 0; | |
0 | 8885 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8886 { | |
8887 v11 = 1; | |
8888 pMessageQueue_50CBD0->uNumMessages = 1; | |
163 | 8889 //LABEL_132: |
271 | 8890 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8891 //_send_message: |
0 | 8892 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8893 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8894 ++pMessageQueue_50CBD0->uNumMessages; | |
8895 break; | |
8896 } | |
437 | 8897 break; |
0 | 8898 } |
437 | 8899 /*if ( (signed int)v11 < 40 ) |
163 | 8900 //goto LABEL_132; |
8901 { | |
271 | 8902 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 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; | |
437 | 8907 }*/ |
8908 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 8909 } |
8910 break; | |
8911 case INPUT_CharCycle: | |
17 | 8912 //__debugbreak(); |
151 | 8913 if ( pCurrentScreen == SCREEN_SPELL_BOOK |
0 | 8914 || dword_50C9E8 >= 40 ) |
8915 break; | |
8916 dword_50C9EC[3 * dword_50C9E8] = 176; | |
163 | 8917 //goto LABEL_155; |
437 | 8918 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8919 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8920 ++dword_50C9E8; |
8921 break; | |
0 | 8922 case INPUT_LookUp: |
17 | 8923 //__debugbreak(); |
0 | 8924 if ( pEventTimer->bPaused ) |
8925 break; | |
8926 partyAction = (PartyAction)7; | |
163 | 8927 //goto _add_action_and_continue_; |
8928 v5 = pActionQueue; | |
8929 v5->Add(partyAction); | |
8930 break; | |
0 | 8931 case INPUT_CenterView: |
17 | 8932 //__debugbreak(); |
0 | 8933 if ( pEventTimer->bPaused ) |
8934 break; | |
8935 partyAction = (PartyAction)9; | |
163 | 8936 //goto _add_action_and_continue_; |
8937 v5 = pActionQueue; | |
8938 v5->Add(partyAction); | |
8939 break; | |
0 | 8940 case INPUT_LookDown: |
17 | 8941 //__debugbreak(); |
0 | 8942 if ( pEventTimer->bPaused ) |
8943 break; | |
8944 partyAction = (PartyAction)8; | |
163 | 8945 //goto _add_action_and_continue_; |
8946 v5 = pActionQueue; | |
8947 v5->Add(partyAction); | |
8948 break; | |
0 | 8949 case INPUT_FlyUp: |
17 | 8950 //__debugbreak(); |
0 | 8951 if ( pCurrentScreen |
8952 || pEventTimer->bPaused ) | |
8953 break; | |
8954 partyAction = (PartyAction)13; | |
163 | 8955 //goto _add_action_and_continue_; |
8956 v5 = pActionQueue; | |
8957 v5->Add(partyAction); | |
8958 break; | |
0 | 8959 case INPUT_Land: |
17 | 8960 //__debugbreak(); |
0 | 8961 if ( pCurrentScreen |
8962 || pEventTimer->bPaused ) | |
8963 break; | |
8964 partyAction = (PartyAction)15; | |
163 | 8965 //goto _add_action_and_continue_; |
8966 v5 = pActionQueue; | |
8967 v5->Add(partyAction); | |
8968 break; | |
0 | 8969 case INPUT_FlyDown: |
17 | 8970 //__debugbreak(); |
0 | 8971 if ( !pCurrentScreen |
8972 && !pEventTimer->bPaused ) | |
8973 { | |
8974 partyAction = (PartyAction)14; | |
163 | 8975 //_add_action_and_continue_: |
0 | 8976 v5 = pActionQueue; |
163 | 8977 //_add_action_and_continue: |
0 | 8978 v5->Add(partyAction); |
8979 } | |
8980 break; | |
8981 case INPUT_ZoomIn: | |
17 | 8982 //__debugbreak(); |
0 | 8983 if ( dword_50C9E8 >= 40 ) |
8984 break; | |
8985 dword_50C9EC[3 * dword_50C9E8] = 367; | |
163 | 8986 //goto LABEL_155; |
437 | 8987 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8988 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8989 ++dword_50C9E8; |
8990 break; | |
0 | 8991 case INPUT_ZoomOut: |
17 | 8992 //__debugbreak(); |
0 | 8993 if ( dword_50C9E8 < 40 ) |
8994 { | |
8995 dword_50C9EC[3 * dword_50C9E8] = 368; | |
163 | 8996 //LABEL_155: |
437 | 8997 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8998 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8999 ++dword_50C9E8; |
9000 } | |
9001 break; | |
9002 case INPUT_AlwaysRun: | |
9003 bAlwaysRun = bAlwaysRun == 0; | |
9004 break; | |
17 | 9005 default: |
9006 //__debugbreak(); | |
9007 break; | |
0 | 9008 } |
9009 } | |
9010 inputAction = (InputAction)((int)inputAction + 1); | |
9011 if ( (signed int)inputAction >= 30 ) | |
9012 goto LABEL_176; | |
9013 } | |
9014 } | |
9015 v12 = 0; | |
9016 do | |
9017 { | |
9018 v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; | |
9019 v13 = pGame->pKeyboardInstance; | |
9020 if ( pKeyActionMap->pToggleTypes[v12] ) | |
9021 v14 = v13->WasKeyPressed(v22); | |
9022 else | |
9023 v14 = v13->IsKeyBeingHeld(v22); | |
9024 if ( v14 && v12 == 9 ) | |
9025 { | |
9026 if ( !pCurrentScreen ) | |
9027 { | |
437 | 9028 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9029 goto LABEL_175; |
9030 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; | |
17 | 9031 //goto LABEL_174; |
9032 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9033 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9034 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9035 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
17 | 9036 goto LABEL_175; |
0 | 9037 } |
151 | 9038 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE |
9039 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
0 | 9040 { |
9041 v15 = pMessageQueue_50CBD0->uNumMessages; | |
9042 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9043 { | |
9044 v15 = 0; | |
9045 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
9046 { | |
9047 v15 = 1; | |
437 | 9048 pMessageQueue_50CBD0->uNumMessages = 0; |
17 | 9049 //goto LABEL_173; |
437 | 9050 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; |
17 | 9051 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9052 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9053 ++pMessageQueue_50CBD0->uNumMessages; | |
9054 goto LABEL_175; | |
0 | 9055 } |
9056 pMessageQueue_50CBD0->uNumMessages = 0; | |
9057 } | |
437 | 9058 /*if ( (signed int)v15 >= 40 ) |
0 | 9059 goto LABEL_175; |
17 | 9060 //LABEL_173: |
0 | 9061 pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; |
17 | 9062 //LABEL_174: |
0 | 9063 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9064 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9065 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9066 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 9067 goto LABEL_175; |
9068 } | |
9069 } | |
9070 LABEL_175: | |
9071 ++v12; | |
9072 } | |
9073 while ( v12 < 30 ); | |
9074 LABEL_176: | |
9075 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
9076 { | |
9077 AsyncKeyboard::LeaveCriticalSection(); | |
9078 v16 = pAsyncKeyboard; | |
9079 AsyncKeyboard::EnterCriticalSection(); | |
9080 memset((char *)v16 + 521, 0, 0x100u); | |
9081 AsyncKeyboard::LeaveCriticalSection(); | |
9082 } | |
9083 } |